diff options
Diffstat (limited to 'runtime')
128 files changed, 6602 insertions, 4592 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 4a90c11734..cad8da6ffb 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -35,7 +35,7 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS} COMMAND "${PROJECT_BINARY_DIR}/bin/nvim" -u NONE -i NONE - -es + -e --headless -c "helptags ++t ." -c quit diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 49663d7e5a..0dfcc424e2 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -11,6 +11,8 @@ catch /E145:/ " Ignore the error in restricted mode endtry +" Load man page {page} from {section} +" call man#get_page([{section}, ]{page}) function man#get_page(...) abort let invoked_from_man = (&filetype ==# 'man') @@ -20,21 +22,14 @@ function man#get_page(...) abort elseif a:0 > 2 echoerr 'too many arguments' return - elseif a:0 == 2 - let [page, sect] = [a:2, 0 + a:1] - elseif type(1) == type(a:1) - let [page, sect] = ['<cword>', a:1] - else - let [page, sect] = [a:1, ''] endif - if page == '<cword>' - let page = expand('<cword>') - endif + let sect = get(a:000, 0) + let page = get(a:000, 1, sect) let [page, sect] = s:parse_page_and_section(sect, page) - if 0 + sect > 0 && s:find_page(sect, page) == 0 + if !empty(sect) && s:find_page(sect, page) == 0 let sect = '' endif @@ -54,9 +49,9 @@ function man#get_page(...) abort let thiswin = winnr() wincmd b if winnr() > 1 - exe "norm! " . thiswin . "\<C-W>w" + exec thiswin . 'wincmd w' while 1 - if &filetype == 'man' + if &filetype ==# 'man' break endif wincmd w @@ -80,11 +75,11 @@ function man#get_page(...) abort endif silent exec 'r!/usr/bin/man '.s:cmd(sect, page).' | col -b' " Remove blank lines from top and bottom. - while getline(1) =~ '^\s*$' - silent keepjumps norm! gg"_dd + while getline(1) =~# '^\s*$' + silent keepjumps 1delete _ endwhile - while getline('$') =~ '^\s*$' - silent keepjumps norm! G"_dd + while getline('$') =~# '^\s*$' + silent keepjumps $delete _ endwhile setlocal nomodified setlocal filetype=man @@ -118,15 +113,11 @@ endfunction " Expects a string like 'access' or 'access(2)'. function s:parse_page_and_section(sect, str) abort try - let save_isk = &iskeyword - setlocal iskeyword-=(,) - let page = substitute(a:str, '(*\(\k\+\).*', '\1', '') - let sect = substitute(a:str, '\(\k\+\)(\([^()]*\)).*', '\2', '') - if sect == page || -1 == match(sect, '^[0-9 ]\+$') + let [page, sect] = matchlist(a:str, '\v\C([-.[:alnum:]_]+)%(\(([-.[:alnum:]_]+)\))?')[1:2] + if empty(sect) let sect = a:sect endif catch - let &l:iskeyword = save_isk echoerr 'man.vim: failed to parse: "'.a:str.'"' endtry @@ -134,7 +125,7 @@ function s:parse_page_and_section(sect, str) abort endfunction function s:cmd(sect, page) abort - if 0 + a:sect > 0 + if !empty(a:sect) return s:man_sect_arg.' '.a:sect.' '.a:page endif return a:page @@ -142,10 +133,5 @@ endfunction function s:find_page(sect, page) abort let where = system('/usr/bin/man '.s:man_find_arg.' '.s:cmd(a:sect, a:page)) - if where !~ "^/" - if matchstr(where, " [^ ]*$") !~ "^ /" - return 0 - endif - endif - return 1 + return (where =~# '^ */') endfunction diff --git a/runtime/autoload/msgpack.vim b/runtime/autoload/msgpack.vim index e6022922fe..2e2697c57f 100644 --- a/runtime/autoload/msgpack.vim +++ b/runtime/autoload/msgpack.vim @@ -356,6 +356,8 @@ let s:MSGPACK_STANDARD_TYPES = { \type(''): 'binary', \type([]): 'array', \type({}): 'map', + \type(v:true): 'boolean', + \type(v:null): 'nil', \} "" @@ -379,7 +381,7 @@ endfunction "" " Dump boolean value. function s:msgpack_dump_boolean(v) abort - return a:v._VAL ? 'TRUE' : 'FALSE' + return (a:v is v:true || (a:v isnot v:false && a:v._VAL)) ? 'TRUE' : 'FALSE' endfunction "" @@ -395,7 +397,8 @@ endfunction "" " Dump floating-point value. function s:msgpack_dump_float(v) abort - return string(type(a:v) == type({}) ? a:v._VAL : a:v) + return substitute(string(type(a:v) == type({}) ? a:v._VAL : a:v), + \'\V\^\(-\)\?str2float(''\(inf\|nan\)'')\$', '\1\2', '') endfunction "" diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 42439a57d3..53668b15be 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: Jan 05, 2015 -" Version: 153 +" Date: Oct 23, 2015 +" Version: 154 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1 +" Copyright: Copyright (C) 1999-2015 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -13,7 +13,7 @@ " expressed or implied. By using this plugin, you agree that " in no event will the copyright holder be liable for any damages " resulting from the use of this software. -"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore() +"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore(,'~'.expand("<slnum>")) " " But be doers of the Word, and not only hearers, deluding your own selves {{{1 " (James 1:22 RSV) @@ -22,14 +22,15 @@ if &cp || exists("g:loaded_netrw") finish endif +" netrw requires vim having patch 213; netrw will benefit from vim's having patch#656, too if v:version < 704 || !has("patch213") if !exists("s:needpatch213") - echo "***sorry*** this version of netrw requires vim v7.4 with patch 213" + unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch 213" endif let s:needpatch213= 1 finish endif -let g:loaded_netrw = "v153" +let g:loaded_netrw = "v154" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -38,9 +39,9 @@ endif let s:keepcpo= &cpo setl cpo&vim -"let g:dechofuncname=1 +"let g:dechofuncname= 1 "DechoRemOn -"call Decho("doing autoload/netrw.vim version ".g:loaded_netrw) +"call Decho("doing autoload/netrw.vim version ".g:loaded_netrw,'~'.expand("<slnum>")) " ====================== " Netrw Variables: {{{1 @@ -54,7 +55,7 @@ setl cpo&vim " Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) " netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number) " (this function can optionally take a list of messages) -" May 15, 2014 : max errnum currently is 98 +" Oct 09, 2015 : max errnum currently is 102 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) @@ -70,7 +71,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) else let level= "**note** (netrw) " endif -" call Decho("level=".level) +" call Decho("level=".level,'~'.expand("<slnum>")) if g:netrw_use_errorwindow " (default) netrw creates a one-line window to show error/warning @@ -78,14 +79,14 @@ fun! netrw#ErrorMsg(level,msg,errnum) " record current window number for NetrwRestorePosn()'s benefit let s:winBeforeErr= winnr() -" call Decho("s:winBeforeErr=".s:winBeforeErr) +" call Decho("s:winBeforeErr=".s:winBeforeErr,'~'.expand("<slnum>")) " getting messages out reliably is just plain difficult! " This attempt splits the current window, creating a one line window. if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0 -" call Decho("write to NetrwMessage buffer") +" call Decho("write to NetrwMessage buffer",'~'.expand("<slnum>")) exe bufwinnr("NetrwMessage")."wincmd w" -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) setl ma noro if type(a:msg) == 3 for msg in a:msg @@ -96,13 +97,13 @@ fun! netrw#ErrorMsg(level,msg,errnum) endif NetrwKeepj $ else -" call Decho("create a NetrwMessage buffer window") +" call Decho("create a NetrwMessage buffer window",'~'.expand("<slnum>")) bo 1split sil! call s:NetrwEnew() sil! NetrwKeepj call s:NetrwSafeOptions() setl bt=nofile NetrwKeepj file NetrwMessage -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) setl ma noro if type(a:msg) == 3 for msg in a:msg @@ -113,7 +114,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) endif NetrwKeepj $ endif -" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr()) +" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr(),'~'.expand("<slnum>")) if &fo !~ '[ta]' syn clear syn match netrwMesgNote "^\*\*note\*\*" @@ -122,7 +123,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) hi link netrwMesgWarning WarningMsg hi link netrwMesgError Error endif -" call Decho("setl noma ro bh=wipe") +" call Decho("setl noma ro bh=wipe",'~'.expand("<slnum>")) setl ro nomod noma bh=wipe else @@ -137,13 +138,13 @@ fun! netrw#ErrorMsg(level,msg,errnum) if type(a:msg) == 3 for msg in a:msg - echomsg level.msg + unsilent echomsg level.msg endfor else - echomsg level.a:msg + unsilent echomsg level.a:msg endif -" call Decho("echomsg ***netrw*** ".a:msg) +" call Decho("echomsg ***netrw*** ".a:msg,'~'.expand("<slnum>")) echohl None endif @@ -154,7 +155,7 @@ endfun " s:NetrwInit: initializes variables if they haven't been defined {{{2 " Loosely, varname = value. fun s:NetrwInit(varname,value) -" call Decho("varname<".a:varname."> value=".a:value) +" call Decho("varname<".a:varname."> value=".a:value,'~'.expand("<slnum>")) if !exists(a:varname) if type(a:value) == 0 exe "let ".a:varname."=".a:value @@ -345,7 +346,7 @@ if !exists("g:netrw_list_cmd") let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" endif else -" call Decho(g:netrw_ssh_cmd." is not executable") +" call Decho(g:netrw_ssh_cmd." is not executable",'~'.expand("<slnum>")) let g:netrw_list_cmd= "" endif endif @@ -504,6 +505,7 @@ endif call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.") call s:NetrwInit("g:netrw_win95ftp",1) call s:NetrwInit("g:netrw_winsize",50) +call s:NetrwInit("g:netrw_wiw",1) if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif " --------------------------------------------------------------------- " Default values for netrw's script variables: {{{2 @@ -531,18 +533,18 @@ endif " Netrw Initialization: {{{1 " ====================== if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") -" call Decho("installed beval events") +" call Decho("installed beval events",'~'.expand("<slnum>")) let &l:bexpr = "netrw#BalloonHelp()" au FileType netrw setl beval au WinLeave * if &ft == "netrw" && exists("s:initbeval")|let &beval= s:initbeval|endif au VimEnter * let s:initbeval= &beval "else " Decho -" if v:version < 700 | call Decho("did not install beval events: v:version=".v:version." < 700") | endif -" if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval") | endif -" if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists") | endif -" if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists") | endif -" if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting") | endif -" if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists") | endif +" if v:version < 700 | call Decho("did not install beval events: v:version=".v:version." < 700","~".expand("<slnum>")) | endif +" if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval","~".expand("<slnum>")) | endif +" if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists","~".expand("<slnum>")) | endif +" if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists","~".expand("<slnum>")) | endif +" if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting","~".expand("<slnum>")) | endif +" if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists","~".expand("<slnum>")) | endif endif au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif @@ -560,7 +562,7 @@ endif " --------------------------------------------------------------------- " netrw#BalloonHelp: {{{2 if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_on") && !exists("g:netrw_nobeval") -" call Decho("loading netrw#BalloonHelp()") +" call Decho("loading netrw#BalloonHelp()",'~'.expand("<slnum>")) fun! netrw#BalloonHelp() if &ft != "netrw" return "" @@ -572,7 +574,7 @@ if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_ elseif getline(v:beval_lnum) =~ '^"\s*/' let mesg = "<cr>: edit/enter o: edit/enter in horiz window t: edit/enter in new tab v:edit/enter in vert window" elseif v:beval_text == "Sorted" || v:beval_text == "by" - let mesg = 's: sort by name, time, or file size r: reverse sorting order mt: mark target' + let mesg = 's: sort by name, time, file size, extension r: reverse sorting order mt: mark target' elseif v:beval_text == "Sort" || v:beval_text == "sequence" let mesg = "S: edit sorting sequence" elseif v:beval_text == "Hiding" || v:beval_text == "Showing" @@ -587,11 +589,11 @@ if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_ return mesg endfun "else " Decho -" if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -")|endif -" if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval") |endif -" if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled") |endif -" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a") |endif -" if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists") |endif +" if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -","~".expand("<slnum>"))|endif +" if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval","~".expand("<slnum>")) |endif +" if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled","~".expand("<slnum>")) |endif +" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a","~".expand("<slnum>")) |endif +" if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists","~".expand("<slnum>")) |endif endif " ------------------------------------------------------------------------ @@ -613,9 +615,10 @@ endif " == 6: Texplore fun! netrw#Explore(indx,dosplit,style,...) " call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("<slnum>")) endif " record current file for Rexplore's benefit @@ -629,23 +632,24 @@ fun! netrw#Explore(indx,dosplit,style,...) if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) let curdir= substitute(curdir,'\','/','g') endif -" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">") +" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">",'~'.expand("<slnum>")) " using completion, directories with spaces in their names (thanks, Bill Gates, for a truly dumb idea) " will end up with backslashes here. Solution: strip off backslashes that precede white space and " try Explore again. if a:0 > 0 " call Decho('considering retry: a:1<'.a:1.'>: '. - \ ((a:1 =~ "\\\s")? 'has backslash whitespace' : 'does not have backslash whitespace').', '. - \ ((filereadable(a:1))? 'is readable' : 'is not readable').', '. - \ ((isdirectory(a:1))? 'is a directory' : 'is not a directory')) - if a:1 =~ "\\\s" && !filereadable(a:1) && !isdirectory(a:1) -" call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">") + \ ((a:1 =~ "\\\s")? 'has backslash whitespace' : 'does not have backslash whitespace').', '. + \ ((filereadable(s:NetrwFile(a:1)))? 'is readable' : 'is not readable').', '. + \ ((isdirectory(s:NetrwFile(a:1))))? 'is a directory' : 'is not a directory', + \ '~'.expand("<slnum>")) + if a:1 =~ "\\\s" && !filereadable(s:NetrwFile(a:1)) && !isdirectory(s:NetrwFile(a:1)) +" call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">",'~'.expand("<slnum>")) call netrw#Explore(a:indx,a:dosplit,a:style,substitute(a:1,'\\\(\s\)','\1','g')) " call Dret("netrw#Explore : returning from retry") return " else " Decho -" call Decho("retry not needed") +" call Decho("retry not needed",'~'.expand("<slnum>")) endif endif @@ -660,7 +664,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " -or- file has been modified AND file not hidden when abandoned " -or- Texplore used if a:dosplit || (&modified && &hidden == 0 && &bufhidden != "hide") || a:style == 6 -" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified") +" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified",'~'.expand("<slnum>")) call s:SaveWinVars() let winsz= g:netrw_winsize if a:indx > 0 @@ -668,119 +672,119 @@ fun! netrw#Explore(indx,dosplit,style,...) endif if a:style == 0 " Explore, Sexplore -" call Decho("style=0: Explore or Sexplore") +" call Decho("style=0: Explore or Sexplore",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "noswapfile ".winsz."wincmd s" -" call Decho("exe noswapfile ".winsz."wincmd s") +" call Decho("exe noswapfile ".winsz."wincmd s",'~'.expand("<slnum>")) elseif a:style == 1 "Explore!, Sexplore! -" call Decho("style=1: Explore! or Sexplore!") +" call Decho("style=1: Explore! or Sexplore!",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile ".winsz."wincmd v") +" call Decho("exe keepalt noswapfile ".winsz."wincmd v",'~'.expand("<slnum>")) elseif a:style == 2 " Hexplore -" call Decho("style=2: Hexplore") +" call Decho("style=2: Hexplore",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile bel ".winsz."wincmd s" -" call Decho("exe keepalt noswapfile bel ".winsz."wincmd s") +" call Decho("exe keepalt noswapfile bel ".winsz."wincmd s",'~'.expand("<slnum>")) elseif a:style == 3 " Hexplore! -" call Decho("style=3: Hexplore!") +" call Decho("style=3: Hexplore!",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile abo ".winsz."wincmd s" -" call Decho("exe keepalt noswapfile abo ".winsz."wincmd s") +" call Decho("exe keepalt noswapfile abo ".winsz."wincmd s",'~'.expand("<slnum>")) elseif a:style == 4 " Vexplore -" call Decho("style=4: Vexplore") +" call Decho("style=4: Vexplore",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile lefta ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v") +" call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v",'~'.expand("<slnum>")) elseif a:style == 5 " Vexplore! -" call Decho("style=5: Vexplore!") +" call Decho("style=5: Vexplore!",'~'.expand("<slnum>")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile rightb ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v") +" call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v",'~'.expand("<slnum>")) elseif a:style == 6 " Texplore call s:SaveBufVars() -" call Decho("style = 6: Texplore") +" call Decho("style = 6: Texplore",'~'.expand("<slnum>")) exe "keepalt tabnew ".fnameescape(curdir) -" call Decho("exe keepalt tabnew ".fnameescape(curdir)) +" call Decho("exe keepalt tabnew ".fnameescape(curdir),'~'.expand("<slnum>")) call s:RestoreBufVars() endif call s:RestoreWinVars() " else " Decho -" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6") +" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6",'~'.expand("<slnum>")) endif NetrwKeepj norm! 0 if a:0 > 0 -" call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">") +" call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">",'~'.expand("<slnum>")) if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)) -" call Decho("..case a:1<".a:1.">: starts with ~ and unix or cygwin") +" call Decho("..case a:1<".a:1.">: starts with ~ and unix or cygwin",'~'.expand("<slnum>")) let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),'')) -" call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)") +" call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)",'~'.expand("<slnum>")) elseif a:1 == '.' -" call Decho("..case a:1<".a:1.">: matches .") +" call Decho("..case a:1<".a:1.">: matches .",'~'.expand("<slnum>")) let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd()) if dirname !~ '/$' let dirname= dirname."/" endif -" call Decho("..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")") +" call Decho("..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")",'~'.expand("<slnum>")) elseif a:1 =~ '\$' -" call Decho("..case a:1<".a:1.">: matches ending $") +" call Decho("..case a:1<".a:1.">: matches ending $",'~'.expand("<slnum>")) let dirname= simplify(expand(a:1)) -" call Decho("..using user-specified dirname<".dirname."> with $env-var") +" call Decho("..using user-specified dirname<".dirname."> with $env-var",'~'.expand("<slnum>")) elseif a:1 !~ '^\*\{1,2}/' && a:1 !~ '^\a\{3,}://' -" call Decho("..case a:1<".a:1.">: other, not pattern or filepattern") +" call Decho("..case a:1<".a:1.">: other, not pattern or filepattern",'~'.expand("<slnum>")) let dirname= simplify(a:1) -" call Decho("..using user-specified dirname<".dirname.">") +" call Decho("..using user-specified dirname<".dirname.">",'~'.expand("<slnum>")) else -" call Decho("..case a:1: pattern or filepattern") +" call Decho("..case a:1: pattern or filepattern",'~'.expand("<slnum>")) let dirname= a:1 endif else " clear explore -" call Decho("case a:0=".a:0.": clearing Explore list") +" call Decho("case a:0=".a:0.": clearing Explore list",'~'.expand("<slnum>")) call s:NetrwClearExplore() " call Dret("netrw#Explore : cleared list") return endif -" call Decho("dirname<".dirname.">") +" call Decho("dirname<".dirname.">",'~'.expand("<slnum>")) if dirname =~ '\.\./\=$' let dirname= simplify(fnamemodify(dirname,':p:h')) elseif dirname =~ '\.\.' || dirname == '.' let dirname= simplify(fnamemodify(dirname,':p')) endif -" call Decho("dirname<".dirname."> (after simplify)") +" call Decho("dirname<".dirname."> (after simplify)",'~'.expand("<slnum>")) if dirname =~ '^\*//' " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("case starpat=1: Explore *//pattern") +" call Decho("case starpat=1: Explore *//pattern",'~'.expand("<slnum>")) let pattern= substitute(dirname,'^\*//\(.*\)$','\1','') let starpat= 1 -" call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") +" call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("<slnum>")) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif elseif dirname =~ '^\*\*//' " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("case starpat=2: Explore **//pattern") +" call Decho("case starpat=2: Explore **//pattern",'~'.expand("<slnum>")) let pattern= substitute(dirname,'^\*\*//','','') let starpat= 2 -" call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") +" call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("<slnum>")) elseif dirname =~ '/\*\*/' " handle .../**/.../filepat -" call Decho("case starpat=4: Explore .../**/.../filepat") +" call Decho("case starpat=4: Explore .../**/.../filepat",'~'.expand("<slnum>")) let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','') if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16"))) let b:netrw_curdir = prefixdir @@ -789,30 +793,30 @@ fun! netrw#Explore(indx,dosplit,style,...) endif let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','') let starpat= 4 -" call Decho("..pwd<".getcwd()."> dirname<".dirname.">") -" call Decho("..case Explore ../**/../filepat (starpat=".starpat.")") +" call Decho("..pwd<".getcwd()."> dirname<".dirname.">",'~'.expand("<slnum>")) +" call Decho("..case Explore ../**/../filepat (starpat=".starpat.")",'~'.expand("<slnum>")) elseif dirname =~ '^\*/' " case starpat=3: Explore */filepat (search in current directory for filenames matching filepat) let starpat= 3 -" call Decho("case starpat=3: Explore */filepat (starpat=".starpat.")") +" call Decho("case starpat=3: Explore */filepat (starpat=".starpat.")",'~'.expand("<slnum>")) elseif dirname=~ '^\*\*/' " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) let starpat= 4 -" call Decho("case starpat=4: Explore **/filepat (starpat=".starpat.")") +" call Decho("case starpat=4: Explore **/filepat (starpat=".starpat.")",'~'.expand("<slnum>")) else let starpat= 0 -" call Decho("case starpat=0: default") +" call Decho("case starpat=0: default",'~'.expand("<slnum>")) endif if starpat == 0 && a:indx >= 0 " [Explore Hexplore Vexplore Sexplore] [dirname] -" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore") +" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore",'~'.expand("<slnum>")) if dirname == "" let dirname= curfiledir -" call Decho("..empty dirname, using current file's directory<".dirname.">") +" call Decho("..empty dirname, using current file's directory<".dirname.">",'~'.expand("<slnum>")) endif if dirname =~ '^scp://' || dirname =~ '^ftp://' call netrw#Nread(2,dirname) @@ -820,7 +824,7 @@ fun! netrw#Explore(indx,dosplit,style,...) if dirname == "" let dirname= getcwd() elseif (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin - " Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo', + " Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo', " depending on whether backslashes have been converted to forward slashes by earlier code). if dirname !~ '^[a-zA-Z]:' && dirname !~ '^\\\\\w\+' && dirname !~ '^//\w\+' let dirname= b:netrw_curdir."/".dirname @@ -828,9 +832,10 @@ fun! netrw#Explore(indx,dosplit,style,...) elseif dirname !~ '^/' let dirname= b:netrw_curdir."/".dirname endif -" call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)") +" call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)",'~'.expand("<slnum>")) call netrw#LocalBrowseCheck(dirname) -" call Decho("win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Decho(" modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) endif if exists("w:netrw_bannercnt") " done to handle P08-Ingelrest. :Explore will _Always_ go to the line just after the banner. @@ -838,7 +843,7 @@ fun! netrw#Explore(indx,dosplit,style,...) exe w:netrw_bannercnt endif -" call Decho("curdir<".curdir.">") +" call Decho("curdir<".curdir.">",'~'.expand("<slnum>")) " --------------------------------------------------------------------- " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest " if has("win32") || has("win95") || has("win64") || has("win16") @@ -854,26 +859,26 @@ fun! netrw#Explore(indx,dosplit,style,...) " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) elseif a:indx <= 0 " Nexplore, Pexplore, Explore: handle starpat -" call Decho("case a:indx<=0: Nexplore, Pexplore, <s-down>, <s-up> starpat=".starpat." a:indx=".a:indx) +" call Decho("case a:indx<=0: Nexplore, Pexplore, <s-down>, <s-up> starpat=".starpat." a:indx=".a:indx,'~'.expand("<slnum>")) if !mapcheck("<s-up>","n") && !mapcheck("<s-down>","n") && exists("b:netrw_curdir") -" call Decho("..set up <s-up> and <s-down> maps") +" call Decho("..set up <s-up> and <s-down> maps",'~'.expand("<slnum>")) let s:didstarstar= 1 nnoremap <buffer> <silent> <s-up> :Pexplore<cr> nnoremap <buffer> <silent> <s-down> :Nexplore<cr> endif if has("path_extra") -" call Decho("..starpat=".starpat.": has +path_extra") +" call Decho("..starpat=".starpat.": has +path_extra",'~'.expand("<slnum>")) if !exists("w:netrw_explore_indx") let w:netrw_explore_indx= 0 endif let indx = a:indx -" call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]") +" call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]",'~'.expand("<slnum>")) if indx == -1 " Nexplore -" call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")") +" call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>")) if !exists("w:netrw_explore_list") " sanity check NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) if has("clipboard") @@ -888,17 +893,17 @@ fun! netrw#Explore(indx,dosplit,style,...) if indx < 0 | let indx= 0 | endif if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif let curfile= w:netrw_explore_list[indx] -" call Decho("....indx=".indx." curfile<".curfile.">") +" call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("<slnum>")) while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] let indx= indx + 1 -" call Decho("....indx=".indx." (Nexplore while loop)") +" call Decho("....indx=".indx." (Nexplore while loop)",'~'.expand("<slnum>")) endwhile if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif -" call Decho("....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) +" call Decho("....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("<slnum>")) elseif indx == -2 " Pexplore -" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")") +" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>")) if !exists("w:netrw_explore_list") " sanity check NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) if has("clipboard") @@ -913,30 +918,30 @@ fun! netrw#Explore(indx,dosplit,style,...) if indx < 0 | let indx= 0 | endif if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif let curfile= w:netrw_explore_list[indx] -" call Decho("....indx=".indx." curfile<".curfile.">") +" call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("<slnum>")) while indx >= 0 && curfile == w:netrw_explore_list[indx] let indx= indx - 1 -" call Decho("....indx=".indx." (Pexplore while loop)") +" call Decho("....indx=".indx." (Pexplore while loop)",'~'.expand("<slnum>")) endwhile if indx < 0 | let indx= 0 | endif -" call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) +" call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("<slnum>")) else " Explore -- initialize " build list of files to Explore with Nexplore/Pexplore -" call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")") +" call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")",'~'.expand("<slnum>")) NetrwKeepj keepalt call s:NetrwClearExplore() let w:netrw_explore_indx= 0 if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() endif -" call Decho("....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) " switch on starpat to build the w:netrw_explore_list of files if starpat == 1 " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls) -" call Decho("....pattern<".pattern.">") +" call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls,'~'.expand("<slnum>")) +" call Decho("....pattern<".pattern.">",'~'.expand("<slnum>")) try exe "NetrwKeepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" catch /^Vim\%((\a\+)\)\=:E480/ @@ -949,8 +954,8 @@ fun! netrw#Explore(indx,dosplit,style,...) elseif starpat == 2 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)") -" call Decho("....pattern<".pattern.">") +" call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)",'~'.expand("<slnum>")) +" call Decho("....pattern<".pattern.">",'~'.expand("<slnum>")) try exe "sil NetrwKeepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" catch /^Vim\%((\a\+)\)\=:E480/ @@ -971,24 +976,24 @@ fun! netrw#Explore(indx,dosplit,style,...) elseif starpat == 3 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) -" call Decho("..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls) +" call Decho("..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls,'~'.expand("<slnum>")) let filepat= substitute(dirname,'^\*/','','') let filepat= substitute(filepat,'^[%#<]','\\&','') -" call Decho("....b:netrw_curdir<".b:netrw_curdir.">") -" call Decho("....filepat<".filepat.">") +" call Decho("....b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) +" call Decho("....filepat<".filepat.">",'~'.expand("<slnum>")) let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif elseif starpat == 4 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) -" call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls) +" call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls,'~'.expand("<slnum>")) let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n')) if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif endif " switch on starpat to build w:netrw_explore_list let w:netrw_explore_listlen = len(w:netrw_explore_list) -" call Decho("....w:netrw_explore_list<".string(w:netrw_explore_list).">") -" call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen) +" call Decho("....w:netrw_explore_list<".string(w:netrw_explore_list).">",'~'.expand("<slnum>")) +" call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen,'~'.expand("<slnum>")) if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) @@ -1004,22 +1009,22 @@ fun! netrw#Explore(indx,dosplit,style,...) " NetrwStatusLine support - for exploring support let w:netrw_explore_indx= indx -" call Decho("....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) +" call Decho("....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen,'~'.expand("<slnum>")) " wrap the indx around, but issue a note if indx >= w:netrw_explore_listlen || indx < 0 -" call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")") +" call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")",'~'.expand("<slnum>")) let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 let w:netrw_explore_indx= indx keepalt NetrwKeepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) endif exe "let dirfile= w:netrw_explore_list[".indx."]" -" call Decho("....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">") +" call Decho("....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">",'~'.expand("<slnum>")) let newdir= substitute(dirfile,'/[^/]*$','','e') -" call Decho("....newdir<".newdir.">") +" call Decho("....newdir<".newdir.">",'~'.expand("<slnum>")) -" call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)") +" call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)",'~'.expand("<slnum>")) call netrw#LocalBrowseCheck(newdir) if !exists("w:netrw_liststyle") let w:netrw_liststyle= g:netrw_liststyle @@ -1033,10 +1038,10 @@ fun! netrw#Explore(indx,dosplit,style,...) let w:netrw_explore_bufnr = bufnr("%") let w:netrw_explore_line = line(".") keepalt NetrwKeepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') -" call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) +" call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line,'~'.expand("<slnum>")) else -" call Decho("..your vim does not have +path_extra") +" call Decho("..your vim does not have +path_extra",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) endif @@ -1050,7 +1055,7 @@ fun! netrw#Explore(indx,dosplit,style,...) endif else -" call Decho("..default case: Explore newdir<".dirname.">") +" call Decho("..default case: Explore newdir<".dirname.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' sil! unlet w:netrw_treedict sil! unlet w:netrw_treetop @@ -1064,13 +1069,13 @@ fun! netrw#Explore(indx,dosplit,style,...) endif " visual display of **/ **// */ Exploration files -" call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist")) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">") +" call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist"),'~'.expand("<slnum>")) +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">",'~'.expand("<slnum>")) if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") -" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-")) +" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-"),'~'.expand("<slnum>")) if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir " only update match list when current directory isn't the same as before -" call Decho("only update match list when current directory not the same as before") +" call Decho("only update match list when current directory not the same as before",'~'.expand("<slnum>")) let s:explore_prvdir = b:netrw_curdir let s:explore_match = "" let dirlen = strlen(b:netrw_curdir) @@ -1079,7 +1084,7 @@ fun! netrw#Explore(indx,dosplit,style,...) endif let prvfname= "" for fname in w:netrw_explore_list -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) if fname =~ '^'.b:netrw_curdir if s:explore_match == "" let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' @@ -1095,7 +1100,7 @@ fun! netrw#Explore(indx,dosplit,style,...) endif let prvfname= fname endfor -" call Decho("explore_match<".s:explore_match.">") +" call Decho("explore_match<".s:explore_match.">",'~'.expand("<slnum>")) exe "2match netrwMarkFile /".s:explore_match."/" endif echo "<s-up>==Pexplore <s-down>==Nexplore" @@ -1104,7 +1109,7 @@ fun! netrw#Explore(indx,dosplit,style,...) if exists("s:explore_match") | unlet s:explore_match | endif if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif echo " " -" call Decho("cleared explore match list") +" call Decho("cleared explore match list",'~'.expand("<slnum>")) endif " since Explore may be used to initialize netrw's browser, @@ -1130,14 +1135,14 @@ fun! netrw#Lexplore(count,rightside,...) " and a directory has been specified, explore with that " directory. let a1 = expand(a:1) -" call Decho("a:1<".a:1."> curwin#".curwin) +" call Decho("a:1<".a:1."> curwin#".curwin,'~'.expand("<slnum>")) exe "1wincmd w" if &ft == "netrw" -" call Decho("exe Explore ".fnameescape(a:1)) +" call Decho("exe Explore ".fnameescape(a:1),'~'.expand("<slnum>")) exe "Explore ".fnameescape(a1) exe curwin."wincmd w" if exists("t:netrw_lexposn") -" call Decho("forgetting t:netrw_lexposn") +" call Decho("forgetting t:netrw_lexposn",'~'.expand("<slnum>")) unlet t:netrw_lexposn endif " call Dret("netrw#Lexplore") @@ -1157,11 +1162,11 @@ fun! netrw#Lexplore(count,rightside,...) if lexwinnr > 0 " close down netrw explorer window -" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window") +" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("<slnum>")) exe lexwinnr."wincmd w" let g:netrw_winsize = -winwidth(0) let t:netrw_lexposn = netrw#SavePosn() -" call Decho("saving t:netrw_lexposn") +" call Decho("saving t:netrw_lexposn",'~'.expand("<slnum>")) close if lexwinnr < curwin let curwin= curwin - 1 @@ -1171,7 +1176,7 @@ fun! netrw#Lexplore(count,rightside,...) else " open netrw explorer window -" call Decho("t:netrw_lexbufnr<n/a>: open netrw explorer window") +" call Decho("t:netrw_lexbufnr<n/a>: open netrw explorer window",'~'.expand("<slnum>")) exe "1wincmd w" let keep_altv = g:netrw_altv let g:netrw_altv = 0 @@ -1180,16 +1185,16 @@ fun! netrw#Lexplore(count,rightside,...) let g:netrw_winsize = a:count endif let curfile= expand("%") -" call Decho("curfile<".curfile.">") +" call Decho("curfile<".curfile.">",'~'.expand("<slnum>")) exe (a:rightside? "botright" : "topleft")." vertical ".((g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize) . " new" if a:0 > 0 && a1 != "" -" call Decho("case 1: Explore ".a1) +" call Decho("case 1: Explore ".a1,'~'.expand("<slnum>")) exe "Explore ".fnameescape(a1) - elseif curfile =~ '^\a\+://' -" call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','','')) + elseif curfile =~ '^\a\{3,}://' +" call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','',''),'~'.expand("<slnum>")) exe "Explore ".substitute(curfile,'[^/\\]*$','','') else -" call Decho("case 3: Explore .") +" call Decho("case 3: Explore .",'~'.expand("<slnum>")) Explore . endif if a:count != 0 @@ -1199,7 +1204,7 @@ fun! netrw#Lexplore(count,rightside,...) let g:netrw_altv = keep_altv let t:netrw_lexbufnr = bufnr("%") if exists("t:netrw_lexposn") -" call Decho("restoring to t:netrw_lexposn") +" call Decho("restoring to t:netrw_lexposn",'~'.expand("<slnum>")) call netrw#RestorePosn(t:netrw_lexposn) unlet t:netrw_lexposn endif @@ -1229,14 +1234,14 @@ fun! netrw#Clean(sys) else let choice= confirm("Remove personal copy of netrw?","&Yes\n&No") endif -" call Decho("choice=".choice) +" call Decho("choice=".choice,'~'.expand("<slnum>")) let diddel= 0 let diddir= "" if choice == 1 for dir in split(&rtp,',') if filereadable(dir."/plugin/netrwPlugin.vim") -" call Decho("removing netrw-related files from ".dir) +" call Decho("removing netrw-related files from ".dir,'~'.expand("<slnum>")) if s:NetrwDelete(dir."/plugin/netrwPlugin.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/plugin/netrwPlugin.vim",55) |endif if s:NetrwDelete(dir."/autoload/netrwFileHandlers.vim")|call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwFileHandlers.vim",55)|endif if s:NetrwDelete(dir."/autoload/netrwSettings.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwSettings.vim",55) |endif @@ -1269,8 +1274,8 @@ fun! netrw#MakeTgt(dname) " call Dfunc("netrw#MakeTgt(dname<".a:dname.">)") " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) let svpos = netrw#SavePosn() - let s:netrwmftgt_islocal= (a:dname !~ '^\a\+://') -" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal) + let s:netrwmftgt_islocal= (a:dname !~ '^\a\{3,}://') +" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("<slnum>")) if s:netrwmftgt_islocal let netrwmftgt= simplify(a:dname) else @@ -1283,7 +1288,7 @@ fun! netrw#MakeTgt(dname) let s:netrwmftgt= netrwmftgt endif if g:netrw_fastbrowse <= 1 - call s:NetrwRefresh((b:netrw_curdir !~ '\a\+://'),b:netrw_curdir) + call s:NetrwRefresh((b:netrw_curdir !~ '\a\{3,}://'),b:netrw_curdir) endif call netrw#RestorePosn(svpos) " call Dret("netrw#MakeTgt") @@ -1309,40 +1314,40 @@ fun! netrw#Obtain(islocal,fname,...) " call Dret("netrw#Obtain") return endif -" call Decho("fnamelist<".string(fnamelist).">") +" call Decho("fnamelist<".string(fnamelist).">",'~'.expand("<slnum>")) if a:0 > 0 let tgtdir= a:1 else let tgtdir= getcwd() endif -" call Decho("tgtdir<".tgtdir.">") +" call Decho("tgtdir<".tgtdir.">",'~'.expand("<slnum>")) if exists("b:netrw_islocal") && b:netrw_islocal " obtain a file from local b:netrw_curdir to (local) tgtdir -" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir) +" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir,'~'.expand("<slnum>")) if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir let topath= s:ComposePath(tgtdir,"") if (has("win32") || has("win95") || has("win64") || has("win16")) " transfer files one at time -" call Decho("transfer files one at a time") +" call Decho("transfer files one at a time",'~'.expand("<slnum>")) for fname in fnamelist -" call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")") - call system(g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) +" call Decho("system(".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath).")",'~'.expand("<slnum>")) + call system(g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s: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)) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) return endif endfor else " transfer files with one command -" call Decho("transfer files with one command") - 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)) +" call Decho("transfer files with one command",'~'.expand("<slnum>")) + let filelist= join(map(deepcopy(fnamelist),"s:ShellEscape(v:val)")) +" call Decho("system(".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath).")",'~'.expand("<slnum>")) + call system(g:netrw_localcopycmd." ".filelist." ".s: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)) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) return endif endif @@ -1354,7 +1359,7 @@ fun! netrw#Obtain(islocal,fname,...) else " obtain files from remote b:netrw_curdir to local tgtdir -" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir) +" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir,'~'.expand("<slnum>")) if type(a:fname) == 1 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) endif @@ -1362,7 +1367,7 @@ fun! netrw#Obtain(islocal,fname,...) if b:netrw_method == 4 " obtain file using scp -" call Decho("obtain via scp (method#4)") +" call Decho("obtain via scp (method#4)",'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else @@ -1373,37 +1378,37 @@ fun! netrw#Obtain(islocal,fname,...) else let path= "" endif - let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)')) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) + let filelist= join(map(deepcopy(fnamelist),'s:ShellEscape(g:netrw_machine.":".path.v:val,1)')) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".filelist." ".s:ShellEscape(tgtdir,1)) elseif b:netrw_method == 2 " obtain file using ftp + .netrc -" call Decho("obtain via ftp+.netrc (method #2)") +" call Decho("obtain via ftp+.netrc (method #2)",'~'.expand("<slnum>")) call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("b:netrw_fname") && b:netrw_fname != "" call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif for fname in fnamelist call setline(line("$")+1,'get "'.fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endfor if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' @@ -1415,56 +1420,56 @@ fun! netrw#Obtain(islocal,fname,...) elseif b:netrw_method == 3 " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc) -" call Decho("obtain via ftp+mipf (method #3)") +" call Decho("obtain via ftp+mipf (method #3)",'~'.expand("<slnum>")) call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) else NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("s:netrw_passwd") && s:netrw_passwd != "" NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) elseif exists("s:netrw_passwd") NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("b:netrw_fname") && b:netrw_fname != "" NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif for fname in fnamelist NetrwKeepj call setline(line("$")+1,'get "'.fname.'"') endfor -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) " perform ftp: " -i : turns off interactive prompting from ftp @@ -1474,7 +1479,7 @@ fun! netrw#Obtain(islocal,fname,...) call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" -" call Decho("error<".getline(1).">") +" call Decho("error<".getline(1).">",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),5) endif @@ -1482,13 +1487,13 @@ fun! netrw#Obtain(islocal,fname,...) elseif b:netrw_method == 9 " obtain file using sftp -" call Decho("obtain via sftp (method #9)") +" call Decho("obtain via sftp (method #9)",'~'.expand("<slnum>")) if a:fname =~ '/' let localfile= substitute(a:fname,'^.*/','','') else let localfile= a:fname endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1).s:ShellEscape(localfile)." ".s:ShellEscape(tgtdir)) elseif !exists("b:netrw_method") || b:netrw_method < 0 " probably a badly formed url; protocol not recognized @@ -1544,19 +1549,19 @@ endfun " s:NetrwOptionRestore: restore options (based on prior s:NetrwOptionSave) {{{2 fun! s:NetrwOptionRestore(vt) " call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) if !exists("{a:vt}netrw_optionsave") if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") +" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)",'~'.expand("<slnum>")) NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) -" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) -" call Decho("unlet s:nbcd_curpos_".bufnr('%')) +" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$"),'~'.expand("<slnum>")) +" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("<slnum>")) unlet s:nbcd_curpos_{bufnr('%')} else -" call Decho("no previous position") +" call Decho("no previous position",'~'.expand("<slnum>")) endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") return endif @@ -1564,7 +1569,7 @@ fun! s:NetrwOptionRestore(vt) if exists("+acd") if exists("{a:vt}netrw_acdkeep") -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) let curdir = getcwd() let &l:acd = {a:vt}netrw_acdkeep unlet {a:vt}netrw_acdkeep @@ -1575,9 +1580,6 @@ fun! s:NetrwOptionRestore(vt) endif if exists("{a:vt}netrw_aikeep") |let &l:ai = {a:vt}netrw_aikeep |unlet {a:vt}netrw_aikeep |endif if exists("{a:vt}netrw_awkeep") |let &l:aw = {a:vt}netrw_awkeep |unlet {a:vt}netrw_awkeep |endif - if g:netrw_liststyle != s:TREELIST - if exists("{a:vt}netrw_bhkeep") |let &l:bh = {a:vt}netrw_bhkeep |unlet {a:vt}netrw_bhkeep |endif - endif if exists("{a:vt}netrw_blkeep") |let &l:bl = {a:vt}netrw_blkeep |unlet {a:vt}netrw_blkeep |endif if exists("{a:vt}netrw_btkeep") |let &l:bt = {a:vt}netrw_btkeep |unlet {a:vt}netrw_btkeep |endif if exists("{a:vt}netrw_bombkeep") |let &l:bomb = {a:vt}netrw_bombkeep |unlet {a:vt}netrw_bombkeep |endif @@ -1632,7 +1634,7 @@ fun! s:NetrwOptionRestore(vt) unlet {a:vt}netrw_swfkeep endif endif - if exists("{a:vt}netrw_dirkeep") && isdirectory({a:vt}netrw_dirkeep) && g:netrw_keepdir + if exists("{a:vt}netrw_dirkeep") && isdirectory(s:NetrwFile({a:vt}netrw_dirkeep)) && g:netrw_keepdir let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') if exists("{a:vt}netrw_dirkeep") call s:NetrwLcd(dirkeep) @@ -1644,29 +1646,29 @@ fun! s:NetrwOptionRestore(vt) endif if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") +" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)",'~'.expand("<slnum>")) NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) -" call Decho("unlet s:nbcd_curpos_".bufnr('%')) +" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("<slnum>")) if exists("s:nbcd_curpos_".bufnr('%')) unlet s:nbcd_curpos_{bufnr('%')} endif else -" call Decho("no previous position") +" call Decho("no previous position",'~'.expand("<slnum>")) endif -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist")) -" call Decho("ts=".&l:ts) +" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("<slnum>")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"),'~'.expand("<slnum>")) +" call Decho("ts=".&l:ts,'~'.expand("<slnum>")) " Moved the filetype detect here from NetrwGetFile() because remote files " were having their filetype detect-generated settings overwritten by " NetrwOptionRestore. if &ft != "netrw" -" call Decho("filetype detect (ft=".&ft.")") +" call Decho("filetype detect (ft=".&ft.")",'~'.expand("<slnum>")) filetype detect endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) " call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun @@ -1680,8 +1682,8 @@ endfun " vt: normally its "w:" or "s:" (a variable type) fun! s:NetrwOptionSave(vt) " call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) -" call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"),'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) if !exists("{a:vt}netrw_optionsave") let {a:vt}netrw_optionsave= 1 @@ -1689,10 +1691,10 @@ fun! s:NetrwOptionSave(vt) " call Dret("s:NetrwOptionSave : options already saved") return endif -" call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) +" call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff,'~'.expand("<slnum>")) " Save current settings and current directory -" call Decho("saving current settings and current directory") +" call Decho("saving current settings and current directory",'~'.expand("<slnum>")) let s:yykeep = @@ if exists("&l:acd")|let {a:vt}netrw_acdkeep = &l:acd|endif let {a:vt}netrw_aikeep = &l:ai @@ -1740,7 +1742,7 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_writekeep = &l:write " save a few selected netrw-related variables -" call Decho("saving a few selected netrw-related variables") +" call Decho("saving a few selected netrw-related variables",'~'.expand("<slnum>")) if g:netrw_keepdir let {a:vt}netrw_dirkeep = getcwd() endif @@ -1749,7 +1751,7 @@ fun! s:NetrwOptionSave(vt) endif sil! let {a:vt}netrw_regslash= @/ -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) " call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()) endfun @@ -1759,8 +1761,8 @@ endfun " Use s:NetrwOptionRestore() to restore user settings fun! s:NetrwSafeOptions() " call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) -" call Decho("win#".winnr()."'s ft=".&ft) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("win#".winnr()."'s ft=".&ft,'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) if exists("+acd") | setl noacd | endif setl noai setl noaw @@ -1769,9 +1771,7 @@ fun! s:NetrwSafeOptions() setl bt=nofile setl noci setl nocin - if g:netrw_liststyle == s:TREELIST - setl bh=hide - endif + setl bh=hide setl cino= setl com= setl cpo-=a @@ -1793,14 +1793,14 @@ fun! s:NetrwSafeOptions() call s:NetrwCursor() " allow the user to override safe options -" call Decho("ft<".&ft."> ei=".&ei) +" call Decho("ft<".&ft."> ei=".&ei,'~'.expand("<slnum>")) if &ft == "netrw" -" call Decho("do any netrw FileType autocmds (doau FileType netrw)") +" call Decho("do any netrw FileType autocmds (doau FileType netrw)",'~'.expand("<slnum>")) sil! keepalt NetrwKeepj doau FileType netrw endif -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">",'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) " call Dret("s:NetrwSafeOptions") endfun @@ -1857,7 +1857,7 @@ fun! netrw#NetRead(mode,...) " NetrwSafeOptions sets a buffer up for a netrw listing, which includes buflisting off. " However, this setting is not wanted for a remote editing session. The buffer should be "nofile", still. setl bl -" call Decho("(netrw#NetRead) buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh) +" call Decho("(netrw#NetRead) buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh,'~'.expand("<slnum>")) " NetRead: interpret mode into a readcmd {{{3 if a:mode == 0 " read remote file before current line @@ -1873,7 +1873,7 @@ fun! netrw#NetRead(mode,...) let readcmd = "r" endif let ichoice = (a:0 == 0)? 0 : 1 -" call Decho("readcmd<".readcmd."> ichoice=".ichoice) +" call Decho("readcmd<".readcmd."> ichoice=".ichoice,'~'.expand("<slnum>")) " NetRead: get temporary filename {{{3 let tmpfile= s:GetTempfile("") @@ -1886,13 +1886,13 @@ fun! netrw#NetRead(mode,...) " attempt to repeat with previous host-file-etc if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("<slnum>")) let choice = b:netrw_lastfile let ichoice= ichoice + 1 else exe "let choice= a:" . ichoice -" call Decho("no lastfile: choice<" . choice . ">") +" call Decho("no lastfile: choice<" . choice . ">",'~'.expand("<slnum>")) if match(choice,"?") == 0 " give help @@ -1915,7 +1915,7 @@ fun! netrw#NetRead(mode,...) elseif match(choice,'^"') != -1 " Reconstruct Choice if choice starts with '"' -" call Decho("reconstructing choice") +" call Decho("reconstructing choice",'~'.expand("<slnum>")) if match(choice,'"$') != -1 " case "..." let choice= strpart(choice,1,strlen(choice)-2) @@ -1941,7 +1941,7 @@ fun! netrw#NetRead(mode,...) endif endif -" call Decho("choice<" . choice . ">") +" call Decho("choice<" . choice . ">",'~'.expand("<slnum>")) let ichoice= ichoice + 1 " NetRead: Determine method of read (ftp, rcp, etc) {{{3 @@ -1953,9 +1953,9 @@ fun! netrw#NetRead(mode,...) let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix " Check whether or not NetrwBrowse() should be handling this request -" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") +" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">",'~'.expand("<slnum>")) if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^https\=://' -" call Decho("yes, choice matches '^.*[\/]$'") +" call Decho("yes, choice matches '^.*[\/]$'",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwBrowse(0,choice) " call Dret("netrw#NetRead :3 getcwd<".getcwd().">") return @@ -1971,7 +1971,7 @@ fun! netrw#NetRead(mode,...) "......................................... " NetRead: (rcp) NetRead Method #1 {{{3 if b:netrw_method == 1 " read with rcp -" call Decho("read via rcp (method #1)") +" call Decho("read via rcp (method #1)",'~'.expand("<slnum>")) " ER: nothing done with g:netrw_uid yet? " ER: on Win2K" rcp machine[.user]:file tmpfile " ER: when machine contains '.' adding .user is required (use $USERNAME) @@ -1990,30 +1990,30 @@ fun! netrw#NetRead(mode,...) let uid_machine = g:netrw_machine endif endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3 elseif b:netrw_method == 2 " read with ftp + <.netrc> -" call Decho("read via ftp+.netrc (method #2)") +" call Decho("read via ftp+.netrc (method #2)",'~'.expand("<slnum>")) let netrw_fname= b:netrw_fname NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline(line("$"))) +" call Decho("filter input: ".getline(line("$")),'~'.expand("<slnum>")) if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline(line("$"))) +" call Decho("filter input: ".getline(line("$")),'~'.expand("<slnum>")) endif call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile) -" call Decho("filter input: ".getline(line("$"))) +" call Decho("filter input: ".getline(line("$")),'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' @@ -2023,7 +2023,7 @@ fun! netrw#NetRead(mode,...) let &debug = debugkeep endif call s:SaveBufVars() - bd! + keepj bd! if bufname("%") == "" && getline("$") == "" && line('$') == 1 " needed when one sources a file in a nolbl setting window via ftp q! @@ -2036,43 +2036,43 @@ fun! netrw#NetRead(mode,...) " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname " Construct execution string (four lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)") +" call Decho("read via ftp+mipf (method #3)",'~'.expand("<slnum>")) let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) else NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) if exists("s:netrw_passwd") NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) elseif exists("s:netrw_passwd") NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif NetrwKeepj put ='get \"'.netrw_fname.'\" '.tmpfile -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) " perform ftp: " -i : turns off interactive prompting from ftp @@ -2082,19 +2082,19 @@ fun! netrw#NetRead(mode,...) call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" -" call Decho("error<".getline(1).">") +" call Decho("error<".getline(1).">",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif - call s:SaveBufVars()|bd!|call s:RestoreBufVars() + call s:SaveBufVars()|keepj bd!|call s:RestoreBufVars() let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (scp) NetRead Method #4 {{{3 elseif b:netrw_method == 4 " read with scp -" call Decho("read via scp (method #4)") +" call Decho("read via scp (method #4)",'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else @@ -2107,14 +2107,14 @@ fun! netrw#NetRead(mode,...) else let tmpfile_get = tmpfile endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile_get,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile_get,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (http) NetRead Method #5 (wget) {{{3 elseif b:netrw_method == 5 -" call Decho("read via http (method #5)") +" call Decho("read via http (method #5)",'~'.expand("<slnum>")) if g:netrw_http_cmd == "" if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"neither the wget nor the fetch command is available",6) @@ -2125,34 +2125,34 @@ fun! netrw#NetRead(mode,...) if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd") " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch) -" call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)") +" call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)",'~'.expand("<slnum>")) if exists("g:netrw_http_xcmd") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".s:ShellEscape(tmpfile,1)) else - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) else " wget/curl/fetch plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) -" call Decho("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)") +" call Decho("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)",'~'.expand("<slnum>")) let netrw_html= substitute(b:netrw_fname,"#.*$","","") let netrw_tag = substitute(b:netrw_fname,"^.*#","","") -" call Decho("netrw_html<".netrw_html.">") -" call Decho("netrw_tag <".netrw_tag.">") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) +" call Decho("netrw_html<".netrw_html.">",'~'.expand("<slnum>")) +" call Decho("netrw_tag <".netrw_tag.">",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) -" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') +" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/','~'.expand("<slnum>")) exe 'NetrwKeepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>" endif let b:netrw_lastfile = choice -" call Decho("setl ro") +" call Decho("setl ro",'~'.expand("<slnum>")) setl ro nomod "......................................... " NetRead: (dav) NetRead Method #6 {{{3 elseif b:netrw_method == 6 -" call Decho("read via cadaver (method #6)") +" call Decho("read via cadaver (method #6)",'~'.expand("<slnum>")) if !executable(g:netrw_dav_cmd) call netrw#ErrorMsg(s:ERROR,g:netrw_dav_cmd." is not executable",73) @@ -2160,7 +2160,7 @@ fun! netrw#NetRead(mode,...) return endif if g:netrw_dav_cmd =~ "curl" - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_dav_cmd." ".s:ShellEscape("dav://".g:netrw_machine.b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) else " Construct execution string (four lines) which will be passed through filter let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) @@ -2180,7 +2180,7 @@ fun! netrw#NetRead(mode,...) " perform cadaver operation: NetrwKeepj norm! 1Gdd call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd) - bd! + keepj bd! endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2188,8 +2188,8 @@ fun! netrw#NetRead(mode,...) "......................................... " NetRead: (rsync) NetRead Method #7 {{{3 elseif b:netrw_method == 7 -" call Decho("read via rsync (method #7)") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) +" call Decho("read via rsync (method #7)",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2197,7 +2197,7 @@ fun! netrw#NetRead(mode,...) " NetRead: (fetch) NetRead Method #8 {{{3 " fetch://[user@]host[:http]/path elseif b:netrw_method == 8 -" call Decho("read via fetch (method #8)") +" call Decho("read via fetch (method #8)",'~'.expand("<slnum>")) if g:netrw_fetch_cmd == "" if !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) @@ -2210,32 +2210,32 @@ fun! netrw#NetRead(mode,...) else let netrw_option= "ftp" endif -" call Decho("read via fetch for ".netrw_option) +" call Decho("read via fetch for ".netrw_option,'~'.expand("<slnum>")) if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != "" - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) else - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) endif let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice -" call Decho("setl ro") +" call Decho("setl ro",'~'.expand("<slnum>")) setl ro nomod "......................................... " NetRead: (sftp) NetRead Method #9 {{{3 elseif b:netrw_method == 9 -" call Decho("read via sftp (method #9)") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) +" call Decho("read via sftp (method #9)",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (file) NetRead Method #10 {{{3 elseif b:netrw_method == 10 && exists("g:netrw_file_cmd") -" " call Decho("read via ".b:netrw_file_cmd." (method #10)") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_file_cmd." ".shellescape(b:netrw_fname,1)." ".tmpfile) +" " call Decho("read via ".b:netrw_file_cmd." (method #10)",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_file_cmd." ".s:ShellEscape(b:netrw_fname,1)." ".tmpfile) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2248,12 +2248,12 @@ fun! netrw#NetRead(mode,...) " NetRead: cleanup {{{3 if exists("b:netrw_method") -" call Decho("cleanup b:netrw_method and b:netrw_fname") +" call Decho("cleanup b:netrw_method and b:netrw_fname",'~'.expand("<slnum>")) unlet b:netrw_method unlet b:netrw_fname endif if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' && tmpfile !~ '.tar.xz$' && tmpfile !~ '.txz' -" call Decho("cleanup by deleting tmpfile<".tmpfile.">") +" call Decho("cleanup by deleting tmpfile<".tmpfile.">",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwDelete(tmpfile) endif NetrwKeepj call s:NetrwOptionRestore("w:") @@ -2285,21 +2285,21 @@ fun! netrw#NetWrite(...) range endif let curbufname= expand("%") -" call Decho("curbufname<".curbufname.">") +" call Decho("curbufname<".curbufname.">",'~'.expand("<slnum>")) if &binary " For binary writes, always write entire file. " (line numbers don't really make sense for that). " Also supports the writing of tar and zip files. -" call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) +" call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("<slnum>")) exe "sil NetrwKeepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) elseif g:netrw_cygwin " write (selected portion of) file to temporary let cygtmpfile= substitute(tmpfile,g:netrw_cygdrive.'/\(.\)','\1:','') -" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)) +" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile),'~'.expand("<slnum>")) exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) else " write (selected portion of) file to temporary -" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) +" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("<slnum>")) exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) endif @@ -2316,7 +2316,7 @@ fun! netrw#NetWrite(...) range " Process arguments: {{{4 " attempt to repeat with previous host-file-etc if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("<slnum>")) let choice = b:netrw_lastfile let ichoice= ichoice + 1 else @@ -2364,7 +2364,7 @@ fun! netrw#NetWrite(...) range endif endif let ichoice= ichoice + 1 -" call Decho("choice<" . choice . "> ichoice=".ichoice) +" call Decho("choice<" . choice . "> ichoice=".ichoice,'~'.expand("<slnum>")) " Determine method of write (ftp, rcp, etc) {{{4 NetrwKeepj call s:NetrwMethod(choice) @@ -2378,13 +2378,13 @@ fun! netrw#NetWrite(...) range " ============================ if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 echo "(netrw) Processing your write request..." -" call Decho("(netrw) Processing your write request...") +" call Decho("(netrw) Processing your write request...",'~'.expand("<slnum>")) endif "......................................... " NetWrite: (rcp) NetWrite Method #1 {{{3 if b:netrw_method == 1 -" call Decho("write via rcp (method #1)") +" call Decho("write via rcp (method #1)",'~'.expand("<slnum>")) if s:netrw_has_nt_rcp == 1 if exists("g:netrw_uid") && ( g:netrw_uid != "" ) let uid_machine = g:netrw_machine .'.'. g:netrw_uid @@ -2398,36 +2398,36 @@ fun! netrw#NetWrite(...) range let uid_machine = g:netrw_machine endif endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3 elseif b:netrw_method == 2 -" call Decho("write via ftp+.netrc (method #2)") +" call Decho("write via ftp+.netrc (method #2)",'~'.expand("<slnum>")) let netrw_fname = b:netrw_fname " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let bhkeep = &l:bh let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew -" call Decho("filter input window#".winnr()) +" call Decho("filter input window#".winnr(),'~'.expand("<slnum>")) setl ff=unix NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$")) +" call Decho("filter input: ".getline("$"),'~'.expand("<slnum>")) endif NetrwKeepj call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"') -" call Decho("filter input: ".getline("$")) +" call Decho("filter input: ".getline("$"),'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else -" call Decho("filter input window#".winnr()) - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) +" call Decho("filter input window#".winnr(),'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" @@ -2449,44 +2449,44 @@ fun! netrw#NetWrite(...) range " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3 elseif b:netrw_method == 3 " Construct execution string (three or more lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)") +" call Decho("read via ftp+mipf (method #3)",'~'.expand("<slnum>")) let netrw_fname = b:netrw_fname let bhkeep = &l:bh " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) else NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) if exists("s:netrw_passwd") && s:netrw_passwd != "" NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) elseif exists("s:netrw_passwd") && s:netrw_passwd != "" NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif endif NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$")) +" call Decho("filter input: ".getline("$"),'~'.expand("<slnum>")) endif NetrwKeepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) " save choice/id/password for future use let b:netrw_lastfile = choice @@ -2513,23 +2513,23 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (scp) NetWrite Method #4 {{{3 elseif b:netrw_method == 4 -" call Decho("write via scp (method #4)") +" call Decho("write via scp (method #4)",'~'.expand("<slnum>")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port) else let useport= "" endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... " NetWrite: (http) NetWrite Method #5 {{{3 elseif b:netrw_method == 5 -" call Decho("write via http (method #5)") +" call Decho("write via http (method #5)",'~'.expand("<slnum>")) let curl= substitute(g:netrw_http_put_cmd,'\s\+.*$',"","") if executable(curl) let url= g:netrw_choice - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".shellescape(tmpfile,1)." ".shellescape(url,1) ) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(url,1) ) elseif !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd".">".",16) endif @@ -2537,7 +2537,7 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3 elseif b:netrw_method == 6 -" call Decho("write via cadaver (method #6)") +" call Decho("write via cadaver (method #6)",'~'.expand("<slnum>")) " Construct execution string (four lines) which will be passed through filter let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape) @@ -2546,7 +2546,7 @@ fun! netrw#NetWrite(...) range " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" @@ -2574,14 +2574,14 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (rsync) NetWrite Method #7 {{{3 elseif b:netrw_method == 7 -" call Decho("write via rsync (method #7)") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) +" call Decho("write via rsync (method #7)",'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... " NetWrite: (sftp) NetWrite Method #9 {{{3 elseif b:netrw_method == 9 -" call Decho("write via sftp (method #9)") +" call Decho("write via sftp (method #9)",'~'.expand("<slnum>")) 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 @@ -2593,13 +2593,13 @@ fun! netrw#NetWrite(...) range let bhkeep = &l:bh let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew setl ff=unix call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) let sftpcmd= substitute(g:netrw_sftp_cmd,"%TEMPFILE%",escape(tmpfile,'\'),"g") - call s:NetrwExe(s:netrw_silentxfer."%!".sftpcmd.' '.shellescape(uid_machine,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".sftpcmd.' '.s:ShellEscape(uid_machine,1)) let filtbuf= bufnr("%") exe curbuf."b!" let &l:bh = bhkeep @@ -2615,9 +2615,9 @@ fun! netrw#NetWrite(...) range endwhile " NetWrite: Cleanup: {{{3 -" call Decho("cleanup") +" call Decho("cleanup",'~'.expand("<slnum>")) if s:FileReadable(tmpfile) -" call Decho("tmpfile<".tmpfile."> readable, will now delete it") +" call Decho("tmpfile<".tmpfile."> readable, will now delete it",'~'.expand("<slnum>")) call s:NetrwDelete(tmpfile) endif call s:NetrwOptionRestore("w:") @@ -2625,12 +2625,12 @@ fun! netrw#NetWrite(...) range if a:firstline == 1 && a:lastline == line("$") " restore modifiability; usually equivalent to set nomod let &mod= mod -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) elseif !exists("leavemod") " indicate that the buffer has not been modified since last written -" call Decho("set nomod") +" call Decho("set nomod",'~'.expand("<slnum>")) setl nomod -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif " call Dret("netrw#NetWrite") @@ -2659,11 +2659,11 @@ fun! netrw#NetSource(...) let i= 1 while i <= a:0 call netrw#NetRead(3,a:{i}) -" call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">") +" call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">",'~'.expand("<slnum>")) if s:FileReadable(s:netrw_tmpfile) -" call Decho("exe so ".fnameescape(s:netrw_tmpfile)) +" call Decho("exe so ".fnameescape(s:netrw_tmpfile),'~'.expand("<slnum>")) exe "so ".fnameescape(s:netrw_tmpfile) -" call Decho("delete(".s:netrw_tmpfile.")") +" call Decho("delete(".s:netrw_tmpfile.")",'~'.expand("<slnum>")) call delete(s:netrw_tmpfile) unlet s:netrw_tmpfile else @@ -2683,33 +2683,37 @@ fun! netrw#SetTreetop(...) " clear out the current tree if exists("w:netrw_treetop") -" call Decho("clearing out current tree") +" call Decho("clearing out current tree",'~'.expand("<slnum>")) let inittreetop= w:netrw_treetop unlet w:netrw_treetop endif if exists("w:netrw_treedict") -" call Decho("freeing w:netrw_treedict") +" call Decho("freeing w:netrw_treedict",'~'.expand("<slnum>")) unlet w:netrw_treedict endif if a:1 == "" && exists("inittreetop") let treedir= s:NetrwTreePath(inittreetop) -" call Decho("treedir<".treedir.">") +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) else - if isdirectory(a:1) -" call Decho("a:1<".a:1."> is a directory") + if isdirectory(s:NetrwFile(a:1)) +" call Decho("a:1<".a:1."> is a directory",'~'.expand("<slnum>")) let treedir= a:1 - elseif exists("b:netrw_curdir") && isdirectory(b:netrw_curdir."/".a:1) + elseif exists("b:netrw_curdir") && (isdirectory(s:NetrwFile(b:netrw_curdir."/".a:1)) || a:1 =~ '^\a\{3,}://') let treedir= b:netrw_curdir."/".a:1 -" call Decho("a:1<".a:1."> is NOT a directory, trying treedir<".treedir.">") +" call Decho("a:1<".a:1."> is NOT a directory, trying treedir<".treedir.">",'~'.expand("<slnum>")) else + " normally the cursor is left in the message window. + " However, here this results in the directory being listed in the message window, which is not wanted. + let netrwbuf= bufnr("%") call netrw#ErrorMsg(s:ERROR,"sorry, ".a:1." doesn't seem to be a directory!",95) + exe bufwinnr(netrwbuf)."wincmd w" let treedir= "." endif endif -" call Decho("treedir<".treedir.">") - let islocal= expand("%") !~ '^\a\+://' -" call Decho("islocal=".islocal) +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) + let islocal= expand("%") !~ '^\a\{3,}://' +" call Decho("islocal=".islocal,'~'.expand("<slnum>")) if islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(islocal,treedir)) else @@ -2729,14 +2733,14 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " readcmd=='t': simply do nothing if a:readcmd == 't' -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("NetrwGetFile : skip read of <".a:tfile.">") return endif " get name of remote filename (ie. url and all) let rfile= bufname("%") -" call Decho("rfile<".rfile.">") +" call Decho("rfile<".rfile.">",'~'.expand("<slnum>")) if exists("*NetReadFixup") " for the use of NetReadFixup (not otherwise used internally) @@ -2745,7 +2749,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) if a:readcmd[0] == '%' " get file into buffer -" call Decho("get file into buffer") +" call Decho("get file into buffer",'~'.expand("<slnum>")) " rename the current buffer to the temp file (ie. tfile) if g:netrw_cygwin @@ -2753,41 +2757,41 @@ fun! s:NetrwGetFile(readcmd, tfile, method) else let tfile= a:tfile endif -" call Decho("exe sil! keepalt file ".fnameescape(tfile)) +" call Decho("exe sil! keepalt file ".fnameescape(tfile),'~'.expand("<slnum>")) exe "sil! keepalt file ".fnameescape(tfile) " edit temporary file (ie. read the temporary file in) if rfile =~ '\.zip$' -" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)") +" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)",'~'.expand("<slnum>")) call zip#Browse(tfile) elseif rfile =~ '\.tar$' -" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)") +" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)",'~'.expand("<slnum>")) call tar#Browse(tfile) elseif rfile =~ '\.tar\.gz$' -" call Decho("handling remote gzip-compressed tar file") +" call Decho("handling remote gzip-compressed tar file",'~'.expand("<slnum>")) call tar#Browse(tfile) elseif rfile =~ '\.tar\.bz2$' -" call Decho("handling remote bz2-compressed tar file") +" call Decho("handling remote bz2-compressed tar file",'~'.expand("<slnum>")) call tar#Browse(tfile) elseif rfile =~ '\.tar\.xz$' -" call Decho("handling remote xz-compressed tar file") +" call Decho("handling remote xz-compressed tar file",'~'.expand("<slnum>")) call tar#Browse(tfile) elseif rfile =~ '\.txz$' -" call Decho("handling remote xz-compressed tar file (.txz)") +" call Decho("handling remote xz-compressed tar file (.txz)",'~'.expand("<slnum>")) call tar#Browse(tfile) else -" call Decho("edit temporary file") +" call Decho("edit temporary file",'~'.expand("<slnum>")) NetrwKeepj e! endif " rename buffer back to remote filename -" call Decho("exe sil! keepalt file ".fnameescape(rfile)) +" call Decho("exe sil! keepalt file ".fnameescape(rfile),'~'.expand("<slnum>")) exe "sil! NetrwKeepj keepalt file ".fnameescape(rfile) " 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") +" call Decho("detect filetype of local version of remote file",'~'.expand("<slnum>")) let iskkeep= &l:isk setl isk-=/ let &l:isk= iskkeep @@ -2798,23 +2802,23 @@ fun! s:NetrwGetFile(readcmd, tfile, method) elseif !&ma " attempting to read a file after the current line in the file, but the buffer is not modifiable NetrwKeepj call netrw#ErrorMsg(s:WARNING,"attempt to read<".a:tfile."> into a non-modifiable buffer!",94) -" call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!") +" call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!") return elseif s:FileReadable(a:tfile) " read file after current line -" call Decho("read file<".a:tfile."> after current line") +" call Decho("read file<".a:tfile."> after current line",'~'.expand("<slnum>")) let curline = line(".") let lastline= line("$") -" call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline) +" call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline,'~'.expand("<slnum>")) exe "NetrwKeepj ".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile) let line1= curline + 1 let line2= line("$") - lastline + 1 else " not readable -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("tfile<".a:tfile."> not readable") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Decho("tfile<".a:tfile."> not readable",'~'.expand("<slnum>")) NetrwKeepj call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) " call Dret("NetrwGetFile : tfile<".a:tfile."> not readable") return @@ -2822,10 +2826,10 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " User-provided (ie. optional) fix-it-up command if exists("*NetReadFixup") -" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") +" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")",'~'.expand("<slnum>")) NetrwKeepj call NetReadFixup(a:method, line1, line2) " else " Decho -" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")") +" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")",'~'.expand("<slnum>")) endif if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu @@ -2833,12 +2837,12 @@ fun! s:NetrwGetFile(readcmd, tfile, method) NetrwKeepj call s:UpdateBuffersMenu() endif -" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile)) +" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile),'~'.expand("<slnum>")) " make sure file is being displayed " redraw! -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("NetrwGetFile") endfun @@ -2847,15 +2851,15 @@ endfun " Input: " choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file] " Output: -" b:netrw_method= 1: rcp -" 2: ftp + <.netrc> -" 3: ftp + machine, id, password, and [path]filename -" 4: scp -" 5: http[s] (wget) +" b:netrw_method= 1: rcp +" 2: ftp + <.netrc> +" 3: ftp + machine, id, password, and [path]filename +" 4: scp +" 5: http[s] (wget) " 6: dav -" 7: rsync -" 8: fetch -" 9: sftp +" 7: rsync +" 8: fetch +" 9: sftp " 10: file " g:netrw_machine= hostname " b:netrw_fname = filename @@ -2876,7 +2880,7 @@ fun! s:NetrwMethod(choice) " curmachine used if protocol == ftp and no .netrc if exists("g:netrw_machine") let curmachine= g:netrw_machine -" call Decho("curmachine<".curmachine.">") +" call Decho("curmachine<".curmachine.">",'~'.expand("<slnum>")) else let curmachine= "N O T A HOST" endif @@ -2921,11 +2925,11 @@ fun! s:NetrwMethod(choice) let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' let fileurm = '^file\=://\(.*\)$' -" call Decho("determine method:") +" call Decho("determine method:",'~'.expand("<slnum>")) " Determine Method " Method#1: rcp://user@hostname/...path-to-file {{{3 if match(a:choice,rcpurm) == 0 -" call Decho("rcp://...") +" call Decho("rcp://...",'~'.expand("<slnum>")) let b:netrw_method = 1 let userid = substitute(a:choice,rcpurm,'\1',"") let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"") @@ -2936,7 +2940,7 @@ fun! s:NetrwMethod(choice) " Method#4: scp://user@hostname/...path-to-file {{{3 elseif match(a:choice,scpurm) == 0 -" call Decho("scp://...") +" call Decho("scp://...",'~'.expand("<slnum>")) let b:netrw_method = 4 let g:netrw_machine = substitute(a:choice,scpurm,'\1',"") let g:netrw_port = substitute(a:choice,scpurm,'\2',"") @@ -2944,7 +2948,7 @@ fun! s:NetrwMethod(choice) " Method#5: http[s]://user@hostname/...path-to-file {{{3 elseif match(a:choice,httpurm) == 0 -" call Decho("http[s]://...") +" call Decho("http[s]://...",'~'.expand("<slnum>")) let b:netrw_method = 5 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") @@ -2952,7 +2956,7 @@ fun! s:NetrwMethod(choice) " Method#6: dav://hostname[:port]/..path-to-file.. {{{3 elseif match(a:choice,davurm) == 0 -" call Decho("dav://...") +" call Decho("dav://...",'~'.expand("<slnum>")) let b:netrw_method= 6 if a:choice =~ 'davs:' let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") @@ -2963,19 +2967,19 @@ fun! s:NetrwMethod(choice) " Method#7: rsync://user@hostname/...path-to-file {{{3 elseif match(a:choice,rsyncurm) == 0 -" call Decho("rsync://...") +" call Decho("rsync://...",'~'.expand("<slnum>")) let b:netrw_method = 7 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") " Methods 2,3: ftp://[user@]hostname[[:#]port]/...path-to-file {{{3 elseif match(a:choice,ftpurm) == 0 -" call Decho("ftp://...") +" call Decho("ftp://...",'~'.expand("<slnum>")) let userid = substitute(a:choice,ftpurm,'\2',"") let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") -" call Decho("g:netrw_machine<".g:netrw_machine.">") +" call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("<slnum>")) if userid != "" let g:netrw_uid= userid endif @@ -3000,15 +3004,15 @@ fun! s:NetrwMethod(choice) call NetUserPass("ftp:".host) elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~ '-[sS]:' -" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">") -" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">") +" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("<slnum>")) +" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">",'~'.expand("<slnum>")) if g:netrw_ftp_cmd =~ '-[sS]:\S*MACHINE\>' let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\<MACHINE\>',g:netrw_machine,'') -" call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">") +" call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("<slnum>")) endif let b:netrw_method= 2 elseif s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc -" call Decho("using <".expand("$HOME/.netrc")."> (readable)") +" call Decho("using <".expand("$HOME/.netrc")."> (readable)",'~'.expand("<slnum>")) let b:netrw_method= 2 else if !exists("g:netrw_uid") || g:netrw_uid == "" @@ -3023,7 +3027,7 @@ fun! s:NetrwMethod(choice) " Method#8: fetch {{{3 elseif match(a:choice,fetchurm) == 0 -" call Decho("fetch://...") +" call Decho("fetch://...",'~'.expand("<slnum>")) let b:netrw_method = 8 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") @@ -3032,7 +3036,7 @@ fun! s:NetrwMethod(choice) " Method#3: Issue an ftp : "machine id password [path/]filename" {{{3 elseif match(a:choice,mipf) == 0 -" call Decho("(ftp) host id pass file") +" call Decho("(ftp) host id pass file",'~'.expand("<slnum>")) let b:netrw_method = 3 let g:netrw_machine = substitute(a:choice,mipf,'\1',"") let g:netrw_uid = substitute(a:choice,mipf,'\2',"") @@ -3042,7 +3046,7 @@ fun! s:NetrwMethod(choice) " Method#3: Issue an ftp: "hostname [path/]filename" {{{3 elseif match(a:choice,mf) == 0 -" call Decho("(ftp) host file") +" call Decho("(ftp) host file",'~'.expand("<slnum>")) if exists("g:netrw_uid") && exists("s:netrw_passwd") let b:netrw_method = 3 let g:netrw_machine = substitute(a:choice,mf,'\1',"") @@ -3056,32 +3060,32 @@ fun! s:NetrwMethod(choice) " Method#9: sftp://user@hostname/...path-to-file {{{3 elseif match(a:choice,sftpurm) == 0 -" call Decho("sftp://...") +" call Decho("sftp://...",'~'.expand("<slnum>")) let b:netrw_method = 9 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") " Method#1: Issue an rcp: hostname:filename" (this one should be last) {{{3 elseif match(a:choice,rcphf) == 0 -" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") +" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">",'~'.expand("<slnum>")) let b:netrw_method = 1 let userid = substitute(a:choice,rcphf,'\2',"") let g:netrw_machine = substitute(a:choice,rcphf,'\3',"") let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") -" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") -" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") -" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") -" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") +" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">",'~'.expand("<slnum>")) +" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">",'~'.expand("<slnum>")) +" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">",'~'.expand("<slnum>")) +" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">",'~'.expand("<slnum>")) if userid != "" let g:netrw_uid= userid endif " Method#10: file://user@hostname/...path-to-file {{{3 elseif match(a:choice,fileurm) == 0 && exists("g:netrw_file_cmd") -" call Decho("http[s]://...") +" call Decho("http[s]://...",'~'.expand("<slnum>")) let b:netrw_method = 10 let b:netrw_fname = substitute(a:choice,fileurm,'\1',"") -" call Decho('\1<'.substitute(a:choice,fileurm,'\1',"").">") +" call Decho('\1<'.substitute(a:choice,fileurm,'\1',"").">",'~'.expand("<slnum>")) " Cannot Determine Method {{{3 else @@ -3100,17 +3104,17 @@ fun! s:NetrwMethod(choice) let g:netrw_port= netrw_port endif -" call Decho("a:choice <".a:choice.">") -" call Decho("b:netrw_method <".b:netrw_method.">") -" call Decho("g:netrw_machine<".g:netrw_machine.">") -" call Decho("g:netrw_port <".g:netrw_port.">") +" call Decho("a:choice <".a:choice.">",'~'.expand("<slnum>")) +" call Decho("b:netrw_method <".b:netrw_method.">",'~'.expand("<slnum>")) +" call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("<slnum>")) +" call Decho("g:netrw_port <".g:netrw_port.">",'~'.expand("<slnum>")) " if exists("g:netrw_uid") "Decho -" call Decho("g:netrw_uid <".g:netrw_uid.">") +" call Decho("g:netrw_uid <".g:netrw_uid.">",'~'.expand("<slnum>")) " endif "Decho " if exists("s:netrw_passwd") "Decho -" call Decho("s:netrw_passwd <".s:netrw_passwd.">") +" call Decho("s:netrw_passwd <".s:netrw_passwd.">",'~'.expand("<slnum>")) " endif "Decho -" call Decho("b:netrw_fname <".b:netrw_fname.">") +" call Decho("b:netrw_fname <".b:netrw_fname.">",'~'.expand("<slnum>")) " call Dret("NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port) endfun @@ -3189,14 +3193,14 @@ fun! NetUserPass(...) if a:1 =~ '^ftp:' " get host from ftp:... url " access userid and password from hup (host-user-passwd) dictionary -" call Decho("case a:0=1: a:1<".a:1."> (get host from ftp:... url)") +" call Decho("case a:0=1: a:1<".a:1."> (get host from ftp:... url)",'~'.expand("<slnum>")) let host = substitute(a:1,'^ftp:','','') let host = substitute(host,'\..*','','') if exists("s:netrw_hup[host]") let g:netrw_uid = s:netrw_hup[host].uid let s:netrw_passwd = s:netrw_hup[host].passwd -" call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") -" call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") +" call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("<slnum>")) +" call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("<slnum>")) else let g:netrw_uid = input("Enter UserId: ") let s:netrw_passwd = inputsecret("Enter Password: ") @@ -3204,7 +3208,7 @@ fun! NetUserPass(...) else " case: one input argument, not an url. Using it as a new user-id. -" call Decho("case a:0=1: a:1<".a:1."> (get host from input argument, not an url)") +" call Decho("case a:0=1: a:1<".a:1."> (get host from input argument, not an url)",'~'.expand("<slnum>")) if exists("g:netrw_machine") if g:netrw_machine =~ '[0-9.]\+' let host= g:netrw_machine @@ -3215,7 +3219,7 @@ fun! NetUserPass(...) let g:netrw_machine= input('Enter hostname: ') endif let g:netrw_uid = a:1 -" call Decho("set g:netrw_uid= <".g:netrw_uid.">") +" call Decho("set g:netrw_uid= <".g:netrw_uid.">",'~'.expand("<slnum>")) if exists("g:netrw_passwd") " ask for password if one not previously entered let s:netrw_passwd= g:netrw_passwd @@ -3224,7 +3228,7 @@ fun! NetUserPass(...) endif endif -" call Decho("host<".host.">") +" call Decho("host<".host.">",'~'.expand("<slnum>")) if exists("host") if !exists('s:netrw_hup[host]') let s:netrw_hup[host]= {} @@ -3248,8 +3252,8 @@ fun! NetUserPass(...) let s:netrw_hup[host].passwd = a:3 let g:netrw_uid = s:netrw_hup[host].uid let s:netrw_passwd = s:netrw_hup[host].passwd -" call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") -" call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") +" call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("<slnum>")) +" call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("<slnum>")) endif " call Dret("NetUserPass : uid<".g:netrw_uid."> passwd<".s:netrw_passwd.">") @@ -3264,9 +3268,9 @@ endfun fun! s:ExplorePatHls(pattern) " call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)") let repat= substitute(a:pattern,'^**/\{1,2}','','') -" call Decho("repat<".repat.">") +" call Decho("repat<".repat.">",'~'.expand("<slnum>")) let repat= escape(repat,'][.\') -" call Decho("repat<".repat.">") +" call Decho("repat<".repat.">",'~'.expand("<slnum>")) let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>' " call Dret("s:ExplorePatHls repat<".repat.">") return repat @@ -3293,7 +3297,7 @@ fun! s:NetrwBookHistHandler(chg,curdir) if a:chg == 0 " bookmark the current directory -" call Decho("(user: <b>) bookmark the current directory") +" call Decho("(user: <b>) bookmark the current directory",'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{curbufnr}") call s:NetrwBookmark(0) echo "bookmarked marked files" @@ -3304,9 +3308,9 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 1 " change to the bookmarked directory -" call Decho("(user: <".v:count."gb>) change to the bookmarked directory") +" call Decho("(user: <".v:count."gb>) change to the bookmarked directory",'~'.expand("<slnum>")) if exists("g:netrw_bookmarklist[v:count-1]") -" call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist)) +" call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("<slnum>")) exe "NetrwKeepj e ".fnameescape(g:netrw_bookmarklist[v:count-1]) else echomsg "Sorry, bookmark#".v:count." doesn't exist!" @@ -3316,12 +3320,12 @@ fun! s:NetrwBookHistHandler(chg,curdir) " redraw! let didwork= 0 " list user's bookmarks -" call Decho("(user: <q>) list user's bookmarks") +" call Decho("(user: <q>) list user's bookmarks",'~'.expand("<slnum>")) if exists("g:netrw_bookmarklist") -" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks') +" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks','~'.expand("<slnum>")) let cnt= 1 for bmd in g:netrw_bookmarklist -" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]) +" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1],'~'.expand("<slnum>")) echo printf("Netrw Bookmark#%-2d: %s",cnt,g:netrw_bookmarklist[cnt-1]) let didwork = 1 let cnt = cnt + 1 @@ -3334,9 +3338,9 @@ fun! s:NetrwBookHistHandler(chg,curdir) let histcnt = 0 if g:netrw_dirhistmax > 0 while ( first || cnt != g:netrw_dirhist_cnt ) -" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt) +" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt,'~'.expand("<slnum>")) if exists("g:netrw_dirhist_{cnt}") -" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt}) +" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt},'~'.expand("<slnum>")) echo printf("Netrw History#%-2d: %s",histcnt,g:netrw_dirhist_{cnt}) let didwork= 1 endif @@ -3356,18 +3360,18 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 3 " saves most recently visited directories (when they differ) -" call Decho("(browsing) record curdir history") +" call Decho("(browsing) record curdir history",'~'.expand("<slnum>")) if !exists("g:netrw_dirhist_cnt") || !exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") || g:netrw_dirhist_{g:netrw_dirhist_cnt} != a:curdir if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt = ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax let g:netrw_dirhist_{g:netrw_dirhist_cnt} = a:curdir endif -" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") +" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("<slnum>")) endif elseif a:chg == 4 " u: change to the previous directory stored on the history list -" call Decho("(user: <u>) chg to prev dir from history") +" call Decho("(user: <u>) chg to prev dir from history",'~'.expand("<slnum>")) if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - v:count1 ) % g:netrw_dirhistmax if g:netrw_dirhist_cnt < 0 @@ -3377,16 +3381,16 @@ fun! s:NetrwBookHistHandler(chg,curdir) let g:netrw_dirhist_cnt= 0 endif if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") +" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") setl ma noro -" call Decho("setl ma noro") - sil! NetrwKeepj %d +" call Decho("setl ma noro",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ setl nomod -" call Decho("setl nomod") -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("setl nomod",'~'.expand("<slnum>")) +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}),'~'.expand("<slnum>")) exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else if g:netrw_dirhistmax > 0 @@ -3399,21 +3403,21 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 5 " U: change to the subsequent directory stored on the history list -" call Decho("(user: <U>) chg to next dir from history") +" call Decho("(user: <U>) chg to next dir from history",'~'.expand("<slnum>")) if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") +" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) setl ma noro - sil! NetrwKeepj %d -" call Decho("removed all lines from buffer (%d)") -" call Decho("setl nomod") + sil! NetrwKeepj %d _ +" call Decho("removed all lines from buffer (%d)",'~'.expand("<slnum>")) +" call Decho("setl nomod",'~'.expand("<slnum>")) setl nomod -" call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}),'~'.expand("<slnum>")) exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax @@ -3428,18 +3432,22 @@ fun! s:NetrwBookHistHandler(chg,curdir) endif elseif a:chg == 6 +" call Decho("(user: <mB>) delete bookmark'd directory",'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{curbufnr}") call s:NetrwBookmark(1) echo "removed marked files from bookmarks" else " delete the v:count'th bookmark -" call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">") + let iremove = v:count + let dremove = g:netrw_bookmarklist[iremove - 1] +" call Decho("delete bookmark#".iremove."<".g:netrw_bookmarklist[iremove - 1].">",'~'.expand("<slnum>")) call s:MergeBookmarks() -" call Decho("remove g:netrw_bookmarklist[".(v:count-1)."]") - NetrwKeepj call remove(g:netrw_bookmarklist,v:count-1) - echo "removed current directory from bookmarks" +" call Decho("remove g:netrw_bookmarklist[".(iremove-1)."]<".g:netrw_bookmarklist[(iremove-1)].">",'~'.expand("<slnum>")) + NetrwKeepj call remove(g:netrw_bookmarklist,iremove-1) + echo "removed ".dremove." from g:netrw_bookmarklist" +" call Decho("g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("<slnum>")) endif -" call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist)) +" call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("<slnum>")) endif call s:NetrwBookmarkMenu() call s:NetrwTgtMenu() @@ -3461,14 +3469,14 @@ fun! s:NetrwBookHistRead() if !exists("s:netrw_initbookhist") let home = s:NetrwHome() let savefile= home."/.netrwbook" - if filereadable(savefile) -" call Decho("sourcing .netrwbook") + if filereadable(s:NetrwFile(savefile)) +" call Decho("sourcing .netrwbook",'~'.expand("<slnum>")) exe "keepalt NetrwKeepj so ".savefile endif if g:netrw_dirhistmax > 0 let savefile= home."/.netrwhist" - if filereadable(savefile) -" call Decho("sourcing .netrwhist") + if filereadable(s:NetrwFile(savefile)) +" call Decho("sourcing .netrwhist",'~'.expand("<slnum>")) exe "keepalt NetrwKeepj so ".savefile endif let s:netrw_initbookhist= 1 @@ -3500,7 +3508,7 @@ fun! s:NetrwBookHistSave() setl nocin noai noci magic nospell nohid wig= noaw setl ma noro write if exists("+acd") | setl noacd | endif - sil! NetrwKeepj keepalt %d + sil! NetrwKeepj keepalt %d _ " save .netrwhist -- no attempt to merge sil! keepalt file .netrwhist @@ -3514,12 +3522,12 @@ fun! s:NetrwBookHistSave() endwhile exe "sil! w! ".savefile - sil NetrwKeepj %d + sil NetrwKeepj %d _ if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] " merge and write .netrwbook let savefile= s:NetrwHome()."/.netrwbook" - if filereadable(savefile) + if filereadable(s:NetrwFile(savefile)) let booklist= deepcopy(g:netrw_bookmarklist) exe "sil NetrwKeepj keepalt so ".savefile for bdm in booklist @@ -3546,10 +3554,12 @@ endfun " list of the contents of a local or remote directory. It is assumed that the " g:netrw_list_cmd has a string, USEPORT HOSTNAME, that needs to be substituted " with the requested remote hostname first. +" Often called via: Explore/e dirname/etc -> netrw#LocalBrowseCheck() -> s:NetrwBrowse() fun! s:NetrwBrowse(islocal,dirname) if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif " 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 Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dredir("ls!") " save alternate-file's filename if w:netrw_rexlocal doesn't exist @@ -3564,7 +3574,7 @@ fun! s:NetrwBrowse(islocal,dirname) endif " s:NetrwBrowse : simplify the dirname (especially for ".."s in dirnames) {{{3 - if a:dirname !~ '^\a\+://' + if a:dirname !~ '^\a\{3,}://' let dirname= simplify(a:dirname) else let dirname= a:dirname @@ -3572,7 +3582,7 @@ fun! s:NetrwBrowse(islocal,dirname) if exists("s:netrw_skipbrowse") unlet s:netrw_skipbrowse -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." filename<".expand("%")."> win#".winnr()." ft<".&ft.">") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." filename<".expand("%")."> win#".winnr()." ft<".&ft.">",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : s:netrw_skipbrowse existed") return endif @@ -3590,54 +3600,54 @@ fun! s:NetrwBrowse(islocal,dirname) endif " s:NetrwBrowse : save options: {{{3 - call s:NetrwOptionSave("w:") + call s:NetrwOptionSave("w:") " s:NetrwBrowse : re-instate any marked files {{{3 if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("clearing marked files") +" call Decho("clearing marked files",'~'.expand("<slnum>")) 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("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") +" call Decho("handle w:netrw_acdkeep:",'~'.expand("<slnum>")) +" call Decho("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")",'~'.expand("<slnum>")) call s:NetrwLcd(dirname) call s:NetrwSafeOptions() -" call Decho("getcwd<".getcwd().">") +" call Decho("getcwd<".getcwd().">",'~'.expand("<slnum>")) elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' " s:NetrwBrowse : remote regular file handler {{{3 -" call Decho("handle remote regular file: dirname<".dirname.">") +" call Decho("handle remote regular file: dirname<".dirname.">",'~'.expand("<slnum>")) if bufname(dirname) != "" -" call Decho("edit buf#".bufname(dirname)." in win#".winnr()) +" call Decho("edit buf#".bufname(dirname)." in win#".winnr(),'~'.expand("<slnum>")) exe "NetrwKeepj b ".bufname(dirname) else " attempt transfer of remote regular file -" call Decho("attempt transfer as regular file<".dirname.">") +" call Decho("attempt transfer as regular file<".dirname.">",'~'.expand("<slnum>")) " 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 Decho("new path<".path.">",'~'.expand("<slnum>")) call s:RemotePathAnalysis(dirname) " s:NetrwBrowse : remote-read the requested file into current buffer {{{3 call s:NetrwEnew(dirname) call s:NetrwSafeOptions() setl ma noro -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) let b:netrw_curdir = dirname let url = s:method."://".((s:user == "")? "" : s:user."@").s:machine.(s:port ? ":".s:port : "")."/".s:path -" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")") +" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")",'~'.expand("<slnum>")) exe "sil! NetrwKeepj keepalt file ".fnameescape(url) exe "sil! NetrwKeepj keepalt doau BufReadPre ".fnameescape(s:fname) sil call netrw#NetRead(2,url) " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error -" call Decho("url<".url.">") -" call Decho("s:path<".s:path.">") -" call Decho("s:fname<".s:fname.">") +" call Decho("url<".url.">",'~'.expand("<slnum>")) +" call Decho("s:path<".s:path.">",'~'.expand("<slnum>")) +" call Decho("s:fname<".s:fname.">",'~'.expand("<slnum>")) if s:path =~ '.bz2' exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.bz2$','','')) elseif s:path =~ '.gz' @@ -3652,9 +3662,9 @@ fun! s:NetrwBrowse(islocal,dirname) " s:NetrwBrowse : save certain window-oriented variables into buffer-oriented variables {{{3 call s:SetBufWinVars() call s:NetrwOptionRestore("w:") -" call Decho("setl ma nomod") +" call Decho("setl ma nomod",'~'.expand("<slnum>")) setl ma nomod noro -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : file<".s:fname.">") return @@ -3672,29 +3682,30 @@ fun! s:NetrwBrowse(islocal,dirname) NetrwKeepj call s:NetrwMenu(1) " get/set-up buffer {{{3 -" call Decho("saving position across a buffer refresh") +" call Decho("saving position across a buffer refresh",'~'.expand("<slnum>")) let svpos = netrw#SavePosn() let reusing= s:NetrwGetBuffer(a:islocal,dirname) + " maintain markfile highlighting if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" call Decho("bufnr(%)=".bufnr('%')) -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/") +" call Decho("bufnr(%)=".bufnr('%'),'~'.expand("<slnum>")) +" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("<slnum>")) exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" else -" call Decho("2match none") +" call Decho("2match none",'~'.expand("<slnum>")) 2match none endif if reusing && line("$") > 1 call s:NetrwOptionRestore("w:") -" call Decho("setl noma nomod nowrap") +" call Decho("setl noma nomod nowrap",'~'.expand("<slnum>")) setl noma nomod nowrap -" call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : re-using not-cleared buffer") return endif " set b:netrw_curdir to the new directory name {{{3 -" call Decho("set b:netrw_curdir to the new directory name<".dirname."> (buf#".bufnr("%").")") +" call Decho("set b:netrw_curdir to the new directory name<".dirname."> (buf#".bufnr("%").")",'~'.expand("<slnum>")) let b:netrw_curdir= dirname if b:netrw_curdir =~ '[/\\]$' let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') @@ -3715,21 +3726,21 @@ fun! s:NetrwBrowse(islocal,dirname) if !a:islocal && b:netrw_curdir !~ '/$' let b:netrw_curdir= b:netrw_curdir.'/' endif -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) " ------------ " (local only) {{{3 " ------------ if a:islocal -" call Decho("local only:") +" call Decho("local only:",'~'.expand("<slnum>")) " Set up ShellCmdPost handling. Append current buffer to browselist call s:LocalFastBrowser() " handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3 if !g:netrw_keepdir -" call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist")) +" call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) +" call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist"),'~'.expand("<slnum>")) if !exists("&l:acd") || !&l:acd call s:NetrwLcd(b:netrw_curdir) endif @@ -3739,23 +3750,23 @@ fun! s:NetrwBrowse(islocal,dirname) " remote handling: {{{3 " -------------------------------- else -" call Decho("remote only:") +" call Decho("remote only:",'~'.expand("<slnum>")) " 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.">") +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">",'~'.expand("<slnum>")) if dirname =~ "^NetrwTreeListing\>" let dirname= b:netrw_curdir -" call Decho("(dirname was <NetrwTreeListing>) dirname<".dirname.">") +" call Decho("(dirname was <NetrwTreeListing>) dirname<".dirname.">",'~'.expand("<slnum>")) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") let dirname= substitute(b:netrw_curdir,'\\','/','g') if dirname !~ '/$' let dirname= dirname.'/' endif let b:netrw_curdir = dirname -" call Decho("(liststyle is TREELIST) dirname<".dirname.">") +" call Decho("(liststyle is TREELIST) dirname<".dirname.">",'~'.expand("<slnum>")) else let dirname = substitute(dirname,'\\','/','g') -" call Decho("(normal) dirname<".dirname.">") +" call Decho("(normal) dirname<".dirname.">",'~'.expand("<slnum>")) endif let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' @@ -3764,14 +3775,14 @@ fun! s:NetrwBrowse(islocal,dirname) NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) endif NetrwKeepj call s:NetrwOptionRestore("w:") -" call Decho("setl noma nomod nowrap") +" call Decho("setl noma nomod nowrap",'~'.expand("<slnum>")) setl noma nomod nowrap -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">") return endif let b:netrw_curdir= dirname -" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)") +" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)",'~'.expand("<slnum>")) endif " (additional remote handling) " ----------------------- @@ -3780,29 +3791,82 @@ fun! s:NetrwBrowse(islocal,dirname) NetrwKeepj call s:NetrwMaps(a:islocal) NetrwKeepj call s:NetrwCommands(a:islocal) NetrwKeepj call s:PerformListing(a:islocal) + + " If there is a rexposn: restore position with rexposn + " Otherwise : set rexposn + if exists("s:rexposn_".bufnr("%")) + NetrwKeepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) + else + NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir) + endif if v:version >= 700 && has("balloon_eval") && &beval == 0 && &l:bexpr == "" && !exists("g:netrw_nobeval") let &l:bexpr= "netrw#BalloonHelp()" -" call Decho("set up balloon help: l:bexpr=".&l:bexpr) +" call Decho("set up balloon help: l:bexpr=".&l:bexpr,'~'.expand("<slnum>")) setl beval endif call s:NetrwOptionRestore("w:") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) - " restore position and jumplist entry - if !reusing -" call Decho("restoring position across buffer refresh") + " restore position + if reusing +" call Decho("reusing=".reusing.": restoring position across buffer refresh",'~'.expand("<slnum>")) call netrw#RestorePosn(svpos) endif " The s:LocalBrowseRefresh() function is called by an autocmd " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed). " However, s:NetrwBrowse() causes the FocusGained event to fire the firstt time. - -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : did PerformListing ft<".&ft.">") return endfun " --------------------------------------------------------------------- +" s:NetrwFile: because of g:netrw_keepdir, isdirectory(), type(), etc may or {{{2 +" may not apply correctly; ie. netrw's idea of the current directory may +" differ from vim's. This function insures that netrw's idea of the current +" directory is used. +fun! s:NetrwFile(fname) +" call Dfunc("s:NetrwFile(fname<".a:fname.">)") + + if g:netrw_keepdir + " vim's idea of the current directory possibly may differ from netrw's + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + + if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) + if a:fname =~ '^\' || a:fname =~ '^\a:\' + " windows, but full path given + let ret= a:fname +" call Decho("windows+full path: isdirectory(".a:fname.")",'~'.expand("<slnum>")) + else + " windows, relative path given + let ret= s:ComposePath(b:netrw_curdir,a:fname) +" call Decho("windows+rltv path: isdirectory(".a:fname.")",'~'.expand("<slnum>")) + endif + + elseif a:fname =~ '^/' + " not windows, full path given + let ret= a:fname +" call Decho("unix+full path: isdirectory(".a:fname.")",'~'.expand("<slnum>")) + else + " not windows, relative path given + let ret= s:ComposePath(b:netrw_curdir,a:fname) +" call Decho("unix+rltv path: isdirectory(".a:fname.")",'~'.expand("<slnum>")) + endif + else + " vim and netrw agree on the current directory + let ret= a:fname +" call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("<slnum>")) + endif + +" call Dret("s:NetrwFile ".ret) + return ret +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.">) b:netrw_curdir<".b:netrw_curdir.">") @@ -3811,40 +3875,34 @@ fun! s:NetrwFileInfo(islocal,fname) if (has("unix") || has("macunix")) && executable("/bin/ls") if getline(".") == "../" - echo system("/bin/ls -lsad ".shellescape("..")) -" call Decho("#1: echo system(/bin/ls -lsad ".shellescape(..).")") + echo system("/bin/ls -lsad ".s:ShellEscape("..")) +" call Decho("#1: echo system(/bin/ls -lsad ".s:ShellEscape(..).")",'~'.expand("<slnum>")) elseif w:netrw_liststyle == s:TREELIST && getline(".") !~ '^'.s:treedepthstring - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir)) -" call Decho("#2: echo system(/bin/ls -lsad ".shellescape(b:netrw_curdir).")") + echo system("/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir)) +" call Decho("#2: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir).")",'~'.expand("<slnum>")) elseif exists("b:netrw_curdir") - if b:netrw_curdir =~ '/$' - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname)) -" call Decho("#3: echo system(/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname).")") - - else - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname)) -" call Decho("#4: echo system(/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname).")") - endif + echo system("/bin/ls -lsad ".s:ShellEscape(s:ComposePath(b:netrw_curdir,a:fname))) +" call Decho("#3: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir.a:fname).")",'~'.expand("<slnum>")) else -" call Decho('using ls '.a:fname." using cwd<".getcwd().">") - echo system("/bin/ls -lsad ".shellescape(a:fname)) -" call Decho("#5: echo system(/bin/ls -lsad ".shellescape(a:fname).")") +" call Decho('using ls '.a:fname." using cwd<".getcwd().">",'~'.expand("<slnum>")) + echo system("/bin/ls -lsad ".s:ShellEscape(s:NetrwFile(a:fname))) +" call Decho("#5: echo system(/bin/ls -lsad ".s:ShellEscape(a:fname).")",'~'.expand("<slnum>")) endif else " use vim functions to return information about file below cursor -" call Decho("using vim functions to query for file info") - if !isdirectory(a:fname) && !filereadable(a:fname) && a:fname =~ '[*@/]' +" call Decho("using vim functions to query for file info",'~'.expand("<slnum>")) + if !isdirectory(s:NetrwFile(a:fname)) && !filereadable(s:NetrwFile(a:fname)) && a:fname =~ '[*@/]' let fname= substitute(a:fname,".$","","") else let fname= a:fname endif - let t = getftime(fname) - let sz = getfsize(fname) - echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)) -" call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname))) + let t = getftime(s:NetrwFile(fname)) + let sz = getfsize(s:NetrwFile(fname)) + echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(s:NetrwFile(fname))) +" call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)),'~'.expand("<slnum>")) endif else echo "sorry, \"qf\" not supported yet for remote files" @@ -3856,45 +3914,46 @@ endfun " --------------------------------------------------------------------- " s:NetrwGetBuffer: {{{2 " returns 0=cleared buffer -" 1=re-used buffer +" 1=re-used buffer (buffer not cleared) fun! s:NetrwGetBuffer(islocal,dirname) " call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) let dirname= a:dirname " re-use buffer if possible {{{3 -" call Decho("--re-use a buffer if possible--") +" call Decho("--re-use a buffer if possible--",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " find NetrwTreeList buffer if there is one -" call Decho("case liststyle=treelist: find NetrwTreeList buffer if there is one") +" call Decho("case liststyle=treelist: find NetrwTreeList buffer if there is one",'~'.expand("<slnum>")) if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 -" call Decho(" re-using w:netrw_treebufnr=".w:netrw_treebufnr) +" call Decho(" re-using w:netrw_treebufnr=".w:netrw_treebufnr,'~'.expand("<slnum>")) let eikeep= &ei setl ei=all - exe "sil! noswapfile keepalt b ".w:netrw_treebufnr + exe "sil! keepj noswapfile keepalt b ".w:netrw_treebufnr let &ei= eikeep setl ma - sil! NetrwKeepj %d -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) + sil! NetrwKeepj %d _ +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("s:NetrwGetBuffer 0<buffer cleared> : bufnum#".w:netrw_treebufnr."<NetrwTreeListing>") return 0 endif let bufnum= -1 -" call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist") +" call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist",'~'.expand("<slnum>")) else " find buffer number of buffer named precisely the same as dirname {{{3 -" call Decho("case listtyle not treelist: 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--",'~'.expand("<slnum>")) " call Dredir("(NetrwGetBuffer) ls!","ls!") " get dirname and associated buffer number let bufnum = bufnr(escape(dirname,'\')) -" call Decho(" find buffer<".dirname.">'s number ") -" call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum) +" call Decho(" find buffer<".dirname.">'s number ",'~'.expand("<slnum>")) +" call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum,'~'.expand("<slnum>")) if bufnum < 0 && dirname !~ '/$' " try appending a trailing / -" call Decho(" try appending a trailing / to dirname<".dirname.">") +" call Decho(" try appending a trailing / to dirname<".dirname.">",'~'.expand("<slnum>")) let bufnum= bufnr(escape(dirname.'/','\')) if bufnum > 0 let dirname= dirname.'/' @@ -3903,43 +3962,43 @@ fun! s:NetrwGetBuffer(islocal,dirname) if bufnum < 0 && dirname =~ '/$' " try removing a trailing / -" call Decho(" try removing a trailing / from dirname<".dirname.">") +" call Decho(" try removing a trailing / from dirname<".dirname.">",'~'.expand("<slnum>")) let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\')) if bufnum > 0 let dirname= substitute(dirname,'/$','','') endif endif -" call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)") +" call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)",'~'.expand("<slnum>")) " 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.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'") +" call Decho(" handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'",'~'.expand("<slnum>")) let ibuf = 1 let buflast = bufnr("$") -" call Decho(" findbuf2: buflast=bufnr($)=".buflast) +" call Decho(" findbuf2: buflast=bufnr($)=".buflast,'~'.expand("<slnum>")) while ibuf <= buflast let bname= substitute(bufname(ibuf),'\\','/','g') let bname= substitute(bname,'.\zs/$','','') -" call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">") +" call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">",'~'.expand("<slnum>")) if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/' " bname is not empty " dirname ends with bname, " dirname doesn't start with /, so its not a absolute path -" call Decho(" findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/') +" call Decho(" findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/','~'.expand("<slnum>")) break endif if bname =~ '^'.dirname.'/\=$' " bname begins with dirname -" call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$') +" call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$','~'.expand("<slnum>")) break endif if dirname =~ '^'.bname.'/$' -" call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$') +" call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$','~'.expand("<slnum>")) break endif if bname != '' && dirname =~ '/'.bname.'$' && bname == bufname("%") && line("$") == 1 -" call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$') +" call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$','~'.expand("<slnum>")) break endif let ibuf= ibuf + 1 @@ -3949,89 +4008,93 @@ fun! s:NetrwGetBuffer(islocal,dirname) else let bufnum= ibuf endif -" call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")") +" call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")",'~'.expand("<slnum>")) endif 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! NetrwKeepj keepalt mark ' - if bufnum < 0 || !bufexists(bufnum) -" call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)") + if bufnum < 0 || !bufexists(bufnum) " get enew buffer and name it +" call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)",'~'.expand("<slnum>")) call s:NetrwEnew(dirname) -" call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)") +" call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)",'~'.expand("<slnum>")) " name the buffer if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " Got enew buffer; transform into a NetrwTreeListing -" call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --") +" call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --",'~'.expand("<slnum>")) if !exists("s:netrw_treelistnum") let s:netrw_treelistnum= 1 else let s:netrw_treelistnum= s:netrw_treelistnum + 1 endif let w:netrw_treebufnr= bufnr("%") -" call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum)) +" call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum),'~'.expand("<slnum>")) exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum) setl bt=nofile noswf nnoremap <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr> nnoremap <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr> nnoremap <silent> <buffer> [[ :sil call <SID>TreeListMove('[')<cr> nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']')<cr> -" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr) +" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr,'~'.expand("<slnum>")) else " let v:errmsg = "" " Decho let escdirname = fnameescape(dirname) -" call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">") -" call Decho(' exe sil! keepalt file '.escdirname) +" call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">",'~'.expand("<slnum>")) +" call Decho(' exe sil! keepalt file '.escdirname,'~'.expand("<slnum>")) " let v:errmsg= "" " Decho - exe 'sil! keepalt file '.escdirname -" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") + exe 'sil! keepj keepalt file '.escdirname +" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">",'~'.expand("<slnum>")) endif -" call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">") +" call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) else " Re-use the buffer -" call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)") +" call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)",'~'.expand("<slnum>")) let eikeep= &ei setl ei=all if getline(2) =~ '^" Netrw Directory Listing' -" call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum) - exe "sil! noswapfile keepalt b ".bufnum +" call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum,'~'.expand("<slnum>")) + exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum else -" call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum) - exe "sil! noswapfile keepalt b ".bufnum +" call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum,'~'.expand("<slnum>")) + exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum endif +" call Decho(" line($)=".line("$"),'~'.expand("<slnum>")) if bufname("%") == '.' -" call Decho("exe sil! keepalt file ".fnameescape(getcwd())) - exe "sil! keepalt file ".fnameescape(getcwd()) +" call Decho("exe sil! keepalt file ".fnameescape(getcwd()),'~'.expand("<slnum>")) + exe "sil! NetrwKeepj keepalt file ".fnameescape(getcwd()) endif let &ei= eikeep - if line("$") <= 1 + if line("$") <= 1 && getline(1) == "" + " empty buffer NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("s:NetrwGetBuffer 0<buffer empty> : re-using buffer#".bufnr("%").", but its empty, so refresh it") return 0 elseif g:netrw_fastbrowse == 0 || (a:islocal && g:netrw_fastbrowse == 1) -" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse." a:islocal=".a:islocal.": clear buffer") +" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse." a:islocal=".a:islocal.": clear buffer",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwListSettings(a:islocal) - sil NetrwKeepj %d -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) + sil NetrwKeepj %d _ +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("s:NetrwGetBuffer 0<cleared buffer> : 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 NetrwKeepj %d +" call Decho("--re-use tree listing--",'~'.expand("<slnum>")) +" call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil NetrwKeepj %d _ NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("s:NetrwGetBuffer 0<cleared buffer> : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") return 0 else -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) -" call Dret("s:NetrwGetBuffer 1<buffer not cleared> : buf#".bufnr("%")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) +" call Dret("s:NetrwGetBuffer 1<buffer not cleared>") return 1 endif endif @@ -4041,19 +4104,20 @@ fun! s:NetrwGetBuffer(islocal,dirname) " slow 0 D D Deleting a buffer implies it will not be re-used (slow) " med 1 D H " fast 2 H H -" call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--") +" call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--",'~'.expand("<slnum>")) let fname= expand("%") NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("exe sil! keepalt file ".fnameescape(fname)) +" call Decho("exe sil! keepalt file ".fnameescape(fname),'~'.expand("<slnum>")) exe "sil! NetrwKeepj keepalt file ".fnameescape(fname) " delete all lines from buffer {{{3 -" call Decho("--delete all lines from buffer--") -" call Decho(" clear buffer<".expand("%")."> with :%d") - sil! keepalt NetrwKeepj %d +" call Decho("--delete all lines from buffer--",'~'.expand("<slnum>")) +" call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil! keepalt NetrwKeepj %d _ -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) -" call Dret("s:NetrwGetBuffer 0<cleared buffer> : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) +" call Dret("s:NetrwGetBuffer 0<cleared buffer>") return 0 endfun @@ -4077,7 +4141,11 @@ endfun " --------------------------------------------------------------------- " s:NetrwGetWord: it gets the directory/file named under the cursor {{{2 fun! s:NetrwGetWord() -" call Dfunc("s:NetrwGetWord() line#".line(".")." liststyle=".s:ShowStyle()." virtcol=".virtcol(".")) +" call Dfunc("s:NetrwGetWord() liststyle=".s:ShowStyle()." virtcol=".virtcol(".")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) + let keepsol= &l:sol + setl nosol + call s:UseBufWinVars() " insure that w:netrw_liststyle is set up @@ -4087,12 +4155,12 @@ fun! s:NetrwGetWord() else let w:netrw_liststyle= s:THINLIST endif -" "call Decho("w:netrw_liststyle=".w:netrw_liststyle) +" call Decho("w:netrw_liststyle=".w:netrw_liststyle,'~'.expand("<slnum>")) endif if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt " Active Banner support -" "call Decho("active banner handling") +" call Decho("active banner handling",'~'.expand("<slnum>")) NetrwKeepj norm! 0 let dirname= "./" let curline= getline('.') @@ -4120,35 +4188,35 @@ fun! s:NetrwGetWord() endif elseif w:netrw_liststyle == s:THINLIST -" "call Decho("thin column handling") +" call Decho("thin column handling",'~'.expand("<slnum>")) NetrwKeepj norm! 0 let dirname= substitute(getline('.'),'\t -->.*$','','') elseif w:netrw_liststyle == s:LONGLIST -" "call Decho("long column handling") +" call Decho("long column handling",'~'.expand("<slnum>")) NetrwKeepj norm! 0 let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e') elseif w:netrw_liststyle == s:TREELIST -" "call Decho("treelist handling") +" call Decho("treelist handling",'~'.expand("<slnum>")) let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') let dirname= substitute(dirname,'\t -->.*$','','') else -" "call Decho("obtain word from wide listing") +" call Decho("obtain word from wide listing",'~'.expand("<slnum>")) let dirname= getline('.') if !exists("b:netrw_cpf") let b:netrw_cpf= 0 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' call histdel("/",-1) -" "call Decho("computed cpf=".b:netrw_cpf) +" "call Decho("computed cpf=".b:netrw_cpf,'~'.expand("<slnum>")) endif -" "call Decho("buf#".bufnr("%")."<".bufname("%").">") +" call Decho("buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf -" "call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt) -" "call Decho("1: dirname<".dirname.">") +" call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) +" call Decho("1: dirname<".dirname.">",'~'.expand("<slnum>")) if filestart == 0 NetrwKeepj norm! 0ma else @@ -4165,9 +4233,9 @@ fun! s:NetrwGetWord() endif let dirname = @a let @a = rega -" "call Decho("2: dirname<".dirname.">") +" call Decho("2: dirname<".dirname.">",'~'.expand("<slnum>")) let dirname= substitute(dirname,'\s\+$','','e') -" "call Decho("3: dirname<".dirname.">") +" call Decho("3: dirname<".dirname.">",'~'.expand("<slnum>")) endif " symlinks are indicated by a trailing "@". Remove it before further processing. @@ -4176,6 +4244,8 @@ fun! s:NetrwGetWord() " executables are indicated by a trailing "*". Remove it before further processing. let dirname= substitute(dirname,"\*$","","") + let &l:sol= keepsol + " call Dret("s:NetrwGetWord <".dirname.">") return dirname endfun @@ -4184,17 +4254,17 @@ endfun " s:NetrwListSettings: make standard settings for a netrw listing {{{2 fun! s:NetrwListSettings(islocal) " call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) let fname= bufname("%") -" " call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro nornu") +" " call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro nornu",'~'.expand("<slnum>")) setl bt=nofile nobl ma nonu nowrap noro nornu -" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname)) +" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname),'~'.expand("<slnum>")) exe "sil! keepalt file ".fnameescape(fname) if g:netrw_use_noswf setl noswf endif " call Dredir("ls!") -" call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>")) exe "setl ts=".(g:netrw_maxfilenamelen+1) setl isk+=.,~,- if g:netrw_fastbrowse > a:islocal @@ -4202,7 +4272,7 @@ fun! s:NetrwListSettings(islocal) else setl bh=delete endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) " call Dret("s:NetrwListSettings") endfun @@ -4218,27 +4288,27 @@ fun! s:NetrwListStyle(islocal) if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif let svpos = netrw#SavePosn() let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST -" call Decho("fname<".fname.">") -" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) +" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle,'~'.expand("<slnum>")) +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("<slnum>")) if w:netrw_liststyle == s:THINLIST " use one column listing -" call Decho("use one column list") +" call Decho("use one column list",'~'.expand("<slnum>")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') elseif w:netrw_liststyle == s:LONGLIST " use long list -" call Decho("use long list") +" call Decho("use long list",'~'.expand("<slnum>")) let g:netrw_list_cmd = g:netrw_list_cmd." -l" elseif w:netrw_liststyle == s:WIDELIST " give wide list -" call Decho("use wide list") +" call Decho("use wide list",'~'.expand("<slnum>")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') elseif w:netrw_liststyle == s:TREELIST -" call Decho("use tree list") +" call Decho("use tree list",'~'.expand("<slnum>")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') else @@ -4248,18 +4318,18 @@ fun! s:NetrwListStyle(islocal) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') endif setl ma noro -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") - sil! NetrwKeepj %d +" call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ " following prevents tree listing buffer from being marked "modified" -" call Decho("setl nomod") +" call Decho("setl nomod",'~'.expand("<slnum>")) setl nomod -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " refresh the listing -" call Decho("refresh the listing") +" call Decho("refresh the listing",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) NetrwKeepj call s:NetrwCursor() @@ -4287,7 +4357,7 @@ fun! s:NetrwBannerCtrl(islocal) let fname= s:NetrwGetWord() sil NetrwKeepj $ let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') -" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) +" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'),'~'.expand("<slnum>")) if result <= 0 && exists("w:netrw_bannercnt") exe "NetrwKeepj ".w:netrw_bannercnt endif @@ -4314,9 +4384,9 @@ fun! s:NetrwBookmark(del,...) if exists("s:netrwmarkfilelist_{curbufnr}") " for every filename in the marked list -" call Decho("bookmark every filename in marked list") +" call Decho("bookmark every filename in marked list",'~'.expand("<slnum>")) let svpos = netrw#SavePosn() - let islocal= expand("%") !~ '^\a\+://' + let islocal= expand("%") !~ '^\a\{3,}://' for fname in s:netrwmarkfilelist_{curbufnr} if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif endfor @@ -4331,7 +4401,7 @@ fun! s:NetrwBookmark(del,...) else " bookmark currently open file -" call Decho("bookmark currently open file") +" call Decho("bookmark currently open file",'~'.expand("<slnum>")) let fname= expand("%") if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif endif @@ -4341,18 +4411,22 @@ fun! s:NetrwBookmark(del,...) " attempts to infer if working remote or local " by deciding if the current file begins with an url " Globbing cannot be done remotely. - let islocal= expand("%") !~ '^\a\+://' -" call Decho("bookmark specified file".((a:0>1)? "s" : "")) + let islocal= expand("%") !~ '^\a\{3,}://' +" call Decho("bookmark specified file".((a:0>1)? "s" : ""),'~'.expand("<slnum>")) let i = 1 while i <= a:0 if islocal - let mbfiles= glob(a:{i},0,1) + if v:version == 704 && has("patch656") + let mbfiles= glob(a:{i},0,1,1) + else + let mbfiles= glob(a:{i},0,1) + endif else let mbfiles= [a:{i}] endif -" call Decho("mbfiles".string(mbfiles)) +" call Decho("mbfiles".string(mbfiles),'~'.expand("<slnum>")) for mbfile in mbfiles -" call Decho("mbfile<".mbfile.">") +" call Decho("mbfile<".mbfile.">",'~'.expand("<slnum>")) if a:del|call s:DeleteBookmark(mbfile)|else|call s:MakeBookmark(mbfile)|endif endfor let i= i + 1 @@ -4379,7 +4453,7 @@ fun! s:NetrwBookmarkMenu() " the following test assures that gvim is running, has menus available, and has menus enabled. if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu if exists("g:NetrwTopLvlMenu") -" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") +" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("<slnum>")) exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks' exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete' endif @@ -4391,7 +4465,7 @@ fun! s:NetrwBookmarkMenu() if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 let cnt= 1 for bmd in g:netrw_bookmarklist -" call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd) +" call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd,'~'.expand("<slnum>")) let bmd= escape(bmd,g:netrw_menu_escape) " show bookmarks for goto menu @@ -4414,7 +4488,7 @@ fun! s:NetrwBookmarkMenu() let priority = g:netrw_dirhist_cnt + histcnt if exists("g:netrw_dirhist_{cnt}") let histdir= escape(g:netrw_dirhist_{cnt},g:netrw_menu_escape) -" call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir) +" call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir,'~'.expand("<slnum>")) exe 'sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\<cr>" endif let first = 0 @@ -4436,27 +4510,27 @@ endfun " NetrwBrowseChgDir() edits the file. 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 : "").">") -" call Decho("win#".winnr()) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) 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("b:netrw_curdir doesn't exist!") -" call Decho("getcwd<".getcwd().">") +" call Decho("b:netrw_curdir doesn't exist!",'~'.expand("<slnum>")) +" call Decho("getcwd<".getcwd().">",'~'.expand("<slnum>")) " call Dredir("ls!") " call Dret("s:NetrwBrowseChgDir") return endif " NetrwBrowseChgDir: save options and initialize {{{3 -" call Decho("saving options") +" call Decho("saving options",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwOptionSave("s:") NetrwKeepj call s:NetrwSafeOptions() let nbcd_curpos = netrw#SavePosn() let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos -" call Decho("setting s:nbcd_curpos_".bufnr('%')." to SavePosn") +" call Decho("setting s:nbcd_curpos_".bufnr('%')." to SavePosn",'~'.expand("<slnum>")) if (has("win32") || has("win95") || has("win64") || has("win16")) let dirname = substitute(b:netrw_curdir,'\\','/','ge') else @@ -4465,110 +4539,108 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let newdir = a:newdir let dolockout = 0 let dorestore = 1 -" call Decho("dirname<".dirname.">") +" call Decho("dirname<".dirname.">",'~'.expand("<slnum>")) " ignore <cr>s when done in the banner -" call Decho('ignore <cr>s when done in banner (g:netrw_banner='.g:netrw_banner.")") +" call Decho('ignore [return]s when done in banner (g:netrw_banner='.g:netrw_banner.")",'~'.expand("<slnum>")) if g:netrw_banner -" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#")) +" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("<slnum>")) if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt if getline(".") =~ 'Quick Help' -" call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) let g:netrw_quickhelp= (g:netrw_quickhelp + 1)%len(s:QuickHelp) -" call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) setl ma noro nowrap NetrwKeepj call setline(line('.'),'" Quick Help: <F1>:help '.s:QuickHelp[g:netrw_quickhelp]) setl noma nomod nowrap NetrwKeepj call netrw#RestorePosn(nbcd_curpos) NetrwKeepj call s:NetrwOptionRestore("s:") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif endif " else " Decho -" call Decho("(s:NetrwBrowseChgdir) g:netrw_banner=".g:netrw_banner." (no banner)") +" call Decho("(s:NetrwBrowseChgdir) g:netrw_banner=".g:netrw_banner." (no banner)",'~'.expand("<slnum>")) endif " set up o/s-dependent directory recognition pattern -" call Decho("set up o/s-dependent directory recognition pattern") if has("amiga") let dirpat= '[\/:]$' else let dirpat= '[\/]$' endif -" call Decho("dirname<".dirname."> dirpat<".dirpat.">") +" call Decho("set up o/s-dependent directory recognition pattern: dirname<".dirname."> dirpat<".dirpat.">",'~'.expand("<slnum>")) if dirname !~ dirpat " apparently vim is "recognizing" that it is in a directory and " is removing the trailing "/". Bad idea, so let's put it back. let dirname= dirname.'/' -" call Decho("adjusting dirname<".dirname.">") +" call Decho("adjusting dirname<".dirname.'> (put trailing "/" back)','~'.expand("<slnum>")) endif -" call Decho("newdir<".newdir."> !~ dirpat<".dirpat.">? ".((newdir !~ dirpat)? "yes" : "no")) - if newdir !~ dirpat && !(a:islocal && isdirectory(newdir)) +" " call Decho("[newdir<".newdir."> ".((newdir =~ dirpat)? "=~" : "!~")." dirpat<".dirpat.">] && [islocal=".a:islocal."] && [newdir is ".(isdirectory(s:NetrwFile(newdir))? "" : "not ")."a directory]",'~'.expand("<slnum>")) + if newdir !~ dirpat && !(a:islocal && isdirectory(s:NetrwFile(s:ComposePath(dirname,newdir)))) " ------------------------------ " NetrwBrowseChgDir: edit a file {{{3 " ------------------------------ -" call Decho('edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") +" call Decho('edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("<slnum>")) " save position for benefit of Rexplore let s:rexposn_{bufnr("%")}= netrw#SavePosn() - -" call Decho("edit-a-file: setting s:rexposn_".bufnr("%")." to SavePosn") -" call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) -" call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">") +" call Decho("edit-a-file: setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>")) +" call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("<slnum>")) +" call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' -" call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">") -" call Decho("edit-a-file: newdir<".newdir.">") +" call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">",'~'.expand("<slnum>")) +" call Decho("edit-a-file: newdir<".newdir.">",'~'.expand("<slnum>")) let dirname= s:NetrwTreeDir(a:islocal) if dirname =~ '/$' let dirname= dirname.newdir else let dirname= dirname."/".newdir endif -" call Decho("edit-a-file: dirname<".dirname.">") -" call Decho("edit-a-file: tree listing") +" call Decho("edit-a-file: dirname<".dirname.">",'~'.expand("<slnum>")) +" call Decho("edit-a-file: tree listing",'~'.expand("<slnum>")) elseif newdir =~ '^\(/\|\a:\)' let dirname= newdir else let dirname= s:ComposePath(dirname,newdir) endif -" call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")") +" call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")",'~'.expand("<slnum>")) " this lets netrw#BrowseX avoid the edit if a:0 < 1 -" call Decho("edit-a-file: set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) +" call Decho("edit-a-file: set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("<slnum>")) NetrwKeepj call s:NetrwOptionRestore("s:") if !exists("s:didsplit") -" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr()) +" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr(),'~'.expand("<slnum>")) if type(g:netrw_browse_split) == 3 " open file in server " Note that g:netrw_browse_split is a List: [servername,tabnr,winnr] -" call Decho("edit-a-file: open file in server") +" call Decho("edit-a-file: open file in server",'~'.expand("<slnum>")) call s:NetrwServerEdit(a:islocal,dirname) " call Dret("s:NetrwBrowseChgDir") return elseif g:netrw_browse_split == 1 " horizontally splitting the window first -" call Decho("edit-a-file: horizontally splitting window prior to edit") +" call Decho("edit-a-file: horizontally splitting window prior to edit",'~'.expand("<slnum>")) keepalt new if !&ea keepalt wincmd _ endif elseif g:netrw_browse_split == 2 " vertically splitting the window first -" call Decho("edit-a-file: vertically splitting window prior to edit") +" call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("<slnum>")) keepalt rightb vert new if !&ea keepalt wincmd | endif elseif g:netrw_browse_split == 3 " open file in new tab -" call Decho("edit-a-file: opening new tab prior to edit") +" call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("<slnum>")) keepalt tabnew elseif g:netrw_browse_split == 4 " act like "P" (ie. open previous window) -" call Decho("edit-a-file: use previous window for edit") +" call Decho("edit-a-file: use previous window for edit",'~'.expand("<slnum>")) if s:NetrwPrevWinOpen(2) == 3 let @@= ykeep " call Dret("s:NetrwBrowseChgDir") @@ -4576,16 +4648,16 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif else " handling a file, didn't split, so remove menu -" call Decho("edit-a-file: handling a file+didn't split, so remove menu") +" call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("<slnum>")) call s:NetrwMenu(0) " optional change to window if g:netrw_chgwin >= 1 -" call Decho("edit-a-file: changing window to #".g:netrw_chgwin) +" call Decho("edit-a-file: changing window to #".g:netrw_chgwin,'~'.expand("<slnum>")) if winnr("$")+1 == g:netrw_chgwin " if g:netrw_chgwin is set to one more than the last window, then " vertically split the last window to make that window available. let curwin= winnr() - exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".winnr("$") + exe "NetrwKeepj keepalt ".winnr("$")."wincmd w" vs exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin endif @@ -4598,7 +4670,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will " no keepalt to support :e # to return to a directory listing if a:islocal -" call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname)) +" call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname),'~'.expand("<slnum>")) " some like c-^ to return to the last edited file " others like c-^ to return to the netrw buffer if exists("g:netrw_altfile") && g:netrw_altfile @@ -4606,14 +4678,14 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else exe "NetrwKeepj e! ".fnameescape(dirname) endif -" call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) +" call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod,'~'.expand("<slnum>")) call s:NetrwCursor() if &hidden || &bufhidden == "hide" " file came from vim's hidden storage. Don't "restore" options with it. let dorestore= 0 endif else -" call Decho("edit-a-file: remote file: NetrwBrowse will edit it") +" call Decho("edit-a-file: remote file: NetrwBrowse will edit it",'~'.expand("<slnum>")) endif let dolockout= 1 @@ -4622,12 +4694,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " or as a list of function references. It will ignore anything that's not " a function reference. See :help Funcref for information about function references. if exists("g:Netrw_funcref") -" call Decho("edit-a-file: handle optional Funcrefs") +" call Decho("edit-a-file: handle optional Funcrefs",'~'.expand("<slnum>")) if type(g:Netrw_funcref) == 2 -" call Decho("edit-a-file: handling a g:Netrw_funcref") +" call Decho("edit-a-file: handling a g:Netrw_funcref",'~'.expand("<slnum>")) NetrwKeepj call g:Netrw_funcref() elseif type(g:Netrw_funcref) == 3 -" call Decho("edit-a-file: handling a list of g:Netrw_funcrefs") +" call Decho("edit-a-file: handling a list of g:Netrw_funcrefs",'~'.expand("<slnum>")) for Fncref in g:Netrw_funcref if type(FncRef) == 2 NetrwKeepj call FncRef() @@ -4641,42 +4713,44 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " ---------------------------------------------------- " NetrwBrowseChgDir: just go to the new directory spec {{{3 " ---------------------------------------------------- -" call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>') +" call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>','~'.expand("<slnum>")) let dirname = newdir NetrwKeepj call s:SetRexDir(a:islocal,dirname) NetrwKeepj call s:NetrwOptionRestore("s:") + norm! m` elseif newdir == './' " --------------------------------------------- " NetrwBrowseChgDir: refresh the directory list {{{3 " --------------------------------------------- -" call Decho('refresh-dirlist: case "refresh directory listing": newdir == "./"') +" call Decho('refresh-dirlist: case "refresh directory listing": newdir == "./"','~'.expand("<slnum>")) NetrwKeepj call s:SetRexDir(a:islocal,dirname) + norm! m` elseif newdir == '../' " -------------------------------------- " NetrwBrowseChgDir: go up one directory {{{3 " -------------------------------------- -" call Decho('go-up: case "go up one directory": newdir == "../"') +" call Decho('go-up: case "go up one directory": newdir == "../"','~'.expand("<slnum>")) if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh -" call Decho("go-up: clear buffer<".expand("%")."> with :%d") -" call Decho("go-up: setl noro ma") +" call Decho("go-up: clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) +" call Decho("go-up: setl noro ma",'~'.expand("<slnum>")) setl noro ma - NetrwKeepj %d + NetrwKeepj %d _ endif if has("amiga") " amiga -" call Decho('go-up: case "go up one directory": newdir == "../" and amiga') +" call Decho('go-up: case "go up one directory": newdir == "../" and amiga','~'.expand("<slnum>")) if a:islocal let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','') let dirname= substitute(dirname,'/$','','') else let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','') endif -" call Decho("go-up: amiga: dirname<".dirname."> (go up one dir)") +" call Decho("go-up: amiga: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>")) elseif !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) " windows @@ -4686,94 +4760,96 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let dirname= '/' endif else - let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') + let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') endif if dirname =~ '^\a:$' let dirname= dirname.'/' endif -" call Decho("go-up: windows: dirname<".dirname."> (go up one dir)") +" call Decho("go-up: windows: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>")) else " unix or cygwin -" call Decho('go-up: case "go up one directory": newdir == "../" and unix or cygwin') +" call Decho('go-up: case "go up one directory": newdir == "../" and unix or cygwin','~'.expand("<slnum>")) if a:islocal let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') if dirname == "" let dirname= '/' endif else - let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') + let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') endif -" call Decho("go-up: unix: dirname<".dirname."> (go up one dir)") +" call Decho("go-up: unix: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>")) endif NetrwKeepj call s:SetRexDir(a:islocal,dirname) + norm m` elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " -------------------------------------- " NetrwBrowseChgDir: Handle Tree Listing {{{3 " -------------------------------------- -" call Decho('tree-list: case liststyle is TREELIST and w:netrw_treedict exists') - " force a refresh (for TREELIST, wait for NetrwTreeDir() to force the refresh) -" call Decho("tree-list: setl noro ma") +" call Decho('tree-list: case liststyle is TREELIST and w:netrw_treedict exists','~'.expand("<slnum>")) + " force a refresh (for TREELIST, NetrwTreeDir() will force the refresh) +" call Decho("tree-list: setl noro ma",'~'.expand("<slnum>")) setl noro ma if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) -" call Decho("tree-list: clear buffer<".expand("%")."> with :%d") - NetrwKeepj %d +" call Decho("tree-list: clear buffer<".expand("%")."> with :%d (force refresh)",'~'.expand("<slnum>")) + NetrwKeepj %d _ endif let treedir = s:NetrwTreeDir(a:islocal) +" call Decho("tree-list: treedir<".treedir.">",'~'.expand("<slnum>")) let s:treecurpos = nbcd_curpos let haskey = 0 -" call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">") +" call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">",'~'.expand("<slnum>")) " search treedict for tree dir as-is -" call Decho("search treedict for tree dir as-is") +" call Decho("search treedict for tree dir as-is",'~'.expand("<slnum>")) if has_key(w:netrw_treedict,treedir) -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!') +" call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!','~'.expand("<slnum>")) let haskey= 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found') +" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>")) endif - " search treedict for treedir with a / appended -" call Decho("search treedict for treedir with a / appended") - if !haskey && treedir !~ '/$' + " search treedict for treedir with a [/@] appended +" call Decho("search treedict for treedir with a [/@] appended",'~'.expand("<slnum>")) + if !haskey && treedir !~ '[/@]$' if has_key(w:netrw_treedict,treedir."/") let treedir= treedir."/" -" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!') +" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>")) let haskey = 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'/> : not found') +" call Decho('tree-list: ....searched for treedir<'.treedir.'/> : not found','~'.expand("<slnum>")) endif endif " search treedict for treedir with any trailing / elided -" call Decho("search treedict for treedir with any trailing / elided") +" call Decho("search treedict for treedir with any trailing / elided",'~'.expand("<slnum>")) if !haskey && treedir =~ '/$' let treedir= substitute(treedir,'/$','','') if has_key(w:netrw_treedict,treedir) -" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!') +" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>")) let haskey = 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found') +" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>")) endif endif -" call Decho("haskey=".haskey) +" call Decho("haskey=".haskey,'~'.expand("<slnum>")) if haskey " close tree listing for selected subdirectory -" call Decho("tree-list: closing selected subdirectory<".dirname.">") +" call Decho("tree-list: closing selected subdirectory<".dirname.">",'~'.expand("<slnum>")) call remove(w:netrw_treedict,treedir) -" call Decho("tree-list: removed entry<".treedir."> from treedict") -" call Decho("tree-list: yielding treedict<".string(w:netrw_treedict).">") +" call Decho("tree-list: removed entry<".treedir."> from treedict",'~'.expand("<slnum>")) +" call Decho("tree-list: yielding treedict<".string(w:netrw_treedict).">",'~'.expand("<slnum>")) let dirname= w:netrw_treetop else " go down one directory let dirname= substitute(treedir,'/*$','/','') -" call Decho("tree-list: go down one dir: treedir<".treedir.">") -" call Decho("tree-list: ... : dirname<".dirname.">") +" call Decho("tree-list: go down one dir: treedir<".treedir.">",'~'.expand("<slnum>")) +" call Decho("tree-list: ... : dirname<".dirname.">",'~'.expand("<slnum>")) endif NetrwKeepj call s:SetRexDir(a:islocal,dirname) -" call Decho("setting s:treeforceredraw to true") +" call Decho("setting s:treeforceredraw to true",'~'.expand("<slnum>")) let s:treeforceredraw = 1 else @@ -4781,8 +4857,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " NetrwBrowseChgDir: Go down one directory {{{3 " ---------------------------------------- let dirname = s:ComposePath(dirname,newdir) -" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") +" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">",'~'.expand("<slnum>")) NetrwKeepj call s:SetRexDir(a:islocal,dirname) + norm m` endif " -------------------------------------- @@ -4791,23 +4868,23 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if dorestore " dorestore is zero'd when a local file was hidden or bufhidden; " in such a case, we want to keep whatever settings it may have. -" call Decho("doing option restore (dorestore=".dorestore.")") +" call Decho("doing option restore (dorestore=".dorestore.")",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwOptionRestore("s:") " else " Decho -" call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod) +" call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod,'~'.expand("<slnum>")) endif if dolockout && dorestore -" call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname)) +" call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname),'~'.expand("<slnum>")) if filewritable(dirname) -" call Decho("restore: doing modification lockout settings: ma nomod noro") -" call Decho("restore: setl ma nomod noro") +" call Decho("restore: doing modification lockout settings: ma nomod noro",'~'.expand("<slnum>")) +" call Decho("restore: setl ma nomod noro",'~'.expand("<slnum>")) setl ma noro nomod -" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) else -" call Decho("restore: doing modification lockout settings: ma nomod ro") -" call Decho("restore: setl ma nomod noro") +" call Decho("restore: doing modification lockout settings: ma nomod ro",'~'.expand("<slnum>")) +" call Decho("restore: setl ma nomod noro",'~'.expand("<slnum>")) setl ma ro nomod -" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif endif let @@= ykeep @@ -4825,7 +4902,7 @@ fun! s:NetrwBrowseUpDir(islocal) if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt-1 " this test needed because occasionally this function seems to be incorrectly called " when multiple leftmouse clicks are taken when atop the one line help in the banner. - " I'm allowing the very bottom line to permit a "-" exit so that one may escape empty + " I'm allowing the very bottom line to permit a "-" exit so that one may escape empty " directories. " call Dret("s:NetrwBrowseUpDir : cursor not in file area") return @@ -4833,12 +4910,13 @@ fun! s:NetrwBrowseUpDir(islocal) norm! 0 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") -" call Decho("case: treestyle") +" call Decho("case: treestyle",'~'.expand("<slnum>")) let curline= getline(".") let swwline= winline() - 1 if exists("w:netrw_treetop") let b:netrw_curdir= w:netrw_treetop endif + let curdir= b:netrw_curdir if a:islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) else @@ -4858,19 +4936,26 @@ fun! s:NetrwBrowseUpDir(islocal) endif endwhile else -" call Decho("case: not treestyle") +" call Decho("case: not treestyle",'~'.expand("<slnum>")) + if exists("b:netrw_curdir") + let curdir= b:netrw_curdir + else + let curdir= expand(getcwd()) + endif if a:islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) else call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../')) endif if exists("w:netrw_bannercnt") -" call Decho("moving to line#".w:netrw_bannercnt) +" call Decho("moving to line#".w:netrw_bannercnt,'~'.expand("<slnum>")) exe w:netrw_bannercnt else 1 endif endif + let curdir= substitute(curdir,'^.*[\/]','','') + call search('\<'.curdir.'\>','wc') " call Dret("s:NetrwBrowseUpDir") endfun @@ -4900,11 +4985,11 @@ fun! netrw#BrowseX(fname,remote) if exists("g:Netrw_corehandler") if type(g:Netrw_corehandler) == 2 " g:Netrw_corehandler is a function reference (see :help Funcref) -" call Decho("g:Netrw_corehandler is a funcref") - call g:Netrw_corehandler(a:fname) +" call Decho("g:Netrw_corehandler is a funcref",'~'.expand("<slnum>")) + call g:Netrw_corehandler(s:NetrwFile(a:fname)) elseif type(g:Netrw_corehandler) == 3 " g:Netrw_corehandler is a List of function references (see :help Funcref) -" call Decho("g:Netrw_corehandler is a List") +" call Decho("g:Netrw_corehandler is a List",'~'.expand("<slnum>")) for Fncref in g:Netrw_corehandler if type(FncRef) == 2 call FncRef(a:fname) @@ -4925,18 +5010,18 @@ fun! netrw#BrowseX(fname,remote) if has("win32") || has("win95") || has("win64") || has("win16") let exten= substitute(exten,'^.*$','\L&\E','') endif -" call Decho("exten<".exten.">") +" call Decho("exten<".exten.">",'~'.expand("<slnum>")) if a:remote == 1 " create a local copy -" call Decho("remote: 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.">",'~'.expand("<slnum>")) setl 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','') -" call Decho("basename<".basename.">") -" call Decho("newname <".newname.">") +" call Decho("basename<".basename.">",'~'.expand("<slnum>")) +" call Decho("newname <".newname.">",'~'.expand("<slnum>")) if rename(s:netrw_tmpfile,newname) == 0 " renaming succeeded let fname= newname @@ -4945,16 +5030,16 @@ fun! netrw#BrowseX(fname,remote) let fname= s:netrw_tmpfile endif else -" call Decho("local: a:remote=".a:remote.": handling local copy of <".a:fname.">") +" call Decho("local: a:remote=".a:remote.": handling local copy of <".a:fname.">",'~'.expand("<slnum>")) let fname= a:fname " special ~ handler for local if fname =~ '^\~' && expand("$HOME") != "" -" call Decho('invoking special ~ handler') - let fname= substitute(fname,'^\~',expand("$HOME"),'') +" call Decho('invoking special ~ handler','~'.expand("<slnum>")) + let fname= s:NetrwFile(substitute(fname,'^\~',expand("$HOME"),'')) endif endif -" call Decho("fname<".fname.">") -" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten)) +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) +" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("<slnum>")) " set up redirection if &srr =~ "%s" @@ -4968,12 +5053,12 @@ fun! netrw#BrowseX(fname,remote) else let redir= &srr . "/dev/null" endif -" call Decho("set up redirection: redir{".redir."} srr{".&srr."}") +" call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("<slnum>")) " extract any viewing options. Assumes that they're set apart by quotes. -" call Decho("extract any viewing options") +" call Decho("extract any viewing options",'~'.expand("<slnum>")) if exists("g:netrw_browsex_viewer") -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>")) if g:netrw_browsex_viewer =~ '\s' let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','') let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." " @@ -4984,32 +5069,32 @@ fun! netrw#BrowseX(fname,remote) let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." " let cnt = cnt + 1 let oviewer = viewer -" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">") +" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("<slnum>")) endwhile else let viewer = g:netrw_browsex_viewer let viewopt = "" endif -" call Decho("viewer<".viewer."> viewopt<".viewopt.">") +" call Decho("viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("<slnum>")) endif " execute the file handler -" call Decho("execute the file handler (if any)") +" call Decho("execute the file handler (if any)",'~'.expand("<slnum>")) if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-' -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>")) let ret= netrwFileHandlers#Invoke(exten,fname) elseif exists("g:netrw_browsex_viewer") && executable(viewer) -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") - call s:NetrwExe("sil !".viewer." ".viewopt.shellescape(fname,1).redir) +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>")) + call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir) let ret= v:shell_error elseif has("win32") || has("win64") -" call Decho("windows") +" call Decho("windows",'~'.expand("<slnum>")) if executable("start") - call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) + call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) elseif executable("rundll32") - call s:NetrwExe('sil! !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) + call s:NetrwExe('sil! !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif @@ -5018,32 +5103,37 @@ fun! netrw#BrowseX(fname,remote) elseif has("win32unix") let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g') -" call Decho("cygwin: winfname<".shellescape(winfname,1).">") +" call Decho("cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("<slnum>")) if executable("start") - call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) + call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1)) elseif executable("rundll32") - call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) + call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1)) elseif executable("cygstart") - call s:NetrwExe('sil !cygstart '.shellescape(fname,1)) + call s:NetrwExe('sil !cygstart '.s:ShellEscape(fname,1)) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif call inputsave()|call input("Press <cr> to continue")|call inputrestore() let ret= v:shell_error - elseif has("unix") && executable("xdg-open") && !s:CheckIfKde() -" call Decho("unix and xdg-open") - call s:NetrwExe("sil !xdg-open ".shellescape(fname,1).redir) + elseif has("unix") && executable("kfmclient") && s:CheckIfKde() +" call Decho("unix and kfmclient",'~'.expand("<slnum>")) + call s:NetrwExe("sil !kfmclient exec ".s:ShellEscape(fname,1)." ".redir) let ret= v:shell_error - elseif has("unix") && executable("kfmclient") && s:CheckIfKde() -" call Decho("unix and kfmclient") - call s:NetrwExe("sil !kfmclient exec ".shellescape(fname,1)." ".redir) + elseif has("unix") && executable("exo-open") && executable("xdg-open") && executable("setsid") +" call Decho("unix, exo-open, xdg-open",'~'.expand("<slnum>")) + call s:NetrwExe("sil !setsid xdg-open ".s:ShellEscape(fname,1).redir) + let ret= v:shell_error + + elseif has("unix") && executable("xdg-open") +" call Decho("unix and xdg-open",'~'.expand("<slnum>")) + call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir) let ret= v:shell_error elseif has("macunix") && executable("open") -" call Decho("macunix and open") - call s:NetrwExe("sil !open ".shellescape(fname,1)." ".redir) +" call Decho("macunix and open",'~'.expand("<slnum>")) + call s:NetrwExe("sil !open ".s:ShellEscape(fname,1)." ".redir) let ret= v:shell_error else @@ -5065,7 +5155,7 @@ fun! netrw#BrowseX(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.">",'~'.expand("<slnum>")) " call s:NetrwDelete(fname) " endif @@ -5090,7 +5180,7 @@ fun! netrw#BrowseXVis() " call Dfunc("netrw#BrowseXVis()") let atkeep = @@ norm! gvy -" call Decho("@@<".@@.">") +" call Decho("@@<".@@.">",'~'.expand("<slnum>")) call netrw#BrowseX(@@,netrw#CheckIfRemote()) let @@ = atkeep " call Dret("netrw#BrowseXVis") @@ -5100,7 +5190,7 @@ endfun " netrw#CheckIfRemote: returns 1 if current file looks like an url, 0 else {{{2 fun! netrw#CheckIfRemote() " call Dfunc("netrw#CheckIfRemote()") - if expand("%") =~ '^\a\+://' + if expand("%") =~ '^\a\{3,}://' " call Dret("netrw#CheckIfRemote 1") return 1 else @@ -5117,9 +5207,9 @@ fun! s:NetrwChgPerm(islocal,curdir) call inputsave() let newperm= input("Enter new permission: ") call inputrestore() - let chgperm= substitute(g:netrw_chgperm,'\<FILENAME\>',shellescape(expand("<cfile>")),'') - let chgperm= substitute(chgperm,'\<PERM\>',shellescape(newperm),'') -" call Decho("chgperm<".chgperm.">") + let chgperm= substitute(g:netrw_chgperm,'\<FILENAME\>',s:ShellEscape(expand("<cfile>")),'') + let chgperm= substitute(chgperm,'\<PERM\>',s:ShellEscape(newperm),'') +" call Decho("chgperm<".chgperm.">",'~'.expand("<slnum>")) call system(chgperm) if v:shell_error != 0 NetrwKeepj call netrw#ErrorMsg(1,"changing permission on file<".expand("<cfile>")."> seems to have failed",75) @@ -5142,14 +5232,14 @@ fun! s:CheckIfKde() " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) if !exists("s:haskdeinit") if has("unix") && executable("ps") && !has("win32unix") - let s:haskdeinit= system("ps -e") =~ '\<kdeinit' + let s:haskdeinit= system("ps -e") =~ '\<kdeinit' if v:shell_error let s:haskdeinit = 0 endif else let s:haskdeinit= 0 endif -" call Decho("setting s:haskdeinit=".s:haskdeinit) +" call Decho("setting s:haskdeinit=".s:haskdeinit,'~'.expand("<slnum>")) endif " call Dret("s:CheckIfKde ".s:haskdeinit) @@ -5208,7 +5298,7 @@ fun! s:NetrwForceChgDir(islocal,newdir) else let newdir= a:newdir.'/' endif -" call Decho("adjusting newdir<".newdir."> due to gd") +" call Decho("adjusting newdir<".newdir."> due to gd",'~'.expand("<slnum>")) else " should already be getting treatment as a directory let newdir= a:newdir @@ -5249,18 +5339,18 @@ fun! s:NetrwHide(islocal) let svpos= netrw#SavePosn() if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">") -" call Decho("g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">",'~'.expand("<slnum>")) +" call Decho("g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) " hide the files in the markfile list for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk) +" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk,'~'.expand("<slnum>")) if match(g:netrw_list_hide,'\<'.fname.'\>') != -1 " remove fname from hiding list let g:netrw_list_hide= substitute(g:netrw_list_hide,'..\<'.escape(fname,g:netrw_fname_escape).'\>..','','') let g:netrw_list_hide= substitute(g:netrw_list_hide,',,',',','g') let g:netrw_list_hide= substitute(g:netrw_list_hide,'^,\|,$','','') -" call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) else " append fname to hiding list if exists("g:netrw_list_hide") && g:netrw_list_hide != "" @@ -5268,7 +5358,7 @@ fun! s:NetrwHide(islocal) else let g:netrw_list_hide= '\<'.escape(fname,g:netrw_fname_escape).'\>' endif -" call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) endif endfor NetrwKeepj call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) @@ -5294,6 +5384,32 @@ fun! s:NetrwHide(islocal) endfun " --------------------------------------------------------------------- +" s:NetrwHideEdit: allows user to edit the file/directory hiding list {{{2 +fun! s:NetrwHideEdit(islocal) +" call Dfunc("NetrwHideEdit(islocal=".a:islocal.")") + + let ykeep= @@ + " save current cursor position + let svpos= netrw#SavePosn() + + " get new hiding list from user + call inputsave() + let newhide= input("Edit Hiding List: ",g:netrw_list_hide) + call inputrestore() + let g:netrw_list_hide= newhide +" call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) + + " refresh the listing + sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) + + " restore cursor position + call netrw#RestorePosn(svpos) + let @@= ykeep + +" call Dret("NetrwHideEdit") +endfun + +" --------------------------------------------------------------------- " s:NetrwHidden: invoked by "gh" {{{2 fun! s:NetrwHidden(islocal) " call Dfunc("s:NetrwHidden()") @@ -5325,9 +5441,9 @@ fun! s:NetrwHome() else " go to vim plugin home for home in split(&rtp,',') + [''] - if isdirectory(home) && filewritable(home) | break | endif + if isdirectory(s:NetrwFile(home)) && filewritable(s:NetrwFile(home)) | break | endif let basehome= substitute(home,'[/\\]\.vim$','','') - if isdirectory(basehome) && filewritable(basehome) + if isdirectory(s:NetrwFile(basehome)) && filewritable(s:NetrwFile(basehome)) let home= basehome."/.vim" break endif @@ -5341,9 +5457,9 @@ fun! s:NetrwHome() endif endif " insure that the home directory exists - if g:netrw_dirhistmax > 0 && !isdirectory(home) + if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home)) if exists("g:netrw_mkdir") - call system(g:netrw_mkdir." ".shellescape(home)) + call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home))) else call mkdir(home) endif @@ -5370,8 +5486,8 @@ fun! s:NetrwLeftmouse(islocal) let mouse_lnum = v:mouse_lnum let wlastline = line('w$') let lastline = line('$') -" call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline." v:mouse_win=".v:mouse_win." winnr#".winnr()) -" call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0)) +" call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline." v:mouse_win=".v:mouse_win." winnr#".winnr(),'~'.expand("<slnum>")) +" call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0),'~'.expand("<slnum>")) if mouse_lnum >= wlastline + 1 || v:mouse_win != winnr() " appears to be a status bar leftmouse click let @@= ykeep @@ -5382,7 +5498,7 @@ fun! s:NetrwLeftmouse(islocal) " Windows are separated by vertical separator bars - but the mouse seems to be doing what it should when dragging that bar " without this test when its disabled. " May 26, 2014: edit file, :Lex, resize window -- causes refresh. Reinstated a modified test. See if problems develop. -" call Decho("v:mouse_col=".v:mouse_col." col#".col('.')." virtcol#".virtcol('.')." col($)#".col("$")." virtcol($)#".virtcol("$")) +" call Decho("v:mouse_col=".v:mouse_col." col#".col('.')." virtcol#".virtcol('.')." col($)#".col("$")." virtcol($)#".virtcol("$"),'~'.expand("<slnum>")) if v:mouse_col > virtcol('.') let @@= ykeep " call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click") @@ -5403,6 +5519,14 @@ fun! s:NetrwLeftmouse(islocal) endfun " --------------------------------------------------------------------- +" s:NetrwCLeftmouse: used to select a file/directory for a target {{{2 +fun! s:NetrwCLeftmouse(islocal) +" call Dfunc("s:NetrwCLeftmouse(islocal=".a:islocal.")") + call s:NetrwMarkFileTgt(a:islocal) +" call Dret("s:NetrwCLeftmouse") +endfun + +" --------------------------------------------------------------------- " s:NetrwServerEdit: edit file in a server gvim, usually NETRWSERVER (implements <c-r>){{{2 " a:islocal=0 : <c-r> not used, remote " a:islocal=1 : <c-r> no used, local @@ -5412,10 +5536,12 @@ fun! s:NetrwServerEdit(islocal,fname) " call Dfunc("s:NetrwServerEdit(islocal=".a:islocal.",fname<".a:fname.">)") let islocal = a:islocal%2 " =0: remote =1: local let ctrlr = a:islocal >= 2 " =0: <c-r> not used =1: <c-r> used +" call Decho("islocal=".islocal." ctrlr=".ctrlr,'~'.expand("<slnum>")) - if (islocal && isdirectory(a:fname)) || (!islocal && a:fname =~ '/$') + if (islocal && isdirectory(s:NetrwFile(a:fname))) || (!islocal && a:fname =~ '/$') " handle directories in the local window -- not in the remote vim server " user must have closed the NETRWSERVER window. Treat as a normal editing from netrw. +" call Decho("handling directory in client window",'~'.expand("<slnum>")) let g:netrw_browse_split= 0 if exists("s:netrw_browse_split_".winnr()) let g:netrw_browse_split= s:netrw_browse_split_{winnr()} @@ -5426,22 +5552,23 @@ fun! s:NetrwServerEdit(islocal,fname) return endif +" call Decho("handling file in server window",'~'.expand("<slnum>")) if has("clientserver") && executable("gvim") -" call Decho("has clientserver and gvim") +" call Decho("has clientserver and gvim",'~'.expand("<slnum>")) if exists("g:netrw_browse_split") && type(g:netrw_browse_split) == 3 -" call Decho("g:netrw_browse_split=".string(g:netrw_browse_split)) +" call Decho("g:netrw_browse_split=".string(g:netrw_browse_split),'~'.expand("<slnum>")) let srvrname = g:netrw_browse_split[0] let tabnum = g:netrw_browse_split[1] let winnum = g:netrw_browse_split[2] if serverlist() !~ '\<'.srvrname.'\>' -" call Decho("server not available; ctrlr=".ctrlr) +" call Decho("server not available; ctrlr=".ctrlr,'~'.expand("<slnum>")) if !ctrlr " user must have closed the server window and the user did not use <c-r>, but " used something like <cr>. -" call Decho("user must have closed server AND did not use ctrl-r") +" call Decho("user must have closed server AND did not use ctrl-r",'~'.expand("<slnum>")) if exists("g:netrw_browse_split") unlet g:netrw_browse_split endif @@ -5455,27 +5582,27 @@ fun! s:NetrwServerEdit(islocal,fname) elseif has("win32") && executable("start") " start up remote netrw server under windows -" call Decho("starting up gvim server<".srvrname."> for windows") +" call Decho("starting up gvim server<".srvrname."> for windows",'~'.expand("<slnum>")) call system("start gvim --servername ".srvrname) else " start up remote netrw server under linux -" call Decho("starting up gvim server<".srvrname.">") +" call Decho("starting up gvim server<".srvrname.">",'~'.expand("<slnum>")) call system("gvim --servername ".srvrname) endif endif -" call Decho("srvrname<".srvrname."> tabnum=".tabnum." winnum=".winnum." server-editing<".a:fname.">") +" call Decho("srvrname<".srvrname."> tabnum=".tabnum." winnum=".winnum." server-editing<".a:fname.">",'~'.expand("<slnum>")) call remote_send(srvrname,":tabn ".tabnum."\<cr>") call remote_send(srvrname,":".winnum."wincmd w\<cr>") - call remote_send(srvrname,":e ".fnameescape(a:fname)."\<cr>") + call remote_send(srvrname,":e ".fnameescape(s:NetrwFile(a:fname))."\<cr>") else if serverlist() !~ '\<'.g:netrw_servername.'\>' if !ctrlr -" call Decho("server<".g:netrw_servername."> not available and ctrl-r not used") +" call Decho("server<".g:netrw_servername."> not available and ctrl-r not used",'~'.expand("<slnum>")) if exists("g:netrw_browse_split") unlet g:netrw_browse_split endif @@ -5485,14 +5612,14 @@ fun! s:NetrwServerEdit(islocal,fname) return else -" call Decho("server<".g:netrw_servername."> not available but ctrl-r used") +" call Decho("server<".g:netrw_servername."> not available but ctrl-r used",'~'.expand("<slnum>")) if has("win32") && executable("start") " start up remote netrw server under windows -" call Decho("starting up gvim server<".g:netrw_servername."> for windows") +" call Decho("starting up gvim server<".g:netrw_servername."> for windows",'~'.expand("<slnum>")) call system("start gvim --servername ".g:netrw_servername) else " start up remote netrw server under linux -" call Decho("starting up gvim server<".g:netrw_servername.">") +" call Decho("starting up gvim server<".g:netrw_servername.">",'~'.expand("<slnum>")) call system("gvim --servername ".g:netrw_servername) endif endif @@ -5500,8 +5627,8 @@ fun! s:NetrwServerEdit(islocal,fname) while 1 try -" call Decho("remote-send: e ".a:fname) - call remote_send(g:netrw_servername,":e ".fnameescape(a:fname)."\<cr>") +" call Decho("remote-send: e ".a:fname,'~'.expand("<slnum>")) + call remote_send(g:netrw_servername,":e ".fnameescape(s:NetrwFile(a:fname))."\<cr>") break catch /^Vim\%((\a\+)\)\=:E241/ sleep 200m @@ -5528,7 +5655,7 @@ endfun " s:NetrwSLeftmouse: marks the file under the cursor. May be dragged to select additional files {{{2 fun! s:NetrwSLeftmouse(islocal) " call Dfunc("s:NetrwSLeftmouse(islocal=".a:islocal.")") - + let s:ngw= s:NetrwGetWord() call s:NetrwMarkFile(a:islocal,s:ngw) @@ -5587,7 +5714,7 @@ fun! s:NetrwListHide() " string. Use the first character left as a separator character. let listhide= g:netrw_list_hide let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1) -" call Decho("sep=".sep) +" call Decho("sep=".sep,'~'.expand("<slnum>")) while listhide != "" if listhide =~ ',' @@ -5600,10 +5727,10 @@ fun! s:NetrwListHide() " Prune the list by hiding any files which match if g:netrw_hide == 1 -" call Decho("hiding<".hide."> listhide<".listhide.">") +" call Decho("hiding<".hide."> listhide<".listhide.">",'~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' elseif g:netrw_hide == 2 -" call Decho("showing<".hide."> listhide<".listhide.">") +" call Decho("showing<".hide."> listhide<".listhide.">",'~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' endif endwhile @@ -5621,52 +5748,6 @@ fun! s:NetrwListHide() endfun " --------------------------------------------------------------------- -" NetrwHideEdit: allows user to edit the file/directory hiding list -fun! s:NetrwHideEdit(islocal) -" call Dfunc("NetrwHideEdit(islocal=".a:islocal.")") - - let ykeep= @@ - " save current cursor position - let svpos= netrw#SavePosn() - - " get new hiding list from user - call inputsave() - let newhide= input("Edit Hiding List: ",g:netrw_list_hide) - call inputrestore() - let g:netrw_list_hide= newhide -" call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">") - - " refresh the listing - sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) - - " restore cursor position - call netrw#RestorePosn(svpos) - let @@= ykeep - -" call Dret("NetrwHideEdit") -endfun - -" --------------------------------------------------------------------- -" NetSortSequence: allows user to edit the sorting sequence -fun! s:NetSortSequence(islocal) -" call Dfunc("NetSortSequence(islocal=".a:islocal.")") - - let ykeep= @@ - let svpos= netrw#SavePosn() - call inputsave() - let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) - call inputrestore() - - " refresh the listing - let g:netrw_sort_sequence= newsortseq - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) - let @@= ykeep - -" call Dret("NetSortSequence") -endfun - -" --------------------------------------------------------------------- " s:NetrwMakeDir: this function makes a directory (both local and remote) {{{2 " implements the "d" mapping. fun! s:NetrwMakeDir(usrhost) @@ -5679,7 +5760,7 @@ fun! s:NetrwMakeDir(usrhost) call inputsave() let newdirname= input("Please give directory name: ") call inputrestore() -" call Decho("newdirname<".newdirname.">") +" call Decho("newdirname<".newdirname.">",'~'.expand("<slnum>")) if newdirname == "" let @@= ykeep @@ -5688,13 +5769,13 @@ fun! s:NetrwMakeDir(usrhost) endif if a:usrhost == "" -" call Decho("local mkdir") +" call Decho("local mkdir",'~'.expand("<slnum>")) " Local mkdir: " sanity checks let fullnewdir= b:netrw_curdir.'/'.newdirname -" call Decho("fullnewdir<".fullnewdir.">") - if isdirectory(fullnewdir) +" call Decho("fullnewdir<".fullnewdir.">",'~'.expand("<slnum>")) + if isdirectory(s:NetrwFile(fullnewdir)) if !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) endif @@ -5722,23 +5803,23 @@ fun! s:NetrwMakeDir(usrhost) else let netrw_origdir= s:NetrwGetcwd(1) call s:NetrwLcd(b:netrw_curdir) -" call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">") - call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) +" call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">",'~'.expand("<slnum>")) + call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.s: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("s:NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) +" call Dret("s:NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(newdirname,1)) return endif if !g:netrw_keepdir -" call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir) +" call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("<slnum>")) call s:NetrwLcd(netrw_origdir) endif endif if v:shell_error == 0 " refresh listing -" call Decho("refresh listing") +" call Decho("refresh listing",'~'.expand("<slnum>")) let svpos= netrw#SavePosn() call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) call netrw#RestorePosn(svpos) @@ -5749,10 +5830,10 @@ fun! s:NetrwMakeDir(usrhost) elseif !exists("b:netrw_method") || b:netrw_method == 4 " Remote mkdir: using ssh -" call Decho("remote mkdir") +" call Decho("remote mkdir",'~'.expand("<slnum>")) let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd) let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname - call s:NetrwExe("sil! !".mkdircmd." ".shellescape(newdirname,1)) + call s:NetrwExe("sil! !".mkdircmd." ".s:ShellEscape(newdirname,1)) if v:shell_error == 0 " refresh listing let svpos= netrw#SavePosn() @@ -5766,9 +5847,9 @@ fun! s:NetrwMakeDir(usrhost) elseif b:netrw_method == 2 " Remote mkdir: using ftp+.netrc let svpos= netrw#SavePosn() -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) if exists("b:netrw_fname") -" call Decho("b:netrw_fname<".b:netrw_fname.">") +" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>")) let remotepath= b:netrw_fname else let remotepath= "" @@ -5780,9 +5861,9 @@ fun! s:NetrwMakeDir(usrhost) elseif b:netrw_method == 3 " Remote mkdir: using ftp + machine, id, passwd, and fname (ie. no .netrc) let svpos= netrw#SavePosn() -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) if exists("b:netrw_fname") -" call Decho("b:netrw_fname<".b:netrw_fname.">") +" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>")) let remotepath= b:netrw_fname else let remotepath= "" @@ -5805,19 +5886,19 @@ fun! s:TreeSqueezeDir(islocal) let curdepth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') let iline = line(".") - 1 let stopline = (exists("w:netrw_bannercnt")? (w:netrw_bannercnt + 1) : 1) -" call Decho("curdepth=".curdepth) -" call Decho("stopline#".stopline) -" call Decho("starting with line#".line(".").": ".getline('.')) +" call Decho("curdepth=".curdepth,'~'.expand("<slnum>")) +" call Decho("stopline#".stopline,'~'.expand("<slnum>")) +" call Decho("starting with line#".line(".").": ".getline('.'),'~'.expand("<slnum>")) while iline > stopline " find a line that has less depth let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') -" call Decho("considering line#".line(".").": ".getline('.')) +" call Decho("considering line#".line(".").": ".getline('.'),'~'.expand("<slnum>")) if depth < curdepth break endif norm! k endwhile -" call Decho("squeezing at line#".line(".").": ".getline('.')) +" call Decho("squeezing at line#".line(".").": ".getline('.'),'~'.expand("<slnum>")) call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord())) endif " call Dret("s:TreeSqueezeDir") @@ -5829,128 +5910,130 @@ fun! s:NetrwMaps(islocal) " call Dfunc("s:NetrwMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") if g:netrw_mousemaps && g:netrw_retmap -" call Decho("set up Rexplore 2-leftmouse") +" call Decho("set up Rexplore 2-leftmouse",'~'.expand("<slnum>")) if !hasmapto("<Plug>NetrwReturn") if maparg("<2-leftmouse>","n") == "" || maparg("<2-leftmouse>","n") =~ '^-$' -" call Decho("making map for 2-leftmouse") +" call Decho("making map for 2-leftmouse",'~'.expand("<slnum>")) nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn elseif maparg("<c-leftmouse>","n") == "" -" call Decho("making map for c-leftmouse") +" call Decho("making map for c-leftmouse",'~'.expand("<slnum>")) nmap <unique> <silent> <c-leftmouse> <Plug>NetrwReturn endif endif nno <silent> <Plug>NetrwReturn :Rexplore<cr> -" call Decho("made <Plug>NetrwReturn map") +" call Decho("made <Plug>NetrwReturn map",'~'.expand("<slnum>")) endif if a:islocal -" call Decho("make local maps") +" call Decho("make local maps",'~'.expand("<slnum>")) " local normal-mode maps - nnoremap <buffer> <silent> a :call <SID>NetrwHide(1)<cr> - nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(1)<cr> - nnoremap <buffer> <silent> c :call <SID>NetrwLcd(b:netrw_curdir)<cr> - nnoremap <buffer> <silent> C :<c-u>call <SID>NetrwSetChgwin()<cr> - nnoremap <buffer> <silent> <cr> :call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> - nnoremap <buffer> <silent> <s-cr> :call <SID>TreeSqueezeDir(1)<cr> - nnoremap <buffer> <silent> <c-r> :call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("")<cr> - nnoremap <buffer> <silent> - :call <SID>NetrwBrowseUpDir(1)<cr> - nnoremap <buffer> <silent> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> gd :<c-u>call <SID>NetrwForceChgDir(1,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> gf :<c-u>call <SID>NetrwForceFile(1,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> gh :<c-u>call <SID>NetrwHidden(1)<cr> - nnoremap <buffer> <silent> gp :<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> I :call <SID>NetrwBannerCtrl(1)<cr> - nnoremap <buffer> <silent> i :call <SID>NetrwListStyle(1)<cr> - nnoremap <buffer> <silent> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mc :<c-u>call <SID>NetrwMarkFileCopy(1)<cr> - nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(1)<cr> - nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(1)<cr> - nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(1)<cr> - nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(1)<cr> - nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(1)<cr> - nnoremap <buffer> <silent> mp :<c-u>call <SID>NetrwMarkFilePrint(1)<cr> - nnoremap <buffer> <silent> mr :<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> - nnoremap <buffer> <silent> ms :<c-u>call <SID>NetrwMarkFileSource(1)<cr> - nnoremap <buffer> <silent> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr> - nnoremap <buffer> <silent> mT :<c-u>call <SID>NetrwMarkFileTag(1)<cr> - nnoremap <buffer> <silent> mu :<c-u>call <SID>NetrwUnMarkFile(1)<cr> - nnoremap <buffer> <silent> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> - nnoremap <buffer> <silent> mx :<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> - nnoremap <buffer> <silent> mX :<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> - nnoremap <buffer> <silent> mz :<c-u>call <SID>NetrwMarkFileCompress(1)<cr> - nnoremap <buffer> <silent> O :call <SID>NetrwObtain(1)<cr> - nnoremap <buffer> <silent> o :call <SID>NetrwSplit(3)<cr> - nnoremap <buffer> <silent> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - nnoremap <buffer> <silent> P :call <SID>NetrwPrevWinOpen(1)<cr> - nnoremap <buffer> <silent> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> - nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> - nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(1)<cr> - nnoremap <buffer> <silent> S :call <SID>NetSortSequence(1)<cr> - nnoremap <buffer> <silent> t :call <SID>NetrwSplit(4)<cr> - nnoremap <buffer> <silent> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - nnoremap <buffer> <silent> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - nnoremap <buffer> <silent> u :<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> - nnoremap <buffer> <silent> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> - nnoremap <buffer> <silent> v :call <SID>NetrwSplit(5)<cr> - nnoremap <buffer> <silent> x :call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> - nnoremap <buffer> <silent> X :call <SID>NetrwLocalExecute(expand("<cword>"))"<cr> + nnoremap <buffer> <silent> <nowait> a :call <SID>NetrwHide(1)<cr> + nnoremap <buffer> <silent> <nowait> % :call <SID>NetrwOpenFile(1)<cr> + nnoremap <buffer> <silent> <nowait> c :call <SID>NetrwLcd(b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr> + nnoremap <buffer> <silent> <nowait> <cr> :call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> + nnoremap <buffer> <silent> <nowait> <s-cr> :call <SID>TreeSqueezeDir(1)<cr> + nnoremap <buffer> <silent> <nowait> <c-r> :call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("")<cr> + nnoremap <buffer> <silent> <nowait> - :call <SID>NetrwBrowseUpDir(1)<cr> + nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(1)<cr> + nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> I :call <SID>NetrwBannerCtrl(1)<cr> + nnoremap <buffer> <silent> <nowait> i :call <SID>NetrwListStyle(1)<cr> + nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(1)<cr> + nnoremap <buffer> <silent> <nowait> md :<c-u>call <SID>NetrwMarkFileDiff(1)<cr> + nnoremap <buffer> <silent> <nowait> me :<c-u>call <SID>NetrwMarkFileEdit(1)<cr> + nnoremap <buffer> <silent> <nowait> mf :<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mg :<c-u>call <SID>NetrwMarkFileGrep(1)<cr> + nnoremap <buffer> <silent> <nowait> mh :<c-u>call <SID>NetrwMarkHideSfx(1)<cr> + nnoremap <buffer> <silent> <nowait> mm :<c-u>call <SID>NetrwMarkFileMove(1)<cr> + nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(1)<cr> + nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> + nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(1)<cr> + nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr> + nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(1)<cr> + nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(1)<cr> + nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> + nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> + nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> + nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(1)<cr> + nnoremap <buffer> <silent> <nowait> O :call <SID>NetrwObtain(1)<cr> + nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(3)<cr> + nnoremap <buffer> <silent> <nowait> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> + nnoremap <buffer> <silent> <nowait> P :call <SID>NetrwPrevWinOpen(1)<cr> + nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> + nnoremap <buffer> <silent> <nowait> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> + nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(1)<cr> + nnoremap <buffer> <silent> <nowait> S :call <SID>NetSortSequence(1)<cr> + nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(4)<cr> + nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> + nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> + nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> + nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> + nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(5)<cr> + nnoremap <buffer> <silent> <nowait> x :call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> + nnoremap <buffer> <silent> <nowait> X :call <SID>NetrwLocalExecute(expand("<cword>"))"<cr> " local insert-mode maps - inoremap <buffer> <silent> a <c-o>:call <SID>NetrwHide(1)<cr> - inoremap <buffer> <silent> c <c-o>:exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir)<cr> - inoremap <buffer> <silent> c <c-o>:call <SID>NetrwLcd(b:netrw_curdir)<cr> - inoremap <buffer> <silent> C <c-o>:call <SID>NetrwSetChgwin()<cr> - inoremap <buffer> <silent> % <c-o>:call <SID>NetrwOpenFile(1)<cr> - inoremap <buffer> <silent> - <c-o>:call <SID>NetrwBrowseUpDir(1)<cr> - inoremap <buffer> <silent> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> - inoremap <buffer> <silent> <s-cr> <c-o>:call <SID>TreeSqueezeDir(1)<cr> - inoremap <buffer> <silent> d <c-o>:call <SID>NetrwMakeDir("")<cr> - inoremap <buffer> <silent> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - inoremap <buffer> <silent> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr> - inoremap <buffer> <silent> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> - inoremap <buffer> <silent> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> - inoremap <buffer> <silent> i <c-o>:call <SID>NetrwListStyle(1)<cr> - inoremap <buffer> <silent> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - inoremap <buffer> <silent> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - inoremap <buffer> <silent> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr> - inoremap <buffer> <silent> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr> - inoremap <buffer> <silent> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr> - inoremap <buffer> <silent> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr> - inoremap <buffer> <silent> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr> - inoremap <buffer> <silent> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr> - inoremap <buffer> <silent> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr> - inoremap <buffer> <silent> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> - inoremap <buffer> <silent> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr> - inoremap <buffer> <silent> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr> - inoremap <buffer> <silent> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr> - inoremap <buffer> <silent> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr> - inoremap <buffer> <silent> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> - inoremap <buffer> <silent> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> - inoremap <buffer> <silent> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> - inoremap <buffer> <silent> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr> - inoremap <buffer> <silent> O <c-o>:call <SID>NetrwObtain(1)<cr> - inoremap <buffer> <silent> o <c-o>:call <SID>NetrwSplit(3)<cr> - inoremap <buffer> <silent> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - inoremap <buffer> <silent> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr> - inoremap <buffer> <silent> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - inoremap <buffer> <silent> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> - inoremap <buffer> <silent> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> - inoremap <buffer> <silent> s <c-o>:call <SID>NetrwSortStyle(1)<cr> - inoremap <buffer> <silent> S <c-o>:call <SID>NetSortSequence(1)<cr> - inoremap <buffer> <silent> t <c-o>:call <SID>NetrwSplit(4)<cr> - inoremap <buffer> <silent> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - inoremap <buffer> <silent> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - inoremap <buffer> <silent> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> - inoremap <buffer> <silent> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> - inoremap <buffer> <silent> v <c-o>:call <SID>NetrwSplit(5)<cr> - inoremap <buffer> <silent> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> + inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(1)<cr> + inoremap <buffer> <silent> <nowait> c <c-o>:exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> c <c-o>:call <SID>NetrwLcd(b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> + inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(1)<cr> + inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(1)<cr> + inoremap <buffer> <silent> <nowait> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> + inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(1)<cr> + inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr> + inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr> + nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr> + inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> + inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(1)<cr> + inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr> + inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr> + inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr> + inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> + inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr> + inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr> + inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr> + inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr> + inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> + inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr> + inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr> + inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr> + inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr> + inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> + inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> + inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> + inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr> + inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(1)<cr> + inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(3)<cr> + inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> + inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr> + inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> + inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> + inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> + inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(1)<cr> + inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(1)<cr> + inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(4)<cr> + inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> + inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> + inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> + inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> + inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(5)<cr> + inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> if !hasmapto('<Plug>NetrwHideEdit') nmap <buffer> <unique> <c-h> <Plug>NetrwHideEdit imap <buffer> <unique> <c-h> <Plug>NetrwHideEdit @@ -5960,7 +6043,7 @@ fun! s:NetrwMaps(islocal) nmap <buffer> <unique> <c-l> <Plug>NetrwRefresh imap <buffer> <unique> <c-l> <Plug>NetrwRefresh endif - nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> + nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './'))<cr> if s:didstarstar || !mapcheck("<s-down>","n") nnoremap <buffer> <silent> <s-down> :Nexplore<cr> inoremap <buffer> <silent> <s-down> :Nexplore<cr> @@ -5972,144 +6055,149 @@ fun! s:NetrwMaps(islocal) let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) if g:netrw_mousemaps == 1 nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse - nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr> + nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr> + nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse + nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(1)<cr> nmap <buffer> <middlemouse> <Plug>NetrwMiddlemouse - nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr> + nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr> nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse - nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(1)<cr> + nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(1)<cr> nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag - nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(1)<cr> + nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(1)<cr> nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse - nmap <buffer> <silent> <Plug>Netrw2Leftmouse - + nmap <buffer> <silent> <Plug>Netrw2Leftmouse - imap <buffer> <leftmouse> <Plug>ILeftmouse - ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr> + ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr> imap <buffer> <middlemouse> <Plug>IMiddlemouse - ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr> + ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr> imap <buffer> <s-leftmouse> <Plug>ISLeftmouse - ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> + ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' endif - exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'nnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'nnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("")<cr>' - exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'vnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'vnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> d <c-o>:call <SID>NetrwMakeDir("")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' + exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' + exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' + exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr>' nnoremap <buffer> <F1> :he netrw-quickhelp<cr> + " support user-specified maps + call netrw#UserMaps(1) + else " remote -" call Decho("make remote maps") +" call Decho("make remote maps",'~'.expand("<slnum>")) call s:RemotePathAnalysis(b:netrw_curdir) " remote normal-mode maps - nnoremap <buffer> <silent> <cr> :call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> - nnoremap <buffer> <silent> <s-cr> :call <SID>TreeSqueezeDir(0)<cr> - nnoremap <buffer> <silent> <c-l> :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - nnoremap <buffer> <silent> <c-r> :call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> - :call <SID>NetrwBrowseUpDir(0)<cr> - nnoremap <buffer> <silent> a :call <SID>NetrwHide(0)<cr> - nnoremap <buffer> <silent> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mc :<c-u>call <SID>NetrwMarkFileCopy(0)<cr> - nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr> - nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr> - nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(0)<cr> - nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(0)<cr> - nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(0)<cr> - nnoremap <buffer> <silent> mp :<c-u>call <SID>NetrwMarkFilePrint(0)<cr> - nnoremap <buffer> <silent> mr :<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> - nnoremap <buffer> <silent> ms :<c-u>call <SID>NetrwMarkFileSource(0)<cr> - nnoremap <buffer> <silent> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr> - nnoremap <buffer> <silent> mT :<c-u>call <SID>NetrwMarkFileTag(0)<cr> - nnoremap <buffer> <silent> mu :<c-u>call <SID>NetrwUnMarkFile(0)<cr> - nnoremap <buffer> <silent> mv :<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> - nnoremap <buffer> <silent> mx :<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> - nnoremap <buffer> <silent> mX :<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> - nnoremap <buffer> <silent> mz :<c-u>call <SID>NetrwMarkFileCompress(0)<cr> - nnoremap <buffer> <silent> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> gh :<c-u>call <SID>NetrwHidden(0)<cr> - nnoremap <buffer> <silent> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> C :<c-u>call <SID>NetrwSetChgwin()<cr> - nnoremap <buffer> <silent> i :call <SID>NetrwListStyle(0)<cr> - nnoremap <buffer> <silent> I :call <SID>NetrwBannerCtrl(1)<cr> - nnoremap <buffer> <silent> o :call <SID>NetrwSplit(0)<cr> - nnoremap <buffer> <silent> O :call <SID>NetrwObtain(0)<cr> - nnoremap <buffer> <silent> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - nnoremap <buffer> <silent> P :call <SID>NetrwPrevWinOpen(0)<cr> - nnoremap <buffer> <silent> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> - nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(0)<cr> - nnoremap <buffer> <silent> S :call <SID>NetSortSequence(0)<cr> - nnoremap <buffer> <silent> t :call <SID>NetrwSplit(1)<cr> - nnoremap <buffer> <silent> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - nnoremap <buffer> <silent> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - nnoremap <buffer> <silent> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> - nnoremap <buffer> <silent> v :call <SID>NetrwSplit(2)<cr> - nnoremap <buffer> <silent> x :call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> - nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(0)<cr> + nnoremap <buffer> <silent> <nowait> <cr> :call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> + nnoremap <buffer> <silent> <nowait> <s-cr> :call <SID>TreeSqueezeDir(0)<cr> + nnoremap <buffer> <silent> <nowait> <c-l> :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> + nnoremap <buffer> <silent> <nowait> <c-r> :call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> - :call <SID>NetrwBrowseUpDir(0)<cr> + nnoremap <buffer> <silent> <nowait> a :call <SID>NetrwHide(0)<cr> + nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(0)<cr> + nnoremap <buffer> <silent> <nowait> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr> + nnoremap <buffer> <silent> <nowait> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr> + nnoremap <buffer> <silent> <nowait> mf :<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mg :<c-u>call <SID>NetrwMarkFileGrep(0)<cr> + nnoremap <buffer> <silent> <nowait> mh :<c-u>call <SID>NetrwMarkHideSfx(0)<cr> + nnoremap <buffer> <silent> <nowait> mm :<c-u>call <SID>NetrwMarkFileMove(0)<cr> + nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(0)<cr> + nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> + nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(0)<cr> + nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr> + nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(0)<cr> + nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(0)<cr> + nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> + nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> + nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> + nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(0)<cr> + nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(0)<cr> + nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr> + nnoremap <buffer> <silent> <nowait> i :call <SID>NetrwListStyle(0)<cr> + nnoremap <buffer> <silent> <nowait> I :call <SID>NetrwBannerCtrl(1)<cr> + nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(0)<cr> + nnoremap <buffer> <silent> <nowait> O :call <SID>NetrwObtain(0)<cr> + nnoremap <buffer> <silent> <nowait> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> + nnoremap <buffer> <silent> <nowait> P :call <SID>NetrwPrevWinOpen(0)<cr> + nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> + nnoremap <buffer> <silent> <nowait> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> + nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(0)<cr> + nnoremap <buffer> <silent> <nowait> S :call <SID>NetSortSequence(0)<cr> + nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(1)<cr> + nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> + nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> + nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(2)<cr> + nnoremap <buffer> <silent> <nowait> x :call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> + nnoremap <buffer> <silent> <nowait> % :call <SID>NetrwOpenFile(0)<cr> " remote insert-mode maps - inoremap <buffer> <silent> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> - inoremap <buffer> <silent> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - inoremap <buffer> <silent> <s-cr> <c-o>:call <SID>TreeSqueezeDir(0)<cr> - inoremap <buffer> <silent> - <c-o>:call <SID>NetrwBrowseUpDir(0)<cr> - inoremap <buffer> <silent> a <c-o>:call <SID>NetrwHide(0)<cr> - inoremap <buffer> <silent> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> - inoremap <buffer> <silent> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr> - inoremap <buffer> <silent> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr> - inoremap <buffer> <silent> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr> - inoremap <buffer> <silent> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr> - inoremap <buffer> <silent> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr> - inoremap <buffer> <silent> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr> - inoremap <buffer> <silent> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr> - inoremap <buffer> <silent> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> - inoremap <buffer> <silent> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr> - inoremap <buffer> <silent> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr> - inoremap <buffer> <silent> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr> - inoremap <buffer> <silent> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr> - nnoremap <buffer> <silent> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> - inoremap <buffer> <silent> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> - inoremap <buffer> <silent> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> - inoremap <buffer> <silent> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> - inoremap <buffer> <silent> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr> - inoremap <buffer> <silent> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> - inoremap <buffer> <silent> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr> - inoremap <buffer> <silent> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> - inoremap <buffer> <silent> C <c-o>:call <SID>NetrwSetChgwin()<cr> - inoremap <buffer> <silent> i <c-o>:call <SID>NetrwListStyle(0)<cr> - inoremap <buffer> <silent> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> - inoremap <buffer> <silent> o <c-o>:call <SID>NetrwSplit(0)<cr> - inoremap <buffer> <silent> O <c-o>:call <SID>NetrwObtain(0)<cr> - inoremap <buffer> <silent> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> - inoremap <buffer> <silent> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr> - inoremap <buffer> <silent> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> - inoremap <buffer> <silent> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> - inoremap <buffer> <silent> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> - inoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> - inoremap <buffer> <silent> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - inoremap <buffer> <silent> s <c-o>:call <SID>NetrwSortStyle(0)<cr> - inoremap <buffer> <silent> S <c-o>:call <SID>NetSortSequence(0)<cr> - inoremap <buffer> <silent> t <c-o>:call <SID>NetrwSplit(1)<cr> - inoremap <buffer> <silent> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> - inoremap <buffer> <silent> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> - inoremap <buffer> <silent> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> - inoremap <buffer> <silent> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> - inoremap <buffer> <silent> v <c-o>:call <SID>NetrwSplit(2)<cr> - inoremap <buffer> <silent> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> - inoremap <buffer> <silent> % <c-o>:call <SID>NetrwOpenFile(0)<cr> + inoremap <buffer> <silent> <nowait> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> + inoremap <buffer> <silent> <nowait> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> + inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(0)<cr> + inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(0)<cr> + inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(0)<cr> + inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr> + inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr> + inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr> + inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> + inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr> + inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr> + inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr> + inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr> + inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> + inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr> + inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr> + inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr> + inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr> + nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> + inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> + inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> + inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> + inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr> + inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr> + inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> + inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(0)<cr> + inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> + inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(0)<cr> + inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(0)<cr> + inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> + inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr> + inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> + inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> + inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> + inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(0)<cr> + inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(0)<cr> + inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(1)<cr> + inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> + inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> + inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> + inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(2)<cr> + inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> + inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(0)<cr> if !hasmapto('<Plug>NetrwHideEdit') nmap <buffer> <c-h> <Plug>NetrwHideEdit imap <buffer> <c-h> <Plug>NetrwHideEdit @@ -6125,44 +6213,45 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> if g:netrw_mousemaps == 1 - nmap <leftmouse> <Plug>NetrwLeftmouse - nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(0)<cr> - nmap <buffer> <leftdrag> <Plug>NetrwLeftdrag - nno <buffer> <silent> <Plug>NetrwLeftdrag :call <SID>NetrwLeftdrag(0)<cr> - nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse - nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(0)<cr> - nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag - nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(0)<cr> - nmap <middlemouse> <Plug>NetrwMiddlemouse - nno <buffer> <silent> <middlemouse> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr> - nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse - nmap <buffer> <silent> <Plug>Netrw2Leftmouse - - imap <buffer> <leftmouse> <Plug>ILeftmouse - ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr> - imap <buffer> <middlemouse> <Plug>IMiddlemouse - ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr> - imap <buffer> <s-leftmouse> <Plug>ISLeftmouse - ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> + nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse + nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(0)<cr> + nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse + nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(0)<cr> + nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse + nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(0)<cr> + nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag + nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(0)<cr> + nmap <middlemouse> <Plug>NetrwMiddlemouse + nno <buffer> <silent> <middlemouse> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr> + nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse + nmap <buffer> <silent> <Plug>Netrw2Leftmouse - + imap <buffer> <leftmouse> <Plug>ILeftmouse + ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr> + imap <buffer> <middlemouse> <Plug>IMiddlemouse + ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr> + imap <buffer> <s-leftmouse> <Plug>ISLeftmouse + ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' endif - exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' - exe 'nnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'nnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'vnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'vnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' - exe 'inoremap <buffer> <silent> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' - exe 'inoremap <buffer> <silent> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'nnoremap <buffer> <silent> <nowait> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' + exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' + exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' nnoremap <buffer> <F1> :he netrw-quickhelp<cr> inoremap <buffer> <F1> <c-o>:he netrw-quickhelp<cr> - endif - NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir) + " support user-specified maps + call netrw#UserMaps(0) + endif " call Dret("s:NetrwMaps") endfun @@ -6184,9 +6273,6 @@ fun! s:NetrwCommands(islocal) com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(0,<f-args>) endif com! -buffer -nargs=? -complete=file MT call s:NetrwMarkTarget(<q-args>) - " the following two commands are intended to be used for testing only, so I'm not advertising them in the manual - com! -buffer -nargs=0 CRL call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) - com! -buffer -nargs=0 CRR call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord())) " call Dret("s:NetrwCommands") endfun @@ -6196,16 +6282,21 @@ endfun " glob()ing only works with local files fun! s:NetrwMarkFiles(islocal,...) " call Dfunc("s:NetrwMarkFiles(islocal=".a:islocal."...) a:0=".a:0) - let i = 1 + let curdir = s:NetrwGetCurdir(a:islocal) + let i = 1 while i <= a:0 if a:islocal - let mffiles= glob(a:{i},0,1) + if v:version == 704 && has("patch656") + let mffiles= glob(a:{i},0,1,1) + else + let mffiles= glob(a:{i},0,1) + endif else let mffiles= [a:{i}] endif -" call Decho("mffiles".string(mffiles)) +" call Decho("mffiles".string(mffiles),'~'.expand("<slnum>")) for mffile in mffiles -" call Decho("mffile<".mffile.">") +" call Decho("mffile<".mffile.">",'~'.expand("<slnum>")) call s:NetrwMarkFile(a:islocal,mffile) endfor let i= i + 1 @@ -6214,18 +6305,20 @@ fun! s:NetrwMarkFiles(islocal,...) endfun " --------------------------------------------------------------------- -" s:NetrwMarkTarget: {{{2 +" s:NetrwMarkTarget: implements :MT (mark target) {{{2 fun! s:NetrwMarkTarget(...) " call Dfunc("s:NetrwMarkTarget() a:0=".a:0) if a:0 == 0 || (a:0 == 1 && a:1 == "") - let tgt= b:netrw_curdir + let curdir = s:NetrwGetCurdir(1) + let tgt = b:netrw_curdir else - let tgt= a:1 + let curdir = s:NetrwGetCurdir((a:1 =~ '^\a\{3,}://')? 0 : 1) + let tgt = a:1 endif -" call Decho("tgt<".tgt.">") +" call Decho("tgt<".tgt.">",'~'.expand("<slnum>")) let s:netrwmftgt = tgt - let s:netrwmftgt_islocal = tgt !~ '^\a\+://' - let curislocal = b:netrw_curdir !~ '^\a\+://' + let s:netrwmftgt_islocal = tgt !~ '^\a\{3,}://' + let curislocal = b:netrw_curdir !~ '^\a\{3,}://' let svpos = netrw#SavePosn() call s:NetrwRefresh(curislocal,s:NetrwBrowseChgDir(curislocal,'./')) call netrw#RestorePosn(svpos) @@ -6251,16 +6344,17 @@ endfun " b:netrw_islocal fun! s:NetrwMarkFile(islocal,fname) " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)") +" call Decho("bufnr(%)=".bufnr("%").": ".bufname("%"),'~'.expand("<slnum>")) " sanity check if empty(a:fname) " call Dret("s:NetrwMarkFile : emtpy fname") return endif + let curdir = s:NetrwGetCurdir(a:islocal) let ykeep = @@ let curbufnr= bufnr("%") - let curdir = b:netrw_curdir if a:fname =~ '^\a' let leader= '\<' else @@ -6272,29 +6366,30 @@ fun! s:NetrwMarkFile(islocal,fname) let trailer = '[@=|\/\*]\=\ze\%( \|\t\|$\)' endif - if exists("s:netrwmarkfilelist_{curbufnr}") + if exists("s:netrwmarkfilelist_".curbufnr) " markfile list pre-exists -" call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") -" call Decho("starting s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">") +" call Decho("case s:netrwmarkfilelist_".curbufnr." already exists",'~'.expand("<slnum>")) +" call Decho("starting s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) +" call Decho("starting s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("<slnum>")) let b:netrw_islocal= a:islocal if index(s:netrwmarkfilelist_{curbufnr},a:fname) == -1 " append filename to buffer's markfilelist -" call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) call add(s:netrwmarkfilelist_{curbufnr},a:fname) let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|'.leader.escape(a:fname,g:netrw_markfileesc).trailer else " remove filename from buffer's markfilelist -" call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) call filter(s:netrwmarkfilelist_{curbufnr},'v:val != a:fname') if s:netrwmarkfilelist_{curbufnr} == [] " local markfilelist is empty; remove it entirely -" call Decho("markfile list now empty") +" call Decho("markfile list now empty",'~'.expand("<slnum>")) call s:NetrwUnmarkList(curbufnr,curdir) else " rebuild match list to display markings correctly -" call Decho("rebuild s:netrwmarkfilemtch_".curbufnr) +" call Decho("rebuild s:netrwmarkfilemtch_".curbufnr,'~'.expand("<slnum>")) let s:netrwmarkfilemtch_{curbufnr}= "" let first = 1 for fname in s:netrwmarkfilelist_{curbufnr} @@ -6305,17 +6400,18 @@ fun! s:NetrwMarkFile(islocal,fname) endif let first= 0 endfor -" call Decho("ending s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("ending s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) endif endif else " initialize new markfilelist +" call Decho("case: initialize new markfilelist",'~'.expand("<slnum>")) -" call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr) +" call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr,'~'.expand("<slnum>")) let s:netrwmarkfilelist_{curbufnr}= [] - call add(s:netrwmarkfilelist_{curbufnr},a:fname) -" call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") + call add(s:netrwmarkfilelist_{curbufnr},substitute(a:fname,'[|@]$','','')) +" call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>")) " build initial markfile matching pattern if a:fname =~ '/$' @@ -6323,7 +6419,7 @@ fun! s:NetrwMarkFile(islocal,fname) else let s:netrwmarkfilemtch_{curbufnr}= leader.escape(a:fname,g:netrw_markfileesc).trailer endif -" call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">") +" call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("<slnum>")) endif " handle global markfilelist @@ -6332,12 +6428,12 @@ fun! s:NetrwMarkFile(islocal,fname) if index(s:netrwmarkfilelist,dname) == -1 " append new filename to global markfilelist call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname)) -" call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">") +" call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) else " remove new filename from global markfilelist -" call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")") +" call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")",'~'.expand("<slnum>")) call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"') -" call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">") +" call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) if s:netrwmarkfilelist == [] unlet s:netrwmarkfilelist endif @@ -6346,17 +6442,17 @@ fun! s:NetrwMarkFile(islocal,fname) " initialize new global-directory markfilelist let s:netrwmarkfilelist= [] call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname)) -" call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">") +" call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) endif - " set up 2match'ing to netrwmarkfilemtch list + " set up 2match'ing to netrwmarkfilemtch_# list if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != "" -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/") +" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/",'~'.expand("<slnum>")) if exists("g:did_drchip_netrwlist_syntax") exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" endif else -" call Decho("2match none") +" call Decho("2match none",'~'.expand("<slnum>")) 2match none endif let @@= ykeep @@ -6374,7 +6470,7 @@ endfun fun! s:NetrwMarkFileCompress(islocal) " call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -6383,25 +6479,25 @@ fun! s:NetrwMarkFileCompress(islocal) " call Dret("s:NetrwMarkFileCompress") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{curbufnr}") && exists("g:netrw_compress") && exists("g:netrw_decompress") " for every filename in the marked list for fname in s:netrwmarkfilelist_{curbufnr} let sfx= substitute(fname,'^.\{-}\(\.\a\+\)$','\1','') -" call Decho("extracted sfx<".sfx.">") +" call Decho("extracted sfx<".sfx.">",'~'.expand("<slnum>")) if exists("g:netrw_decompress['".sfx."']") " fname has a suffix indicating that its compressed; apply associated decompression routine let exe= g:netrw_decompress[sfx] -" call Decho("fname<".fname."> is compressed so decompress with <".exe.">") +" call Decho("fname<".fname."> is compressed so decompress with <".exe.">",'~'.expand("<slnum>")) let exe= netrw#WinPath(exe) if a:islocal if g:netrw_keepdir - let fname= shellescape(s:ComposePath(curdir,fname)) + let fname= s:ShellEscape(s:ComposePath(curdir,fname)) endif else - let fname= shellescape(b:netrw_curdir.fname,1) + let fname= s:ShellEscape(b:netrw_curdir.fname,1) endif if executable(exe) if a:islocal @@ -6419,10 +6515,10 @@ fun! s:NetrwMarkFileCompress(islocal) unlet exe elseif a:islocal " fname not a compressed file, so compress it - call system(netrw#WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname))) + call system(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,fname))) else " fname not a compressed file, so compress it - NetrwKeepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname)) + NetrwKeepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(fname)) endif endfor " for every file in the marked list @@ -6443,11 +6539,7 @@ endfun fun! s:NetrwMarkFileCopy(islocal,...) " call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---')."> a:0=".a:0) - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") - endif - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -6456,18 +6548,18 @@ fun! s:NetrwMarkFileCopy(islocal,...) " call Dret("s:NetrwMarkFileCopy") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if !exists("s:netrwmftgt") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif -" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) if a:islocal && s:netrwmftgt_islocal " Copy marked files, local directory to local directory -" call Decho("copy from local to local") +" call Decho("copy from local to local",'~'.expand("<slnum>")) if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '^'.expand("$COMSPEC").'\s' 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!") @@ -6478,17 +6570,17 @@ fun! s:NetrwMarkFileCopy(islocal,...) if simplify(s:netrwmftgt) == simplify(b:netrw_curdir) if len(s:netrwmarkfilelist_{bufnr('%')}) == 1 " only one marked file -" call Decho("case: only one marked file") - let args = shellescape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0]) +" call Decho("case: only one marked file",'~'.expand("<slnum>")) + let args = s:ShellEscape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0]) let oldname = s:netrwmarkfilelist_{bufnr('%')}[0] elseif a:0 == 1 -" call Decho("case: handling one input argument") +" call Decho("case: handling one input argument",'~'.expand("<slnum>")) " this happens when the next case was used to recursively call s:NetrwMarkFileCopy() - let args = shellescape(b:netrw_curdir."/".a:1) + let args = s:ShellEscape(b:netrw_curdir."/".a:1) let oldname = a:1 else " copy multiple marked files inside the same directory -" call Decho("case: handling a multiple marked files") +" call Decho("case: handling a multiple marked files",'~'.expand("<slnum>")) let s:recursive= 1 for oldname in s:netrwmarkfilelist_{bufnr("%")} let ret= s:NetrwMarkFileCopy(a:islocal,oldname) @@ -6509,11 +6601,11 @@ fun! s:NetrwMarkFileCopy(islocal,...) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif - let args= shellescape(oldname) - let tgt = shellescape(s:netrwmftgt.'/'.newname) + let args= s:ShellEscape(oldname) + let tgt = s:ShellEscape(s:netrwmftgt.'/'.newname) else - let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)")) - let tgt = shellescape(s:netrwmftgt) + let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"s:ShellEscape(b:netrw_curdir.\"/\".v:val)")) + let tgt = s:ShellEscape(s:netrwmftgt) endif if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) let args= substitute(args,'/','\\','g') @@ -6521,16 +6613,17 @@ fun! s:NetrwMarkFileCopy(islocal,...) endif if args =~ "'"|let args= substitute(args,"'\\(.*\\)'",'\1','')|endif if tgt =~ "'"|let tgt = substitute(tgt,"'\\(.*\\)'",'\1','') |endif - if isdirectory(args) -" call Decho("args<".args."> is a directory") + if args =~ '//$'|let args= substitute(args,'//$','/','')|endif + if isdirectory(s:NetrwFile(args)) +" call Decho("args<".args."> is a directory",'~'.expand("<slnum>")) let copycmd= g:netrw_localcopydircmd -" call Decho("using copydircmd<".copycmd.">") +" call Decho("using copydircmd<".copycmd.">",'~'.expand("<slnum>")) if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) " window's xcopy doesn't copy a directory to a target properly. Instead, it copies a directory's " contents to a target. One must append the source directory name to the target to get xcopy to " do the right thing. let tgt= tgt.'\'.substitute(a:1,'^.*[\\/]','','') -" call Decho("modified tgt for xcopy") +" call Decho("modified tgt for xcopy",'~'.expand("<slnum>")) endif else let copycmd= g:netrw_localcopycmd @@ -6542,30 +6635,34 @@ fun! s:NetrwMarkFileCopy(islocal,...) else let copycmd = netrw#WinPath(copycmd) endif -" call Decho("args <".args.">") -" call Decho("tgt <".tgt.">") -" call Decho("copycmd<".copycmd.">") -" call Decho("system(".copycmd." '".args."' '".tgt."')") +" call Decho("args <".args.">",'~'.expand("<slnum>")) +" call Decho("tgt <".tgt.">",'~'.expand("<slnum>")) +" call Decho("copycmd<".copycmd.">",'~'.expand("<slnum>")) +" call Decho("system(".copycmd." '".args."' '".tgt."')",'~'.expand("<slnum>")) call system(copycmd." '".args."' '".tgt."'") if v:shell_error != 0 - call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) -" call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt)) + if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir + call netrw#ErrorMsg(s:ERROR,"copy failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",101) + else + call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) + endif +" call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".s:ShellEscape(s:netrwmftgt)) return 0 endif elseif a:islocal && !s:netrwmftgt_islocal " Copy marked files, local directory to remote directory -" call Decho("copy from local to remote") +" call Decho("copy from local to remote",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && s:netrwmftgt_islocal " Copy marked files, remote directory to local directory -" call Decho("copy from remote to local") +" call Decho("copy from remote to local",'~'.expand("<slnum>")) NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && !s:netrwmftgt_islocal " Copy marked files, remote directory to remote directory -" call Decho("copy from remote to remote") +" call Decho("copy from remote to remote",'~'.expand("<slnum>")) let curdir = getcwd() let tmpdir = s:GetTempfile("") if tmpdir !~ '/' @@ -6574,14 +6671,14 @@ fun! s:NetrwMarkFileCopy(islocal,...) if exists("*mkdir") call mkdir(tmpdir) else - call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1)) + call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.s: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) ) +" call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(tmpdir,1) ) return endif endif - if isdirectory(tmpdir) + if isdirectory(s:NetrwFile(tmpdir)) call s:NetrwLcd(tmpdir) NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")') @@ -6591,10 +6688,10 @@ fun! s:NetrwMarkFileCopy(islocal,...) NetrwKeepj call s:NetrwDelete(fname) endfor call s:NetrwLcd(curdir) - call s:NetrwExe("sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1)) + call s:NetrwExe("sil !".g:netrw_localrmdir." ".s: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) ) +" call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) ) return endif else @@ -6606,7 +6703,7 @@ fun! s:NetrwMarkFileCopy(islocal,...) " ------- " cleanup " ------- -" call Decho("cleanup") +" call Decho("cleanup",'~'.expand("<slnum>")) if !exists("s:recursive") " remove markings from local buffer call s:NetrwUnmarkList(curbufnr,curdir) @@ -6622,7 +6719,7 @@ fun! s:NetrwMarkFileCopy(islocal,...) if g:netrw_fastbrowse <= 1 NetrwKeepj call s:LocalBrowseRefresh() endif - + " call Dret("s:NetrwMarkFileCopy 1") return 1 endfun @@ -6642,21 +6739,21 @@ fun! s:NetrwMarkFileDiff(islocal) " call Dret("s:NetrwMarkFileDiff") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + let curdir= s:NetrwGetCurdir(a:islocal) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{".curbufnr."}") let cnt = 0 - let curdir = b:netrw_curdir for fname in s:netrwmarkfilelist let cnt= cnt + 1 if cnt == 1 -" call Decho("diffthis: fname<".fname.">") +" call Decho("diffthis: fname<".fname.">",'~'.expand("<slnum>")) exe "NetrwKeepj e ".fnameescape(fname) diffthis elseif cnt == 2 || cnt == 3 vsplit wincmd l -" call Decho("diffthis: ".fname) +" call Decho("diffthis: ".fname,'~'.expand("<slnum>")) exe "NetrwKeepj e ".fnameescape(fname) diffthis else @@ -6675,7 +6772,7 @@ endfun fun! s:NetrwMarkFileEdit(islocal) " call Dfunc("s:NetrwMarkFileEdit(islocal=".a:islocal.")") - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -6684,7 +6781,7 @@ fun! s:NetrwMarkFileEdit(islocal) " call Dret("s:NetrwMarkFileEdit") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{curbufnr}") call s:SetRexDir(a:islocal,curdir) @@ -6692,11 +6789,11 @@ fun! s:NetrwMarkFileEdit(islocal) " unmark markedfile list " call s:NetrwUnmarkList(curbufnr,curdir) call s:NetrwUnmarkAll() -" call Decho("exe sil args ".flist) +" call Decho("exe sil args ".flist,'~'.expand("<slnum>")) exe "sil args ".flist endif echo "(use :bn, :bp to navigate files; :Rex to return)" - + " call Dret("s:NetrwMarkFileEdit") endfun @@ -6710,17 +6807,17 @@ fun! s:NetrwMarkFileQFEL(islocal,qfel) if !empty(a:qfel) for entry in a:qfel let bufnmbr= entry["bufnr"] -" call Decho("bufname(".bufnmbr.")<".bufname(bufnmbr)."> line#".entry["lnum"]." text=".entry["text"]) +" call Decho("bufname(".bufnmbr.")<".bufname(bufnmbr)."> line#".entry["lnum"]." text=".entry["text"],'~'.expand("<slnum>")) if !exists("s:netrwmarkfilelist_{curbufnr}") -" call Decho("case: no marked file list") +" call Decho("case: no marked file list",'~'.expand("<slnum>")) call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) elseif index(s:netrwmarkfilelist_{curbufnr},bufname(bufnmbr)) == -1 " s:NetrwMarkFile will remove duplicate entries from the marked file list. " So, this test lets two or more hits on the same pattern to be ignored. -" call Decho("case: ".bufname(bufnmbr)." not currently in marked file list") +" call Decho("case: ".bufname(bufnmbr)." not currently in marked file list",'~'.expand("<slnum>")) call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) else -" call Decho("case: ".bufname(bufnmbr)." already in marked file list") +" call Decho("case: ".bufname(bufnmbr)." already in marked file list",'~'.expand("<slnum>")) endif endfor echo "(use me to edit marked files)" @@ -6738,7 +6835,7 @@ endfun fun! s:NetrwMarkFileExe(islocal,enbloc) " call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.",enbloc=".a:enbloc.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") if a:enbloc == 0 @@ -6749,14 +6846,14 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) " call Dret("s:NetrwMarkFileExe") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{curbufnr}") " get the command call inputsave() let cmd= input("Enter command: ","","file") call inputrestore() -" call Decho("cmd<".cmd.">") +" call Decho("cmd<".cmd.">",'~'.expand("<slnum>")) if cmd == "" " call Dret("s:NetrwMarkFileExe : early exit, empty command") return @@ -6767,10 +6864,10 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) for fname in s:netrwmarkfilelist_{curbufnr} if a:islocal if g:netrw_keepdir - let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname))) + let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname))) endif else - let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname)) + let fname= s:ShellEscape(netrw#WinPath(b:netrw_curdir.fname)) endif if cmd =~ '%' let xcmd= substitute(cmd,'%',fname,'g') @@ -6778,10 +6875,10 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) let xcmd= cmd.' '.fname endif if a:islocal -" call Decho("local: xcmd<".xcmd.">") +" call Decho("local: xcmd<".xcmd.">",'~'.expand("<slnum>")) let ret= system(xcmd) else -" call Decho("remote: xcmd<".xcmd.">") +" call Decho("remote: xcmd<".xcmd.">",'~'.expand("<slnum>")) let ret= s:RemoteSystem(xcmd) endif if v:shell_error < 0 @@ -6807,15 +6904,15 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) call inputsave() let cmd= input("Enter command: ","","file") call inputrestore() -" call Decho("cmd<".cmd.">") +" call Decho("cmd<".cmd.">",'~'.expand("<slnum>")) if cmd == "" " call Dret("s:NetrwMarkFileExe : early exit, empty command") return endif if cmd =~ '%' - let cmd= substitute(cmd,'%',join(map(s:netrwmarkfilelist,'shellescape(v:val)'),' '),'g') + let cmd= substitute(cmd,'%',join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' '),'g') else - let cmd= cmd.' '.join(map(s:netrwmarkfilelist,'shellescape(v:val)'),' ') + let cmd= cmd.' '.join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' ') endif if a:islocal call system(cmd) @@ -6832,7 +6929,7 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) NetrwKeepj call netrw#RestorePosn(svpos) endif - + " call Dret("s:NetrwMarkFileExe") endfun @@ -6849,7 +6946,7 @@ fun! s:NetrwMarkHideSfx(islocal) if exists("s:netrwmarkfilelist_{curbufnr}") for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("s:NetrwMarkFileCopy: fname<".fname.">") +" call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("<slnum>")) " construct suffix pattern if fname =~ '\.' let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','') @@ -6869,7 +6966,7 @@ fun! s:NetrwMarkHideSfx(islocal) let itemnum= itemnum + 1 endfor endif -" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">") +" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("<slnum>")) if inhidelist " remove sfxpat from list call remove(hidelist,itemnum) @@ -6899,7 +6996,7 @@ endfun fun! s:NetrwMarkFileVimCmd(islocal) " call Dfunc("s:NetrwMarkFileVimCmd(islocal=".a:islocal.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -6908,14 +7005,14 @@ fun! s:NetrwMarkFileVimCmd(islocal) " call Dret("s:NetrwMarkFileVimCmd") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist_{curbufnr}") " get the command call inputsave() let cmd= input("Enter vim command: ","","file") call inputrestore() -" call Decho("cmd<".cmd.">") +" call Decho("cmd<".cmd.">",'~'.expand("<slnum>")) if cmd == "" " " call Dret("s:NetrwMarkFileVimCmd : early exit, empty command") return @@ -6924,15 +7021,15 @@ fun! s:NetrwMarkFileVimCmd(islocal) " apply command to marked files. Substitute: filename -> % " If no %, then append a space and the filename to the command for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) if a:islocal 1split exe "sil! NetrwKeepj keepalt e ".fnameescape(fname) -" call Decho("local<".fname.">: exe ".cmd) +" call Decho("local<".fname.">: exe ".cmd,'~'.expand("<slnum>")) exe cmd exe "sil! keepalt wq!" else -" call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET") +" call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET",'~'.expand("<slnum>")) echo "sorry, \"mv\" not supported yet for remote files" endif endfor @@ -6946,7 +7043,7 @@ fun! s:NetrwMarkFileVimCmd(islocal) else NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif - + " call Dret("s:NetrwMarkFileVimCmd") endfun @@ -6963,7 +7060,7 @@ fun! s:NetrwMarkHideSfx(islocal) if exists("s:netrwmarkfilelist_{curbufnr}") for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("s:NetrwMarkFileCopy: fname<".fname.">") +" call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("<slnum>")) " construct suffix pattern if fname =~ '\.' let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','') @@ -6983,7 +7080,7 @@ fun! s:NetrwMarkHideSfx(islocal) let itemnum= itemnum + 1 endfor endif -" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">") +" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("<slnum>")) if inhidelist " remove sfxpat from list call remove(hidelist,itemnum) @@ -7014,13 +7111,14 @@ fun! s:NetrwMarkFileGrep(islocal) " call Dfunc("s:NetrwMarkFileGrep(islocal=".a:islocal.")") let svpos = netrw#SavePosn() let curbufnr = bufnr("%") + let curdir = s:NetrwGetCurdir(a:islocal) if exists("s:netrwmarkfilelist") -" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") +" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)")) call s:NetrwUnmarkAll() else -" call Decho('no marked files, using "*"') +" call Decho('no marked files, using "*"','~'.expand("<slnum>")) let netrwmarkfilelist= "*" endif @@ -7031,7 +7129,7 @@ fun! s:NetrwMarkFileGrep(islocal) let patbang = "" if pat =~ '^!' let patbang = "!" - let pat= strpart(pat,2) + let pat = strpart(pat,2) endif if pat =~ '^\i' let pat = escape(pat,'/') @@ -7041,7 +7139,7 @@ fun! s:NetrwMarkFileGrep(islocal) endif " use vimgrep for both local and remote -" call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist) +" call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist,'~'.expand("<slnum>")) try exe "NetrwKeepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist catch /^Vim\%((\a\+)\)\=:E480/ @@ -7056,7 +7154,7 @@ fun! s:NetrwMarkFileGrep(islocal) if exists("nonisi") " original, user-supplied pattern did not begin with a character from isident -" call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg") +" call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg",'~'.expand("<slnum>")) if pat =~ nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' call s:NetrwMarkFileQFEL(a:islocal,getqflist()) endif @@ -7072,7 +7170,7 @@ endfun " = 1: target directory is local fun! s:NetrwMarkFileMove(islocal) " call Dfunc("s:NetrwMarkFileMove(islocal=".a:islocal.")") - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -7081,61 +7179,65 @@ fun! s:NetrwMarkFileMove(islocal) " call Dret("s:NetrwMarkFileMove") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if !exists("s:netrwmftgt") NetrwKeepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif -" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) if a:islocal && s:netrwmftgt_islocal " move: local -> local -" call Decho("move from local to local") -" call Decho("local to local move") +" call Decho("move from local to local",'~'.expand("<slnum>")) +" call Decho("local to local move",'~'.expand("<slnum>")) if !executable(g:netrw_localmovecmd) && g:netrw_localmovecmd !~ '^'.expand("$COMSPEC").'\s' 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 - let tgt = shellescape(s:netrwmftgt) -" call Decho("tgt<".tgt.">") + let tgt = s:ShellEscape(s:netrwmftgt) +" call Decho("tgt<".tgt.">",'~'.expand("<slnum>")) if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) let tgt = substitute(tgt, '/','\\','g') -" call Decho("windows exception: tgt<".tgt.">") +" call Decho("windows exception: tgt<".tgt.">",'~'.expand("<slnum>")) if g:netrw_localmovecmd =~ '\s' let movecmd = substitute(g:netrw_localmovecmd,'\s.*$','','') let movecmdargs = substitute(g:netrw_localmovecmd,'^.\{-}\(\s.*\)$','\1','') let movecmd = netrw#WinPath(movecmd).movecmdargs -" call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)") +" call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)",'~'.expand("<slnum>")) else let movecmd = netrw#WinPath(movecmd) -" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)") +" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)",'~'.expand("<slnum>")) endif else let movecmd = netrw#WinPath(g:netrw_localmovecmd) -" call Decho("movecmd<".movecmd."> (#3 linux or cygwin)") +" call Decho("movecmd<".movecmd."> (#3 linux or cygwin)",'~'.expand("<slnum>")) endif for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("system(".movecmd." ".shellescape(fname)." ".tgt.")") if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) let fname= substitute(fname,'/','\\','g') endif - let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".tgt) +" call Decho("system(".movecmd." ".s:ShellEscape(fname)." ".tgt.")",'~'.expand("<slnum>")) + let ret= system(movecmd." ".s:ShellEscape(fname)." ".tgt) if v:shell_error != 0 - call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) + if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir + call netrw#ErrorMsg(s:ERROR,"move failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",100) + else + call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) + endif break endif endfor elseif a:islocal && !s:netrwmftgt_islocal " move: local -> remote -" call Decho("move from local to remote") -" call Decho("copy") +" call Decho("move from local to remote",'~'.expand("<slnum>")) +" call Decho("copy",'~'.expand("<slnum>")) let mflist= s:netrwmarkfilelist_{bufnr("%")} NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove") +" call Decho("remove",'~'.expand("<slnum>")) for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') let ok = s:NetrwLocalRmFile(b:netrw_curdir,barefname,1) @@ -7144,11 +7246,11 @@ fun! s:NetrwMarkFileMove(islocal) elseif !a:islocal && s:netrwmftgt_islocal " move: remote -> local -" call Decho("move from remote to local") -" call Decho("copy") +" call Decho("move from remote to local",'~'.expand("<slnum>")) +" call Decho("copy",'~'.expand("<slnum>")) let mflist= s:netrwmarkfilelist_{bufnr("%")} NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove") +" call Decho("remove",'~'.expand("<slnum>")) for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1) @@ -7157,11 +7259,11 @@ fun! s:NetrwMarkFileMove(islocal) elseif !a:islocal && !s:netrwmftgt_islocal " move: remote -> remote -" call Decho("move from remote to remote") -" call Decho("copy") +" call Decho("move from remote to remote",'~'.expand("<slnum>")) +" call Decho("copy",'~'.expand("<slnum>")) let mflist= s:netrwmarkfilelist_{bufnr("%")} NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove") +" call Decho("remove",'~'.expand("<slnum>")) for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1) @@ -7172,25 +7274,25 @@ fun! s:NetrwMarkFileMove(islocal) " ------- " cleanup " ------- -" call Decho("cleanup") +" call Decho("cleanup",'~'.expand("<slnum>")) " remove markings from local buffer call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer " refresh buffers if !s:netrwmftgt_islocal -" call Decho("refresh netrwmftgt<".s:netrwmftgt.">") +" call Decho("refresh netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) endif if a:islocal -" call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) endif if g:netrw_fastbrowse <= 1 -" call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh") +" call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh",'~'.expand("<slnum>")) NetrwKeepj call s:LocalBrowseRefresh() endif - + " call Dret("s:NetrwMarkFileMove") endfun @@ -7207,10 +7309,11 @@ fun! s:NetrwMarkFilePrint(islocal) " call Dret("s:NetrwMarkFilePrint") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) + let curdir= s:NetrwGetCurdir(a:islocal) + if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr} - let curdir = b:netrw_curdir call s:NetrwUnmarkList(curbufnr,curdir) for fname in netrwmarkfilelist if a:islocal @@ -7222,9 +7325,9 @@ fun! s:NetrwMarkFilePrint(islocal) endif 1split " the autocmds will handle both local and remote files -" call Decho("exe sil e ".escape(fname,' ')) +" call Decho("exe sil e ".escape(fname,' '),'~'.expand("<slnum>")) exe "sil NetrwKeepj e ".fnameescape(fname) -" call Decho("hardcopy") +" call Decho("hardcopy",'~'.expand("<slnum>")) hardcopy q endfor @@ -7246,28 +7349,33 @@ fun! s:NetrwMarkFileRegexp(islocal) call inputrestore() if a:islocal + let curdir= s:NetrwGetCurdir(a:islocal) " get the matching list of files using local glob() -" call Decho("handle local regexp") +" call Decho("handle local regexp",'~'.expand("<slnum>")) let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - let files = glob(s:ComposePath(dirname,regexp)) -" call Decho("files<".files.">") + if v:version == 704 && has("patch656") + let files = glob(s:ComposePath(dirname,regexp),0,0,1) + else + let files = glob(s:ComposePath(dirname,regexp),0,0) + endif +" call Decho("files<".files.">",'~'.expand("<slnum>")) let filelist= split(files,"\n") " mark the list of files for fname in filelist -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) endfor else -" call Decho("handle remote regexp") +" call Decho("handle remote regexp",'~'.expand("<slnum>")) " convert displayed listing into a filelist let eikeep = &ei let areg = @a sil NetrwKeepj %y a setl ei=all ma -" call Decho("setl ei=all ma") +" call Decho("setl ei=all ma",'~'.expand("<slnum>")) 1split NetrwKeepj call s:NetrwEnew() NetrwKeepj call s:NetrwSafeOptions() @@ -7290,7 +7398,7 @@ fun! s:NetrwMarkFileRegexp(islocal) endif " convert regexp into the more usual glob-style format let regexp= substitute(regexp,'\*','.*','g') -" call Decho("regexp<".regexp.">") +" call Decho("regexp<".regexp.">",'~'.expand("<slnum>")) exe "sil! NetrwKeepj v/".escape(regexp,'/')."/d" call histdel("/",-1) let filelist= getline(1,line("$")) @@ -7320,10 +7428,11 @@ fun! s:NetrwMarkFileSource(islocal) " call Dret("s:NetrwMarkFileSource") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) + let curdir= s:NetrwGetCurdir(a:islocal) + if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")} - let curdir = b:netrw_curdir call s:NetrwUnmarkList(curbufnr,curdir) for fname in netrwmarkfilelist if a:islocal @@ -7334,7 +7443,7 @@ fun! s:NetrwMarkFileSource(islocal) let fname= curdir.fname endif " the autocmds will handle sourcing both local and remote files -" call Decho("exe so ".fnameescape(fname)) +" call Decho("exe so ".fnameescape(fname),'~'.expand("<slnum>")) exe "so ".fnameescape(fname) endfor 2match none @@ -7348,7 +7457,7 @@ endfun fun! s:NetrwMarkFileTag(islocal) " call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -7357,16 +7466,16 @@ fun! s:NetrwMarkFileTag(islocal) " call Dret("s:NetrwMarkFileTag") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>")) if exists("s:netrwmarkfilelist") -" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") - let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "shellescape(v:val,".!a:islocal.")")) +" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>")) + let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "s:ShellEscape(v:val,".!a:islocal.")")) call s:NetrwUnmarkAll() if a:islocal if executable(g:netrw_ctags) -" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")") +" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")",'~'.expand("<slnum>")) call system(g:netrw_ctags." ".netrwmarkfilelist) else call netrw#ErrorMsg(s:ERROR,"g:netrw_ctags<".g:netrw_ctags."> is not executable!",51) @@ -7378,7 +7487,7 @@ fun! s:NetrwMarkFileTag(islocal) 1split NetrwKeepj e tags let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','') -" call Decho("curdir<".curdir."> path<".path.">") +" call Decho("curdir<".curdir."> path<".path.">",'~'.expand("<slnum>")) exe 'NetrwKeepj %s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e' call histdel("/",-1) wq! @@ -7393,14 +7502,14 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileTgt: (invoked by mt) This function sets up a marked file target {{{2 -" Sets up two variables, +" Sets up two variables, " s:netrwmftgt : holds the target directory " s:netrwmftgt_islocal : 0=target directory is remote " 1=target directory is local fun! s:NetrwMarkFileTgt(islocal) " call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let hadtgt = exists("s:netrwmftgt") if !exists("w:netrw_bannercnt") let w:netrw_bannercnt= b:netrw_bannercnt @@ -7408,9 +7517,10 @@ fun! s:NetrwMarkFileTgt(islocal) " set up target if line(".") < w:netrw_bannercnt +" call Decho("set up target: line(.) < w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) " if cursor in banner region, use b:netrw_curdir for the target unless its already the target if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") && s:netrwmftgt == b:netrw_curdir -" call Decho("cursor in banner region, and target already is <".b:netrw_curdir.">: removing target") +" call Decho("cursor in banner region, and target already is <".b:netrw_curdir.">: removing target",'~'.expand("<slnum>")) unlet s:netrwmftgt s:netrwmftgt_islocal if g:netrw_fastbrowse <= 1 call s:LocalBrowseRefresh() @@ -7421,50 +7531,87 @@ fun! s:NetrwMarkFileTgt(islocal) return else let s:netrwmftgt= b:netrw_curdir -" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) endif else " get word under cursor. " * If directory, use it for the target. " * If file, use b:netrw_curdir for the target +" call Decho("get word under cursor",'~'.expand("<slnum>")) let curword= s:NetrwGetWord() let tgtdir = s:ComposePath(curdir,curword) - if a:islocal && isdirectory(tgtdir) + if a:islocal && isdirectory(s:NetrwFile(tgtdir)) let s:netrwmftgt = tgtdir -" call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) elseif !a:islocal && tgtdir =~ '/$' let s:netrwmftgt = tgtdir -" call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) else let s:netrwmftgt = curdir -" call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) endif endif if a:islocal " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) let s:netrwmftgt= simplify(s:netrwmftgt) -" call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>")) endif if g:netrw_cygwin - let s:netrwmftgt= substitute(system("cygpath ".shellescape(s:netrwmftgt)),'\n$','','') + let s:netrwmftgt= substitute(system("cygpath ".s:ShellEscape(s:netrwmftgt)),'\n$','','') let s:netrwmftgt= substitute(s:netrwmftgt,'\n$','','') endif let s:netrwmftgt_islocal= a:islocal + " need to do refresh so that the banner will be updated + " s:LocalBrowseRefresh handles all local-browsing buffers when not fast browsing if g:netrw_fastbrowse <= 1 +" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse.", so refreshing all local netrw buffers") call s:LocalBrowseRefresh() endif - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + if w:netrw_liststyle == s:TREELIST + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,w:netrw_treetop)) + else + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + endif call netrw#RestorePosn(svpos) if !hadtgt sil! NetrwKeepj norm! j endif +" call Decho("getmatches=".string(getmatches()),'~'.expand("<slnum>")) +" call Decho("s:netrwmarkfilelist=".(exists("s:netrwmarkfilelist")? string(s:netrwmarkfilelist) : 'n/a'),'~'.expand("<slnum>")) " call Dret("s:NetrwMarkFileTgt : netrwmftgt<".(exists("s:netrwmftgt")? s:netrwmftgt : "").">") endfun " --------------------------------------------------------------------- +" s:NetrwGetCurdir: gets current directory and sets up b:netrw_curdir if necessary {{{2 +fun! s:NetrwGetCurdir(islocal) +" call Dfunc("s:NetrwGetCurdir(islocal=".a:islocal.")") + + if w:netrw_liststyle == s:TREELIST + let b:netrw_curdir = s:NetrwTreePath(w:netrw_treetop) +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used s:NetrwTreeDir)",'~'.expand("<slnum>")) + elseif !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("<slnum>")) + endif + +" call Decho("b:netrw_curdir<".b:netrw_curdir."> ".((b:netrw_curdir !~ '\<\a\{3,}://')? "does not match" : "matches")." url pattern") + if b:netrw_curdir !~ '\<\a\{3,}://' + let curdir= b:netrw_curdir +" call Decho("g:netrw_keepdir=".g:netrw_keepdir) + if g:netrw_keepdir == 0 + call s:NetrwLcd(curdir) + endif + endif + +" call Dret("s:NetrwGetCurdir <".curdir.">") + return b:netrw_curdir +endfun + +" --------------------------------------------------------------------- " s:NetrwOpenFile: query user for a filename and open it {{{2 fun! s:NetrwOpenFile(islocal) " call Dfunc("s:NetrwOpenFile(islocal=".a:islocal.")") @@ -7477,7 +7624,10 @@ fun! s:NetrwOpenFile(islocal) if exists("g:netrw_quiet") let netrw_quiet_keep = g:netrw_quiet endif - let g:netrw_quiet = 1 + let g:netrw_quiet = 1 + " save position for benefit of Rexplore + let s:rexposn_{bufnr("%")}= netrw#SavePosn() +" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>")) if b:netrw_curdir =~ '/$' exe "NetrwKeepj e ".fnameescape(b:netrw_curdir.fname) else @@ -7497,14 +7647,84 @@ fun! s:NetrwOpenFile(islocal) endfun " --------------------------------------------------------------------- -" s:NetrwUnmarkList: delete local marked file lists and remove their contents from the global marked-file list {{{2 -" User access provided by the <mu> mapping. (see :help netrw-mu) +" netrw#Shrink: shrinks/expands a netrw or Lexplorer window {{{2 +" For the mapping to this function be made via +" netrwPlugin, you'll need to have had +" g:netrw_usetab set to non-zero. +fun! netrw#Shrink() +" call Dfunc("netrw#Shrink() ft<".&ft."> winwidth=".winwidth(0)." lexbuf#".((exists("t:netrw_lexbufnr"))? t:netrw_lexbufnr : 'n/a')) + let curwin = winnr() + let wiwkeep = &wiw + set wiw=1 + + if &ft == "netrw" + if winwidth(0) > g:netrw_wiw + let t:netrw_winwidth= winwidth(0) + exe "vert resize ".g:netrw_wiw + wincmd l + if winnr() == curwin + wincmd h + endif +" call Decho("vert resize 0",'~'.expand("<slnum>")) + else + exe "vert resize ".t:netrw_winwidth +" call Decho("vert resize ".t:netrw_winwidth,'~'.expand("<slnum>")) + endif + + elseif exists("t:netrw_lexbufnr") + exe bufwinnr(t:netrw_lexbufnr)."wincmd w" + if winwidth(bufwinnr(t:netrw_lexbufnr)) > g:netrw_wiw + let t:netrw_winwidth= winwidth(0) + exe "vert resize ".g:netrw_wiw + wincmd l + if winnr() == curwin + wincmd h + endif +" call Decho("vert resize 0",'~'.expand("<slnum>")) + elseif winwidth(bufwinnr(t:netrw_lexbufnr)) >= 0 + exe "vert resize ".t:netrw_winwidth +" call Decho("vert resize ".t:netrw_winwidth,'~'.expand("<slnum>")) + else + call netrw#Lexplore(0,0) + endif + + else + call netrw#Lexplore(0,0) + endif + let wiw= wiwkeep + +" call Dret("netrw#Shrink") +endfun + +" --------------------------------------------------------------------- +" s:NetSortSequence: allows user to edit the sorting sequence {{{2 +fun! s:NetSortSequence(islocal) +" call Dfunc("NetSortSequence(islocal=".a:islocal.")") + + let ykeep= @@ + let svpos= netrw#SavePosn() + call inputsave() + let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) + call inputrestore() + + " refresh the listing + let g:netrw_sort_sequence= newsortseq + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) + let @@= ykeep + +" call Dret("NetSortSequence") +endfun + +" --------------------------------------------------------------------- +" s:NetrwUnmarkList: delete local marked file list and remove their contents from the global marked-file list {{{2 +" User access provided by the <mF> mapping. (see :help netrw-mF) " Used by many MarkFile functions. fun! s:NetrwUnmarkList(curbufnr,curdir) " call Dfunc("s:NetrwUnmarkList(curbufnr=".a:curbufnr." curdir<".a:curdir.">)") " remove all files in local marked-file list from global list - if exists("s:netrwmarkfilelist_{a:curbufnr}") + if exists("s:netrwmarkfilelist") for mfile in s:netrwmarkfilelist_{a:curbufnr} let dfile = s:ComposePath(a:curdir,mfile) " prepend directory to mfile let idx = index(s:netrwmarkfilelist,dfile) " get index in list of dfile @@ -7513,7 +7733,7 @@ fun! s:NetrwUnmarkList(curbufnr,curdir) if s:netrwmarkfilelist == [] unlet s:netrwmarkfilelist endif - + " getting rid of the local marked-file lists is easy unlet s:netrwmarkfilelist_{a:curbufnr} endif @@ -7544,7 +7764,7 @@ fun! s:NetrwUnmarkAll2() let redir END let netrwmarkfilelist_list= split(netrwmarkfilelist_let,'\n') " convert let string into a let list - call filter(netrwmarkfilelist_list,"v:val =~ '^s:netrwmarkfilelist_'") " retain only those vars that start as s:netrwmarkfilelist_ + call filter(netrwmarkfilelist_list,"v:val =~ '^s:netrwmarkfilelist_'") " retain only those vars that start as s:netrwmarkfilelist_ call map(netrwmarkfilelist_list,"substitute(v:val,'\\s.*$','','')") " remove what the entries are equal to for flist in netrwmarkfilelist_list let curbufnr= substitute(flist,'s:netrwmarkfilelist_','','') @@ -7555,22 +7775,36 @@ fun! s:NetrwUnmarkAll2() endfun " --------------------------------------------------------------------- -" s:NetrwUnMarkFile: {{{2 +" s:NetrwUnMarkFile: called via mu map; unmarks *all* marked files, both global and buffer-local {{{2 +" +" Marked files are in two types of lists: +" s:netrwmarkfilelist -- holds complete paths to all marked files +" s:netrwmarkfilelist_# -- holds list of marked files in current-buffer's directory (#==bufnr()) +" +" Marked files suitable for use with 2match are in: +" s:netrwmarkfilemtch_# -- used with 2match to display marked files fun! s:NetrwUnMarkFile(islocal) " call Dfunc("s:NetrwUnMarkFile(islocal=".a:islocal.")") let svpos = netrw#SavePosn() let curbufnr = bufnr("%") - " unmark marked file list (although I expect s:NetrwUpload() - " to do it, I'm just making sure) - if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("unlet'ing: s:netrwmarkfile[list|mtch]_".bufnr("%")) + " unmark marked file list + " (although I expect s:NetrwUpload() to do it, I'm just making sure) + if exists("s:netrwmarkfilelist") +" " call Decho("unlet'ing: s:netrwmarkfilelist",'~'.expand("<slnum>")) unlet s:netrwmarkfilelist - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - 2match none endif + let ibuf= 1 + while ibuf < bufnr("$") + if exists("s:netrwmarkfilelist_".ibuf) + unlet s:netrwmarkfilelist_{ibuf} + unlet s:netrwmarkfilemtch_{ibuf} + endif + let ibuf = ibuf + 1 + endwhile + 2match none + " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) call netrw#RestorePosn(svpos) " call Dret("s:NetrwUnMarkFile") @@ -7588,7 +7822,7 @@ fun! s:NetrwMenu(domenu) " call Dfunc("NetrwMenu(domenu=".a:domenu.")") if !exists("s:netrw_menu_enabled") && a:domenu -" call Decho("initialize menu") +" call Decho("initialize menu",'~'.expand("<slnum>")) let s:netrw_menu_enabled= 1 exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>' exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :' @@ -7654,6 +7888,7 @@ fun! s:NetrwMenu(domenu) exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.1 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Name<tab>s :let g:netrw_sort_by="name"<cr><c-L>' exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.2 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Time<tab>s :let g:netrw_sort_by="time"<cr><c-L>' exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Size<tab>s :let g:netrw_sort_by="size"<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Exten<tab>s :let g:netrw_sort_by="exten"<cr><c-L>' exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R' exe 'sil! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c c' let s:netrw_menucnt= 28 @@ -7667,9 +7902,9 @@ fun! s:NetrwMenu(domenu) exe curwin."wincmd w" if s:netrwcnt <= 1 -" call Decho("clear menus") +" call Decho("clear menus",'~'.expand("<slnum>")) exe 'sil! unmenu '.g:NetrwTopLvlMenu -" call Decho('exe sil! unmenu '.g:NetrwTopLvlMenu.'*') +" call Decho('exe sil! unmenu '.g:NetrwTopLvlMenu.'*','~'.expand("<slnum>")) sil! unlet s:netrw_menu_enabled endif endif @@ -7687,7 +7922,7 @@ fun! s:NetrwObtain(islocal) let ykeep= @@ if exists("s:netrwmarkfilelist_{bufnr('%')}") - let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://' + let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\{3,}://' call netrw#Obtain(islocal,s:netrwmarkfilelist_{bufnr('%')}) call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir) else @@ -7720,32 +7955,32 @@ fun! s:NetrwPrevWinOpen(islocal) let choice = 0 let s:treedir = s:NetrwTreeDir(a:islocal) let curdir = s:treedir -" call Decho("winnr($)#".lastwinnr." curword<".curword.">") +" call Decho("winnr($)#".lastwinnr." curword<".curword.">",'~'.expand("<slnum>")) let didsplit = 0 if lastwinnr == 1 " if only one window, open a new one first -" call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")") +" call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")",'~'.expand("<slnum>")) if g:netrw_preview " vertically split preview window let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize -" call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s",'~'.expand("<slnum>")) exe (g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s" else " horizontally split preview window let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("<slnum>")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" endif let didsplit = 1 -" call Decho("did split") +" call Decho("did split",'~'.expand("<slnum>")) else NetrwKeepj call s:SaveBufVars() let eikeep= &ei setl ei=all wincmd p -" call Decho("wincmd p (now in win#".winnr().") curdir<".curdir.">") +" call Decho("wincmd p (now in win#".winnr().") curdir<".curdir.">",'~'.expand("<slnum>")) " prevwinnr: the window number of the "prev" window " prevbufnr: the buffer number of the buffer in the "prev" window @@ -7756,22 +7991,22 @@ fun! s:NetrwPrevWinOpen(islocal) let prevmod = &mod let bnrcnt = 0 NetrwKeepj call s:RestoreBufVars() -" call Decho("after wincmd p: win#".winnr()." win($)#".winnr("$")." origwin#".origwin." &mod=".&mod." bufname(%)<".bufname("%")."> prevbufnr=".prevbufnr) +" call Decho("after wincmd p: win#".winnr()." win($)#".winnr("$")." origwin#".origwin." &mod=".&mod." bufname(%)<".bufname("%")."> prevbufnr=".prevbufnr,'~'.expand("<slnum>")) " if the previous window's buffer has been changed (ie. its modified flag is set), " and it doesn't appear in any other extant window, then ask the " user if s/he wants to abandon modifications therein. if prevmod -" call Decho("detected that prev window's buffer has been modified: prevbufnr=".prevbufnr." winnr()#".winnr()) +" call Decho("detected that prev window's buffer has been modified: prevbufnr=".prevbufnr." winnr()#".winnr(),'~'.expand("<slnum>")) windo if winbufnr(0) == prevbufnr | let bnrcnt=bnrcnt+1 | endif -" call Decho("prevbufnr=".prevbufnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr()=".winnr()." prevwinnr#".prevwinnr) +" call Decho("prevbufnr=".prevbufnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr()=".winnr()." prevwinnr#".prevwinnr,'~'.expand("<slnum>")) exe prevwinnr."wincmd w" if bnrcnt == 1 && &hidden == 0 " only one copy of the modified buffer in a window, and " hidden not set, so overwriting will lose the modified file. Ask first... let choice = confirm("Save modified buffer<".prevbufname."> first?","&Yes\n&No\n&Cancel") -" call Decho("(NetrwPrevWinOpen) prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr()) +" call Decho("(NetrwPrevWinOpen) prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr(),'~'.expand("<slnum>")) let &ei= eikeep if choice == 1 @@ -7779,7 +8014,7 @@ fun! s:NetrwPrevWinOpen(islocal) let v:errmsg= "" sil w if v:errmsg != "" - call netrw#ErrorMsg(s:ERROR,"unable to write <".prevbufname.">!",30) + call netrw#ErrorMsg(s:ERROR,"unable to write <".(exists("prevbufname")? prevbufname : 'n/a').">!",30) exe origwin."wincmd w" let &ei = eikeep let @@ = ykeep @@ -7789,12 +8024,12 @@ fun! s:NetrwPrevWinOpen(islocal) elseif choice == 2 " No -- don't worry about changed file, just browse anyway -" call Decho("don't worry about chgd file, just browse anyway (winnr($)#".winnr("$").")") +" call Decho("don't worry about chgd file, just browse anyway (winnr($)#".winnr("$").")",'~'.expand("<slnum>")) echomsg "**note** changes to ".prevbufname." abandoned" else " Cancel -- don't do this -" call Decho("cancel, don't browse, switch to win#".origwin) +" call Decho("cancel, don't browse, switch to win#".origwin,'~'.expand("<slnum>")) exe origwin."wincmd w" let &ei= eikeep let @@ = ykeep @@ -7828,46 +8063,46 @@ endfun fun! s:NetrwUpload(fname,tgt,...) " call Dfunc("s:NetrwUpload(fname<".((type(a:fname) == 1)? a:fname : string(a:fname))."> tgt<".a:tgt.">) a:0=".a:0) - if a:tgt =~ '^\a\+://' - let tgtdir= substitute(a:tgt,'^\a\+://[^/]\+/\(.\{-}\)$','\1','') + if a:tgt =~ '^\a\{3,}://' + let tgtdir= substitute(a:tgt,'^\a\{3,}://[^/]\+/\(.\{-}\)$','\1','') else let tgtdir= substitute(a:tgt,'^\(.*\)/[^/]*$','\1','') endif -" call Decho("tgtdir<".tgtdir.">") +" call Decho("tgtdir<".tgtdir.">",'~'.expand("<slnum>")) if a:0 > 0 let fromdir= a:1 else let fromdir= getcwd() endif -" call Decho("fromdir<".fromdir.">") +" call Decho("fromdir<".fromdir.">",'~'.expand("<slnum>")) if type(a:fname) == 1 " handle uploading a single file using NetWrite -" call Decho("handle uploading a single file via NetWrite") +" call Decho("handle uploading a single file via NetWrite",'~'.expand("<slnum>")) 1split -" call Decho("exe e ".fnameescape(a:fname)) - exe "NetrwKeepj e ".fnameescape(a:fname) -" call Decho("now locally editing<".expand("%").">, has ".line("$")." lines") +" call Decho("exe e ".fnameescape(s:NetrwFile(a:fname)),'~'.expand("<slnum>")) + exe "NetrwKeepj e ".fnameescape(s:NetrwFile(a:fname)) +" call Decho("now locally editing<".expand("%").">, has ".line("$")." lines",'~'.expand("<slnum>")) if a:tgt =~ '/$' let wfname= substitute(a:fname,'^.*/','','') -" call Decho("exe w! ".fnameescape(wfname)) +" call Decho("exe w! ".fnameescape(wfname),'~'.expand("<slnum>")) exe "w! ".fnameescape(a:tgt.wfname) else -" call Decho("writing local->remote: exe w ".fnameescape(a:tgt)) +" call Decho("writing local->remote: exe w ".fnameescape(a:tgt),'~'.expand("<slnum>")) exe "w ".fnameescape(a:tgt) -" call Decho("done writing local->remote") +" call Decho("done writing local->remote",'~'.expand("<slnum>")) endif q! elseif type(a:fname) == 3 " handle uploading a list of files via scp -" call Decho("handle uploading a list of files via scp") +" call Decho("handle uploading a list of files via scp",'~'.expand("<slnum>")) let curdir= getcwd() if a:tgt =~ '^scp:' call s:NetrwLcd(fromdir) let filelist= deepcopy(s:netrwmarkfilelist_{bufnr('%')}) - let args = join(map(filelist,"shellescape(v:val, 1)")) + let args = join(map(filelist,"s:ShellEscape(v:val, 1)")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else @@ -7875,7 +8110,7 @@ fun! s:NetrwUpload(fname,tgt,...) endif let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','') let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','') - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".args." ".s:ShellEscape(machine.":".tgt,1)) call s:NetrwLcd(curdir) elseif a:tgt =~ '^ftp:' @@ -7885,35 +8120,35 @@ fun! s:NetrwUpload(fname,tgt,...) " handle uploading a list of files via ftp+.netrc let netrw_fname = b:netrw_fname sil NetrwKeepj new -" call Decho("filter input window#".winnr()) +" call Decho("filter input window#".winnr(),'~'.expand("<slnum>")) NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if tgtdir == "" let tgtdir= '/' endif NetrwKeepj call setline(line("$")+1,'cd "'.tgtdir.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) for fname in a:fname - NetrwKeepj call setline(line("$")+1,'put "'.fname.'"') -" call Decho("filter input: ".getline('$')) + NetrwKeepj call setline(line("$")+1,'put "'.s:NetrwFile(fname).'"') +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endfor if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else -" call Decho("filter input window#".winnr()) - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) +" call Decho("filter input window#".winnr(),'~'.expand("<slnum>")) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) sil NetrwKeepj g/Local directory now/d @@ -7933,42 +8168,42 @@ fun! s:NetrwUpload(fname,tgt,...) if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) else NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("s:netrw_passwd") NetrwKeepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') endif -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) elseif exists("s:netrw_passwd") NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif endif NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) if exists("b:netrw_fname") && b:netrw_fname != "" NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endif for fname in a:fname NetrwKeepj call setline(line("$")+1,'put "'.fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("<slnum>")) endfor " perform ftp: @@ -8009,7 +8244,7 @@ fun! s:NetrwPreview(path) range NetrwKeepj call s:NetrwOptionSave("s:") NetrwKeepj call s:NetrwSafeOptions() if has("quickfix") - if !isdirectory(a:path) + if !isdirectory(s:NetrwFile(a:path)) if g:netrw_preview && !g:netrw_alto let pvhkeep = &pvh let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize @@ -8036,15 +8271,16 @@ fun! s:NetrwRefresh(islocal,dirname) " call Dfunc("s: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. setl ma noro -" call Decho("setl ma noro") -" call Decho("clear buffer<".expand("%")."> with :%d") +" call Decho("setl ma noro",'~'.expand("<slnum>")) +" call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) let ykeep = @@ " save the cursor position before refresh. let screenposn = netrw#SavePosn() -" call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">") -" call Decho("clearing buffer prior to refresh") - sil! NetrwKeepj %d + +" call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">",'~'.expand("<slnum>")) +" call Decho("clearing buffer prior to refresh",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ if a:islocal NetrwKeepj call netrw#LocalBrowseCheck(a:dirname) else @@ -8056,10 +8292,10 @@ fun! s:NetrwRefresh(islocal,dirname) " restore file marks if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/") +" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("<slnum>")) exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" else -" call Decho("2match none") +" call Decho("2match none (bufnr(%)=".bufnr("%")."<".bufname("%").">)",'~'.expand("<slnum>")) 2match none endif @@ -8076,26 +8312,26 @@ fun! s:NetrwRefreshDir(islocal,dirname) " 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") +" call Decho("slowest mode: keep buffers refreshed, local or remote",'~'.expand("<slnum>")) let tgtwin= bufwinnr(a:dirname) -" call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin) +" call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin,'~'.expand("<slnum>")) if tgtwin > 0 " tgtwin is being displayed, so refresh it let curwin= winnr() -" call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")") +" call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")",'~'.expand("<slnum>")) exe tgtwin."wincmd w" - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) exe curwin."wincmd w" elseif bufnr(a:dirname) > 0 let bn= bufnr(a:dirname) -" call Decho("bd bufnr(".a:dirname.")=".bn) - exe "sil bd ".bn +" call Decho("bd bufnr(".a:dirname.")=".bn,'~'.expand("<slnum>")) + exe "sil keepj bd ".bn endif elseif g:netrw_fastbrowse <= 1 -" call Decho("medium-speed mode: refresh local buffers only") +" call Decho("medium-speed mode: refresh local buffers only",'~'.expand("<slnum>")) NetrwKeepj call s:LocalBrowseRefresh() endif " call Dret("s:NetrwRefreshDir") @@ -8109,7 +8345,7 @@ endfun fun! s:NetrwSetChgwin(...) " call Dfunc("s:NetrwSetChgwin() v:count=".v:count) if a:0 > 0 -" call Decho("a:1<".a:1.">") +" call Decho("a:1<".a:1.">",'~'.expand("<slnum>")) if a:1 == "" " :NetrwC win# let g:netrw_chgwin= winnr() else " :NetrwC @@ -8120,6 +8356,7 @@ fun! s:NetrwSetChgwin(...) else " C let g:netrw_chgwin= winnr() endif + echo "editing window now set to window#".g:netrw_chgwin " call Dret("s:NetrwSetChgwin : g:netrw_chgwin=".g:netrw_chgwin) endfun @@ -8159,7 +8396,7 @@ fun! s:NetrwSetSort() else let spriority= priority.g:netrw_sepchr endif -" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">") +" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">",'~'.expand("<slnum>")) " sanity check if w:netrw_bannercnt > line("$") @@ -8235,7 +8472,7 @@ fun! s:NetrwSortStyle(islocal) NetrwKeepj call s:NetrwSaveWordPosn() let svpos= netrw#SavePosn() - let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name' + let g:netrw_sort_by= (g:netrw_sort_by =~ '^n')? 'time' : (g:netrw_sort_by =~ '^t')? 'size' : (g:netrw_sort_by =~ '^siz')? 'exten' : 'name' NetrwKeepj norm! 0 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) NetrwKeepj call netrw#RestorePosn(svpos) @@ -8261,7 +8498,7 @@ fun! s:NetrwSplit(mode) " remote and o let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("<slnum>")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8271,7 +8508,7 @@ fun! s:NetrwSplit(mode) elseif a:mode == 1 " remote and t let newdir = s:NetrwBrowseChgDir(0,s:NetrwGetWord()) -" call Decho("tabnew") +" call Decho("tabnew",'~'.expand("<slnum>")) tabnew let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8282,7 +8519,7 @@ fun! s:NetrwSplit(mode) " remote and v let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") +" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("<slnum>")) exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8293,7 +8530,7 @@ fun! s:NetrwSplit(mode) " local and o let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("<slnum>")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8312,9 +8549,9 @@ fun! s:NetrwSplit(mode) setl ei=all exe "NetrwKeepj norm! ".netrw_hline."G0z\<CR>" exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\<bar>" - let &ei= eikeep - let netrw_curdir= s:NetrwTreeDir(0) -" call Decho("tabnew") + let &ei = eikeep + let netrw_curdir = s:NetrwTreeDir(0) +" call Decho("tabnew",'~'.expand("<slnum>")) tabnew let b:netrw_curdir = netrw_curdir let s:didsplit = 1 @@ -8332,7 +8569,7 @@ fun! s:NetrwSplit(mode) " local and v let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") +" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("<slnum>")) exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8359,21 +8596,29 @@ fun! s:NetrwTgtMenu() " the following test assures that gvim is running, has menus available, and has menus enabled. if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu if exists("g:NetrwTopLvlMenu") -" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") +" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("<slnum>")) exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Targets' endif if !exists("s:netrw_initbookhist") call s:NetrwBookHistRead() endif + " try to cull duplicate entries + let tgtdict={} + " target bookmarked places if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 -" call Decho("installing bookmarks as easy targets") +" call Decho("installing bookmarks as easy targets",'~'.expand("<slnum>")) let cnt= 1 for bmd in g:netrw_bookmarklist + if has_key(tgtdict,bmd) + let cnt= cnt + 1 + continue + endif + let tgtdict[bmd]= cnt let ebmd= escape(bmd,g:netrw_menu_escape) " show bookmarks for goto menu -" call Decho("menu: Targets: ".bmd) +" call Decho("menu: Targets: ".bmd,'~'.expand("<slnum>")) exe 'sil! menu <silent> '.g:NetrwMenuPriority.".19.1.".cnt." ".g:NetrwTopLvlMenu.'Targets.'.ebmd." :call netrw#MakeTgt('".bmd."')\<cr>" let cnt= cnt + 1 endfor @@ -8381,14 +8626,19 @@ fun! s:NetrwTgtMenu() " target directory browsing history if exists("g:netrw_dirhistmax") && g:netrw_dirhistmax > 0 -" call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")") +" call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")",'~'.expand("<slnum>")) let histcnt = 1 while histcnt <= g:netrw_dirhistmax let priority = g:netrw_dirhist_cnt + histcnt if exists("g:netrw_dirhist_{histcnt}") let histentry = g:netrw_dirhist_{histcnt} - let ehistentry = escape(histentry,g:netrw_menu_escape) -" call Decho("menu: Targets: ".histentry) + if has_key(tgtdict,histentry) + let histcnt = histcnt + 1 + continue + endif + let tgtdict[histentry] = histcnt + let ehistentry = escape(histentry,g:netrw_menu_escape) +" call Decho("menu: Targets: ".histentry,'~'.expand("<slnum>")) exe 'sil! menu <silent> '.g:NetrwMenuPriority.".19.2.".priority." ".g:NetrwTopLvlMenu.'Targets.'.ehistentry." :call netrw#MakeTgt('".histentry."')\<cr>" endif let histcnt = histcnt + 1 @@ -8411,63 +8661,72 @@ fun! s:NetrwTreeDir(islocal) " call Dret("s:NetrwTreeDir ".treedir) return treedir endif + if !exists("b:netrw_curdir") || b:netrw_curdir == "" let b:netrw_curdir= getcwd() endif + let treedir = b:netrw_curdir -" call Decho("set initial treedir<".treedir.">") +" call Decho("set initial treedir<".treedir.">",'~'.expand("<slnum>")) let s:treecurpos= netrw#SavePosn() if w:netrw_liststyle == s:TREELIST -" call Decho("w:netrw_liststyle is TREELIST:") -" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") +" call Decho("w:netrw_liststyle is TREELIST:",'~'.expand("<slnum>")) +" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>")) " extract tree directory if on a line specifying a subdirectory (ie. ends with "/") let curline= substitute(getline('.'),"\t -->.*$",'','') if curline =~ '/$' -" call Decho("extract tree subdirectory from current line") +" call Decho("extract tree subdirectory from current line",'~'.expand("<slnum>")) let treedir= substitute(getline('.'),'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') -" call Decho("treedir<".treedir.">") +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) + elseif curline =~ '@$' +" call Decho("handle symbolic link from current line",'~'.expand("<slnum>")) + let treedir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e')) +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) else -" call Decho("do not extract tree subdirectory from current line and set treedir to empty") +" call Decho("do not extract tree subdirectory from current line and set treedir to empty",'~'.expand("<slnum>")) let treedir= "" endif " detect user attempting to close treeroot -" call Decho("check if user is attempting to close treeroot") -" call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") -" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~ '^'.s:treedepthstring)? '=~' : '!~').' ^'.s:treedepthstring) +" call Decho("check if user is attempting to close treeroot",'~'.expand("<slnum>")) +" call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) +" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~ '^'.s:treedepthstring)? '=~' : '!~').' ^'.s:treedepthstring,'~'.expand("<slnum>")) if curline !~ '^'.s:treedepthstring && getline('.') != '..' -" call Decho(".user may have attempted to close treeroot") +" call Decho(".user may have attempted to close treeroot",'~'.expand("<slnum>")) " now force a refresh -" call Decho(".force refresh: clear buffer<".expand("%")."> with :%d") - sil! NetrwKeepj %d -" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") +" call Decho(".force refresh: clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ +" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">") return b:netrw_curdir " else " Decho -" call Decho(".user did not attempt to close treeroot") +" call Decho(".user did not attempt to close treeroot",'~'.expand("<slnum>")) endif -" call Decho("islocal=".a:islocal." curline<".curline.">") -" call Decho("after subst<".substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)$','\1','').">") +" call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("<slnum>")) +" call Decho("after subst<".substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)$','\1','').">",'~'.expand("<slnum>")) let potentialdir= substitute(curline,'^'.s:treedepthstring.'* \(.*\)@$','\1','') -" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir)) - - if a:islocal && curline =~ '@$' && isdirectory(potentialdir) - let newdir = w:netrw_treetop.'/'.potentialdir - let treedir = s:NetrwTreePath(newdir) - let w:netrw_treetop = newdir -" call Decho("newdir <".newdir.">") - else +" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(s:NetrwFile(potentialdir)),'~'.expand("<slnum>")) + + " COMBAK: a symbolic link may point anywhere -- so it will be used to start a new treetop +" if a:islocal && curline =~ '@$' && isdirectory(s:NetrwFile(potentialdir)) +" let newdir = w:netrw_treetop.'/'.potentialdir +" " call Decho("apply NetrwTreePath to newdir<".newdir.">",'~'.expand("<slnum>")) +" let treedir = s:NetrwTreePath(newdir) +" let w:netrw_treetop = newdir +" " call Decho("newdir <".newdir.">",'~'.expand("<slnum>")) +" else +" call Decho("apply NetrwTreePath to treetop<".w:netrw_treetop.">",'~'.expand("<slnum>")) let treedir = s:NetrwTreePath(w:netrw_treetop) - endif +" endif endif " sanity maintenance: keep those //s away... let treedir= substitute(treedir,'//$','/','') -" call Decho("treedir<".treedir.">") +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) -" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") +" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">") return treedir endfun @@ -8482,9 +8741,9 @@ fun! s:NetrwTreeDisplay(dir,depth) " install ../ and shortdir if a:depth == "" call setline(line("$")+1,'../') -" call Decho("setline#".line("$")." ../ (depth is zero)") +" call Decho("setline#".line("$")." ../ (depth is zero)",'~'.expand("<slnum>")) endif - if a:dir =~ '^\a\+://' + if a:dir =~ '^\a\{3,}://' if a:dir == w:netrw_treetop let shortdir= a:dir else @@ -8495,29 +8754,30 @@ fun! s:NetrwTreeDisplay(dir,depth) let shortdir= substitute(a:dir,'^.*/','','e') call setline(line("$")+1,a:depth.shortdir.'/') endif -" call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">") +" call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">",'~'.expand("<slnum>")) " append a / to dir if its missing one let dir= a:dir - if dir !~ '/$' - let dir= dir.'/' - endif " display subtrees (if any) let depth= s:treedepthstring.a:depth +" call Decho("display subtrees with depth<".depth."> and current leaves",'~'.expand("<slnum>")) -" call Decho("display subtrees with depth<".depth."> and current leaves") - for entry in w:netrw_treedict[a:dir] - let direntry= substitute(dir.entry,'/$','','e') -" call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">") +" call Decho("w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("<slnum>")) + for entry in w:netrw_treedict[dir] + let direntry= substitute(dir.'/'.entry,'[@/]$','','e') +" call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("<slnum>")) if entry =~ '/$' && has_key(w:netrw_treedict,direntry) -" call Decho("<".direntry."> is a key in treedict - display subtree for it") +" call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwTreeDisplay(direntry,depth) elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') -" call Decho("<".direntry."/> is a key in treedict - display subtree for it") +" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth) + elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@') +" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth) else -" call Decho("<".entry."> is not a key in treedict (no subtree)") +" call Decho("<".entry."> is not a key in treedict (no subtree)",'~'.expand("<slnum>")) sil! NetrwKeepj call setline(line("$")+1,depth.entry) endif endfor @@ -8527,34 +8787,36 @@ endfun " --------------------------------------------------------------------- " s:NetrwTreeListing: displays tree listing from treetop on down, using NetrwTreeDisplay() {{{2 +" Called by s:PerformListing() fun! s:NetrwTreeListing(dirname) if w:netrw_liststyle == s:TREELIST " call Dfunc("NetrwTreeListing() bufname<".expand("%").">") -" call Decho("curdir<".a:dirname.">") -" call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit")) -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("curdir<".a:dirname.">",'~'.expand("<slnum>")) +" call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit"),'~'.expand("<slnum>")) +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) " update the treetop -" call Decho("update the treetop") +" call Decho("update the treetop",'~'.expand("<slnum>")) if !exists("w:netrw_treetop") let w:netrw_treetop= a:dirname -" call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)") +" call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)",'~'.expand("<slnum>")) elseif (w:netrw_treetop =~ ('^'.a:dirname) && s:Strlen(a:dirname) < s:Strlen(w:netrw_treetop)) || a:dirname !~ ('^'.w:netrw_treetop) let w:netrw_treetop= a:dirname -" call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)") +" call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)",'~'.expand("<slnum>")) endif - " insure that we have at least an empty treedict if !exists("w:netrw_treedict") + " insure that we have a treedict, albeit empty +" call Decho("initializing w:netrw_treedict to empty",'~'.expand("<slnum>")) let w:netrw_treedict= {} endif " update the directory listing for the current directory -" call Decho("updating dictionary with ".a:dirname.":[..directory listing..]") -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$")) +" call Decho("updating dictionary with ".a:dirname.":[..directory listing..]",'~'.expand("<slnum>")) +" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("<slnum>")) exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d' let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$")) -" call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname])) +" call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname]),'~'.expand("<slnum>")) exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d" " if past banner, record word @@ -8563,16 +8825,16 @@ fun! s:NetrwTreeListing(dirname) else let fname= "" endif -" call Decho("fname<".fname.">") -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) " display from treetop on down NetrwKeepj call s:NetrwTreeDisplay(w:netrw_treetop,"") -" call Decho("s:NetrwTreeDisplay) setl noma nomod ro") +" call Decho("s:NetrwTreeDisplay) setl noma nomod ro",'~'.expand("<slnum>")) " remove any blank line remaining as line#1 (happens in treelisting mode with banner suppressed) while getline(1) =~ '^\s*$' && byte2line(1) > 0 -" call Decho("deleting blank line") +" call Decho("deleting blank line",'~'.expand("<slnum>")) 1d endwhile @@ -8591,25 +8853,32 @@ endfun fun! s:NetrwTreePath(treetop) " call Dfunc("s:NetrwTreePath() line#".line(".")."<".getline(".").">") let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') -" call Decho("(s:NetrwTreePath) depth<".depth."> 1st subst") +" call Decho("depth<".depth."> 1st subst",'~'.expand("<slnum>")) let depth = substitute(depth,'^'.s:treedepthstring,'','') -" call Decho("(s:NetrwTreePath) depth<".depth."> 2nd subst (first depth removed)") - if getline('.') =~ '/$' -" call Decho("extract tree directory from current line") - let treedir= substitute(getline('.'),'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') -" call Decho("(s:NetrwTreePath) treedir<".treedir.">") +" call Decho("depth<".depth."> 2nd subst (first depth removed)",'~'.expand("<slnum>")) + let curline= getline('.') +" call Decho("curline<".curline.'>','~'.expand("<slnum>")) + if curline =~ '/$' +" call Decho("extract tree directory from current line",'~'.expand("<slnum>")) + let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) + elseif curline =~ '@\s\+-->' +" call Decho("extract tree directory using symbolic link",'~'.expand("<slnum>")) + let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') + let treedir= substitute(treedir,'@\s\+-->.*$','','e') +" call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) else -" call Decho("(s:NetrwTreePath) do not extract tree directory from current line and set treedir to empty") +" call Decho("do not extract tree directory from current line and set treedir to empty",'~'.expand("<slnum>")) let treedir= "" endif " construct treedir by searching backwards at correct depth -" call Decho("(s:NetrwTreePath) construct treedir by searching backwards for correct depth") -" call Decho("(s:NetrwTreePath) initial treedir<".treedir."> depth<".depth.">") +" call Decho("construct treedir by searching backwards for correct depth",'~'.expand("<slnum>")) +" call Decho("initial treedir<".treedir."> depth<".depth.">",'~'.expand("<slnum>")) while depth != "" && search('^'.depth.'[^'.s:treedepthstring.'].\{-}/$','bW') let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') let treedir= dirname.treedir let depth = substitute(depth,'^'.s:treedepthstring,'','') -" call Decho("(s:NetrwTreePath) constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">") +" call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">",'~'.expand("<slnum>")) endwhile if a:treetop =~ '/$' let treedir= a:treetop.treedir @@ -8632,7 +8901,7 @@ fun! s:NetrwWideListing() " fpl: filenames per line " fpc: filenames per column setl ma noro -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("<slnum>")) let b:netrw_cpf= 0 if line("$") >= w:netrw_bannercnt exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' @@ -8642,22 +8911,23 @@ fun! s:NetrwWideListing() return endif let b:netrw_cpf= b:netrw_cpf + 2 -" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf) +" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("<slnum>")) " determine qty files per line (fpl) let w:netrw_fpl= winwidth(0)/b:netrw_cpf if w:netrw_fpl <= 0 let w:netrw_fpl= 1 endif -" call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl) +" call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl,'~'.expand("<slnum>")) " make wide display - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/' + " fpc: files per column of wide listing + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'S",submatch(0)),"\\")/' NetrwKeepj call histdel("/",-1) let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl let newcolstart = w:netrw_bannercnt + fpc let newcolend = newcolstart + fpc - 1 -" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]") +" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("<slnum>")) if has("clipboard") sil! let keepregstar = @* endif @@ -8680,9 +8950,9 @@ fun! s:NetrwWideListing() NetrwKeepj call histdel("/",-1) exe 'nno <buffer> <silent> w :call search(''^.\\|\s\s\zs\S'',''W'')'."\<cr>" exe 'nno <buffer> <silent> b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\<cr>" -" call Decho("NetrwWideListing) setl noma nomod ro") +" call Decho("NetrwWideListing) setl noma nomod ro",'~'.expand("<slnum>")) exe "setl ".g:netrw_bufsettings -" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("NetrwWideListing") return else @@ -8699,26 +8969,27 @@ endfun " --------------------------------------------------------------------- " s:PerformListing: {{{2 fun! s:PerformListing(islocal) -" call Dfunc("s:PerformListing(islocal=".a:islocal.") bufnr(%)=".bufnr("%")."<".bufname("%").">") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)") +" call Dfunc("s:PerformListing(islocal=".a:islocal.")") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) +" call Decho("settings: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)",'~'.expand("<slnum>")) " set up syntax highlighting {{{3 -" call Decho("set up syntax highlighting (ie. setl ft=netrw)") +" call Decho("--set up syntax highlighting (ie. setl ft=netrw)",'~'.expand("<slnum>")) sil! setl ft=netrw NetrwKeepj call s:NetrwSafeOptions() setl noro ma -" call Decho("setl noro ma bh=".&bh) +" call Decho("setl noro ma bh=".&bh,'~'.expand("<slnum>")) " if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho -" call Decho("(netrw) Processing your browsing request...") +" call Decho("(netrw) Processing your browsing request...",'~'.expand("<slnum>")) " endif " Decho -" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) +" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh for tree listings -" call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d") - sil! NetrwKeepj %d +" call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + sil! NetrwKeepj %d _ endif " save current directory on directory history list @@ -8726,21 +8997,34 @@ fun! s:PerformListing(islocal) " Set up the banner {{{3 if g:netrw_banner -" call Decho("set up banner") +" call Decho("--set up banner",'~'.expand("<slnum>")) NetrwKeepj call setline(1,'" ============================================================================') - NetrwKeepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') + if exists("g:netrw_pchk") + " this undocumented option allows pchk to run with different versions of netrw without causing spurious + " failure detections. + NetrwKeepj call setline(2,'" Netrw Directory Listing') + else + NetrwKeepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') + endif + if exists("g:netrw_pchk") + let curdir= substitute(b:netrw_curdir,expand("$HOME"),'~','') + else + let curdir= b:netrw_curdir + endif if exists("g:netrw_bannerbackslash") && g:netrw_bannerbackslash - NetrwKeepj call setline(3,'" '.substitute(b:netrw_curdir,'/','\\','g')) + NetrwKeepj call setline(3,'" '.substitute(curdir,'/','\\','g')) else - NetrwKeepj call setline(3,'" '.b:netrw_curdir) + NetrwKeepj call setline(3,'" '.curdir) endif let w:netrw_bannercnt= 3 NetrwKeepj exe "sil! NetrwKeepj ".w:netrw_bannercnt else +" call Decho("--no banner",'~'.expand("<slnum>")) NetrwKeepj 1 let w:netrw_bannercnt= 1 endif -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr()) +" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr(),'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) let sortby= g:netrw_sort_by if g:netrw_sort_direction =~ "^r" @@ -8749,28 +9033,28 @@ fun! s:PerformListing(islocal) " Sorted by... {{{3 if g:netrw_banner -" call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">") +" call Decho("--handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("<slnum>")) if g:netrw_sort_by =~ "^n" -" call Decho("directories will be sorted by name") +" call Decho("directories will be sorted by name",'~'.expand("<slnum>")) " sorted by name NetrwKeepj put ='\" Sorted by '.sortby NetrwKeepj put ='\" Sort sequence: '.g:netrw_sort_sequence let w:netrw_bannercnt= w:netrw_bannercnt + 2 else -" call Decho("directories will be sorted by size or time") +" call Decho("directories will be sorted by size or time",'~'.expand("<slnum>")) " sorted by size or date NetrwKeepj put ='\" Sorted by '.sortby let w:netrw_bannercnt= w:netrw_bannercnt + 1 endif exe "sil! NetrwKeepj ".w:netrw_bannercnt " else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) endif " show copy/move target, if any if g:netrw_banner if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") -" call Decho("show copy/move target<".s:netrwmftgt.">") +" call Decho("--show copy/move target<".s:netrwmftgt.">",'~'.expand("<slnum>")) NetrwKeepj put ='' if s:netrwmftgt_islocal sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') @@ -8779,14 +9063,14 @@ fun! s:PerformListing(islocal) endif let w:netrw_bannercnt= w:netrw_bannercnt + 1 else -" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt") +" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt",'~'.expand("<slnum>")) endif exe "sil! NetrwKeepj ".w:netrw_bannercnt endif " Hiding... -or- Showing... {{{3 if g:netrw_banner -" call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") +" call Decho("--handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)",'~'.expand("<slnum>")) if g:netrw_list_hide != "" && g:netrw_hide if g:netrw_hide == 1 NetrwKeepj put ='\" Hiding: '.g:netrw_list_hide @@ -8797,34 +9081,34 @@ fun! s:PerformListing(islocal) endif exe "NetrwKeepj ".w:netrw_bannercnt -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) let quickhelp = g:netrw_quickhelp%len(s:QuickHelp) -" call Decho("quickhelp =".quickhelp) +" call Decho("quickhelp =".quickhelp,'~'.expand("<slnum>")) NetrwKeepj put ='\" Quick Help: <F1>:help '.s:QuickHelp[quickhelp] -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) NetrwKeepj put ='\" ==============================================================================' let w:netrw_bannercnt= w:netrw_bannercnt + 2 " else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) endif " bannercnt should index the line just after the banner if g:netrw_banner let w:netrw_bannercnt= w:netrw_bannercnt + 1 exe "sil! NetrwKeepj ".w:netrw_bannercnt -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) +" call Decho("--w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"),'~'.expand("<slnum>")) " else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) endif " get list of files -" call Decho("Get list of files - islocal=".a:islocal) +" call Decho("--Get list of files - islocal=".a:islocal,'~'.expand("<slnum>")) if a:islocal NetrwKeepj call s:LocalListing() else " remote NetrwKeepj let badresult= s:NetrwRemoteListing() if badresult -" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") +" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) " call Dret("s:PerformListing : error detected by NetrwRemoteListing") return endif @@ -8834,24 +9118,25 @@ fun! s:PerformListing(islocal) if !exists("w:netrw_bannercnt") let w:netrw_bannercnt= 0 endif -" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("--manipulate directory listing (hide, sort)",'~'.expand("<slnum>")) +" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)",'~'.expand("<slnum>")) +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (hide)") -" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("manipulate directory listing (hide)",'~'.expand("<slnum>")) +" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>")) if g:netrw_hide && g:netrw_list_hide != "" NetrwKeepj call s:NetrwListHide() endif if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">") +" call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("<slnum>")) if g:netrw_sort_by =~ "^n" " sort by name NetrwKeepj call s:NetrwSetSort() if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) if g:netrw_sort_direction =~ 'n' " normal direction sorting exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options @@ -8861,18 +9146,39 @@ fun! s:PerformListing(islocal) endif endif " remove priority pattern prefix -" call Decho("remove priority pattern prefix") +" call Decho("remove priority pattern prefix",'~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' NetrwKeepj call histdel("/",-1) + elseif g:netrw_sort_by =~ "^ext" + " sort by extension + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g+/+s/^/001'.g:netrw_sepchr.'/' + NetrwKeepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+[./]+s/^/002'.g:netrw_sepchr.'/' + NetrwKeepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+['.g:netrw_sepchr.'/]+s/^\(.*\.\)\(.\{-\}\)$/\2'.g:netrw_sepchr.'&/e' + NetrwKeepj call histdel("/",-1) + if !g:netrw_banner || w:netrw_bannercnt < line("$") +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) + if g:netrw_sort_direction =~ 'n' + " normal direction sorting + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options + else + " reverse direction sorting + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options + endif + endif + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^.\{-}'.g:netrw_sepchr.'//e' + NetrwKeepj call histdel("/",-1) + elseif a:islocal if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction) +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction,'~'.expand("<slnum>")) if g:netrw_sort_direction =~ 'n' -" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort') +" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort','~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else -" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!') +" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!','~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options endif exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e' @@ -8881,62 +9187,72 @@ fun! s:PerformListing(islocal) endif elseif g:netrw_sort_direction =~ 'r' -" call Decho('(s:PerformListing) reverse the sorted listing') +" call Decho('(s:PerformListing) reverse the sorted listing','~'.expand("<slnum>")) if !g:netrw_banner || w:netrw_bannercnt < line('$') exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt call histdel("/",-1) endif endif endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) " convert to wide/tree listing {{{3 -" call Decho("modify display if wide/tree listing style") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#1)") +" call Decho("--modify display if wide/tree listing style",'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#1)",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwWideListing() -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#2)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#2)",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwTreeListing(b:netrw_curdir) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)",'~'.expand("<slnum>")) " resolve symbolic links if local and (thin or tree) if a:islocal && (w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:TREELIST) - g/@$/call s:ShowLink() +" call Decho("--resolve symbolic links if local and thin|tree",'~'.expand("<slnum>")) + g/@$/call s:ShowLink() endif - if exists("w:netrw_bannercnt") && (line("$") > w:netrw_bannercnt || !g:netrw_banner) + if exists("w:netrw_bannercnt") && (line("$") >= w:netrw_bannercnt || !g:netrw_banner) " place cursor on the top-left corner of the file listing -" call Decho("place cursor on top-left corner of file listing") - exe 'sil! NetrwKeepj '.w:netrw_bannercnt +" call Decho("--place cursor on top-left corner of file listing",'~'.expand("<slnum>")) + exe 'sil! '.w:netrw_bannercnt sil! NetrwKeepj norm! 0 +" call Decho(" tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) + else +" call Decho("--did NOT place cursor on top-left corner",'~'.expand("<slnum>")) +" call Decho(" w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a'),'~'.expand("<slnum>")) +" call Decho(" line($)=".line("$"),'~'.expand("<slnum>")) +" call Decho(" g:netrw_banner=".(exists("g:netrw_banner")? g:netrw_banner : 'n/a'),'~'.expand("<slnum>")) endif " record previous current directory let w:netrw_prvdir= b:netrw_curdir -" call Decho("record netrw_prvdir<".w:netrw_prvdir.">") +" call Decho("--record netrw_prvdir<".w:netrw_prvdir.">",'~'.expand("<slnum>")) " save certain window-oriented variables into buffer-oriented variables {{{3 -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#4)") +" call Decho("--save some window-oriented variables into buffer oriented variables",'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#4)",'~'.expand("<slnum>")) NetrwKeepj call s:SetBufWinVars() -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwOptionRestore("w:") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)",'~'.expand("<slnum>")) " set display to netrw display settings -" call Decho("set display to netrw display settings (".g:netrw_bufsettings.")") +" call Decho("--set display to netrw display settings (".g:netrw_bufsettings.")",'~'.expand("<slnum>")) exe "setl ".g:netrw_bufsettings -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#7)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#7)",'~'.expand("<slnum>")) if g:netrw_liststyle == s:LONGLIST -" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>")) exe "setl ts=".(g:netrw_maxfilenamelen+1) endif if exists("s:treecurpos") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)") +" call Decho("s:treecurpos exists; restore posn",'~'.expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)",'~'.expand("<slnum>")) NetrwKeepj call netrw#RestorePosn(s:treecurpos) unlet s:treecurpos endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (return)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (return)",'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) " call Dret("s:PerformListing : curpos<".string(getpos(".")).">") endfun @@ -8947,7 +9263,7 @@ fun! s:SetupNetrwStatusLine(statline) if !exists("s:netrw_setup_statline") let s:netrw_setup_statline= 1 -" call Decho("do first-time status line setup") +" call Decho("do first-time status line setup",'~'.expand("<slnum>")) if !exists("s:netrw_users_stl") let s:netrw_users_stl= &stl @@ -8961,7 +9277,7 @@ fun! s:SetupNetrwStatusLine(statline) redir @a try hi User9 - catch /^Vim\%((\a\+)\)\=:E411/ + catch /^Vim\%((\a\{3,})\)\=:E411/ if &bg == "dark" hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue else @@ -8977,7 +9293,7 @@ fun! s:SetupNetrwStatusLine(statline) " make sure statusline is displayed let &stl=a:statline setl laststatus=2 -" call Decho("stl=".&stl) +" call Decho("stl=".&stl,'~'.expand("<slnum>")) redraw " call Dret("SetupNetrwStatusLine : stl=".&stl) @@ -8994,7 +9310,7 @@ endfun " enforced here. fun! s:NetrwRemoteFtpCmd(path,listcmd) " call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) w:netrw_method=".(exists("w:netrw_method")? w:netrw_method : (exists("b:netrw_method")? b:netrw_method : "???"))) -" call Decho("line($)=".line("$")." w:netrw_bannercnt=".w:netrw_bannercnt) +" call Decho("line($)=".line("$")." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) " sanity check: {{{3 if !exists("w:netrw_method") if exists("b:netrw_method") @@ -9009,11 +9325,11 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " WinXX ftp uses unix style input, so set ff to unix " {{{3 let ffkeep= &ff setl ma ff=unix noro -" call Decho("setl ma ff=unix noro") +" call Decho("setl ma ff=unix noro",'~'.expand("<slnum>")) " clear off any older non-banner lines " {{{3 " note that w:netrw_bannercnt indexes the line after the banner -" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d (clear off old non-banner lines)") +" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d (clear off old non-banner lines)",'~'.expand("<slnum>")) exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d" "......................................... @@ -9024,16 +9340,16 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif NetrwKeepj call setline(line("$")+1,a:listcmd) -" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' +" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand("<slnum>"))' if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) +" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1),'~'.expand("<slnum>")) + exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1) else -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) +" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1),'~'.expand("<slnum>")) + exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1) endif "......................................... @@ -9048,7 +9364,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " handle userid and password let host= substitute(g:netrw_machine,'\..*$','','') -" call Decho("host<".host.">") +" call Decho("host<".host.">",'~'.expand("<slnum>")) if exists("s:netrw_hup") && exists("s:netrw_hup[host]") call NetUserPass("ftp:".host) endif @@ -9068,7 +9384,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("<slnum>")) endif NetrwKeepj call setline(line("$")+1,a:listcmd) @@ -9077,11 +9393,11 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password if exists("w:netrw_bannercnt") -" exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' +" exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand("<slnum>"))' call s:NetrwExe(s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " else " Decho -" call Decho("WARNING: w:netrw_bannercnt doesn't exist!") -" g/^./call Decho("SKIPPING ftp#".line(".").": ".getline(".")) +" call Decho("WARNING: w:netrw_bannercnt doesn't exist!",'~'.expand("<slnum>")) +" g/^./call Decho("SKIPPING ftp#".line(".").": ".getline("."),'~'.expand("<slnum>")) endif "......................................... @@ -9148,9 +9464,9 @@ fun! s:NetrwRemoteListing() " sanity check: if exists("b:netrw_method") && b:netrw_method =~ '[235]' -" call Decho("b:netrw_method=".b:netrw_method) +" call Decho("b:netrw_method=".b:netrw_method,'~'.expand("<slnum>")) if !executable("ftp") -" call Decho("ftp is not executable") +" call Decho("ftp is not executable",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ftp",18) endif @@ -9160,7 +9476,7 @@ fun! s:NetrwRemoteListing() endif elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' -" call Decho("g:netrw_list_cmd<",(exists("g:netrw_list_cmd")? 'n/a' : "-empty-").">") +" call Decho("g:netrw_list_cmd<",(exists("g:netrw_list_cmd")? 'n/a' : "-empty-").">",'~'.expand("<slnum>")) if !exists("g:netrw_quiet") if g:netrw_list_cmd == "" NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your g:netrw_list_cmd is empty; perhaps ".g:netrw_ssh_cmd." is not executable on your system",47) @@ -9173,16 +9489,16 @@ fun! s:NetrwRemoteListing() " call Dret("s:NetrwRemoteListing -1") return -1 endif " (remote handling sanity check) -" call Decho("passed remote listing sanity checks") +" call Decho("passed remote listing sanity checks",'~'.expand("<slnum>")) if exists("b:netrw_method") -" call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">") +" call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">",'~'.expand("<slnum>")) let w:netrw_method= b:netrw_method endif if s:method == "ftp" " use ftp to get remote file listing {{{3 -" call Decho("use ftp to get remote file listing") +" call Decho("use ftp to get remote file listing",'~'.expand("<slnum>")) let s:method = "ftp" let listcmd = g:netrw_ftp_list_cmd if g:netrw_sort_by =~ '^t' @@ -9190,9 +9506,9 @@ fun! s:NetrwRemoteListing() elseif g:netrw_sort_by =~ '^s' let listcmd= g:netrw_ftp_sizelist_cmd endif -" call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)") +" call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)",'~'.expand("<slnum>")) call s:NetrwRemoteFtpCmd(s:path,listcmd) -" exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."))' +" exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."),''~''.expand("<slnum>"))' " report on missing file or directory messages if search('[Nn]o such file or directory\|Failed to change directory') @@ -9210,7 +9526,7 @@ fun! s:NetrwRemoteListing() if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST " shorten the listing -" call Decho("generate short listing") +" call Decho("generate short listing",'~'.expand("<slnum>")) exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt " cleanup @@ -9225,21 +9541,21 @@ fun! s:NetrwRemoteListing() let line1= line(".") exe "sil! NetrwKeepj ".w:netrw_bannercnt let line2= search('\.\.\/\%(\s\|$\)','cnW') -" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt) +" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>")) if line2 == 0 -" call Decho("netrw is putting ../ into listing") +" call Decho("netrw is putting ../ into listing",'~'.expand("<slnum>")) sil! NetrwKeepj put='../' endif exe "sil! NetrwKeepj ".line1 sil! NetrwKeepj norm! 0 -" call Decho("line1=".line1." line2=".line2." line(.)=".line(".")) +" call Decho("line1=".line1." line2=".line2." line(.)=".line("."),'~'.expand("<slnum>")) if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup -" call Decho("M$ ftp cleanup") +" call Decho("M$ ftp cleanup",'~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+//' NetrwKeepj call histdel("/",-1) else " normal ftp cleanup -" call Decho("normal ftp cleanup") +" call Decho("normal ftp cleanup",'~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' @@ -9251,12 +9567,12 @@ fun! s:NetrwRemoteListing() else " use ssh to get remote file listing {{{3 -" call Decho("use ssh to get remote file listing: s:path<".s:path.">") +" call Decho("use ssh to get remote file listing: s:path<".s:path.">",'~'.expand("<slnum>")) let listcmd= s:MakeSshCmd(g:netrw_list_cmd) -" call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)") +" call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)",'~'.expand("<slnum>")) if g:netrw_scp_cmd =~ '^pscp' -" call Decho("1: exe r! ".shellescape(listcmd.s:path, 1)) - exe "NetrwKeepj r! ".listcmd.shellescape(s:path, 1) +" call Decho("1: exe r! ".s:ShellEscape(listcmd.s:path, 1),'~'.expand("<slnum>")) + exe "NetrwKeepj r! ".listcmd.s:ShellEscape(s:path, 1) " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like sil! NetrwKeepj g/^Listing directory/NetrwKeepj d sil! NetrwKeepj g/^d[-rwx][-rwx][-rwx]/NetrwKeepj s+$+/+e @@ -9270,18 +9586,18 @@ fun! s:NetrwRemoteListing() endif else if s:path == "" -" call Decho("2: exe r! ".listcmd) +" call Decho("2: exe r! ".listcmd,'~'.expand("<slnum>")) exe "NetrwKeepj keepalt r! ".listcmd else -" call Decho("3: exe r! ".listcmd.' '.shellescape(fnameescape(s:path),1)) - exe "NetrwKeepj keepalt r! ".listcmd.' '.shellescape(fnameescape(s:path),1) -" call Decho("listcmd<".listcmd."> path<".s:path.">") +" call Decho("3: exe r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1),'~'.expand("<slnum>")) + exe "NetrwKeepj keepalt r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1) +" call Decho("listcmd<".listcmd."> path<".s:path.">",'~'.expand("<slnum>")) endif endif " cleanup if g:netrw_ssh_browse_reject != "" -" call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d") +" call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d",'~'.expand("<slnum>")) exe "sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d" NetrwKeepj call histdel("/",-1) endif @@ -9289,7 +9605,7 @@ fun! s:NetrwRemoteListing() if w:netrw_liststyle == s:LONGLIST " do a long listing; these substitutions need to be done prior to sorting {{{3 -" call Decho("fix long listing:") +" call Decho("fix long listing:",'~'.expand("<slnum>")) if s:method == "ftp" " cleanup @@ -9312,12 +9628,12 @@ fun! s:NetrwRemoteListing() endif if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup -" call Decho("M$ ftp site listing cleanup") +" call Decho("M$ ftp site listing cleanup",'~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/' elseif exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") -" call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$")) +" call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("<slnum>")) exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/ -> .*$//e' - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e' + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2 \t\1/e' exe 'sil NetrwKeepj '.w:netrw_bannercnt NetrwKeepj call histdel("/",-1) NetrwKeepj call histdel("/",-1) @@ -9326,7 +9642,7 @@ fun! s:NetrwRemoteListing() endif " if exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " Decho -" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."))' +" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."),''~''.expand("<slnum>"))' " endif " Decho " call Dret("s:NetrwRemoteListing 0") @@ -9337,13 +9653,13 @@ endfun " s:NetrwRemoteRm: remove/delete a remote file or directory {{{2 fun! s:NetrwRemoteRm(usrhost,path) range " call Dfunc("s:NetrwRemoteRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol(".")) -" call Decho("firstline=".a:firstline." lastline=".a:lastline) +" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("<slnum>")) let svpos= netrw#SavePosn() let all= 0 if exists("s:netrwmarkfilelist_{bufnr('%')}") " remove all marked files -" call Decho("remove all marked files with bufnr#".bufnr("%")) +" call Decho("remove all marked files with bufnr#".bufnr("%"),'~'.expand("<slnum>")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwRemoteRmFile(a:path,fname,all) if ok =~ 'q\%[uit]' @@ -9356,10 +9672,12 @@ fun! s:NetrwRemoteRm(usrhost,path) range else " remove files specified by range -" call Decho("remove files specified by range") +" call Decho("remove files specified by range",'~'.expand("<slnum>")) " preparation for removing multiple files/directories - let ctr= a:firstline + let keepsol = &l:sol + setl nosol + let ctr = a:firstline " remove multiple files and directories while ctr <= a:lastline @@ -9372,10 +9690,11 @@ fun! s:NetrwRemoteRm(usrhost,path) range endif let ctr= ctr + 1 endwhile + let &l:sol = keepsol endif " refresh the (remote) directory listing -" call Decho("refresh remote directory listing") +" call Decho("refresh remote directory listing",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) NetrwKeepj call netrw#RestorePosn(svpos) @@ -9392,10 +9711,10 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) if a:rmfile !~ '^"' && (a:rmfile =~ '@$' || a:rmfile !~ '[\/]$') " attempt to remove file -" call Decho("attempt to remove file (all=".all.")") +" call Decho("attempt to remove file (all=".all.")",'~'.expand("<slnum>")) if !all echohl Statement -" call Decho("case all=0:") +" call Decho("case all=0:",'~'.expand("<slnum>")) call inputsave() let ok= input("Confirm deletion of file<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") call inputrestore() @@ -9410,47 +9729,53 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) endif if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : "")) +" call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : ""),'~'.expand("<slnum>")) if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) -" call Decho("case ftp:") +" call Decho("case ftp:",'~'.expand("<slnum>")) let path= a:path - if path =~ '^\a\+://' - let path= substitute(path,'^\a\+://[^/]\+/','','') + if path =~ '^\a\{3,}://' + let path= substitute(path,'^\a\{3,}://[^/]\+/','','') endif sil! NetrwKeepj .,$d call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"') else -" call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">") +" call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">",'~'.expand("<slnum>")) let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd) -" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">") +" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("<slnum>")) if !exists("b:netrw_curdir") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) let ok="q" else let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') -" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">") -" call Decho("remotedir<".remotedir.">") -" call Decho("rmfile<".a:rmfile.">") +" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("<slnum>")) +" call Decho("remotedir<".remotedir.">",'~'.expand("<slnum>")) +" call Decho("rmfile<".a:rmfile.">",'~'.expand("<slnum>")) if remotedir != "" - let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(remotedir.a:rmfile)) + let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(remotedir.a:rmfile)) else - let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(a:rmfile)) + let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(a:rmfile)) endif -" call Decho("call system(".netrw_rm_cmd.")") +" call Decho("call system(".netrw_rm_cmd.")",'~'.expand("<slnum>")) let ret= system(netrw_rm_cmd) - if ret != 0 - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) + if v:shell_error != 0 + if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir + call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",102) + else + call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) + endif + else if ret != 0 + call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif -" call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>")) endif endif elseif ok =~ 'q\%[uit]' -" call Decho("ok==".ok) +" call Decho("ok==".ok,'~'.expand("<slnum>")) endif else " attempt to remove directory -" call Decho("attempt to remove directory") +" call Decho("attempt to remove directory",'~'.expand("<slnum>")) if !all call inputsave() let ok= input("Confirm deletion of directory<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") @@ -9469,17 +9794,17 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) else let rmfile = substitute(a:path.a:rmfile,'/$','','') - let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.shellescape(netrw#WinPath(rmfile)) -" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")") + let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.s:ShellEscape(netrw#WinPath(rmfile)) +" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")",'~'.expand("<slnum>")) let ret= system(netrw_rmdir_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>")) if v:shell_error != 0 -" call Decho("v:shell_error not 0") - let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.shellescape(netrw#WinPath(substitute(rmfile,'[\/]$','','e'))) -" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")") +" call Decho("v:shell_error not 0",'~'.expand("<slnum>")) + let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.s:ShellEscape(netrw#WinPath(substitute(rmfile,'[\/]$','','e'))) +" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")",'~'.expand("<slnum>")) let ret= system(netrw_rmf_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>")) if v:shell_error != 0 && !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) @@ -9488,7 +9813,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) endif elseif ok =~ 'q\%[uit]' -" call Decho("ok==".ok) +" call Decho("ok==".ok,'~'.expand("<slnum>")) endif endif @@ -9509,10 +9834,10 @@ fun! s:NetrwRemoteRename(usrhost,path) range " rename files given by the markfilelist if exists("s:netrwmarkfilelist_{bufnr('%')}") for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("<slnum>")) if exists("subfrom") let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>")) else call inputsave() let newname= input("Moving ".oldname." to : ",oldname) @@ -9521,16 +9846,16 @@ fun! s:NetrwRemoteRename(usrhost,path) range let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') let newname = substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>")) endif endif - + if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) else - let oldname= shellescape(a:path.oldname) - let newname= shellescape(a:path.newname) -" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")") + let oldname= s:ShellEscape(a:path.oldname) + let newname= s:ShellEscape(a:path.newname) +" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("<slnum>")) let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) endif @@ -9540,11 +9865,13 @@ fun! s:NetrwRemoteRename(usrhost,path) range else " attempt to rename files/directories + let keepsol= &l:sol + setl nosol while ctr <= a:lastline exe "NetrwKeepj ".ctr let oldname= s:NetrwGetWord() -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("<slnum>")) call inputsave() let newname= input("Moving ".oldname." to : ",oldname) @@ -9553,14 +9880,15 @@ fun! s:NetrwRemoteRename(usrhost,path) range if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) else - let oldname= shellescape(a:path.oldname) - let newname= shellescape(a:path.newname) -" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")") + let oldname= s:ShellEscape(a:path.oldname) + let newname= s:ShellEscape(a:path.newname) +" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("<slnum>")) let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) endif let ctr= ctr + 1 endwhile + let &l:sol= keepsol endif " refresh the directory @@ -9589,37 +9917,37 @@ 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:///') +" call Decho('converting file://localhost/ -to- file:///','~'.expand("<slnum>")) let fname= substitute(fname,'^file://localhost/','file:///','') -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) endif if (has("win32") || has("win95") || has("win64") || has("win16")) if fname =~ '^file:///\=\a[|:]/' -" call Decho('converting file:///\a|/ -to- file://\a:/') +" call Decho('converting file:///\a|/ -to- file://\a:/','~'.expand("<slnum>")) let fname = substitute(fname,'^file:///\=\(\a\)[|:]/','file://\1:/','') -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) 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") +" call Decho("windows exception for plainfname",'~'.expand("<slnum>")) if plainfname =~ '^/\+\a:' -" call Decho('removing leading "/"s') +" call Decho('removing leading "/"s','~'.expand("<slnum>")) let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','') endif endif -" call Decho("fname2396<".fname2396.">") -" call Decho("plainfname<".plainfname.">") +" call Decho("fname2396<".fname2396.">",'~'.expand("<slnum>")) +" call Decho("plainfname<".plainfname.">",'~'.expand("<slnum>")) exe "sil doau BufReadPre ".fname2396e exe 'NetrwKeepj r '.plainfname exe 'sil! bdelete '.plainfname exe 'keepalt file! '.plainfname NetrwKeepj 1d -" call Decho("setl nomod") +" call Decho("setl nomod",'~'.expand("<slnum>")) setl nomod -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("netrw#FileUrlRead") exe "sil doau BufReadPost ".fname2396e endfun @@ -9627,6 +9955,7 @@ endfun " --------------------------------------------------------------------- " netrw#LocalBrowseCheck: {{{2 fun! netrw#LocalBrowseCheck(dirname) + " This function is called by netrwPlugin.vim's s:LocalBrowse() and by s:NetrwRexplore() " unfortunate interaction -- split window debugging can't be " used here, must use D-echoRemOn or D-echoTabOn -- the BufEnter " event triggers another call to LocalBrowseCheck() when attempts @@ -9635,33 +9964,32 @@ fun! netrw#LocalBrowseCheck(dirname) " would hit when re-entering netrw windows, creating unexpected " refreshes (and would do so in the middle of NetrwSaveOptions(), too) " call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">") -" call Decho("isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("isdir<".a:dirname.">=".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).expand("<slnum>")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) " call Dredir("ls!","ls!") - norm! m` +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) +" call Decho("current buffer#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("<slnum>")) let ykeep= @@ - if isdirectory(a:dirname) -" call Decho("is-directory 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#SavePosn() + if isdirectory(s:NetrwFile(a:dirname)) +" call Decho("is-directory 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,'~'.expand("<slnum>")) if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1 -" call Decho("case 1 : ft=".&ft) +" call Decho("case 1 : ft=".&ft,'~'.expand("<slnum>")) +" call Decho("s:rexposn_".bufnr("%")."<".bufname("%")."> ".(exists("s:rexposn_".bufnr("%"))? "exists" : "does not exist"),'~'.expand("<slnum>")) sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) - NetrwKeepj keepalt call netrw#RestorePosn(svposn) elseif &ft == "netrw" && line("$") == 1 -" call Decho("case 2 (ft≡netrw && line($)≡1)") +" call Decho("case 2 (ft≡netrw && line($)≡1)",'~'.expand("<slnum>")) sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) - NetrwKeepj keepalt call netrw#RestorePosn(svposn) elseif exists("s:treeforceredraw") -" call Decho("case 3 (treeforceredraw)") +" call Decho("case 3 (treeforceredraw)",'~'.expand("<slnum>")) unlet s:treeforceredraw sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) - NetrwKeepj keepalt call netrw#RestorePosn(svposn) endif +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("netrw#LocalBrowseCheck") return endif @@ -9670,18 +9998,19 @@ fun! netrw#LocalBrowseCheck(dirname) " 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 -" call Decho("wiping out currently unused netrw buffers") +" call Decho("wiping out currently unused netrw buffers",'~'.expand("<slnum>")) let ibuf = 1 let buflast = bufnr("$") while ibuf <= buflast - if bufwinnr(ibuf) == -1 && isdirectory(bufname(ibuf)) - exe "sil! keepalt ".ibuf."bw!" + if bufwinnr(ibuf) == -1 && isdirectory(s:NetrwFile(bufname(ibuf))) + exe "sil! keepj keepalt ".ibuf."bw!" endif let ibuf= ibuf + 1 endwhile endif let @@= ykeep -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " not a directory, ignore it " call Dret("netrw#LocalBrowseCheck : not a directory, ignoring it; dirname<".a:dirname.">") endfun @@ -9693,8 +10022,8 @@ endfun " on the chance that s/he removed/created a file/directory with it. fun! s:LocalBrowseRefresh() " call Dfunc("s:LocalBrowseRefresh() tabpagenr($)=".tabpagenr("$")) -" call Decho("s:netrw_browselist =".(exists("s:netrw_browselist")? string(s:netrw_browselist) : '<n/a>')) -" call Decho("w:netrw_bannercnt =".(exists("w:netrw_bannercnt")? string(w:netrw_bannercnt) : '<n/a>')) +" call Decho("s:netrw_browselist =".(exists("s:netrw_browselist")? string(s:netrw_browselist) : '<n/a>'),'~'.expand("<slnum>")) +" call Decho("w:netrw_bannercnt =".(exists("w:netrw_bannercnt")? string(w:netrw_bannercnt) : '<n/a>'),'~'.expand("<slnum>")) " determine which buffers currently reside in a tab if !exists("s:netrw_browselist") @@ -9719,36 +10048,38 @@ fun! s:LocalBrowseRefresh() let itab = itab + 1 tabn endwhile -" call Decho("buftablist".string(buftablist)) -" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">") +" call Decho("buftablist".string(buftablist),'~'.expand("<slnum>")) +" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">",'~'.expand("<slnum>")) " GO through all buffers on netrw_browselist (ie. just local-netrw buffers): " | refresh any netrw window " | wipe out any non-displaying netrw buffer let curwin = winnr() let ibl = 0 for ibuf in s:netrw_browselist -" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf)) +" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf),'~'.expand("<slnum>")) if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1 " wipe out any non-displaying netrw buffer -" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">") - exe "sil! bd ".fnameescape(ibuf) +" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">",'~'.expand("<slnum>")) + exe "sil! keepj bd ".fnameescape(ibuf) call remove(s:netrw_browselist,ibl) -" call Decho("browselist=".string(s:netrw_browselist)) +" call Decho("browselist=".string(s:netrw_browselist),'~'.expand("<slnum>")) continue elseif index(tabpagebuflist(),ibuf) != -1 " refresh any netrw buffer -" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) +" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf),'~'.expand("<slnum>")) exe bufwinnr(ibuf)."wincmd w" if getline(".") =~ 'Quick Help' " decrement g:netrw_quickhelp to prevent refresh from changing g:netrw_quickhelp " (counteracts s:NetrwBrowseChgDir()'s incrementing) let g:netrw_quickhelp= g:netrw_quickhelp - 1 endif -" call Decho("#3: quickhelp=".g:netrw_quickhelp) +" call Decho("#3: quickhelp=".g:netrw_quickhelp,'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) endif let ibl= ibl + 1 +" call Decho("bottom of s:netrw_browselist for loop: ibl=".ibl,'~'.expand("<slnum>")) endfor +" call Decho("restore window: exe ".curwin."wincmd w",'~'.expand("<slnum>")) exe curwin."wincmd w" let @@= ykeep @@ -9759,10 +10090,10 @@ endfun " s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2 " " g:netrw_ Directory Is -" fastbrowse Local Remote +" 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 +" 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". @@ -9775,21 +10106,21 @@ endfun " =2: autocmds installed (doesn't ignore any FocusGained events) fun! s:LocalFastBrowser() " call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse) -" call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a')) -" call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "installed" : "not installed")) -" call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "installed" : "not installed")) +" call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a'),'~'.expand("<slnum>")) +" call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "installed" : "not installed"),'~'.expand("<slnum>")) +" call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "installed" : "not installed"),'~'.expand("<slnum>")) " initialize browselist, a list of buffer numbers that the local browser has used if !exists("s:netrw_browselist") -" call Decho("initialize s:netrw_browselist") +" call Decho("initialize s:netrw_browselist",'~'.expand("<slnum>")) 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 Decho("appendng current buffer to browselist",'~'.expand("<slnum>")) call add(s:netrw_browselist,bufnr("%")) -" call Decho("browselist=".string(s:netrw_browselist)) +" call Decho("browselist=".string(s:netrw_browselist),'~'.expand("<slnum>")) endif " enable autocmd events to handle refreshing/removing local browser buffers @@ -9803,10 +10134,10 @@ fun! s:LocalFastBrowser() augroup AuNetrwEvent au! if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("installing autocmd: ShellCmdPost") +" call Decho("installing autocmd: ShellCmdPost",'~'.expand("<slnum>")) au ShellCmdPost * call s:LocalBrowseRefresh() else -" call Decho("installing autocmds: ShellCmdPost FocusGained") +" call Decho("installing autocmds: ShellCmdPost FocusGained",'~'.expand("<slnum>")) au ShellCmdPost,FocusGained * call s:LocalBrowseRefresh() endif augroup END @@ -9814,7 +10145,7 @@ fun! s:LocalFastBrowser() " user must have changed fastbrowse to its fast setting, so remove " the associated autocmd events elseif g:netrw_fastbrowse > 1 && exists("#ShellCmdPost") && exists("s:netrw_events") -" call Decho("remove AuNetrwEvent autcmd group") +" call Decho("remove AuNetrwEvent autcmd group",'~'.expand("<slnum>")) unlet s:netrw_events augroup AuNetrwEvent au! @@ -9829,70 +10160,78 @@ endfun " s:LocalListing: does the job of "ls" for local directories {{{2 fun! s:LocalListing() " call Dfunc("s:LocalListing()") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) -" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist") |endif -" if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist")|endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist",'~'.expand("<slnum>")) |endif +" if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist",'~'.expand("<slnum>"))|endif +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) " get the list of files contained in the current directory let dirname = b:netrw_curdir let dirnamelen = strlen(b:netrw_curdir) - let filelist = glob(s:ComposePath(dirname,"*"),0,1) - let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) -" call Decho("filelist=".string(filelist)) + if v:version == 704 && has("patch656") +" call Decho("using glob with patch656",'~'.expand("<slnum>")) + let filelist = glob(s:ComposePath(dirname,"*"),0,1,1) + let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1,1) + else +" call Decho("using glob without patch656",'~'.expand("<slnum>")) + let filelist = glob(s:ComposePath(dirname,"*"),0,1) + let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) + endif +" call Decho("filelist=".string(filelist),'~'.expand("<slnum>")) if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("filelist=".string(filelist)) +" call Decho("filelist=".string(filelist),'~'.expand("<slnum>")) elseif index(filelist,'..') == -1 && b:netrw_curdir !~ '/' " include ../ in the glob() entry if its missing -" call Decho("forcibly including on \"..\"") +" call Decho("forcibly including on \"..\"",'~'.expand("<slnum>")) let filelist= filelist+[s:ComposePath(b:netrw_curdir,"../")] -" call Decho("filelist=".string(filelist)) +" call Decho("filelist=".string(filelist),'~'.expand("<slnum>")) endif -" call Decho("before while: dirname<".dirname.">") -" call Decho("before while: dirnamelen<".dirnamelen.">") -" call Decho("before while: filelist=".string(filelist)) +" call Decho("before while: dirname<".dirname.">",'~'.expand("<slnum>")) +" call Decho("before while: dirnamelen<".dirnamelen.">",'~'.expand("<slnum>")) +" call Decho("before while: filelist=".string(filelist),'~'.expand("<slnum>")) if get(g:, 'netrw_dynamic_maxfilenamelen', 0) let filelistcopy = map(deepcopy(filelist),'fnamemodify(v:val, ":t")') let g:netrw_maxfilenamelen = max(map(filelistcopy,'len(v:val)')) + 1 -" call Decho("dynamic_maxfilenamelen: filenames =".string(filelistcopy)) -" call Decho("dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen) +" call Decho("dynamic_maxfilenamelen: filenames =".string(filelistcopy),'~'.expand("<slnum>")) +" call Decho("dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen,'~'.expand("<slnum>")) endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) for filename in filelist -" call Decho(" ") -" call Decho("for filename in filelist: filename<".filename.">") +" call Decho(" ",'~'.expand("<slnum>")) +" call Decho("for filename in filelist: filename<".filename.">",'~'.expand("<slnum>")) if getftype(filename) == "link" " indicate a symbolic link -" call Decho("indicate <".filename."> is a symbolic link with trailing @") +" call Decho("indicate <".filename."> is a symbolic link with trailing @",'~'.expand("<slnum>")) let pfile= filename."@" elseif getftype(filename) == "socket" " indicate a socket -" call Decho("indicate <".filename."> is a socket with trailing =") +" call Decho("indicate <".filename."> is a socket with trailing =",'~'.expand("<slnum>")) let pfile= filename."=" elseif getftype(filename) == "fifo" " indicate a fifo -" call Decho("indicate <".filename."> is a fifo with trailing |") +" call Decho("indicate <".filename."> is a fifo with trailing |",'~'.expand("<slnum>")) let pfile= filename."|" - elseif isdirectory(filename) + elseif isdirectory(s:NetrwFile(filename)) " indicate a directory -" call Decho("indicate <".filename."> is a directory with trailing /") +" call Decho("indicate <".filename."> is a directory with trailing /",'~'.expand("<slnum>")) let pfile= filename."/" - elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(filename) + elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(s:NetrwFile(filename)) if (has("win32") || has("win95") || has("win64") || has("win16")) if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$' " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("<slnum>")) let pfile= filename."*" else " normal file @@ -9900,7 +10239,7 @@ fun! s:LocalListing() endif elseif executable(filename) " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("<slnum>")) let pfile= filename."*" else " normal file @@ -9911,45 +10250,45 @@ fun! s:LocalListing() " normal file let pfile= filename endif -" call Decho("pfile<".pfile."> (after *@/ appending)") +" call Decho("pfile<".pfile."> (after *@/ appending)",'~'.expand("<slnum>")) if pfile =~ '//$' let pfile= substitute(pfile,'//$','/','e') -" call Decho("change // to /: pfile<".pfile.">") +" call Decho("change // to /: pfile<".pfile.">",'~'.expand("<slnum>")) endif let pfile= strpart(pfile,dirnamelen) let pfile= substitute(pfile,'^[/\\]','','e') -" call Decho("filename<".filename.">") -" call Decho("pfile <".pfile.">") +" call Decho("filename<".filename.">",'~'.expand("<slnum>")) +" call Decho("pfile <".pfile.">",'~'.expand("<slnum>")) if w:netrw_liststyle == s:LONGLIST let sz = getfsize(filename) let fsz = strpart(" ",1,15-strlen(sz)).sz let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) -" call Decho("sz=".sz." fsz=".fsz) +" call Decho("sz=".sz." fsz=".fsz,'~'.expand("<slnum>")) endif if g:netrw_sort_by =~ "^t" " sort by time (handles time up to 1 quintillion seconds, US) -" call Decho("getftime(".filename.")=".getftime(filename)) +" call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("<slnum>")) let t = getftime(filename) let ft = strpart("000000000000000000",1,18-strlen(t)).t -" call Decho("exe NetrwKeepj put ='".ft.'/'.filename."'") +" call Decho("exe NetrwKeepj put ='".ft.'/'.filename."'",'~'.expand("<slnum>")) let ftpfile= ft.'/'.pfile sil! NetrwKeepj put=ftpfile elseif g:netrw_sort_by =~ "^s" " sort by size (handles file sizes up to 1 quintillion bytes, US) -" call Decho("getfsize(".filename.")=".getfsize(filename)) +" call Decho("getfsize(".filename.")=".getfsize(filename),'~'.expand("<slnum>")) let sz = getfsize(filename) let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz -" call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'") +" call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'",'~'.expand("<slnum>")) let fszpfile= fsz.'/'.pfile sil! NetrwKeepj put =fszpfile else " sort by name -" call Decho("exe NetrwKeepj put ='".pfile."'") +" call Decho("exe NetrwKeepj put ='".pfile."'",'~'.expand("<slnum>")) sil! NetrwKeepj put=pfile endif endfor @@ -9958,7 +10297,7 @@ fun! s:LocalListing() sil! NetrwKeepj g/^$/d sil! NetrwKeepj %s/\r$//e call histdel("/",-1) -" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>")) exe "setl ts=".(g:netrw_maxfilenamelen+1) " call Dret("s:LocalListing") @@ -9978,9 +10317,9 @@ fun! s:NetrwLocalExecute(cmd) endif let optargs= input(":!".a:cmd,"","file") -" call Decho("optargs<".optargs.">") +" call Decho("optargs<".optargs.">",'~'.expand("<slnum>")) let result= system(a:cmd.optargs) -" call Decho("result) +" call Decho("result,'~'.expand("<slnum>")) " strip any ansi escape sequences off let result = substitute(result,"\e\\[[0-9;]*m","","g") @@ -9998,32 +10337,39 @@ 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#SavePosn() + let ykeep = @@ + let ctr = a:firstline + let svpos = netrw#SavePosn() " rename files given by the markfilelist if exists("s:netrwmarkfilelist_{bufnr('%')}") for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("<slnum>")) if exists("subfrom") let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>")) else call inputsave() - let newname= input("Moving ".oldname." to : ",oldname) + let newname= input("Moving ".oldname." to : ",oldname,"file") call inputrestore() + if newname =~ '' + " two ctrl-x's : ignore all of string preceding the ctrl-x's + let newname = substitute(newname,'^.*','','') + elseif newname =~ '' + " one ctrl-x : ignore portion of string preceding ctrl-x but after last / + let newname = substitute(newname,'[^/]*','','') + endif if newname =~ '^s/' let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>")) 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 @@ -10043,21 +10389,21 @@ fun! s:NetrwLocalRename(path) range NetrwKeepj norm! 0 let oldname= s:ComposePath(a:path,curword) -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("<slnum>")) call inputsave() let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) call inputrestore() call rename(oldname,newname) -" call Decho("renaming <".oldname."> to <".newname.">") +" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>")) let ctr= ctr + 1 endwhile endif " refresh the directory -" call Decho("refresh the directory listing") +" call Decho("refresh the directory listing",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) NetrwKeepj call netrw#RestorePosn(svpos) let @@= ykeep @@ -10069,7 +10415,7 @@ endfun " s:NetrwLocalRm: {{{2 fun! s:NetrwLocalRm(path) range " call Dfunc("s:NetrwLocalRm(path<".a:path.">)") -" call Decho("firstline=".a:firstline." lastline=".a:lastline) +" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("<slnum>")) " preparation for removing multiple files/directories let ykeep = @@ @@ -10079,7 +10425,7 @@ fun! s:NetrwLocalRm(path) range if exists("s:netrwmarkfilelist_{bufnr('%')}") " remove all marked files -" call Decho("remove all marked files") +" call Decho("remove all marked files",'~'.expand("<slnum>")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwLocalRmFile(a:path,fname,all) if ok =~ 'q\%[uit]' || ok == "no" @@ -10092,8 +10438,10 @@ fun! s:NetrwLocalRm(path) range else " remove (multiple) files and directories -" call Decho("remove files in range [".a:firstline.",".a:lastline."]") +" call Decho("remove files in range [".a:firstline.",".a:lastline."]",'~'.expand("<slnum>")) + let keepsol= &l:sol + setl nosol let ctr = a:firstline while ctr <= a:lastline exe "NetrwKeepj ".ctr @@ -10116,10 +10464,11 @@ fun! s:NetrwLocalRm(path) range endif let ctr= ctr + 1 endwhile + let &l:sol= keepsol endif " refresh the directory -" call Decho("bufname<".bufname("%").">") +" call Decho("bufname<".bufname("%").">",'~'.expand("<slnum>")) if bufname("%") != "NetrwMessage" NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) NetrwKeepj call netrw#RestorePosn(svpos) @@ -10134,16 +10483,16 @@ endfun " Give confirmation prompt unless all==1 fun! s:NetrwLocalRmFile(path,fname,all) " call Dfunc("s:NetrwLocalRmFile(path<".a:path."> fname<".a:fname."> all=".a:all) - + let all= a:all let ok = "" NetrwKeepj norm! 0 - let rmfile= s:ComposePath(a:path,a:fname) -" call Decho("rmfile<".rmfile.">") + let rmfile= s:NetrwFile(s:ComposePath(a:path,a:fname)) +" call Decho("rmfile<".rmfile.">",'~'.expand("<slnum>")) if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') " attempt to remove file -" call Decho("attempt to remove file<".rmfile.">") +" call Decho("attempt to remove file<".rmfile.">",'~'.expand("<slnum>")) if !all echohl Statement call inputsave() @@ -10153,9 +10502,9 @@ fun! s:NetrwLocalRmFile(path,fname,all) if ok == "" let ok="no" endif -" call Decho("response: ok<".ok.">") +" call Decho("response: ok<".ok.">",'~'.expand("<slnum>")) let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') -" call Decho("response: ok<".ok."> (after sub)") +" call Decho("response: ok<".ok."> (after sub)",'~'.expand("<slnum>")) if ok =~ 'a\%[ll]' let all= 1 endif @@ -10163,7 +10512,7 @@ fun! s:NetrwLocalRmFile(path,fname,all) if all || ok =~ 'y\%[es]' || ok == "" let ret= s:NetrwDelete(rmfile) -" call Decho("errcode=".v:shell_error." ret=".ret) +" call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("<slnum>")) endif else @@ -10184,19 +10533,19 @@ fun! s:NetrwLocalRmFile(path,fname,all) let rmfile= substitute(rmfile,'[\/]$','','e') if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.shellescape(rmfile).')') - call system(netrw#WinPath(g:netrw_localrmdir).' '.shellescape(rmfile)) -" call Decho("v:shell_error=".v:shell_error) +" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.s:ShellEscape(rmfile).')','~'.expand("<slnum>")) + call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile)) +" call Decho("v:shell_error=".v:shell_error,'~'.expand("<slnum>")) if v:shell_error != 0 -" call Decho("2nd attempt to remove directory<".rmfile.">") +" call Decho("2nd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>")) let errcode= s:NetrwDelete(rmfile) -" call Decho("errcode=".errcode) +" call Decho("errcode=".errcode,'~'.expand("<slnum>")) if errcode != 0 if has("unix") -" call Decho("3rd attempt to remove directory<".rmfile.">") - call system("rm ".shellescape(rmfile)) +" call Decho("3rd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>")) + call system("rm ".s:ShellEscape(rmfile)) if v:shell_error != 0 && !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34) let ok="no" @@ -10232,6 +10581,18 @@ fun! netrw#Access(ilist) return s:netrwmftgt endfun +" --------------------------------------------------------------------- +" netrw#Call: allows user-specified mappings to call internal netrw functions {{{2 +fun! netrw#Call(funcname,...) +" call Dfunc("netrw#Call(funcname<".a:funcname.">,".string(a:000).")") + if a:0 > 0 + exe "call s:".a:funcname."(".string(a:000).")" + else + exe "call s:".a:funcname."()" + endif +" call Dret("netrw#Call") +endfun + " ------------------------------------------------------------------------ " netrw#RestorePosn: restores the cursor and file position as saved by netrw#SavePosn() {{{2 fun! netrw#RestorePosn(...) @@ -10247,22 +10608,22 @@ fun! netrw#RestorePosn(...) if a:0 > 0 exe "keepj ".a:1 endif -" "call Decho("a:1 = ".((a:0 > 0)? a:1 : 'n/a')) -" "call Decho("liststyle = ".(exists("liststyle")? liststyle : 'n/a'). " w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) +" "call Decho("a:1 = ".((a:0 > 0)? a:1 : 'n/a'),'~'.expand("<slnum>")) +" "call Decho("liststyle = ".(exists("liststyle")? liststyle : 'n/a'). " w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) if exists("liststyle") && exists("w:netrw_liststyle") && liststyle != w:netrw_liststyle let usesrch= 1 else let usesrch= 0 endif -" "call Decho("winh = ".(exists("w:netrw_winh")? w:netrw_winh : -1)) -" "call Decho("winw = ".(exists("w:netrw_winw")? w:netrw_winw : -1)) -" "call Decho("cur winheight=".winheight(0)." winwidth=".winwidth(0)) -" "call Decho("w:netrw_winfile = ".(exists("w:netrw_winfile")? w:netrw_winfile : 'n/a')) +" "call Decho("winh = ".(exists("w:netrw_winh")? w:netrw_winh : -1),'~'.expand("<slnum>")) +" "call Decho("winw = ".(exists("w:netrw_winw")? w:netrw_winw : -1),'~'.expand("<slnum>")) +" "call Decho("cur winheight=".winheight(0)." winwidth=".winwidth(0),'~'.expand("<slnum>")) +" "call Decho("w:netrw_winfile = ".(exists("w:netrw_winfile")? w:netrw_winfile : 'n/a'),'~'.expand("<slnum>")) " restore window if exists("w:netrw_winnr") -" "call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w") +" "call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w",'~'.expand("<slnum>")) exe "sil! ".w:netrw_winnr."wincmd w" endif " if v:shell_error == 0 @@ -10273,34 +10634,34 @@ fun! netrw#RestorePosn(...) " restore top-of-screen line if exists("w:netrw_hline") -" "call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z") +" "call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z",'~'.expand("<slnum>")) exe "keepj norm! ".w:netrw_hline."G0z\<CR>" endif " restore position " when the window's height x width has changed, the line,col is no longer useful if w:netrw_winh == winheight(0) && w:netrw_winw == winwidth(0) && exists("w:netrw_line") && exists("w:netrw_col") && !usesrch -" "call Decho("using posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|") +" "call Decho("using posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|",'~'.expand("<slnum>")) exe "keepj norm! ".w:netrw_line."G0".w:netrw_col."\<bar>" elseif exists("w:netrw_winfile") if !search('\<'.escape(w:netrw_winfile,g:netrw_fname_escape),'cw') if exists("w:netrw_bannercnt") -" "call Decho("using bannercnt: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") +" "call Decho("using bannercnt: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("<slnum>")) exe "keepj ".w:netrw_bannercnt norm! 0 else " go to upper left corner -" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") +" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("<slnum>")) keepj 1 norm! 0 endif else -" "call Decho("used search: w:netrw_winfile<".w:netrw_winfile.">") +" "call Decho("used search: w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("<slnum>")) endif else -" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)) +" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0),'~'.expand("<slnum>")) keepj 1 norm! 0 endif @@ -10310,6 +10671,39 @@ fun! netrw#RestorePosn(...) endfun " --------------------------------------------------------------------- +" netrw#Expose: allows UserMaps and pchk to look at otherwise script-local variables {{{2 +" I expect this function to be used in +" :PChkAssert netrw#Expose("netrwmarkfilelist") +" for example. +fun! netrw#Expose(varname) +" call Dfunc("netrw#Expose(varname<".a:varname.">)") + exe "let retval= s:".a:varname + if exists("g:netrw_pchk") + if type(retval) == 3 + let retval = copy(retval) + let i = 0 + while i < len(retval) + let retval[i]= substitute(retval[i],expand("$HOME"),'~','') + let i = i + 1 + endwhile + endif +" call Dret("netrw#Expose ".string(retval)) + return string(retval) + endif + +" call Dret("netrw#Expose ".string(retval)) + return retval +endfun + +" --------------------------------------------------------------------- +" netrw#Modify: allows UserMaps to set (modify) script-local variables {{{2 +fun! netrw#Modify(varname,newvalue) +" call Dfunc("netrw#Modify(varname<".a:varname.">,newvalue<".string(a:newvalue).">)") + exe "let s:".a:varname."= ".string(a:newvalue) +" call Dret("netrw#Modify") +endfun + +" --------------------------------------------------------------------- " netrw#RFC2396: converts %xx into characters {{{2 fun! netrw#RFC2396(fname) " call Dfunc("netrw#RFC2396(fname<".a:fname.">)") @@ -10321,27 +10715,27 @@ endfun " --------------------------------------------------------------------- " netrw#SavePosn: saves position of cursor on screen {{{2 fun! netrw#SavePosn() -" call Dfunc("netrw#SavePosn() line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) +" call Dfunc("netrw#SavePosn() win#".winnr()." line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) " Save current line and column let w:netrw_winnr= winnr() let w:netrw_line = line(".") let w:netrw_col = virtcol(".") -" "call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col) +" "call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col,'~'.expand("<slnum>")) " save filename under cursor -" "call Decho("line#".line(".")." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')) +" "call Decho("line#".line(".")." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a'),'~'.expand("<slnum>")) if exists("w:netrw_bannercnt") && line(".") >= w:netrw_bannercnt && &ft == "netrw" let winfile = "|let w:netrw_winfile=\"".fnameescape(s:NetrwGetWord())."\"" else let winfile= "" endif -" "call Decho("winfile<".winfile.">") +" "call Decho("winfile<".winfile.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") let liststyle = "|let liststyle=".w:netrw_liststyle else let liststyle= "" endif -" "call Decho("liststyle=".liststyle) +" "call Decho("liststyle=".liststyle,'~'.expand("<slnum>")) " Save top-of-screen line keepj norm! H0 @@ -10356,11 +10750,51 @@ fun! netrw#SavePosn() let ret = "let w:netrw_winnr=".w:netrw_winnr."|let w:netrw_line=".w:netrw_line."|let w:netrw_col=".w:netrw_col."|let w:netrw_hline=".w:netrw_hline."|let w:netrw_winh=".w:netrw_winh."|let w:netrw_winw=".w:netrw_winw.liststyle.winfile keepj call netrw#RestorePosn() -" call Dret("netrw#SavePosn : winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : "n/a")." line=".(exists("w:netrw_line")? w:netrw_line : "n/a")." col=".(exists("w:netrw_col")? w:netrw_col : "n/a")." hline=".(exists("w:netrw_hline")? w:netrw_hline : "n/a")) +" call Dret("netrw#SavePosn : win#=".(exists("w:netrw_winnr")? w:netrw_winnr : "n/a")." line=".(exists("w:netrw_line")? w:netrw_line : "n/a")." col=".(exists("w:netrw_col")? w:netrw_col : "n/a")." hline=".(exists("w:netrw_hline")? w:netrw_hline : "n/a")) return ret endfun " --------------------------------------------------------------------- +" netrw#UserMaps: supports user-specified maps {{{2 +" see :help function() +" +" g:Netrw_UserMaps is a List with members such as: +" [[keymap sequence, function reference],...] +" +" The referenced function may return a string, +" refresh : refresh the display +" -other- : this string will be executed +" or it may return a List of strings. +" +" Each keymap-sequence will be set up with a nnoremap +" to invoke netrw#UserMaps(islocal). +" Related functions: +" netrw#Expose(varname) -- see s:varname variables +" netrw#Modify(varname,newvalue) -- modify value of s:varname variable +" netrw#Call(funcname,...) -- call internal netrw function with optional arguments +fun! netrw#UserMaps(islocal) +" call Dfunc("netrw#UserMaps(islocal=".a:islocal.")") +" call Decho("g:Netrw_UserMaps ".(exists("g:Netrw_UserMaps")? "exists" : "does NOT exist"),'~'.expand("<slnum>")) + + " set up usermaplist + if exists("g:Netrw_UserMaps") && type(g:Netrw_UserMaps) == 3 +" call Decho("g:Netrw_UserMaps has type 3<List>",'~'.expand("<slnum>")) + for umap in g:Netrw_UserMaps +" call Decho("type(umap[0]<".string(umap[0]).">)=".type(umap[0])." (should be 1=string)",'~'.expand("<slnum>")) +" call Decho("type(umap[1])=".type(umap[1])." (should be 1=string)",'~'.expand("<slnum>")) + " if umap[0] is a string and umap[1] is a string holding a function name + if type(umap[0]) == 1 && type(umap[1]) == 1 +" call Decho("nno <buffer> <silent> ".umap[0]." :call s:UserMaps(".a:islocal.",".string(umap[1]).")<cr>",'~'.expand("<slnum>")) + exe "nno <buffer> <silent> ".umap[0]." :call <SID>UserMaps(".a:islocal.",'".umap[1]."')<cr>" + else + call netrw#ErrorMsg(s:WARNING,"ignoring usermap <".string(umap[0])."> -- not a [string,funcref] entry",99) + endif + endfor + endif +" call Dret("netrw#UserMaps") +endfun + +" --------------------------------------------------------------------- " netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2 fun! netrw#WinPath(path) " call Dfunc("netrw#WinPath(path<".a:path.">)") @@ -10386,7 +10820,7 @@ fun! s:ComposePath(base,subdir) " call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)") if has("amiga") -" call Decho("amiga") +" call Decho("amiga",'~'.expand("<slnum>")) let ec = a:base[s:Strlen(a:base)-1] if ec != '/' && ec != ':' let ret = a:base . "/" . a:subdir @@ -10395,19 +10829,19 @@ fun! s:ComposePath(base,subdir) endif elseif a:subdir =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows") +" call Decho("windows",'~'.expand("<slnum>")) let ret= a:subdir elseif a:base =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows") +" call Decho("windows",'~'.expand("<slnum>")) if a:base =~ '[/\\]$' let ret= a:base.a:subdir else - let ret= a:base."/".a:subdir + let ret= a:base.'/'.a:subdir endif - elseif a:base =~ '^\a\+://' -" call Decho("remote linux/macos") + elseif a:base =~ '^\a\{3,}://' +" call Decho("remote linux/macos",'~'.expand("<slnum>")) let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','') let curpath = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\2','') if a:subdir == '../' @@ -10420,12 +10854,12 @@ fun! s:ComposePath(base,subdir) else let ret= urlbase.curpath.a:subdir endif -" call Decho("urlbase<".urlbase.">") -" call Decho("curpath<".curpath.">") -" call Decho("ret<".ret.">") +" call Decho("urlbase<".urlbase.">",'~'.expand("<slnum>")) +" call Decho("curpath<".curpath.">",'~'.expand("<slnum>")) +" call Decho("ret<".ret.">",'~'.expand("<slnum>")) else -" call Decho("local linux/macos") +" call Decho("local linux/macos",'~'.expand("<slnum>")) let ret = substitute(a:base."/".a:subdir,"//","/","g") if a:base =~ '^//' " keeping initial '//' for the benefit of network share listing support @@ -10471,9 +10905,9 @@ fun! s:FileReadable(fname) " call Dfunc("s:FileReadable(fname<".a:fname.">)") if g:netrw_cygwin - let ret= filereadable(substitute(a:fname,g:netrw_cygdrive.'/\(.\)','\1:/','')) + let ret= filereadable(s:NetrwFile(substitute(a:fname,g:netrw_cygdrive.'/\(.\)','\1:/',''))) else - let ret= filereadable(a:fname) + let ret= filereadable(s:NetrwFile(a:fname)) endif " call Dret("s:FileReadable ".ret) @@ -10490,14 +10924,14 @@ fun! s:GetTempfile(fname) if !exists("b:netrw_tmpfile") " get a brand new temporary filename let tmpfile= tempname() -" call Decho("tmpfile<".tmpfile."> : from tempname()") +" call Decho("tmpfile<".tmpfile."> : from tempname()",'~'.expand("<slnum>")) let tmpfile= substitute(tmpfile,'\','/','ge') -" call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /") +" call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /",'~'.expand("<slnum>")) " sanity check -- does the temporary file's directory exist? - if !isdirectory(substitute(tmpfile,'[^/]\+$','','e')) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + if !isdirectory(s:NetrwFile(substitute(tmpfile,'[^/]\+$','','e'))) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) " call Dret("s:GetTempfile getcwd<".getcwd().">") return "" @@ -10505,7 +10939,7 @@ fun! s:GetTempfile(fname) " let netrw#NetSource() know about the tmpfile let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#BrowseX() -" call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">") +" call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">",'~'.expand("<slnum>")) " o/s dependencies if g:netrw_cygwin != 0 @@ -10518,17 +10952,17 @@ fun! s:GetTempfile(fname) let tmpfile = tmpfile endif let b:netrw_tmpfile= tmpfile -" call Decho("o/s dependent fixed tempname<".tmpfile.">") +" call Decho("o/s dependent fixed tempname<".tmpfile.">",'~'.expand("<slnum>")) else " re-use temporary filename let tmpfile= b:netrw_tmpfile -" call Decho("tmpfile<".tmpfile."> re-using") +" call Decho("tmpfile<".tmpfile."> re-using",'~'.expand("<slnum>")) endif " use fname's suffix for the temporary file if a:fname != "" if a:fname =~ '\.[^./]\+$' -" call Decho("using fname<".a:fname.">'s suffix") +" call Decho("using fname<".a:fname.">'s suffix",'~'.expand("<slnum>")) if a:fname =~ '\.tar\.gz$' || a:fname =~ '\.tar\.bz2$' || a:fname =~ '\.tar\.xz$' let suffix = ".tar".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') elseif a:fname =~ '.txz$' @@ -10536,16 +10970,16 @@ fun! s:GetTempfile(fname) else let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') endif -" call Decho("suffix<".suffix.">") +" call Decho("suffix<".suffix.">",'~'.expand("<slnum>")) let tmpfile= substitute(tmpfile,'\.tmp$','','e') -" call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)") +" call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)",'~'.expand("<slnum>")) let tmpfile .= suffix -" call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">") +" call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>")) let s:netrw_tmpfile= tmpfile " supports netrw#NetSource() endif endif -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:GetTempfile <".tmpfile.">") return tmpfile endfun @@ -10582,7 +11016,7 @@ fun! s:MakeBookmark(fname) if index(g:netrw_bookmarklist,a:fname) == -1 " curdir not currently in g:netrw_bookmarklist, so include it - if isdirectory(a:fname) && a:fname !~ '/$' + if isdirectory(s:NetrwFile(a:fname)) && a:fname !~ '/$' call add(g:netrw_bookmarklist,a:fname.'/') elseif a:fname !~ '/' call add(g:netrw_bookmarklist,getcwd()."/".a:fname) @@ -10598,13 +11032,13 @@ endfun " --------------------------------------------------------------------- " s:MergeBookmarks: merge current bookmarks with saved bookmarks {{{2 fun! s:MergeBookmarks() -" call Dfunc("s:MergeBookmarks()") +" call Dfunc("s:MergeBookmarks() : merge current bookmarks into .netrwbook") " get bookmarks from .netrwbook file let savefile= s:NetrwHome()."/.netrwbook" - if filereadable(savefile) -" call Decho("merge bookmarks (active and file)") + if filereadable(s:NetrwFile(savefile)) +" call Decho("merge bookmarks (active and file)",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwBookHistSave() -" call Decho("bookmark delete savefile<".savefile.">") +" call Decho("bookmark delete savefile<".savefile.">",'~'.expand("<slnum>")) NetrwKeepj call delete(savefile) endif " call Dret("s:MergeBookmarks") @@ -10641,13 +11075,13 @@ fun! s:NetrwCursor() if &ft != "netrw" " if the current window isn't a netrw directory listing window, then use user cursorline/column " settings. Affects when netrw is used to read/write a file using scp/ftp/etc. -" call Decho("case ft!=netrw: use user cul,cuc") +" call Decho("case ft!=netrw: use user cul,cuc",'~'.expand("<slnum>")) let &l:cursorline = s:netrw_usercul let &l:cursorcolumn = s:netrw_usercuc elseif g:netrw_cursor == 4 " all styles: cursorline, cursorcolumn -" call Decho("case g:netrw_cursor==4: setl cul cuc") +" call Decho("case g:netrw_cursor==4: setl cul cuc",'~'.expand("<slnum>")) setl cursorline setl cursorcolumn @@ -10655,11 +11089,11 @@ fun! s:NetrwCursor() " thin-long-tree: cursorline, user's cursorcolumn " wide : cursorline, cursorcolumn if w:netrw_liststyle == s:WIDELIST -" call Decho("case g:netrw_cursor==3 and wide: setl cul cuc") +" call Decho("case g:netrw_cursor==3 and wide: setl cul cuc",'~'.expand("<slnum>")) setl cursorline setl cursorcolumn else -" call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)") +" call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)",'~'.expand("<slnum>")) setl cursorline let &l:cursorcolumn = s:netrw_usercuc endif @@ -10667,7 +11101,7 @@ fun! s:NetrwCursor() elseif g:netrw_cursor == 2 " thin-long-tree: cursorline, user's cursorcolumn " wide : cursorline, user's cursorcolumn -" call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)") +" call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)",'~'.expand("<slnum>")) let &l:cursorcolumn = s:netrw_usercuc setl cursorline @@ -10676,16 +11110,16 @@ fun! s:NetrwCursor() " wide : cursorline, user's cursorcolumn let &l:cursorcolumn = s:netrw_usercuc if w:netrw_liststyle == s:WIDELIST -" call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)") +" call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)",'~'.expand("<slnum>")) setl cursorline else -" call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)") +" call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)",'~'.expand("<slnum>")) let &l:cursorline = s:netrw_usercul endif else " all styles: user's cursorline, user's cursorcolumn -" call Decho("default: (use user's cul,cuc)") +" call Decho("default: (use user's cul,cuc)",'~'.expand("<slnum>")) let &l:cursorline = s:netrw_usercul let &l:cursorcolumn = s:netrw_usercuc endif @@ -10722,11 +11156,11 @@ fun! s:NetrwDelete(path) let result = delete(path) let &shellslash = sskeep else -" call Decho("exe let result= ".a:cmd."('".path."')") +" call Decho("exe let result= ".a:cmd."('".path."')",'~'.expand("<slnum>")) let result= delete(path) endif else -" call Decho("let result= delete(".path.")") +" call Decho("let result= delete(".path.")",'~'.expand("<slnum>")) let result= delete(path) endif if result < 0 @@ -10741,10 +11175,10 @@ endfun " s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2 fun! s:NetrwEnew(...) " call Dfunc("s:NetrwEnew() a:0=".a:0." bufnr($)=".bufnr("$")) -" call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">") +" call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) " grab a function-local-variable copy of buffer variables -" call Decho("make function-local copy of netrw variables") +" call Decho("make function-local copy of netrw variables",'~'.expand("<slnum>")) if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif if exists("b:netrw_browser_active") |let netrw_browser_active = b:netrw_browser_active |endif if exists("b:netrw_cpf") |let netrw_cpf = b:netrw_cpf |endif @@ -10763,15 +11197,15 @@ fun! s:NetrwEnew(...) if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif NetrwKeepj call s:NetrwOptionRestore("w:") -" call Decho("generate a buffer with NetrwKeepj keepalt enew!") +" call Decho("generate a buffer with NetrwKeepj keepalt enew!",'~'.expand("<slnum>")) let netrw_keepdiff= &l:diff noswapfile NetrwKeepj keepalt enew! let &l:diff= netrw_keepdiff -" call Decho("bufnr($)=".bufnr("$")." winnr($)=".winnr("$")) +" call Decho("bufnr($)=".bufnr("$")." winnr($)=".winnr("$"),'~'.expand("<slnum>")) NetrwKeepj call s:NetrwOptionSave("w:") " copy function-local-variables to buffer variable equivalents -" call Decho("copy function-local variables back to buffer netrw variables") +" call Decho("copy function-local variables back to buffer netrw variables",'~'.expand("<slnum>")) if exists("netrw_bannercnt") |let b:netrw_bannercnt = netrw_bannercnt |endif if exists("netrw_browser_active") |let b:netrw_browser_active = netrw_browser_active |endif if exists("netrw_cpf") |let b:netrw_cpf = netrw_cpf |endif @@ -10841,7 +11275,7 @@ fun! s:NetrwInsureWinVars() endwhile exe "keepalt ".curwin."wincmd w" if exists("winvars") -" call Decho("copying w#".iwin." window variables to w#".curwin) +" call Decho("copying w#".iwin." window variables to w#".curwin,'~'.expand("<slnum>")) for k in keys(winvars) let w:{k}= winvars[k] endfor @@ -10860,7 +11294,7 @@ fun! s:NetrwLcd(newdir) catch /^Vim\%((\a\+)\)\=:E344/ " Vim's lcd fails with E344 when attempting to go above the 'root' of a Windows share. " Therefore, detect if a Windows share is present, and if E344 occurs, just settle at - " 'root' (ie. '\'). The share name may start with either backslashes ('\\Foo') or + " 'root' (ie. '\'). The share name may start with either backslashes ('\\Foo') or " forward slashes ('//Foo'), depending on whether backslashes have been converted to " forward slashes by earlier code; so check for both. if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin @@ -10875,9 +11309,9 @@ fun! s:NetrwLcd(newdir) let a:newdir= w:netrw_prvdir else call s:NetrwOptionRestore("w:") -" call Decho("setl noma nomod nowrap") +" call Decho("setl noma nomod nowrap",'~'.expand("<slnum>")) exe "setl ".g:netrw_bufsettings -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) let a:newdir= dirname " call Dret("s:NetrwBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") return @@ -10939,12 +11373,12 @@ fun! s:RemotePathAnalysis(dirname) let s:machine = substitute(s:machine,dirpat,'\2','') endif -" call Decho("set up s:method <".s:method .">") -" call Decho("set up s:user <".s:user .">") -" call Decho("set up s:machine<".s:machine.">") -" call Decho("set up s:port <".s:port.">") -" call Decho("set up s:path <".s:path .">") -" call Decho("set up s:fname <".s:fname .">") +" call Decho("set up s:method <".s:method .">",'~'.expand("<slnum>")) +" call Decho("set up s:user <".s:user .">",'~'.expand("<slnum>")) +" call Decho("set up s:machine<".s:machine.">",'~'.expand("<slnum>")) +" call Decho("set up s:port <".s:port.">",'~'.expand("<slnum>")) +" call Decho("set up s:path <".s:path .">",'~'.expand("<slnum>")) +" call Decho("set up s:fname <".s:fname .">",'~'.expand("<slnum>")) " call Dret("s:RemotePathAnalysis") endfun @@ -10954,7 +11388,7 @@ endfun " Returns status " Runs system() on " [cd REMOTEDIRPATH;] a:cmd -" Note that it doesn't do shellescape(a:cmd)! +" Note that it doesn't do s:ShellEscape(a:cmd)! fun! s:RemoteSystem(cmd) " call Dfunc("s:RemoteSystem(cmd<".a:cmd.">)") if !executable(g:netrw_ssh_cmd) @@ -10965,12 +11399,12 @@ fun! s:RemoteSystem(cmd) let cmd = s:MakeSshCmd(g:netrw_ssh_cmd." USEPORT HOSTNAME") let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') if remotedir != "" - let cmd= cmd.' cd '.shellescape(remotedir).";" + let cmd= cmd.' cd '.s:ShellEscape(remotedir).";" else let cmd= cmd.' ' endif let cmd= cmd.a:cmd -" call Decho("call system(".cmd.")") +" call Decho("call system(".cmd.")",'~'.expand("<slnum>")) let ret= system(cmd) endif " call Dret("s:RemoteSystem ".ret) @@ -11009,23 +11443,26 @@ endfun " is true) and a command, :Rexplore, which call this function. " " s:nbcd_curpos_{bufnr('%')} is set up by s:NetrwBrowseChgDir() +" +" s:rexposn_BUFNR used to save/restore cursor position fun! s:NetrwRexplore(islocal,dirname) if exists("s:netrwdrag") return endif " call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir.">") -" call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">") +" call Decho("currently in bufname<".bufname("%").">",'~'.expand("<slnum>")) +" call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">",'~'.expand("<slnum>")) if &ft == "netrw" && exists("w:netrw_rexfile") && w:netrw_rexfile != "" " a :Rex while in a netrw buffer means: edit the file in w:netrw_rexfile -" call Decho("in netrw buffer, will edit file<".w:netrw_rexfile.">") +" call Decho("in netrw buffer, will edit file<".w:netrw_rexfile.">",'~'.expand("<slnum>")) exe "NetrwKeepj e ".w:netrw_rexfile unlet w:netrw_rexfile " call Dret("s:NetrwRexplore returning from netrw to buf#".bufnr("%")."<".bufname("%")."> (ft=".&ft.")") return " else " Decho -" call Decho("treating as not-netrw-buffer: ft=".&ft.((&ft == "netrw")? " == netrw" : "!= netrw")) -" call Decho("treating as not-netrw-buffer: w:netrw_rexfile<".((exists("w:netrw_rexfile"))? w:netrw_rexfile : 'n/a').">") +" call Decho("treating as not-netrw-buffer: ft=".&ft.((&ft == "netrw")? " == netrw" : "!= netrw"),'~'.expand("<slnum>")) +" call Decho("treating as not-netrw-buffer: w:netrw_rexfile<".((exists("w:netrw_rexfile"))? w:netrw_rexfile : 'n/a').">",'~'.expand("<slnum>")) endif " --------------------------- @@ -11034,43 +11471,37 @@ fun! s:NetrwRexplore(islocal,dirname) " record current file so :Rex can return to it from netrw let w:netrw_rexfile= expand("%") +" call Decho("set w:netrw_rexfile<".w:netrw_rexfile."> (win#".winnr().")",'~'.expand("<slnum>")) if !exists("w:netrw_rexlocal") " call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft.")") return endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) if w:netrw_rexlocal - if g:netrw_keepj =~ "keepj" - keepj call netrw#LocalBrowseCheck(w:netrw_rexdir) - else - call netrw#LocalBrowseCheck(w:netrw_rexdir) - endif - elseif g:netrw_keepj =~ "keepj" - keepj call s:NetrwBrowse(0,w:netrw_rexdir) + NetrwKeepj call netrw#LocalBrowseCheck(w:netrw_rexdir) else - call s:NetrwBrowse(0,w:netrw_rexdir) + NetrwKeepj call s:NetrwBrowse(0,w:netrw_rexdir) endif if exists("s:initbeval") setl beval endif if exists("s:rexposn_".bufnr("%")) -" call Decho("restore posn, then unlet s:rexposn_".bufnr('%')) - if g:netrw_keepj =~ "keepj" - keepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) - else - call netrw#RestorePosn(s:rexposn_{bufnr('%')}) +" call Decho("restore posn, then unlet s:rexposn_".bufnr('%')."<".bufname("%").">",'~'.expand("<slnum>")) + " restore position in directory listing + NetrwKeepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) + if exists("s:rexposn_".bufnr('%')) + unlet s:rexposn_{bufnr('%')} endif - unlet s:rexposn_{bufnr('%')} else -" call Decho("s:rexposn_".bufnr('%')." doesn't exist") +" call Decho("s:rexposn_".bufnr('%')."<".bufname("%")."> doesn't exist",'~'.expand("<slnum>")) endif if exists("s:explore_match") exe "2match netrwMarkFile /".s:explore_match."/" endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) " call Dret("s:NetrwRexplore : ft=".&ft) endfun @@ -11141,8 +11572,10 @@ endfun " s:SetRexDir: set directory for :Rexplore {{{2 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 + let w:netrw_rexdir = a:dirname + let w:netrw_rexlocal = a:islocal + let s:rexposn_{bufnr("%")} = netrw#SavePosn() +" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>")) " call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) endfun @@ -11150,22 +11583,23 @@ endfun " s:ShowLink: used to modify thin and tree listings to show links {{{2 fun! s:ShowLink() " " call Dfunc("s:ShowLink()") -" " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">") -" " call Decho(printf("line#%4d: %s",line("."),getline("."))) +" " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("<slnum>")) +" " call Decho(printf("line#%4d: %s",line("."),getline(".")),'~'.expand("<slnum>")) if exists("b:netrw_curdir") norm! $?\a let fname = b:netrw_curdir.'/'.s:NetrwGetWord() let resname = resolve(fname) - if resname =~ '^\M'.b:netrw_curdir +" " call Decho("fname <".fname.">",'~'.expand("<slnum>")) +" " call Decho("resname <".resname.">",'~'.expand("<slnum>")) +" " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>")) + if resname =~ '^\M'.b:netrw_curdir.'/' let dirlen = strlen(b:netrw_curdir) let resname = strpart(resname,dirlen+1) -" " call Decho("resname<".resname."> (b:netrw_curdir elided)") -" " else " Decho -" " call Decho("resname<".fname.">") +" " call Decho("resname<".resname."> (b:netrw_curdir elided)",'~'.expand("<slnum>")) endif let modline = getline(".")."\t --> ".resname -" " call Decho("fname <".fname.">") -" " call Decho("modline<".modline.">") +" " call Decho("fname <".fname.">",'~'.expand("<slnum>")) +" " call Decho("modline<".modline.">",'~'.expand("<slnum>")) setl noro ma call setline(".",modline) setl ro noma nomod @@ -11203,22 +11637,22 @@ fun! s:Strlen(x) if v:version >= 703 && exists("*strdisplaywidth") let ret= strdisplaywidth(a:x) - + elseif type(g:Align_xstrlen) == 1 " allow user to specify a function to compute the string length (ie. let g:Align_xstrlen="mystrlenfunc") exe "let ret= ".g:Align_xstrlen."('".substitute(a:x,"'","''","g")."')" - + elseif g:Align_xstrlen == 1 " number of codepoints (Latin a + combining circumflex is two codepoints) " (comment from TM, solution from NW) let ret= strlen(substitute(a:x,'.','c','g')) - + elseif g:Align_xstrlen == 2 " number of spacing codepoints (Latin a + combining circumflex is one spacing " codepoint; a hard tab is one; wide and narrow CJK are one each; etc.) " (comment from TM, solution from TM) let ret=strlen(substitute(a:x, '.\Z', 'x', 'g')) - + elseif g:Align_xstrlen == 3 " virtual length (counting, for instance, tabs as anything between 1 and " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately @@ -11231,7 +11665,7 @@ fun! s:Strlen(x) d NetrwKeepj norm! k let &l:mod= modkeep - + else " at least give a decent default let ret= strlen(a:x) @@ -11241,6 +11675,16 @@ fun! s:Strlen(x) endfun " --------------------------------------------------------------------- +" s:ShellEscape: shellescape(), or special windows handling {{{2 +fun! s:ShellEscape(s, ...) + if (has('win32') || has('win64')) && $SHELL == '' && &shellslash + return printf('"%s"', substitute(a:s, '"', '""', 'g')) + endif + let f = a:0 > 0 ? a:1 : 0 + return shellescape(a:s, f) +endfun + +" --------------------------------------------------------------------- " s:TreeListMove: {{{2 fun! s:TreeListMove(dir) " call Dfunc("s:TreeListMove(dir<".a:dir.">)") @@ -11249,33 +11693,33 @@ fun! s:TreeListMove(dir) let nxtline = (line(".") < line("$"))? getline(line(".")+1) : '' let curindent= substitute(curline,'^\([| ]*\).\{-}$','\1','') let indentm1 = substitute(curindent,'^'.s:treedepthstring.' ','','') -" call Decho("prvline <".prvline."> #".line(".")-1) -" call Decho("curline <".curline."> #".line(".")) -" call Decho("nxtline <".nxtline."> #".line(".")+1) -" call Decho("curindent<".curindent.">") -" call Decho("indentm1 <".indentm1.">") +" call Decho("prvline <".prvline."> #".line(".")-1,'~'.expand("<slnum>")) +" call Decho("curline <".curline."> #".line("."),'~'.expand("<slnum>")) +" call Decho("nxtline <".nxtline."> #".line(".")+1,'~'.expand("<slnum>")) +" call Decho("curindent<".curindent.">",'~'.expand("<slnum>")) +" call Decho("indentm1 <".indentm1.">",'~'.expand("<slnum>")) if curline !~ '/$' -" call Decho('regfile') +" call Decho('regfile','~'.expand("<slnum>")) if a:dir == '[' && prvline != '' NetrwKeepj norm! 0 let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from regular file -" call Decho("regfile srch back: ".nl) +" call Decho("regfile srch back: ".nl,'~'.expand("<slnum>")) elseif a:dir == ']' && nxtline != '' NetrwKeepj norm! $ let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from regular file -" call Decho("regfile srch fwd: ".nl) +" call Decho("regfile srch fwd: ".nl,'~'.expand("<slnum>")) endif elseif a:dir == '[' && prvline != '' NetrwKeepj norm! 0 let curline= line(".") let nl = search('^'.curindent.'[^'.s:treedepthstring.']','bWe') " search backwards From directory, same indentation -" call Decho("dir srch back ind: ".nl) +" call Decho("dir srch back ind: ".nl,'~'.expand("<slnum>")) if nl != 0 if line(".") == curline-1 let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from directory, indentation - 1 -" call Decho("dir srch back ind-1: ".nl) +" call Decho("dir srch back ind-1: ".nl,'~'.expand("<slnum>")) endif endif @@ -11283,11 +11727,11 @@ fun! s:TreeListMove(dir) NetrwKeepj norm! $ let curline = line(".") let nl = search('^'.curindent.'[^'.s:treedepthstring.']','We') " search forwards from directory, same indentation -" call Decho("dir srch fwd ind: ".nl) +" call Decho("dir srch fwd ind: ".nl,'~'.expand("<slnum>")) if nl != 0 if line(".") == curline+1 let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from directory, indentation - 1 -" call Decho("dir srch fwd ind-1: ".nl) +" call Decho("dir srch fwd ind-1: ".nl,'~'.expand("<slnum>")) endif endif @@ -11333,6 +11777,48 @@ fun! s:UseBufWinVars() endfun " --------------------------------------------------------------------- +" s:UserMaps: supports user-defined UserMaps {{{2 +" * calls a user-supplied funcref(islocal,curdir) +" * interprets result +" See netrw#UserMaps() +fun! s:UserMaps(islocal,funcname) +" call Dfunc("s:UserMaps(islocal=".a:islocal.",funcname<".a:funcname.">)") + + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + let Funcref = function(a:funcname) + let result = Funcref(a:islocal) + + if type(result) == 1 + " if result from user's funcref is a string... +" call Decho("result string from user funcref<".result.">",'~'.expand("<slnum>")) + if result == "refresh" +" call Decho("refreshing display",'~'.expand("<slnum>")) + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + elseif result != "" +" call Decho("executing result<".result.">",'~'.expand("<slnum>")) + exe result + endif + + elseif type(result) == 3 + " if result from user's funcref is a List... +" call Decho("result List from user funcref<".string(result).">",'~'.expand("<slnum>")) + for action in result + if action == "refresh" +" call Decho("refreshing display",'~'.expand("<slnum>")) + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + elseif action != "" +" call Decho("executing action<".action.">",'~'.expand("<slnum>")) + exe action + endif + endfor + endif + +" call Dret("s:UserMaps") +endfun + +" --------------------------------------------------------------------- " Settings Restoration: {{{1 let &cpo= s:keepcpo unlet s:keepcpo diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index 6dcddfd43e..7f25d9df33 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2015 Apr 02 +" Last Change: 2015 Jul 13 " " OPTIONS: " @@ -318,7 +318,7 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ \ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') if f_name =~? '^'.substitute(a:base, '\\', '\\\\', 'g') let f_args = matchstr(i, - \ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\({\|$\)') + \ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\(;\|{\|$\)') let int_functions[f_name.'('] = f_args.')' endif endfor @@ -646,7 +646,7 @@ function! phpcomplete#CompleteUnknownClass(base, context) " {{{ let f_name = matchstr(i, \ '^&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') let f_args = matchstr(i, - \ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\({\|$\)') + \ '^&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\(;\|{\|$\)') let int_functions[f_name.'('] = f_args.')' endfor @@ -981,7 +981,7 @@ function! phpcomplete#CompleteUserClass(context, base, sccontent, visibility) " let f_name = matchstr(i, \ 'function\s*&\?\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') let f_args = matchstr(i, - \ 'function\s*&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\({\|\_$\)') + \ 'function\s*&\?[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\s*(\zs.\{-}\ze)\_s*\(;\|{\|\_$\)') if f_name != '' && stridx(f_name, '__') != 0 let c_functions[f_name.'('] = f_args if g:phpcomplete_parse_docblock_comments @@ -1379,8 +1379,8 @@ function! phpcomplete#GetCallChainReturnType(classname_candidate, class_candidat " Get Structured information of all classes and subclasses including namespace and includes " try to find the method's return type in docblock comment for classstructure in classcontents - let doclock_target_pattern = 'function\s\+&\?'.method.'\|\(public\|private\|protected\|var\).\+\$'.method - let doc_str = phpcomplete#GetDocBlock(split(classstructure.content, '\n'), doclock_target_pattern) + let docblock_target_pattern = 'function\s\+&\?'.method.'\|\(public\|private\|protected\|var\).\+\$'.method + let doc_str = phpcomplete#GetDocBlock(split(classstructure.content, '\n'), docblock_target_pattern) if doc_str != '' break endif @@ -1659,7 +1659,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " function declaration line if line =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(' - let function_lines = join(reverse(lines), " ") + let function_lines = join(reverse(copy(lines)), " ") " search for type hinted arguments if function_lines =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(.\{-}'.class_name_pattern.'\s\+'.object && !object_is_array let f_args = matchstr(function_lines, '\cfunction\(\s\+'.function_name_pattern.'\)\?\s*(\zs.\{-}\ze)') @@ -1700,10 +1700,12 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " try to find the next non-comment or string ";" char let start_col = match(line, '^\s*'.object.'\C\s*=\zs&\?\s\+\(clone\)\?\s*'.variable_name_pattern) - let filelines = reverse(lines) - let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col]) + let filelines = reverse(copy(lines)) + let [pos, char] = s:getNextCharWithPos(filelines, [len(filelines) - i, start_col]) let chars_read = 1 let last_pos = pos + " function_boundary == 0 if we are not in a function + let real_lines_offset = len(function_boundary) == 1 ? 1 : function_boundary[0][0] " read while end of the file while char != 'EOF' && chars_read < 1000 let last_pos = pos @@ -1711,7 +1713,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let chars_read += 1 " we got a candidate if char == ';' - let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name') + " pos values is relative to the function's lines, + " line 0 need to be offsetted with the line number + " where te function was started to get the line number + " in real buffer terms + let synIDName = synIDattr(synID(real_lines_offset + pos[0], pos[1] + 1, 0), 'name') " it's not a comment or string, end search if synIDName !~? 'comment\|string' break @@ -1719,7 +1725,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor endif endwhile - let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin) + let prev_context = phpcomplete#GetCurrentInstruction(real_lines_offset + last_pos[0], last_pos[1], b:phpbegin) if prev_context == '' " cannot get previous context give up return @@ -1739,13 +1745,14 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " assignment for the variable in question with a function on the right hand side if line =~# '^\s*'.object.'\s*=&\?\s*'.function_invocation_pattern - " try to find the next non-comment or string ";" char let start_col = match(line, '\C^\s*'.object.'\s*=\zs&\?\s*'.function_invocation_pattern) - let filelines = reverse(lines) - let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col]) + let filelines = reverse(copy(lines)) + let [pos, char] = s:getNextCharWithPos(filelines, [len(filelines) - i, start_col]) let chars_read = 1 let last_pos = pos + " function_boundary == 0 if we are not in a function + let real_lines_offset = len(function_boundary) == 1 ? 1 : function_boundary[0][0] " read while end of the file while char != 'EOF' && chars_read < 1000 let last_pos = pos @@ -1753,7 +1760,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let chars_read += 1 " we got a candidate if char == ';' - let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name') + " pos values is relative to the function's lines, + " line 0 need to be offsetted with the line number + " where te function was started to get the line number + " in real buffer terms + let synIDName = synIDattr(synID(real_lines_offset + pos[0], pos[1] + 1, 0), 'name') " it's not a comment or string, end search if synIDName !~? 'comment\|string' break @@ -1761,7 +1772,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor endif endwhile - let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin) + let prev_context = phpcomplete#GetCurrentInstruction(real_lines_offset + last_pos[0], last_pos[1], b:phpbegin) if prev_context == '' " cannot get previous context give up return @@ -1864,6 +1875,9 @@ function! phpcomplete#GetClassLocation(classname, namespace) " {{{ if has_key(g:php_builtin_classes, tolower(a:classname)) && (a:namespace == '' || a:namespace == '\') return 'VIMPHP_BUILTINOBJECT' endif + if has_key(g:php_builtin_interfaces, tolower(a:classname)) && (a:namespace == '' || a:namespace == '\') + return 'VIMPHP_BUILTINOBJECT' + endif if a:namespace == '' || a:namespace == '\' let search_namespace = '\' @@ -1876,7 +1890,7 @@ function! phpcomplete#GetClassLocation(classname, namespace) " {{{ let i = 1 while i < line('.') let line = getline(line('.')-i) - if line =~? '^\s*\(abstract\s\+\|final\s\+\)*\s*\(class\|interface\|trait\)\s*'.a:classname.'\(\s\+\|$\)' && tolower(current_namespace) == search_namespace + if line =~? '^\s*\(abstract\s\+\|final\s\+\)*\s*\(class\|interface\|trait\)\s*'.a:classname.'\(\s\+\|$\|{\)' && tolower(current_namespace) == search_namespace return expand('%:p') else let i += 1 @@ -2048,9 +2062,18 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam let content = join(getline(cfline, endline), "\n") " Catch extends if content =~? 'extends' - let extends_class = matchstr(content, 'class\_s\+'.a:class_name.'\_s\+extends\_s\+\zs'.class_name_pattern.'\ze') + let extends_string = matchstr(content, '\(class\|interface\)\_s\+'.a:class_name.'\_.\+extends\_s\+\zs\('.class_name_pattern.'\(,\|\_s\)*\)\+\ze\(extends\|{\)') + let extended_classes = map(split(extends_string, '\(,\|\_s\)\+'), 'substitute(v:val, "\\_s\\+", "", "g")') + else + let extended_classes = '' + endif + + " Catch implements + if content =~? 'implements' + let implements_string = matchstr(content, 'class\_s\+'.a:class_name.'\_.\+implements\_s\+\zs\('.class_name_pattern.'\(,\|\_s\)*\)\+\ze') + let implemented_interfaces = map(split(implements_string, '\(,\|\_s\)\+'), 'substitute(v:val, "\\_s\\+", "", "g")') else - let extends_class = '' + let implemented_interfaces = [] endif call searchpair('{', '', '}', 'W') let class_closing_bracket_line = line('.') @@ -2108,8 +2131,11 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam \ }) let all_extends = used_traits - if extends_class != '' - call add(all_extends, extends_class) + if len(extended_classes) > 0 + call extend(all_extends, extended_classes) + endif + if len(implemented_interfaces) > 0 + call extend(all_extends, implemented_interfaces) endif if len(all_extends) > 0 for class in all_extends @@ -2119,11 +2145,16 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam endif let classlocation = phpcomplete#GetClassLocation(class, namespace) if classlocation == "VIMPHP_BUILTINOBJECT" - let result += [phpcomplete#GenerateBuiltinClassStub(g:php_builtin_classes[tolower(class)])] + if has_key(g:php_builtin_classes, tolower(class)) + let result += [phpcomplete#GenerateBuiltinClassStub('class', g:php_builtin_classes[tolower(class)])] + endif + if has_key(g:php_builtin_interfaces, tolower(class)) + let result += [phpcomplete#GenerateBuiltinClassStub('interface', g:php_builtin_interfaces[tolower(class)])] + endif elseif classlocation != '' && filereadable(classlocation) let full_file_path = fnamemodify(classlocation, ':p') let result += phpcomplete#GetClassContentsStructure(full_file_path, readfile(full_file_path), class) - elseif tolower(current_namespace) == tolower(namespace) + elseif tolower(current_namespace) == tolower(namespace) && match(join(a:file_lines, "\n"), '\c\(class\|interface\|trait\)\_s\+'.class.'\(\>\|$\)') != -1 " try to find the declaration in the same file. let result += phpcomplete#GetClassContentsStructure(full_file_path, a:file_lines, class) endif @@ -2144,43 +2175,53 @@ function! phpcomplete#GetClassContents(classlocation, class_name) " {{{ endfunction " }}} -function! phpcomplete#GenerateBuiltinClassStub(class_info) " {{{ - let re = 'class '.a:class_info['name']." {" - for [name, initializer] in items(a:class_info.constants) - let re .= "\n\tconst ".name." = ".initializer.";" - endfor - for [name, info] in items(a:class_info.properties) - let re .= "\n\t// @var $".name." ".info.type - let re .= "\n\tpublic $".name.";" - endfor - for [name, info] in items(a:class_info.static_properties) - let re .= "\n\t// @var ".name." ".info.type - let re .= "\n\tpublic static ".name." = ".info.initializer.";" - endfor - for [name, info] in items(a:class_info.methods) - if name =~ '^__' - continue - endif - let re .= "\n\t/**" - let re .= "\n\t * ".name - let re .= "\n\t *" - let re .= "\n\t * @return ".info.return_type - let re .= "\n\t */" - let re .= "\n\tpublic function ".name."(".info.signature."){" - let re .= "\n\t}" - endfor - for [name, info] in items(a:class_info.static_methods) - let re .= "\n\t/**" - let re .= "\n\t * ".name - let re .= "\n\t *" - let re .= "\n\t * @return ".info.return_type - let re .= "\n\t */" - let re .= "\n\tpublic static function ".name."(".info.signature."){" - let re .= "\n\t}" - endfor +function! phpcomplete#GenerateBuiltinClassStub(type, class_info) " {{{ + let re = a:type.' '.a:class_info['name']." {" + if has_key(a:class_info, 'constants') + for [name, initializer] in items(a:class_info.constants) + let re .= "\n\tconst ".name." = ".initializer.";" + endfor + endif + if has_key(a:class_info, 'properties') + for [name, info] in items(a:class_info.properties) + let re .= "\n\t// @var $".name." ".info.type + let re .= "\n\tpublic $".name.";" + endfor + endif + if has_key(a:class_info, 'static_properties') + for [name, info] in items(a:class_info.static_properties) + let re .= "\n\t// @var ".name." ".info.type + let re .= "\n\tpublic static ".name." = ".info.initializer.";" + endfor + endif + if has_key(a:class_info, 'methods') + for [name, info] in items(a:class_info.methods) + if name =~ '^__' + continue + endif + let re .= "\n\t/**" + let re .= "\n\t * ".name + let re .= "\n\t *" + let re .= "\n\t * @return ".info.return_type + let re .= "\n\t */" + let re .= "\n\tpublic function ".name."(".info.signature."){" + let re .= "\n\t}" + endfor + endif + if has_key(a:class_info, 'static_methods') + for [name, info] in items(a:class_info.static_methods) + let re .= "\n\t/**" + let re .= "\n\t * ".name + let re .= "\n\t *" + let re .= "\n\t * @return ".info.return_type + let re .= "\n\t */" + let re .= "\n\tpublic static function ".name."(".info.signature."){" + let re .= "\n\t}" + endfor + endif let re .= "\n}" - return { 'class': a:class_info['name'], + return { a:type : a:class_info['name'], \ 'content': re, \ 'namespace': '', \ 'imports': {}, @@ -2204,8 +2245,11 @@ function! phpcomplete#GetDocBlock(sccontent, search) " {{{ " start backward serch for the comment block while l != 0 let line = a:sccontent[l] - " if comment end found save line position and end search - if line =~? '^\s*\*/' + " if it's a one line docblock like comment and we can just return it right away + if line =~? '^\s*\/\*\*.\+\*\/\s*$' + return substitute(line, '\v^\s*(\/\*\*\s*)|(\s*\*\/)\s*$', '', 'g') + "... or if comment end found save line position and end search + elseif line =~? '^\s*\*/' let comment_end = l break " ... or the line doesn't blank (only whitespace or nothing) end search @@ -2227,6 +2271,7 @@ function! phpcomplete#GetDocBlock(sccontent, search) " {{{ endif let l -= 1 endwhile + " no docblock comment start found if comment_start == -1 return '' @@ -2388,7 +2433,15 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ break endif let block_end_pos = searchpairpos('{', '', '}\|\%$', 'W', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"') - silent! exec block_start_pos[0].','.block_end_pos[0].'d' + + if block_end_pos != [0, 0] + " end of the block found, just delete it + silent! exec block_start_pos[0].','.block_end_pos[0].'d _' + else + " block pair not found, use block start as beginning and the end + " of the buffer instead + silent! exec block_start_pos[0].',$d _' + endif endwhile normal! G @@ -2407,8 +2460,8 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ while i < file_length let line = file_lines[i] - if line =~? '^\s*namespace\s*'.namespace_name_pattern - let current_namespace = matchstr(line, '\c^\s*namespace\s*\zs'.namespace_name_pattern.'\ze') + if line =~? '^\(<?php\)\?\s*namespace\s*'.namespace_name_pattern + let current_namespace = matchstr(line, '\c^\(<?php\)\?\s*namespace\s*\zs'.namespace_name_pattern.'\ze') break endif @@ -2571,7 +2624,7 @@ endfunction function! phpcomplete#ExpandClassName(classname, current_namespace, imports) " {{{ " if there's an imported class, just use that class's information - if has_key(a:imports, a:classname) && (a:imports[a:classname].kind == 'c' || a:imports[a:classname].kind == 'i') + if has_key(a:imports, a:classname) && (a:imports[a:classname].kind == 'c' || a:imports[a:classname].kind == 'i' || a:imports[a:classname].kind == 't') let namespace = has_key(a:imports[a:classname], 'namespace') ? a:imports[a:classname].namespace : '' return [a:imports[a:classname].name, namespace] endif diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 5ea9df92fe..c7cb14ded7 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -47,6 +47,16 @@ elseif exists('$DISPLAY') && executable('xclip') let s:paste['+'] = 'xclip -o -selection clipboard' let s:copy['*'] = 'xclip -quiet -i -selection primary' let s:paste['*'] = 'xclip -o -selection primary' +elseif executable('lemonade') + let s:copy['+'] = 'lemonade copy' + let s:paste['+'] = 'lemonade paste' + let s:copy['*'] = 'lemonade copy' + let s:paste['*'] = 'lemonade paste' +elseif executable('doitclient') + let s:copy['+'] = 'doitclient wclip' + let s:paste['+'] = 'doitclient wclip -r' + let s:copy['*'] = s:copy['+'] + let s:paste['*'] = s:paste['+'] else echom 'clipboard: No clipboard tool available. See :help nvim-clipboard' finish diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim index b769895357..cb9d5c5296 100644 --- a/runtime/autoload/provider/python.vim +++ b/runtime/autoload/provider/python.vim @@ -24,12 +24,10 @@ if s:prog == '' finish endif -let s:plugin_path = expand('<sfile>:p:h').'/script_host.py' - " The Python provider plugin will run in a separate instance of the Python " host. call remote#host#RegisterClone('legacy-python-provider', 'python') -call remote#host#RegisterPlugin('legacy-python-provider', s:plugin_path, []) +call remote#host#RegisterPlugin('legacy-python-provider', 'script_host.py', []) function! provider#python#Call(method, args) if s:err != '' diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim index 2952f76b40..f4a751e7a2 100644 --- a/runtime/autoload/provider/python3.vim +++ b/runtime/autoload/provider/python3.vim @@ -24,12 +24,10 @@ if s:prog == '' finish endif -let s:plugin_path = expand('<sfile>:p:h').'/script_host.py' - " The Python3 provider plugin will run in a separate instance of the Python3 " host. call remote#host#RegisterClone('legacy-python3-provider', 'python3') -call remote#host#RegisterPlugin('legacy-python3-provider', s:plugin_path, []) +call remote#host#RegisterPlugin('legacy-python3-provider', 'script_host.py', []) function! provider#python3#Call(method, args) if s:err != '' diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index 022ef19914..c3256e8308 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -5,6 +5,32 @@ endif let s:loaded_pythonx_provider = 1 +function! provider#pythonx#Require(host) abort + let ver = (a:host.orig_name ==# 'python') ? 2 : 3 + + " Python host arguments + let args = ['-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()'] + + " Collect registered Python plugins into args + let python_plugins = remote#host#PluginsForHost(a:host.name) + for plugin in python_plugins + call add(args, plugin.path) + endfor + + try + let channel_id = rpcstart((ver ==# '2' ? + \ provider#python#Prog() : provider#python3#Prog()), args) + if rpcrequest(channel_id, 'poll') ==# 'ok' + return channel_id + endif + catch + echomsg v:throwpoint + echomsg v:exception + endtry + throw remote#host#LoadErrorForHost(a:host.orig_name, + \ '$NVIM_PYTHON_LOG_FILE') +endfunction + function! provider#pythonx#Detect(major_ver) abort let host_var = (a:major_ver == 2) ? \ 'g:python_host_prog' : 'g:python3_host_prog' @@ -44,7 +70,7 @@ endfunction function! s:check_interpreter(prog, major_ver, skip) abort let prog_path = exepath(a:prog) - if prog_path == '' + if prog_path ==# '' return [0, a:prog . ' not found in search path or not executable.'] endif @@ -57,8 +83,8 @@ function! s:check_interpreter(prog, major_ver, skip) abort " Try to load neovim module, and output Python version. " Return codes: " 0 Neovim module can be loaded. - " 1 Something else went wrong. " 2 Neovim module cannot be loaded. + " Otherwise something else went wrong (e.g. 1 or 127). let prog_ver = system([ a:prog , '-c' , \ 'import sys; ' . \ 'sys.path.remove(""); ' . @@ -67,7 +93,8 @@ function! s:check_interpreter(prog, major_ver, skip) abort \ 'exit(2*int(pkgutil.get_loader("neovim") is None))' \ ]) - if prog_ver + if v:shell_error == 2 || v:shell_error == 0 + " Check version only for expected return codes. if prog_ver !~ '^' . a:major_ver return [0, prog_path . ' is Python ' . prog_ver . ' and cannot provide Python ' \ . a:major_ver . '.'] @@ -77,12 +104,16 @@ function! s:check_interpreter(prog, major_ver, skip) abort endif endif - if v:shell_error == 1 - return [0, 'Checking ' . prog_path . ' caused an unknown error. ' - \ . 'Please report this at github.com/neovim/neovim.'] - elseif v:shell_error == 2 - return [0, prog_path . ' does have not have the neovim module installed. ' + if v:shell_error == 2 + return [0, prog_path . ' does not have the neovim module installed. ' \ . 'See ":help nvim-python".'] + elseif v:shell_error == 127 + " This can happen with pyenv's shims. + return [0, prog_path . ' does not exist: ' . prog_ver] + elseif v:shell_error + return [0, 'Checking ' . prog_path . ' caused an unknown error. ' + \ . '(' . v:shell_error . ', output: ' . prog_ver . ')' + \ . ' Please report this at github.com/neovim/neovim.'] endif return [1, ''] diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim new file mode 100644 index 0000000000..aad8c09d28 --- /dev/null +++ b/runtime/autoload/provider/ruby.vim @@ -0,0 +1,34 @@ +" The Ruby provider helper +if exists('s:loaded_ruby_provider') + finish +endif + +let s:loaded_ruby_provider = 1 + +function! provider#ruby#Require(host) abort + " Collect registered Ruby plugins into args + let args = [] + let ruby_plugins = remote#host#PluginsForHost(a:host.name) + + for plugin in ruby_plugins + call add(args, plugin.path) + endfor + + try + let channel_id = rpcstart(provider#ruby#Prog(), args) + + if rpcrequest(channel_id, 'poll') == 'ok' + return channel_id + endif + catch + echomsg v:throwpoint + echomsg v:exception + endtry + + throw remote#host#LoadErrorForHost(a:host.orig_name, + \ '$NVIM_RUBY_LOG_FILE') +endfunction + +function! provider#ruby#Prog() abort + return 'neovim-ruby-host' +endfunction diff --git a/runtime/autoload/provider/script_host.py b/runtime/autoload/provider/script_host.py deleted file mode 100644 index 416b4070bb..0000000000 --- a/runtime/autoload/provider/script_host.py +++ /dev/null @@ -1,247 +0,0 @@ -"""Legacy python/python3-vim emulation.""" -import imp -import io -import logging -import os -import sys - -import neovim - -__all__ = ('ScriptHost',) - - -logger = logging.getLogger(__name__) -debug, info, warn = (logger.debug, logger.info, logger.warn,) - -IS_PYTHON3 = sys.version_info >= (3, 0) - -if IS_PYTHON3: - basestring = str - - if sys.version_info >= (3, 4): - from importlib.machinery import PathFinder - - -@neovim.plugin -class ScriptHost(object): - - """Provides an environment for running python plugins created for Vim.""" - - def __init__(self, nvim): - """Initialize the legacy python-vim environment.""" - self.setup(nvim) - # context where all code will run - self.module = imp.new_module('__main__') - nvim.script_context = self.module - # it seems some plugins assume 'sys' is already imported, so do it now - exec('import sys', self.module.__dict__) - self.legacy_vim = nvim.with_hook(LegacyEvalHook()) - sys.modules['vim'] = self.legacy_vim - - def setup(self, nvim): - """Setup import hooks and global streams. - - This will add import hooks for importing modules from runtime - directories and patch the sys module so 'print' calls will be - forwarded to Nvim. - """ - self.nvim = nvim - info('install import hook/path') - self.hook = path_hook(nvim) - sys.path_hooks.append(self.hook) - nvim.VIM_SPECIAL_PATH = '_vim_path_' - sys.path.append(nvim.VIM_SPECIAL_PATH) - info('redirect sys.stdout and sys.stderr') - self.saved_stdout = sys.stdout - self.saved_stderr = sys.stderr - sys.stdout = RedirectStream(lambda data: nvim.out_write(data)) - sys.stderr = RedirectStream(lambda data: nvim.err_write(data)) - - def teardown(self): - """Restore state modified from the `setup` call.""" - for plugin in self.installed_plugins: - if hasattr(plugin, 'on_teardown'): - plugin.teardown() - nvim = self.nvim - info('uninstall import hook/path') - sys.path.remove(nvim.VIM_SPECIAL_PATH) - sys.path_hooks.remove(self.hook) - info('restore sys.stdout and sys.stderr') - sys.stdout = self.saved_stdout - sys.stderr = self.saved_stderr - - @neovim.rpc_export('python_execute', sync=True) - def python_execute(self, script, range_start, range_stop): - """Handle the `python` ex command.""" - self._set_current_range(range_start, range_stop) - exec(script, self.module.__dict__) - - @neovim.rpc_export('python_execute_file', sync=True) - def python_execute_file(self, file_path, range_start, range_stop): - """Handle the `pyfile` ex command.""" - self._set_current_range(range_start, range_stop) - with open(file_path) as f: - script = compile(f.read(), file_path, 'exec') - exec(script, self.module.__dict__) - - @neovim.rpc_export('python_do_range', sync=True) - def python_do_range(self, start, stop, code): - """Handle the `pydo` ex command.""" - self._set_current_range(start, stop) - nvim = self.nvim - start -= 1 - stop -= 1 - fname = '_vim_pydo' - - # define the function - function_def = 'def %s(line, linenr):\n %s' % (fname, code,) - exec(function_def, self.module.__dict__) - # get the function - function = self.module.__dict__[fname] - while start <= stop: - # Process batches of 5000 to avoid the overhead of making multiple - # API calls for every line. Assuming an average line length of 100 - # bytes, approximately 488 kilobytes will be transferred per batch, - # which can be done very quickly in a single API call. - sstart = start - sstop = min(start + 5000, stop) - lines = nvim.current.buffer.get_line_slice(sstart, sstop, True, - True) - - exception = None - newlines = [] - linenr = sstart + 1 - for i, line in enumerate(lines): - result = function(line, linenr) - if result is None: - # Update earlier lines, and skip to the next - if newlines: - end = sstart + len(newlines) - 1 - nvim.current.buffer.set_line_slice(sstart, end, - True, True, - newlines) - sstart += len(newlines) + 1 - newlines = [] - pass - elif isinstance(result, basestring): - newlines.append(result) - else: - exception = TypeError('pydo should return a string ' + - 'or None, found %s instead' - % result.__class__.__name__) - break - linenr += 1 - - start = sstop + 1 - if newlines: - end = sstart + len(newlines) - 1 - nvim.current.buffer.set_line_slice(sstart, end, True, True, - newlines) - if exception: - raise exception - # delete the function - del self.module.__dict__[fname] - - @neovim.rpc_export('python_eval', sync=True) - def python_eval(self, expr): - """Handle the `pyeval` vim function.""" - return eval(expr, self.module.__dict__) - - def _set_current_range(self, start, stop): - current = self.legacy_vim.current - current.range = current.buffer.range(start, stop) - - -class RedirectStream(io.IOBase): - def __init__(self, redirect_handler): - self.redirect_handler = redirect_handler - - def write(self, data): - self.redirect_handler(data) - - def writelines(self, seq): - self.redirect_handler('\n'.join(seq)) - - -class LegacyEvalHook(neovim.SessionHook): - - """Injects legacy `vim.eval` behavior to a Nvim instance.""" - - def __init__(self): - super(LegacyEvalHook, self).__init__(from_nvim=self._string_eval) - - def _string_eval(self, obj, session, method, kind): - if method == 'vim_eval': - if IS_PYTHON3: - if isinstance(obj, (int, float)): - return str(obj) - elif isinstance(obj, (int, long, float)): - return str(obj) - return obj - - -# This was copied/adapted from nvim-python help -def path_hook(nvim): - def _get_paths(): - return discover_runtime_directories(nvim) - - def _find_module(fullname, oldtail, path): - idx = oldtail.find('.') - if idx > 0: - name = oldtail[:idx] - tail = oldtail[idx+1:] - fmr = imp.find_module(name, path) - module = imp.find_module(fullname[:-len(oldtail)] + name, *fmr) - return _find_module(fullname, tail, module.__path__) - else: - return imp.find_module(fullname, path) - - class VimModuleLoader(object): - def __init__(self, module): - self.module = module - - def load_module(self, fullname, path=None): - # Check sys.modules, required for reload (see PEP302). - if fullname in sys.modules: - return sys.modules[fullname] - return imp.load_module(fullname, *self.module) - - class VimPathFinder(object): - @staticmethod - def find_module(fullname, path=None): - "Method for Python 2.7 and 3.3." - try: - return VimModuleLoader( - _find_module(fullname, fullname, path or _get_paths())) - except ImportError: - return None - - @staticmethod - def find_spec(fullname, path=None, target=None): - "Method for Python 3.4+." - return PathFinder.find_spec(fullname, path or _get_paths(), target) - - def hook(path): - if path == nvim.VIM_SPECIAL_PATH: - return VimPathFinder - else: - raise ImportError - - return hook - - -def discover_runtime_directories(nvim): - rv = [] - for path in nvim.list_runtime_paths(): - if not os.path.exists(path): - continue - path1 = os.path.join(path, 'pythonx') - if IS_PYTHON3: - path2 = os.path.join(path, 'python3') - else: - path2 = os.path.join(path, 'python2') - if os.path.exists(path1): - rv.append(path1) - if os.path.exists(path2): - rv.append(path2) - return rv diff --git a/runtime/autoload/python3complete.vim b/runtime/autoload/python3complete.vim index b02200be7f..f0f3aaddb3 100644 --- a/runtime/autoload/python3complete.vim +++ b/runtime/autoload/python3complete.vim @@ -1,7 +1,7 @@ "python3complete.vim - Omni Completion for python " Maintainer: Aaron Griffin <aaronmgriffin@gmail.com> " Version: 0.9 -" Last Updated: 18 Jun 2009 +" Last Updated: 18 Jun 2009 (small fix 2015 Sep 14 from Debian) " " Roland Puntaier: this file contains adaptations for python3 and is parallel to pythoncomplete.vim " @@ -359,6 +359,7 @@ class PyParser: def __init__(self): self.top = Scope('global',0) self.scope = self.top + self.parserline = 0 def _parsedotname(self,pre=None): #returns (dottedname, nexttoken) diff --git a/runtime/autoload/pythoncomplete.vim b/runtime/autoload/pythoncomplete.vim index 57add71cbd..ecc36646d9 100644 --- a/runtime/autoload/pythoncomplete.vim +++ b/runtime/autoload/pythoncomplete.vim @@ -377,6 +377,7 @@ class PyParser: def __init__(self): self.top = Scope('global',0) self.scope = self.top + self.parserline = 0 def _parsedotname(self,pre=None): #returns (dottedname, nexttoken) diff --git a/runtime/autoload/remote/define.vim b/runtime/autoload/remote/define.vim index dd2482998d..b04a5d2280 100644 --- a/runtime/autoload/remote/define.vim +++ b/runtime/autoload/remote/define.vim @@ -1,7 +1,7 @@ function! remote#define#CommandOnHost(host, method, sync, name, opts) let prefix = '' - if has_key(a:opts, 'range') + if has_key(a:opts, 'range') if a:opts.range == '' || a:opts.range == '%' " -range or -range=%, pass the line range in a list let prefix = '<line1>,<line2>' @@ -30,7 +30,7 @@ function! remote#define#CommandOnHost(host, method, sync, name, opts) exe s:GetCommandPrefix(a:name, a:opts) \ .' call remote#define#CommandBootstrap("'.a:host.'"' \ . ', "'.a:method.'"' - \ . ', "'.a:sync.'"' + \ . ', '.string(a:sync) \ . ', "'.a:name.'"' \ . ', '.string(a:opts).'' \ . ', "'.join(forward_args, '').'"' @@ -94,7 +94,7 @@ function! remote#define#AutocmdOnHost(host, method, sync, name, opts) let bootstrap_def = s:GetAutocmdPrefix(a:name, a:opts) \ .' call remote#define#AutocmdBootstrap("'.a:host.'"' \ . ', "'.a:method.'"' - \ . ', "'.a:sync.'"' + \ . ', '.string(a:sync) \ . ', "'.a:name.'"' \ . ', '.string(a:opts).'' \ . ', "'.escape(forward, '"').'"' @@ -133,7 +133,7 @@ function! remote#define#FunctionOnHost(host, method, sync, name, opts) exe 'autocmd! '.group.' FuncUndefined '.a:name \ .' call remote#define#FunctionBootstrap("'.a:host.'"' \ . ', "'.a:method.'"' - \ . ', "'.a:sync.'"' + \ . ', '.string(a:sync) \ . ', "'.a:name.'"' \ . ', '.string(a:opts) \ . ', "'.group.'"' @@ -157,6 +157,9 @@ endfunction function! remote#define#FunctionOnChannel(channel, method, sync, name, opts) let rpcargs = [a:channel, '"'.a:method.'"', 'a:000'] + if has_key(a:opts, 'range') + call add(rpcargs, '[a:firstline, a:lastline]') + endif call s:AddEval(rpcargs, a:opts) let function_def = s:GetFunctionPrefix(a:name, a:opts) @@ -187,7 +190,7 @@ let s:next_gid = 1 function! s:GetNextAutocmdGroup() let gid = s:next_gid let s:next_gid += 1 - + let group_name = 'RPC_DEFINE_AUTOCMD_GROUP_'.gid " Ensure the group is defined exe 'augroup '.group_name.' | augroup END' @@ -218,7 +221,11 @@ endfunction function! s:GetFunctionPrefix(name, opts) - return "function! ".a:name."(...)\n" + let res = "function! ".a:name."(...)" + if has_key(a:opts, 'range') + let res = res." range" + endif + return res."\n" endfunction diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim index d04dea180c..a63c6a923b 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -2,10 +2,11 @@ let s:hosts = {} let s:plugin_patterns = {} let s:remote_plugins_manifest = fnamemodify(expand($MYVIMRC, 1), ':h') \.'/.'.fnamemodify($MYVIMRC, ':t').'-rplugin~' +let s:plugins_for_host = {} " Register a host by associating it with a factory(funcref) -function! remote#host#Register(name, pattern, factory) +function! remote#host#Register(name, pattern, factory) abort let s:hosts[a:name] = {'factory': a:factory, 'channel': 0, 'initialized': 0} let s:plugin_patterns[a:name] = a:pattern if type(a:factory) == type(1) && a:factory @@ -19,7 +20,7 @@ endfunction " as `source`, but it will run as a different process. This can be used by " plugins that should run isolated from other plugins created for the same host " type -function! remote#host#RegisterClone(name, orig_name) +function! remote#host#RegisterClone(name, orig_name) abort if !has_key(s:hosts, a:orig_name) throw 'No host named "'.a:orig_name.'" is registered' endif @@ -34,7 +35,10 @@ endfunction " Get a host channel, bootstrapping it if necessary -function! remote#host#Require(name) +function! remote#host#Require(name) abort + if empty(s:plugins_for_host) + call remote#host#LoadRemotePlugins() + endif if !has_key(s:hosts, a:name) throw 'No host named "'.a:name.'" is registered' endif @@ -51,7 +55,7 @@ function! remote#host#Require(name) endfunction -function! remote#host#IsRunning(name) +function! remote#host#IsRunning(name) abort if !has_key(s:hosts, a:name) throw 'No host named "'.a:name.'" is registered' endif @@ -72,7 +76,7 @@ endfunction " " The third item in a declaration is a boolean: non zero means the command, " autocommand or function will be executed synchronously with rpcrequest. -function! remote#host#RegisterPlugin(host, path, specs) +function! remote#host#RegisterPlugin(host, path, specs) abort let plugins = remote#host#PluginsForHost(a:host) for plugin in plugins @@ -116,19 +120,27 @@ function! remote#host#RegisterPlugin(host, path, specs) endfunction -function! remote#host#LoadRemotePlugins() +function! remote#host#LoadRemotePlugins() abort if filereadable(s:remote_plugins_manifest) exe 'source '.s:remote_plugins_manifest endif endfunction -function! s:RegistrationCommands(host) +function! remote#host#LoadRemotePluginsEvent(event, pattern) abort + autocmd! nvim-rplugin + call remote#host#LoadRemotePlugins() + execute 'silent doautocmd <nomodeline>' a:event a:pattern +endfunction + + +function! s:RegistrationCommands(host) abort " Register a temporary host clone for discovering specs let host_id = a:host.'-registration-clone' call remote#host#RegisterClone(host_id, a:host) let pattern = s:plugin_patterns[a:host] let paths = globpath(&rtp, 'rplugin/'.a:host.'/'.pattern, 0, 1) + let paths = map(paths, 'tr(v:val,"\\","/")') " Normalize slashes #4795 if empty(paths) return [] endif @@ -138,7 +150,9 @@ function! s:RegistrationCommands(host) endfor let channel = remote#host#Require(host_id) let lines = [] + let registered = [] for path in paths + unlet! specs let specs = rpcrequest(channel, 'specs', path) if type(specs) != type([]) " host didn't return a spec list, indicates a failure while loading a @@ -151,9 +165,10 @@ function! s:RegistrationCommands(host) call add(lines, " \\ ".string(spec).",") endfor call add(lines, " \\ ])") + call add(registered, path) endfor echomsg printf("remote/host: %s host registered plugins %s", - \ a:host, string(map(copy(paths), "fnamemodify(v:val, ':t')"))) + \ a:host, string(map(registered, "fnamemodify(v:val, ':t')"))) " Delete the temporary host clone call rpcstop(s:hosts[host_id].channel) @@ -163,7 +178,7 @@ function! s:RegistrationCommands(host) endfunction -function! s:UpdateRemotePlugins() +function! remote#host#UpdateRemotePlugins() abort let commands = [] let hosts = keys(s:hosts) for host in hosts @@ -180,14 +195,12 @@ function! s:UpdateRemotePlugins() endif endfor call writefile(commands, s:remote_plugins_manifest) + echomsg printf('remote/host: generated the manifest file in "%s"', + \ s:remote_plugins_manifest) endfunction -command! UpdateRemotePlugins call s:UpdateRemotePlugins() - - -let s:plugins_for_host = {} -function! remote#host#PluginsForHost(host) +function! remote#host#PluginsForHost(host) abort if !has_key(s:plugins_for_host, a:host) let s:plugins_for_host[a:host] = [] end @@ -195,40 +208,25 @@ function! remote#host#PluginsForHost(host) endfunction -" Registration of standard hosts - -" Python/Python3 {{{ -function! s:RequirePythonHost(host) - let ver = (a:host.orig_name ==# 'python') ? 2 : 3 - - " Python host arguments - let args = ['-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()'] - - " Collect registered Python plugins into args - let python_plugins = remote#host#PluginsForHost(a:host.name) - for plugin in python_plugins - call add(args, plugin.path) - endfor - - try - let channel_id = rpcstart((ver == '2' ? - \ provider#python#Prog() : provider#python3#Prog()), args) - if rpcrequest(channel_id, 'poll') == 'ok' - return channel_id - endif - catch - echomsg v:throwpoint - echomsg v:exception - endtry - throw 'Failed to load '. a:host.orig_name . ' host. '. +function! remote#host#LoadErrorForHost(host, log) abort + return 'Failed to load '. a:host . ' host. '. \ 'You can try to see what happened '. \ 'by starting Neovim with the environment variable '. - \ '$NVIM_PYTHON_LOG_FILE set to a file and opening '. - \ 'the generated log file. Also, the host stderr will be available '. + \ a:log . ' set to a file and opening the generated '. + \ 'log file. Also, the host stderr will be available '. \ 'in Neovim log, so it may contain useful information. '. \ 'See also ~/.nvimlog.' endfunction -call remote#host#Register('python', '*.py', function('s:RequirePythonHost')) -call remote#host#Register('python3', '*.py', function('s:RequirePythonHost')) -" }}} + +" Registration of standard hosts + +" Python/Python3 +call remote#host#Register('python', '*', + \ function('provider#pythonx#Require')) +call remote#host#Register('python3', '*', + \ function('provider#pythonx#Require')) + +" Ruby +call remote#host#Register('ruby', '*.rb', + \ function('provider#ruby#Require')) diff --git a/runtime/autoload/spellfile.vim b/runtime/autoload/spellfile.vim index c32dd5df9b..a5ffa514ea 100644 --- a/runtime/autoload/spellfile.vim +++ b/runtime/autoload/spellfile.vim @@ -1,6 +1,4 @@ " Vim script to download a missing spell file -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Jan 08 if !exists('g:spellfile_URL') " Prefer using http:// when netrw should be able to use it, since @@ -43,22 +41,23 @@ function! spellfile#LoadFile(lang) if len(dirlist) == 0 let dir_to_create = spellfile#WritableSpellDir() if &verbose || dir_to_create != '' - echomsg 'spellfile#LoadFile(): There is no writable spell directory.' + echomsg 'spellfile#LoadFile(): No (writable) spell directory found.' endif if dir_to_create != '' - if confirm("Shall I create " . dir_to_create, "&Yes\n&No", 2) == 1 - " After creating the directory it should show up in the list. - call mkdir(dir_to_create, "p") - let [dirlist, dirchoices] = spellfile#GetDirChoices() - endif + call mkdir(dir_to_create, "p") + " Now it should show up in the list. + let [dirlist, dirchoices] = spellfile#GetDirChoices() endif if len(dirlist) == 0 + echomsg 'Failed to create: '.dir_to_create return + else + echomsg 'Created '.dir_to_create endif endif - let msg = 'Cannot find spell file for "' . a:lang . '" in ' . &enc - let msg .= "\nDo you want me to try downloading it?" + let msg = 'No spell file for "' . a:lang . '" in ' . &enc + let msg .= "\nDownload it?" if confirm(msg, "&Yes\n&No", 2) == 1 let enc = &encoding if enc == 'iso-8859-15' @@ -78,78 +77,77 @@ function! spellfile#LoadFile(lang) " Careful: Nread() may have opened a new window for the error message, " we need to go back to our own buffer and window. if newbufnr != winbufnr(0) - let winnr = bufwinnr(newbufnr) - if winnr == -1 - " Our buffer has vanished!? Open a new window. - echomsg "download buffer disappeared, opening a new one" - new - setlocal bin fenc= - else - exe winnr . "wincmd w" - endif + let winnr = bufwinnr(newbufnr) + if winnr == -1 + " Our buffer has vanished!? Open a new window. + echomsg "download buffer disappeared, opening a new one" + new + setlocal bin fenc= + else + exe winnr . "wincmd w" + endif endif if newbufnr == winbufnr(0) - " We are back the old buffer, remove any (half-finished) download. - g/^/d + " We are back the old buffer, remove any (half-finished) download. + g/^/d_ else - let newbufnr = winbufnr(0) + let newbufnr = winbufnr(0) endif let fname = a:lang . '.ascii.spl' echo 'Could not find it, trying ' . fname . '...' call spellfile#Nread(fname) if getline(2) !~ 'VIMspell' - echo 'Sorry, downloading failed' - exe newbufnr . "bwipe!" - return + echo 'Download failed' + exe newbufnr . "bwipe!" + return endif endif " Delete the empty first line and mark the file unmodified. - 1d + 1d_ set nomod - let msg = "In which directory do you want to write the file:" - for i in range(len(dirlist)) - let msg .= "\n" . (i + 1) . '. ' . dirlist[i] - endfor - let dirchoice = confirm(msg, dirchoices) - 2 + if len(dirlist) == 1 + let dirchoice = 0 + else + let msg = "In which directory do you want to write the file:" + for i in range(len(dirlist)) + let msg .= "\n" . (i + 1) . '. ' . dirlist[i] + endfor + let dirchoice = confirm(msg, dirchoices) - 2 + endif if dirchoice >= 0 if exists('*fnameescape') - let dirname = fnameescape(dirlist[dirchoice]) + let dirname = fnameescape(dirlist[dirchoice]) else - let dirname = escape(dirlist[dirchoice], ' ') + let dirname = escape(dirlist[dirchoice], ' ') endif setlocal fenc= exe "write " . dirname . '/' . fname - " Also download the .sug file, if the user wants to. - let msg = "Do you want me to try getting the .sug file?\n" - let msg .= "This will improve making suggestions for spelling mistakes,\n" - let msg .= "but it uses quite a bit of memory." - if confirm(msg, "&No\n&Yes") == 2 - g/^/d - let fname = substitute(fname, '\.spl$', '.sug', '') - echo 'Downloading ' . fname . '...' - call spellfile#Nread(fname) - if getline(2) =~ 'VIMsug' - 1d - exe "write " . dirname . '/' . fname - set nomod - else - echo 'Sorry, downloading failed' - " Go back to our own buffer/window, Nread() may have taken us to - " another window. - if newbufnr != winbufnr(0) - let winnr = bufwinnr(newbufnr) - if winnr != -1 - exe winnr . "wincmd w" - endif - endif - if newbufnr == winbufnr(0) - set nomod - endif - endif + " Also download the .sug file. + g/^/d_ + let fname = substitute(fname, '\.spl$', '.sug', '') + echo 'Downloading ' . fname . '...' + call spellfile#Nread(fname) + if getline(2) =~ 'VIMsug' + 1d_ + exe "write " . dirname . '/' . fname + set nomod + else + echo 'Download failed' + " Go back to our own buffer/window, Nread() may have taken us to + " another window. + if newbufnr != winbufnr(0) + let winnr = bufwinnr(newbufnr) + if winnr != -1 + exe winnr . "wincmd w" + endif + endif + if newbufnr == winbufnr(0) + set nomod + endif endif endif diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim index 5cb23a6146..d972ad63fe 100644 --- a/runtime/autoload/tohtml.vim +++ b/runtime/autoload/tohtml.vim @@ -1,6 +1,6 @@ " Vim autoload file for the tohtml plugin. " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2013 Jun 19 +" Last Change: 2013 Sep 03 " " Additional contributors: " @@ -302,7 +302,7 @@ func! tohtml#Convert2HTML(line1, line2) "{{{ else "{{{ let win_list = [] let buf_list = [] - windo | if &diff | call add(win_list, winbufnr(0)) | endif + windo if &diff | call add(win_list, winbufnr(0)) | endif let s:settings.whole_filler = 1 let g:html_diff_win_num = 0 for window in win_list diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt new file mode 100644 index 0000000000..ca79465e0d --- /dev/null +++ b/runtime/doc/api.txt @@ -0,0 +1,99 @@ +*api.txt* For Nvim. {Nvim} + + + NVIM REFERENCE MANUAL by Thiago de Arruda + +The C API of Nvim *nvim-api* + +1. Introduction |nvim-api-intro| +2. API Types |nvim-api-types| +3. API metadata |nvim-api-metadata| +4. Buffer highlighting |nvim-api-highlights| + +============================================================================== +1. Introduction *nvim-api-intro* + +Nvim defines a C API as the primary way for external code to interact with +the NVim core. In the present version of Nvim the API is primarily used by +external processes to interact with Nvim using the msgpack-rpc protocol, see +|msgpack-rpc|. The API will also be used from vimscript to access new Nvim core +features, but this is not implemented yet. Later on, Nvim might be embeddable +in C applications as libnvim, and the application will then control the +embedded instance by calling the C API directly. + +============================================================================== +2. API Types *nvim-api-types* + +Nvim's C API uses custom types for all functions. Some are just typedefs +around C99 standard types, and some are Nvim defined data structures. + +Boolean -> bool +Integer (signed 64-bit integer) -> int64_t +Float (IEEE 754 double precision) -> double +String -> {char* data, size_t size} struct + +Additionally, the following data structures are defined: + +Array +Dictionary +Object + +The following handle types are defined as integer typedefs, but are +discriminated as separate types in an Object: + +Buffer -> enum value kObjectTypeBuffer +Window -> enum value kObjectTypeWindow +Tabpage -> enum value kObjectTypeTabpage + +============================================================================== +3. API metadata *nvim-api-metadata* + +Nvim exposes metadata about the API as a Dictionary with the following keys: + +functions calling signature of the API functions +types The custom handle types defined by Nvim +error_types The possible kinds of errors an API function can exit with. + +This metadata is mostly useful for external programs accessing the api over +msgpack-api, see |msgpack-rpc-api|. + +============================================================================== +4. Buffer highlighting *nvim-api-highlights* + +Nvim allows plugins to add position-based highlights to buffers. This is +similar to |matchaddpos()| but with some key differences. The added highlights +are associated with a buffer and adapts to line insertions and deletions, +similar to signs. It is also possible to manage a set of highlights as a group +and delete or replace all at once. + +The intended use case are linter or semantic highlighter plugins that monitor +a buffer for changes, and in the background compute highlights to the buffer. +Another use case are plugins that show output in an append-only buffer, and +want to add highlights to the outputs. Highlight data cannot be preserved +on writing and loading a buffer to file, nor in undo/redo cycles. + +Highlights are registered using the |buffer_add_highlight| function, see the +generated API documentation for details. If an external highlighter plugin is +adding a large number of highlights in a batch, performance can be improved by +calling |buffer_add_highlight| as an asynchronous notification, after first +(synchronously) reqesting a source id. Here is an example using wrapper +functions in the python client: +> + src = vim.new_highlight_source() + + buf = vim.current.buffer + for i in range(5): + buf.add_highlight("String",i,0,-1,src_id=src) + + # some time later + + buf.clear_highlight(src) +< +If the highlights don't need to be deleted or updated, just pass -1 as +src_id (this is the default in python). |buffer_clear_highlight| can be used +to clear highligts from a specific source, in a specific line range or the +entire buffer by passing in the line range 0, -1 (the later is the default +in python as used above). + +============================================================================== + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index e17281821c..25ae94f784 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.4. Last change: 2015 Mar 21 +*autocmd.txt* For Vim version 7.4. Last change: 2015 Dec 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -308,6 +308,8 @@ Name triggered by ~ |InsertCharPre| when a character was typed in Insert mode, before inserting it +|TextYankPost| when some text is yanked or deleted + |TextChanged| after a change was made to the text in Normal mode |TextChangedI| after a change was made to the text in Insert mode @@ -722,6 +724,18 @@ InsertCharPre When a character is typed in Insert mode, It is not allowed to change the text |textlock|. The event is not triggered when 'paste' is set. + *TextYankPost* +TextYankPost Just after a |yank| or |deleting| command, but not + if the black hole register |quote_| is used nor + for |setreg()|. Pattern must be * because its + meaning may change in the future. + Sets these |v:event| keys: + operator + regcontents + regname + regtype + Recursion is ignored. + It is not allowed to change the text |textlock|. *InsertEnter* InsertEnter Just before starting Insert mode. Also for Replace mode and Virtual Replace mode. The @@ -756,13 +770,15 @@ OptionSet After setting an option. The pattern is it's global or local scoped and |<amatch>| indicates what option has been set. - Note: It's a bad idea, to reset an option - during this autocommand, since this will - probably break plugins. You can always use - |:noa| to prevent triggering this autocommand. - Could be used, to check for existence of the - 'backupdir' and 'undodir' options and create - directories, if they don't exist yet. + Usage example: Check for the existence of the + directory in the 'backupdir' and 'undodir' + options, create the directory if it doesn't + exist yet. + + Note: It's a bad idea to reset an option + during this autocommand, this may break a + plugin. You can always use `:noa` to prevent + triggering this autocommand. *QuickFixCmdPre* QuickFixCmdPre Before a quickfix command is run (|:make|, @@ -1086,7 +1102,7 @@ Instead of a pattern buffer-local autocommands use one of these forms: Examples: > :au CursorHold <buffer> echo 'hold' :au CursorHold <buffer=33> echo 'hold' - :au CursorHold <buffer=abuf> echo 'hold' + :au BufNewFile * au CursorHold <buffer=abuf> echo 'hold' All the commands for autocommands also work with buffer-local autocommands, simply use the special string instead of the pattern. Examples: > @@ -1145,6 +1161,9 @@ name! :aug[roup] {name} Define the autocmd group name for the following ":autocmd" commands. The name "end" or "END" selects the default group. + To avoid confusion, the name should be + different from existing {event} names, as this + most likely will not do what you intended. *:augroup-delete* *E367* :aug[roup]! {name} Delete the autocmd group {name}. Don't use diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 30b7dcaa4a..c8eb0705f6 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.4. Last change: 2015 Feb 10 +*change.txt* For Vim version 7.4. Last change: 2016 Jan 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -366,14 +366,45 @@ Adding and subtracting ~ CTRL-A Add [count] to the number or alphabetic character at or after the cursor. + *v_CTRL-A* +{Visual}CTRL-A Add [count] to the number or alphabetic character in + the highlighted text. {not in Vi} + + *v_g_CTRL-A* +{Visual}g CTRL-A Add [count] to the number or alphabetic character in + the highlighted text. If several lines are + highlighted, each one will be incremented by an + additional [count] (so effectively creating a + [count] incrementing sequence). {not in Vi} + For Example, if you have this list of numbers: + 1. ~ + 1. ~ + 1. ~ + 1. ~ + Move to the second "1." and Visually select three + lines, pressing g CTRL-A results in: + 1. ~ + 2. ~ + 3. ~ + 4. ~ + *CTRL-X* CTRL-X Subtract [count] from the number or alphabetic character at or after the cursor. -The CTRL-A and CTRL-X commands can work for: -- signed and unsigned decimal numbers -- unsigned binary, octal and hexadecimal numbers -- alphabetic characters + *v_CTRL-X* +{Visual}CTRL-X Subtract [count] from the number or alphabetic + character in the highlighted text. {not in Vi} + + *v_g_CTRL-X* +{Visual}g CTRL-X Subtract [count] from the number or alphabetic + character in the highlighted text. If several lines + are highlighted, each value will be decremented by an + additional [count] (so effectively creating a [count] + decrementing sequence). {not in Vi} + +The CTRL-A and CTRL-X commands work for (signed) decimal numbers, unsigned +binary/octal/hexadecimal numbers and alphabetic characters. This depends on the 'nrformats' option: - When 'nrformats' includes "bin", Vim assumes numbers starting with '0b' or @@ -392,7 +423,7 @@ This depends on the 'nrformats' option: index. For decimals a leading negative sign is considered for incrementing or -decrementing, for binary and octal and hex values, it won't be considered. To +decrementing, for binary, octal and hex values, it won't be considered. To ignore the sign Visually select the number before using CTRL-A or CTRL-X. For numbers with leading zeros (including all octal and hexadecimal numbers), @@ -591,9 +622,9 @@ For MS-Windows: $TMP, $TEMP, $USERPROFILE, current-dir. may add [flags], see |:s_flags|. Note that after `:substitute` the '&' flag can't be used, it's recognized as a pattern separator. - The space between `:substitute` and the 'c', 'g' and - 'r' flags isn't required, but in scripts it's a good - idea to keep it to avoid confusion. + The space between `:substitute` and the 'c', 'g', + 'i', 'I' and 'r' flags isn't required, but in scripts + it's a good idea to keep it to avoid confusion. :[range]~[&][flags] [count] *:~* Repeat last substitute with same substitute string @@ -802,6 +833,36 @@ either the first or second pattern in parentheses did not match, so either :s/\([ab]\)\|\([cd]\)/\1x/g modifies "a b c d" to "ax bx x x" < + *:sc* *:sce* *:scg* *:sci* *:scI* *:scl* *:scp* *:sg* *:sgc* + *:sge* *:sgi* *:sgI* *:sgl* *:sgn* *:sgp* *:sgr* *:sI* *:si* + *:sic* *:sIc* *:sie* *:sIe* *:sIg* *:sIl* *:sin* *:sIn* *:sIp* + *:sip* *:sIr* *:sir* *:sr* *:src* *:srg* *:sri* *:srI* *:srl* + *:srn* *:srp* +2-letter and 3-letter :substitute commands ~ + + List of :substitute commands + | c e g i I n p l r + | c :sc :sce :scg :sci :scI :scn :scp :scl --- + | e + | g :sgc :sge :sg :sgi :sgI :sgn :sgp :sgl :sgr + | i :sic :sie --- :si :siI :sin :sip --- :sir + | I :sIc :sIe :sIg :sIi :sI :sIn :sIp :sIl :sIr + | n + | p + | l + | r :src --- :srg :sri :srI :srn :srp :srl :sr + +Exceptions: + :scr is `:scriptnames` + :se is `:set` + :sig is `:sign` + :sil is `:silent` + :sn is `:snext` + :sp is `:split` + :sl is `:sleep` + :sre is `:srewind` + + Substitute with an expression *sub-replace-expression* *sub-replace-\=* *s/\=* When the substitute string starts with "\=" the remainder is interpreted as an @@ -905,7 +966,7 @@ inside of strings can change! Also see 'softtabstop' option. > :reg[isters] {arg} Display the contents of the numbered and named registers that are mentioned in {arg}. For example: > - :dis 1a + :reg 1a < to display registers '1' and 'a'. Spaces are allowed in {arg}. @@ -1071,7 +1132,7 @@ Rationale: In Vi the "y" command followed by a backwards motion would With a linewise yank command the cursor is put in the first line, but the column is unmodified, thus it may not be on the first yanked character. -There are nine types of registers: *registers* *E354* +There are ten types of registers: *registers* *E354* 1. The unnamed register "" 2. 10 numbered registers "0 to "9 3. The small delete register "- @@ -1615,7 +1676,7 @@ Vim has a sorting function and a sorting command. The sorting function can be found here: |sort()|, |uniq()|. *:sor* *:sort* -:[range]sor[t][!] [i][u][r][n][x][o][b] [/{pattern}/] +:[range]sor[t][!] [b][f][i][n][o][r][u][x] [/{pattern}/] Sort lines in [range]. When no range is given all lines are sorted. @@ -1623,10 +1684,18 @@ found here: |sort()|, |uniq()|. With [i] case is ignored. + Options [n][f][x][o][b] are mutually exclusive. + With [n] sorting is done on the first decimal number in the line (after or inside a {pattern} match). One leading '-' is included in the number. + With [f] sorting is done on the Float in the line. + The value of Float is determined similar to passing + the text (after or inside a {pattern} match) to + str2float() function. This option is available only + if Vim was compiled with Floating point support. + With [x] sorting is done on the first hexadecimal number in the line (after or inside a {pattern} match). A leading "0x" or "0X" is ignored. @@ -1638,10 +1707,10 @@ found here: |sort()|, |uniq()|. With [b] sorting is done on the first binary number in the line (after or inside a {pattern} match). - With [u] only keep the first of a sequence of - identical lines (ignoring case when [i] is used). - Without this flag, a sequence of identical lines - will be kept in their original order. + With [u] (u stands for unique) only keep the first of + a sequence of identical lines (ignoring case when [i] + is used). Without this flag, a sequence of identical + lines will be kept in their original order. Note that leading and trailing white space may cause lines to be different. diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index ae808a4a9b..a123ea711b 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 7.4. Last change: 2014 Sep 06 +*cmdline.txt* For Vim version 7.4. Last change: 2015 Dec 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -97,6 +97,11 @@ CTRL-E or <End> *c_CTRL-E* *c_<End>* *c_End* *c_<LeftMouse>* <LeftMouse> Move the cursor to the position of the mouse click. + *c_<MiddleMouse>* +<MiddleMouse> Paste the contents of the clipboard (for X11 the primary + selection). This is similar to using CTRL-R *, but no CR + characters are inserted between lines. + CTRL-H *c_<BS>* *c_CTRL-H* *c_BS* <BS> Delete the character in front of the cursor. *c_<Del>* *c_Del* @@ -565,6 +570,7 @@ starts editing the three files "foo bar", "goes to" and "school ". When you want to use the special characters '"' or '|' in a command, or want to use '%' or '#' in a file name, precede them with a backslash. The backslash is not required in a range and in the ":substitute" command. +See also |`=|. *:_!* The '!' (bang) character after an Ex command makes the command behave in a @@ -714,13 +720,13 @@ to insert special things while typing you can use the CTRL-R command. For example, "%" stands for the current file name, while CTRL-R % inserts the current file name right away. See |c_CTRL-R|. -Note: If you want to avoid the special characters in a Vim script you may want -to use |fnameescape()|. +Note: If you want to avoid the effects of special characters in a Vim script +you may want to use |fnameescape()|. Also see |`=|. In Ex commands, at places where a file name can be used, the following characters have a special meaning. These can also be used in the expression -function expand() |expand()|. +function |expand()|. % Is replaced with the current file name. *:_%* *c_%* # Is replaced with the alternate file name. *:_#* *c_#* This is remembered for every window. @@ -755,6 +761,7 @@ it, no matter how many backslashes. # alternate.file \# # \\# \# +Also see |`=|. *:<cword>* *:<cWORD>* *:<cfile>* *<cfile>* *:<sfile>* *<sfile>* *:<afile>* *<afile>* @@ -776,13 +783,13 @@ Note: these are typed literally, they are not special keys! <afile> only when the file name isn't used to match with (for FileType, Syntax and SpellFileMissing events). <sfile> When executing a ":source" command, is replaced with the - file name of the sourced file. *E498* - When executing a function, is replaced with - "function {function-name}"; function call nesting is - indicated like this: - "function {function-name1}..{function-name2}". Note that - filename-modifiers are useless when <sfile> is used inside - a function. + file name of the sourced file. *E498* + When executing a function, is replaced with: + "function {function-name}[{lnum}]" + function call nesting is indicated like this: + "function {function-name1}[{lnum}]..{function-name2}[{lnum}]" + Note that filename-modifiers are useless when <sfile> is + used inside a function. <slnum> When executing a ":source" command, is replaced with the line number. *E842* When executing a function it's the line number relative to @@ -844,7 +851,7 @@ These modifiers can be given, in this order: :gs?pat?sub? Substitute all occurrences of "pat" with "sub". Otherwise this works like ":s". - :S Escape special characters for use with a shell command (see + :S Escape special characters for use with a shell command (see |shellescape()|). Must be the last one. Examples: > :!dir <cfile>:S :call system('chmod +w -- ' . expand('%:S')) @@ -897,9 +904,8 @@ name). This is included for backwards compatibility with version 3.0, the Note: Where a file name is expected wildcards expansion is done. On Unix the shell is used for this, unless it can be done internally (for speed). -Backticks also work, like in > +Unless in |restricted-mode|, backticks work also, like in > :n `echo *.c` -(backtick expansion is not possible in |restricted-mode|) But expansion is only done if there are any wildcards before expanding the '%', '#', etc.. This avoids expanding wildcards inside a file name. If you want to expand the result of <cfile>, add a wildcard character to it. @@ -910,6 +916,7 @@ Examples: (alternate file name is "?readme?") :e #.* :e {files matching "?readme?.*"} :cd <cfile> :cd {file name under cursor} :cd <cfile>* :cd {file name under cursor plus "*" and then expanded} +Also see |`=|. When the expanded argument contains a "!" and it is used for a shell command (":!cmd", ":r !cmd" or ":w !cmd"), the "!" is escaped with a backslash to @@ -936,6 +943,8 @@ for the file "$home" in the root directory. A few examples: /\$home file "$home" in root directory \\$home file "\\", followed by expanded $home +Also see |`=|. + ============================================================================== 7. Command-line window *cmdline-window* *cmdwin* *command-line-window* diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 8c9cdc3800..12bc655edc 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -1,4 +1,4 @@ -*diff.txt* For Vim version 7.4. Last change: 2015 Feb 03 +*diff.txt* For Vim version 7.4. Last change: 2015 Nov 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -124,8 +124,9 @@ file for a moment and come back to the same file and be in diff mode again. if the current window does not have 'diff' set then no options in it are changed. -The ":diffoff" command resets the relevant options to the values they had when -using |:diffsplit|, |:diffpatch| , |:diffthis|. or starting Vim in diff mode. +The `:diffoff` command resets the relevant options to the values they had when +using `:diffsplit`, `:diffpatch` , `:diffthis`. or starting Vim in diff mode. +When using `:diffoff` twice the last saved values are restored. Otherwise they are set to their default value: 'diff' off @@ -173,8 +174,8 @@ hidden buffers. You can use ":hide" to close a window without unloading the buffer. If you don't want a buffer to remain used for the diff do ":set nodiff" before hiding it. - *:diffu* *:diffupdate* -:diffu[pdate][!] Update the diff highlighting and folds. + *:dif* *:diffupdate* +:dif[fupdate][!] Update the diff highlighting and folds. Vim attempts to keep the differences updated when you make changes to the text. This mostly takes care of inserted and deleted lines. Changes within a diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index bcb89f6527..c51286a350 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2015 Apr 18 +*editing.txt* For Vim version 7.4. Last change: 2016 Jan 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -77,7 +77,8 @@ g CTRL-G Prints the current position of the cursor in five than one position on the screen (<Tab> or special character), both the "real" column and the screen column are shown, separated with a dash. - See also 'ruler' option. + Also see the 'ruler' option and the |wordcount()| + function. *v_g_CTRL-G* {Visual}g CTRL-G Similar to "g CTRL-G", but Word, Character, Line, and @@ -378,25 +379,38 @@ Finds files: /usr/include/sys/types.h /usr/inc_old/types.h *backtick-expansion* *`-expansion* -On Unix and a few other systems you can also use backticks in the file name, -for example: > - :e `find . -name ver\\*.c -print` -The backslashes before the star are required to prevent "ver*.c" to be -expanded by the shell before executing the find program. +On Unix and a few other systems you can also use backticks for the file name +argument, for example: > + :next `find . -name ver\\*.c -print` + :view `ls -t *.patch \| head -n1` +The backslashes before the star are required to prevent the shell from +expanding "ver*.c" prior to execution of the find program. The backslash +before the shell pipe symbol "|" prevents Vim from parsing it as command +termination. This also works for most other systems, with the restriction that the backticks must be around the whole item. It is not possible to have text directly before the first or just after the last backtick. *`=* -You can have the backticks expanded as a Vim expression, instead of an -external command, by using the syntax `={expr}` e.g.: > +You can have the backticks expanded as a Vim expression, instead of as an +external command, by putting an equal sign right after the first backtick, +e.g.: > :e `=tempname()` The expression can contain just about anything, thus this can also be used to avoid the special meaning of '"', '|', '%' and '#'. However, 'wildignore' does apply like to other wildcards. + +Environment variables in the expression are expanded when evaluating the +expression, thus this works: > + :e `=$HOME . '/.vimrc'` +This does not work, $HOME is inside a string and used literally: > + :e `='$HOME' . '/.vimrc'` + If the expression returns a string then names are to be separated with line breaks. When the result is a |List| then each item is used as a name. Line breaks also separate names. +Note that such expressions are only supported in places where a filename is +expected as an argument to an Ex-command. *++opt* *[++opt]* The [++opt] argument can be used to force the value of 'fileformat', @@ -1028,10 +1042,10 @@ The names can be in upper- or lowercase. the last file in the argument list has not been edited. See |:confirm| and 'confirm'. -:q[uit]! Quit without writing, also when currently visible - buffers have changes. Does not exit when this is the - last window and there is a changed hidden buffer. - In this case, the first changed hidden buffer becomes +:q[uit]! Quit without writing, also when the current buffer has + changes. If this is the last window and there is a + modified hidden buffer, the current buffer is + abandoned and the first changed hidden buffer becomes the current buffer. Use ":qall!" to exit always. @@ -1203,12 +1217,18 @@ use has("browsefilter"): > ============================================================================== 7. The current directory *current-directory* -You may use the |:cd| and |:lcd| commands to change to another directory, so -you will not have to type that directory name in front of the file names. It -also makes a difference for executing external commands, e.g. ":!ls". +You can use |:cd|, |:tcd| and |:lcd| to change to another directory, so you +will not have to type that directory name in front of the file names. It also +makes a difference for executing external commands, e.g. ":!ls" or ":te ls". + +There are three current-directory "scopes": global, tab and window. The +window-local working directory takes precedence over the tab-local +working directory, which in turn takes precedence over the global +working directory. If a local working directory (tab or window) does not +exist, the next-higher scope in the hierarchy applies. -Changing directory fails when the current buffer is modified, the '.' flag is -present in 'cpoptions' and "!" is not used in the command. +Commands for changing the working directory can be suffixed with a bang "!" +(e.g. |:cd!|) which is ignored, for compatibility with Vim. *:cd* *E747* *E472* :cd[!] On non-Unix systems: Print the current directory @@ -1233,29 +1253,50 @@ present in 'cpoptions' and "!" is not used in the command. *:chd* *:chdir* :chd[ir][!] [path] Same as |:cd|. + *:tc* *:tcd* *E5000* *E5001* *E5002* +:tc[d][!] {path} Like |:cd|, but set the current directory for the + current tab and window. The current directory for + other tabs and windows is not changed. + + *:tcd-* +:tcd[!] - Change to the previous current directory (before the + previous ":tcd {path}" command). + + *:tch* *:tchdir* +:tch[dir][!] Same as |:tcd|. + *:lc* *:lcd* :lc[d][!] {path} Like |:cd|, but only set the current directory for the current window. The current directory for other - windows is not changed. + windows or any tabs is not changed. *:lch* *:lchdir* :lch[dir][!] Same as |:lcd|. + *:lcd-* +:lcd[!] - Change to the previous current directory (before the + previous ":tcd {path}" command). + *:pw* *:pwd* *E187* :pw[d] Print the current directory name. Also see |getcwd()|. -So long as no |:lcd| command has been used, all windows share the same current -directory. Using a command to jump to another window doesn't change anything -for the current directory. -When a |:lcd| command has been used for a window, the specified directory -becomes the current directory for that window. Windows where the |:lcd| -command has not been used stick to the global current directory. When jumping -to another window the current directory will become the last specified local -current directory. If none was specified, the global current directory is -used. -When a |:cd| command is used, the current window will lose his local current -directory and will use the global current directory from now on. +So long as no |:tcd| or |:lcd| command has been used, all windows share the +same "current directory". Using a command to jump to another window doesn't +change anything for the current directory. + +When |:lcd| has been used for a window, the specified directory becomes the +current directory for that window. Windows where the |:lcd| command has not +been used stick to the global or tab-local directory. When jumping to another +window the current directory will become the last specified local current +directory. If none was specified, the global or tab-local directory is used. + +When changing tabs the same behaviour applies. If the current tab has no +local working directory the global working directory is used. When a |:cd| +command is used, the current window and tab will lose their local current +directories and will use the global current directory from now on. When +a |:tcd| command is used, only the current window will lose its local working +directory. After using |:cd| the full path name will be used for reading and writing files. On some networked file systems this may cause problems. The result of @@ -1292,7 +1333,7 @@ There are a few things to remember when editing binary files: and when the file is written the <NL> will be replaced with <CR> <NL>. - <Nul> characters are shown on the screen as ^@. You can enter them with "CTRL-V CTRL-@" or "CTRL-V 000". -- To insert a <NL> character in the file split up a line. When writing the +- To insert a <NL> character in the file split a line. When writing the buffer to a file a <NL> will be written for the <EOL>. - Vim normally appends an <EOL> at the end of the file if there is none. Setting the 'binary' option prevents this. If you want to add the final @@ -1304,9 +1345,7 @@ There are a few things to remember when editing binary files: 9. Encryption *encryption* *:X* *E817* *E818* *E819* *E820* -Support for editing encrypted files has been removed, but may be added back in -the future. See the following discussions for more information: - +Support for editing encrypted files has been removed. https://github.com/neovim/neovim/issues/694 https://github.com/neovim/neovim/issues/701 diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index bb7ca77de7..a8504e2a2a 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2015 Nov 30 +*eval.txt* For Vim version 7.4. Last change: 2016 Jan 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -864,8 +864,8 @@ expr1'th single byte from expr8. expr8 is used as a String, expr1 as a Number. This doesn't recognize multi-byte encodings, see |byteidx()| for an alternative. -Index zero gives the first character. This is like it works in C. Careful: -text column numbers start with one! Example, to get the character under the +Index zero gives the first byte. This is like it works in C. Careful: +text column numbers start with one! Example, to get the byte under the cursor: > :let c = getline(".")[col(".") - 1] @@ -916,6 +916,11 @@ just above, except that indexes out of range cause an error. Examples: > Using expr8[expr1] or expr8[expr1a : expr1b] on a |Funcref| results in an error. +Watch out for confusion between a namespace and a variable followed by a colon +for a sublist: > + mylist[n:] " uses variable n + mylist[s:] " uses namespace s:, error! + expr8.name entry in a |Dictionary| *expr-entry* @@ -1003,7 +1008,7 @@ function. Example: > -string *string* *expr-string* *E114* +string *string* *String* *expr-string* *E114* ------ "string" string constant *expr-quote* @@ -1386,6 +1391,22 @@ v:errors Errors found by assert functions, such as |assert_true()|. < If v:errors is set to anything but a list it is made an empty list by the assert function. + *v:event* *event-variable* +v:event Dictionary of event data for the current |autocommand|. The + available keys differ per event type and are specified at the + documentation for each |event|. The possible keys are: + operator The operation performed. Unlike + |v:operator|, it is set also for an Ex + mode command. For instance, |:yank| is + translated to "|y|". + regcontents Text stored in the register as a + |readfile()|-style list of lines. + regname Requested register (e.g "x" for "xyy) + or the empty string for an unnamed + operation. + regtype Type of register as returned by + |getregtype()|. + *v:exception* *exception-variable* v:exception The value of the exception most recently caught and not finished. See also |v:throwpoint| and |throw-variables|. @@ -1397,6 +1418,13 @@ v:exception The value of the exception most recently caught and not :endtry < Output: "caught oops". + *v:false* *false-variable* +v:false Special value used to put "false" in JSON and msgpack. See + |json_encode()|. This value is converted to "false" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). + *v:fcs_reason* *fcs_reason-variable* v:fcs_reason The reason why the |FileChangedShell| event was triggered. Can be used in an autocommand to decide what to do and/or what @@ -1475,7 +1503,9 @@ v:hlsearch Variable that indicates whether search highlighting is on. this variable to zero acts like the |:nohlsearch| command, setting it to one acts like > let &hlsearch = &hlsearch -< +< Note that the value is restored when returning from a + function. |function-search-undo|. + *v:insertmode* *insertmode-variable* v:insertmode Used for the |InsertEnter| and |InsertChange| autocommand events. Values: @@ -1534,6 +1564,13 @@ v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()| (not editable) empty lists. To check whether some list is one of msgpack types, use |is| operator. + *v:null* *null-variable* +v:null Special value used to put "null" in JSON and NIL in msgpack. + See |json_encode()|. This value is converted to "null" when + used as a String (e.g. in |expr5| with string concatenation + operator) and to zero when used as a Number (e.g. in |expr5| + or |expr7| when used with numeric operators). + *v:oldfiles* *oldfiles-variable* v:oldfiles List of file names that is loaded from the |shada| file on startup. These are the files that Vim remembers marks for. @@ -1699,6 +1736,13 @@ v:throwpoint The point where the exception most recently caught and not :endtry < Output: "Exception from test.vim, line 2" + *v:true* *true-variable* +v:true Special value used to put "true" in JSON and msgpack. See + |json_encode()|. This value is converted to "true" when used + as a String (e.g. in |expr5| with string concatenation + operator) and to one when used as a Number (e.g. in |expr5| or + |expr7| when used with numeric operators). + *v:val* *val-variable* v:val Value of the current item of a |List| or |Dictionary|. Only valid while evaluating the expression used with |map()| and @@ -1719,7 +1763,8 @@ v:version Version number of Vim: Major version number times 100 plus v:warningmsg Last given warning message. It's allowed to set this variable. *v:windowid* *windowid-variable* {Nvim} -v:windowid Is a no-op at the moment; the value is always set to 0. +v:windowid Application-specific window ID ("window handle" in MS-Windows) + which may be set by any attached UI. Defaults to zero. Note: for windows inside Vim use |winnr()|. ============================================================================== @@ -1731,170 +1776,176 @@ See |function-list| for a list grouped by what the function is used for. USAGE RESULT DESCRIPTION ~ -abs( {expr}) Float or Number absolute value of {expr} -acos( {expr}) Float arc cosine of {expr} -add( {list}, {item}) List append {item} to |List| {list} -and( {expr}, {expr}) Number bitwise AND -append( {lnum}, {string}) Number append {string} below line {lnum} -append( {lnum}, {list}) Number append lines {list} below line {lnum} +abs({expr}) Float or Number absolute value of {expr} +acos({expr}) Float arc cosine of {expr} +add({list}, {item}) List append {item} to |List| {list} +and({expr}, {expr}) Number bitwise AND +append({lnum}, {string}) Number append {string} below line {lnum} +append({lnum}, {list}) Number append lines {list} below line {lnum} argc() Number number of files in the argument list argidx() Number current index in the argument list -arglistid( [{winnr} [, {tabnr}]]) - Number argument list id -argv( {nr}) String {nr} entry of the argument list -argv( ) List the argument list -assert_equal( {exp}, {act} [, {msg}]) none assert that {exp} equals {act} -assert_false( {actual} [, {msg}]) none assert that {actual} is false -assert_true( {actual} [, {msg}]) none assert that {actual} is true -asin( {expr}) Float arc sine of {expr} -atan( {expr}) Float arc tangent of {expr} -atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2} -browse( {save}, {title}, {initdir}, {default}) +arglistid([{winnr} [, {tabnr}]]) Number argument list id +argv({nr}) String {nr} entry of the argument list +argv() List the argument list +assert_equal({exp}, {act} [, {msg}]) none assert {exp} equals {act} +assert_exception({error} [, {msg}]) none assert {error} is in v:exception +assert_fails( {cmd} [, {error}]) none assert {cmd} fails +assert_false({actual} [, {msg}]) none assert {actual} is false +assert_true({actual} [, {msg}]) none assert {actual} is true +asin({expr}) Float arc sine of {expr} +atan({expr}) Float arc tangent of {expr} +atan2({expr}, {expr}) Float arc tangent of {expr1} / {expr2} +browse({save}, {title}, {initdir}, {default}) String put up a file requester -browsedir( {title}, {initdir}) String put up a directory requester -bufexists( {expr}) Number TRUE if buffer {expr} exists -buflisted( {expr}) Number TRUE if buffer {expr} is listed -bufloaded( {expr}) Number TRUE if buffer {expr} is loaded -bufname( {expr}) String Name of the buffer {expr} -bufnr( {expr}) Number Number of the buffer {expr} -bufwinnr( {expr}) Number window number of buffer {expr} -byte2line( {byte}) Number line number at byte count {byte} -byteidx( {expr}, {nr}) Number byte index of {nr}'th char in {expr} -byteidxcomp( {expr}, {nr}) Number byte index of {nr}'th char in {expr} -call( {func}, {arglist} [, {dict}]) +browsedir({title}, {initdir}) String put up a directory requester +bufexists({expr}) Number TRUE if buffer {expr} exists +buflisted({expr}) Number TRUE if buffer {expr} is listed +bufloaded({expr}) Number TRUE if buffer {expr} is loaded +bufname({expr}) String Name of the buffer {expr} +bufnr({expr} [, {create}]) Number Number of the buffer {expr} +bufwinnr({expr}) Number window number of buffer {expr} +byte2line({byte}) Number line number at byte count {byte} +byteidx({expr}, {nr}) Number byte index of {nr}'th char in {expr} +byteidxcomp({expr}, {nr}) Number byte index of {nr}'th char in {expr} +call({func}, {arglist} [, {dict}]) any call {func} with arguments {arglist} -ceil( {expr}) Float round {expr} up +ceil({expr}) Float round {expr} up changenr() Number current change number -char2nr( {expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr} -cindent( {lnum}) Number C indent for line {lnum} +char2nr({expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr} +cindent({lnum}) Number C indent for line {lnum} clearmatches() none clear all matches -col( {expr}) Number column nr of cursor or mark -complete( {startcol}, {matches}) none set Insert mode completion -complete_add( {expr}) Number add completion match +col({expr}) Number column nr of cursor or mark +complete({startcol}, {matches}) none set Insert mode completion +complete_add({expr}) Number add completion match complete_check() Number check for key typed during completion -confirm( {msg} [, {choices} [, {default} [, {type}]]]) +confirm({msg} [, {choices} [, {default} [, {type}]]]) Number number of choice picked by user -copy( {expr}) any make a shallow copy of {expr} -cos( {expr}) Float cosine of {expr} -cosh( {expr}) Float hyperbolic cosine of {expr} -count( {list}, {expr} [, {ic} [, {start}]]) +copy({expr}) any make a shallow copy of {expr} +cos({expr}) Float cosine of {expr} +cosh({expr}) Float hyperbolic cosine of {expr} +count({list}, {expr} [, {ic} [, {start}]]) Number count how many {expr} are in {list} -cscope_connection( [{num} , {dbpath} [, {prepend}]]) +cscope_connection([{num} , {dbpath} [, {prepend}]]) Number checks existence of cscope connection -cursor( {lnum}, {col} [, {off}]) +cursor({lnum}, {col} [, {off}]) Number move cursor to {lnum}, {col}, {off} -cursor( {list}) Number move cursor to position in {list} -deepcopy( {expr} [, {noref}]) any make a full copy of {expr} -delete( {fname}) Number delete file {fname} -dictwatcheradd({dict}, {pattern}, {callback}) Start watching a dictionary -dictwatcherdel({dict}, {pattern}, {callback}) Stop watching a dictionary +cursor({list}) Number move cursor to position in {list} +deepcopy({expr} [, {noref}]) any make a full copy of {expr} +delete({fname} [, {flags}]) Number delete the file or directory {fname} +dictwatcheradd({dict}, {pattern}, {callback}) + Start watching a dictionary +dictwatcherdel({dict}, {pattern}, {callback}) + Stop watching a dictionary did_filetype() Number TRUE if FileType autocommand event used -diff_filler( {lnum}) Number diff filler lines about {lnum} -diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col} -empty( {expr}) Number TRUE if {expr} is empty -escape( {string}, {chars}) String escape {chars} in {string} with '\' -eval( {string}) any evaluate {string} into its value -eventhandler( ) Number TRUE if inside an event handler -executable( {expr}) Number 1 if executable {expr} exists -exepath( {expr}) String full path of the command {expr} -exists( {expr}) Number TRUE if {expr} exists -extend( {expr1}, {expr2} [, {expr3}]) +diff_filler({lnum}) Number diff filler lines about {lnum} +diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col} +empty({expr}) Number TRUE if {expr} is empty +escape({string}, {chars}) String escape {chars} in {string} with '\' +eval({string}) any evaluate {string} into its value +eventhandler() Number TRUE if inside an event handler +executable({expr}) Number 1 if executable {expr} exists +exepath({expr}) String full path of the command {expr} +exists({expr}) Number TRUE if {expr} exists +extend({expr1}, {expr2} [, {expr3}]) List/Dict insert items of {expr2} into {expr1} -exp( {expr}) Float exponential of {expr} -expand( {expr} [, {nosuf} [, {list}]]) +exp({expr}) Float exponential of {expr} +expand({expr} [, {nosuf} [, {list}]]) any expand special keywords in {expr} -feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer -filereadable( {file}) Number TRUE if {file} is a readable file -filewritable( {file}) Number TRUE if {file} is a writable file -filter( {expr}, {string}) List/Dict remove items from {expr} where - {string} is 0 -finddir( {name}[, {path}[, {count}]]) +feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer +filereadable({file}) Number TRUE if {file} is a readable file +filewritable({file}) Number TRUE if {file} is a writable file +filter({expr}, {string}) List/Dict remove items from {expr} where + {string} is 0 +finddir({name}[, {path}[, {count}]]) String find directory {name} in {path} -findfile( {name}[, {path}[, {count}]]) +findfile({name}[, {path}[, {count}]]) String find file {name} in {path} -float2nr( {expr}) Number convert Float {expr} to a Number -floor( {expr}) Float round {expr} down -fmod( {expr1}, {expr2}) Float remainder of {expr1} / {expr2} -fnameescape( {fname}) String escape special characters in {fname} -fnamemodify( {fname}, {mods}) String modify file name -foldclosed( {lnum}) Number first line of fold at {lnum} if closed -foldclosedend( {lnum}) Number last line of fold at {lnum} if closed -foldlevel( {lnum}) Number fold level at {lnum} -foldtext( ) String line displayed for closed fold -foldtextresult( {lnum}) String text for closed fold at {lnum} -foreground( ) Number bring the Vim window to the foreground -function( {name}) Funcref reference to function {name} -garbagecollect( [{atexit}]) none free memory, breaking cyclic references -get( {list}, {idx} [, {def}]) any get item {idx} from {list} or {def} -get( {dict}, {key} [, {def}]) any get item {key} from {dict} or {def} -getbufline( {expr}, {lnum} [, {end}]) +float2nr({expr}) Number convert Float {expr} to a Number +floor({expr}) Float round {expr} down +fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2} +fnameescape({fname}) String escape special characters in {fname} +fnamemodify({fname}, {mods}) String modify file name +foldclosed({lnum}) Number first line of fold at {lnum} if closed +foldclosedend({lnum}) Number last line of fold at {lnum} if closed +foldlevel({lnum}) Number fold level at {lnum} +foldtext() String line displayed for closed fold +foldtextresult({lnum}) String text for closed fold at {lnum} +foreground() Number bring the Vim window to the foreground +function({name}) Funcref reference to function {name} +garbagecollect([{atexit}]) none free memory, breaking cyclic references +get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def} +get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def} +getbufline({expr}, {lnum} [, {end}]) List lines {lnum} to {end} of buffer {expr} -getbufvar( {expr}, {varname} [, {def}]) +getbufvar({expr}, {varname} [, {def}]) any variable {varname} in buffer {expr} -getchar( [expr]) Number get one character from the user -getcharmod( ) Number modifiers for the last typed character +getchar([expr]) Number get one character from the user +getcharmod() Number modifiers for the last typed character +getcharsearch() Dict last character search getcmdline() String return the current command-line getcmdpos() Number return cursor position in command-line getcmdtype() String return current command-line type getcmdwintype() String return current command-line window type getcurpos() List position of the cursor -getcwd() String the current working directory -getfontname( [{name}]) String name of font being used -getfperm( {fname}) String file permissions of file {fname} -getfsize( {fname}) Number size in bytes of file {fname} -getftime( {fname}) Number last modification time of file -getftype( {fname}) String description of type of file {fname} -getline( {lnum}) String line {lnum} of current buffer -getline( {lnum}, {end}) List lines {lnum} to {end} of current buffer -getloclist( {nr}) List list of location list items +getcwd([{scope}]) String the current working directory +getfontname([{name}]) String name of font being used +getfperm({fname}) String file permissions of file {fname} +getfsize({fname}) Number size in bytes of file {fname} +getftime({fname}) Number last modification time of file +getftype({fname}) String description of type of file {fname} +getline({lnum}) String line {lnum} of current buffer +getline({lnum}, {end}) List lines {lnum} to {end} of current buffer +getloclist({nr}) List list of location list items getmatches() List list of current matches getpid() Number process ID of Vim -getpos( {expr}) List position of cursor, mark, etc. +getpos({expr}) List position of cursor, mark, etc. getqflist() List list of quickfix items -getreg( [{regname} [, 1 [, {list}]]]) +getreg([{regname} [, 1 [, {list}]]]) String or List contents of register -getregtype( [{regname}]) String type of register -gettabvar( {nr}, {varname} [, {def}]) +getregtype([{regname}]) String type of register +gettabvar({nr}, {varname} [, {def}]) any variable {varname} in tab {nr} or {def} -gettabwinvar( {tabnr}, {winnr}, {name} [, {def}]) +gettabwinvar({tabnr}, {winnr}, {name} [, {def}]) any {name} in {winnr} in tab page {tabnr} getwinposx() Number X coord in pixels of GUI Vim window getwinposy() Number Y coord in pixels of GUI Vim window -getwinvar( {nr}, {varname} [, {def}]) +getwinvar({nr}, {varname} [, {def}]) any variable {varname} in window {nr} -glob( {expr} [, {nosuf} [, {list} [, {alllinks}]]]) +glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) any expand file wildcards in {expr} -glob2regpat( {expr}) String convert a glob pat into a search pat -globpath( {path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) +glob2regpat({expr}) String convert a glob pat into a search pat +globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) String do glob({expr}) for all dirs in {path} -has( {feature}) Number TRUE if feature {feature} supported -has_key( {dict}, {key}) Number TRUE if {dict} has entry {key} +has({feature}) Number TRUE if feature {feature} supported +has_key({dict}, {key}) Number TRUE if {dict} has entry {key} haslocaldir() Number TRUE if current window executed |:lcd| -hasmapto( {what} [, {mode} [, {abbr}]]) +hasmapto({what} [, {mode} [, {abbr}]]) Number TRUE if mapping to {what} exists -histadd( {history},{item}) String add an item to a history -histdel( {history} [, {item}]) String remove an item from a history -histget( {history} [, {index}]) String get the item {index} from a history -histnr( {history}) Number highest index of a history -hlexists( {name}) Number TRUE if highlight group {name} exists -hlID( {name}) Number syntax ID of highlight group {name} +histadd({history},{item}) String add an item to a history +histdel({history} [, {item}]) String remove an item from a history +histget({history} [, {index}]) String get the item {index} from a history +histnr({history}) Number highest index of a history +hlexists({name}) Number TRUE if highlight group {name} exists +hlID({name}) Number syntax ID of highlight group {name} hostname() String name of the machine Vim is running on -iconv( {expr}, {from}, {to}) String convert encoding of {expr} -indent( {lnum}) Number indent of line {lnum} -index( {list}, {expr} [, {start} [, {ic}]]) +iconv({expr}, {from}, {to}) String convert encoding of {expr} +indent({lnum}) Number indent of line {lnum} +index({list}, {expr} [, {start} [, {ic}]]) Number index in {list} where {expr} appears -input( {prompt} [, {text} [, {completion}]]) +input({prompt} [, {text} [, {completion}]]) String get input from the user -inputdialog( {p} [, {t} [, {c}]]) String like input() but in a GUI dialog -inputlist( {textlist}) Number let the user pick from a choice list +inputdialog({p} [, {t} [, {c}]]) String like input() but in a GUI dialog +inputlist({textlist}) Number let the user pick from a choice list inputrestore() Number restore typeahead inputsave() Number save and clear typeahead -inputsecret( {prompt} [, {text}]) String like input() but hiding the text -insert( {list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}] -invert( {expr}) Number bitwise invert -isdirectory( {directory}) Number TRUE if {directory} is a directory -islocked( {expr}) Number TRUE if {expr} is locked -items( {dict}) List key-value pairs in {dict} +inputsecret({prompt} [, {text}]) + String like input() but hiding the text +insert({list}, {item} [, {idx}]) + List insert {item} in {list} [before {idx}] +invert({expr}) Number bitwise invert +isdirectory({directory}) Number TRUE if {directory} is a directory +islocked({expr}) Number TRUE if {expr} is locked +items({dict}) List key-value pairs in {dict} jobclose({job}[, {stream}]) Number Closes a job stream(s) jobpid({job}) Number Returns pid of a job. jobresize({job}, {width}, {height}) @@ -1903,191 +1954,200 @@ jobsend({job}, {data}) Number Writes {data} to {job}'s stdin jobstart({cmd}[, {opts}]) Number Spawns {cmd} as a job jobstop({job}) Number Stops a job jobwait({ids}[, {timeout}]) Number Wait for a set of jobs -join( {list} [, {sep}]) String join {list} items into one String -keys( {dict}) List keys in {dict} -len( {expr}) Number the length of {expr} -libcall( {lib}, {func}, {arg}) String call {func} in library {lib} with {arg} -libcallnr( {lib}, {func}, {arg}) Number idem, but return a Number -line( {expr}) Number line nr of cursor, last line or mark -line2byte( {lnum}) Number byte count of line {lnum} -lispindent( {lnum}) Number Lisp indent for line {lnum} +join({list} [, {sep}]) String join {list} items into one String +json_decode({expr}) any Convert {expr} from JSON +json_encode({expr}) String Convert {expr} to JSON +keys({dict}) List keys in {dict} +len({expr}) Number the length of {expr} +libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg} +libcallnr({lib}, {func}, {arg}) Number idem, but return a Number +line({expr}) Number line nr of cursor, last line or mark +line2byte({lnum}) Number byte count of line {lnum} +lispindent({lnum}) Number Lisp indent for line {lnum} localtime() Number current time -log( {expr}) Float natural logarithm (base e) of {expr} -log10( {expr}) Float logarithm of Float {expr} to base 10 -map( {expr}, {string}) List/Dict change each item in {expr} to {expr} -maparg( {name}[, {mode} [, {abbr} [, {dict}]]]) +log({expr}) Float natural logarithm (base e) of {expr} +log10({expr}) Float logarithm of Float {expr} to base 10 +map({expr}, {string}) List/Dict change each item in {expr} to {expr} +maparg({name}[, {mode} [, {abbr} [, {dict}]]]) String or Dict rhs of mapping {name} in mode {mode} -mapcheck( {name}[, {mode} [, {abbr}]]) +mapcheck({name}[, {mode} [, {abbr}]]) String check for mappings matching {name} -match( {expr}, {pat}[, {start}[, {count}]]) +match({expr}, {pat}[, {start}[, {count}]]) Number position where {pat} matches in {expr} -matchadd( {group}, {pattern}[, {priority}[, {id}]]) +matchadd({group}, {pattern}[, {priority}[, {id}]]) Number highlight {pattern} with {group} -matchaddpos( {group}, {list}[, {priority}[, {id}]]) +matchaddpos({group}, {list}[, {priority}[, {id}]]) Number highlight positions with {group} -matcharg( {nr}) List arguments of |:match| -matchdelete( {id}) Number delete match identified by {id} -matchend( {expr}, {pat}[, {start}[, {count}]]) +matcharg({nr}) List arguments of |:match| +matchdelete({id}) Number delete match identified by {id} +matchend({expr}, {pat}[, {start}[, {count}]]) Number position where {pat} ends in {expr} -matchlist( {expr}, {pat}[, {start}[, {count}]]) +matchlist({expr}, {pat}[, {start}[, {count}]]) List match and submatches of {pat} in {expr} -matchstr( {expr}, {pat}[, {start}[, {count}]]) +matchstr({expr}, {pat}[, {start}[, {count}]]) String {count}'th match of {pat} in {expr} -max( {list}) Number maximum value of items in {list} -min( {list}) Number minimum value of items in {list} -mkdir( {name} [, {path} [, {prot}]]) +max({list}) Number maximum value of items in {list} +min({list}) Number minimum value of items in {list} +mkdir({name} [, {path} [, {prot}]]) Number create directory {name} -mode( [expr]) String current editing mode -msgpackdump( {list}) List dump a list of objects to msgpack -msgpackparse( {list}) List parse msgpack to a list of objects -nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum} -nr2char( {expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} -or( {expr}, {expr}) Number bitwise OR -pathshorten( {expr}) String shorten directory names in a path -pow( {x}, {y}) Float {x} to the power of {y} -prevnonblank( {lnum}) Number line nr of non-blank line <= {lnum} -printf( {fmt}, {expr1}...) String format text +mode([expr]) String current editing mode +msgpackdump({list}) List dump a list of objects to msgpack +msgpackparse({list}) List parse msgpack to a list of objects +nextnonblank({lnum}) Number line nr of non-blank line >= {lnum} +nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} +or({expr}, {expr}) Number bitwise OR +pathshorten({expr}) String shorten directory names in a path +pow({x}, {y}) Float {x} to the power of {y} +prevnonblank({lnum}) Number line nr of non-blank line <= {lnum} +printf({fmt}, {expr1}...) String format text pumvisible() Number whether popup menu is visible -pyeval( {expr}) any evaluate |Python| expression -py3eval( {expr}) any evaluate |python3| expression -range( {expr} [, {max} [, {stride}]]) +pyeval({expr}) any evaluate |Python| expression +py3eval({expr}) any evaluate |python3| expression +range({expr} [, {max} [, {stride}]]) List items from {expr} to {max} -readfile( {fname} [, {binary} [, {max}]]) +readfile({fname} [, {binary} [, {max}]]) List get list of lines from file {fname} -reltime( [{start} [, {end}]]) List get time value -reltimestr( {time}) String turn time value into a String -remote_expr( {server}, {string} [, {idvar}]) +reltime([{start} [, {end}]]) List get time value +reltimefloat({time}) Float turn the time value into a Float +reltimestr({time}) String turn time value into a String +remote_expr({server}, {string} [, {idvar}]) String send expression -remote_foreground( {server}) Number bring Vim server to the foreground -remote_peek( {serverid} [, {retvar}]) +remote_foreground({server}) Number bring Vim server to the foreground +remote_peek({serverid} [, {retvar}]) Number check for reply string -remote_read( {serverid}) String read reply string -remote_send( {server}, {string} [, {idvar}]) +remote_read({serverid}) String read reply string +remote_send({server}, {string} [, {idvar}]) String send key sequence -remove( {list}, {idx} [, {end}]) any remove items {idx}-{end} from {list} -remove( {dict}, {key}) any remove entry {key} from {dict} -rename( {from}, {to}) Number rename (move) file from {from} to {to} -repeat( {expr}, {count}) String repeat {expr} {count} times -resolve( {filename}) String get filename a shortcut points to -reverse( {list}) List reverse {list} in-place -round( {expr}) Float round off {expr} +remove({list}, {idx} [, {end}]) any remove items {idx}-{end} from {list} +remove({dict}, {key}) any remove entry {key} from {dict} +rename({from}, {to}) Number rename (move) file from {from} to {to} +repeat({expr}, {count}) String repeat {expr} {count} times +resolve({filename}) String get filename a shortcut points to +reverse({list}) List reverse {list} in-place +round({expr}) Float round off {expr} rpcnotify({channel}, {event}[, {args}...]) Sends a |msgpack-rpc| notification to {channel} rpcrequest({channel}, {method}[, {args}...]) Sends a |msgpack-rpc| request to {channel} rpcstart({prog}[, {argv}]) Spawns {prog} and opens a |msgpack-rpc| channel rpcstop({channel}) Closes a |msgpack-rpc| {channel} -screenattr( {row}, {col}) Number attribute at screen position -screenchar( {row}, {col}) Number character at screen position +screenattr({row}, {col}) Number attribute at screen position +screenchar({row}, {col}) Number character at screen position screencol() Number current cursor column screenrow() Number current cursor row -search( {pattern} [, {flags} [, {stopline} [, {timeout}]]]) +search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) Number search for {pattern} -searchdecl( {name} [, {global} [, {thisblock}]]) +searchdecl({name} [, {global} [, {thisblock}]]) Number search for variable declaration -searchpair( {start}, {middle}, {end} [, {flags} [, {skip} [...]]]) +searchpair({start}, {middle}, {end} [, {flags} [, {skip} [...]]]) Number search for other end of start/end pair -searchpairpos( {start}, {middle}, {end} [, {flags} [, {skip} [...]]]) +searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} [...]]]) List search for other end of start/end pair -searchpos( {pattern} [, {flags} [, {stopline} [, {timeout}]]]) +searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) List search for {pattern} -server2client( {clientid}, {string}) +server2client({clientid}, {string}) Number send reply string serverlist() String get a list of available servers -setbufvar( {expr}, {varname}, {val}) set {varname} in buffer {expr} to {val} -setcharsearch( {dict}) Dict set character search from {dict} -setcmdpos( {pos}) Number set cursor position in command-line -setline( {lnum}, {line}) Number set line {lnum} to {line} -setloclist( {nr}, {list}[, {action}]) +setbufvar({expr}, {varname}, {val}) set {varname} in buffer {expr} to {val} +setcharsearch({dict}) Dict set character search from {dict} +setcmdpos({pos}) Number set cursor position in command-line +setfperm({fname}, {mode} Number set {fname} file permissions to {mode} +setline({lnum}, {line}) Number set line {lnum} to {line} +setloclist({nr}, {list}[, {action}[, {title}]]) Number modify location list using {list} -setmatches( {list}) Number restore a list of matches -setpos( {expr}, {list}) Number set the {expr} position to {list} -setqflist( {list}[, {action}]) Number modify quickfix list using {list} -setreg( {n}, {v}[, {opt}]) Number set register to value and type -settabvar( {nr}, {varname}, {val}) set {varname} in tab page {nr} to {val} -settabwinvar( {tabnr}, {winnr}, {varname}, {val}) set {varname} in window +setmatches({list}) Number restore a list of matches +setpos({expr}, {list}) Number set the {expr} position to {list} +setqflist({list}[, {action}[, {title}]] + Number modify quickfix list using {list} +setreg({n}, {v}[, {opt}]) Number set register to value and type +settabvar({nr}, {varname}, {val}) set {varname} in tab page {nr} to {val} +settabwinvar({tabnr}, {winnr}, {varname}, {val}) set {varname} in window {winnr} in tab page {tabnr} to {val} -setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val} -sha256( {string}) String SHA256 checksum of {string} -shellescape( {string} [, {special}]) +setwinvar({nr}, {varname}, {val}) set {varname} in window {nr} to {val} +sha256({string}) String SHA256 checksum of {string} +shellescape({string} [, {special}]) String escape {string} for use as shell command argument shiftwidth() Number effective value of 'shiftwidth' -simplify( {filename}) String simplify filename as much as possible -sin( {expr}) Float sine of {expr} -sinh( {expr}) Float hyperbolic sine of {expr} -sort( {list} [, {func} [, {dict}]]) +simplify({filename}) String simplify filename as much as possible +sin({expr}) Float sine of {expr} +sinh({expr}) Float hyperbolic sine of {expr} +sort({list} [, {func} [, {dict}]]) List sort {list}, using {func} to compare -soundfold( {word}) String sound-fold {word} +soundfold({word}) String sound-fold {word} spellbadword() String badly spelled word at cursor -spellsuggest( {word} [, {max} [, {capital}]]) +spellsuggest({word} [, {max} [, {capital}]]) List spelling suggestions -split( {expr} [, {pat} [, {keepempty}]]) +split({expr} [, {pat} [, {keepempty}]]) List make |List| from {pat} separated {expr} -sqrt( {expr}) Float square root of {expr} -str2float( {expr}) Float convert String to Float -str2nr( {expr} [, {base}]) Number convert String to Number -strchars( {expr}) Number character length of the String {expr} -strdisplaywidth( {expr} [, {col}]) Number display length of the String {expr} -strftime( {format}[, {time}]) String time in specified format -stridx( {haystack}, {needle}[, {start}]) +sqrt({expr}) Float square root of {expr} +str2float({expr}) Float convert String to Float +str2nr({expr} [, {base}]) Number convert String to Number +strchars({expr} [, {skipcc}]) Number character length of the String {expr} +strdisplaywidth({expr} [, {col}]) Number display length of the String {expr} +strftime({format}[, {time}]) String time in specified format +stridx({haystack}, {needle}[, {start}]) Number index of {needle} in {haystack} -string( {expr}) String String representation of {expr} value -strlen( {expr}) Number length of the String {expr} -strpart( {src}, {start}[, {len}]) +string({expr}) String String representation of {expr} value +strlen({expr}) Number length of the String {expr} +strpart({src}, {start}[, {len}]) String {len} characters of {src} at {start} -strridx( {haystack}, {needle} [, {start}]) +strridx({haystack}, {needle} [, {start}]) Number last index of {needle} in {haystack} -strtrans( {expr}) String translate string to make it printable -strwidth( {expr}) Number display cell length of the String {expr} -submatch( {nr}[, {list}]) String or List +strtrans({expr}) String translate string to make it printable +strwidth({expr}) Number display cell length of the String {expr} +submatch({nr}[, {list}]) String or List specific match in ":s" or substitute() -substitute( {expr}, {pat}, {sub}, {flags}) +substitute({expr}, {pat}, {sub}, {flags}) String all {pat} in {expr} replaced with {sub} -synID( {lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col} -synIDattr( {synID}, {what} [, {mode}]) +synID({lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col} +synIDattr({synID}, {what} [, {mode}]) String attribute {what} of syntax ID {synID} -synIDtrans( {synID}) Number translated syntax ID of {synID} -synconcealed( {lnum}, {col}) List info about concealing -synstack( {lnum}, {col}) List stack of syntax IDs at {lnum} and {col} -system( {cmd} [, {input}]) String output of shell command/filter {cmd} -systemlist( {cmd} [, {input}]) List output of shell command/filter {cmd} -tabpagebuflist( [{arg}]) List list of buffer numbers in tab page -tabpagenr( [{arg}]) Number number of current or last tab page -tabpagewinnr( {tabarg}[, {arg}]) +synIDtrans({synID}) Number translated syntax ID of {synID} +synconcealed({lnum}, {col}) List info about concealing +synstack({lnum}, {col}) List stack of syntax IDs at {lnum} and {col} +system({cmd} [, {input}]) String output of shell command/filter {cmd} +systemlist({cmd} [, {input}]) List output of shell command/filter {cmd} +tabpagebuflist([{arg}]) List list of buffer numbers in tab page +tabpagenr([{arg}]) Number number of current or last tab page +tabpagewinnr({tabarg}[, {arg}]) Number number of current window in tab page -taglist( {expr}) List list of tags matching {expr} +taglist({expr}) List list of tags matching {expr} tagfiles() List tags files used +tan({expr}) Float tangent of {expr} +tanh({expr}) Float hyperbolic tangent of {expr} tempname() String name for a temporary file -tan( {expr}) Float tangent of {expr} -tanh( {expr}) Float hyperbolic tangent of {expr} -tolower( {expr}) String the String {expr} switched to lowercase -toupper( {expr}) String the String {expr} switched to uppercase -tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} +timer_start({time}, {callback} [, {options}]) + Number create a timer +timer_stop({timer}) none stop a timer +tolower({expr}) String the String {expr} switched to lowercase +toupper({expr}) String the String {expr} switched to uppercase +tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} to chars in {tostr} -trunc( {expr}) Float truncate Float {expr} -type( {name}) Number type of variable {name} -undofile( {name}) String undo file name for {name} +trunc({expr}) Float truncate Float {expr} +type({name}) Number type of variable {name} +undofile({name}) String undo file name for {name} undotree() List undo file tree -uniq( {list} [, {func} [, {dict}]]) +uniq({list} [, {func} [, {dict}]]) List remove adjacent duplicates from a list -values( {dict}) List values in {dict} -virtcol( {expr}) Number screen column of cursor or mark -visualmode( [expr]) String last visual mode used +values({dict}) List values in {dict} +virtcol({expr}) Number screen column of cursor or mark +visualmode([expr]) String last visual mode used wildmenumode() Number whether 'wildmenu' mode is active -winbufnr( {nr}) Number buffer number of window {nr} +winbufnr({nr}) Number buffer number of window {nr} wincol() Number window column of the cursor -winheight( {nr}) Number height of window {nr} +winheight({nr}) Number height of window {nr} winline() Number window line of the cursor -winnr( [{expr}]) Number number of current window +winnr([{expr}]) Number number of current window winrestcmd() String returns command to restore window sizes -winrestview( {dict}) none restore view of current window +winrestview({dict}) none restore view of current window winsaveview() Dict save view of current window -winwidth( {nr}) Number width of window {nr} -writefile( {list}, {fname} [, {flags}]) +winwidth({nr}) Number width of window {nr} +wordcount() Dict get byte/char/word statistics +writefile({list}, {fname} [, {flags}]) Number write list of lines to file {fname} -xor( {expr}, {expr}) Number bitwise XOR +xor({expr}, {expr}) Number bitwise XOR abs({expr}) *abs()* Return the absolute value of {expr}. When {expr} evaluates to @@ -2191,19 +2251,37 @@ assert_equal({expected}, {actual}, [, {msg}]) < Will result in a string to be added to |v:errors|: test.vim line 12: Expected 'foo' but got 'bar' ~ -assert_false({actual}, [, {msg}]) *assert_false()* +assert_exception({error} [, {msg}]) *assert_exception()* + When v:exception does not contain the string {error} an error + message is added to |v:errors|. + This can be used to assert that a command throws an exception. + Using the error number, followed by a colon, avoids problems + with translations: > + try + commandthatfails + call assert_false(1, 'command should have failed') + catch + call assert_exception('E492:') + endtry + +assert_fails({cmd} [, {error}]) *assert_fails()* + Run {cmd} and add an error message to |v:errors| if it does + NOT produce an error. + When {error} is given it must match |v:errmsg|. + +assert_false({actual} [, {msg}]) *assert_false()* When {actual} is not false an error message is added to - |v:errors|, like with |assert_equal()|.. - A value is false when it is zero. When "{actual}" is not a - number the assert fails. + |v:errors|, like with |assert_equal()|. + A value is false when it is zero or |v:false|. When "{actual}" + is not a number or |v:false| the assert fails. When {msg} is omitted an error in the form "Expected False but got {actual}" is produced. -assert_true({actual}, [, {msg}]) *assert_true()* +assert_true({actual} [, {msg}]) *assert_true()* When {actual} is not true an error message is added to - |v:errors|, like with |assert_equal()|.. - A value is true when it is a non-zeron number. When {actual} - is not a number the assert fails. + |v:errors|, like with |assert_equal()|. + A value is true when it is a non-zero number or |v:true|. + When {actual} is not a number or |v:true| the assert fails. When {msg} is omitted an error in the form "Expected True but got {actual}" is produced. @@ -2717,13 +2795,19 @@ deepcopy({expr}[, {noref}]) *deepcopy()* *E698* {noref} set to 1 will fail. Also see |copy()|. -delete({fname}) *delete()* - Deletes the file by the name {fname}. The result is a Number, - which is 0 if the file was deleted successfully, and non-zero - when the deletion failed. - Use |remove()| to delete an item from a |List|. - To delete a line from the buffer use |:delete|. Use |:exe| - when the line number is in a variable. +delete({fname} [, {flags}]) *delete()* + Without {flags} or with {flags} empty: Deletes the file by the + name {fname}. This also works when {fname} is a symbolic link. + A symbolic link itself is deleted, not what it points to. + + When {flags} is "d": Deletes the directory by the name + {fname}. This fails when directory {fname} is not empty. + + When {flags} is "rf": Deletes the directory by the name + {fname} and everything in it, recursively. BE CAREFUL! + + The result is a Number, which is 0 if the delete operation was + successful and -1 when the deletion failed or partly failed. dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()* Adds a watcher to a dictionary. A dictionary watcher is @@ -2797,9 +2881,8 @@ diff_hlID({lnum}, {col}) *diff_hlID()* empty({expr}) *empty()* Return the Number 1 if {expr} is empty, zero otherwise. A |List| or |Dictionary| is empty when it does not have any - items. A Number is empty when its value is zero. - For a long |List| this is much faster than comparing the - length with zero. + items. A Number is empty when its value is zero. Special + variable is empty when it is |v:false| or |v:null|. escape({string}, {chars}) *escape()* Escape the characters in {chars} that occur in {string} with a @@ -3499,7 +3582,7 @@ getcmdwintype() *getcmdwintype()* *getcurpos()* getcurpos() Get the position of the cursor. This is like getpos('.'), but includes an extra item in the list: - [bufnum, lnum, col, off, curswant] + [bufnum, lnum, col, off, curswant] ~ The "curswant" number is the preferred column when moving the cursor vertically. This can be used to save and restore the cursor position: > @@ -3507,9 +3590,18 @@ getcurpos() Get the position of the cursor. This is like getpos('.'), but MoveTheCursorAround call setpos('.', save_cursor) < - *getcwd()* -getcwd() The result is a String, which is the name of the current - working directory. +getcwd([{window}[, {tab}]]) *getcwd()* + With no arguments the result is a String, which is the name of + the current effective working directory. With {window} or + {tab} the working directory of that scope is returned. + Tabs and windows are identified by their respective numbers, + 0 means current tab or window. Missing argument implies 0. + Thus the following are equivalent: > + getcwd() + getcwd(0) + getcwd(0, 0) +< If {window} is -1 it is ignored, only the tab is resolved. + getfsize({fname}) *getfsize()* The result is a Number, which is the size in bytes of the @@ -3546,6 +3638,8 @@ getfperm({fname}) *getfperm()* < This will hopefully (from a security point of view) display the string "rw-r--r--" or even "rw-------". + For setting permissions use |setfperm()|. + getftime({fname}) *getftime()* The result is a Number, which is the last modification time of the given file {fname}. The value is measured as seconds @@ -3844,9 +3938,18 @@ has_key({dict}, {key}) *has_key()* The result is a Number, which is 1 if |Dictionary| {dict} has an entry with key {key}. Zero otherwise. -haslocaldir() *haslocaldir()* - The result is a Number, which is 1 when the current - window has set a local path via |:lcd|, and 0 otherwise. +haslocaldir([{window}[, {tab}]]) *haslocaldir()* + The result is a Number, which is 1 when the specified tabpage + or window has a local path set via |:lcd| or |:tcd|, and + 0 otherwise. + + Tabs and windows are identified by their respective numbers, + 0 means current tab or window. Missing argument implies 0. + Thus the following are equivalent: > + haslocaldir() + haslocaldir(0) + haslocaldir(0, 0) +< If {window} is -1 it is ignored, only the tab is resolved. hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* The result is a Number, which is 1 if there is a mapping that @@ -4262,6 +4365,46 @@ join({list} [, {sep}]) *join()* converted into a string like with |string()|. The opposite function is |split()|. +json_decode({expr}) *json_decode()* + Convert {expr} from JSON object. Accepts |readfile()|-style + list as the input, as well as regular string. May output any + Vim value. When 'encoding' is not UTF-8 string is converted + from UTF-8 to 'encoding', failing conversion fails + json_decode(). In the following cases it will output + |msgpack-special-dict|: + 1. Dictionary contains duplicate key. + 2. Dictionary contains empty key. + 3. String contains NUL byte. Two special dictionaries: for + dictionary and for string will be emitted in case string + with NUL byte was a dictionary key. + + Note: function treats its input as UTF-8 always regardless of + 'encoding' value. This is needed because JSON source is + supposed to be external (e.g. |readfile()|) and JSON standard + allows only a few encodings, of which UTF-8 is recommended and + the only one required to be supported. Non-UTF-8 characters + are an error. + +json_encode({expr}) *json_encode()* + Convert {expr} into a JSON string. Accepts + |msgpack-special-dict| as the input. Converts from 'encoding' + to UTF-8 when encoding strings. Will not convert |Funcref|s, + mappings with non-string keys (can be created as + |msgpack-special-dict|), values with self-referencing + containers, strings which contain non-UTF-8 characters, + pseudo-UTF-8 strings which contain codepoints reserved for + surrogate pairs (such strings are not valid UTF-8 strings). + When converting 'encoding' is taken into account, if it is not + "utf-8", then conversion is performed before encoding strings. + Non-printable characters are converted into "\u1234" escapes + or special escapes like "\t", other are dumped as-is. + + Note: all characters above U+0079 are considered non-printable + when 'encoding' is not UTF-8. This function always outputs + UTF-8 strings as required by the standard thus when 'encoding' + is not unicode resulting string will look incorrect if + "\u1234" notation is not used. + keys({dict}) *keys()* Return a |List| with all the keys of {dict}. The |List| is in arbitrary order. @@ -4573,7 +4716,7 @@ match({expr}, {pat}[, {start}[, {count}]]) *match()* done like 'magic' is set and 'cpoptions' is empty. *matchadd()* *E798* *E799* *E801* -matchadd({group}, {pattern}[, {priority}[, {id}]]) +matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]]) Defines a pattern to be highlighted in the current window (a "match"). It will be highlighted with {group}. Returns an identification number (ID), which can be used to delete the @@ -4581,6 +4724,8 @@ matchadd({group}, {pattern}[, {priority}[, {id}]]) Matching is case sensitive and magic, unless case sensitivity or magicness are explicitly overridden in {pattern}. The 'magic', 'smartcase' and 'ignorecase' options are not used. + The "Conceal" value is special, it causes the match to be + concealed. The optional {priority} argument assigns a priority to the match. A match with a high priority will have its @@ -4598,9 +4743,18 @@ matchadd({group}, {pattern}[, {priority}[, {id}]]) message will appear and the match will not be added. An ID is specified as a positive integer (zero excluded). IDs 1, 2 and 3 are reserved for |:match|, |:2match| and |:3match|, - respectively. If the {id} argument is not specified, + respectively. If the {id} argument is not specified or -1, |matchadd()| automatically chooses a free ID. + The optional {dict} argmument allows for further custom + values. Currently this is used to specify a match specifc + conceal character that will be shown for |hl-Conceal| + highlighted matches. The dict can have the following members: + + conceal Special character to show instead of the + match (only for |hl-Conceal| highlighed + matches, see |:syn-cchar|) + The number of matches is not limited, as it is the case with the |:match| commands. @@ -4614,7 +4768,7 @@ matchadd({group}, {pattern}[, {priority}[, {id}]]) available from |getmatches()|. All matches can be deleted in one operation by |clearmatches()|. -matchaddpos({group}, {pos}[, {priority}[, {id}]]) *matchaddpos()* +matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) *matchaddpos()* Same as |matchadd()|, but requires a list of positions {pos} instead of a pattern. This command is faster than |matchadd()| because it does not require to handle regular expressions and @@ -4778,7 +4932,7 @@ msgpackdump({list}) {Nvim} *msgpackdump()* (dictionary with zero items is represented by 0x80 byte in messagepack). - Limitations: *E951* *E952* + Limitations: *E951* *E952* *E953* 1. |Funcref|s cannot be dumped. 2. Containers that reference themselves cannot be dumped. 3. Dictionary keys are always dumped as STR strings. @@ -4813,9 +4967,13 @@ msgpackparse({list}) {Nvim} *msgpackparse()* contains name of the key from |v:msgpack_types|): Key Value ~ - nil Zero, ignored when dumping. - boolean One or zero. When dumping it is only checked that - value is a |Number|. + nil Zero, ignored when dumping. This value cannot + possibly appear in |msgpackparse()| output in Neovim + versions which have |v:null|. + boolean One or zero. When dumping it is only checked that + value is a |Number|. This value cannot possibly + appear in |msgpackparse()| output in Neovim versions + which have |v:true| and |v:false|. integer |List| with four numbers: sign (-1 or 1), highest two bits, number with bits from 62nd to 31st, lowest 31 bits. I.e. to get actual number one will need to use @@ -5146,7 +5304,7 @@ readfile({fname} [, {binary} [, {max}]]) separated with CR will result in a single long line (unless a NL appears somewhere). All NUL characters are replaced with a NL character. - When {binary/append} contains "b" binary mode is used: + When {binary} contains "b" binary mode is used: - When the last line ends in a NL an extra empty list item is added. - No CR characters are removed. @@ -5174,7 +5332,8 @@ readfile({fname} [, {binary} [, {max}]]) reltime([{start} [, {end}]]) *reltime()* Return an item that represents a time value. The format of the item depends on the system. It can be passed to - |reltimestr()| to convert it to a string. + |reltimestr()| to convert it to a string or |reltimefloat()| + to convert to a float. Without an argument it returns the current time. With one argument is returns the time passed since the time specified in the argument. @@ -5182,7 +5341,16 @@ reltime([{start} [, {end}]]) *reltime()* and {end}. The {start} and {end} arguments must be values returned by reltime(). - {only available when compiled with the |+reltime| feature} + +reltimefloat({time}) *reltimefloat()* + Return a Float that represents the time value of {time}. + Unit of time is seconds. + Example: + let start = reltime() + call MyFunction() + let seconds = reltimefloat(reltime(start)) + See the note of reltimestr() about overhead. + Also see |profiling|. reltimestr({time}) *reltimestr()* Return a String that represents the time value of {time}. @@ -5192,12 +5360,10 @@ reltimestr({time}) *reltimestr()* call MyFunction() echo reltimestr(reltime(start)) < Note that overhead for the commands will be added to the time. - The accuracy depends on the system. Leading spaces are used to make the string align nicely. You can use split() to remove it. > echo split(reltimestr(reltime(start)))[0] < Also see |profiling|. - {only available when compiled with the |+reltime| feature} *remote_expr()* *E449* remote_expr({server}, {string} [, {idvar}]) @@ -5417,14 +5583,15 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* move. No error message is given. {flags} is a String, which can contain these character flags: - 'b' search backward instead of forward - 'c' accept a match at the cursor position + 'b' search Backward instead of forward + 'c' accept a match at the Cursor position 'e' move to the End of the match 'n' do Not move the cursor - 'p' return number of matching sub-pattern (see below) - 's' set the ' mark at the previous location of the cursor - 'w' wrap around the end of the file - 'W' don't wrap around the end of the file + 'p' return number of matching sub-Pattern (see below) + 's' Set the ' mark at the previous location of the cursor + 'w' Wrap around the end of the file + 'W' don't Wrap around the end of the file + 'z' start searching at the cursor column instead of Zero If neither 'w' or 'W' is given, the 'wrapscan' option applies. If the 's' flag is supplied, the ' mark is set, only if the @@ -5432,6 +5599,12 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* flag. 'ignorecase', 'smartcase' and 'magic' are used. + + When the 'z' flag is not given seaching always starts in + column zero and then matches before the cursor are skipped. + When the 'c' flag is present in 'cpo' the next search starts + after the match. Without the 'c' flag the next search starts + one column further. When the {stopline} argument is given then the search stops after searching this line. This is useful to restrict the @@ -5618,7 +5791,7 @@ searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *searchpos()* < In this example "submatch" is 2 when a lowercase letter is found |/\l|, 3 when an uppercase letter is found |/\u|. -server2client( {clientid}, {string}) *server2client()* +server2client({clientid}, {string}) *server2client()* Send a reply string to {clientid}. The most recent {clientid} that sent a string can be retrieved with expand("<client>"). {only available when compiled with the |+clientserver| feature} @@ -5670,7 +5843,7 @@ setbufvar({expr}, {varname}, {val}) *setbufvar()* :call setbufvar("todo", "myvar", "foobar") < This function is not available in the |sandbox|. -setcharsearch() *setcharsearch()* +setcharsearch({dict}) *setcharsearch()* Set the current character search information to {dict}, which contains one or more of the following entries: @@ -5705,6 +5878,23 @@ setcmdpos({pos}) *setcmdpos()* Returns 0 when successful, 1 when not editing the command line. +setfperm({fname}, {mode}) *setfperm()* *chmod* + Set the file permissions for {fname} to {mode}. + {mode} must be a string with 9 characters. It is of the form + "rwxrwxrwx", where each group of "rwx" flags represent, in + turn, the permissions of the owner of the file, the group the + file belongs to, and other users. A '-' character means the + permission is off, any other character means on. Multi-byte + characters are not supported. + + For example "rw-r-----" means read-write for the user, + readable by the group, not accessible by others. "xx-x-----" + would do the same thing. + + Returns non-zero for success, zero for failure. + + To read permissions see |getfperm()|. + setline({lnum}, {text}) *setline()* Set line {lnum} of the current buffer to {text}. To insert lines use |append()|. @@ -5723,11 +5913,13 @@ setline({lnum}, {text}) *setline()* :endfor < Note: The '[ and '] marks are not set. -setloclist({nr}, {list} [, {action}]) *setloclist()* +setloclist({nr}, {list} [, {action}[, {title}]]) *setloclist()* Create or replace or add to the location list for window {nr}. When {nr} is zero the current window is used. For a location list window, the displayed location list is modified. For an - invalid window number {nr}, -1 is returned. + invalid window number {nr}, -1 is returned. If {title} is + given, it will be used to set |w:quickfix_title| after opening + the location window. Otherwise, same as |setqflist()|. Also see |location-list|. @@ -5784,7 +5976,7 @@ setpos({expr}, {list}) |winrestview()|. -setqflist({list} [, {action}]) *setqflist()* +setqflist({list} [, {action}[, {title}]]) *setqflist()* Create or replace or add to the quickfix list using the items in {list}. Each item in {list} is a dictionary. Non-dictionary items in {list} are ignored. Each dictionary @@ -5823,6 +6015,9 @@ setqflist({list} [, {action}]) *setqflist()* with the items from {list}. If {action} is not present or is set to ' ', then a new list is created. + If {title} is given, it will be used to set |w:quickfix_title| + after opening the quickfix window. + Returns zero for success, -1 for failure. This function can be used to create a quickfix list @@ -6008,6 +6203,10 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702* strtod() function to parse numbers, Strings, Lists, Dicts and Funcrefs will be considered as being 0). + When {func} is given and it is 'N' then all items will be + sorted numerical. This is like 'n' but a string containing + digits will be used as the number they represent. + When {func} is a |Funcref| or a function name, this function is called to compare items. The function is invoked with two items as argument and must return zero if they are equal, 1 or @@ -6109,7 +6308,8 @@ split({expr} [, {pattern} [, {keepempty}]]) *split()* :let words = split(getline('.'), '\W\+') < To split a string in individual characters: > :for c in split(mystring, '\zs') -< If you want to keep the separator you can also use '\zs': > +< If you want to keep the separator you can also use '\zs' at + the end of the pattern: > :echo split('abc:def:ghi', ':\zs') < ['abc:', 'def:', 'ghi'] ~ Splitting a table where the first element can be empty: > @@ -6130,7 +6330,7 @@ sqrt({expr}) *sqrt()* "nan" may be different, it depends on system libraries. -str2float( {expr}) *str2float()* +str2float({expr}) *str2float()* Convert String {expr} to a Float. This mostly works the same as when using a floating point number in an expression, see |floating-point-format|. But it's a bit more permissive. @@ -6144,7 +6344,7 @@ str2float( {expr}) *str2float()* let f = str2float(substitute(text, ',', '', 'g')) -str2nr( {expr} [, {base}]) *str2nr()* +str2nr({expr} [, {base}]) *str2nr()* Convert string {expr} to a number. {base} is the conversion base, it can be 2, 8, 10 or 16. When {base} is omitted base 10 is used. This also means that @@ -6157,15 +6357,35 @@ str2nr( {expr} [, {base}]) *str2nr()* Text after the number is silently ignored. -strchars({expr}) *strchars()* +strchars({expr} [, {skipcc}]) *strchars()* The result is a Number, which is the number of characters - String {expr} occupies. Composing characters are counted - separately. + in String {expr}. + When {skipcc} is omitted or zero, composing characters are + counted separately. + When {skipcc} set to 1, Composing characters are ignored. Also see |strlen()|, |strdisplaywidth()| and |strwidth()|. + + {skipcc} is only available after 7.4.755. For backward + compatibility, you can define a wrapper function: > + if has("patch-7.4.755") + function s:strchars(str, skipcc) + return strchars(a:str, a:skipcc) + endfunction + else + function s:strchars(str, skipcc) + if a:skipcc + return strlen(substitute(a:str, ".", "x", "g")) + else + return strchars(a:str) + endif + endfunction + endif +< + strdisplaywidth({expr}[, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells - String {expr} occupies on the screen when it starts a {col}. + String {expr} occupies on the screen when it starts at {col}. When {col} is omitted zero is used. Otherwise it is the screen column where to start. This matters for Tab characters. @@ -6221,25 +6441,31 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number, {expr} type result ~ String 'string' Number 123 - Float 123.123456 or 1.123456e8 - Funcref function('name') + Float 123.123456 or 1.123456e8 or + `str2float('inf')` + Funcref `function('name')` List [item, item] Dictionary {key: value, key: value} Note that in String values the ' character is doubled. Also see |strtrans()|. + Note 2: Output format is mostly compatible with YAML, except + for infinite and NaN floating-point values representations + which use |str2float()|. Strings are also dumped literally, + only single quote is escaped, which does not allow using YAML + for parsing back binary strings (including text when + 'encoding' is not UTF-8). |eval()| should always work for + strings and floats though and this is the only official + method, use |msgpackdump()| or |json_encode()| if you need to + share data with other application. *strlen()* strlen({expr}) The result is a Number, which is the length of the String {expr} in bytes. - If you want to count the number of multi-byte characters (not - counting composing characters) use something like this: > - - :let len = strlen(substitute(str, ".", "x", "g")) -< If the argument is a Number it is first converted to a String. For other types an error is given. - Also see |len()|, |strchars()|, |strdisplaywidth()| and - |strwidth()|. + If you want to count the number of multi-byte characters use + |strchars()|. + Also see |len()|, |strdisplaywidth()| and |strwidth()|. strpart({src}, {start}[, {len}]) *strpart()* The result is a String, which is part of {src}, starting from @@ -6353,6 +6579,9 @@ synID({lnum}, {col}, {trans}) *synID()* {col} is 1 for the leftmost column, {lnum} is 1 for the first line. 'synmaxcol' applies, in a longer line zero is returned. + Note that when the position is after the last character, + that's where the cursor can be in Insert mode, synID() returns + zero. When {trans} is non-zero, transparent items are reduced to the item that they reveal. This is useful when wanting to know @@ -6620,6 +6849,37 @@ tanh({expr}) *tanh()* < -0.761594 + *timer_start()* +timer_start({time}, {callback} [, {options}]) + Create a timer and return the timer ID. + + {time} is the waiting time in milliseconds. This is the + minimum time before invoking the callback. When the system is + busy or Vim is not waiting for input the time will be longer. + + {callback} is the function to call. It can be the name of a + function or a Funcref. It is called with one argument, which + is the timer ID. The callback is only invoked when Vim is + waiting for input. + + {options} is a dictionary. Supported entries: + "repeat" Number of times to repeat calling the + callback. -1 means forever. + + Example: > + func MyHandler(timer) + echo 'Handler called' + endfunc + let timer = timer_start(500, 'MyHandler', + \ {'repeat': 3}) +< This will invoke MyHandler() three times at 500 msec + intervals. + {only available when compiled with the |+timers| feature} + +timer_stop({timer}) *timer_stop()* + Stop a timer. {timer} is an ID returned by timer_start(). + The timer callback will no longer be invoked. + tolower({expr}) *tolower()* The result is a copy of the String given, with all uppercase characters turned into lowercase (just like applying |gu| to @@ -6658,12 +6918,14 @@ trunc({expr}) *trunc()* type({expr}) *type()* The result is a Number, depending on the type of {expr}: - Number: 0 - String: 1 + Number: 0 + String: 1 Funcref: 2 - List: 3 + List: 3 Dictionary: 4 - Float: 5 + Float: 5 + Boolean: 6 (|v:true| and |v:false|) + Null: 7 (|v:null|) To avoid the magic numbers it should be used this way: > :if type(myvar) == type(0) :if type(myvar) == type("") @@ -6671,6 +6933,10 @@ type({expr}) *type()* :if type(myvar) == type([]) :if type(myvar) == type({}) :if type(myvar) == type(0.0) + :if type(myvar) == type(v:true) +< In place of checking for |v:null| type it is better to check + for |v:null| directly as it is the only value of this type: > + :if myvar is v:null undofile({name}) *undofile()* Return the name of the undo file that would be used for a file @@ -6916,6 +7182,28 @@ winwidth({nr}) *winwidth()* : exe "normal 50\<C-W>|" :endif < +wordcount() *wordcount()* + The result is a dictionary of byte/chars/word statistics for + the current buffer. This is the same info as provided by + |g_CTRL-G| + The return value includes: + bytes Number of bytes in the buffer + chars Number of chars in the buffer + words Number of words in the buffer + cursor_bytes Number of bytes before cursor position + (not in Visual mode) + cursor_chars Number of chars before cursor position + (not in Visual mode) + cursor_words Number of words before cursor position + (not in Visual mode) + visual_bytes Number of bytes visually selected + (only in Visual mode) + visual_chars Number of chars visually selected + (only in Visual mode) + visual_words Number of chars visually selected + (only in Visual mode) + + *writefile()* writefile({list}, {fname} [, {flags}]) Write |List| {list} to file {fname}. Each list item is @@ -7075,6 +7363,7 @@ termresponse Compiled with support for |t_RV| and |v:termresponse|. textobjects Compiled with support for |text-objects|. tgetent Compiled with tgetent support, able to use a termcap or terminfo file. +timers Compiled with |timer_start()| support. title Compiled with window title support |'title'|. toolbar Compiled with support for |gui-toolbar|. unix Unix version of Vim. diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index b6525e8494..76aa3a50ce 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 7.4. Last change: 2013 Dec 15 +*filetype.txt* For Vim version 7.4. Last change: 2015 Dec 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -510,7 +510,7 @@ Local mappings: to the end of the file in Normal mode. This means "> " is inserted in each line. -MAN *ft-man-plugin* *:Man* +MAN *ft-man-plugin* *:Man* *man.vim* Displays a manual page in a nice way. Also see the user manual |find-manpage|. @@ -535,6 +535,13 @@ Global mapping: Local mappings: CTRL-] Jump to the manual page for the word under the cursor. CTRL-T Jump back to the previous manual page. +q Same as ":quit" + +To enable folding use this: > + let g:ft_man_folding_enable = 1 +If you do not like the default folding, use an autocommand to add your desired +folding style instead. For example: > + autocmd FileType man setlocal foldmethod=indent foldenable PDF *ft-pdf-plugin* diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index 03dd6a61ba..680e3270f2 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -1,4 +1,4 @@ -*fold.txt* For Vim version 7.4. Last change: 2013 Dec 04 +*fold.txt* For Vim version 7.4. Last change: 2016 Jan 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -94,9 +94,9 @@ These are the conditions with which the expression is evaluated: lowest. "=" use fold level from the previous line "a1", "a2", .. add one, two, .. to the fold level of the previous - line + line, use the result for the current line "s1", "s2", .. subtract one, two, .. from the fold level of the - previous line + previous line, use the result for the next line "<1", "<2", .. a fold with this level ends at this line ">1", ">2", .. a fold with this level starts at this line @@ -119,6 +119,18 @@ method can be very slow! Try to avoid the "=", "a" and "s" return values, since Vim often has to search backwards for a line for which the fold level is defined. This can be slow. +An example of using "a1" and "s1": For a multi-line C comment, a line +containing "/*" would return "a1" to start a fold, and a line containing "*/" +would return "s1" to end the fold after that line: > + if match(thisline, '/\*') >= 0 + return 'a1' + elseif match(thisline, '\*/') >= 0 + return 's1' + else + return '=' + endif +However, this won't work for single line comments, strings, etc. + |foldlevel()| can be useful to compute a fold level relative to a previous fold level. But note that foldlevel() may return -1 if the level is not known yet. And it returns the level at the start of the line, while a fold might @@ -570,8 +582,9 @@ what you type! When using an operator, a closed fold is included as a whole. Thus "dl" deletes the whole closed fold under the cursor. -For Ex commands the range is adjusted to always start at the first line of a -closed fold and end at the last line of a closed fold. Thus this command: > +For Ex commands that work on buffer lines the range is adjusted to always +start at the first line of a closed fold and end at the last line of a closed +fold. Thus this command: > :s/foo/bar/g when used with the cursor on a closed fold, will replace "foo" with "bar" in all lines of the fold. diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt index ce00600979..228be9eab2 100644 --- a/runtime/doc/gui_w32.txt +++ b/runtime/doc/gui_w32.txt @@ -385,7 +385,7 @@ detailed elsewhere: see |'mouse'|, |win32-hidden-menus|. You can drag and drop one or more files into the Vim window, where they will be opened as normal. See |drag-n-drop|. - *:simalt* *:si* + *:simalt* *:sim* :sim[alt] {key} simulate pressing {key} while holding Alt pressed. {only for Win32 versions} diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 19bcb35da8..342c475f9b 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -1,4 +1,4 @@ -*help.txt* For Vim version 7.4. Last change: 2015 Apr 15 +*help.txt* For Vim version 7.4. Last change: 2016 Jan 10 VIM - main help file k @@ -9,14 +9,14 @@ Close this window: Use ":q<Enter>". Jump to a subject: Position the cursor on a tag (e.g. |bars|) and hit CTRL-]. With the mouse: Double-click the left mouse button on a tag, e.g. |bars|. - Jump back: Type CTRL-T or CTRL-O (repeat to go further back). + Jump back: Type CTRL-T or CTRL-O. Repeat to go further back. Get specific help: It is possible to go directly to whatever you want help on, by giving an argument to the |:help| command. - It is possible to further specify the context: - *help-context* + Prepend something to specify the context: *help-context* + WHAT PREPEND EXAMPLE ~ - Normal mode command (nothing) :help x + Normal mode command :help x Visual mode command v_ :help v_u Insert mode command i_ :help i_<Esc> Command-line command : :help :quit @@ -24,6 +24,8 @@ Get specific help: It is possible to go directly to whatever you want help Vim command argument - :help -r Option ' :help 'textwidth' Regular expression / :help /[ + See |help-summary| for more contexts and an explanation. + Search for help: Type ":help word", then hit CTRL-D to see matching help entries for "word". Or use ":helpgrep word". |:helpgrep| diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 2067b0c321..e98f0400c4 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.4. Last change: 2015 Feb 12 +*index.txt* For Vim version 7.4. Last change: 2016 Jan 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1171,7 +1171,7 @@ tag command action ~ |:cpfile| :cpf[ile] go to last error in previous file |:cquit| :cq[uit] quit Vim with an error code |:crewind| :cr[ewind] go to the specified error, default first one -|:cscope| :cs[cope] execute cscope command +|:cscope| :cs[cope] execute cscope command |:cstag| :cst[ag] use cscope to jump to a tag |:cunmap| :cu[nmap] like ":unmap" but for Command-line mode |:cunabbrev| :cuna[bbrev] like ":unabbrev" but for Command-line mode @@ -1290,7 +1290,7 @@ tag command action ~ |:lcd| :lc[d] change directory locally |:lchdir| :lch[dir] change directory locally |:lclose| :lcl[ose] close location window -|:lcscope| :lcs[cope] like ":cscope" but uses location list +|:lcscope| :lcs[cope] like ":cscope" but uses location list |:ldo| :ld[o] execute command in valid location list entries |:lfdo| :lfd[o] execute command in each file in location list |:left| :le[ft] left align lines @@ -1341,7 +1341,7 @@ tag command action ~ |:marks| :marks list all marks |:match| :mat[ch] define a match to highlight |:menu| :me[nu] enter a new menu item -|:menutranslate| :menut[ranslate] add a menu translation item +|:menutranslate| :menut[ranslate] add a menu translation item |:messages| :mes[sages] view previously displayed messages |:mkexrc| :mk[exrc] write current mappings and settings to a file |:mksession| :mks[ession] write session info to a file @@ -1494,7 +1494,7 @@ tag command action ~ |:stop| :st[op] suspend the editor or escape to a shell |:stag| :sta[g] split window and jump to a tag |:startinsert| :star[tinsert] start Insert mode -|:startgreplace| :startg[replace] start Virtual Replace mode +|:startgreplace| :startg[replace] start Virtual Replace mode |:startreplace| :startr[eplace] start Replace mode |:stopinsert| :stopi[nsert] stop Insert mode |:stjump| :stj[ump] do ":tjump" and split window diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index cb01d5fe92..f931dfa341 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.4. Last change: 2015 May 22 +*insert.txt* For Vim version 7.4. Last change: 2015 Sep 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -78,8 +78,8 @@ CTRL-W Delete the word before the cursor (see |i_backspacing| about |word-motions|, for the definition of a word. *i_CTRL-U* CTRL-U Delete all entered characters before the cursor in the current - line. If there are no newly entereed characters and - 'backspace'is not empty, delete all characters before the + line. If there are no newly entered characters and + 'backspace' is not empty, delete all characters before the cursor in the current line. See |i_backspacing| about joining lines. *i_CTRL-I* *i_<Tab>* *i_Tab* @@ -148,7 +148,7 @@ CTRL-R CTRL-R {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-R* CTRL-R a results in "ac". CTRL-R CTRL-R a results in "ab^Hc". < Options 'textwidth', 'formatoptions', etc. still apply. If - you also want to avoid these, use "<C-R><C-O>r", see below. + you also want to avoid these, use CTRL-R CTRL-O, see below. The '.' register (last inserted text) is still inserted as typed. diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index fdf106a7bb..cbe017e051 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -452,7 +452,7 @@ notation meaning equivalent decimal value(s) ~ <C-...> control-key *control* *ctrl* *<C-* <M-...> alt-key or meta-key *meta* *alt* *<M-* <A-...> same as <M-...> *<A-* -<D-...> command-key (Macintosh only) *<D-* +<D-...> command-key or "super" key *<D-* <t_xx> key with "xx" entry in termcap ----------------------------------------------------------------------- diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 464c700a4d..31c3198f72 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.4. Last change: 2014 Dec 08 +*map.txt* For Vim version 7.4. Last change: 2016 Jan 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -481,7 +481,7 @@ internal code is written to the script file. 1.6 SPECIAL CHARACTERS *:map-special-chars* - *map_backslash* + *map_backslash* *map-backslash* Note that only CTRL-V is mentioned here as a special character for mappings and abbreviations. When 'cpoptions' does not contain 'B', a backslash can also be used like CTRL-V. The <> notation can be fully used then |<>|. But @@ -492,21 +492,21 @@ To map a backslash, or use a backslash literally in the {rhs}, the special sequence "<Bslash>" can be used. This avoids the need to double backslashes when using nested mappings. - *map_CTRL-C* + *map_CTRL-C* *map-CTRL-C* Using CTRL-C in the {lhs} is possible, but it will only work when Vim is waiting for a key, not when Vim is busy with something. When Vim is busy CTRL-C interrupts/breaks the command. When using the GUI version on MS-Windows CTRL-C can be mapped to allow a Copy command to the clipboard. Use CTRL-Break to interrupt Vim. - *map_space_in_lhs* + *map_space_in_lhs* *map-space_in_lhs* To include a space in {lhs} precede it with a CTRL-V (type two CTRL-Vs for each space). - *map_space_in_rhs* + *map_space_in_rhs* *map-space_in_rhs* If you want a {rhs} that starts with a space, use "<Space>". To be fully Vi compatible (but unreadable) don't use the |<>| notation, precede {rhs} with a single CTRL-V (you have to type CTRL-V two times). - *map_empty_rhs* + *map_empty_rhs* *map-empty-rhs* You can create an empty {rhs} by typing nothing after a single CTRL-V (you have to type CTRL-V two times). Unfortunately, you cannot do this in a vimrc file. @@ -581,7 +581,7 @@ Upper and lowercase differences are ignored. It is not possible to put a comment after these commands, because the '"' character is considered to be part of the {lhs} or {rhs}. - *map_bar* + *map_bar* *map-bar* Since the '|' character is used to separate a map command from the next command, you will have to do something special to include a '|' in {rhs}. There are three methods: @@ -599,7 +599,7 @@ When 'b' is present in 'cpoptions', "\|" will be recognized as a mapping ending in a '\' and then another command. This is Vi compatible, but illogical when compared to other commands. - *map_return* + *map_return* *map-return* When you have a mapping that contains an Ex command, you need to put a line terminator after it to have it executed. The use of <CR> is recommended for this (see |<>|). Example: > diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt index d732e7f818..bafb9dfc2c 100644 --- a/runtime/doc/msgpack_rpc.txt +++ b/runtime/doc/msgpack_rpc.txt @@ -7,7 +7,7 @@ The Msgpack-RPC Interface to Nvim *msgpack-rpc* 1. Introduction |msgpack-rpc-intro| -2. API |msgpack-rpc-api| +2. API mapping |msgpack-rpc-api| 3. Connecting |msgpack-rpc-connecting| 4. Clients |msgpack-rpc-clients| 5. Types |msgpack-rpc-types| @@ -36,13 +36,13 @@ Nvim's msgpack-rpc interface is like a more powerful version of Vim's `clientserver` feature. ============================================================================== -2. API *msgpack-rpc-api* +2. API mapping *msgpack-rpc-api* -The Nvim C API is automatically exposed to the msgpack-rpc interface by the -build system, which parses headers at src/nvim/api from the project root. A -dispatch function is generated, which matches msgpack-rpc method names with -non-static API functions, converting/validating arguments and return values -back to msgpack. +The Nvim C API, see |nvim-api|, is automatically exposed to the msgpack-rpc +interface by the build system, which parses headers at src/nvim/api from the +project root. A dispatch function is generated, which matches msgpack-rpc method +names with non-static API functions, converting/validating arguments and return +values back to msgpack. Client libraries will normally provide wrappers that hide msgpack-rpc details from programmers. The wrappers can be automatically generated by reading @@ -63,7 +63,7 @@ Here's a simple way to get human-readable description of the API (requires Python and the `pyyaml`/`msgpack-python` pip packages): > nvim --api-info | python -c 'import msgpack, sys, yaml; print yaml.dump(msgpack.unpackb(sys.stdin.read()))' > api.yaml - +< ============================================================================== 3. Connecting *msgpack-rpc-connecting* @@ -162,8 +162,8 @@ https://github.com/msgpack-rpc/msgpack-rpc-ruby/blob/master/lib/msgpack/rpc/tran ============================================================================== 5. Types *msgpack-rpc-types* -Nvim's C API uses custom types for all functions (some are just typedefs -around C99 standard types). The types can be split into two groups: +Nvim's C API uses custom types for all functions, se |nvim-api-types|. +For the purpose of mapping to msgpack, he types can be split into two groups: - Basic types that map natively to msgpack (and probably have a default representation in msgpack-supported programming languages) diff --git a/runtime/doc/nvim_clipboard.txt b/runtime/doc/nvim_clipboard.txt index 1183ad7a3c..078382c7a7 100644 --- a/runtime/doc/nvim_clipboard.txt +++ b/runtime/doc/nvim_clipboard.txt @@ -22,6 +22,10 @@ is found in your `$PATH`. - xclip - xsel (newer alternative to xclip) - pbcopy/pbpaste (only for Mac OS X) +- lemonade (useful for SSH machine) + https://github.com/pocke/lemonade +- doitclient (another option for SSH setups from the maintainer of PuTTY) + http://www.chiark.greenend.org.uk/~sgtatham/doit/ The presence of a suitable clipboard tool implicitly enables the '+' and '*' registers. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 51bfc12f9d..83ae96a651 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2015 Oct 15 +*options.txt* For Vim version 7.4. Last change: 2016 Jan 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -49,9 +49,12 @@ achieve special effects. These options come in three forms: :se[t] {option}&vi Reset option to its Vi default value. :se[t] {option}&vim Reset option to its Vim default value. -:se[t] all& Set all options, except terminal options, to their - default value. The values of 'term', 'lines' and - 'columns' are not changed. +:se[t] all& Set all options to their default value. The values of + these options are not changed: + 'columns' + 'encoding' + 'lines' + Warning: This may have a lot of side effects. *:set-args* *E487* *E521* :se[t] {option}={value} or @@ -704,7 +707,8 @@ A jump table for the options with a short description can be found at |Q_op|. line. When 'smartindent' or 'cindent' is on the indent is changed in a different way. - The 'autoindent' option is reset when the 'paste' option is set. + The 'autoindent' option is reset when the 'paste' option is set and + restored when 'paste' is reset. {small difference from Vi: After the indent is deleted when typing <Esc> or <CR>, the cursor position when moving up or down is after the deleted indent; Vi puts the cursor somewhere in the deleted indent}. @@ -772,14 +776,13 @@ A jump table for the options with a short description can be found at |Q_op|. putting a ":gui" command in the gvimrc file, before where the value of 'background' is used (e.g., before ":syntax on"). - For Windows the default is "dark". - For other systems "dark" is used when 'term' is "linux", - "screen.linux", "cygwin" or "putty", or $COLORFGBG suggests a dark - background. Otherwise the default is "light". + For Windows the default is "dark". "dark" should be used if $COLORFGBG + suggests a dark background (not yet implemented). Otherwise the default + is "light". Normally this option would be set in the vimrc file. Possibly depending on the terminal name. Example: > - :if &term == "xterm" + :if $TERM == "xterm" : set background=dark :endif < When this option is set, the default settings for the highlight groups @@ -1361,7 +1364,7 @@ A jump table for the options with a short description can be found at |Q_op|. option, yank and delete operations (but not put) will additionally copy the text into register '*'. See |nvim-clipboard|. -< + *clipboard-autoselect* autoselect Works like the 'a' flag in 'guioptions': If present, then whenever Visual mode is started, or the Visual @@ -2274,6 +2277,8 @@ A jump table for the options with a short description can be found at |Q_op|. <Tab>. Spaces are used in indents with the '>' and '<' commands and when 'autoindent' is on. To insert a real tab when 'expandtab' is on, use CTRL-V<Tab>. See also |:retab| and |ins-expandtab|. + This option is reset when the 'paste' option is set and restored when + the 'paste' option is reset. *'exrc'* *'ex'* *'noexrc'* *'noex'* 'exrc' 'ex' boolean (default off) @@ -3405,7 +3410,7 @@ A jump table for the options with a short description can be found at |Q_op|. global Ignore case in search patterns. Also used when searching in the tags file. - Also see 'smartcase'. + Also see 'smartcase' and 'tagcase'. Can be overruled by using "\c" or "\C" in the pattern, see |/ignorecase|. @@ -3780,7 +3785,7 @@ A jump table for the options with a short description can be found at |Q_op|. feature} This option allows switching your keyboard into a special language mode. When you are typing text in Insert mode the characters are - inserted directly. When in command mode the 'langmap' option takes + inserted directly. When in Normal mode the 'langmap' option takes care of translating these special characters to the original meaning of the key. This means you don't have to change the keyboard mode to be able to execute Normal mode commands. @@ -4147,8 +4152,11 @@ A jump table for the options with a short description can be found at |Q_op|. global Maximum amount of memory in Kbyte to use for all buffers together. The maximum usable value is about 2000000 (2 Gbyte). Use this to work - without a limit. On 64 bit machines higher values might work. But - hey, do you really need more than 2 Gbyte for text editing? + without a limit. + On 64 bit machines higher values might work. But hey, do you really + need more than 2 Gbyte for text editing? Keep in mind that text is + stored in the swap file, one can edit files > 2 Gbyte anyway. We do + need the memory to store undo info. Also see 'maxmem'. *'menuitems'* *'mis'* @@ -4518,19 +4526,21 @@ A jump table for the options with a short description can be found at |Q_op|. When the 'paste' option is switched on (also when it was already on): - mapping in Insert mode and Command-line mode is disabled - abbreviations are disabled - - 'textwidth' is set to 0 - - 'wrapmargin' is set to 0 - 'autoindent' is reset - - 'smartindent' is reset - - 'softtabstop' is set to 0 + - 'expandtab' is reset + - 'formatoptions' is used like it is empty - 'revins' is reset - 'ruler' is reset - 'showmatch' is reset - - 'formatoptions' is used like it is empty + - 'smartindent' is reset + - 'smarttab' is reset + - 'softtabstop' is set to 0 + - 'textwidth' is set to 0 + - 'wrapmargin' is set to 0 These options keep their value, but their effect is disabled: - - 'lisp' - - 'indentexpr' - 'cindent' + - 'indentexpr' + - 'lisp' NOTE: When you start editing another file while the 'paste' option is on, settings from the modelines or autocommands may change the settings again, causing trouble when pasting text. You might want to @@ -4853,7 +4863,8 @@ A jump table for the options with a short description can be found at |Q_op|. Inserting characters in Insert mode will work backwards. See "typing backwards" |ins-reverse|. This option can be toggled with the CTRL-_ command in Insert mode, when 'allowrevins' is set. - NOTE: This option is reset when 'paste' is set. + This option is reset when 'paste' is set and restored when 'paste' is + reset. *'rightleft'* *'rl'* *'norightleft'* *'norl'* 'rightleft' 'rl' boolean (default off) @@ -4902,7 +4913,8 @@ A jump table for the options with a short description can be found at |Q_op|. separated with a dash. For an empty line "0-1" is shown. For an empty buffer the line number will also be zero: "0,0-1". - This option is reset when the 'paste' option is set. + This option is reset when 'paste' is set and restored when 'paste' is + reset. If you don't want to see the ruler all the time but want to know where you are, use "g CTRL-G" |g_CTRL-G|. @@ -5539,6 +5551,9 @@ A jump table for the options with a short description can be found at |Q_op|. c don't give |ins-completion-menu| messages. For example, "-- XXX completion (YYY)", "match 1 of 2", "The only match", "Pattern not found", "Back at original", etc. + q use "recording" instead of "recording @a" + F don't give the file info when editing a file, like `:silent` + was used for the command This gives you the opportunity to avoid that a change between buffers requires you to hit <Enter>, but still gives as useful a message as @@ -5607,7 +5622,9 @@ A jump table for the options with a short description can be found at |Q_op|. jump is only done if the match can be seen on the screen. The time to show the match can be set with 'matchtime'. A Beep is given if there is no match (no matter if the match can be - seen or not). This option is reset when the 'paste' option is set. + seen or not). + This option is reset when 'paste' is set and restored when 'paste' is + reset. When the 'm' flag is not included in 'cpoptions', typing a character will immediately move the cursor back to where it belongs. See the "sm" field in 'guicursor' for setting the cursor shape and @@ -5706,7 +5723,8 @@ A jump table for the options with a short description can be found at |Q_op|. mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H. When using the ">>" command, lines starting with '#' are not shifted right. - NOTE: When 'paste' is set smart indenting is disabled. + This option is reset when 'paste' is set and restored when 'paste' is + reset. *'smarttab'* *'sta'* *'nosmarttab'* *'nosta'* 'smarttab' 'sta' boolean (default on) @@ -5721,6 +5739,8 @@ A jump table for the options with a short description can be found at |Q_op|. What gets inserted (a <Tab> or spaces) depends on the 'expandtab' option. Also see |ins-expandtab|. When 'expandtab' is not set, the number of spaces is minimized by using <Tab>s. + This option is reset when 'paste' is set and restored when 'paste' is + reset. *'softtabstop'* *'sts'* 'softtabstop' 'sts' number (default 0) @@ -5733,7 +5753,8 @@ A jump table for the options with a short description can be found at |Q_op|. commands like "x" still work on the actual characters. When 'sts' is zero, this feature is off. When 'sts' is negative, the value of 'shiftwidth' is used. - 'softtabstop' is set to 0 when the 'paste' option is set. + 'softtabstop' is set to 0 when the 'paste' option is set and restored + when 'paste' is reset. See also |ins-expandtab|. When 'expandtab' is not set, the number of spaces is minimized by using <Tab>s. The 'L' flag in 'cpoptions' changes how tabs are used when 'list' is @@ -5805,7 +5826,8 @@ A jump table for the options with a short description can be found at |Q_op|. the two-letter, lower case region name. You can use more than one region by listing them: "en_us,en_ca" supports both US and Canadian English, but not words specific for Australia, New Zealand or Great - Britain. + Britain. (Note: currently en_au and en_nz dictionaries are older than + en_ca, en_gb and en_us). If the name "cjk" is included East Asian characters are excluded from spell checking. This is useful when editing text that also has Asian words. @@ -6067,7 +6089,7 @@ A jump table for the options with a short description can be found at |Q_op|. become empty. This will make a group like the following disappear completely from the statusline when none of the flags are set. > :set statusline=...%(\ [%M%R%H]%)... -< +< *g:actual_curbuf* Beware that an expression is evaluated each and every time the status line is displayed. The current buffer and current window will be set temporarily to that of the window (and buffer) whose statusline is @@ -6177,6 +6199,7 @@ A jump table for the options with a short description can be found at |Q_op|. split If included, split the current window before loading a buffer for a |quickfix| command that display errors. Otherwise: do not split, use current window. + vsplit Just like "split" but split vertically. newtab Like "split", but open a new tab page. Overrules "split" when both are present. @@ -6302,19 +6325,22 @@ A jump table for the options with a short description can be found at |Q_op|. < [The whitespace before and after the '0' must be a single <Tab>] When a binary search was done and no match was found in any of the - files listed in 'tags', and 'ignorecase' is set or a pattern is used + files listed in 'tags', and case is ignored or a pattern is used instead of a normal tag name, a retry is done with a linear search. Tags in unsorted tags files, and matches with different case will only be found in the retry. If a tag file indicates that it is case-fold sorted, the second, - linear search can be avoided for the 'ignorecase' case. Use a value - of '2' in the "!_TAG_FILE_SORTED" line for this. A tag file can be - case-fold sorted with the -f switch to "sort" in most unices, as in - the command: "sort -f -o tags tags". For "Exuberant ctags" version - 5.x or higher (at least 5.5) the --sort=foldcase switch can be used - for this as well. Note that case must be folded to uppercase for this - to work. + linear search can be avoided when case is ignored. Use a value of '2' + in the "!_TAG_FILE_SORTED" line for this. A tag file can be case-fold + sorted with the -f switch to "sort" in most unices, as in the command: + "sort -f -o tags tags". For "Exuberant ctags" version 5.x or higher + (at least 5.5) the --sort=foldcase switch can be used for this as + well. Note that case must be folded to uppercase for this to work. + + By default, tag searches are case-sensitive. Case is ignored when + 'ignorecase' is set and 'tagcase' is "followic", or when 'tagcase' is + "ignore". When 'tagbsearch' is off, tags searching is slower when a full match exists, but faster when no full match exists. Tags in unsorted tags @@ -6325,6 +6351,16 @@ A jump table for the options with a short description can be found at |Q_op|. This option doesn't affect commands that find all matching tags (e.g., command-line completion and ":help"). + *'tagcase'* *'tc'* +'tagcase' 'tc' string (default "followic") + global or local to buffer |global-local| + {not in Vi} + This option specifies how case is handled when searching the tags + file: + followic Follow the 'ignorecase' option + ignore Ignore case + match Match case + *'taglength'* *'tl'* 'taglength' 'tl' number (default 0) global @@ -6370,17 +6406,7 @@ A jump table for the options with a short description can be found at |Q_op|. mapping which should not change the tagstack. *'term'* *E529* *E530* *E531* -'term' string (default is $TERM, if that fails: - in the GUI: "builtin_gui" - on Mac: "mac-ansi" - on Unix: "ansi" - on Windows: "win32") - global - Name of the terminal. Used for choosing the terminal control - characters. Environment variables are expanded |:set_env|. - For example: > - :set term=$TERM -< See |termcap|. +'term' Removed. |vim-differences| {Nvim} *'termbidi'* *'tbidi'* *'notermbidi'* *'notbidi'* @@ -6398,6 +6424,14 @@ A jump table for the options with a short description can be found at |Q_op|. *'termencoding'* *'tenc'* 'termencoding' 'tenc' Removed. |vim-differences| {Nvim} + *'termguicolors'* *'tgc'* +'termguicolors' 'tgc' boolean (default off) + global + When on, uses |highlight-guifg| and |highlight-guibg| attributes in + the terminal (thus using 24-bit color). Requires a ISO-8613-3 + compatible terminal. + Must be set at startup (in your |init.vim| or |--cmd|). + *'terse'* *'noterse'* 'terse' boolean (default off) global @@ -6411,8 +6445,10 @@ A jump table for the options with a short description can be found at |Q_op|. local to buffer Maximum width of text that is being inserted. A longer line will be broken after white space to get this width. A zero value disables - this. 'textwidth' is set to 0 when the 'paste' option is set. When - 'textwidth' is zero, 'wrapmargin' may be used. See also + this. + 'textwidth' is set to 0 when the 'paste' option is set and restored + when 'paste' is reset. + When 'textwidth' is zero, 'wrapmargin' may be used. See also 'formatoptions' and |ins-textwidth|. When 'formatexpr' is set it will be used to break the line. @@ -6560,9 +6596,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'ttyscroll' 'tsl' Removed. |vim-differences| {Nvim} *'ttytype'* *'tty'* -'ttytype' 'tty' string (default from $TERM) - global - Alias for 'term', see above. +'ttytype' 'tty' Alias for 'term'. Removed. |vim-differences| {Nvim} *'undodir'* *'udir'* *E926* 'undodir' 'udir' string (default "$XDG_DATA_HOME/nvim/undo") diff --git a/runtime/doc/os_dos.txt b/runtime/doc/os_dos.txt deleted file mode 100644 index 1601d65ffd..0000000000 --- a/runtime/doc/os_dos.txt +++ /dev/null @@ -1,279 +0,0 @@ -*os_dos.txt* For Vim version 7.4. Last change: 2006 Mar 30 - - - VIM REFERENCE MANUAL by Bram Moolenaar - - - *dos* *DOS* -This file documents some particularities of the Win32 -version of Vim. Also see |os_win32.txt|. - -1. File locations |dos-locations| -2. Using backslashes |dos-backslash| -3. Standard mappings |dos-standard-mappings| -4. Screen output and colors |dos-colors| -5. File formats |dos-file-formats| -6. :cd command |dos-:cd| -7. Interrupting |dos-CTRL-Break| -8. Temp files |dos-temp-files| -9. Shell option default |dos-shell| - -============================================================================== -1. File locations *dos-locations* - -If you keep the Vim executable in the directory that contains the help and -syntax subdirectories, there is no need to do anything special for Vim to -work. No registry entries or environment variables need to be set. Just make -sure that the directory is in your search path, or use a shortcut on the -desktop. - -Your vimrc files ("_vimrc" and "_gvimrc") are normally located one directory -up from the runtime files. If you want to put them somewhere else, set the -environment variable $VIM to the directory where you keep them. Example: > - set VIM=C:\user\piet -Will find "c:\user\piet\_vimrc". -Note: This would only be needed when the computer is used by several people. -Otherwise it's simpler to keep your _vimrc file in the default place. - -If you move the executable to another location, you also need to set the $VIM -environment variable. The runtime files will be found in "$VIM/vim{version}". -Example: > - set VIM=E:\vim -Will find the version 5.4 runtime files in "e:\vim\vim54". -Note: This is _not_ recommended. The preferred way is to keep the executable -in the runtime directory. - -If you move your executable AND want to put your "_vimrc" and "_gvimrc" files -somewhere else, you must set $VIM to where you vimrc files are, and set -$VIMRUNTIME to the runtime files. Example: > - set VIM=C:\usr\piet - set VIMRUNTIME=E:\vim\vim54 -Will find "c:\user\piet\_vimrc" and the runtime files in "e:\vim\vim54". - -See |$VIM| and |$VIMRUNTIME| for more information. - -You can set environment variables for each user separately under -"Start/Settings/Control Panel->System", or through the properties in the menu -of "My Computer", under the Environment Tab. - -============================================================================== -2. Using backslashes *dos-backslash* - -Using backslashes in file names can be a problem. Vi halves the number of -backslashes for some commands. Vim is a bit more tolerant and does not remove -backslashes from a file name, so ":e c:\foo\bar" works as expected. But when -a backslash occurs before a special character (space, comma, backslash, etc.), -Vim removes the backslash. Use slashes to avoid problems: ":e c:/foo/bar" -works fine. Vim replaces the slashes with backslashes internally to avoid -problems with some MS-DOS programs and Win32 programs. - -When you prefer to use forward slashes, set the 'shellslash' option. Vim will -then replace backslashes with forward slashes when expanding file names. This -is especially useful when using a Unix-like 'shell'. - -============================================================================== -3. Standard mappings *dos-standard-mappings* - -The mappings for CTRL-PageUp and CTRL-PageDown have been removed, they now -jump to the next or previous tab page |<C-PageUp>| |<C-PageDown>| - -If you want them to move to the first and last screen line you can use these -mappings: - -key key code Normal/Visual mode Insert mode ~ -CTRL-PageUp <M-N><M-C-D> H <C-O>H -CTRL-PageDown <M-N>v L$ <C-O>L<C-O>$ - -Additionally, these keys are available for copy/cut/paste. -In the Win32 version, they also use the clipboard. - -Shift-Insert paste text (from clipboard) *<S-Insert>* -CTRL-Insert copy Visual text (to clipboard) *<C-Insert>* -CTRL-Del cut Visual text (to clipboard) *<C-Del>* -Shift-Del cut Visual text (to clipboard) *<S-Del>* - -These mappings accomplish this (Win32 version of Vim): - -key key code Normal Visual Insert ~ -Shift-Insert <M-N><M-T> "*P "-d"*P <C-R><C-O>* -CTRL-Insert <M-N><M-U> "*y -Shift-Del <M-N><M-W> "*d -CTRL-Del <M-N><M-X> "*d - -Or these mappings (non-Win32 version of Vim): - -key key code Normal Visual Insert ~ -Shift-Insert <M-N><M-T> P "-dP <C-R><C-O>" -CTRL-Insert <M-N><M-U> y -Shift-Del <M-N><M-W> d -CTRL-Del <M-N><M-X> d - -When the clipboard is supported, the "* register is used. - -============================================================================== -4. Screen output and colors *dos-colors* - -The default output method for the screen is to use bios calls. This works -right away on most systems. You do not need ansi.sys. You can use ":mode" to -set the current screen mode. See |:mode|. - -To change the screen colors that Vim uses, you can use the |:highlight| -command. The Normal highlight group specifies the colors Vim uses for normal -text. For example, to get grey text on a blue background: > - :hi Normal ctermbg=Blue ctermfg=grey -See |highlight-groups| for other groups that are available. - -A DOS console does not support attributes like bold and underlining. You can -set the color used in five modes with nine terminal options. Note that this -is not necessary since you can set the color directly with the ":highlight" -command; these options are for backward compatibility with older Vim versions. -The |'highlight'| option specifies which of the five modes is used for which -action. > - - :set t_mr=^V^[\|xxm start of invert mode - :set t_md=^V^[\|xxm start of bold mode - :set t_me=^V^[\|xxm back to normal text - - :set t_so=^V^[\|xxm start of standout mode - :set t_se=^V^[\|xxm back to normal text - - :set t_us=^V^[\|xxm start of underline mode - :set t_ue=^V^[\|xxm back to normal text - - :set t_ZH=^V^[\|xxm start of italics mode - :set t_ZR=^V^[\|xxm back to normal text - -^V is CTRL-V -^[ is <Esc> -You must replace xx with a decimal code, which is the foreground color number -and background color number added together: - -COLOR FOREGROUND BACKGROUND ~ -Black 0 0 -DarkBlue 1 16 -DarkGreen 2 32 -DarkCyan 3 48 -DarkRed 4 64 -DarkMagenta 5 80 -Brown, DarkYellow 6 96 -LightGray 7 112 -DarkGray 8 128 * -Blue, LightBlue 9 144 * -Green, LightGreen 10 160 * -Cyan, LightCyan 11 176 * -Red, LightRed 12 192 * -Magenta, LightMagenta 13 208 * -Yellow, LightYellow 14 224 * -White 15 240 * - -* Depending on the display mode, the color codes above 128 may not be - available, and code 128 will make the text blink. - -When you use 0, the color is reset to the one used when you started Vim -(usually 7, lightgray on black, but you can override this. If you have -overridden the default colors in a command prompt, you may need to adjust -some of the highlight colors in your vimrc---see below). -This is the default for t_me. - -The defaults for the various highlight modes are: - t_mr 112 reverse mode: Black text (0) on LightGray (112) - t_md 15 bold mode: White text (15) on Black (0) - t_me 0 normal mode (revert to default) - - t_so 31 standout mode: White (15) text on DarkBlue (16) - t_se 0 standout mode end (revert to default) - - t_czh 225 italic mode: DarkBlue text (1) on Yellow (224) - t_czr 0 italic mode end (revert to default) - - t_us 67 underline mode: DarkCyan text (3) on DarkRed (64) - t_ue 0 underline mode end (revert to default) - -These colors were chosen because they also look good when using an inverted -display, but you can change them to your liking. - -Example: > - :set t_mr=^V^[\|97m " start of invert mode: DarkBlue (1) on Brown (96) - :set t_md=^V^[\|67m " start of bold mode: DarkCyan (3) on DarkRed (64) - :set t_me=^V^[\|112m " back to normal mode: Black (0) on LightGray (112) - - :set t_so=^V^[\|37m " start of standout mode: DarkMagenta (5) on DarkGreen - (32) - :set t_se=^V^[\|112m " back to normal mode: Black (0) on LightGray (112) - -============================================================================== -5. File formats *dos-file-formats* - -If the 'fileformat' option is set to "dos" (which is the default), Vim accepts -a single <NL> or a <CR><NL> pair for end-of-line (<EOL>). When writing a -file, Vim uses <CR><NL>. Thus, if you edit a file and write it, Vim replaces -<NL> with <CR><NL>. - -If the 'fileformat' option is set to "unix", Vim uses a single <NL> for <EOL> -and shows <CR> as ^M. - -You can use Vim to replace <NL> with <CR><NL> by reading in any mode and -writing in Dos mode (":se ff=dos"). -You can use Vim to replace <CR><NL> with <NL> by reading in Dos mode and -writing in Unix mode (":se ff=unix"). - -Vim sets 'fileformat' automatically when 'fileformats' is not empty (which is -the default), so you don't really have to worry about what you are doing. - |'fileformat'| |'fileformats'| - -If you want to edit a script file or a binary file, you should set the -'binary' option before loading the file. Script files and binary files may -contain single <NL> characters which Vim would replace with <CR><NL>. You can -set 'binary' automatically by starting Vim with the "-b" (binary) option. - -============================================================================== -6. :cd command *dos-:cd* - -The ":cd" command recognizes the drive specifier and changes the current -drive. Use ":cd c:" to make drive C the active drive. Use ":cd d:\foo" to go -to the directory "foo" in the root of drive D. Vim also recognizes UNC names -if the system supports them; e.g., ":cd \\server\share\dir". |:cd| - -============================================================================== -7. Interrupting *dos-CTRL-Break* - -Use CTRL-Break instead of CTRL-C to interrupt searches. Vim does not detect -the CTRL-C until it tries to read a key. - -============================================================================== -8. Temp files *dos-temp-files* - -Vim uses standard Windows functions to obtain a temporary file name (for -filtering). The first of these directories that exists and in which Vim can -create a file is used: - $TMP - $TEMP - current directory - -============================================================================== -9. Shell option default *dos-shell* - -The default for the 'sh' ('shell') option is "cmd.exe" on Windows. -If SHELL is defined, Vim uses SHELL instead, and if SHELL is not defined -but COMSPEC is, Vim uses COMSPEC. Vim starts external commands with -"<shell> /c <command_name>". Typing CTRL-Z starts a new command -subshell. Return to Vim with "exit". |'shell'| |CTRL-Z| - -If you are running a third-party shell, you may need to set the -|'shellcmdflag'| ('shcf') and |'shellquote'| ('shq') or |'shellxquote'| -('sxq') options. Unfortunately, this also depends on the version of Vim used. -For example, with the MKS Korn shell or with bash, the values of the options -on Win32 should be: - -'shellcmdflag' -c -'shellquote' (empty) -'shellxquote' " - -For Win32, this starts the shell as: - <shell> -c "command name >file" - -When starting up, Vim checks for the presence of "sh" anywhere in the 'shell' -option. If it is present, Vim sets the 'shellcmdflag' and 'shellquote' or -'shellxquote' options will be set as described above. - - vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 84dce82176..5897f756d8 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.4. Last change: 2015 Mar 16 +*pattern.txt* For Vim version 7.4. Last change: 2016 Jan 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -392,8 +392,8 @@ Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used. Use of "\v" means that in the pattern after it all ASCII characters except '0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning. "very magic" -Use of "\V" means that in the pattern after it only the backslash has a -special meaning. "very nomagic" +Use of "\V" means that in the pattern after it only the backslash and the +terminating character (/ or ?) has a special meaning. "very nomagic" Examples: after: \v \m \M \V matches ~ @@ -401,6 +401,7 @@ after: \v \m \M \V matches ~ $ $ $ \$ matches end-of-line . . \. \. matches any character * * \* \* any number of the previous atom + ~ ~ \~ \~ latest substitute string () \(\) \(\) \(\) grouping into an atom | \| \| \| separating alternatives \a \a \a \a alphabetic character @@ -477,6 +478,7 @@ More explanation and examples below, follow the links. |/\%v| \%23v \%23v in virtual column 23 |/zero-width| Character classes: */character-classes* + magic nomagic matches ~ |/\i| \i \i identifier character (see 'isident' option) |/\I| \I \I like "\i", but excluding digits |/\k| \k \k keyword character (see 'iskeyword' option) @@ -507,6 +509,7 @@ Character classes: */character-classes* class with end-of-line included (end of character classes) + magic nomagic matches ~ |/\e| \e \e <Esc> |/\t| \t \t <Tab> |/\r| \r \r <CR> @@ -532,6 +535,7 @@ Character classes: */character-classes* |/\Z| \Z \Z ignore differences in Unicode "combining characters". Useful when searching voweled Hebrew or Arabic text. + magic nomagic matches ~ |/\m| \m \m 'magic' on for the following chars in the pattern |/\M| \M \M 'magic' off for the following chars in the pattern |/\v| \v \v the following chars in the pattern are "very magic" @@ -1090,7 +1094,10 @@ x A single character, with no special meaning, matches itself plausible pattern for a Unix filename: "[-./[:alnum:]_~]\+" That is, a list of at least one character, each of which is either '-', '.', '/', alphabetic, numeric, '_' or '~'. - These items only work for 8-bit characters. + These items only work for 8-bit characters, except [:lower:] and + [:upper:] also work for multi-byte characters when using the new + regexp engine. In the future these items may work for multi-byte + characters. */[[=* *[==]* - An equivalence class. This means that characters are matched that have almost the same meaning, e.g., when ignoring accents. This diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 7f5825ba25..1705010ff2 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.4. Last change: 2015 Jan 05 +*pi_netrw.txt* For Vim version 7.4. Last change: 2015 Oct 31 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -365,7 +365,12 @@ settings are described below, in |netrw-browser-options|, and in fun! MyFuncRef() endfun let g:Netrw_funcref= function("MyFuncRef") + < + *g:Netrw_UserMaps* specifies a function or |List| of functions which can + be used to set up user-specified maps and functionality. + See |netrw-usermaps| + *g:netrw_ftp* if it doesn't exist, use default ftp =0 use default ftp (uid password) =1 use alternate ftp method (user uid password) @@ -1062,9 +1067,10 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 < <F1> Causes Netrw to issue help <cr> Netrw will enter the directory or read the file |netrw-cr| <del> Netrw will attempt to remove the file/directory |netrw-del| - <c-h> Edit file hiding list |netrw-ctrl-h| - <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l| - <c-r> Browse using a gvim server |netrw-ctrl-r| + <c-h> Edit file hiding list |netrw-ctrl-h| + <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l| + <c-r> Browse using a gvim server |netrw-ctrl-r| + <c-tab> Shrink/expand a netrw/explore window |netrw-c-tab| - Makes Netrw go up one directory |netrw--| a Toggles between normal display, |netrw-a| hiding (suppress display of files matching g:netrw_list_hide) @@ -1077,6 +1083,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 gd Force treatment as directory |netrw-gd| gf Force treatment as file |netrw-gf| gh Quick hide/unhide of dot-files |netrw-gh| + gn Make top of tree the directory below the cursor |netrw-gn| i Cycle between thin, long, wide, and tree listings |netrw-i| mb Bookmark current directory |netrw-mb| mc Copy marked files to marked-file target directory |netrw-mc| @@ -1105,7 +1112,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 qf Display information on file |netrw-qf| qF Mark files using a quickfix list |netrw-qF| r Reverse sorting order |netrw-r| - R Rename the designed file(s)/directory(ies) |netrw-R| + R Rename the designated file(s)/directory(ies) |netrw-R| s Select sorting style: by name, time, or file size |netrw-s| S Specify suffix priority for name-sorting |netrw-S| t Enter the file/directory under the cursor in a new tab|netrw-t| @@ -1174,10 +1181,10 @@ Addtionally, one may use :NetrwMB to bookmark files or directories. > < No bang: enters files/directories into Netrw's bookmark system No argument and in netrw buffer: - if there are marked files: bookmark marked files - otherwise : bookmark file/directory under cursor + if there are marked files : bookmark marked files + otherwise : bookmark file/directory under cursor No argument and not in netrw buffer: bookmarks current open file - Has arguments: globs them individually and bookmarks them + Has arguments : |glob()|s each arg and bookmarks them With bang: deletes files/directories from Netrw's bookmark system @@ -1394,8 +1401,8 @@ list (unless |g:netrw_dirhistmax| is zero; by default, it's ten). With the the opposite, see |netrw-U|. The "u" map also accepts counts to go back in the history several slots. -For your convenience, |netrw-qb| lists the history number which can be -re-used in that count. +For your convenience, qb (see |netrw-qb|) lists the history number which may +be used in that count. *.netrwhist* See |g:netrw_dirhistmax| for how to control the quantity of history stack @@ -1412,7 +1419,7 @@ CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2 With the "U" map, one can change to a later directory (successor). This map is the opposite of the "u" map. (see |netrw-u|) Use the -q map to list both the bookmarks and history. (see |netrw-qb|) +qb map to list both the bookmarks and history. (see |netrw-qb|) The "U" map also accepts counts to go forward in the history several slots. @@ -1420,7 +1427,7 @@ See |g:netrw_dirhistmax| for how to control the quantity of history stack slots. -CHANGING TREE TOP *netrw-ntree* *:Ntree* {{{2 +CHANGING TREE TOP *netrw-ntree* *:Ntree* *netrw-gn* {{{2 One may specify a new tree top for tree listings using > @@ -1430,14 +1437,18 @@ Without a "dirname", the current line is used (and any leading depth information is elided). With a "dirname", the specified directory name is used. +The "gn" map will take the word below the cursor and use that for +changing the top of the tree listing. + NETRW CLEAN *netrw-clean* *:NetrwClean* {{{2 -With :NetrwClean one may easily remove netrw from one's home directory; +With NetrwClean one may easily remove netrw from one's home directory; more precisely, from the first directory on your |'runtimepath'|. -With :NetrwClean!, netrw will remove netrw from all directories on your -|'runtimepath'|. +With NetrwClean!, netrw will attempt to remove netrw from all directories on +your |'runtimepath'|. Of course, you have to have write/delete permissions +correct to do this. With either form of the command, netrw will first ask for confirmation that the removal is in fact what you want to do. If netrw doesn't have @@ -1454,6 +1465,7 @@ operating system). Netrw allows one to invoke such special handlers by: > * when Exploring, hit the "x" key * when editing, hit gx with the cursor atop the special filename < (latter not available if the |g:netrw_nogx| variable exists) + Netrw determines which special handler by the following method: * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to @@ -1629,19 +1641,23 @@ DIRECTORY EXPLORATION COMMANDS {{{2 of the current tab. It will open a netrw window on the current directory if [dir] is omitted; a :Lexplore [dir] will show the specified directory in the left-hand side browser display no matter - from which window the command is issued. By default, :Lexplore will - change an uninitialized |g:netrw_chgwin| to 2; edits will thus - preferentially be made in window#2. - The [N] specifies a |g:netrw_winsize| just for the new :Lexplore + from which window the command is issued. + + By default, :Lexplore will change an uninitialized |g:netrw_chgwin| + to 2; edits will thus preferentially be made in window#2. + + The [N] specifies a |g:netrw_winsize| just for the new :Lexplore window. - Those who like this method often also like tree style displays; + + Those who like this method often also often like tree style displays; see |g:netrw_liststyle|. - Also see: |netrw-C| |g:netrw_chgwin| |g:netrw_winsize| - |netrw-p| |netrw-P| |g:netrw_browse_split| + Also see: |netrw-C| |g:netrw_browse_split| |g:netrw_wiw| + |netrw-p| |netrw-P| |g:netrw_chgwin| + |netrw-c-tab| |g:netrw_winsize| :[N]Lexplore! is like :Lexplore, except that the full-height Explorer window - will open on the right hand side, and an uninitialized |g:netrw_chgwin| + will open on the right hand side and an uninitialized |g:netrw_chgwin| will be set to 1. *netrw-:Sexplore* @@ -2125,19 +2141,18 @@ is unlikely to be fixed. UNMARKING FILES *netrw-mF* {{{2 - (also see |netrw-mf|) + (also see |netrw-mf|, |netrw-mu|) -This command will unmark all files in the current buffer. One may also use -mf (|netrw-mf|) on a specific file to unmark just that file. +The "mF" command will unmark all files in the current buffer. One may also use +mf (|netrw-mf|) on a specific, already marked, file to unmark just that file. MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2 (also see |netrw-mf|) -One may convert the |quickfix-error-lists| into a marked file list using -"qF". You may then proceed with commands such as me (|netrw-me|) to -edit them. Quickfix error lists are generated, for example, by calls -to |:vimgrep|. +One may convert |quickfix-error-lists| into a marked file list using "qF". +You may then proceed with commands such as me (|netrw-me|) to edit them. +Quickfix error lists are generated, for example, by calls to |:vimgrep|. MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2 @@ -2155,14 +2170,17 @@ MARKED FILES, ARBITRARY VIM COMMAND *netrw-mv* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked-file list) -The "mv" map causes netrw execute an arbitrary vim command on each file -on the local marked file list, individually: +The "mv" map causes netrw to execute an arbitrary vim command on each file on +the local marked file list, individually: * 1split * sil! keepalt e file * run vim command * sil! keepalt wq! +A prompt, "Enter vim command: ", will be issued to elicit the vim command +you wish used. + MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) @@ -2194,13 +2212,13 @@ command to be applied to all marked files on the global marked file list. The command files -It is useful, for example, to select files and make a tarball: +This approach is useful, for example, to select files and make a tarball: > (mark files) mX Enter command: tar cf mynewtarball.tar - -The command that will be run in this example: +< +The command that will be run with this example: tar cf mynewtarball.tar 'file1' 'file2' ... @@ -2253,7 +2271,7 @@ MARKED FILES: EDITING *netrw-me* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the global marked file list) -This command will place the marked files on the |arglist| and commence +The "me" command will place the marked files on the |arglist| and commence editing them. One may return the to explorer window with |:Rexplore|. (use |:n| and |:p| to edit next and previous files in the arglist) @@ -2261,26 +2279,33 @@ MARKED FILES: GREP *netrw-mg* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the global marked file list) -This command will apply |:vimgrep| to the marked files. +The "mg" command will apply |:vimgrep| to the marked files. The command will ask for the requested pattern; one may then enter: > /pattern/[g][j] ! /pattern/[g][j] pattern < -In the cases of "j" option usage as shown above, "mg" will winnow the current -marked file list to just those possessing the specified pattern. -Thus, one may use > - mr ...file-pattern - mg ..contents-pattern -to have a marked file list satisfying the file-pattern but containing the -desired contents-pattern. +With /pattern/, editing will start with the first item on the |quickfix| list +that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|). The |:vimgrep| +command is in use, so without 'g' each line is added to quickfix list only +once; with 'g' every match is included. + +With /pattern/j, "mg" will winnow the current marked file list to just those +marked files also possessing the specified pattern. Thus, one may use > + + mr ...file-pattern... + mg /pattern/j +< +to have a marked file list satisfying the file-pattern but also restricted to +files containing some desired pattern. + MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked file list) -This command extracts the suffices of the marked files and toggles their +The "mh" command extracts the suffices of the marked files and toggles their presence on the hiding list. Please note that marking the same suffix this way multiple times will result in the suffix's presence being toggled for each file (so an even quantity of marked files having the same suffix @@ -2309,16 +2334,16 @@ MARKED FILES: PRINTING *netrw-mp* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked file list) -Netrw will apply the |:hardcopy| command to marked files. What it does -is open each file in a one-line window, execute hardcopy, then close the -one-line window. +When "mp" is used, netrw will apply the |:hardcopy| command to marked files. +What netrw does is open each file in a one-line window, execute hardcopy, then +close the one-line window. MARKED FILES: SOURCING *netrw-ms* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked file list) -Netrw will source the marked files (using vim's |:source| command) +With "ms", netrw will source the marked files (using vim's |:source| command) MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2 @@ -2341,6 +2366,9 @@ Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|): This command uses |<q-args>|, so spaces in the directory name are permitted without escaping. + * With mouse-enabled vim or with gvim, one may select a target by using + <c-leftmouse> + There is only one copy/move-to target at a time in a vim session; ie. the target is a script variable (see |s:var|) and is shared between all netrw windows (in an instance of vim). @@ -2417,9 +2445,13 @@ Related topics: MARKED FILES: UNMARKING *netrw-mu* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf|, |netrw-mF|) + +The "mu" mapping will unmark all currently marked files. This command differs +from "mF" as the latter only unmarks files in the current directory whereas +"mu" will unmark global and all buffer-local marked files. +(see |netrw-mF|) -The "mu" mapping will unmark all currently marked files. *netrw-browser-settings* NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2 @@ -2724,6 +2756,11 @@ your browsing preferences. (see also: |netrw-settings|) evaluation will be suppressed (see |'ballooneval'|) + *g:netrw_usetab* if this variable exists and is non-zero, then + the <tab> map supporting shrinking/expanding a + Lexplore or netrw window will be enabled. + (see |netrw-c-tab|) + *g:netrw_remote_mkdir* command for making a remote directory via ftp (also see |g:netrw_mkdir_cmd|) default: "mkdir" @@ -2760,7 +2797,8 @@ your browsing preferences. (see also: |netrw-settings|) |netrw-ctrl-r| to use for its server. default: "NETRWSERVER" - *g:netrw_sort_by* sort by "name", "time", or "size" + *g:netrw_sort_by* sort by "name", "time", "size", or + "exten". default: "name" *g:netrw_sort_direction* sorting direction: "normal" or "reverse" @@ -2872,6 +2910,10 @@ your browsing preferences. (see also: |netrw-settings|) take effect, for example). default: 50 (for 50%) + *g:netrw_wiw* =1 specifies the minimum window width to use + when shrinking a netrw/Lexplore window + (see |netrw-c-tab|). + *g:netrw_xstrlen* Controls how netrw computes string lengths, including multi-byte characters' string length. (thanks to N Weibull, T Mechelynck) @@ -2917,7 +2959,7 @@ help on what each of the variables do. ============================================================================== -OBTAINING A FILE *netrw-O* {{{2 +OBTAINING A FILE *netrw-obtain* *netrw-O* {{{2 If there are no marked files: @@ -2947,7 +2989,7 @@ Related topics: * To automatically make the currently browsed directory the current directory, see |g:netrw_keepdir|. - *netrw-createfile* + *netrw-newfile* *netrw-createfile* OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* {{{2 To open a new file in netrw's current directory, press "%". This map @@ -2979,10 +3021,13 @@ These will: will use only 30% of the columns available; the rest of the window is used for the preview window. -Also see: |g:netrw_chgwin| |netrw-P| + Related: if you like this idea, you may also find :Lexplore + (|netrw-:Lexplore|) or |g:netrw_chgwin| of interest +Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| -PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2 + +PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2 To edit a file or directory in the previously used (last accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one window, then the one window @@ -3004,7 +3049,7 @@ Associated setting variables: Also see: |g:netrw_chgwin| |netrw-p| -REFRESHING THE LISTING *netrw-ctrl-l* *netrw-ctrl_l* {{{2 +REFRESHING THE LISTING *netrw-refresh* *netrw-ctrl-l* *netrw-ctrl_l* {{{2 To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or hit the <cr> when atop the ./ directory entry in the listing. One may also @@ -3024,11 +3069,12 @@ RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2 If there are no marked files: (see |netrw-mf|) - Renaming/moving files and directories involves moving the cursor to the + Renaming files and directories involves moving the cursor to the file/directory to be moved (renamed) and pressing "R". You will then be - queried for where you want the file/directory to be moved. You may select + queried for what you want the file/directory to be renamed to You may select a range of lines with the "V" command (visual selection), and then - pressing "R". + press "R"; you will be queried for each file as to what you want it + renamed to. If there are marked files: (see |netrw-mf|) @@ -3046,6 +3092,14 @@ If there are marked files: (see |netrw-mf|) This example will mark all *.c files and then rename them to *.cpp files. + The ctrl-X character has special meaning for renaming files: > + + <c-x> : a single ctrl-x tells netrw to ignore the portion of the response + lying between the last '/' and the ctrl-x. + + <c-x><c-x> : a pair of contiguous ctrl-x's tells netrw to ignore any + portion of the string preceding the double ctrl-x's. +< WARNING:~ Note that moving files is a dangerous operation; copies are safer. That's @@ -3053,13 +3107,13 @@ If there are marked files: (see |netrw-mf|) the copy fails and the delete does not, you may lose the file. Use at your own risk. -The g:netrw_rename_cmd variable is used to implement renaming. By default its -value is: +The g:netrw_rename_cmd variable is used to implement remote renaming. By +default its value is: ssh HOSTNAME mv One may rename a block of files and directories by selecting them with -the V (|linewise-visual|). +V (|linewise-visual|) when using thin style SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2 @@ -3072,18 +3126,19 @@ Related topics: |netrw-r| |netrw-S| Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence| -SETTING EDITING WINDOW *netrw-C* *netrw-:NetrwC* {{{2 +SETTING EDITING WINDOW *netrw-editwindow* *netrw-C* *netrw-:NetrwC* {{{2 One may select a netrw window for editing with the "C" mapping, using the -:NetrwC [win#] command, or by setting g:netrw_chgwin to the selected window +:NetrwC [win#] command, or by setting |g:netrw_chgwin| to the selected window number. Subsequent selection of a file to edit (|netrw-cr|) will use that window. - * C by itself, will select the current window for editing via - |netrw-cr| + * C : by itself, will select the current window holding a netrw buffer + for editing via |netrw-cr|. The C mapping is only available while in + netrw buffers. - * [count]C the count will be used as the window number to be used - for editing via |netrw-cr|. + * [count]C : the count will be used as the window number to be used + for subsequent editing via |netrw-cr|. * :NetrwC will set |g:netrw_chgwin| to the current window @@ -3092,12 +3147,91 @@ window. Using > let g:netrw_chgwin= -1 -will restore the default editing behavior (ie. use the current window). +will restore the default editing behavior +(ie. editing will use the current window). Related topics: |netrw-cr| |g:netrw_browse_split| Associated setting variables: |g:netrw_chgwin| +SHRINKING OR EXPANDING A NETRW OR LEXPLORE WINDOW *netrw-c-tab* {{{2 + +The <c-tab> key will toggle a netrw or |:Lexplore| window's width, +but only if |g:netrw_usetab| exists and is non-zero (and, of course, +only if your terminal supports differentiating <c-tab> from a plain +<tab>). + + * If the current window is a netrw window, toggle its width + (between |g:netrw_wiw| and its original width) + + * Else if there is a |:Lexplore| window in the current tab, toggle + its width + + * Else bring up a |:Lexplore| window + +If |g:netrw_usetab| exists or is zero, or if there is a pre-existing mapping +for <c-tab>, then the <tab> will not be mapped. One may map something other +than a <c-tab>, too: (but you'll still need to have had g:netrw_usetab set) > + + nmap <unique> (whatever) <Plug>NetrwShrink +< +Related topics: |:Lexplore| +Associated setting variable: |g:netrw_usetab| + + +USER SPECIFIED MAPS *netrw-usermaps* {{{1 + +One may make customized user maps. Specify a variable, |g:Netrw_UserMaps|, +to hold a |List| of lists of keymap strings and function names: > + + [["keymap-sequence","ExampleUserMapFunc"],...] +< +When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps| +exists, then the internal function netrw#UserMaps(islocal) is called. +This function goes through all the entries in the |g:Netrw_UserMaps| list: + + * sets up maps: > + nno <buffer> <silent> KEYMAP-SEQUENCE + :call s:UserMaps(islocal,"ExampleUserMapFunc") +< * refreshes if result from that function call is the string + "refresh" + * if the result string is not "", then that string will be + executed (:exe result) + * if the result is a List, then the above two actions on results + will be taken for every string in the result List + +The user function is passed one argument; it resembles > + + fun! ExampleUserMapFunc(islocal) +< +where a:islocal is 1 if its a local-directory system call or 0 when +remote-directory system call. + +Use netrw#Expose("varname") to access netrw-internal (script-local) + variables. +Use netrw#Modify("varname",newvalue) to change netrw-internal variables. +Use netrw#Call("funcname"[,args]) to call a netrw-internal function with + specified arguments. + +Example: Get a copy of netrw's marked file list: > + + let netrwmarkfilelist= netrw#Expose("netrwmarkfilelist") +< +Example: Modify the value of netrw's marked file list: > + + call netrw#Modify("netrwmarkfilelist",[]) +< +Example: Clear netrw's marked file list via a mapping on gu > + " ExampleUserMap: {{{2 + fun! ExampleUserMap(islocal) + call netrw#Modify("netrwmarkfilelist",[]) + call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"") + let retval= ["refresh"] + return retval + endfun + let g:Netrw_UserMaps= [["gu","ExampleUserMap"]] +< + 10. Problems and Fixes *netrw-problems* {{{1 (This section is likely to grow as I get feedback) @@ -3272,6 +3406,7 @@ Associated setting variables: |g:netrw_chgwin| The first one (|g:netrw_ssh_cmd|) is the most important; most of the others will use the string in g:netrw_ssh_cmd by default. + *netrw-p9* *netrw-ml_get* P9. I'm browsing, changing directory, and bang! ml_get errors appear and I have to kill vim. Any way around this? @@ -3298,6 +3433,14 @@ Associated setting variables: |g:netrw_chgwin| P11. I want to have two windows; a thin one on the left and my editing window on the right. How may I accomplish this? + You probably want netrw running as in a side window. If so, you + will likely find that ":[N]Lexplore" does what you want. The + optional "[N]" allows you to select the quantity of columns you + wish the |:Lexplore|r window to start with (see |g:netrw_winsize| + for how this parameter works). + + Previous solution: + * Put the following line in your <.vimrc>: let g:netrw_altv = 1 * Edit the current directory: :e . @@ -3311,6 +3454,7 @@ Associated setting variables: |g:netrw_chgwin| <leftmouse> in the browser window and then press the <middlemouse> to select the file. + *netrw-p12* P12. My directory isn't sorting correctly, or unwanted letters are appearing in the listed filenames, or things aren't lining @@ -3388,7 +3532,7 @@ Associated setting variables: |g:netrw_chgwin| to open a swap file. (romainl) It looks like you are starting Vim from a protected - directory. Start if from your $HOME or another writable + directory. Start netrw from your $HOME or other writable directory. *netrw-p17* @@ -3412,6 +3556,58 @@ Associated setting variables: |g:netrw_chgwin| "Using Vim to Remotely Edit A File on ServerB Only Accessible From ServerA" + *netrw-P19* + P19. How do I get numbering on in directory listings? + With |g:netrw_bufsettings|, you can control netrw's buffer + settings; try putting > + let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu" +< in your .vimrc. If you'd like to have relative numbering + instead, try > + let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu" +< + *netrw-P20* + P20. How may I have gvim start up showing a directory listing? + Try putting the following code snippet into your .vimrc: > + augroup VimStartup + au! + au VimEnter * if expand("%") == "" && argc() == 0 && + \ (v:servername =~ 'GVIM\d*' || v:servername == "") + \ | e . | endif + augroup END +< You may use Lexplore instead of "e" if you're so inclined. + This snippet assumes that you have client-server enabled + (ie. a "huge" vim version). + + *netrw-P21* + P21. I've made a directory (or file) with an accented character, but + netrw isn't letting me enter that directory/read that file: + + Its likely that the shell or o/s is using a different encoding + than you have vim (netrw) using. A patch to vim supporting + "systemencoding" may address this issue in the future; for + now, just have netrw use the proper encoding. For example: > + + au FileType netrw set enc=latin1 +< + *netrw-P22* + P22. I get an error message when I try to copy or move a file: + + **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work! + + What's wrong? + + Netrw uses several system level commands to do things (see + + |g:netrw_localcopycmd|, |g:netrw_localmovecmd|, + |g:netrw_localrmdir|, |g:netrw_mkdir_cmd|). + + You may need to adjust the default commands for one or more of + these commands by setting them properly in your .vimrc. Another + source of difficulty is that these commands use vim's local + directory, which may not be the same as the browsing directory + shown by netrw (see |g:netrw_keepdir|). + + ============================================================================== 11. Debugging Netrw Itself *netrw-debug* {{{1 @@ -3502,6 +3698,46 @@ netrw: ============================================================================== 12. History *netrw-history* {{{1 + v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where + a file was not treated properly as a file + due to g:netrw_keepdir == 1 + Mar 25, 2015 * (requested by Ben Friz) one may now sort by + extension + Mar 28, 2015 * (requested by Matt Brooks) netrw has a lot + of buffer-local mappings; however, some + plugins (such as vim-surround) set up + conflicting mappings that cause vim to wait. + The "<nowait>" modifier has been included + with most of netrw's mappings to avoid that + delay. + Jun 26, 2015 * |netrw-gn| mapping implemted + * :Ntree NotADir resulted in having + the tree listing expand in the error messages + window. Fixed. + Jun 29, 2015 * Attempting to delete a file remotely caused + an error with "keepsol" mentioned; fixed. + Jul 08, 2015 * Several changes to keep the |:jumps| table + correct when working with + |g:netrw_fastbrowse| set to 2 + * wide listing with accented characters fixed + (using %-S instead of %-s with a |printf()| + Jul 13, 2015 * (Daniel Hahler) CheckIfKde() could be true + but kfmclient not installed. Changed order + in netrw#BrowseX(): checks if kde and + kfmclient, then will use xdg-open on a unix + system (if xdg-open is executable) + Aug 11, 2015 * (McDonnell) tree listing mode wouldn't + select a file in a open subdirectory. + * (McDonnell) when multiple subdirectories + were concurrently open in tree listing + mode, a ctrl-L wouldn't refresh properly. + * The netrw:target menu showed duplicate + entries + Oct 13, 2015 * (mattn) provided an exception to handle + windows with shellslash set but no shell + Oct 23, 2015 * if g:netrw_usetab and <c-tab> now used + to control whether NetrwShrink is used + (see |netrw-c-tab|) v153: May 13, 2014 * added another |g:netrw_ffkeep| usage {{{2 May 14, 2014 * changed s:PerformListing() so that it always sets ft=netrw for netrw buffers diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index bcce5a983a..ff4fded0d9 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 7.4. Last change: 2014 Mar 27 +*quickfix.txt* For Vim version 7.4. Last change: 2015 Sep 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -302,16 +302,22 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: etc. < When the current file can't be |abandon|ed and the [!] is not present, the command fails. - When an error is detected on one buffer, further - buffers will not be visited. + When an error is detected excecution stops. The last buffer (or where an error occurred) becomes the current buffer. {cmd} can contain '|' to concatenate several commands. + Only valid entries in the quickfix list are used. + A range can be used to select entries, e.g.: > + :10,$cdo cmd +< To skip entries 1 to 9. + Note: While this command is executing, the Syntax autocommand event is disabled by adding it to 'eventignore'. This considerably speeds up editing each buffer. + {not in Vi} {not available when compiled without the + |+listcmds| feature} Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, |:ldo|, |:cfdo| and |:lfdo|. @@ -323,20 +329,9 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: :cnfile :{cmd} etc. -< When the current file can't be |abandon|ed and the [!] - is not present, the command fails. - When an error is detected on one buffer, further - buffers will not be visited. - The last buffer (or where an error occurred) becomes - the current buffer. - {cmd} can contain '|' to concatenate several commands. - Only valid entries in the quickfix list are used. - Note: While this command is executing, the Syntax - autocommand event is disabled by adding it to - 'eventignore'. This considerably speeds up editing - each buffer. - Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, - |:cdo|, |:ldo| and |:lfdo|. +< Otherwise it works the same as `:cdo`. + {not in Vi} {not available when compiled without the + |+listcmds| feature} *:ldo* :ld[o][!] {cmd} Execute {cmd} in each valid entry in the location list @@ -347,20 +342,10 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: :lnext :{cmd} etc. -< When the current file can't be |abandon|ed and the [!] - is not present, the command fails. - When an error is detected on one buffer, further - buffers will not be visited. - The last buffer (or where an error occurred) becomes - the current buffer. - {cmd} can contain '|' to concatenate several commands. - Only valid entries in the location list are used. - Note: While this command is executing, the Syntax - autocommand event is disabled by adding it to - 'eventignore'. This considerably speeds up editing - each buffer. - Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, - |:cdo|, |:cfdo| and |:lfdo|. +< Only valid entries in the location list are used. + Otherwise it works the same as `:cdo`. + {not in Vi} {not available when compiled without the + |+listcmds| feature} *:lfdo* :lfdo[!] {cmd} Execute {cmd} in each file in the location list for @@ -371,20 +356,9 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: :lnfile :{cmd} etc. -< When the current file can't be |abandon|ed and the [!] - is not present, the command fails. - When an error is detected on one buffer, further - buffers will not be visited. - The last buffer (or where an error occurred) becomes - the current buffer. - {cmd} can contain '|' to concatenate several commands. - Only valid entries in the location list are used. - Note: While this command is executing, the Syntax - autocommand event is disabled by adding it to - 'eventignore'. This considerably speeds up editing - each buffer. - Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|, - |:cdo|, |:ldo| and |:cfdo|. +< Otherwise it works the same as `:ldo`. + {not in Vi} {not available when compiled without the + |+listcmds| feature} ============================================================================= 2. The error window *quickfix-window* diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index ded5e69438..8e40628e25 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 7.4. Last change: 2014 Nov 19 +*quickref.txt* For Vim version 7.4. Last change: 2015 Nov 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -617,6 +617,7 @@ Short explanation of each option: *option-list* 'balloondelay' 'bdlay' delay in mS before a balloon may pop up 'ballooneval' 'beval' switch on balloon evaluation 'balloonexpr' 'bexpr' expression to show in balloon +'belloff' 'bo' do not ring the bell for these reasons 'binary' 'bin' read/write/edit file in binary mode 'bomb' prepend a Byte Order Mark to the file 'breakat' 'brk' characters that may cause a line break @@ -688,6 +689,7 @@ Short explanation of each option: *option-list* 'fileignorecase' 'fic' ignore case when using file names 'filetype' 'ft' type of file, used for autocommands 'fillchars' 'fcs' characters to use for displaying special items +'fixendofline' 'fixeol' make sure last line in file has <EOL> 'fkmap' 'fk' Farsi keyboard mapping 'foldclose' 'fcl' close a fold when the cursor leaves it 'foldcolumn' 'fdc' width of the column used to indicate folds @@ -702,10 +704,10 @@ Short explanation of each option: *option-list* 'foldnestmax' 'fdn' maximum fold depth 'foldopen' 'fdo' for which commands a fold will be opened 'foldtext' 'fdt' expression used to display for a closed fold +'formatexpr' 'fex' expression used with "gq" command 'formatlistpat' 'flp' pattern used to recognize a list header 'formatoptions' 'fo' how automatic formatting is to be done 'formatprg' 'fp' name of external program used with "gq" command -'formatexpr' 'fex' expression used with "gq" command 'fsync' 'fs' whether to invoke fsync() after file write 'gdefault' 'gd' the ":substitute" flag 'g' is default on 'grepformat' 'gfm' format of 'grepprg' output @@ -798,6 +800,7 @@ Short explanation of each option: *option-list* 'patchexpr' 'pex' expression used to patch a file 'patchmode' 'pm' keep the oldest version of a file 'path' 'pa' list of directories searched with "gf" et.al. +'perldll' name of the Perl dynamic library 'preserveindent' 'pi' preserve the indent structure when reindenting 'previewheight' 'pvh' height of the preview window 'previewwindow' 'pvw' identifies the preview window @@ -810,6 +813,8 @@ Short explanation of each option: *option-list* 'printmbfont' 'pmbfn' font names to be used for CJK output of :hardcopy 'printoptions' 'popt' controls the format of :hardcopy output 'pumheight' 'ph' maximum height of the popup menu +'pythondll' name of the Python 2 dynamic library +'pythonthreedll' name of the Python 3 dynamic library 'quoteescape' 'qe' escape characters used in a string 'readonly' 'ro' disallow writing the buffer 'redrawtime' 'rdt' timeout for 'hlsearch' and |:match| highlighting @@ -820,6 +825,7 @@ Short explanation of each option: *option-list* 'revins' 'ri' inserting characters will work backwards 'rightleft' 'rl' window is right-to-left oriented 'rightleftcmd' 'rlc' commands for which editing works right-to-left +'rubydll' name of the Ruby dynamic library 'ruler' 'ru' show cursor line and column in the status line 'rulerformat' 'ruf' custom format for the ruler 'runtimepath' 'rtp' list of directories used for runtime files @@ -873,10 +879,11 @@ Short explanation of each option: *option-list* 'switchbuf' 'swb' sets behavior when switching to another buffer 'synmaxcol' 'smc' maximum column to find syntax items 'syntax' 'syn' syntax to be loaded for current buffer -'tabstop' 'ts' number of spaces that <Tab> in file uses 'tabline' 'tal' custom format for the console tab pages line 'tabpagemax' 'tpm' maximum number of tab pages for |-p| and "tab all" +'tabstop' 'ts' number of spaces that <Tab> in file uses 'tagbsearch' 'tbs' use binary searching in tags files +'tagcase' 'tc' how to handle case when searching in tags files 'taglength' 'tl' number of significant characters for a tag 'tagrelative' 'tr' file names in tag file are relative 'tags' 'tag' list of file names used by the tag command diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 21b5eef811..343d3e62cf 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.4. Last change: 2015 Apr 13 +*repeat.txt* For Vim version 7.4. Last change: 2016 Jan 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -109,6 +109,12 @@ q{0-9a-zA-Z"} Record typed characters into register {0-9a-zA-Z"} while executing a register, and it doesn't work inside a mapping and |:normal|. + Note: If the register being used for recording is also + used for |y| and |p| the result is most likely not + what is expected, because the put will paste the + recorded macro and the yank will overwrite the + recorded macro. + q Stops recording. Implementation note: The 'q' that stops recording is not stored in the register, unless it was the result @@ -461,16 +467,44 @@ Additionally, these commands can be used: finish Finish the current script or user function and come back to debug mode for the command after the one that sourced or called it. + *>bt* + *>backtrace* + *>where* + backtrace Show the call stacktrace for current debugging session. + bt + where + *>frame* + frame N Goes to N backtrace level. + and - signs make movement + relative. E.g., ":frame +3" goes three frames up. + *>up* + up Goes one level up from call stacktrace. + *>down* + down Goes one level down from call stacktrace. About the additional commands in debug mode: - There is no command-line completion for them, you get the completion for the normal Ex commands only. -- You can shorten them, up to a single character: "c", "n", "s" and "f". +- You can shorten them, up to a single character, unless more then one command + starts with the same letter. "f" stands for "finish", use "fr" for "frame". - Hitting <CR> will repeat the previous one. When doing another command, this is reset (because it's not clear what you want to repeat). - When you want to use the Ex command with the same name, prepend a colon: ":cont", ":next", ":finish" (or shorter). +The backtrace shows the hierarchy of function calls, e.g.: + >bt ~ + 3 function One[3] ~ + 2 Two[3] ~ + ->1 Three[3] ~ + 0 Four ~ + line 1: let four = 4 ~ + +The "->" points to the current frame. Use "up", "down" and "frame N" to +select another frame. + +In the current frame you can evaluate the local function variables. There is +no way to see the command at the current line yet. + DEFINING BREAKPOINTS *:breaka* *:breakadd* diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 752444a3bd..a767f6cbbf 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.4. Last change: 2014 Sep 19 +*spell.txt* For Vim version 7.4. Last change: 2016 Jan 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1373,6 +1373,14 @@ the item name. Case is always ignored. The Hunspell feature to use three arguments and flags is not supported. + *spell-NOCOMPOUNDSUGS* +This item indicates that using compounding to make suggestions is not a good +idea. Use this when compounding is used with very short or one-character +words. E.g. to make numbers out of digits. Without this flag creating +suggestions would spend most time trying all kind of weird compound words. + + NOCOMPOUNDSUGS ~ + *spell-SYLLABLE* The SYLLABLE item defines characters or character sequences that are used to count the number of syllables in a word. Example: diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index e2473976eb..46efe1996a 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -217,7 +217,7 @@ argument. :set to display option values. When 'verbose' is non-zero messages are printed (for debugging, to stderr). - 'term' and $TERM are not used. + $TERM is not used. If Vim appears to be stuck try typing "qa!<Enter>". You don't get a prompt thus you can't see Vim is waiting for you to type something. @@ -315,9 +315,10 @@ argument. When {vimrc} is equal to "NONE" (all uppercase), all initializations from files and environment variables are skipped, including reading the |ginit.vim| file when the GUI - starts. Loading plugins is also skipped. + starts. Plugins and syntax highlighting are also skipped. When {vimrc} is equal to "NORC" (all uppercase), this has the - same effect as "NONE", but loading plugins is not skipped. + same effect as "NONE", but plugins and syntax highlighting are + not skipped. *-i* -i {shada} The file {shada} is used instead of the default ShaDa @@ -349,18 +350,15 @@ argument. -W {scriptout} Like -w, but do not append, overwrite an existing file. ============================================================================== -3. Initialization *initialization* *startup* +2. Initialization *initialization* *startup* At startup, Vim checks environment variables and files and sets values accordingly. Vim proceeds in this order: -1. Set the 'shell' and 'term' option *SHELL* *COMSPEC* *TERM* +1. Set the 'shell' option *SHELL* *COMSPEC* *TERM* The environment variable SHELL, if it exists, is used to set the 'shell' option. On Windows, the COMSPEC variable is used if SHELL is not set. - The environment variable TERM, if it exists, is used to set the 'term' - option. However, 'term' will change later when starting the GUI (step - 8 below). 2. Process the arguments The options and file names from the command that start Vim are @@ -382,6 +380,8 @@ accordingly. Vim proceeds in this order: Places for your personal initializations: Unix $XDG_CONFIG_HOME/nvim/init.vim (default for $XDG_CONFIG_HOME is ~/.config) + Windows $XDG_CONFIG_HOME/nvim/init.vim + (default for $XDG_CONFIG_HOME is ~/AppData/Local) The files are searched in the order specified above and only the first one that is found is read. @@ -394,7 +394,8 @@ accordingly. Vim proceeds in this order: All following initializations until 4. are skipped. $MYVIMRC is not set. "vim -u NORC" can be used to skip these initializations without - reading a file. "vim -u NONE" also skips loading plugins. |-u| + reading a file. "vim -u NONE" also skips plugins and syntax + highlighting. |-u| If Vim was started in Ex mode with the "-s" argument, all following initializations until 4. are skipped. Only the "-u" option is @@ -427,7 +428,22 @@ accordingly. Vim proceeds in this order: - The file ".exrc" (for Unix) "_exrc" (for Win32) -4. Load the plugin scripts. *load-plugins* +4. Enable filetype and indent plugins. + This does the same as the commands: > + :runtime! filetype.vim + :runtime! ftplugin.vim + :runtime! indent.vim +< This step is skipped if ":filetype ..." was called before now or if + the "-u NONE" command line argument was given. + +5. Enable syntax highlighting. + This does the same as the command: > + :runtime! syntax/syntax.vim +< Note: This enables filetype detection even if ":filetype off" was + called before now. + This step is skipped if the "-u NONE" command line argument was given. + +6. Load the plugin scripts. *load-plugins* This does the same as the command: > :runtime! plugin/**/*.vim < The result is that all directories in the 'runtimepath' option will be @@ -443,31 +459,30 @@ accordingly. Vim proceeds in this order: commands from the command line have not been executed yet. You can use "--cmd 'set noloadplugins'" |--cmd|. -5. Set 'shellpipe' and 'shellredir' +7. Set 'shellpipe' and 'shellredir' The 'shellpipe' and 'shellredir' options are set according to the value of the 'shell' option, unless they have been set before. This means that Vim will figure out the values of 'shellpipe' and 'shellredir' for you, unless you have set them yourself. -6. Set 'updatecount' to zero, if "-n" command argument used +8. Set 'updatecount' to zero, if "-n" command argument used -7. Set binary options +9. Set binary options If the "-b" flag was given to Vim, the options for binary editing will be set now. See |-b|. -8. Perform GUI initializations +10. Perform GUI initializations Only when starting "gvim", the GUI initializations will be done. See |gui-init|. -9. Read the ShaDa file - If the 'shada' option is not empty, the ShaDa file is read. See - |shada-file|. +11. Read the ShaDa file + See |shada-file|. -10. Read the quickfix file +12. Read the quickfix file If the "-q" flag was given to Vim, the quickfix file is read. If this fails, Vim exits. -11. Open all windows +13. Open all windows When the |-o| flag was given, windows will be opened (but not displayed yet). When the |-p| flag was given, tab pages will be created (but not @@ -476,7 +491,7 @@ accordingly. Vim proceeds in this order: If the "-q" flag was given to Vim, the first error is jumped to. Buffers for all windows will be loaded. -12. Execute startup commands +14. Execute startup commands If a "-t" flag was given to Vim, the tag is jumped to. The commands given with the |-c| and |+cmd| arguments are executed. The starting flag is reset, has("vim_starting") will now return zero. @@ -586,7 +601,7 @@ This still won't work for systems where gvim does not use stdout at all though. ============================================================================== -4. $VIM and $VIMRUNTIME +3. $VIM and $VIMRUNTIME *$VIM* The environment variable "$VIM" is used to locate various user files for Vim, such as the user startup script |init.vim|. This depends on the system, see @@ -648,7 +663,7 @@ greps in the help files) you might be able to use this: > VIMRUNTIME="$(nvim -e --cmd 'echo $VIMRUNTIME|quit' 2>&1)" ============================================================================== -5. Suspending *suspend* +4. Suspending *suspend* *iconize* *iconise* *CTRL-Z* *v_CTRL-Z* CTRL-Z Suspend Vim, like ":stop". @@ -681,7 +696,7 @@ can't paste it in another application (since Vim is going to sleep an attempt to get the selection would make the program hang). ============================================================================== -6. Saving settings *save-settings* +5. Saving settings *save-settings* Mostly you will edit your vimrc files manually. This gives you the greatest flexibility. There are a few commands to generate a vimrc file automatically. @@ -705,8 +720,8 @@ vimrc file. These commands will write ":map" and ":set" commands to a file, in such a way that when these commands are executed, the current key mappings and options will be set to the same values. The options 'columns', 'endofline', -'fileformat', 'lines', 'modified', 'scroll', and 'term' are not included, -because these are terminal or file dependent. +'fileformat', 'lines', 'modified', and 'scroll' are not included, because +these are terminal or file dependent. Note that the options 'binary', 'paste' and 'readonly' are included, this might not always be what you want. @@ -738,7 +753,7 @@ these steps: You need to escape special characters, esp. spaces. ============================================================================== -7. Views and Sessions *views-sessions* +6. Views and Sessions *views-sessions* This is introduced in sections |21.4| and |21.5| of the user manual. @@ -882,7 +897,7 @@ To automatically save and restore views for *.c files: > au BufWinEnter *.c silent loadview ============================================================================== -8. The ShaDa file *shada* *shada-file* +7. The ShaDa file *shada* *shada-file* If you exit Vim and later start it again, you would normally lose a lot of information. The ShaDa file can be used to remember that information, which diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 6aed7441a0..81ba639dbe 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2015 Mar 29 +*syntax.txt* For Vim version 7.4. Last change: 2015 Dec 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -417,18 +417,19 @@ and last line to be converted. Example, using the last set Visual area: > *:TOhtml* :[range]TOhtml The ":TOhtml" command is defined in a standard plugin. This command will source |2html.vim| for you. When a - range is given, set |g:html_start_line| and - |g:html_end_line| to the start and end of the range, - respectively. Default range is the entire buffer. - - If the current window is part of a |diff|, unless - |g:html_diff_one_file| is set, :TOhtml will convert - all windows which are part of the diff in the current - tab and place them side-by-side in a <table> element - in the generated HTML. With |g:html_line_ids| you can - jump to lines in specific windows with (for example) - #W1L42 for line 42 in the first diffed window, or - #W3L87 for line 87 in the third. + range is given, this command sets |g:html_start_line| + and |g:html_end_line| to the start and end of the + range, respectively. Default range is the entire + buffer. + + If the current window is part of a |diff|, unless + |g:html_diff_one_file| is set, :TOhtml will convert + all windows which are part of the diff in the current + tab and place them side-by-side in a <table> element + in the generated HTML. With |g:html_line_ids| you can + jump to lines in specific windows with (for example) + #W1L42 for line 42 in the first diffed window, or + #W3L87 for line 87 in the third. Examples: > @@ -742,6 +743,22 @@ and UTF-32 instead, use: > Note that documents encoded in either UTF-32 or UTF-16 have known compatibility problems with some major browsers. + *g:html_font* +Default: "monospace" +You can specify the font or fonts used in the converted document using +g:html_font. If this option is set to a string, then the value will be +surrounded with single quotes. If this option is set to a list then each list +item is surrounded by single quotes and the list is joined with commas. Either +way, "monospace" is added as the fallback generic family name and the entire +result used as the font family (using CSS) or font face (if not using CSS). +Examples: > + + " font-family: 'Consolas', monospace; + :let g:html_font = "Consolas" + + " font-family: 'DejaVu Sans Mono', 'Consolas', monospace; + :let g:html_font = ["DejaVu Sans Mono", "Consolas"] +< *convert-to-XML* *convert-to-XHTML* *g:html_use_xhtml* Default: 0. When 0, generate standard HTML 4.01 (strict when possible). @@ -1059,7 +1076,8 @@ CPP *cpp.vim* *ft-cpp-syntax* Most of things are same as |ft-c-syntax|. Variable Highlight ~ -cpp_no_c11 don't highlight C++11 standard items +cpp_no_cpp11 don't highlight C++11 standard items +cpp_no_cpp14 don't highlight C++14 standard items CSH *csh.vim* *ft-csh-syntax* @@ -1415,34 +1433,28 @@ form, then > :let fortran_fixed_source=1 in your vimrc prior to the :syntax on command. -If the form of the source code depends upon the file extension, then it is -most convenient to set fortran_free_source in a ftplugin file. For more -information on ftplugin files, see |ftplugin|. For example, if all your -fortran files with an .f90 extension are written in free source form and the -rest in fixed source form, add the following code to your ftplugin file > - let s:extfname = expand("%:e") - if s:extfname ==? "f90" - let fortran_free_source=1 - unlet! fortran_fixed_source - else - let fortran_fixed_source=1 - unlet! fortran_free_source - endif -Note that this will work only if the "filetype plugin indent on" command -precedes the "syntax on" command in your vimrc file. +If the form of the source code depends, in a non-standard way, upon the file +extension, then it is most convenient to set fortran_free_source in a ftplugin +file. For more information on ftplugin files, see |ftplugin|. Note that this +will work only if the "filetype plugin indent on" command precedes the "syntax +on" command in your .vimrc file. + When you edit an existing fortran file, the syntax script will assume free source form if the fortran_free_source variable has been set, and assumes fixed source form if the fortran_fixed_source variable has been set. If neither of these variables have been set, the syntax script attempts to -determine which source form has been used by examining the first five columns -of the first 250 lines of your file. If no signs of free source form are -detected, then the file is assumed to be in fixed source form. The algorithm -should work in the vast majority of cases. In some cases, such as a file that -begins with 250 or more full-line comments, the script may incorrectly decide -that the fortran code is in fixed form. If that happens, just add a -non-comment statement beginning anywhere in the first five columns of the -first twenty five lines, save (:w) and then reload (:e!) the file. +determine which source form has been used by examining the file extension +using conventions common to the ifort, gfortran, Cray, NAG, and PathScale +compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 for +free-source). If none of this works, then the script examines the first five +columns of the first 500 lines of your file. If no signs of free source form +are detected, then the file is assumed to be in fixed source form. The +algorithm should work in the vast majority of cases. In some cases, such as a +file that begins with 500 or more full-line comments, the script may +incorrectly decide that the fortran code is in fixed form. If that happens, +just add a non-comment statement beginning anywhere in the first five columns +of the first twenty five lines, save (:w) and then reload (:e!) the file. Tabs in fortran files ~ Tabs are not recognized by the Fortran standards. Tabs are not a good idea in @@ -3430,7 +3442,7 @@ DEFINING KEYWORDS *:syn-keyword* :syntax keyword Type contained int long char :syntax keyword Type int long contained char :syntax keyword Type int long char contained -< *E789* +< *E789* *E890* When you have a keyword with an optional tail, like Ex commands in Vim, you can put the optional characters inside [], to define all the variations at once: > @@ -3684,6 +3696,7 @@ Whether or not it is actually concealed depends on the value of the 'conceallevel' option. The 'concealcursor' option is used to decide whether concealable items in the current line are displayed unconcealed to be able to edit the line. +Another way to conceal text with with |matchadd()|. concealends *:syn-concealends* @@ -4130,7 +4143,7 @@ example, for instance, can be done like this: > As can be seen here, the \z actually does double duty. In the start pattern, it marks the "\(\I\i*\)" sub-expression as external; in the end pattern, it -changes the \1 back-reference into an external reference referring to the +changes the \z1 back-reference into an external reference referring to the first external sub-expression in the start pattern. External references can also be used in skip patterns: > :syn region foo start="start \(\I\i*\)" skip="not end \z1" end="end \z1" diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 59c4a28ff2..70e6953211 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -273,8 +273,8 @@ window on the same buffer and then edit another buffer. Thus ":tabnew" triggers: WinLeave leave current window TabLeave leave current tab page - TabEnter enter new tab page WinEnter enter window in new tab page + TabEnter enter new tab page BufLeave leave current buffer BufEnter enter new empty buffer @@ -282,8 +282,8 @@ When switching to another tab page the order is: BufLeave WinLeave TabLeave - TabEnter WinEnter + TabEnter BufEnter When entering a new tab page (|:tabnew|), TabNew is triggered before TabEnter diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 7d3697db07..75d820d072 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -84,11 +84,13 @@ changed, to avoid confusion when using ":tnext". It is changed when using ":tag {ident}". The ignore-case matches are not found for a ":tag" command when the -'ignorecase' option is off. They are found when a pattern is used (starting -with a "/") and for ":tselect", also when 'ignorecase' is off. Note that -using ignore-case tag searching disables binary searching in the tags file, -which causes a slowdown. This can be avoided by fold-case sorting the tag -file. See the 'tagbsearch' option for an explanation. +'ignorecase' option is off and 'tagcase' is "followic" or when 'tagcase' is +"match". They are found when a pattern is used (starting with a "/") and for +":tselect", also when 'ignorecase' is off and 'tagcase' is "followic" or when +'tagcase' is "match". Note that using ignore-case tag searching disables +binary searching in the tags file, which causes a slowdown. This can be +avoided by fold-case sorting the tag file. See the 'tagbsearch' option for an +explanation. ============================================================================== 2. Tag stack *tag-stack* *tagstack* *E425* @@ -418,12 +420,13 @@ file "tags". It can also be used to access a common tags file. The next file in the list is not used when: - A matching static tag for the current buffer has been found. - A matching global tag has been found. -This also depends on the 'ignorecase' option. If it is off, and the tags file -only has a match without matching case, the next tags file is searched for a -match with matching case. If no tag with matching case is found, the first -match without matching case is used. If 'ignorecase' is on, and a matching -global tag with or without matching case is found, this one is used, no -further tags files are searched. +This also depends on whether case is ignored. Case is ignored when +'ignorecase' is set and 'tagcase' is "followic", or when 'tagcase' is +"ignore". If case is not ignored, and the tags file only has a match without +matching case, the next tags file is searched for a match with matching case. +If no tag with matching case is found, the first match without matching case +is used. If case is ignored, and a matching global tag with or without +matching case is found, this one is used, no further tags files are searched. When a tag file name starts with "./", the '.' is replaced with the path of the current file. This makes it possible to use a tags file in the directory @@ -556,8 +559,10 @@ that indicates if the file was sorted. When this line is found, Vim uses binary searching for the tags file: !_TAG_FILE_SORTED<Tab>1<Tab>{anything} ~ -A tag file may be case-fold sorted to avoid a linear search when 'ignorecase' -is on. See 'tagbsearch' for details. The value '2' should be used then: +A tag file may be case-fold sorted to avoid a linear search when case is +ignored. (Case is ignored when 'ignorecase' is set and 'tagcase' is +"followic", or when 'tagcase' is "ignore".) See 'tagbsearch' for details. +The value '2' should be used then: !_TAG_FILE_SORTED<Tab>2<Tab>{anything} ~ The other tag that Vim recognizes, but only when compiled with the diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index d85b4a326d..7d47368ba3 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 7.4. Last change: 2015 Feb 23 +*term.txt* For Vim version 7.4. Last change: 2015 Nov 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -744,7 +744,7 @@ Mouse clicks can be mapped. The codes for mouse clicks are: The X1 and X2 buttons refer to the extra buttons found on some mice. The 'Microsoft Explorer' mouse has these buttons available to the right thumb. -Currently X1 and X2 only work on Win32 environments. +Currently X1 and X2 only work on Win32 and X11 environments. Examples: > :noremap <MiddleMouse> <LeftMouse><MiddleMouse> diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index 1342621516..c6c70ab6d2 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -250,8 +250,8 @@ ignored if its owner differs from the owner of the edited file, except when the owner of the undo file is the current user. Set 'verbose' to get a message about that when opening a file. -Undo files are normally saved in the same directory as the file. This can be -changed with the 'undodir' option. +Location of the undo files is controlled by the 'undodir' option, by default +they are saved to the dedicated directory in the application data folder. You can also save and restore undo histories by using ":wundo" and ":rundo" respectively: diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index 6a288f8965..1c536c1eda 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -1,4 +1,4 @@ -*usr_02.txt* For Vim version 7.4. Last change: 2015 Apr 12 +*usr_02.txt* For Vim version 7.4. Last change: 2016 Jan 15 VIM USER MANUAL - by Bram Moolenaar @@ -397,7 +397,15 @@ original version of the file. Everything you always wanted to know can be found in the Vim help files. Don't be afraid to ask! - To get generic help use this command: > + +If you know what you are looking for, it is usually easier to search for it +using the help system, instead of using Google. Because the subjects follow +a certain style guide. + +Also the help has the advantage of belonging to your particular Vim version. +You won't see help for commands added later. These would not work for you. + +To get generic help use this command: > :help @@ -471,7 +479,7 @@ example, use the following command: > :help 'number' -The table with all mode prefixes can be found here: |help-context|. +The table with all mode prefixes can be found below: |help-summary|. Special keys are enclosed in angle brackets. To find help on the up-arrow key in Insert mode, for instance, use this command: > @@ -488,64 +496,187 @@ You can use the error ID at the start to find help about it: > Summary: *help-summary* > - :help -< Gives you very general help. Scroll down to see a list of all - helpfiles, including those added locally (i.e. not distributed - with Vim). > - :help user-toc.txt -< Table of contents of the User Manual. > - :help :subject -< Ex-command "subject", for instance the following: > - :help :help -< Help on getting help. > - :help abc -< normal-mode command "abc". > - :help CTRL-B -< Control key <C-B> in Normal mode. > - :help i_abc - :help i_CTRL-B -< The same in Insert mode. > - :help v_abc - :help v_CTRL-B -< The same in Visual mode. > - :help c_abc - :help c_CTRL-B -< The same in Command-line mode. > - :help 'subject' -< Option 'subject'. > - :help subject() -< Function "subject". > - :help -subject -< Command-line argument "-subject". > - :help +subject -< Compile-time feature "+subject". > - :help /* -< Regular expression item "*" > - :help EventName -< Autocommand event "EventName". > - :help digraphs.txt -< The top of the helpfile "digraph.txt". - Similarly for any other helpfile. > - :help pattern<Tab> -< Find a help tag starting with "pattern". Repeat <Tab> for - others. > - :help pattern<Ctrl-D> -< See all possible help tag matches "pattern" at once. > - :helpgrep pattern -< Search the whole text of all help files for pattern "pattern". - Jumps to the first match. Jump to other matches with: > - :cn -< next match > - :cprev - :cN -< previous match > - :cfirst - :clast -< first or last match > - :copen - :cclose -< open/close the quickfix window; press <Enter> to jump - to the item under the cursor + +1) Use Ctrl-D after typing a topic and let Vim show all available topics. + Or press Tab to complete: > + :help some<Tab> +< More information on how to use the help: > + :help helphelp + +2) Follow the links in bars to related help. You can go from the detailed + help to the user documentation, which describes certain commands more from + a user perspective and less detailed. E.g. after: > + :help pattern.txt +< You can see the user guide topics |03.9| and |usr_27.txt| in the + introduction. + +3) Options are enclosed in single apostrophes. To go to the help topic for the + list option: > + :help 'list' +< If you only know you are looking for a certain option, you can also do: > + :help options.txt +< to open the help page which describes all option handling and then search + using regular expressions, e.g. textwidth. + Certain options have their own namespace, e.g.: > + :help cpo-<letter> +< for the corresponding flag of the 'cpoptions' settings, substitute <letter> + by a specific flag, e.g.: > + :help cpo-; +< And for the guioption flags: > + :help go-<letter> + +4) Normal mode commands do not have a prefix. To go to the help page for the + "gt" command: > + :help gt + +5) Insert mode commands start with i_. Help for deleting a word: > + :help i_CTRL-W + +6) Visual mode commands start with v_. Help for jumping to the other side of + the Visual area: > + :help v_o + +7) Command line editing and arguments start with c_. Help for using the + command argument %: > + :help c_% + +8) Ex-commands always start with ":", so to go to the :s command help: > + :help :s + +9) Key combinations. They usually start with a single letter indicating + the mode for which they can be used. E.g.: > + :help i_CTRL-X +< takes you to the family of Ctrl-X commands for insert mode which can be + used to auto complete different things. Note, that certain keys will + always be written the same, e.g. Control will always be CTRL. + For normal mode commands there is no prefix and the topic is available at + :h CTRL-<Letter>. E.g. > + :help CTRL-W +< In contrast > + :help c_CTRL-R +< will describe what the Ctrl-R does when entering commands in the Command + line and > + :help v_Ctrl-A +< talks about incrementing numbers in visual mode and > + :help g_CTRL-A +< talks about the g<C-A> command (e.g. you have to press "g" then <Ctrl-A>). + Here the "g" stand for the normal command "g" which always expects a second + key before doing something similar to the commands starting with "z" + +10) Regexp items always start with /. So to get help for the "\+" quantifier + in Vim regexes: > + :help /\+ +< If you need to know everything about regular expressions, start reading + at: > + :help pattern.txt + +11) Registers always start with "quote". To find out about the special ":" + register: > + :help quote: + +12) Vim Script (VimL) is available at > + :help eval.txt +< Certain aspects of the language are available at :h expr-X where "X" is a + single letter. E.g. > + :help expr-! +< will take you to the topic describing the "!" (Not) operator for + VimScript. + Also important is > + :help function-list +< to find a short description of all functions available. Help topics for + VimL functions always include the "()", so: > + :help append() +< talks about the append VimL function rather than how to append text in the + current buffer. + +13) Mappings are talked about in the help page :h |map.txt|. Use > + :help mapmode-i +< to find out about the |:imap| command. Also use :map-topic + to find out about certain subtopics particular for mappings. e.g: > + :help :map-local +< for buffer-local mappings or > + :help map-bar +< for how the '|' is handled in mappings. + +14) Command definitions are talked about :h command-topic, so use > + :help command-bar +< to find out about the '!' argument for custom commands. + +15) Window management commands always start with CTRL-W, so you find the + corresponding help at :h CTRL-W_letter. E.g. > + :help CTRL-W_p +< for moving the previous accessed window). You can also access > + :help windows.txt +< and read your way through if you are looking for window handling + commands. + +16) Use |:helpgrep| to search in all help pages (and also of any installed + plugins). See |:helpgrep| for how to use it. + To search for a topic: > + :helpgrep topic +< This takes you to the first match. To go to the next one: > + :cnext +< All matches are available in the quickfix window which can be opened + with: > + :copen +< Move around to the match you like and press Enter to jump to that help. + +17) The user manual. This describes help topics for beginners in a rather + friendly way. Start at |usr_toc.txt| to find the table of content (as you + might have guessed): > + :help usr_toc.txt +< Skim over the contents to find interesting topics. The "Digraphs" and + "Entering special characters" items are in chapter 24, so to go to that + particular help page: > + :help usr_24.txt +< Also if you want to access a certain chapter in the help, the chapter + number can be accessed directly like this: > + :help 10.1 +< goes to chapter 10.1 in |usr_10.txt| and talks about recording macros. + +18) Highlighting groups. Always start with hl-groupname. E.g. > + :help hl-WarningMsg +< talks about the WarningMsg highlighting group. + +19) Syntax highlighting is namespaced to :syn-topic e.g. > + :help :syn-conceal +< talks about the conceal argument for the :syn command. + +20) Quickfix commands usually start with :c while location list commands + usually start with :l + +21) Autocommand events can be found by their name: > + :help BufWinLeave +< To see all possible events: > + :help autocommands-events + +22) Command-line switches always start with "-". So for the help of the -f + command switch of Vim use: > + :help -f + +23) Optional features always start with "+". To find out about the + conceal feature use: > + :help +conceal + +24) Documentation for included filetype specific functionality is usually + available in the form ft-<filetype>-<functionality>. So > + :help ft-c-syntax +< talks about the C syntax file and the option it provides. Sometimes, + additional sections for omni completion > + :help ft-php-omni +< or filetype plugins > + :help ft-tex-plugin +< are available. + +25) Error and Warning codes can be looked up directly in the help. So > + :help E297 +< takes you exactly to the description of the swap error message and > + :help W10 +< talks about the warning "Changing a readonly file". + Sometimes however, those error codes are not described, but rather are + listed at the Vim command that usually causes this. So: > + :help E128 +< takes you to the |:function| command ============================================================================== diff --git a/runtime/doc/usr_03.txt b/runtime/doc/usr_03.txt index 5b6eaa295b..943d7b528c 100644 --- a/runtime/doc/usr_03.txt +++ b/runtime/doc/usr_03.txt @@ -1,4 +1,4 @@ -*usr_03.txt* For Vim version 7.4. Last change: 2006 Jun 21 +*usr_03.txt* For Vim version 7.4. Last change: 2016 Jan 05 VIM USER MANUAL - by Bram Moolenaar @@ -57,8 +57,11 @@ paragraph, much faster than using "l". "b" does the same in the other direction. A word ends at a non-word character, such as a ".", "-" or ")". To change -what Vim considers to be a word, see the 'iskeyword' option. - It is also possible to move by white-space separated WORDs. This is not a +what Vim considers to be a word, see the 'iskeyword' option. If you try this +out in the help directly, 'iskeyword' needs to be reset for the examples to +work: > + :set iskeyword& +It is also possible to move by white-space separated WORDs. This is not a word in the normal sense, that's why the uppercase is used. The commands for moving by WORDs are also uppercase, as this figure shows: @@ -411,8 +414,8 @@ in "the" use: > /the\> The "\>" item is a special marker that only matches at the end of a word. -Similarly "\<" only matches at the begin of a word. Thus to search for the -word "the" only: > +Similarly "\<" only matches at the beginning of a word. Thus to search for +the word "the" only: > /\<the\> diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index 86fcf0cc2f..5aecf33557 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -37,9 +37,10 @@ for you), you can edit it this way: > If you don't have a vimrc file yet, see |init.vim| to find out where you can create a vimrc file. -For Unix and Macintosh this file is always used and is recommended: +This file is always used and is recommended: - ~/.config/nvim/init.vim ~ + ~/.config/nvim/init.vim (Unix and OSX) ~ + ~/AppData/Local/nvim/init.vim (Windows) ~ The vimrc file can contain all the commands that you type after a colon. The most simple ones are for setting options. For example, if you want Vim to diff --git a/runtime/doc/usr_06.txt b/runtime/doc/usr_06.txt index 1cb3eb8673..b4b495ff9f 100644 --- a/runtime/doc/usr_06.txt +++ b/runtime/doc/usr_06.txt @@ -152,7 +152,7 @@ You could also write your own color scheme. This is how you do it: directory. For Unix, this should work: > !mkdir -p ~/.config/nvim/colors - !cp $VIMRUNTIME/colors/morning.vim ~/.vim/colors/mine.vim + !cp $VIMRUNTIME/colors/morning.vim ~/.config/nvim/colors/mine.vim < This is done from Vim, because it knows the value of $VIMRUNTIME. diff --git a/runtime/doc/usr_29.txt b/runtime/doc/usr_29.txt index 22de2f6ce6..e495aad06d 100644 --- a/runtime/doc/usr_29.txt +++ b/runtime/doc/usr_29.txt @@ -255,7 +255,8 @@ function. RELATED ITEMS -You can set 'ignorecase' to make case in tag names be ignored. +To make case in tag names be ignored, you can set 'ignorecase' while leaving +'tagcase' as "followic", or set 'tagcase' to "ignore". The 'tagbsearch' option tells if the tags file is sorted or not. The default is to assume a sorted tags file, which makes a tags search a lot faster, but diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 8017b99f97..fc8419a522 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -921,6 +921,7 @@ Various: *various-functions* py3eval() evaluate Python expression (|+python3|) pyeval() evaluate Python expression (|+python|) + wordcount() get byte/word/char count of buffer ============================================================================== *41.7* Defining a function diff --git a/runtime/doc/usr_43.txt b/runtime/doc/usr_43.txt index e61e6af660..bab446af3c 100644 --- a/runtime/doc/usr_43.txt +++ b/runtime/doc/usr_43.txt @@ -1,4 +1,4 @@ -*usr_43.txt* For Vim version 7.4. Last change: 2008 Dec 28 +*usr_43.txt* For Vim version 7.4. Last change: 2015 Oct 23 VIM USER MANUAL - by Bram Moolenaar @@ -45,6 +45,7 @@ three-line comment. You do this with only two steps: setlocal softtabstop=4 noremap <buffer> <LocalLeader>c o/**************<CR><CR>/<Esc> + let b:undo_ftplugin = "setl softtabstop< | unmap <buffer> <LocalLeader>c" Try editing a C file. You should notice that the 'softtabstop' option is set to 4. But when you edit another file it's reset to the default zero. That is @@ -59,6 +60,11 @@ buffer. This works with any mapping command: ":map!", ":vmap", etc. The |<LocalLeader>| in the mapping is replaced with the value of the "maplocalleader" variable. +The line to set b:undo_ftplugin is for when the filetype is set to another +value. In that case you will want to undo your preferences. The +b:undo_ftplugin variable is executed as a command. Watch out for characters +with a special meaning inside a string, such as a backslash. + You can find examples for filetype plugins in this directory: > $VIMRUNTIME/ftplugin/ diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index ff37466a14..293cfe6e00 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 7.4. Last change: 2014 Aug 06 +*various.txt* For Vim version 7.4. Last change: 2016 Jan 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -222,6 +222,10 @@ g8 Print the hex values of the bytes used in the modified, but can be forced with "!". See |termopen()| and |nvim-terminal-emulator| for more information. + To switch to terminal mode automatically: +> + autocmd BufEnter term://* startinsert +< *:!cmd* *:!* *E34* :!{cmd} Execute {cmd} with 'shell'. See also |:terminal|. @@ -367,6 +371,7 @@ N *+tablineat* 'tabline' option recognizing %@Func@ items. N *+tag_binary* binary searching in tags file |tag-binary-search| N *+tag_old_static* old method for static tags |tag-old-static| m *+tag_any_white* any white space allowed in tags file |tag-any-white| +B *+termguicolors* 24-bit color in xterm-compatible terminals support *+terminfo* uses |terminfo| instead of termcap N *+termresponse* support for |t_RV| and |v:termresponse| N *+textobjects* |text-objects| selection @@ -586,4 +591,12 @@ highlighting. The "h" key will give you a short overview of the available commands. +If you want to set options differently when using less, define the +LessInitFunc in your vimrc, for example: > + + func LessInitFunc() + set nocursorcolumn nocursorline + endfunc +< + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index 38248d1b22..ec35694c9e 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -1,4 +1,4 @@ -*vi_diff.txt* For Vim version 7.4. Last change: 2013 Aug 22 +*vi_diff.txt* For Vim version 7.4. Last change: 2015 Nov 01 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 6609a96e9e..508712ca75 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -11,7 +11,7 @@ the "{Nvim}" tag. This document is a complete and centralized list of all these differences. 1. Configuration |nvim-configuration| -2. Option defaults |nvim-option-defaults| +2. Defaults |nvim-defaults| 3. Changed features |nvim-features-changed| 4. New features |nvim-features-new| 5. Missing legacy features |nvim-features-missing| @@ -21,14 +21,17 @@ these differences. ============================================================================== 1. Configuration *nvim-configuration* -- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for storing +- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for storing configuration. - Use `$XDG_CONFIG_HOME/nvim` instead of `.vim` to store configuration files. -- Use `$XDG_DATA_HOME/nvim/shada/main.shada` instead of `.viminfo` for persistent +- Use `$XDG_DATA_HOME/nvim/shada/main.shada` instead of `.viminfo` for persistent session information. ============================================================================== -2. Option defaults *nvim-option-defaults* +2. Defaults *nvim-defaults* + +- Syntax highlighting is enabled by default +- ":filetype plugin indent on" is enabled by default - 'autoindent' is set by default - 'autoread' is set by default @@ -45,7 +48,7 @@ these differences. - 'listchars' defaults to "tab:> ,trail:-,nbsp:+" - 'mouse' defaults to "a" - 'nocompatible' is always set -- 'nrformats' defaults to "hex" +- 'nrformats' defaults to "bin,hex" - 'sessionoptions' doesn't include "options" - 'smarttab' is set by default - 'tabpagemax' defaults to 50 @@ -68,54 +71,72 @@ are always available and may be used simultaneously in separate plugins. The |nvim-python|). |mkdir()| behaviour changed: -1. Assuming /tmp/foo does not exist and /tmp can be written to +1. Assuming /tmp/foo does not exist and /tmp can be written to mkdir('/tmp/foo/bar', 'p', 0700) will create both /tmp/foo and /tmp/foo/bar with 0700 permissions. Vim mkdir will create /tmp/foo with 0755. -2. If you try to create an existing directory with `'p'` (e.g. mkdir('/', +2. If you try to create an existing directory with `'p'` (e.g. mkdir('/', 'p')) mkdir() will silently exit. In Vim this was an error. 3. mkdir() error messages now include strerror() text when mkdir fails. 'encoding' cannot be changed after startup. |string()| and |:echo| behaviour changed: -1. No maximum recursion depth limit is applied to nested container +1. No maximum recursion depth limit is applied to nested container structures. -2. |string()| fails immediately on nested containers, not when recursion limit +2. |string()| fails immediately on nested containers, not when recursion limit was exceeded. 2. When |:echo| encounters duplicate containers like > let l = [] echo [l, l] < - it does not use "[...]" (was: "[[], [...]]", now: "[[], []]"). "..." is + it does not use "[...]" (was: "[[], [...]]", now: "[[], []]"). "..." is only used for recursive containers. -3. |:echo| printing nested containers adds "@level" after "..." designating - the level at which recursive container was printed: |:echo-self-refer|. - Same thing applies to |string()| (though it uses construct like - "{E724@level}"), but this is not reliable because |string()| continues to +3. |:echo| printing nested containers adds "@level" after "..." designating + the level at which recursive container was printed: |:echo-self-refer|. + Same thing applies to |string()| (though it uses construct like + "{E724@level}"), but this is not reliable because |string()| continues to error out. +4. Stringifyed infinite and NaN values now use |str2float()| and can be evaled + back. +5. (internal) Trying to print or stringify VAR_UNKNOWN in Vim results in + nothing, |E908|, in Neovim it is internal error. + +|json_decode()| behaviour changed: +1. It may output |msgpack-special-dict|. +2. |msgpack-special-dict| is emitted also in case of duplicate keys, while in + Vim it errors out. +3. It accepts only valid JSON. Trailing commas are not accepted. + +|json_encode()| behaviour slightly changed: now |msgpack-special-dict| values +are accepted, but |v:none| is not. + +*v:none* variable is absent. In Vim it represents “no value†in “js†strings +like "[,]" parsed as "[v:none]" by |js_decode()|. + +*js_encode()* and *js_decode()* functions are also absent. -Viminfo text files were replaced with binary (messagepack) ShaDa files. +Viminfo text files were replaced with binary (messagepack) ShaDa files. Additional differences: - |shada-c| has no effect. - |shada-s| now limits size of every item and not just registers. -- When reading ShaDa files items are merged according to the timestamp. +- When reading ShaDa files items are merged according to the timestamp. |shada-merging| -- 'viminfo' option got renamed to 'shada'. Old option is kept as an alias for +- 'viminfo' option got renamed to 'shada'. Old option is kept as an alias for compatibility reasons. -- |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old +- |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old commands are still kept. - |:oldfiles| supports !. -- When writing (|:wshada| without bang or at exit) it merges much more data, - and does this according to the timestamp. Vim merges only marks. +- When writing (|:wshada| without bang or at exit) it merges much more data, + and does this according to the timestamp. Vim merges only marks. |shada-merging| -- ShaDa file format was designed with forward and backward compatibility in +- ShaDa file format was designed with forward and backward compatibility in mind. |shada-compatibility| -- Some errors make ShaDa code keep temporary file in-place for user to decide - what to do with it. Vim deletes temporary file in these cases. +- Some errors make ShaDa code keep temporary file in-place for user to decide + what to do with it. Vim deletes temporary file in these cases. |shada-error-handling| -- Vim keeps no timestamps at all, neither in viminfo file nor in the instance +- Vim keeps no timestamps at all, neither in viminfo file nor in the instance itself. - ShaDa file keeps search direction (|v:searchforward|), viminfo does not. @@ -134,8 +155,8 @@ Meta (alt) chords are recognized (even in the terminal). Note: Meta chords are case-sensitive (<M-a> is distinguished from <M-A>). -Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants (even in -the terminal). Specifically, the following are known to work: +Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants +(even in the terminal). Specifically, the following are known to work: <C-Tab>, <C-S-Tab> <C-BS>, <C-S-BS> <C-Enter>, <C-S-Enter> @@ -207,6 +228,7 @@ Other options: 'shelltype' 'shortname' 'swapsync' + 'term' 'termencoding' (Vim 7.4.852 also removed this for Windows) 'textauto' 'textmode' @@ -214,6 +236,8 @@ Other options: 'toolbariconsize' 'ttybuiltin' 'ttymouse' + 'ttyscroll' + 'ttytype' 'weirdinvert' Other commands: diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index eee171b7da..51b73223b6 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 7.4. Last change: 2015 Jan 31 +*windows.txt* For Vim version 7.4. Last change: 2015 Nov 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -706,7 +706,7 @@ can also get to them with the buffer list commands, like ":bnext". *:bufdo* :[range]bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list or if - [range[ is given only for buffers for which their + [range] is given only for buffers for which their buffer name is in the [range]. It works like doing this: > :bfirst @@ -1099,13 +1099,13 @@ list of buffers. |unlisted-buffer| the current buffer remains being edited. See |:buffer-!| for [!]. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. - Also see ||+cmd|. + Also see |+cmd|. :[N]b[uffer][!] [+cmd] {bufname} Edit buffer for {bufname} from the buffer list. See |:buffer-!| for [!]. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. - Also see ||+cmd|. + Also see |+cmd|. :[N]sb[uffer] [+cmd] [N] *:sb* *:sbuffer* Split window and edit buffer [N] from the buffer list. If [N] @@ -1113,7 +1113,7 @@ list of buffers. |unlisted-buffer| "useopen" setting of 'switchbuf' when splitting. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. - Also see ||+cmd|. + Also see |+cmd|. :[N]sb[uffer] [+cmd] {bufname} Split window and edit buffer for {bufname} from the buffer @@ -1122,13 +1122,13 @@ list of buffers. |unlisted-buffer| Note: If what you want to do is split the buffer, make a copy under another name, you can do it this way: > :w foobar | sp # -< Also see ||+cmd|. +< Also see |+cmd|. :[N]bn[ext][!] [+cmd] [N] *:bn* *:bnext* *E87* Go to [N]th next buffer in buffer list. [N] defaults to one. Wraps around the end of the buffer list. See |:buffer-!| for [!]. - Also see ||+cmd|. + Also see |+cmd|. If you are in a help buffer, this takes you to the next help buffer (if there is one). Similarly, if you are in a normal (non-help) buffer, this takes you to the next normal buffer. @@ -1141,21 +1141,21 @@ list of buffers. |unlisted-buffer| :[N]sbn[ext] [+cmd] [N] Split window and go to [N]th next buffer in buffer list. Wraps around the end of the buffer list. Uses 'switchbuf' - Also see ||+cmd|. + Also see |+cmd|. :[N]bN[ext][!] [+cmd] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88* :[N]bp[revious][!] [+cmd] [N] Go to [N]th previous buffer in buffer list. [N] defaults to one. Wraps around the start of the buffer list. See |:buffer-!| for [!] and 'switchbuf'. - Also see ||+cmd|. + Also see |+cmd|. :[N]sbN[ext] [+cmd] [N] *:sbN* *:sbNext* *:sbp* *:sbprevious* :[N]sbp[revious] [+cmd] [N] Split window and go to [N]th previous buffer in buffer list. Wraps around the start of the buffer list. Uses 'switchbuf'. - Also see ||+cmd|. + Also see |+cmd|. :br[ewind][!] [+cmd] *:br* *:brewind* Go to first buffer in buffer list. If the buffer list is diff --git a/runtime/filetype.vim b/runtime/filetype.vim index c5b01f0c40..c5a3577a62 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2015 Apr 06 +" Last Change: 2015 Oct 13 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -139,7 +139,7 @@ au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch au BufNewFile,BufRead *.art setf art " AsciiDoc -au BufNewFile,BufRead *.asciidoc setf asciidoc +au BufNewFile,BufRead *.asciidoc,*.adoc setf asciidoc " ASN.1 au BufNewFile,BufRead *.asn,*.asn1 setf asn @@ -304,6 +304,9 @@ au BufNewFile,BufRead *.bl setf blank " Blkid cache file au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml +" Bazel (http://bazel.io) +autocmd BufRead,BufNewFile *.bzl,BUILD,WORKSPACE setfiletype bzl + " C or lpc au BufNewFile,BufRead *.c call s:FTlpc() @@ -822,7 +825,7 @@ au BufNewFile,BufRead *.gs setf grads au BufNewFile,BufRead *.gretl setf gretl " Groovy -au BufNewFile,BufRead *.groovy setf groovy +au BufNewFile,BufRead *.gradle,*.groovy setf groovy " GNU Server Pages au BufNewFile,BufRead *.gsp setf gsp @@ -868,7 +871,7 @@ func! s:FThtml() setf xhtml return endif - if getline(n) =~ '{%\s*\(extends\|block\|load\)\>' + if getline(n) =~ '{%\s*\(extends\|block\|load\)\>\|{#\s\+' setf htmldjango return endif @@ -1164,7 +1167,7 @@ func! s:FTm() let n = 1 while n < 10 let line = getline(n) - if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\|//\)' + if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\|//\)' setf objc return endif @@ -1332,7 +1335,7 @@ func! s:FTmm() let n = 1 while n < 10 let line = getline(n) - if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)' + if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)' setf objcpp return endif @@ -1855,7 +1858,7 @@ au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. " Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts -au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,.bash_aliases*,*.bash,*.ebuild,PKGBUILD* call SetFileTypeSH("bash") +au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,*.bash,*/{,.}bash[_-]completion{,.d,.sh}{,/*},*.ebuild,*.eclass,PKGBUILD* call SetFileTypeSH("bash") au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh") au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1)) @@ -2119,6 +2122,9 @@ au BufNewFile,BufRead *.cm setf voscm " Sysctl au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl +" Systemd unit files +au BufNewFile,BufRead */systemd/*.{automount,mount,path,service,socket,swap,target,timer} setf systemd + " Synopsys Design Constraints au BufNewFile,BufRead *.sdc setf sdc @@ -2174,6 +2180,9 @@ au BufNewFile,BufRead *.tli setf tli " Telix Salt au BufNewFile,BufRead *.slt setf tsalt +" Tera Term Language +au BufRead,BufNewFile *.ttl setf teraterm + " Terminfo au BufNewFile,BufRead *.ti setf terminfo diff --git a/runtime/ftplugin/bzl.vim b/runtime/ftplugin/bzl.vim new file mode 100644 index 0000000000..0296b0c0b8 --- /dev/null +++ b/runtime/ftplugin/bzl.vim @@ -0,0 +1,94 @@ +" Vim filetype plugin file +" Language: Bazel (http://bazel.io) +" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) +" Last Change: 2015 Aug 11 + +"" +" @section Introduction, intro +" Core settings for the bzl filetype, used for BUILD and *.bzl files for the +" Bazel build system (http://bazel.io/). + +if exists('b:did_ftplugin') + finish +endif + + +" Vim 7.4.051 has opinionated settings in ftplugin/python.vim that try to force +" PEP8 conventions on every python file, but these conflict with Google's +" indentation guidelines. As a workaround, we explicitly source the system +" ftplugin, but save indentation settings beforehand and restore them after. +let s:save_expandtab = &l:expandtab +let s:save_shiftwidth = &l:shiftwidth +let s:save_softtabstop = &l:softtabstop +let s:save_tabstop = &l:tabstop + +" NOTE: Vim versions before 7.3.511 had a ftplugin/python.vim that was broken +" for compatible mode. +let s:save_cpo = &cpo +set cpo&vim + +" Load base python ftplugin (also defines b:did_ftplugin). +source $VIMRUNTIME/ftplugin/python.vim + +" NOTE: Vim versions before 7.4.104 and later set this in ftplugin/python.vim. +setlocal comments=b:#,fb:- + +" Restore pre-existing indentation settings. +let &l:expandtab = s:save_expandtab +let &l:shiftwidth = s:save_shiftwidth +let &l:softtabstop = s:save_softtabstop +let &l:tabstop = s:save_tabstop + +setlocal formatoptions-=t + +" Make gf work with imports in BUILD files. +setlocal includeexpr=substitute(v:fname,'//','','') + +" Enable syntax-based folding, if specified. +if get(g:, 'ft_bzl_fold', 0) + setlocal foldmethod=syntax + setlocal foldtext=BzlFoldText() +endif + +if exists('*BzlFoldText') + finish +endif + +function BzlFoldText() abort + let l:start_num = nextnonblank(v:foldstart) + let l:end_num = prevnonblank(v:foldend) + + if l:end_num <= l:start_num + 1 + " If the fold is empty, don't print anything for the contents. + let l:content = '' + else + " Otherwise look for something matching the content regex. + " And if nothing matches, print an ellipsis. + let l:content = '...' + for l:line in getline(l:start_num + 1, l:end_num - 1) + let l:content_match = matchstr(l:line, '\m\C^\s*name = \zs.*\ze,$') + if !empty(l:content_match) + let l:content = l:content_match + break + endif + endfor + endif + + " Enclose content with start and end + let l:start_text = getline(l:start_num) + let l:end_text = substitute(getline(l:end_num), '^\s*', '', '') + let l:text = l:start_text . ' ' . l:content . ' ' . l:end_text + + " Compute the available width for the displayed text. + let l:width = winwidth(0) - &foldcolumn - (&number ? &numberwidth : 0) + let l:lines_folded = ' ' . string(1 + v:foldend - v:foldstart) . ' lines' + + " Expand tabs, truncate, pad, and concatenate + let l:text = substitute(l:text, '\t', repeat(' ', &tabstop), 'g') + let l:text = strpart(l:text, 0, l:width - len(l:lines_folded)) + let l:padding = repeat(' ', l:width - len(l:lines_folded) - len(l:text)) + return l:text . l:padding . l:lines_folded +endfunction + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/ftplugin/changelog.vim b/runtime/ftplugin/changelog.vim index 244245e271..257e9cd9d4 100644 --- a/runtime/ftplugin/changelog.vim +++ b/runtime/ftplugin/changelog.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file -" Language: generic Changelog file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2014-01-10 +" Language: generic Changelog file +" Maintainer: Martin Florian <marfl@posteo.de> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-10-25 " Variables: " g:changelog_timeformat (deprecated: use g:changelog_dateformat instead) - " description: the timeformat used in ChangeLog entries. @@ -167,7 +168,7 @@ if &filetype == 'changelog' let cursor = stridx(line, '{cursor}') call setline(lnum, substitute(line, '{cursor}', '', '')) endif - startinsert! + startinsert endfunction " Internal function to create a new entry in the ChangeLog. @@ -223,7 +224,8 @@ if &filetype == 'changelog' endfunction if exists(":NewChangelogEntry") != 2 - noremap <buffer> <silent> <Leader>o <Esc>:call <SID>new_changelog_entry('')<CR> + nnoremap <buffer> <silent> <Leader>o :<C-u>call <SID>new_changelog_entry('')<CR> + xnoremap <buffer> <silent> <Leader>o :<C-u>call <SID>new_changelog_entry('')<CR> command! -nargs=0 NewChangelogEntry call s:new_changelog_entry('') endif diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim index 7591edd821..5d42409fd4 100644 --- a/runtime/ftplugin/fortran.vim +++ b/runtime/ftplugin/fortran.vim @@ -1,9 +1,9 @@ " Vim settings file " Language: Fortran 2008 (and older: Fortran 2003, 95, 90, 77, 66) -" Version: 0.49 -" Last Change: 2013 Oct. 01 +" Version: 0.50 +" Last Change: 2015 Nov. 30 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/> -" Usage: Do :help fortran-plugin from Vim +" Usage: For instructions, do :help fortran-plugin from Vim " Credits: " Useful suggestions were made by Stefano Zacchiroli, Hendrik Merx, Ben " Fritz, and David Barnett. @@ -20,7 +20,10 @@ set cpoptions&vim let b:did_ftplugin = 1 " Determine whether this is a fixed or free format source file -" if this hasn't been done yet +" if this hasn't been done yet using the priority: +" buffer-local value +" > global value +" > file extension as in Intel ifort, gcc (gfortran), NAG, Pathscale, and Cray compilers if !exists("b:fortran_fixed_source") if exists("fortran_free_source") " User guarantees free source form @@ -28,13 +31,19 @@ if !exists("b:fortran_fixed_source") elseif exists("fortran_fixed_source") " User guarantees fixed source form let b:fortran_fixed_source = 1 + elseif expand("%:e") ==? "f\<90\|95\|03\|08\>" + " Free-form file extension defaults as in Intel ifort, gcc(gfortran), NAG, Pathscale, and Cray compilers + let b:fortran_fixed_source = 0 + elseif expand("%:e") ==? "f\|f77\|for" + " Fixed-form file extension defaults + let b:fortran_fixed_source = 1 else - " Modern Fortran allows both fixed and free source form - " assume fixed source form unless signs of free source form - " are detected in the first five columns of the first s:lmax lines + " Modern fortran still allows both fixed and free source form + " Assume fixed source form unless signs of free source form + " are detected in the first five columns of the first s:lmax lines. " Detection becomes more accurate and time-consuming if more lines " are checked. Increase the limit below if you keep lots of comments at - " the very top of each file and you have a fast computer + " the very top of each file and you have a fast computer. let s:lmax = 500 if ( s:lmax > line("$") ) let s:lmax = line("$") diff --git a/runtime/ftplugin/hgcommit.vim b/runtime/ftplugin/hgcommit.vim new file mode 100644 index 0000000000..d5a6c0a383 --- /dev/null +++ b/runtime/ftplugin/hgcommit.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: hg (Mercurial) commit file +" Maintainer: Ken Takata <kentkt at csc dot jp> +" Last Change: 2016 Jan 6 +" Filenames: hg-editor-*.txt +" License: VIM License +" URL: https://github.com/k-takata/hg-vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal nomodeline + +let b:undo_ftplugin = 'setl modeline<' diff --git a/runtime/ftplugin/hog.vim b/runtime/ftplugin/hog.vim new file mode 100644 index 0000000000..4ee0a9f934 --- /dev/null +++ b/runtime/ftplugin/hog.vim @@ -0,0 +1,39 @@ +" Vim filetype plugin +" Language: hog (snort.conf) +" Maintainer: . Victor Roemer, <vroemer@badsec.org>. +" Last Change: Mar 1, 2013 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:undo_ftplugin = "setl fo< com< cms< def< inc<" + +let s:cpo_save = &cpo +set cpo&vim + +setlocal formatoptions=croq +setlocal comments=:# +setlocal commentstring=\c#\ %s +setlocal define=\c^\s\{-}var +setlocal include=\c^\s\{-}include + +" Move around configurations +let s:hog_keyword_match = '\c^\s*\<\(preprocessor\\|config\\|output\\|include\\|ipvar\\|portvar\\|var\\|dynamicpreprocessor\\|' . + \ 'dynamicengine\\|dynamicdetection\\|activate\\|alert\\|drop\\|block\\|dynamic\\|log\\|pass\\|reject\\|sdrop\\|sblock\)\>' + +exec "nnoremap <buffer><silent> ]] :call search('" . s:hog_keyword_match . "', 'W' )<CR>" +exec "nnoremap <buffer><silent> [[ :call search('" . s:hog_keyword_match . "', 'bW' )<CR>" + +if exists("loaded_matchit") + let b:match_words = + \ '^\s*\<\%(preprocessor\|config\|output\|include\|ipvar\|portvar' . + \ '\|var\|dynamicpreprocessor\|dynamicengine\|dynamicdetection' . + \ '\|activate\|alert\|drop\|block\|dynamic\|log\|pass\|reject' . + \ '\|sdrop\|sblock\>\):$,\::\,:;' + let b:match_skip = 'r:\\.\{-}$\|^\s*#.\{-}$\|^\s*$' +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/j.vim b/runtime/ftplugin/j.vim index 774696836f..9dc1692534 100644 --- a/runtime/ftplugin/j.vim +++ b/runtime/ftplugin/j.vim @@ -2,7 +2,7 @@ " Language: J " Maintainer: David Bürgin <676c7473@gmail.com> " URL: https://github.com/glts/vim-j -" Last Change: 2015-03-27 +" Last Change: 2015-09-27 if exists('b:did_ftplugin') finish @@ -12,13 +12,20 @@ let b:did_ftplugin = 1 let s:save_cpo = &cpo set cpo&vim -setlocal iskeyword=48-57,A-Z,_,a-z +setlocal iskeyword=48-57,A-Z,a-z,_ setlocal comments=:NB. setlocal commentstring=NB.\ %s setlocal formatoptions-=t setlocal matchpairs=(:) +setlocal path-=/usr/include -let b:undo_ftplugin = 'setlocal matchpairs< formatoptions< commentstring< comments< iskeyword<' +" Includes. To make the shorthand form "require 'web/cgi'" work, double the +" last path component. Also strip off leading folder names like "~addons/". +setlocal include=\\v^\\s*(load\|require)\\s*'\\zs\\f+\\ze' +setlocal includeexpr=substitute(substitute(tr(v:fname,'\\','/'),'\\v^[^~][^/.]*(/[^/.]+)$','&\\1',''),'\\v^\\~[^/]+/','','') +setlocal suffixesadd=.ijs + +let b:undo_ftplugin = 'setlocal matchpairs< formatoptions< commentstring< comments< iskeyword< path< include< includeexpr< suffixesadd<' " Section movement with ]] ][ [[ []. The start/end patterns below are amended " inside the function in order to avoid matching on the current cursor line. diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index 133a28e626..04ab539fb1 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -24,14 +24,18 @@ setlocal buftype=nofile noswapfile setlocal nomodifiable readonly bufhidden=hide nobuflisted tabstop=8 if !exists("g:no_plugin_maps") && !exists("g:no_man_maps") - nnoremap <silent> <buffer> <C-]> :call man#get_page(v:count)<CR> + nnoremap <silent> <buffer> <C-]> :call man#get_page(v:count, expand('<cword>'))<CR> nnoremap <silent> <buffer> <C-T> :call man#pop_page()<CR> nnoremap <silent> <nowait><buffer> q <C-W>c if &keywordprg !=# ':Man' - nnoremap <silent> <buffer> K :call man#get_page(v:count)<CR> + nnoremap <silent> <buffer> K :call man#get_page(v:count, expand('<cword>'))<CR> endif endif +if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1) + setlocal foldmethod=indent foldnestmax=1 foldenable +endif + let b:undo_ftplugin = 'setlocal iskeyword<' " vim: set sw=2: diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim index f972753533..6d5bf4b806 100644 --- a/runtime/ftplugin/spec.vim +++ b/runtime/ftplugin/spec.vim @@ -2,7 +2,7 @@ " Filename: spec.vim " Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com " Former Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com> (until March 2014) -" Last Change: Fri Feb 20 16:01 MSK 2014 Igor Gnatenko +" Last Change: Mon Jun 01 21:15 MSK 2015 Igor Gnatenko if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim new file mode 100644 index 0000000000..60b3fd996d --- /dev/null +++ b/runtime/ftplugin/systemd.vim @@ -0,0 +1,7 @@ +" Vim filetype plugin file +" Language: systemd.unit(5) + +if !exists('b:did_ftplugin') + " Looks a lot like dosini files. + runtime! ftplugin/dosini.vim +endif diff --git a/runtime/indent/bzl.vim b/runtime/indent/bzl.vim new file mode 100644 index 0000000000..24e5b870cd --- /dev/null +++ b/runtime/indent/bzl.vim @@ -0,0 +1,97 @@ +" Vim indent file +" Language: Bazel (http://bazel.io) +" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) +" Last Change: 2015 Aug 11 + +if exists('b:did_indent') + finish +endif + +" Load base python indent. +if !exists('*GetPythonIndent') + runtime! indent/python.vim +endif + +let b:did_indent = 1 + +" Only enable bzl google indent if python google indent is enabled. +if !get(g:, 'no_google_python_indent') + setlocal indentexpr=GetBzlIndent(v:lnum) +endif + +if exists('*GetBzlIndent') + finish +endif + +let s:save_cpo = &cpo +set cpo-=C + +" Maximum number of lines to look backwards. +let s:maxoff = 50 + +"" +" Determine the correct indent level given an {lnum} in the current buffer. +function GetBzlIndent(lnum) abort + let l:use_recursive_indent = !get(g:, 'no_google_python_recursive_indent') + if l:use_recursive_indent + " Backup and override indent setting variables. + if exists('g:pyindent_nested_paren') + let l:pyindent_nested_paren = g:pyindent_nested_paren + endif + if exists('g:pyindent_open_paren') + let l:pyindent_open_paren = g:pyindent_open_paren + endif + " Vim 7.3.693 and later defines a shiftwidth() function to get the effective + " shiftwidth value. Fall back to &shiftwidth if the function doesn't exist. + let l:sw_expr = exists('*shiftwidth') ? 'shiftwidth()' : '&shiftwidth' + let g:pyindent_nested_paren = l:sw_expr . ' * 2' + let g:pyindent_open_paren = l:sw_expr . ' * 2' + endif + + let l:indent = -1 + + " Indent inside parens. + " Align with the open paren unless it is at the end of the line. + " E.g. + " open_paren_not_at_EOL(100, + " (200, + " 300), + " 400) + " open_paren_at_EOL( + " 100, 200, 300, 400) + call cursor(a:lnum, 1) + let [l:par_line, l:par_col] = searchpairpos('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" . + \ " synIDattr(synID(line('.'), col('.'), 1), 'name')" . + \ " =~ '\\(Comment\\|String\\)$'") + if l:par_line > 0 + call cursor(l:par_line, 1) + if l:par_col != col('$') - 1 + let l:indent = l:par_col + endif + endif + + " Delegate the rest to the original function. + if l:indent == -1 + let l:indent = GetPythonIndent(a:lnum) + endif + + if l:use_recursive_indent + " Restore global variables. + if exists('l:pyindent_nested_paren') + let g:pyindent_nested_paren = l:pyindent_nested_paren + else + unlet g:pyindent_nested_paren + endif + if exists('l:pyindent_open_paren') + let g:pyindent_open_paren = l:pyindent_open_paren + else + unlet g:pyindent_open_paren + endif + endif + + return l:indent +endfunction + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim index 2c83f26b58..d492889fc7 100644 --- a/runtime/indent/fortran.vim +++ b/runtime/indent/fortran.vim @@ -1,9 +1,9 @@ " Vim indent file -" Language: Fortran 2008 (and earlier versions: 2003, 95, 90, and 77) -" Version: 0.41 -" Last Change: 2015 Jan. 15 +" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) +" Version: 0.42 +" Last Change: 2015 Nov. 30 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/> -" Usage: Do :help fortran-indent from Vim +" Usage: For instructions, do :help fortran-indent from Vim " Credits: " Useful suggestions were made by: Albert Oliver Serra. @@ -27,7 +27,10 @@ if exists("b:fortran_indent_more") || exists("g:fortran_indent_more") endif " Determine whether this is a fixed or free format source file -" if this hasn't been done yet +" if this hasn't been done yet using the priority: +" buffer-local value +" > global value +" > file extension as in Intel ifort, gcc (gfortran), NAG, Pathscale, and Cray compilers if !exists("b:fortran_fixed_source") if exists("fortran_free_source") " User guarantees free source form @@ -35,13 +38,19 @@ if !exists("b:fortran_fixed_source") elseif exists("fortran_fixed_source") " User guarantees fixed source form let b:fortran_fixed_source = 1 + elseif expand("%:e") ==? "f\<90\|95\|03\|08\>" + " Free-form file extension defaults as in Intel ifort, gcc(gfortran), NAG, Pathscale, and Cray compilers + let b:fortran_fixed_source = 0 + elseif expand("%:e") ==? "f\|f77\|for" + " Fixed-form file extension defaults + let b:fortran_fixed_source = 1 else - " f90 and f95 allow both fixed and free source form - " assume fixed source form unless signs of free source form + " Modern fortran still allows both fixed and free source form + " Assume fixed source form unless signs of free source form " are detected in the first five columns of the first s:lmax lines. - " Detection becomes more accurate and more time-consuming if more lines + " Detection becomes more accurate and time-consuming if more lines " are checked. Increase the limit below if you keep lots of comments at - " the very top of each file and you have a fast computer + " the very top of each file and you have a fast computer. let s:lmax = 500 if ( s:lmax > line("$") ) let s:lmax = line("$") diff --git a/runtime/indent/hog.vim b/runtime/indent/hog.vim new file mode 100644 index 0000000000..02ac7d4d1b --- /dev/null +++ b/runtime/indent/hog.vim @@ -0,0 +1,77 @@ +" Vim indent file +" Language: hog (Snort.conf) +" Maintainer: Victor Roemer, <vroemer@badsec.org> +" Last Change: Mar 7, 2013 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 +let b:undo_indent = 'setlocal smartindent< indentexpr< indentkeys<' + +setlocal nosmartindent +setlocal indentexpr=GetHogIndent() +setlocal indentkeys+=!^F,o,O,0# + +" Only define the function once. +if exists("*GetHogIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +let s:syn_blocks = '\<SnortRuleTypeBody\>' + +function s:IsInBlock(lnum) + return synIDattr(synID(a:lnum, 1, 1), 'name') =~ s:syn_blocks +endfunction + +function GetHogIndent() + let prevlnum = prevnonblank(v:lnum-1) + + " Comment blocks have identical indent + if getline(v:lnum) =~ '^\s*#' && getline(prevlnum) =~ '^\s*#' + return indent(prevlnum) + endif + + " Ignore comment lines when calculating indent + while getline(prevlnum) =~ '^\s*#' + let prevlnum = prevnonblank(prevlnum-1) + if !prevlnum + return previndent + endif + endwhile + + " Continuation of a line that wasn't indented + let prevline = getline(prevlnum) + if prevline =~ '^\k\+.*\\\s*$' + return &sw + endif + + " Continuation of a line that was indented + if prevline =~ '\k\+.*\\\s*$' + return indent(prevlnum) + endif + + " Indent the next line if previous line contained a start of a block + " definition ('{' or '('). + if prevline =~ '^\k\+[^#]*{}\@!\s*$' " TODO || prevline =~ '^\k\+[^#]*()\@!\s*$' + return &sw + endif + + " Match inside of a block + if s:IsInBlock(v:lnum) + if prevline =~ "^\k\+.*$" + return &sw + else + return indent(prevlnum) + endif + endif + + return 0 +endfunction + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index 7eb963b7b2..8aaf82e21f 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -2,7 +2,7 @@ " Header: "{{{ " Maintainer: Bram Moolenaar " Original Author: Andy Wokula <anwoku@yahoo.de> -" Last Change: 2015 Jun 12 +" Last Change: 2015 Sep 25 " Version: 1.0 " Description: HTML indent script with cached state for faster indenting on a " range of lines. @@ -178,13 +178,15 @@ let s:countonly = 0 " 3 "script" " 4 "style" " 5 comment start +" 6 conditional comment start " -1 closing tag " -2 "/pre" " -3 "/script" " -4 "/style" " -5 comment end +" -6 conditional comment end let s:indent_tags = {} -let s:endtags = [0,0,0,0,0,0] " long enough for the highest index +let s:endtags = [0,0,0,0,0,0,0] " long enough for the highest index "}}} " Add a list of tag names for a pair of <tag> </tag> to "tags". @@ -257,6 +259,7 @@ call s:AddBlockTag('pre', 2) call s:AddBlockTag('script', 3) call s:AddBlockTag('style', 4) call s:AddBlockTag('<!--', 5, '-->') +call s:AddBlockTag('<!--[', 6, '![endif]-->') "}}} " Return non-zero when "tagname" is an opening tag, not being a block tag, for @@ -291,7 +294,7 @@ func! s:CountITags(text) let s:nextrel = 0 " relative indent steps for next line [unit &sw]: let s:block = 0 " assume starting outside of a block let s:countonly = 1 " don't change state - call substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') + call substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\[\|\[endif\]-->\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') let s:countonly = 0 endfunc "}}} @@ -303,7 +306,7 @@ func! s:CountTagsAndState(text) let s:nextrel = 0 " relative indent steps for next line [unit &sw]: let s:block = b:hi_newstate.block - let tmp = substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') + let tmp = substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\[\|\[endif\]-->\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') if s:block == 3 let b:hi_newstate.scripttype = s:GetScriptType(matchstr(tmp, '\C.*<SCRIPT\>\zs[^>]*')) endif @@ -425,7 +428,7 @@ func! s:FreshState(lnum) " State: " lnum last indented line == prevnonblank(a:lnum - 1) " block = 0 a:lnum located within special tag: 0:none, 2:<pre>, - " 3:<script>, 4:<style>, 5:<!-- + " 3:<script>, 4:<style>, 5:<!--, 6:<!--[ " baseindent use this indent for line a:lnum as a start - kind of " autoindent (if block==0) " scripttype = '' type attribute of a script tag (if block==3) @@ -464,10 +467,13 @@ func! s:FreshState(lnum) " FI " look back for a blocktag - call cursor(a:lnum, 1) - let [stopline, stopcol] = searchpos('\c<\zs\/\=\%(pre\>\|script\>\|style\>\)', "bW") - if stopline > 0 - " fugly ... why isn't there searchstr() + let stopline2 = v:lnum + 1 + if has_key(b:hi_indent, 'block') && b:hi_indent.block > 5 + let [stopline2, stopcol2] = searchpos('<!--', 'bnW') + endif + let [stopline, stopcol] = searchpos('\c<\zs\/\=\%(pre\>\|script\>\|style\>\)', "bnW") + if stopline > 0 && stopline < stopline2 + " ugly ... why isn't there searchstr() let tagline = tolower(getline(stopline)) let blocktag = matchstr(tagline, '\/\=\%(pre\>\|script\>\|style\>\)', stopcol - 1) if blocktag[0] != "/" @@ -487,23 +493,29 @@ func! s:FreshState(lnum) " blocktag == "/..." let swendtag = match(tagline, '^\s*</') >= 0 if !swendtag - let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bW") + let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bnW") call s:CountITags(tolower(getline(bline)[: bcol-2])) let state.baseindent = indent(bline) + (s:curind + s:nextrel) * s:ShiftWidth() return state endif endif endif + if stopline > stopline2 + let stopline = stopline2 + let stopcol = stopcol2 + endif " else look back for comment - call cursor(a:lnum, 1) - let [comlnum, comcol, found] = searchpos('\(<!--\)\|-->', 'bpW', stopline) - if found == 2 + let [comlnum, comcol, found] = searchpos('\(<!--\[\)\|\(<!--\)\|-->', 'bpnW', stopline) + if found == 2 || found == 3 " comment opener found, assume a:lnum within comment - let state.block = 5 + let state.block = (found == 3 ? 5 : 6) let state.blocklnr = comlnum " check preceding tags in the line: call s:CountITags(tolower(getline(comlnum)[: comcol-2])) + if found == 2 + let state.baseindent = b:hi_indent.baseindent + endif let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth() return state endif @@ -819,6 +831,20 @@ func! s:Alien5() return indent(prevlnum) endfunc "}}} +" Return the indent for conditional comment: <!--[ ![endif]--> +func! s:Alien6() + "{{{ + let curtext = getline(v:lnum) + if curtext =~ '\s*\zs<!\[endif\]-->' + " current line starts with end of comment, line up with comment start. + let lnum = search('<!--', 'bn') + if lnum > 0 + return indent(lnum) + endif + endif + return b:hi_indent.baseindent + s:ShiftWidth() +endfunc "}}} + " When the "lnum" line ends in ">" find the line containing the matching "<". func! HtmlIndent_FindTagStart(lnum) "{{{ diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim index 5f049d4585..d1d2c0d600 100644 --- a/runtime/indent/lua.vim +++ b/runtime/indent/lua.vim @@ -2,7 +2,7 @@ " Language: Lua script " Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol.com.br> " First Author: Max Ischenko <mfi 'at' ukr.net> -" Last Change: 2014 Nov 12 +" Last Change: 2016 Jan 10 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -52,9 +52,9 @@ function! GetLuaIndent() endif endif - " Subtract a 'shiftwidth' on end, else (and elseif), until and '}' + " Subtract a 'shiftwidth' on end, else, elseif, until and '}' " This is the part that requires 'indentkeys'. - let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|until\>\|}\)') + let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\)') if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment" let ind = ind - &shiftwidth endif diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index 0394ee22e8..5bd8c77fab 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -1,16 +1,21 @@ " Vim indent file -" Language: Shell Script -" Maintainer: Peter Aronoff <telemachus@arpinum.org> -" Original Author: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2014-08-22 +" Language: Shell Script +" Maintainer: Christian Brabandt <cb@256bit.org> +" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org> +" Original Author: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-12-15 +" License: Vim (see :h license) +" Repository: https://github.com/chrisbra/vim-sh-indent if exists("b:did_indent") finish endif let b:did_indent = 1 +let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<' + setlocal indentexpr=GetShIndent() -setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,),0=;;,0=;& +setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,0=end,),0=;;,0=;& setlocal indentkeys+=0=fin,0=fil,0=fip,0=fir,0=fix setlocal indentkeys-=:,0# setlocal nosmartindent @@ -54,8 +59,8 @@ function! GetShIndent() let ind = indent(lnum) let line = getline(lnum) - if line =~ '^\s*\%(if\|then\|do\|else\|elif\|case\|while\|until\|for\|select\)\>' - if line !~ '\<\%(fi\|esac\|done\)\>\s*\%(#.*\)\=$' + if line =~ '^\s*\%(if\|then\|do\|else\|elif\|case\|while\|until\|for\|select\|foreach\)\>' + if line !~ '\<\%(fi\|esac\|done\|end\)\>\s*\%(#.*\)\=$' let ind += s:indent_value('default') endif elseif s:is_case_label(line, pnum) @@ -76,7 +81,7 @@ function! GetShIndent() let pine = line let line = getline(v:lnum) - if line =~ '^\s*\%(then\|do\|else\|elif\|fi\|done\)\>' || line =~ '^\s*}' + if line =~ '^\s*\%(then\|do\|else\|elif\|fi\|done\|end\)\>' || line =~ '^\s*}' let ind -= s:indent_value('default') elseif line =~ '^\s*esac\>' && s:is_case_empty(getline(v:lnum - 1)) let ind -= s:indent_value('default') diff --git a/runtime/indent/systemd.vim b/runtime/indent/systemd.vim new file mode 100644 index 0000000000..a05a87bb1c --- /dev/null +++ b/runtime/indent/systemd.vim @@ -0,0 +1,10 @@ +" Vim indent file +" Language: systemd.unit(5) + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +" Looks a lot like dosini files. +runtime! indent/dosini.vim diff --git a/runtime/indent/teraterm.vim b/runtime/indent/teraterm.vim new file mode 100644 index 0000000000..ba24257b02 --- /dev/null +++ b/runtime/indent/teraterm.vim @@ -0,0 +1,67 @@ +" Vim indent file +" Language: Tera Term Language (TTL) +" Based on Tera Term Version 4.86 +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-teraterm +" Last Change: 2015 Jun 4 +" Filenames: *.ttl +" License: VIM License + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal nosmartindent +setlocal noautoindent +setlocal indentexpr=GetTeraTermIndent(v:lnum) +setlocal indentkeys=!^F,o,O,e +setlocal indentkeys+==elseif,=endif,=loop,=next,=enduntil,=endwhile + +if exists("*GetTeraTermIndent") + finish +endif + +" The shiftwidth() function is relatively new. +" Don't require it to exist. +if exists('*shiftwidth') + function s:sw() abort + return shiftwidth() + endfunction +else + function s:sw() abort + return &shiftwidth + endfunction +endif + +function! GetTeraTermIndent(lnum) + let l:prevlnum = prevnonblank(a:lnum-1) + if l:prevlnum == 0 + " top of file + return 0 + endif + + " grab the previous and current line, stripping comments. + let l:prevl = substitute(getline(l:prevlnum), ';.*$', '', '') + let l:thisl = substitute(getline(a:lnum), ';.*$', '', '') + let l:previ = indent(l:prevlnum) + + let l:ind = l:previ + + if l:prevl =~ '^\s*if\>.*\<then\s*$' + " previous line opened a block + let l:ind += s:sw() + endif + if l:prevl =~ '^\s*\%(elseif\|else\|do\|until\|while\|for\)\>' + " previous line opened a block + let l:ind += s:sw() + endif + if l:thisl =~ '^\s*\%(elseif\|else\|endif\|enduntil\|endwhile\|loop\|next\)\>' + " this line closed a block + let l:ind -= s:sw() + endif + + return l:ind +endfunction + +" vim: ts=8 sw=2 sts=2 diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim index 1d03715773..aa4906ce0a 100644 --- a/runtime/indent/yaml.vim +++ b/runtime/indent/yaml.vim @@ -1,6 +1,7 @@ " Vim indent file " Language: YAML " Maintainer: Nikolai Pavlov <zyx.vim@gmail.com> +" Last Change: 2015 Nov 01 " Only load this indent file when no other was loaded. if exists('b:did_indent') @@ -13,7 +14,7 @@ set cpo&vim let b:did_indent = 1 setlocal indentexpr=GetYAMLIndent(v:lnum) -setlocal indentkeys=!^F,o,O,0#,0},0],<:>,- +setlocal indentkeys=!^F,o,O,0#,0},0],<:>,0- setlocal nosmartindent let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<' @@ -115,8 +116,13 @@ function GetYAMLIndent(lnum) \ s:liststartregex)) elseif line =~# s:mapkeyregex " Same for line containing mapping key - return indent(s:FindPrevLEIndentedLineMatchingRegex(a:lnum, - \ s:mapkeyregex)) + let prevmapline = s:FindPrevLEIndentedLineMatchingRegex(a:lnum, + \ s:mapkeyregex) + if getline(prevmapline) =~# '^\s*- ' + return indent(prevmapline) + 2 + else + return indent(prevmapline) + endif elseif prevline =~# '^\s*- ' " - List with " multiline scalar diff --git a/runtime/macros/less.bat b/runtime/macros/less.bat index bbe619bc92..7395a70003 100644 --- a/runtime/macros/less.bat +++ b/runtime/macros/less.bat @@ -4,7 +4,7 @@ rem Read stdin if no arguments were given. rem Written by Ken Takata. if "%1"=="" ( - vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" - + nvim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" - ) else ( - vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" %* + nvim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" %* ) diff --git a/runtime/macros/less.sh b/runtime/macros/less.sh index e29958f7ad..125162f10a 100755 --- a/runtime/macros/less.sh +++ b/runtime/macros/less.sh @@ -8,9 +8,9 @@ if test -t 1; then echo "Missing filename" 1>&2 exit fi - vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - + nvim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - else - vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" + nvim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" fi else # Output is not a terminal, cat arguments or stdin diff --git a/runtime/macros/less.vim b/runtime/macros/less.vim index d38bd3781d..7ccbeb32ea 100644 --- a/runtime/macros/less.vim +++ b/runtime/macros/less.vim @@ -1,6 +1,6 @@ " Vim script to work like "less" " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 May 13 +" Last Change: 2015 Nov 15 " Avoid loading this file twice, allow the user to define his own script. if exists("loaded_less") @@ -48,6 +48,12 @@ set nows let s:lz = &lz set lz +" Allow the user to define a function, which can set options specifically for +" this script. +if exists('*LessInitFunc') + call LessInitFunc() +endif + " Used after each command: put cursor at end and display position if &wrap noremap <SID>L L0:redraw<CR>:file<CR> diff --git a/runtime/makemenu.vim b/runtime/makemenu.vim index b78fdfd601..839dbdac07 100644 --- a/runtime/makemenu.vim +++ b/runtime/makemenu.vim @@ -177,6 +177,7 @@ SynMenu DE.Doxygen.C\ with\ doxygen:c.doxygen SynMenu DE.Doxygen.C++\ with\ doxygen:cpp.doxygen SynMenu DE.Doxygen.IDL\ with\ doxygen:idl.doxygen SynMenu DE.Doxygen.Java\ with\ doxygen:java.doxygen +SynMenu DE.Doxygen.DataScript\ with\ doxygen:datascript.doxygen SynMenu DE.Dracula:dracula SynMenu DE.DSSSL:dsl SynMenu DE.DTD:dtd diff --git a/runtime/optwin.vim b/runtime/optwin.vim index a092f18d23..68444dde01 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Nov 19 +" Last Change: 2015 Jul 22 " If there already is an option window, jump to that one. if bufwinnr("option-window") > 0 @@ -289,6 +289,10 @@ call append("$", " \tset tl=" . &tl) call append("$", "tags\tlist of file names to search for tags") call append("$", "\t(global or local to buffer)") call <SID>OptionG("tag", &tag) +call append("$", "tagcase\thow to handle case when searching in tags files:") +call append("$", "\t\"followic\" to follow 'ignorecase', \"ignore\" or \"match\"") +call append("$", "\t(global or local to buffer)") +call <SID>OptionG("tc", &tc) call append("$", "tagrelative\tfile names in a tags file are relative to the tags file") call <SID>BinOptionG("tr", &tr) call append("$", "tagstack\ta :tag command will use the tagstack") @@ -406,6 +410,10 @@ call append("$", "highlight\twhich highlighting to use for various occasions") call <SID>OptionG("hl", &hl) call append("$", "hlsearch\thighlight all matches for the last used search pattern") call <SID>BinOptionG("hls", &hls) +if has("termguicolors") + call append("$", "termguicolors\tuse GUI colors for the terminal") + call <SID>BinOptionG("tgc", &tgc) +endif if has("syntax") call append("$", "cursorcolumn\thighlight the screen column of the cursor") call append("$", "\t(local to window)") @@ -673,6 +681,8 @@ call append("$", "errorbells\tring the bell for error messages") call <SID>BinOptionG("eb", &eb) call append("$", "visualbell\tuse a visual bell instead of beeping") call <SID>BinOptionG("vb", &vb) +call append("$", "belloff\tdo not ring the bell for these reasons") +call <SID>OptionG("belloff", &belloff) if has("multi_lang") call append("$", "helplang\tlist of preferred languages for finding help") call <SID>OptionG("hlg", &hlg) @@ -756,7 +766,7 @@ call append("$", "infercase\tadjust case of a keyword completion match") call append("$", "\t(local to buffer)") call <SID>BinOptionL("inf") if has("digraphs") - call append("$", "digraph\tenable entering digraps with c1 <BS> c2") + call append("$", "digraph\tenable entering digraphs with c1 <BS> c2") call <SID>BinOptionG("dg", &dg) endif call append("$", "tildeop\tthe \"~\" command behaves like an operator") @@ -922,7 +932,7 @@ call <SID>BinOptionL("bin") call append("$", "endofline\tlast line in the file has an end-of-line") call append("$", "\t(local to buffer)") call <SID>BinOptionL("eol") -call append("$", "fixeol\tfixes missing end-of-line at end of text file") +call append("$", "fixendofline\tfixes missing end-of-line at end of text file") call append("$", "\t(local to buffer)") call <SID>BinOptionL("fixeol") if has("multi_byte") @@ -1132,7 +1142,7 @@ if has("arabic") call <SID>BinOptionG("tbidi", &tbidi) endif if has("keymap") - call append("$", "keymap\tname of a keyboard mappping") + call append("$", "keymap\tname of a keyboard mapping") call <SID>OptionL("kmp") endif if has("langmap") diff --git a/runtime/plugin/matchit.vim b/runtime/plugin/matchit.vim index 74c1a1eb92..70867b1f93 100644 --- a/runtime/plugin/matchit.vim +++ b/runtime/plugin/matchit.vim @@ -303,7 +303,7 @@ fun! s:CleanUp(options, mode, startline, startcol, ...) let regexp = s:Wholematch(matchline, a:1, currcol-1) let endcol = matchend(matchline, regexp) if endcol > currcol " This is NOT off by one! - execute "normal!" . (endcol - currcol) . "l" + call cursor(0, endcol) endif endif " a:0 endif " a:mode != "o" && etc. diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index 3804ab949a..873302efee 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -1,6 +1,6 @@ " Vim plugin for showing matching parens " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Jul 19 +" Last Change: 2015 Dec 31 " Exit quickly when: " - this plugin was already loaded (or disabled) @@ -55,14 +55,19 @@ function! s:Highlight_Matching_Pair() let before = 0 let text = getline(c_lnum) - let c = text[c_col - 1] + let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\=\)') + if empty(matches) + let [c_before, c] = ['', ''] + else + let [c_before, c] = matches[1:2] + endif let plist = split(&matchpairs, '.\zs[:,]') let i = index(plist, c) if i < 0 " not found, in Insert mode try character before the cursor if c_col > 1 && (mode() == 'i' || mode() == 'R') - let before = 1 - let c = text[c_col - 2] + let before = strlen(c_before) + let c = c_before let i = index(plist, c) endif if i < 0 diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index cad4d31a04..3776ac30f8 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -20,19 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v153" -if v:version < 702 - echohl WarningMsg - echo "***warning*** you need vim version 7.2 for this version of netrw" - echohl None - finish -endif -if v:version < 703 || (v:version == 703 && !has("patch465")) - echohl WarningMsg - echo "***warning*** this version of netrw needs vim 7.3.465 or later" - echohl Normal - finish -endif +let g:loaded_netrwPlugin = "v154" let s:keepcpo = &cpo set cpo&vim "DechoRemOn @@ -102,6 +90,12 @@ if !exists("g:netrw_nogx") vno <silent> <Plug>NetrwBrowseXVis :<c-u>call netrw#BrowseXVis()<cr> endif endif +if exists("g:netrw_usetab") && g:netrw_usetab + if maparg('<c-tab>','n') == "" + nmap <unique> <c-tab> <Plug>NetrwShrink + endif + nno <silent> <Plug>NetrwShrink :call netrw#Shrink()<cr> +endif " --------------------------------------------------------------------- " LocalBrowse: invokes netrw#LocalBrowseCheck() on directory buffers {{{2 @@ -135,15 +129,19 @@ fun! s:LocalBrowse(dirname) elseif isdirectory(a:dirname) " call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)") " call Dredir("LocalBrowse ft last set: ","verbose set ft") +" call Decho("(s:LocalBrowse) COMBAK#23: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) sil! call netrw#LocalBrowseCheck(a:dirname) +" call Decho("(s:LocalBrowse) COMBAK#24: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt exe w:netrw_bannercnt +" call Decho("(s:LocalBrowse) COMBAK#25: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) endif else " not a directory, ignore it " call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...") endif +" call Decho("(s:LocalBrowse) COMBAK#26: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) " call Dret("s:LocalBrowse") endfun diff --git a/runtime/plugin/rplugin.vim b/runtime/plugin/rplugin.vim index 2b2d333738..b4b03032b3 100644 --- a/runtime/plugin/rplugin.vim +++ b/runtime/plugin/rplugin.vim @@ -1,5 +1,16 @@ -if exists('loaded_remote_plugins') || &cp +if exists('g:loaded_remote_plugins') finish endif -let loaded_remote_plugins = 1 -call remote#host#LoadRemotePlugins() +let g:loaded_remote_plugins = 1 + +command! UpdateRemotePlugins call remote#host#UpdateRemotePlugins() + +augroup nvim-rplugin + autocmd! + autocmd FuncUndefined * + \ call remote#host#LoadRemotePluginsEvent( + \ 'FuncUndefined', expand('<amatch>')) + autocmd CmdUndefined * + \ call remote#host#LoadRemotePluginsEvent( + \ 'CmdUndefined', expand('<amatch>')) +augroup END diff --git a/runtime/plugin/spellfile.vim b/runtime/plugin/spellfile.vim index 437296090c..e03659d6d6 100644 --- a/runtime/plugin/spellfile.vim +++ b/runtime/plugin/spellfile.vim @@ -1,15 +1,8 @@ " Vim plugin for downloading spell files -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2006 Feb 01 -" Exit quickly when: -" - this plugin was already loaded -" - when 'compatible' is set -" - some autocommands are already taking care of spell files if exists("loaded_spellfile_plugin") || &cp || exists("#SpellFileMissing") finish endif let loaded_spellfile_plugin = 1 -" The function is in the autoload directory. autocmd SpellFileMissing * call spellfile#LoadFile(expand('<amatch>')) diff --git a/runtime/plugin/tohtml.vim b/runtime/plugin/tohtml.vim index eb47b1a7c3..b438dea811 100644 --- a/runtime/plugin/tohtml.vim +++ b/runtime/plugin/tohtml.vim @@ -1,6 +1,6 @@ " Vim plugin for converting a syntax highlighted file to HTML. " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2013 Jul 08 +" Last Change: 2015 Sep 08 " " The core of the code is in $VIMRUNTIME/autoload/tohtml.vim and " $VIMRUNTIME/syntax/2html.vim @@ -67,20 +67,24 @@ if exists('g:loaded_2html_plugin') finish endif -let g:loaded_2html_plugin = 'vim7.4_v1' +let g:loaded_2html_plugin = 'vim7.4_v2' " " Changelog: {{{ -" 7.4_v1 (this version): Fix modeline mangling for new "Vim:" format, and +" 7.4_v2 (this version): Fix error raised when converting a diff containing +" an empty buffer. Jan Stocker: allow g:html_font to +" take a list so it is easier to specfiy fallback +" fonts in the generated CSS. +" 7.4_v1 (Vim 7.4.0000): Fix modeline mangling for new "Vim:" format, and " also for version-specific modelines like "vim>703:". " " 7.3 updates: {{{ -" 7.3_v14 (ad6996a23e3e): Allow suppressing line number anchors using +" 7.3_v14 (Vim 7.3.1246): Allow suppressing line number anchors using " g:html_line_ids=0. Allow customizing " important IDs (like line IDs and fold IDs) using " g:html_id_expr evalutated when the buffer conversion " is started. -" 7.3_v13 (2eb30f341e8d): Keep foldmethod at manual in the generated file and +" 7.3_v13 (Vim 7.3.1088): Keep foldmethod at manual in the generated file and " insert modeline to set it to manual. " Fix bug: diff mode with 2 unsaved buffers creates a " duplicate of one buffer instead of including both. @@ -91,7 +95,7 @@ let g:loaded_2html_plugin = 'vim7.4_v1' " Fix XML validation error: &nsbp; not part of XML. " Allow TOhtml to chain together with other commands " using |. -" 7.3_v12 (9910cbff5f16): Fix modeline mangling to also work for when multiple +" 7.3_v12 (Vim 7.3.0616): Fix modeline mangling to also work for when multiple " highlight groups make up the start-of-modeline text. " Improve render time of page with uncopyable regions " by not using one-input-per-char. Change name of @@ -117,23 +121,23 @@ let g:loaded_2html_plugin = 'vim7.4_v1' " http://groups.google.com/d/topic/vim_dev/B6FSGfq9VoI/discussion. " This patch has not yet been included in Vim, thus " these changes are removed in the next version. -" 7.3_v10 (fd09a9c8468e): Fix error E684 when converting a range wholly inside +" 7.3_v10 (Vim 7.3.0227): Fix error E684 when converting a range wholly inside " multiple nested folds with dynamic folding on. " Also fix problem with foldtext in this situation. -" 7.3_v9 (0877b8d6370e): Add html_pre_wrap option active with html_use_css +" 7.3_v9 (Vim 7.3.0170): Add html_pre_wrap option active with html_use_css " and without html_no_pre, default value same as " 'wrap' option, (Andy Spencer). Don't use " 'fileencoding' for converted document encoding if " 'buftype' indicates a special buffer which isn't " written. -" 7.3_v8 (85c5a72551e2): Add html_expand_tabs option to allow leaving tab +" 7.3_v8 (Vim 7.3.0100): Add html_expand_tabs option to allow leaving tab " characters in generated output (Andy Spencer). " Escape text that looks like a modeline so Vim " doesn't use anything in the converted HTML as a " modeline. Bugfixes: Fix folding when a fold starts " before the conversion range. Remove fold column when " there are no folds. -" 7.3_v7 (840c3cadb842): see betas released on vim_dev below: +" 7.3_v7 (Vim 7-3-0063): see betas released on vim_dev below: " 7.3_v7b3: Fixed bug, convert Unicode to UTF-8 all the way. " 7.3_v7b2: Remove automatic detection of encodings that are not " supported by all major browsers according to @@ -147,23 +151,22 @@ let g:loaded_2html_plugin = 'vim7.4_v1' " charset, and make sure the 'fenc' of the generated " file matches its indicated charset. Add charsets for " all of Vim's natively supported encodings. -" 7.3_v6 (0d3f0e3d289b): Really fix bug with 'nowrapscan', 'magic' and other +" 7.3_v6 (Vim 7.3.0000): Really fix bug with 'nowrapscan', 'magic' and other " user settings interfering with diff mode generation, " trailing whitespace (e.g. line number column) when " using html_no_pre, and bugs when using " html_hover_unfold. " 7.3_v5 ( unreleased ): Fix bug with 'nowrapscan' and also with out-of-sync " folds in diff mode when first line was folded. -" 7.3_v4 (7e008c174cc3): Bugfixes, especially for xhtml markup, and diff mode -" 7.3_v3 (a29075150aee): Refactor option handling and make html_use_css +" 7.3_v4 (Vim 7.3.0000): Bugfixes, especially for xhtml markup, and diff mode +" 7.3_v3 (Vim 7.3.0000): Refactor option handling and make html_use_css " default to true when not set to anything. Use strict " doctypes where possible. Rename use_xhtml option to " html_use_xhtml for consistency. Use .xhtml extension " when using this option. Add meta tag for settings. -" 7.3_v2 (80229a724a11): Fix syntax highlighting in diff mode to use both the +" 7.3_v2 (Vim 7.3.0000): Fix syntax highlighting in diff mode to use both the " diff colors and the normal syntax colors -" 7.3_v1 (e7751177126b): Add conceal support and meta tags in output -" Pre-v1 baseline: Mercurial changeset 3c9324c0800e +" 7.3_v1 (Vim 7.3.0000): Add conceal support and meta tags in output "}}} "}}} diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index 2db72a2b60..76f60131f2 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -161,6 +161,7 @@ an 50.30.290 &Syntax.DE.Doxygen.C\ with\ doxygen :cal SetSyn("c.doxygen")<CR> an 50.30.300 &Syntax.DE.Doxygen.C++\ with\ doxygen :cal SetSyn("cpp.doxygen")<CR> an 50.30.310 &Syntax.DE.Doxygen.IDL\ with\ doxygen :cal SetSyn("idl.doxygen")<CR> an 50.30.320 &Syntax.DE.Doxygen.Java\ with\ doxygen :cal SetSyn("java.doxygen")<CR> +an 50.30.320 &Syntax.DE.Doxygen.DataScript\ with\ doxygen :cal SetSyn("datascript.doxygen")<CR> an 50.30.330 &Syntax.DE.Dracula :cal SetSyn("dracula")<CR> an 50.30.340 &Syntax.DE.DSSSL :cal SetSyn("dsl")<CR> an 50.30.350 &Syntax.DE.DTD :cal SetSyn("dtd")<CR> diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim index 187b1be1b0..ddc7819be2 100644 --- a/runtime/syntax/2html.vim +++ b/runtime/syntax/2html.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2013 Jul 08 +" Last Change: 2015 Sep 08 " " Additional contributors: " @@ -26,7 +26,11 @@ let s:end=line('$') " Font if exists("g:html_font") - let s:htmlfont = "'". g:html_font . "', monospace" + if type(g:html_font) == type([]) + let s:htmlfont = "'". join(g:html_font,"','") . "', monospace" + else + let s:htmlfont = "'". g:html_font . "', monospace" + endif else let s:htmlfont = "monospace" endif diff --git a/runtime/syntax/aptconf.vim b/runtime/syntax/aptconf.vim index 0607ca10f5..7a31b2d15e 100644 --- a/runtime/syntax/aptconf.vim +++ b/runtime/syntax/aptconf.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: APT config file " Maintainer: Yann Amar <quidame@poivron.org> -" Last Change: 2013 Apr 12 +" Last Change: 2015 Dec 22 " For version 5.x: Clear all syntax items " For version 6.x and 7.x: Quit when a syntax file was already loaded @@ -38,22 +38,22 @@ setlocal iskeyword+=/,-,.,_,+ " Incomplete keywords will be treated differently than completely bad strings: syn keyword aptconfGroupIncomplete - \ a[cquire] a[ptitude] d[ebtags] d[ebug] d[ir] d[pkg] d[select] - \ o[rderlist] p[ackagemanager] p[kgcachegen] q[uiet] r[pm] - \ u[nattended-upgrade] + \ a[cquire] a[dequate] a[ptitude] a[ptlistbugs] d[ebtags] d[ebug] + \ d[ir] d[pkg] d[select] o[rderlist] p[ackagemanager] p[kgcachegen] + \ q[uiet] r[pm] s[ynaptic] u[nattended-upgrade] w[hatmaps] " Only the following keywords can be used at toplevel (to begin an option): syn keyword aptconfGroup - \ acquire apt aptitude debtags debug dir dpkg dselect - \ orderlist packagemanager pkgcachegen quiet rpm - \ unattended-upgrade + \ acquire adequate apt aptitude aptlistbugs debtags debug + \ dir dpkg dselect orderlist packagemanager pkgcachegen + \ quiet rpm synaptic unattended-upgrade whatmaps " Possible options for each group: " Acquire: {{{ syn keyword aptconfAcquire contained - \ cdrom Check-Valid-Until CompressionTypes ForceHash ftp gpgv - \ GzipIndexes http https Languages Max-ValidTime Min-ValidTime PDiffs - \ Queue-Mode Retries Source-Symlinks + \ cdrom Check-Valid-Until CompressionTypes ForceHash ForceIPv4 + \ ForceIPv6 ftp gpgv GzipIndexes http https Languages Max-ValidTime + \ Min-ValidTime PDiffs Queue-Mode Retries Source-Symlinks syn keyword aptconfAcquireCDROM contained \ AutoDetect CdromOnly Mount UMount @@ -62,14 +62,15 @@ syn keyword aptconfAcquireCompressionTypes contained \ bz2 lzma gz Order syn keyword aptconfAcquireFTP contained - \ Passive Proxy ProxyLogin Timeout + \ ForceExtended Passive Proxy ProxyLogin Timeout syn keyword aptconfAcquireHTTP contained \ AllowRedirect Dl-Limit Max-Age No-Cache No-Store Pipeline-Depth - \ Proxy Timeout User-Agent + \ Proxy ProxyAutoDetect Proxy-Auto-Detect Timeout User-Agent syn keyword aptconfAcquireHTTPS contained - \ CaInfo CaPath CrlFile IssuerCert SslCert SslForceVersion SslKey + \ AllowRedirect CaInfo CaPath CrlFile Dl-Limit IssuerCert Max-Age + \ No-Cache No-Store Proxy SslCert SslForceVersion SslKey Timeout \ Verify-Host Verify-Peer syn keyword aptconfAcquireMaxValidTime contained @@ -83,14 +84,21 @@ syn cluster aptconfAcquire_ contains=aptconfAcquire, \ aptconfAcquireHTTP,aptconfAcquireHTTPS,aptconfAcquireMaxValidTime, \ aptconfAcquirePDiffs " }}} +" Adequate: {{{ +syn keyword aptconfAdequate contained + \ Enabled + +syn cluster aptconfAdequate_ contains=aptconfAdequate +" }}} " Apt: {{{ syn keyword aptconfApt contained \ Architecture Architectures Archive Authentication AutoRemove - \ Build-Essential Cache Cache-Grow Cache-Limit Cache-Start CDROM - \ Changelogs Clean-Installed Compressor Default-Release - \ Force-LoopBreak Get Ignore-Hold Immediate-Configure + \ Build-Essential Build-Profiles Cache Cache-Grow Cache-Limit + \ Cache-Start CDROM Changelogs Clean-Installed Compressor + \ Default-Release Force-LoopBreak Get Ignore-Hold Immediate-Configure \ Install-Recommends Install-Suggests Keep-Fds List-Cleanup - \ NeverAutoRemove Never-MarkAuto-Sections Periodic Status-Fd Update + \ Move-Autobit-Sections NeverAutoRemove Never-MarkAuto-Sections + \ Periodic Status-Fd Update VersionedKernelPackages syn keyword aptconfAptAuthentication contained \ TrustCDROM @@ -124,11 +132,12 @@ syn keyword aptconfAptGet contained syn keyword aptconfAptPeriodic contained \ AutocleanInterval BackupArchiveInterval BackupLevel - \ Download-Upgradeable-Packages MaxAge MaxSize MinAge - \ Unattended-Upgrade Update-Package-Lists Verbose + \ Download-Upgradeable-Packages Download-Upgradeable-Packages-Debdelta + \ Enable MaxAge MaxSize MinAge Unattended-Upgrade Update-Package-Lists + \ Verbose syn keyword aptconfAptUpdate contained - \ Pre-Invoke Post-Invoke Post-Invoke-Success + \ List-Refresh Pre-Invoke Post-Invoke Post-Invoke-Success syn cluster aptconfApt_ contains=aptconfApt, \ aptconfAptAuthentication,aptconfAptAutoRemove,aptconfAptCache, @@ -240,6 +249,12 @@ syn cluster aptconfAptitude_ contains=aptconfAptitude, \ aptconfAptitudeUIKeyBindings,aptconfAptitudeUIStyles, \ aptconfAptitudeUIStylesElements " }}} +" AptListbugs: {{{ +syn keyword aptconfAptListbugs contained + \ IgnoreRegexp Severities + +syn cluster aptconfAptListbugs_ contains=aptconfAptListbugs +" }}} " DebTags: {{{ syn keyword aptconfDebTags contained \ Vocabulary @@ -251,7 +266,8 @@ syn keyword aptconfDebug contained \ Acquire aptcdrom BuildDeps Hashes IdentCdrom Nolocking \ pkgAcquire pkgAutoRemove pkgCacheGen pkgDepCache pkgDPkgPM \ pkgDPkgProgressReporting pkgInitialize pkgOrderList - \ pkgPackageManager pkgPolicy pkgProblemResolver sourceList + \ pkgPackageManager pkgPolicy pkgProblemResolver RunScripts + \ sourceList syn keyword aptconfDebugAcquire contained \ cdrom Ftp gpgv Http Https netrc @@ -295,7 +311,7 @@ syn keyword aptconfDirMedia contained \ MountPath syn keyword aptconfDirState contained - \ cdroms extended_states Lists mirrors status + \ cdroms extended_states Lists mirrors preferences status syn cluster aptconfDir_ contains=aptconfDir, \ aptconfDirAptitude,aptconfDirBin,aptconfDirCache,aptconfDirEtc, @@ -303,15 +319,16 @@ syn cluster aptconfDir_ contains=aptconfDir, " }}} " DPkg: {{{ syn keyword aptconfDPkg contained - \ Build-Options Chroot-Directory ConfigurePending FlushSTDIN MaxArgs - \ MaxBytes NoTriggers options Pre-Install-Pkgs Pre-Invoke Post-Invoke + \ Build-Options Chroot-Directory ConfigurePending FlushSTDIN + \ MaxArgBytes MaxArgs MaxBytes NoTriggers options + \ Pre-Install-Pkgs Pre-Invoke Post-Invoke \ Run-Directory StopOnError Tools TriggersPending syn keyword aptconfDPkgTools contained - \ Options Version + \ adequate InfoFD Options Version syn cluster aptconfDPkg_ contains=aptconfDPkg, - \ aptconfDPkgOrderList,aptconfDPkgOrderListScore,aptconfDPkgTools + \ aptconfDPkgTools " }}} " DSelect: {{{ syn keyword aptconfDSelect contained @@ -353,23 +370,59 @@ syn keyword aptconfRpm contained syn cluster aptconfRpm_ contains=aptconfRpm " }}} -" Unattened Upgrade: {{{ +" Synaptic: {{{ +syn keyword aptconfSynaptic contained + \ AskQuitOnProceed AskRelated AutoCleanCache CleanCache DefaultDistro + \ delAction delHistory Download-Only ftpProxy ftpProxyPort httpProxy + \ httpProxyPort Install-Recommends LastSearchType Maximized noProxy + \ OneClickOnStatusActions ShowAllPkgInfoInMain showWelcomeDialog + \ ToolbarState undoStackSize update upgradeType useProxy UseStatusColors + \ UseTerminal useUserFont useUserTerminalFont ViewMode + \ availVerColumnPos availVerColumnVisible componentColumnPos + \ componentColumnVisible descrColumnPos descrColumnVisible + \ downloadSizeColumnPos downloadSizeColumnVisible hpanedPos + \ instVerColumnPos instVerColumnVisible instSizeColumnPos + \ instSizeColumnVisible nameColumnPos nameColumnVisible + \ sectionColumnPos sectionColumnVisible statusColumnPos + \ statusColumnVisible supportedColumnPos supportedColumnVisible + \ vpanedPos windowWidth windowHeight windowX windowY closeZvt + \ color-available color-available-locked color-broken color-downgrade + \ color-install color-installed-locked color-installed-outdated + \ color-installed-updated color-new color-purge color-reinstall + \ color-remove color-upgrade + +syn keyword aptconfSynapticUpdate contained + \ last type + +syn cluster aptconfSynaptic_ contains=aptconfSynaptic, + \ aptconfSynapticUpdate +" }}} +" Unattended Upgrade: {{{ syn keyword aptconfUnattendedUpgrade contained - \ AutoFixInterruptedDpkg Automatic-Reboot InstallOnShutdown Mail - \ MailOnlyOnError MinimalSteps Origins-Pattern Package-Blacklist + \ AutoFixInterruptedDpkg Automatic-Reboot Automatic-Reboot-Time + \ Automatic-Reboot-WithUsers InstallOnShutdown Mail MailOnlyOnError + \ MinimalSteps Origins-Pattern Package-Blacklist \ Remove-Unused-Dependencies syn cluster aptconfUnattendedUpgrade_ contains=aptconfUnattendedUpgrade " }}} +" Whatmaps: {{{ +syn keyword aptconfWhatmaps contained + \ Enable-Restart Security-Update-Origins + +syn cluster aptconfWhatmaps_ contains=aptconfWhatmaps +" }}} syn case match " Now put all the keywords (and 'valid' options) in a single cluster: syn cluster aptconfOptions contains=aptconfRegexpOpt, - \ @aptconfAcquire_,@aptconfApt_,@aptconfAptitude_,@aptconfDebTags_, - \ @aptconfDebug_,@aptconfDir_,@aptconfDPkg_,@aptconfDSelect_, - \ @aptconfOrderList_,@aptconfPackageManager_,@aptconfPkgCacheGen_, - \ @aptconfQuiet_,@aptconfRpm_,@aptconfUnattendedUpgrade_ + \ @aptconfAcquire_,@aptconfAdequate_,@aptconfApt_,@aptconfAptitude_, + \ @aptconfAptListbugs_,@aptconfDebTags_,@aptconfDebug_,@aptconfDir_, + \ @aptconfDPkg_,@aptconfDSelect_,@aptconfOrderList_, + \ @aptconfPackageManager_,@aptconfPkgCacheGen_,@aptconfQuiet_, + \ @aptconfRpm_,@aptconfSynaptic_,@aptconfUnattendedUpgrade_, + \ @aptconfWhatmaps_ " Syntax: syn match aptconfSemiColon ';' @@ -382,8 +435,11 @@ syn region aptconfInclude matchgroup=aptconfOperator start='::' end='::\|\s'me= " Basic Syntax Errors: XXX avoid to generate false positives !!! " -" * Invalid comment format (seems to not cause errors, but...): -syn match aptconfAsError display '^#.*' +" * Undocumented inline comment. Since it is currently largely used, and does +" not seem to cause trouble ('apt-config dump' never complains when # is used +" the same way than //) it has been moved to aptconfComment group. But it +" still needs to be defined here (i.e. before #clear and #include directives) +syn match aptconfComment '#.*' contains=@aptconfCommentSpecial " " * When a semicolon is missing after a double-quoted string: " There are some cases (for example in the Dir group of options, but not only) @@ -445,6 +501,8 @@ hi def link aptconfAcquireHTTPS aptconfOption hi def link aptconfAcquireMaxValidTime aptconfOption hi def link aptconfAcquirePDiffs aptconfOption +hi def link aptconfAdequate aptconfOption + hi def link aptconfApt aptconfOption hi def link aptconfAptAuthentication aptconfOption hi def link aptconfAptAutoRemove aptconfOption @@ -471,6 +529,8 @@ hi def link aptconfAptitudeUIKeyBindings aptconfOption hi def link aptconfAptitudeUIStyles aptconfOption hi def link aptconfAptitudeUIStylesElements aptconfOption +hi def link aptconfAptListbugs aptconfOption + hi def link aptconfDebTags aptconfOption hi def link aptconfDebug aptconfOption @@ -504,8 +564,13 @@ hi def link aptconfQuiet aptconfOption hi def link aptconfRpm aptconfOption +hi def link aptconfSynaptic aptconfOption +hi def link aptconfSynapticUpdate aptconfOption + hi def link aptconfUnattendedUpgrade aptconfOption +hi def link aptconfWhatmaps aptconfOption + let b:current_syntax = "aptconf" let &cpo = s:cpo_save diff --git a/runtime/syntax/autohotkey.vim b/runtime/syntax/autohotkey.vim index 42d4cfdfe4..764f94b11a 100644 --- a/runtime/syntax/autohotkey.vim +++ b/runtime/syntax/autohotkey.vim @@ -1,7 +1,8 @@ " Vim syntax file " Language: AutoHotkey script file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-06-22 +" Maintainer: SungHyun Nam <goweol@gmail.com> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-10-29 if exists("b:current_syntax") finish @@ -179,6 +180,7 @@ syn keyword autohotkeyRepeat syn keyword autohotkeyConditional \ IfExist IfNotExist If IfEqual IfLess IfGreater Else + \ IfWinExist IfWinNotExist syn match autohotkeyPreProcStart \ nextgroup= diff --git a/runtime/syntax/bzl.vim b/runtime/syntax/bzl.vim new file mode 100644 index 0000000000..b0ee9454ff --- /dev/null +++ b/runtime/syntax/bzl.vim @@ -0,0 +1,16 @@ +" Vim syntax file +" Language: Bazel (http://bazel.io) +" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) +" Last Change: 2015 Aug 11 + +if exists('b:current_syntax') + finish +endif + + +runtime! syntax/python.vim + +let b:current_syntax = 'bzl' + +syn region bzlRule start='^\w\+($' end='^)\n*' transparent fold +syn region bzlList start='\[' end='\]' transparent fold diff --git a/runtime/syntax/cmake.vim b/runtime/syntax/cmake.vim index 8e54d511e0..4586940c5e 100644 --- a/runtime/syntax/cmake.vim +++ b/runtime/syntax/cmake.vim @@ -2,10 +2,10 @@ " Program: CMake - Cross-Platform Makefile Generator " Module: $RCSfile: cmake-syntax.vim,v $ " Language: CMake +" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com> +" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com> " Author: Andy Cedilnik <andy.cedilnik@kitware.com> -" Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com> -" Last Change: 2012 Jun 01 -" (Dominique Pelle added @Spell) +" Last Change: 2015 Dec 17 " Version: $Revision: 1.10 $ " " Licence: The CMake license applies to this file. See @@ -31,9 +31,9 @@ syn region cmakeVariableValue start=/\${/ end=/}/ \ contained oneline contains=CONTAINED,cmakeTodo syn region cmakeEnvironment start=/\$ENV{/ end=/}/ \ contained oneline contains=CONTAINED,cmakeTodo -syn region cmakeString start=/"/ end=/"/ +syn region cmakeString start=/"/ end=/"/ \ contains=CONTAINED,cmakeTodo,cmakeOperators -syn region cmakeArguments start=/(/ end=/)/ +syn region cmakeArguments start=/(/ end=/)/ \ contains=ALLBUT,cmakeArguments,cmakeTodo syn keyword cmakeSystemVariables \ WIN32 UNIX APPLE CYGWIN BORLAND MINGW MSVC MSVC_IDE MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 @@ -44,11 +44,11 @@ syn keyword cmakeDeprecated ABSTRACT_FILES BUILD_NAME SOURCE_FILES SOURCE_FILES_ \ nextgroup=cmakeArguments " The keywords are generated as: cmake --help-command-list | tr "\n" " " -syn keyword cmakeStatement +syn keyword cmakeStatement \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE \ nextgroup=cmakeArguments -syn keyword cmakeTodo - \ TODO FIXME XXX +syn keyword cmakeTodo + \ TODO FIXME XXX \ contained " Define the default highlighting. diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim index 526ecbcd53..c7a68388be 100644 --- a/runtime/syntax/cpp.vim +++ b/runtime/syntax/cpp.vim @@ -2,7 +2,7 @@ " Language: C++ " Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Previous Maintainer: Ken Shan <ccshan@post.harvard.edu> -" Last Change: 2015 Mar 1 +" Last Change: 2015 Nov 10 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -23,7 +23,8 @@ endif " C++ extensions syn keyword cppStatement new delete this friend using syn keyword cppAccess public protected private -syn keyword cppType inline virtual explicit export bool wchar_t +syn keyword cppModifier inline virtual explicit export +syn keyword cppType bool wchar_t syn keyword cppExceptions throw try catch syn keyword cppOperator operator typeid syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq @@ -36,7 +37,8 @@ syn keyword cppConstant __cplusplus " C++ 11 extensions if !exists("cpp_no_cpp11") - syn keyword cppType override final + syn keyword cppModifier override final + syn keyword cppType nullptr_t syn keyword cppExceptions noexcept syn keyword cppStorageClass constexpr decltype thread_local syn keyword cppConstant nullptr @@ -46,7 +48,12 @@ if !exists("cpp_no_cpp11") syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE - syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell + syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell +endif + +" C++ 14 extensions +if !exists("cpp_no_cpp14") + syn match cppNumber display "\<0b[01]\+\(u\=l\{0,2}\|ll\=u\)\>" endif " The minimum and maximum operators in GNU C++ @@ -65,6 +72,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits") HiLink cppExceptions Exception HiLink cppOperator Operator HiLink cppStatement Statement + HiLink cppModifier Type HiLink cppType Type HiLink cppStorageClass StorageClass HiLink cppStructure Structure diff --git a/runtime/syntax/datascript.vim b/runtime/syntax/datascript.vim index 2b4ec513b4..a983b8e34c 100644 --- a/runtime/syntax/datascript.vim +++ b/runtime/syntax/datascript.vim @@ -1,11 +1,12 @@ " Vim syntax file -" Language: Datascript +" Language: DataScript " Maintainer: Dominique Pelle <dominique.pelle@gmail.com> -" Last Change: 2014 Feb 26 +" Last Change: 2015 Jul 30 " " DataScript is a formal language for modelling binary datatypes, " bitstreams or file formats. For more information, see: -" http://datascript.berlios.de/DataScriptLanguageOverview.html +" +" http://dstools.sourceforge.net/DataScriptLanguageOverview.html if version < 600 syntax clear @@ -19,6 +20,8 @@ syn keyword dsPackage import package syn keyword dsType bit bool string syn keyword dsType int int8 int16 int32 int64 syn keyword dsType uint8 uint16 uint32 uint64 +syn keyword dsType varint16 varint32 varint64 +syn keyword dsType varuint16 varuint32 varuint64 syn keyword dsType leint16 leint32 leint64 syn keyword dsType leuint16 leuint32 leuint64 syn keyword dsEndian little big @@ -32,7 +35,8 @@ syn keyword dsOperator sizeof bitsizeof lengthof is sum forall in syn keyword dsStorageClass const syn keyword dsTodo contained TODO FIXME XXX syn keyword dsSql sql sql_table sql_database sql_pragma sql_index -syn keyword dsSql sql_integer sql_metadata sql_key foreign_key +syn keyword dsSql sql_integer sql_metadata sql_key sql_virtual +syn keyword dsSql using reference_key foreign_key to " dsCommentGroup allows adding matches for special things in comments. syn cluster dsCommentGroup contains=dsTodo @@ -61,6 +65,8 @@ syn region dsComment syn region dsString \ start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell +syn sync ccomment dsComment + " Define the default highlighting. hi def link dsType Type hi def link dsEndian StorageClass diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index ed3d024499..4f1d6d4b11 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,8 +3,8 @@ " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainers: Gerfried Fuchs <alfie@ist.org> " Wichert Akkerman <wakkerma@debian.org> -" Last Change: 2015 Apr 30 -" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/debchangelog.vim +" Last Change: 2015 Oct 24 +" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debchangelog.vim " Standard syntax initialization if version < 600 @@ -23,7 +23,7 @@ let binNMU='binary-only=yes' syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " exe 'syn match debchangelogFirstKV contained "; \('.urgency.'\|'.binNMU.'\)"' exe 'syn match debchangelogOtherKV contained ", \('.urgency.'\|'.binNMU.'\)"' -syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|wheezy-%(backports%(-sloppy)=|security)|jessie%(-backports|-security)=|stretch|%(devel|lucid|precise|trusty|utopic)%(-%(security|proposed|updates|backports|commercial|partner))=)+" +syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|wheezy-%(backports%(-sloppy)=|security)|jessie%(-backports|-security)=|stretch|%(devel|precise|trusty|vivid|wily|xenial)%(-%(security|proposed|updates|backports|commercial|partner))=)+" syn match debchangelogVersion contained "(.\{-})" syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*" syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*" diff --git a/runtime/syntax/debcontrol.vim b/runtime/syntax/debcontrol.vim index 6d140d9bd9..4fb53a55ca 100644 --- a/runtime/syntax/debcontrol.vim +++ b/runtime/syntax/debcontrol.vim @@ -3,8 +3,8 @@ " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainers: Gerfried Fuchs <alfie@ist.org> " Wichert Akkerman <wakkerma@debian.org> -" Last Change: 2014 Oct 08 -" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/debcontrol.vim +" Last Change: 2015 Oct 24 +" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debcontrol.vim " Standard syntax initialization if version < 600 diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index c8d110c77b..e0c5f4075f 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,8 +2,8 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl> -" Last Change: 2015 May 25 -" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/debsources.vim +" Last Change: 2015 Oct 24 +" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debsources.vim " Standard syntax initialization if version < 600 @@ -27,7 +27,7 @@ let s:supported = [ \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', \ 'squeeze', 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy', \ - \ 'precise', 'trusty', 'utopic', 'vivid', 'wily', 'devel' + \ 'precise', 'trusty', 'vivid', 'wily', 'xenial', 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', @@ -35,7 +35,8 @@ let s:unsupported = [ \ \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', - \ 'maverick', 'natty', 'oneiric', 'quantal', 'raring', 'saucy' + \ 'maverick', 'natty', 'oneiric', 'quantal', 'raring', 'saucy', + \ 'utopic' \ ] let &cpo=s:cpo diff --git a/runtime/syntax/dircolors.vim b/runtime/syntax/dircolors.vim index c94d720644..1b598c39b5 100644 --- a/runtime/syntax/dircolors.vim +++ b/runtime/syntax/dircolors.vim @@ -44,24 +44,24 @@ highlight default link dircolorsExtension Identifier highlight default link dircolorsEscape Special function! s:set_guicolors() abort - let s:guicolors = {} - - let s:guicolors[0] = "Black" - let s:guicolors[1] = "DarkRed" - let s:guicolors[2] = "DarkGreen" - let s:guicolors[3] = "DarkYellow" - let s:guicolors[4] = "DarkBlue" - let s:guicolors[5] = "DarkMagenta" - let s:guicolors[6] = "DarkCyan" - let s:guicolors[7] = "Gray" - let s:guicolors[8] = "DarkGray" - let s:guicolors[9] = "Red" - let s:guicolors[10] = "Green" - let s:guicolors[11] = "Yellow" - let s:guicolors[12] = "Blue" - let s:guicolors[13] = "Magenta" - let s:guicolors[14] = "Cyan" - let s:guicolors[15] = "White" + let s:termguicolors = {} + + let s:termguicolors[0] = "Black" + let s:termguicolors[1] = "DarkRed" + let s:termguicolors[2] = "DarkGreen" + let s:termguicolors[3] = "DarkYellow" + let s:termguicolors[4] = "DarkBlue" + let s:termguicolors[5] = "DarkMagenta" + let s:termguicolors[6] = "DarkCyan" + let s:termguicolors[7] = "Gray" + let s:termguicolors[8] = "DarkGray" + let s:termguicolors[9] = "Red" + let s:termguicolors[10] = "Green" + let s:termguicolors[11] = "Yellow" + let s:termguicolors[12] = "Blue" + let s:termguicolors[13] = "Magenta" + let s:termguicolors[14] = "Cyan" + let s:termguicolors[15] = "White" let xterm_palette = ["00", "5f", "87", "af", "d7", "ff"] @@ -70,7 +70,7 @@ function! s:set_guicolors() abort for r in xterm_palette for g in xterm_palette for b in xterm_palette - let s:guicolors[cur_col] = '#' . r . g . b + let s:termguicolors[cur_col] = '#' . r . g . b let cur_col += 1 endfor endfor @@ -78,14 +78,14 @@ function! s:set_guicolors() abort for i in range(24) let g = i * 0xa + 8 - let s:guicolors[i + 232] = '#' . g . g . g + let s:termguicolors[i + 232] = '#' . g . g . g endfor endfunction function! s:get_hi_str(color, place) abort if a:color >= 0 && a:color <= 255 if has('gui_running') - return ' gui' . a:place . '=' . s:guicolors[a:color] + return ' gui' . a:place . '=' . s:termguicolors[a:color] elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88 return ' cterm' . a:place . '=' . a:color endif diff --git a/runtime/syntax/dnsmasq.vim b/runtime/syntax/dnsmasq.vim index 2a31aed77f..9fa32077b6 100644 --- a/runtime/syntax/dnsmasq.vim +++ b/runtime/syntax/dnsmasq.vim @@ -4,8 +4,8 @@ " :3s+-foo++g " Description: highlight dnsmasq configuration files " File: runtime/syntax/dnsmasq.vim -" Version: 2.70 -" Last Change: 2014 Apr 30 +" Version: 2.76 +" Last Change: 2015 Sep 27 " Modeline: vim: ts=8:sw=2:sts=2: " " License: VIM License @@ -131,10 +131,12 @@ syn match DnsmasqKeyword "^\s*dhcp-sequential-ip\>" syn match DnsmasqKeyword "^\s*dhcp-subscrid\>" syn match DnsmasqKeyword "^\s*dhcp-userclass\>" syn match DnsmasqKeyword "^\s*dhcp-vendorclass\>" +syn match DnsmasqKeyword "^\s*dhcp-hostsdir\>" syn match DnsmasqKeyword "^\s*dns-rr\>" syn match DnsmasqKeyword "^\s*dnssec\>" syn match DnsmasqKeyword "^\s*dnssec-check-unsigned\>" syn match DnsmasqKeyword "^\s*dnssec-no-timecheck\>" +syn match DnsmasqKeyword "^\s*dnssec-timestamp\>" syn match DnsmasqKeyword "^\s*dns-forward-max\>" syn match DnsmasqKeyword "^\s*domain\>" syn match DnsmasqKeyword "^\s*domain-needed\>" @@ -150,6 +152,7 @@ syn match DnsmasqKeyword "^\s*host-record\>" syn match DnsmasqKeyword "^\s*interface\>" syn match DnsmasqKeyword "^\s*interface-name\>" syn match DnsmasqKeyword "^\s*ipset\>" +syn match DnsmasqKeyword "^\s*ignore-address\>" syn match DnsmasqKeyword "^\s*keep-in-foreground\>" syn match DnsmasqKeyword "^\s*leasefile-ro\>" syn match DnsmasqKeyword "^\s*listen-address\>" @@ -164,6 +167,7 @@ syn match DnsmasqKeyword "^\s*log-facility\>" syn match DnsmasqKeyword "^\s*log-queries\>" syn match DnsmasqKeyword "^\s*max-ttl\>" syn match DnsmasqKeyword "^\s*max-cache-ttl\>" +syn match DnsmasqKeyword "^\s*min-cache-ttl\>" syn match DnsmasqKeyword "^\s*min-port\>" syn match DnsmasqKeyword "^\s*mx-host\>" syn match DnsmasqKeyword "^\s*mx-target\>" @@ -204,6 +208,7 @@ syn match DnsmasqKeyword "^\s*test\>" syn match DnsmasqKeyword "^\s*tftp-max\>" syn match DnsmasqKeyword "^\s*tftp-lowercase\>" syn match DnsmasqKeyword "^\s*tftp-no-blocksize\>" +syn match DnsmasqKeyword "^\s*tftp-no-fail\>" syn match DnsmasqKeyword "^\s*tftp-port-range\>" syn match DnsmasqKeyword "^\s*tftp-root\>" syn match DnsmasqKeyword "^\s*tftp-secure\>" diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim index 120a999404..26d063524e 100644 --- a/runtime/syntax/fortran.vim +++ b/runtime/syntax/fortran.vim @@ -1,12 +1,12 @@ " Vim syntax file -" Language: Fortran 2008 (and earlier versions: 2003, 95, 90, and 77) -" Version: 0.95 -" Last Change: 2015 Jan. 15 +" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77) +" Version: 0.96 +" Last Change: 2015 Nov. 30 " Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/> " Usage: For instructions, do :help fortran-syntax from Vim " Credits: " Version 0.1 was based on the fortran 77 syntax file by Mario Eusebio and -" Preben Guldberg. Useful suggestions were made by: Andrej Panjkov, +" Preben Guldberg. Useful suggestions and contributions were made by: Andrej Panjkov, " Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile, " Walter Dieudonné, Alexander Wagner, Roman Bertle, Charles Rendleman, " Andrew Griffiths, Joe Krahn, Hendrik Merx, and Matt Thompson. @@ -19,8 +19,8 @@ let s:cpo_save = &cpo set cpo&vim " Choose fortran_dialect using the priority: -" source file directive > buffer-local value > global value > default -" try using directive in first three lines of file +" source file directive > buffer-local value > global value > file extension +" first try using directive in first three lines of file let b:fortran_retype = getline(1)." ".getline(2)." ".getline(3) if b:fortran_retype =~? '\<fortran_dialect\s*=\s*F\>' let b:fortran_dialect = "F" @@ -51,6 +51,12 @@ if !exists("b:fortran_fixed_source") elseif exists("fortran_fixed_source") " User guarantees fixed source form for all fortran files let b:fortran_fixed_source = 1 + elseif expand("%:e") ==? "f\<90\|95\|03\|08\>" + " Free-form file extension defaults as in Intel ifort, gcc(gfortran), NAG, Pathscale, and Cray compilers + let b:fortran_fixed_source = 0 + elseif expand("%:e") ==? "f\|f77\|for" + " Fixed-form file extension defaults + let b:fortran_fixed_source = 1 else " Modern fortran still allows both free and fixed source form. " Assume fixed source form unless signs of free source form @@ -67,8 +73,8 @@ if !exists("b:fortran_fixed_source") while s:ln <= s:lmax let s:test = strpart(getline(s:ln),0,5) if s:test !~ '^[Cc*]' && s:test !~ '^ *[!#]' && s:test =~ '[^ 0-9\t]' && s:test !~ '^[ 0-9]*\t' - let b:fortran_fixed_source = 0 - break + let b:fortran_fixed_source = 0 + break endif let s:ln = s:ln + 1 endwhile diff --git a/runtime/syntax/gnuplot.vim b/runtime/syntax/gnuplot.vim index 03d813c99f..d85932d401 100644 --- a/runtime/syntax/gnuplot.vim +++ b/runtime/syntax/gnuplot.vim @@ -1,8 +1,9 @@ " Vim syntax file " Language: gnuplot 4.7.0 -" Maintainer: Andrew Rasmussen andyras@users.sourceforge.net +" Maintainer: Josh Wainwright <wainwright DOT ja AT gmail DOT com> +" Last Maintainer: Andrew Rasmussen andyras@users.sourceforge.net " Original Maintainer: John Hoelzel johnh51@users.sourceforge.net -" Last Change: 2014-02-24 +" Last Change: 2015-08-25 " Filenames: *.gnu *.plt *.gpi *.gih *.gp *.gnuplot scripts: #!*gnuplot " URL: http://www.vim.org/scripts/script.php?script_id=4873 " Original URL: http://johnh51.get.to/vim/syntax/gnuplot.vim @@ -364,18 +365,18 @@ syn keyword gnuplotKeyword samples " set size syn keyword gnuplotKeyword size square nosquare ratio noratio " set style -syn keyword gnuplotKeyword style function data noborder rectangle arrow -syn keyword gnuplotKeyword default nohead head heads size filled empty -syn keyword gnuplotKeyword nofilled front back boxplot range fraction -syn keyword gnuplotKeyword outliers nooutliers pointtype candlesticks -syn keyword gnuplotKeyword separation labels off auto x x2 sorted unsorted -syn keyword gnuplotKeyword fill empty transparent solid pattern border -syn keyword gnuplotKeyword increment userstyles financebars line default -syn keyword gnuplotKeyword linetype lt linecolor lc linewidth lw pointtype -syn keyword gnuplotKeyword pt pointsize ps pointinterval pi palette circle -syn keyword gnuplotKeyword radius graph screen wedge nowedge ellipse size -syn keyword gnuplotKeyword units xx xy yy histogram line textbox opaque -syn keyword gnuplotKeyword border noborder +syn keyword gnuplotKeyword style arrow auto back border boxplot +syn keyword gnuplotKeyword candlesticks circle clustered columnstacked data +syn keyword gnuplotKeyword default ellipse empty fill[ed] financebars +syn keyword gnuplotKeyword fraction front function gap graph head[s] +syn keyword gnuplotKeyword histogram increment labels lc line linecolor +syn keyword gnuplotKeyword linetype linewidth lt lw noborder nofilled +syn keyword gnuplotKeyword nohead nooutliers nowedge off opaque outliers +syn keyword gnuplotKeyword palette pattern pi pointinterval pointsize +syn keyword gnuplotKeyword pointtype ps pt radius range rectangle +syn keyword gnuplotKeyword rowstacked screen separation size solid sorted +syn keyword gnuplotKeyword textbox transparent units unsorted userstyles +syn keyword gnuplotKeyword wedge x x2 xx xy yy " set surface syn keyword gnuplotKeyword surface implicit explicit " set table @@ -496,8 +497,8 @@ syn keyword gnuplotTodo contained TODO FIXME XXX syn keyword gnuplotStatement cd call clear evaluate exit fit help history syn keyword gnuplotStatement load lower pause plot p print pwd quit raise syn keyword gnuplotStatement refresh replot rep reread reset save set show -syn keyword gnuplotStatement shell splot spstats system test undefine unset -syn keyword gnuplotStatement update +syn keyword gnuplotStatement shell splot spstats stats system test undefine +syn keyword gnuplotStatement unset update " ---- Define the default highlighting ---- " " For version 5.7 and earlier: only when not done already diff --git a/runtime/syntax/groovy.vim b/runtime/syntax/groovy.vim index 65dbf17728..42fcf4abac 100644 --- a/runtime/syntax/groovy.vim +++ b/runtime/syntax/groovy.vim @@ -2,9 +2,9 @@ " Language: Groovy " Original Author: Alessio Pace <billy.corgan@tiscali.it> " Maintainer: Tobias Rapp <yahuxo@gmx.de> -" Version: 0.1.13 +" Version: 0.1.14 " URL: http://www.vim.org/scripts/script.php?script_id=945 -" Last Change: 2015 Apr 13 +" Last Change: 2015 Apr 21 " THE ORIGINAL AUTHOR'S NOTES: " diff --git a/runtime/syntax/hog.vim b/runtime/syntax/hog.vim index 7f01d7fc11..f37f7ae899 100644 --- a/runtime/syntax/hog.vim +++ b/runtime/syntax/hog.vim @@ -1,350 +1,200 @@ -" Snort syntax file -" Language: Snort Configuration File (see: http://www.snort.org) -" Maintainer: Phil Wood, cornett@arpa.net -" Last Change: $Date: 2004/06/13 17:41:17 $ -" Filenames: *.hog *.rules snort.conf vision.conf -" URL: http://home.lanl.gov/cpw/vim/syntax/hog.vim -" Snort Version: 1.8 By Martin Roesch (roesch@clark.net, www.snort.org) -" TODO include all 1.8 syntax - -" For version 5.x: Clear all syntax items +" Vim syntax file +" Language: hog (Snort.conf + .rules) +" Maintainer: Victor Roemer, <vroemer@badsec.org>. +" Last Change: 2015 Oct 24 -> Rename syntax items from Snort -> Hog +" 2012 Oct 24 -> Originalish release + if version < 600 - syntax clear + syntax clear elseif exists("b:current_syntax") -" For version 6.x: Quit when a syntax file was already loaded - finish + finish endif -syn match hogComment +\s\#[^\-:.%#=*].*$+lc=1 contains=hogTodo,hogCommentString -syn region hogCommentString contained oneline start='\S\s\+\#+'ms=s+1 end='\#' - -syn match hogJunk "\<\a\+|\s\+$" -syn match hogNumber contained "\<\d\+\>" -syn region hogText contained oneline start='\S' end=',' skipwhite -syn region hogTexts contained oneline start='\S' end=';' skipwhite - -" Environment Variables -" ===================== -"syn match hogEnvvar contained "[\!]\=\$\I\i*" -"syn match hogEnvvar contained "[\!]\=\${\I\i*}" -syn match hogEnvvar contained "\$\I\i*" -syn match hogEnvvar contained "[\!]\=\${\I\i*}" - - -" String handling lifted from vim.vim written by Dr. Charles E. Campbell, Jr. -" Try to catch strings, if nothing else matches (therefore it must precede the others!) -" vmEscapeBrace handles ["] []"] (ie. stays as string) -syn region hogEscapeBrace oneline contained transparent start="[^\\]\(\\\\\)*\[\^\=\]\=" skip="\\\\\|\\\]" end="\]"me=e-1 -syn match hogPatSep contained "\\[|()]" -syn match hogNotPatSep contained "\\\\" -syn region hogString oneline start=+[^:a-zA-Z\->!\\]"+hs=e+1 skip=+\\\\\|\\"+ end=+"\s*;+he=s-1 contains=hogEscapeBrace,hogPatSep,hogNotPatSep oneline -""syn region hogString oneline start=+[^:a-zA-Z>!\\]'+lc=1 skip=+\\\\\|\\'+ end=+'+ contains=hogEscapeBrace,vimPatSep,hogNotPatSep -"syn region hogString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=hogEscapeBrace,hogPatSep,hogNotPatSep -"syn region hogString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=hogEscapeBrace,hogPatSep,hogNotPatSep -"syn region hogString oneline start="[^\\]+\s*[^a-zA-Z0-9.]"lc=1 skip="\\\\\|\\+" end="+" contains=hogEscapeBrace,hogPatSep,hogNotPatSep -"syn region hogString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=hogEscapeBrace,hogPatSep,hogNotPatSep -"syn match hogString contained +"[^"]*\\$+ skipnl nextgroup=hogStringCont -"syn match hogStringCont contained +\(\\\\\|.\)\{-}[^\\]"+ - - -" Beginners - Patterns that involve ^ -" -syn match hogLineComment +^[ \t]*#.*$+ contains=hogTodo,hogCommentString,hogCommentTitle -syn match hogCommentTitle '#\s*\u\a*\(\s\+\u\a*\)*:'ms=s+1 contained -syn keyword hogTodo contained TODO - -" Rule keywords -syn match hogARPCOpt contained "\d\+,\*,\*" -syn match hogARPCOpt contained "\d\+,\d\+,\*" -syn match hogARPCOpt contained "\d\+,\*,\d\+" -syn match hogARPCOpt contained "\d\+,\d\+,\d" -syn match hogATAGOpt contained "session" -syn match hogATAGOpt contained "host" -syn match hogATAGOpt contained "dst" -syn match hogATAGOpt contained "src" -syn match hogATAGOpt contained "seconds" -syn match hogATAGOpt contained "packets" -syn match hogATAGOpt contained "bytes" -syn keyword hogARespOpt contained rst_snd rst_rcv rst_all skipwhite -syn keyword hogARespOpt contained icmp_net icmp_host icmp_port icmp_all skipwhite -syn keyword hogAReactOpt contained block warn msg skipwhite -syn match hogAReactOpt contained "proxy\d\+" skipwhite -syn keyword hogAFOpt contained logto content_list skipwhite -syn keyword hogAIPOptVal contained eol nop ts sec lsrr lsrre satid ssrr rr skipwhite -syn keyword hogARefGrps contained arachnids skipwhite -syn keyword hogARefGrps contained bugtraq skipwhite -syn keyword hogARefGrps contained cve skipwhite -syn keyword hogSessionVal contained printable all skipwhite -syn match hogAFlagOpt contained "[0FSRPAUfsrpau21]\+" skipwhite -syn match hogAFragOpt contained "[DRMdrm]\+" skipwhite -" -" Output syslog options -" Facilities -syn keyword hogSysFac contained LOG_AUTH LOG_AUTHPRIV LOG_DAEMON LOG_LOCAL0 -syn keyword hogSysFac contained LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 -syn keyword hogSysFac contained LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_USER -" Priorities -syn keyword hogSysPri contained LOG_EMERG ALERT LOG_CRIT LOG_ERR -syn keyword hogSysPri contained LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG -" Options -syn keyword hogSysOpt contained LOG_CONS LOG_NDELAY LOG_PERROR -syn keyword hogSysOpt contained LOG_PID -" RuleTypes -syn keyword hogRuleType contained log pass alert activate dynamic - -" Output log_database arguments and parameters -" Type of database followed by , -" syn keyword hogDBSQL contained mysql postgresql unixodbc -" Parameters param=constant -" are just various constants assigned to parameter names - -" Output log_database arguments and parameters -" Type of database followed by , -syn keyword hogDBType contained alert log -syn keyword hogDBSRV contained mysql postgresql unixodbc -" Parameters param=constant -" are just various constants assigned to parameter names -syn keyword hogDBParam contained dbname host port user password sensor_name - -" Output xml arguments and parameters -" xml args -syn keyword hogXMLArg contained log alert -syn keyword hogXMLParam contained file protocol host port cert key ca server sanitize encoding detail -" -" hog rule handler '(.*)' -syn region hogAOpt contained oneline start="rpc" end=":"me=e-1 nextgroup=hogARPCOptGrp skipwhite -syn region hogARPCOptGrp contained oneline start="."hs=s+1 end=";"me=e-1 contains=hogARPCOpt skipwhite - -syn region hogAOpt contained oneline start="tag" end=":"me=e-1 nextgroup=hogATAGOptGrp skipwhite -syn region hogATAGOptGrp contained oneline start="."hs=s+1 skip="," end=";"me=e-1 contains=hogATAGOpt,hogNumber skipwhite -" -syn region hogAOpt contained oneline start="nocase\|sameip" end=";"me=e-1 skipwhite oneline keepend -" -syn region hogAOpt contained start="resp" end=":"me=e-1 nextgroup=hogARespOpts skipwhite -syn region hogARespOpts contained oneline start="." end="[,;]" contains=hogARespOpt skipwhite nextgroup=hogARespOpts -" -syn region hogAOpt contained start="react" end=":"me=e-1 nextgroup=hogAReactOpts skipwhite -syn region hogAReactOpts contained oneline start="." end="[,;]" contains=hogAReactOpt skipwhite nextgroup=hogAReactOpts - -syn region hogAOpt contained oneline start="depth\|seq\|ttl\|ack\|icmp_seq\|activates\|activated_by\|dsize\|icode\|icmp_id\|count\|itype\|tos\|id\|offset" end=":"me=e-1 nextgroup=hogANOptGrp skipwhite -syn region hogANOptGrp contained oneline start="."hs=s+1 end=";"me=e-1 contains=hogNumber skipwhite oneline keepend - -syn region hogAOpt contained oneline start="classtype" end=":"me=e-1 nextgroup=hogAFileGrp skipwhite - -syn region hogAOpt contained oneline start="regex\|msg\|content" end=":"me=e-1 nextgroup=hogAStrGrp skipwhite -"syn region hogAStrGrp contained oneline start=+:\s*"+hs=s+1 skip="\\;" end=+"\s*;+he=s-1 contains=hogString skipwhite oneline keepend -syn region hogAStrGrp contained oneline start=+:\s*"\|:"+hs=s+1 skip="\\;" end=+"\s*;+he=s-1 contains=hogString skipwhite oneline keepend - -syn region hogAOpt contained oneline start="logto\|content-list" end=":"me=e-1 nextgroup=hogAFileGrp skipwhite -syn region hogAFileGrp contained oneline start="."hs=s+1 end=";"me=e-1 contains=hogFileName skipwhite - -syn region hogAOpt contained oneline start="reference" end=":"me=e-1 nextgroup=hogARefGrp skipwhite -syn region hogARefGrp contained oneline start="."hs=s+1 end=","me=e-1 contains=hogARefGrps nextgroup=hogARefName skipwhite -syn region hogARefName contained oneline start="."hs=s+1 end=";"me=e-1 contains=hogString,hogFileName,hogNumber skipwhite - -syn region hogAOpt contained oneline start="flags" end=":"he=s-1 nextgroup=hogAFlagOpt skipwhite oneline keepend - -syn region hogAOpt contained oneline start="fragbits" end=":"he=s-1 nextgroup=hogAFlagOpt skipwhite oneline keepend - -syn region hogAOpt contained oneline start="ipopts" end=":"he=s-1 nextgroup=hogAIPOptVal skipwhite oneline keepend - -"syn region hogAOpt contained oneline start="." end=":"he=s-1 contains=hogAFOpt nextgroup=hogFileName skipwhite - -syn region hogAOpt contained oneline start="session" end=":"he=s-1 nextgroup=hogSessionVal skipwhite - -syn match nothing "$" -syn region hogRules oneline contains=nothing start='$' end="$" -syn region hogRules oneline contains=hogRule start='('ms=s+1 end=")\s*$" skipwhite -syn region hogRule contained oneline start="." skip="\\;" end=";"he=s-1 contains=hogAOpts, skipwhite keepend -"syn region hogAOpts contained oneline start="." end="[;]"he=s-1 contains=hogAOpt skipwhite -syn region hogAOpts contained oneline start="." end="[;]"me=e-1 contains=hogAOpt skipwhite - - -" ruletype command -syn keyword hogRTypeStart skipwhite ruletype nextgroup=hogRuleName skipwhite -syn region hogRuleName contained start="." end="\s" contains=hogFileName nextgroup=hogRTypeRegion -" type ruletype sub type -syn region hogRtypeRegion contained start="{" end="}" nextgroup=hogRTypeStart -syn keyword hogRTypeStart skipwhite type nextgroup=hogRuleTypes skipwhite -syn region hogRuleTypes contained start="." end="\s" contains=hogRuleType nextgroup=hogOutStart - - -" var command -syn keyword hogVarStart skipwhite var nextgroup=hogVarIdent skipwhite -syn region hogVarIdent contained start="."hs=e+1 end="\s\+"he=s-1 contains=hogEnvvar nextgroup=hogVarRegion skipwhite -syn region hogVarRegion contained oneline start="." contains=hogIPaddr,hogEnvvar,hogNumber,hogString,hogFileName end="$"he=s-1 keepend skipwhite - -" config command -syn keyword hogConfigStart config skipwhite nextgroup=hogConfigType -syn match hogConfigType contained "\<classification\>" nextgroup=hogConfigTypeRegion skipwhite -syn region hogConfigTypeRegion contained oneline start=":"ms=s+1 end="$" contains=hogNumber,hogText keepend skipwhite - - -" include command -syn keyword hogIncStart include skipwhite nextgroup=hogIncRegion -syn region hogIncRegion contained oneline start="\>" contains=hogFileName,hogEnvvar end="$" keepend - -" preprocessor command -" http_decode, minfrag, portscan[-ignorehosts] -syn keyword hogPPrStart preprocessor skipwhite nextgroup=hogPPr -syn match hogPPr contained "\<spade\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-homenet\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-threshlearn\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-adapt\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-adapt2\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-adapt3\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<spade-survey\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<defrag\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<telnet_decode\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<rpc_decode\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<bo\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<stream\>" nextgroup=hogStreamRegion skipwhite -syn match hogPPr contained "\<stream2\>" nextgroup=hogStreamRegion skipwhite -syn match hogPPr contained "\<stream3\>" nextgroup=hogStreamRegion skipwhite -syn match hogPPr contained "\<http_decode\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<minfrag\>" nextgroup=hogPPrRegion skipwhite -syn match hogPPr contained "\<portscan[-ignorehosts]*\>" nextgroup=hogPPrRegion skipwhite -syn region hogPPrRegion contained oneline start="$" end="$" keepend -syn region hogPPrRegion contained oneline start=":" end="$" contains=hogNumber,hogIPaddr,hogEnvvar,hogFileName keepend -syn keyword hogStreamArgs contained timeout ports maxbytes -syn region hogStreamRegion contained oneline start=":" end="$" contains=hogStreamArgs,hogNumber - -" output command -syn keyword hogOutStart output nextgroup=hogOut skipwhite -" -" alert_syslog -syn match hogOut contained "\<alert_syslog\>" nextgroup=hogSyslogRegion skipwhite -syn region hogSyslogRegion contained start=":" end="$" contains=hogSysFac,hogSysPri,hogSysOpt,hogEnvvar oneline skipwhite keepend -" -" alert_fast (full,smb,unixsock, and tcpdump) -syn match hogOut contained "\<alert_fast\|alert_full\|alert_smb\|alert_unixsock\|log_tcpdump\>" nextgroup=hogLogFileRegion skipwhite -syn region hogLogFileRegion contained start=":" end="$" contains=hogFileName,hogEnvvar oneline skipwhite keepend -" -" database -syn match hogOut contained "\<database\>" nextgroup=hogDBTypes skipwhite -syn region hogDBTypes contained start=":" end="," contains=hogDBType,hogEnvvar nextgroup=hogDBSRVs skipwhite -syn region hogDBSRVs contained start="\s\+" end="," contains=hogDBSRV nextgroup=hogDBParams skipwhite -syn region hogDBParams contained start="." end="="me=e-1 contains=hogDBParam nextgroup=hogDBValues -syn region hogDBValues contained start="." end="\>" contains=hogNumber,hogEnvvar,hogAscii nextgroup=hogDBParams oneline skipwhite -syn match hogAscii contained "\<\a\+" -" -" log_tcpdump -syn match hogOut contained "\<log_tcpdump\>" nextgroup=hogLogRegion skipwhite -syn region hogLogRegion oneline start=":" skipwhite end="$" contains=hogEnvvar,hogFileName keepend -" -" xml -syn keyword hogXMLTrans contained http https tcp iap -syn match hogOut contained "\<xml\>" nextgroup=hogXMLRegion skipwhite -syn region hogXMLRegion contained start=":" end="," contains=hogXMLArg,hogEnvvar nextgroup=hogXMLParams skipwhite -"syn region hogXMLParams contained start="." end="="me=e-1 contains=hogXMLProto nextgroup=hogXMLProtos -"syn region hogXMLProtos contained start="." end="\>" contains=hogXMLTrans nextgroup=hogXMLParams -syn region hogXMLParams contained start="." end="="me=e-1 contains=hogXMLParam nextgroup=hogXMLValue -syn region hogXMLValue contained start="." end="\>" contains=hogNumber,hogIPaddr,hogEnvvar,hogAscii,hogFileName nextgroup=hogXMLParams oneline skipwhite keepend -" -" Filename -syn match hogFileName contained "[-./[:alnum:]_~]\+" -syn match hogFileName contained "[-./[:alnum:]_~]\+" -" IP address -syn match hogIPaddr "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\>" -syn match hogIPaddr "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/\d\{1,2}\>" - -syn keyword hogProto tcp TCP ICMP icmp udp UDP - -" hog alert address port pairs -" hog IPaddresses -syn match hogIPaddrAndPort contained "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\>" skipwhite nextgroup=hogPort -syn match hogIPaddrAndPort contained "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/\d\{1,2}\>" skipwhite nextgroup=hogPort -syn match hogIPaddrAndPort contained "\<any\>" skipwhite nextgroup=hogPort -syn match hogIPaddrAndPort contained "\$\I\i*" nextgroup=hogPort skipwhite -syn match hogIPaddrAndPort contained "\${\I\i*}" nextgroup=hogPort skipwhite -"syn match hogPort contained "[\!]\=[\:]\=\d\+L\=\>" skipwhite -syn match hogPort contained "[\:]\=\d\+\>" -syn match hogPort contained "[\!]\=\<any\>" skipwhite -syn match hogPort contained "[\!]\=\d\+L\=:\d\+L\=\>" skipwhite - -" action commands -syn keyword hog7Functions activate skipwhite nextgroup=hogActRegion -syn keyword hog7Functions dynamic skipwhite nextgroup=hogActRegion -syn keyword hogActStart alert skipwhite nextgroup=hogActRegion -syn keyword hogActStart log skipwhite nextgroup=hogActRegion -syn keyword hogActStart pass skipwhite nextgroup=hogActRegion - -syn region hogActRegion contained oneline start="tcp\|TCP\|udp\|UDP\|icmp\|ICMP" end="\s\+"me=s-1 nextgroup=hogActSource oneline keepend skipwhite -syn region hogActSource contained oneline contains=hogIPaddrAndPort start="\s\+"ms=e+1 end="->\|<>"me=e-2 oneline keepend skipwhite nextgroup=hogActDest -syn region hogActDest contained oneline contains=hogIPaddrAndPort start="->\|<>" end="$" oneline keepend -syn region hogActDest contained oneline contains=hogIPaddrAndPort start="->\|<>" end="("me=e-1 oneline keepend skipwhite nextgroup=hogRules - - -" ==================== -if version >= 508 || !exists("did_hog_syn_inits") - if version < 508 - let did_hog_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif -" The default methods for highlighting. Can be overridden later - HiLink hogComment Comment - HiLink hogLineComment Comment - HiLink hogAscii Constant - HiLink hogCommentString Constant - HiLink hogFileName Constant - HiLink hogIPaddr Constant - HiLink hogNotPatSep Constant - HiLink hogNumber Constant - HiLink hogText Constant - HiLink hogString Constant - HiLink hogSysFac Constant - HiLink hogSysOpt Constant - HiLink hogSysPri Constant -" HiLink hogAStrGrp Error - HiLink hogJunk Error - HiLink hogEnvvar Identifier - HiLink hogIPaddrAndPort Identifier - HiLink hogVarIdent Identifier - HiLink hogATAGOpt PreProc - HiLink hogAIPOptVal PreProc - HiLink hogARespOpt PreProc - HiLink hogAReactOpt PreProc - HiLink hogAFlagOpt PreProc - HiLink hogAFragOpt PreProc - HiLink hogCommentTitle PreProc - HiLink hogDBType PreProc - HiLink hogDBSRV PreProc - HiLink hogPort PreProc - HiLink hogARefGrps PreProc - HiLink hogSessionVal PreProc - HiLink hogXMLArg PreProc - HiLink hogARPCOpt PreProc - HiLink hogPatSep Special - HiLink hog7Functions Statement - HiLink hogActStart Statement - HiLink hogIncStart Statement - HiLink hogConfigStart Statement - HiLink hogOutStart Statement - HiLink hogPPrStart Statement - HiLink hogVarStart Statement - HiLink hogRTypeStart Statement - HiLink hogTodo Todo - HiLink hogRuleType Type - HiLink hogAFOpt Type - HiLink hogANoVal Type - HiLink hogAStrOpt Type - HiLink hogANOpt Type - HiLink hogAOpt Type - HiLink hogDBParam Type - HiLink hogStreamArgs Type - HiLink hogOut Type - HiLink hogPPr Type - HiLink hogConfigType Type - HiLink hogActRegion Type - HiLink hogProto Type - HiLink hogXMLParam Type - HiLink resp Todo - HiLink cLabel Label - delcommand HiLink +setlocal iskeyword-=: +setlocal iskeyword+=- +syn case ignore + +" Hog ruletype crap +syn keyword HogRuleType ruletype nextgroup=HogRuleTypeName skipwhite +syn match HogRuleTypeName "[[:alnum:]_]\+" contained nextgroup=HogRuleTypeBody skipwhite +syn region HogRuleTypeBody start="{" end="}" contained contains=HogRuleTypeType,HogOutput fold +syn keyword HogRuleTypeType type contained + +" Hog Configurables +syn keyword HogPreproc preprocessor nextgroup=HogConfigName skipwhite +syn keyword HogConfig config nextgroup=HogConfigName skipwhite +syn keyword HogOutput output nextgroup=HogConfigName skipwhite +syn match HogConfigName "[[:alnum:]_-]\+" contained nextgroup=HogConfigOpts skipwhite +syn region HogConfigOpts start=":" skip="\\.\{-}$\|^\s*#.\{-}$\|^\s*$" end="$" fold keepend contained contains=HogSpecial,HogNumber,HogIPAddr,HogVar,HogComment + +" Event filter's and threshold's +syn region HogEvFilter start="event_filter\|threshold" skip="\\.\{-}$\|^\s*#.\{-}$\|^\s*$" end="$" fold transparent keepend contains=HogEvFilterKeyword,HogEvFilterOptions,HogComment +syn keyword HogEvFilterKeyword skipwhite event_filter threshold +syn keyword HogEvFilterOptions skipwhite type nextgroup=HogEvFilterTypes +syn keyword HogEvFilterTypes skipwhite limit threshold both contained +syn keyword HogEvFilterOptions skipwhite track nextgroup=HogEvFilterTrack +syn keyword HogEvFilterTrack skipwhite by_src by_dst contained +syn keyword HogEvFilterOptions skipwhite gen_id sig_id count seconds nextgroup=HogNumber + +" Suppressions +syn region HogEvFilter start="suppress" skip="\\.\{-}$\|^\s*#.\{-}$\|^\s*$" end="$" fold transparent keepend contains=HogSuppressKeyword,HogComment +syn keyword HogSuppressKeyword skipwhite suppress +syn keyword HogSuppressOptions skipwhite gen_id sig_id nextgroup=HogNumber +syn keyword HogSuppressOptions skipwhite track nextgroup=HogEvFilterTrack +syn keyword HogSuppressOptions skipwhite ip nextgroup=HogIPAddr + +" Attribute table +syn keyword HogAttribute attribute_table nextgroup=HogAttributeFile +syn match HogAttributeFile contained ".*$" contains=HogVar,HogAttributeType,HogComment +syn keyword HogAttributeType filename + +" Hog includes +syn keyword HogInclude include nextgroup=HogIncludeFile skipwhite +syn match HogIncludeFile ".*$" contained contains=HogVar,HogComment + +" Hog dynamic libraries +syn keyword HogDylib dynamicpreprocessor dynamicengine dynamicdetection nextgroup=HogDylibFile skipwhite +syn match HogDylibFile "\s.*$" contained contains=HogVar,HogDylibType,HogComment +syn keyword HogDylibType directory file contained + +" Variable dereferenced with '$' +syn match HogVar "\$[[:alnum:]_]\+" + +", Variables declared with 'var' +syn keyword HogVarType var nextgroup=HogVarSet skipwhite +syn match HogVarSet "[[:alnum:]_]\+" display contained nextgroup=HogVarValue skipwhite +syn match HogVarValue ".*$" contained contains=HogString,HogNumber,HogVar,HogComment + +" Variables declared with 'ipvar' +syn keyword HogIPVarType ipvar nextgroup=HogIPVarSet skipwhite +syn match HogIPVarSet "[[:alnum:]_]\+" display contained nextgroup=HogIPVarList,HogSpecial skipwhite +syn region HogIPVarList start="\[" end="]" contains=HogIPVarList,HogIPAddr,HogVar,HogOpNot + +" Variables declared with 'portvar' +syn keyword HogPortVarType portvar nextgroup=HogPortVarSet skipwhite +syn match HogPortVarSet "[[:alnum:]_]\+" display contained nextgroup=HogPortVarList,HogPort,HogOpRange,HogOpNot,HogSpecial skipwhite +syn region HogPortVarList start="\[" end="]" contains=HogPortVarList,HogVar,HogOpNot,HogPort,HogOpRange,HogOpNot +syn match HogPort "\<\%(\d\+\|any\)\>" display contains=HogOpRange nextgroup=HogOpRange + +" Generic stuff +syn match HogIPAddr contained "\<\%(\d\{1,3}\(\.\d\{1,3}\)\{3}\|any\)\>" nextgroup=HogIPCidr +syn match HogIPAddr contained "\<\d\{1,3}\(\.\d\{1,3}\)\{3}\>" nextgroup=HogIPCidr +syn match HogIPCidr contained "\/\([0-2][0-9]\=\|3[0-2]\=\)" +syn region HogHexEsc contained start='|' end='|' oneline +syn region HogString contained start='"' end='"' extend oneline contains=HogHexEsc +syn match HogNumber contained display "\<\d\+\>" +syn match HogNumber contained display "\<\d\+\>" +syn match HogNumber contained display "0x\x\+\>" +syn keyword HogSpecial contained true false yes no default all any +syn keyword HogSpecialAny contained any +syn match HogOpNot "!" contained +syn match HogOpRange ":" contained + +" Rules +syn keyword HogRuleAction activate alert drop block dynamic log pass reject sdrop sblock skipwhite nextgroup=HogRuleProto,HogRuleBlock +syn keyword HogRuleProto ip tcp udp icmp skipwhite contained nextgroup=HogRuleSrcIP +syn match HogRuleSrcIP "\S\+" transparent skipwhite contained contains=HogIPVarList,HogIPAddr,HogVar,HogOpNot nextgroup=HogRuleSrcPort +syn match HogRuleSrcPort "\S\+" transparent skipwhite contained contains=HogPortVarList,HogVar,HogPort,HogOpRange,HogOpNot nextgroup=HogRuleDir +syn match HogRuleDir "->\|<>" skipwhite contained nextgroup=HogRuleDstIP +syn match HogRuleDstIP "\S\+" transparent skipwhite contained contains=HogIPVarList,HogIPAddr,HogVar,HogOpNot nextgroup=HogRuleDstPort +syn match HogRuleDstPort "\S\+" transparent skipwhite contained contains=HogPortVarList,HogVar,HogPort,HogOpRange,HogOpNot nextgroup=HogRuleBlock +syn region HogRuleBlock start="(" end=")" transparent skipwhite contained contains=HogRuleOption,HogComment fold +",HogString,HogComment,HogVar,HogOptNot +"syn region HogRuleOption start="\<gid\|sid\|rev\|depth\|offset\|distance\|within\>" end="\ze;" skipwhite contained contains=HogNumber +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP msg gid sid rev classtype priority metadata content nocase rawbytes +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP depth offset distance within http_client_body http_cookie http_raw_cookie http_header +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP http_raw_header http_method http_uri http_raw_uri http_stat_code http_stat_msg +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP fast_pattern uricontent urilen isdataat pcre pkt_data file_data base64_decode base64_data +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP byte_test byte_jump byte_extract ftpbounce asn1 cvs dce_iface dce_opnum dce_stub_data +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP sip_method sip_stat_code sip_header sip_body gtp_type gtp_info gtp_version ssl_version +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP ssl_state fragoffset ttl tos id ipopts fragbits dsize flags flow flowbits seq ack window +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP itype icode icmp_id icmp_seq rpc ip_proto sameip stream_reassemble stream_size +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP logto session resp react tag activates activated_by count replace detection_filter +syn keyword HogRuleOption skipwhite contained nextgroup=HogRuleSROP threshold reference sd_pattern file_type file_group + +syn region HogRuleSROP start=':' end=";" transparent keepend contained contains=HogRuleChars,HogString,HogNumber +syn match HogRuleChars "\%(\k\|\.\|?\|=\|/\|%\|&\)\+" contained +syn match HogURLChars "\%(\.\|?\|=\)\+" contained + +" Hog File Type Rules +syn match HogFileType /^\s*file.*$/ transparent contains=HogFileTypeOpt,HogFileFROP +syn keyword HogFileTypeOpt skipwhite contained nextgroup=HogRuleFROP file type ver category id rev content offset msg group +syn region HogFileFROP start=':' end=";" transparent keepend contained contains=NotASemicoln +syn match NotASemiColn ".*$" contained + + +" Comments +syn keyword HogTodo XXX TODO NOTE contained +syn match HogTodo "Step\s\+#\=\d\+" contained +syn region HogComment start="#" end="$" contains=HogTodo,@Spell + +syn case match + +if !exists("hog_minlines") + let hog_minlines = 100 endif +exec "syn sync minlines=" . hog_minlines + +hi link HogRuleType Statement +hi link HogRuleTypeName Type +hi link HogRuleTypeType Keyword + +hi link HogPreproc Statement +hi link HogConfig Statement +hi link HogOutput Statement +hi link HogConfigName Type + +"hi link HogEvFilter +hi link HogEvFilterKeyword Statement +hi link HogSuppressKeyword Statement +hi link HogEvFilterTypes Constant +hi link HogEvFilterTrack Constant + +hi link HogAttribute Statement +hi link HogAttributeFile String +hi link HogAttributeType Statement + +hi link HogInclude Statement +hi link HogIncludeFile String + +hi link HogDylib Statement +hi link HogDylibType Statement +hi link HogDylibFile String + +" Variables +" var +hi link HogVar Identifier +hi link HogVarType Keyword +hi link HogVarSet Identifier +hi link HogVarValue String +" ipvar +hi link HogIPVarType Keyword +hi link HogIPVarSet Identifier +" portvar +hi link HogPortVarType Keyword +hi link HogPortVarSet Identifier +hi link HogPort Constant + +hi link HogTodo Todo +hi link HogComment Comment +hi link HogString String +hi link HogHexEsc PreProc +hi link HogNumber Number +hi link HogSpecial Constant +hi link HogSpecialAny Constant +hi link HogIPAddr Constant +hi link HogIPCidr Constant +hi link HogOpNot Operator +hi link HogOpRange Operator + +hi link HogRuleAction Statement +hi link HogRuleProto Identifier +hi link HogRuleDir Operator +hi link HogRuleOption Keyword +hi link HogRuleChars String + +hi link HogFileType HogRuleAction +hi link HogFileTypeOpt HogRuleOption +hi link NotASemiColn HogRuleChars let b:current_syntax = "hog" - -" hog: cpw=59 diff --git a/runtime/syntax/man.vim b/runtime/syntax/man.vim index 4172a02fe1..fbc1847e6e 100644 --- a/runtime/syntax/man.vim +++ b/runtime/syntax/man.vim @@ -3,7 +3,7 @@ " Maintainer: SungHyun Nam <goweol@gmail.com> " Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com> " Version Info: -" Last Change: 2008 Sep 17 +" Last Change: 2015 Nov 24 " Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>: " * manSubHeading @@ -27,8 +27,8 @@ endif syn case ignore syn match manReference "\f\+([1-9][a-z]\=)" syn match manTitle "^\f\+([0-9]\+[a-z]\=).*" -syn match manSectionHeading "^[a-z][a-z ]*[a-z]$" -syn match manSubHeading "^\s\{3\}[a-z][a-z ]*[a-z]$" +syn match manSectionHeading "^[a-z][a-z -]*[a-z]$" +syn match manSubHeading "^\s\{3\}[a-z][a-z -]*[a-z]$" syn match manOptionDesc "^\s*[+-][a-z0-9]\S*" syn match manLongOptionDesc "^\s*--[a-z0-9-]\S*" " syn match manHistory "^[a-z].*last change.*$" diff --git a/runtime/syntax/manual.vim b/runtime/syntax/manual.vim index 5ea373180a..c0e53fa7b4 100644 --- a/runtime/syntax/manual.vim +++ b/runtime/syntax/manual.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2008 Jan 26 +" Last Change: 2016 Feb 01 " This file is used for ":syntax manual". " It installs the Syntax autocommands, but no the FileType autocommands. @@ -16,10 +16,11 @@ endif let syntax_manual = 1 -" Remove the connection between FileType and Syntax autocommands. -if exists('#syntaxset') - au! syntaxset FileType -endif +" Overrule the connection between FileType and Syntax autocommands. This sets +" the syntax when the file type is detected, without changing the value. +augroup syntaxset + au! FileType * exe "set syntax=" . &syntax +augroup END " If the GUI is already running, may still need to install the FileType menu. " Don't do it when the 'M' flag is included in 'guioptions'. diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim index 980fe5dde5..718cee1429 100644 --- a/runtime/syntax/netrw.vim +++ b/runtime/syntax/netrw.vim @@ -19,7 +19,6 @@ syn cluster NetrwTreeGroup contains=netrwDir,netrwSymLink,netrwExe syn match netrwPlain "\(\S\+ \)*\S\+" contains=netrwLink,@NoSpell syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell syn match netrwDir "\.\{1,2}/" contains=netrwClassify,@NoSpell -"syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify,@NoSpell syn match netrwDir "\%(\S\+ \)*\S\+/\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" skipwhite contains=netrwDateSep,@NoSpell nextgroup=netrwTime syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell diff --git a/runtime/syntax/objc.vim b/runtime/syntax/objc.vim index 1f61e50b8d..9d7b20ecd0 100644 --- a/runtime/syntax/objc.vim +++ b/runtime/syntax/objc.vim @@ -1,8 +1,7 @@ " Vim syntax file " Language: Objective-C -" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com> -" Last Change: 2013 Jun 13 -" Remark: Modern Objective-C Edition +" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@gmail.com> +" Last Change: 2015 Dec 14 """ Preparation for loading ObjC stuff if exists("b:current_syntax") @@ -25,14 +24,14 @@ syn keyword objcUsefulTerm nil Nil NO YES " Preprocessor Directives syn region objcImported display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn match objcImported display contained "<[^>]*>" +syn match objcImported display contained "\(<\h[-a-zA-Z0-9_/]*\.h>\|<[a-z0-9]\+>\)" syn match objcImport display "^\s*\(%:\|#\)\s*import\>\s*["<]" contains=objcImported " ObjC Compiler Directives syn match objcObjDef display /@interface\>\|@implementation\>\|@end\>\|@class\>/ syn match objcProtocol display /@protocol\>\|@optional\>\|@required\>/ syn match objcProperty display /@property\>\|@synthesize\>\|@dynamic\>/ -syn match objcIvarScope display /@private\>\|@protected\>\|@public\>/ +syn match objcIvarScope display /@private\>\|@protected\>\|@public\>\|@package\>/ syn match objcInternalRep display /@selector\>\|@encode\>/ syn match objcException display /@try\>\|@throw\>\|@catch\|@finally\>/ syn match objcThread display /@synchronized\>/ @@ -56,6 +55,17 @@ syn keyword objcTollFreeBridgeQualifier __bridge __bridge_retained __bridge_tran " ObjC Type Qualifiers for Remote Messaging syn match objcRemoteMessagingQualifier display contained /\((\s*oneway\s\+\|(\s*in\s\+\|(\s*out\s\+\|(\s*inout\s\+\|(\s*bycopy\s\+\(in\(out\)\?\|out\)\?\|(\s*byref\s\+\(in\(out\)\?\|out\)\?\)/hs=s+1 +" ObjC Storage Classes +syn keyword objcStorageClass _Nullable _Nonnull _Null_unspecified +syn keyword objcStorageClass __nullable __nonnull __null_unspecified +syn keyword objcStorageClass nullable nonnull null_unspecified + +" ObjC type specifier +syn keyword objcTypeSpecifier __kindof __covariant + +" ObjC Type Infomation Parameters +syn keyword objcTypeInfoParams ObjectType KeyType + " shorthand syn cluster objcTypeQualifier contains=objcBlocksQualifier,objcObjectLifetimeQualifier,objcTollFreeBridgeQualifier,objcRemoteMessagingQualifier @@ -75,17 +85,24 @@ syn keyword objcDeclPropAccessorType readonly readwrite contained syn keyword objcDeclPropAssignSemantics assign retain copy contained syn keyword objcDeclPropAtomicity nonatomic contained syn keyword objcDeclPropARC strong weak contained -syn region objcDeclProp display transparent keepend start=/@property\s*(/ end=/)/ contains=objcProperty,objcDeclPropAccessorName,objcDeclPropAccessorType,objcDeclPropAssignSemantics,objcDeclPropAtomicity,objcDeclPropARC +syn match objcDeclPropNullable /\((\|\s\)nullable\(,\|)\)/ms=s+1,hs=s+1,me=e-1,he=e-1 contained +syn match objcDeclPropNonnull /\((\|\s\)nonnull\(,\|)\)/ms=s+1,hs=s+1,me=e-1,he=e-1 contained +syn match objcDeclPropNullUnspecified /\((\|\s\)null_unspecified\(,\|)\)/ms=s+1,hs=s+1,me=e-1,he=e-1 contained +syn keyword objcDeclProcNullResettable null_resettable contained +syn region objcDeclProp display transparent keepend start=/@property\s*(/ end=/)/ contains=objcProperty,objcDeclPropAccessorName,objcDeclPropAccessorType,objcDeclPropAssignSemantics,objcDeclPropAtomicity,objcDeclPropARC,objcDeclPropNullable,objcDeclPropNonnull,objcDeclPropNullUnspecified,objcDeclProcNullResettable " To distinguish colons in methods and dictionaries from those in C's labels. syn match objcColon display /^\s*\h\w*\s*\:\(\s\|.\)/me=e-1,he=e-1 " To distinguish a protocol list from system header files -syn match objcProtocolList display /<\h\w*\(\s*,\s*\h\w*\)*>/ contains=objcPrincipalType,cType,Type +syn match objcProtocolList display /<\h\w*\(\s*,\s*\h\w*\)*>/ contains=objcPrincipalType,cType,Type,objcType,objcTypeInfoParams + +" Type info for collection classes +syn match objcTypeInfo display /<\h\w*\s*<\(\h\w*\s*\**\|\h\w*\)>>/ contains=objcPrincipalType,cType,Type,objcType,objcTypeInfoParams " shorthand syn cluster objcCEntities contains=cType,cStructure,cStorageClass,cString,cCharacter,cSpecialCharacter,cNumbers,cConstant,cOperator,cComment,cCommentL,cStatement,cLabel,cConditional,cRepeat -syn cluster objcObjCEntities contains=objcHiddenArgument,objcPrincipalType,objcString,objcUsefulTerm,objcProtocol,objcInternalRep,objcException,objcThread,objcPool,objcModuleImport,@objcTypeQualifier,objcLiteralSyntaxNumber,objcLiteralSyntaxOp,objcLiteralSyntaxChar,objcLiteralSyntaxSpecialChar,objcProtocolList,objcColon,objcFastEnumKeyword,objcType,objcClass,objcMacro,objcEnum,objcEnumValue,objcExceptionValue,objcNotificationValue,objcConstVar,objcPreProcMacro +syn cluster objcObjCEntities contains=objcHiddenArgument,objcPrincipalType,objcString,objcUsefulTerm,objcProtocol,objcInternalRep,objcException,objcThread,objcPool,objcModuleImport,@objcTypeQualifier,objcLiteralSyntaxNumber,objcLiteralSyntaxOp,objcLiteralSyntaxChar,objcLiteralSyntaxSpecialChar,objcProtocolList,objcColon,objcFastEnumKeyword,objcType,objcClass,objcMacro,objcEnum,objcEnumValue,objcExceptionValue,objcNotificationValue,objcConstVar,objcPreProcMacro,objcTypeInfo " Objective-C Message Expressions syn region objcMethodCall start=/\[/ end=/\]/ contains=objcMethodCall,objcBlocks,@objcObjCEntities,@objcCEntities @@ -114,13 +131,17 @@ syn keyword objcEnum NSSortOptions syn keyword objcEnumValue NSSortConcurrent NSSortStable syn keyword objcEnumValue NSNotFound syn keyword objcMacro NSIntegerMax NSIntegerMin NSUIntegerMax +syn keyword objcMacro NS_INLINE NS_BLOCKS_AVAILABLE NS_NONATOMIC_IOSONLY NS_FORMAT_FUNCTION NS_FORMAT_ARGUMENT NS_RETURNS_RETAINED NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_AUTOMATED_REFCOUNT_UNAVAILABLE NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE NS_REQUIRES_PROPERTY_DEFINITIONS NS_REPLACES_RECEIVER NS_RELEASES_ARGUMENT NS_VALID_UNTIL_END_OF_SCOPE NS_ROOT_CLASS NS_REQUIRES_SUPER NS_PROTOCOL_REQUIRES_EXPLICIT_IMPLEMENTATION NS_DESIGNATED_INITIALIZER NS_REQUIRES_NIL_TERMINATION +syn keyword objcEnum NSQualityOfService +syn keyword objcEnumValue NSQualityOfServiceUserInteractive NSQualityOfServiceUserInitiated NSQualityOfServiceUtility NSQualityOfServiceBackground NSQualityOfServiceDefault " NSRange.h syn keyword objcType NSRange NSRangePointer " NSGeometry.h -syn keyword objcType NSPoint NSPointPointer NSPointArray NSSize NSSizePointer NSSizeArray NSRect NSRectPointer NSRectArray +syn keyword objcType NSPoint NSPointPointer NSPointArray NSSize NSSizePointer NSSizeArray NSRect NSRectPointer NSRectArray NSEdgeInsets syn keyword objcEnum NSRectEdge syn keyword objcEnumValue NSMinXEdge NSMinYEdge NSMaxXEdge NSMaxYEdge -syn keyword objcConstVar NSZeroPoint NSZeroSize NSZeroRect +syn keyword objcEnumValue NSRectEdgeMinX NSRectEdgeMinY NSRectEdgeMaxX NSRectEdgeMaxY +syn keyword objcConstVar NSZeroPoint NSZeroSize NSZeroRect NSEdgeInsetsZero syn keyword cType CGFloat CGPoint CGSize CGRect syn keyword objcEnum NSAlignmentOptions syn keyword objcEnumValue NSAlignMinXInward NSAlignMinYInward NSAlignMaxXInward NSAlignMaxYInward NSAlignWidthInward NSAlignHeightInward NSAlignMinXOutward NSAlignMinYOutward NSAlignMaxXOutward NSAlignMaxYOutward NSAlignWidthOutward NSAlignHeightOutward NSAlignMinXNearest NSAlignMinYNearest NSAlignMaxXNearest NSAlignMaxYNearest NSAlignWidthNearest NSAlignHeightNearest NSAlignRectFlipped NSAlignAllEdgesInward NSAlignAllEdgesOutward NSAlignAllEdgesNearest @@ -130,6 +151,7 @@ syn keyword objcEnum NSRoundingMode syn keyword objcEnumValue NSRoundPlain NSRoundDown NSRoundUp NSRoundBankers syn keyword objcEnum NSCalculationError syn keyword objcEnumValue NSCalculationNoError NSCalculationLossOfPrecision NSCalculationUnderflow NSCalculationOverflow NSCalculationDivideByZero +syn keyword objcConstVar NSDecimalMaxSize NSDecimalNoScale " NSDate.h syn match objcClass /NSDate\s*\*/me=s+6,he=s+6 syn keyword objcType NSTimeInterval @@ -137,11 +159,13 @@ syn keyword objcNotificationValue NSSystemClockDidChangeNotification syn keyword objcMacro NSTimeIntervalSince1970 " NSZone.h syn match objcType /NSZone\s*\*/me=s+6,he=s+6 +syn keyword objcEnumValue NSScannedOption NSCollectorDisabledOption " NSError.h syn match objcClass /NSError\s*\*/me=s+7,he=s+7 syn keyword objcConstVar NSCocoaErrorDomain NSPOSIXErrorDomain NSOSStatusErrorDomain NSMachErrorDomain NSUnderlyingErrorKey NSLocalizedDescriptionKey NSLocalizedFailureReasonErrorKey NSLocalizedRecoverySuggestionErrorKey NSLocalizedRecoveryOptionsErrorKey NSRecoveryAttempterErrorKey NSHelpAnchorErrorKey NSStringEncodingErrorKey NSURLErrorKey NSFilePathErrorKey " NSException.h syn match objcClass /NSException\s*\*/me=s+11,he=s+11 +syn match objcClass /NSAssertionHandler\s*\*/me=s+18,he=s+18 syn keyword objcType NSUncaughtExceptionHandler syn keyword objcConstVar NSGenericException NSRangeException NSInvalidArgumentException NSInternalInconsistencyException NSMallocException NSObjectInaccessibleException NSObjectNotAvailableException NSDestinationInvalidException NSPortTimeoutException NSInvalidSendPortException NSInvalidReceivePortException NSPortSendException NSPortReceiveException NSOldStyleException " NSNotification.h @@ -153,6 +177,8 @@ syn keyword objcConstVar NSLocalNotificationCenterType syn keyword objcEnum NSNotificationSuspensionBehavior syn keyword objcEnumValue NSNotificationSuspensionBehaviorDrop NSNotificationSuspensionBehaviorCoalesce NSNotificationSuspensionBehaviorHold NSNotificationSuspensionBehaviorHold NSNotificationSuspensionBehaviorDeliverImmediately syn keyword objcEnumValue NSNotificationDeliverImmediately NSNotificationPostToAllSessions +syn keyword objcEnum NSDistributedNotificationOptions +syn keyword objcEnumValue NSDistributedNotificationDeliverImmediately NSDistributedNotificationPostToAllSessions " NSNotificationQueue.h syn match objcClass /NSNotificationQueue\s*\*/me=s+19,he=s+19 syn keyword objcEnum NSPostingStyle @@ -161,11 +187,15 @@ syn keyword objcEnum NSNotificationCoalescing syn keyword objcEnumValue NSNotificationNoCoalescing NSNotificationCoalescingOnName NSNotificationCoalescingOnSender " NSEnumerator.h syn match objcClass /NSEnumerator\s*\*/me=s+12,he=s+12 +syn match objcClass /NSEnumerator<.*>\s*\*/me=s+12,he=s+12 contains=objcTypeInfoParams +syn keyword objcType NSFastEnumerationState " NSIndexSet.h syn match objcClass /NSIndexSet\s*\*/me=s+10,he=s+10 syn match objcClass /NSMutableIndexSet\s*\*/me=s+17,he=s+17 " NSCharecterSet.h syn match objcClass /NSCharacterSet\s*\*/me=s+14,he=s+14 +syn match objcClass /NSMutableCharacterSet\s*\*/me=s+21,he=s+21 +syn keyword objcConstVar NSOpenStepUnicodeReservedBase " NSURL.h syn match objcClass /NSURL\s*\*/me=s+5,he=s+5 syn keyword objcEnum NSURLBookmarkCreationOptions @@ -174,11 +204,11 @@ syn keyword objcEnum NSURLBookmarkResolutionOptions syn keyword objcEnumValue NSURLBookmarkResolutionWithoutUI NSURLBookmarkResolutionWithoutMounting NSURLBookmarkResolutionWithSecurityScope syn keyword objcType NSURLBookmarkFileCreationOptions syn keyword objcConstVar NSURLFileScheme NSURLKeysOfUnsetValuesKey -syn keyword objcConstVar NSURLNameKey NSURLLocalizedNameKey NSURLIsRegularFileKey NSURLIsDirectoryKey NSURLIsSymbolicLinkKey NSURLIsVolumeKey NSURLIsPackageKey NSURLIsSystemImmutableKey NSURLIsUserImmutableKey NSURLIsHiddenKey NSURLHasHiddenExtensionKey NSURLCreationDateKey NSURLContentAccessDateKey NSURLContentModificationDateKey NSURLAttributeModificationDateKey NSURLLinkCountKey NSURLParentDirectoryURLKey NSURLVolumeURLKey NSURLTypeIdentifierKey NSURLLocalizedTypeDescriptionKey NSURLLabelNumberKey NSURLLabelColorKey NSURLLocalizedLabelKey NSURLEffectiveIconKey NSURLCustomIconKey NSURLFileResourceIdentifierKey NSURLVolumeIdentifierKey NSURLPreferredIOBlockSizeKey NSURLIsReadableKey NSURLIsWritableKey NSURLIsExecutableKey NSURLFileSecurityKey NSURLIsExcludedFromBackupKey NSURLPathKey NSURLIsMountTriggerKey NSURLFileResourceTypeKey -syn keyword objcConstVar NSURLFileResourceTypeNamedPipe NSURLFileResourceTypeCharacterSpecial NSURLFileResourceTypeDirectory NSURLFileResourceTypeBlockSpecial NSURLFileResourceTypeRegular NSURLFileResourceTypeSymbolicLink NSURLFileResourceTypeSocket NSURLFileResourceTypeUnknown -syn keyword objcConstVar NSURLFileSizeKey NSURLFileAllocatedSizeKey NSURLTotalFileSizeKey NSURLTotalFileAllocatedSizeKey NSURLIsAliasFileKey +syn keyword objcConstVar NSURLNameKey NSURLLocalizedNameKey NSURLIsRegularFileKey NSURLIsDirectoryKey NSURLIsSymbolicLinkKey NSURLIsVolumeKey NSURLIsPackageKey NSURLIsApplicationKey NSURLApplicationIsScriptableKey NSURLIsSystemImmutableKey NSURLIsUserImmutableKey NSURLIsHiddenKey NSURLHasHiddenExtensionKey NSURLCreationDateKey NSURLContentAccessDateKey NSURLContentModificationDateKey NSURLAttributeModificationDateKey NSURLLinkCountKey NSURLParentDirectoryURLKey NSURLVolumeURLKey NSURLTypeIdentifierKey NSURLLocalizedTypeDescriptionKey NSURLLabelNumberKey NSURLLabelColorKey NSURLLocalizedLabelKey NSURLEffectiveIconKey NSURLCustomIconKey NSURLFileResourceIdentifierKey NSURLVolumeIdentifierKey NSURLPreferredIOBlockSizeKey NSURLIsReadableKey NSURLIsWritableKey NSURLIsExecutableKey NSURLFileSecurityKey NSURLIsExcludedFromBackupKey NSURLTagNamesKey NSURLPathKey NSURLIsMountTriggerKey NSURLGenerationIdentifierKey NSURLDocumentIdentifierKey NSURLAddedToDirectoryDateKey NSURLQuarantinePropertiesKey NSURLFileResourceTypeKey +syn keyword objcConstVar NSURLFileResourceTypeNamedPipe NSURLFileResourceTypeCharacterSpecial NSURLFileResourceTypeDirectory NSURLFileResourceTypeBlockSpecial NSURLFileResourceTypeRegular NSURLFileResourceTypeSymbolicLink NSURLFileResourceTypeSocket NSURLFileResourceTypeUnknown NSURLThumbnailDictionaryKey NSURLThumbnailKey NSThumbnail1024x1024SizeKey +syn keyword objcConstVar NSURLFileSizeKey NSURLFileAllocatedSizeKey NSURLTotalFileSizeKey NSURLTotalFileAllocatedSizeKey NSURLIsAliasFileKey NSURLFileProtectionKey NSURLFileProtectionNone NSURLFileProtectionComplete NSURLFileProtectionCompleteUnlessOpen NSURLFileProtectionCompleteUntilFirstUserAuthentication syn keyword objcConstVar NSURLVolumeLocalizedFormatDescriptionKey NSURLVolumeTotalCapacityKey NSURLVolumeAvailableCapacityKey NSURLVolumeResourceCountKey NSURLVolumeSupportsPersistentIDsKey NSURLVolumeSupportsSymbolicLinksKey NSURLVolumeSupportsHardLinksKey NSURLVolumeSupportsJournalingKey NSURLVolumeIsJournalingKey NSURLVolumeSupportsSparseFilesKey NSURLVolumeSupportsZeroRunsKey NSURLVolumeSupportsCaseSensitiveNamesKey NSURLVolumeSupportsCasePreservedNamesKey NSURLVolumeSupportsRootDirectoryDatesKey NSURLVolumeSupportsVolumeSizesKey NSURLVolumeSupportsRenamingKey NSURLVolumeSupportsAdvisoryFileLockingKey NSURLVolumeSupportsExtendedSecurityKey NSURLVolumeIsBrowsableKey NSURLVolumeMaximumFileSizeKey NSURLVolumeIsEjectableKey NSURLVolumeIsRemovableKey NSURLVolumeIsInternalKey NSURLVolumeIsAutomountedKey NSURLVolumeIsLocalKey NSURLVolumeIsReadOnlyKey NSURLVolumeCreationDateKey NSURLVolumeURLForRemountingKey NSURLVolumeUUIDStringKey NSURLVolumeNameKey NSURLVolumeLocalizedNameKey -syn keyword objcConstVar NSURLIsUbiquitousItemKey NSURLUbiquitousItemHasUnresolvedConflictsKey NSURLUbiquitousItemIsDownloadedKey NSURLUbiquitousItemIsDownloadingKey NSURLUbiquitousItemIsUploadedKey NSURLUbiquitousItemIsUploadingKey NSURLUbiquitousItemPercentDownloadedKey NSURLUbiquitousItemPercentUploadedKey +syn keyword objcConstVar NSURLIsUbiquitousItemKey NSURLUbiquitousItemHasUnresolvedConflictsKey NSURLUbiquitousItemIsDownloadedKey NSURLUbiquitousItemIsDownloadingKey NSURLUbiquitousItemIsUploadedKey NSURLUbiquitousItemIsUploadingKey NSURLUbiquitousItemPercentDownloadedKey NSURLUbiquitousItemPercentUploadedKey NSURLUbiquitousItemDownloadingStatusKey NSURLUbiquitousItemDownloadingErrorKey NSURLUbiquitousItemUploadingErrorKey NSURLUbiquitousItemDownloadRequestedKey NSURLUbiquitousItemContainerDisplayNameKey NSURLUbiquitousItemDownloadingStatusNotDownloaded NSURLUbiquitousItemDownloadingStatusDownloaded NSURLUbiquitousItemDownloadingStatusCurrent """""""""""" " NSString.h syn match objcClass /NSString\s*\*/me=s+8,he=s+8 @@ -189,11 +219,14 @@ syn keyword objcMacro NSMaximumStringLength syn keyword objcEnum NSStringCompareOptions syn keyword objcEnumValue NSCaseInsensitiveSearch NSLiteralSearch NSBackwardsSearch NSAnchoredSearch NSNumericSearch NSDiacriticInsensitiveSearch NSWidthInsensitiveSearch NSForcedOrderingSearch NSRegularExpressionSearch syn keyword objcEnum NSStringEncoding +syn keyword objcEnumValue NSProprietaryStringEncoding syn keyword objcEnumValue NSASCIIStringEncoding NSNEXTSTEPStringEncoding NSJapaneseEUCStringEncoding NSUTF8StringEncoding NSISOLatin1StringEncoding NSSymbolStringEncoding NSNonLossyASCIIStringEncoding NSShiftJISStringEncoding NSISOLatin2StringEncoding NSUnicodeStringEncoding NSWindowsCP1251StringEncoding NSWindowsCP1252StringEncoding NSWindowsCP1253StringEncoding NSWindowsCP1254StringEncoding NSWindowsCP1250StringEncoding NSISO2022JPStringEncoding NSMacOSRomanStringEncoding NSUTF16StringEncoding NSUTF16BigEndianStringEncoding NSUTF16LittleEndianStringEncoding NSUTF32StringEncoding NSUTF32BigEndianStringEncoding NSUTF32LittleEndianStringEncoding syn keyword objcEnum NSStringEncodingConversionOptions syn keyword objcEnumValue NSStringEncodingConversionAllowLossy NSStringEncodingConversionExternalRepresentation syn keyword objcEnum NSStringEnumerationOptions syn keyword objcEnumValue NSStringEnumerationByLines NSStringEnumerationByParagraphs NSStringEnumerationByComposedCharacterSequences NSStringEnumerationByWords NSStringEnumerationBySentences NSStringEnumerationReverse NSStringEnumerationSubstringNotRequired NSStringEnumerationLocalized +syn keyword objcConstVar NSStringTransformLatinToKatakana NSStringTransformLatinToHiragana NSStringTransformLatinToHangul NSStringTransformLatinToArabic NSStringTransformLatinToHebrew NSStringTransformLatinToThai NSStringTransformLatinToCyrillic NSStringTransformLatinToGreek NSStringTransformToLatin NSStringTransformMandarinToLatin NSStringTransformHiraganaToKatakana NSStringTransformFullwidthToHalfwidth NSStringTransformToXMLHex NSStringTransformToUnicodeName NSStringTransformStripCombiningMarks NSStringTransformStripDiacritics +syn keyword objcConstVar NSStringEncodingDetectionSuggestedEncodingsKey NSStringEncodingDetectionDisallowedEncodingsKey NSStringEncodingDetectionUseOnlySuggestedEncodingsKey NSStringEncodingDetectionAllowLossyKey NSStringEncodingDetectionFromWindowsKey NSStringEncodingDetectionLossySubstitutionKey NSStringEncodingDetectionLikelyLanguageKey " NSAttributedString.h syn match objcClass /NSAttributedString\s*\*/me=s+18,he=s+18 syn match objcClass /NSMutableAttributedString\s*\*/me=s+25,he=s+25 @@ -215,21 +248,32 @@ syn keyword objcEnum NSDataWritingOptions syn keyword objcEnumValue NSDataWritingAtomic NSDataWritingWithoutOverwriting NSDataWritingFileProtectionNone NSDataWritingFileProtectionComplete NSDataWritingFileProtectionCompleteUnlessOpen NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication NSDataWritingFileProtectionMask NSAtomicWrite syn keyword objcEnum NSDataSearchOptions syn keyword objcEnumValue NSDataSearchBackwards NSDataSearchAnchored +syn keyword objcEnum NSDataBase64EncodingOptions NSDataBase64DecodingOptions +syn keyword objcEnumValue NSDataBase64Encoding64CharacterLineLength NSDataBase64Encoding76CharacterLineLength NSDataBase64EncodingEndLineWithCarriageReturn NSDataBase64EncodingEndLineWithLineFeed NSDataBase64DecodingIgnoreUnknownCharacters " NSArray.h syn match objcClass /NSArray\s*\*/me=s+7,he=s+7 +syn match objcClass /NSArray<.*>\s*\*/me=s+7,he=s+7 contains=objcTypeInfoParams syn match objcClass /NSMutableArray\s*\*/me=s+14,he=s+14 +syn match objcClass /NSMutableArray<.*>\s*\*/me=s+14,he=s+14 contains=objcTypeInfoParams syn keyword objcEnum NSBinarySearchingOptions syn keyword objcEnumValue NSBinarySearchingFirstEqual NSBinarySearchingLastEqual NSBinarySearchingInsertionIndex " NSDictionary.h syn match objcClass /NSDictionary\s*\*/me=s+12,he=s+12 +syn match objcClass /NSDictionary<.*>\s*\*/me=s+12,he=s+12 contains=objcTypeInfoParams syn match objcClass /NSMutableDictionary\s*\*/me=s+19,he=s+19 +syn match objcClass /NSMutableDictionary<.*>\s*\*/me=s+19,he=s+19 contains=objcTypeInfoParams " NSSet.h syn match objcClass /NSSet\s*\*/me=s+5,me=s+5 +syn match objcClass /NSSet<.*>\s*\*/me=s+5,me=s+5 contains=objcTypeInfoParams syn match objcClass /NSMutableSet\s*\*/me=s+12,me=s+12 +syn match objcClass /NSMutableSet<.*>\s*\*/me=s+12,me=s+12 contains=objcTypeInfoParams syn match objcClass /NSCountedSet\s*\*/me=s+12,me=s+12 +syn match objcClass /NSCountedSet<.*>\s*\*/me=s+12,me=s+12 contains=objcTypeInfoParams " NSOrderedSet.h syn match objcClass /NSOrderedSet\s*\*/me=s+12,me=s+12 +syn match objcClass /NSOrderedSet<.*>\s*\*/me=s+12,me=s+12 contains=objcTypeInfoParams syn match objcClass /NSMutableOrderedSet\s*\*/me=s+19,me=s+19 +syn match objcClass /NSMutableOrderedSet<.*>\s*\*/me=s+19,me=s+19 """"""""""""""""""" " NSPathUtilities.h syn keyword objcEnum NSSearchPathDirectory @@ -238,9 +282,15 @@ syn keyword objcEnum NSSearchPathDomainMask syn keyword objcEnumValue NSUserDomainMask NSLocalDomainMask NSNetworkDomainMask NSSystemDomainMask NSAllDomainsMask " NSFileManger.h syn match objcClass /NSFileManager\s*\*/me=s+13,he=s+13 -syn match objcClass /NSDirectoryEnumerator\s*\*/me=s+21,he=s+21 +syn match objcClass /NSDirectoryEnumerator\s*\*/me=s+21,he=s+21 contains=objcTypeInfoParams +syn match objcClass /NSDirectoryEnumerator<.*>\s*\*/me=s+21,he=s+21 syn keyword objcEnum NSVolumeEnumerationOptions syn keyword objcEnumValue NSVolumeEnumerationSkipHiddenVolumes NSVolumeEnumerationProduceFileReferenceURLs +syn keyword objcEnum NSURLRelationship +syn keyword objcEnumValue NSURLRelationshipContains NSURLRelationshipSame NSURLRelationshipOther +syn keyword objcEnum NSFileManagerUnmountOptions +syn keyword objcEnumValue NSFileManagerUnmountAllPartitionsAndEjectDisk NSFileManagerUnmountWithoutUI +syn keyword objcConstVar NSFileManagerUnmountDissentingProcessIdentifierErrorKey syn keyword objcEnum NSDirectoryEnumerationOptions syn keyword objcEnumValue NSDirectoryEnumerationSkipsSubdirectoryDescendants NSDirectoryEnumerationSkipsPackageDescendants NSDirectoryEnumerationSkipsHiddenFiles syn keyword objcEnum NSFileManagerItemReplacementOptions @@ -261,10 +311,12 @@ syn keyword objcNotificationValue NSCurrentLocaleDidChangeNotification syn keyword objcConstVar NSLocaleIdentifier NSLocaleLanguageCode NSLocaleCountryCode NSLocaleScriptCode NSLocaleVariantCode NSLocaleExemplarCharacterSet NSLocaleCalendar NSLocaleCollationIdentifier NSLocaleUsesMetricSystem NSLocaleMeasurementSystem NSLocaleDecimalSeparator NSLocaleGroupingSeparator NSLocaleCurrencySymbol NSLocaleCurrencyCode NSLocaleCollatorIdentifier NSLocaleQuotationBeginDelimiterKey NSLocaleQuotationEndDelimiterKey NSLocaleAlternateQuotationBeginDelimiterKey NSLocaleAlternateQuotationEndDelimiterKey NSGregorianCalendar NSBuddhistCalendar NSChineseCalendar NSHebrewCalendar NSIslamicCalendar NSIslamicCivilCalendar NSJapaneseCalendar NSRepublicOfChinaCalendar NSPersianCalendar NSIndianCalendar NSISO8601Calendar " NSFormatter.h syn match objcClass /NSFormatter\s*\*/me=s+11,he=s+11 +syn keyword objcEnum NSFormattingContext NSFormattingUnitStyle +syn keyword objcEnumValue NSFormattingContextUnknown NSFormattingContextDynamic NSFormattingContextStandalone NSFormattingContextListItem NSFormattingContextBeginningOfSentence NSFormattingContextMiddleOfSentence NSFormattingUnitStyleShort NSFormattingUnitStyleMedium NSFormattingUnitStyleLong " NSNumberFormatter.h syn match objcClass /NSNumberFormatter\s*\*/me=s+17,he=s+17 syn keyword objcEnum NSNumberFormatterStyle -syn keyword objcEnumValue NSNumberFormatterNoStyle NSNumberFormatterDecimalStyle NSNumberFormatterCurrencyStyle NSNumberFormatterPercentStyle NSNumberFormatterScientificStyle NSNumberFormatterSpellOutStyle +syn keyword objcEnumValue NSNumberFormatterNoStyle NSNumberFormatterDecimalStyle NSNumberFormatterCurrencyStyle NSNumberFormatterPercentStyle NSNumberFormatterScientificStyle NSNumberFormatterSpellOutStyle NSNumberFormatterOrdinalStyle NSNumberFormatterCurrencyISOCodeStyle NSNumberFormatterCurrencyPluralStyle NSNumberFormatterCurrencyAccountingStyle syn keyword objcEnum NSNumberFormatterBehavior syn keyword objcEnumValue NSNumberFormatterBehaviorDefault NSNumberFormatterBehavior10_0 NSNumberFormatterBehavior10_4 syn keyword objcEnum NSNumberFormatterPadPosition @@ -279,10 +331,15 @@ syn keyword objcEnum NSDateFormatterBehavior syn keyword objcEnumValue NSDateFormatterBehaviorDefault NSDateFormatterBehavior10_0 NSDateFormatterBehavior10_4 " NSCalendar.h syn match objcClass /NSCalendar\s*\*/me=s+10,he=s+10 +syn keyword objcConstVar NSCalendarIdentifierGregorian NSCalendarIdentifierBuddhist NSCalendarIdentifierChinese NSCalendarIdentifierCoptic NSCalendarIdentifierEthiopicAmeteMihret NSCalendarIdentifierEthiopicAmeteAlem NSCalendarIdentifierHebrew NSCalendarIdentifierISO8601 NSCalendarIdentifierIndian NSCalendarIdentifierIslamic NSCalendarIdentifierIslamicCivil NSCalendarIdentifierJapanese NSCalendarIdentifierPersian NSCalendarIdentifierRepublicOfChina NSCalendarIdentifierIslamicTabular NSCalendarIdentifierIslamicUmmAlQura syn keyword objcEnum NSCalendarUnit +syn keyword objcEnumValue NSCalendarUnitEra NSCalendarUnitYear NSCalendarUnitMonth NSCalendarUnitDay NSCalendarUnitHour NSCalendarUnitMinute NSCalendarUnitSecond NSCalendarUnitWeekday NSCalendarUnitWeekdayOrdinal NSCalendarUnitQuarter NSCalendarUnitWeekOfMonth NSCalendarUnitWeekOfYear NSCalendarUnitYearForWeekOfYear NSCalendarUnitNanosecond NSCalendarUnitCalendar NSCalendarUnitTimeZone syn keyword objcEnumValue NSEraCalendarUnit NSYearCalendarUnit NSMonthCalendarUnit NSDayCalendarUnit NSHourCalendarUnit NSMinuteCalendarUnit NSSecondCalendarUnit NSWeekCalendarUnit NSWeekdayCalendarUnit NSWeekdayOrdinalCalendarUnit NSQuarterCalendarUnit NSWeekOfMonthCalendarUnit NSWeekOfYearCalendarUnit NSYearForWeekOfYearCalendarUnit NSCalendarCalendarUnit NSTimeZoneCalendarUnit -syn keyword objcEnumValue NSWrapCalendarComponents NSUndefinedDateComponent +syn keyword objcEnumValue NSWrapCalendarComponents NSUndefinedDateComponent NSDateComponentUndefined syn match objcClass /NSDateComponents\s*\*/me=s+16,he=s+16 +syn keyword objcEnum NSCalendarOptions +syn keyword objcEnumValue NSCalendarWrapComponents NSCalendarMatchStrictly NSCalendarSearchBackwards NSCalendarMatchPreviousTimePreservingSmallerUnits NSCalendarMatchNextTimePreservingSmallerUnits NSCalendarMatchNextTime NSCalendarMatchFirst NSCalendarMatchLast +syn keyword objcConstVar NSCalendarDayChangedNotification " NSTimeZone.h syn match objcClass /NSTimeZone\s*\*/me=s+10,he=s+10 syn keyword objcEnum NSTimeZoneNameStyle @@ -299,6 +356,7 @@ syn keyword objcExceptionValue NSInconsistentArchiveException syn match objcClass /NSKeyedArchiver\s*\*/me=s+15,he=s+15 syn match objcClass /NSKeyedUnarchiver\s*\*/me=s+17,he=s+17 syn keyword objcExceptionValue NSInvalidArchiveOperationException NSInvalidUnarchiveOperationException +syn keyword objcConstVar NSKeyedArchiveRootObjectKey """""""""""""""""" " NSPropertyList.h syn keyword objcEnum NSPropertyListMutabilityOptions @@ -313,11 +371,16 @@ syn keyword objcNotificationValue NSUserDefaultsDidChangeNotification " NSBundle.h syn match objcClass /NSBundle\s*\*/me=s+8,he=s+8 syn keyword objcEnumValue NSBundleExecutableArchitectureI386 NSBundleExecutableArchitecturePPC NSBundleExecutableArchitectureX86_64 NSBundleExecutableArchitecturePPC64 -syn keyword objcNotificationValue NSBundleDidLoadNotification NSLoadedClasses +syn keyword objcNotificationValue NSBundleDidLoadNotification NSLoadedClasses NSBundleResourceRequestLowDiskSpaceNotification +syn keyword objcConstVar NSBundleResourceRequestLoadingPriorityUrgent """"""""""""""""" " NSProcessInfo.h syn match objcClass /NSProcessInfo\s*\*/me=s+13,he=s+13 syn keyword objcEnumValue NSWindowsNTOperatingSystem NSWindows95OperatingSystem NSSolarisOperatingSystem NSHPUXOperatingSystem NSMACHOperatingSystem NSSunOSOperatingSystem NSOSF1OperatingSystem +syn keyword objcType NSOperatingSystemVersion +syn keyword objcEnum NSActivityOptions NSProcessInfoThermalState +syn keyword objcEnumValue NSActivityIdleDisplaySleepDisabled NSActivityIdleSystemSleepDisabled NSActivitySuddenTerminationDisabled NSActivityAutomaticTerminationDisabled NSActivityUserInitiated NSActivityUserInitiatedAllowingIdleSystemSleep NSActivityBackground NSActivityLatencyCritical NSProcessInfoThermalStateNominal NSProcessInfoThermalStateFair NSProcessInfoThermalStateSerious NSProcessInfoThermalStateCritical +syn keyword objcNotificationValue NSProcessInfoThermalStateDidChangeNotification NSProcessInfoPowerStateDidChangeNotification " NSTask.h syn match objcClass /NSTask\s*\*/me=s+6,he=s+6 syn keyword objcEnum NSTaskTerminationReason @@ -352,6 +415,7 @@ syn match objcClass /NSPort\s*\*/me=s+6,he=s+6 syn keyword objcType NSSocketNativeHandle syn keyword objcNotificationValue NSPortDidBecomeInvalidNotification syn match objcClass /NSMachPort\s*\*/me=s+10,he=s+10 +syn keyword objcEnum NSMachPortOptions syn keyword objcEnumValue NSMachPortDeallocateNone NSMachPortDeallocateSendRight NSMachPortDeallocateReceiveRight syn match objcClass /NSMessagePort\s*\*/me=s+13,he=s+13 syn match objcClass /NSSocketPort\s*\*/me=s+12,he=s+12 @@ -386,6 +450,31 @@ syn match objcClass /NSProxy\s*\*/me=s+7,he=s+7 " NSObject.h syn match objcClass /NSObject\s*\*/me=s+8,he=s+8 + +" NSCache.h +syn match objcClass /NSCache\s*\*/me=s+7,he=s+7 +syn match objcClass /NSCache<.*>\s*\*/me=s+7,he=s+7 contains=objcTypeInfoParams +" NSHashTable.h +syn match objcClass /NSHashTable\s*\*/me=s+11,he=s+11 +syn match objcClass /NSHashTable<.*>\s*\*/me=s+11,he=s+11 contains=objcTypeInfoParams +syn keyword objcConstVar NSHashTableStrongMemory NSHashTableZeroingWeakMemory NSHashTableCopyIn NSHashTableObjectPointerPersonality NSHashTableWeakMemory +syn keyword objcType NSHashTableOptions NSHashEnumerator NSHashTableCallBacks +syn keyword objcConstVar NSIntegerHashCallBacks NSNonOwnedPointerHashCallBacks NSNonRetainedObjectHashCallBacks NSObjectHashCallBacks NSOwnedObjectIdentityHashCallBacks NSOwnedPointerHashCallBacks NSPointerToStructHashCallBacks NSOwnedObjectIdentityHashCallBacks NSOwnedObjectIdentityHashCallBacks NSIntHashCallBacks +" NSMapTable.h +syn match objcClass /NSMapTable\s*\*/me=s+10,he=s+10 +syn match objcClass /NSMapTable<.*>\s*\*/me=s+10,he=s+10 contains=objcTypeInfoParams +syn keyword objcConstVar NSPointerToStructHashCallBacks NSPointerToStructHashCallBacks NSPointerToStructHashCallBacks NSPointerToStructHashCallBacks NSPointerToStructHashCallBacks +syn keyword objcConstVar NSMapTableStrongMemory NSMapTableZeroingWeakMemory NSMapTableCopyIn NSMapTableObjectPointerPersonality NSMapTableWeakMemory +syn keyword objcType NSMapTableOptions NSMapEnumerator NSMapTableKeyCallBacks NSMapTableValueCallBacks +syn keyword objcMacro NSNotAnIntMapKey NSNotAnIntegerMapKey NSNotAPointerMapKey +syn keyword objcConstVar NSIntegerMapKeyCallBacks NSNonOwnedPointerMapKeyCallBacks NSNonOwnedPointerOrNullMapKeyCallBacks NSNonRetainedObjectMapKeyCallBacks NSObjectMapKeyCallBacks NSOwnedPointerMapKeyCallBacks NSIntMapKeyCallBacks NSIntegerMapValueCallBacks NSNonOwnedPointerMapValueCallBacks NSObjectMapValueCallBacks NSNonRetainedObjectMapValueCallBacks NSOwnedPointerMapValueCallBacks NSIntMapValueCallBacks + +" NSPointerFunctions.h +syn match objcClass /NSPointerFunctions\s*\*/me=s+18,he=s+18 +syn keyword objcEnum NSPointerFunctionsOptions +syn keyword objcEnumValue NSPointerFunctionsStrongMemory NSPointerFunctionsZeroingWeakMemory NSPointerFunctionsOpaqueMemory NSPointerFunctionsMallocMemory NSPointerFunctionsMachVirtualMemory NSPointerFunctionsWeakMemory NSPointerFunctionsObjectPersonality NSPointerFunctionsOpaquePersonality NSPointerFunctionsObjectPointerPersonality NSPointerFunctionsCStringPersonality NSPointerFunctionsStructPersonality NSPointerFunctionsIntegerPersonality NSPointerFunctionsCopyIn + + """ Default Highlighting hi def link objcPreProcMacro cConstant hi def link objcPrincipalType cType @@ -408,6 +497,7 @@ hi def link objcBlocksQualifier cStorageClass hi def link objcObjectLifetimeQualifier cStorageClass hi def link objcTollFreeBridgeQualifier cStorageClass hi def link objcRemoteMessagingQualifier cStorageClass +hi def link objcStorageClass cStorageClass hi def link objcFastEnumKeyword cStatement hi def link objcLiteralSyntaxNumber cNumber hi def link objcLiteralSyntaxChar cCharacter @@ -418,16 +508,22 @@ hi def link objcDeclPropAccessorType cConstant hi def link objcDeclPropAssignSemantics cConstant hi def link objcDeclPropAtomicity cConstant hi def link objcDeclPropARC cConstant +hi def link objcDeclPropNullable cConstant +hi def link objcDeclPropNonnull cConstant +hi def link objcDeclPropNullUnspecified cConstant +hi def link objcDeclProcNullResettable cConstant hi def link objcInstanceMethod Function hi def link objcClassMethod Function hi def link objcType cType hi def link objcClass cType +hi def link objcTypeSpecifier cType hi def link objcMacro cConstant hi def link objcEnum cType hi def link objcEnumValue cConstant hi def link objcExceptionValue cConstant hi def link objcNotificationValue cConstant hi def link objcConstVar cConstant +hi def link objcTypeInfoParams Identifier """ Final step let b:current_syntax = "objc" diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index e2d73111e4..4e1a84651c 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: php PHP 3/4/5 " Maintainer: Jason Woofenden <jason@jasonwoof.com> -" Last Change: Mar 24, 2015 +" Last Change: Dec 26, 2015 " URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD " Former Maintainers: Peter Hodge <toomuchphp-vim@yahoo.com> " Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> @@ -280,7 +280,7 @@ syn keyword phpStatement return break continue exit goto contained syn keyword phpKeyword var const contained " Type -syn keyword phpType bool[ean] int[eger] real double float string array object NULL contained +syn keyword phpType bool boolean int integer real double float string array object NULL contained " Structure syn keyword phpStructure namespace extends implements instanceof parent self contained @@ -393,13 +393,13 @@ endif " String if exists("php_parent_error_open") - syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble contained keepend - syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained keepend - syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote contained keepend + syn region phpStringDouble matchgroup=phpStringDouble start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble contained keepend + syn region phpBacktick matchgroup=phpBacktick start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained keepend + syn region phpStringSingle matchgroup=phpStringSingle start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote contained keepend else - syn region phpStringDouble matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble contained extend keepend - syn region phpBacktick matchgroup=None start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained extend keepend - syn region phpStringSingle matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote contained keepend extend + syn region phpStringDouble matchgroup=phpStringDouble start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@phpAddStrings,phpBackslashSequences,phpBackslashDoubleQuote,@phpInterpDouble contained extend keepend + syn region phpBacktick matchgroup=phpBacktick start=+`+ skip=+\\\\\|\\"+ end=+`+ contains=@phpAddStrings,phpIdentifier,phpBackslashSequences,phpIdentifierSimply,phpIdentifierComplex contained extend keepend + syn region phpStringSingle matchgroup=phpStringSingle start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@phpAddStrings,phpBackslashSingleQuote contained keepend extend endif " HereDoc and NowDoc @@ -515,7 +515,7 @@ syntax keyword phpStatement die contained " Highlighting for PHP5's user-definable magic class methods syntax keyword phpSpecialFunction containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle,phpIdentifier - \ __construct __destruct __call __toString __sleep __wakeup __set __get __unset __isset __clone __set_state + \ __construct __destruct __call __callStatic __get __set __isset __unset __sleep __wakeup __toString __invoke __set_state __clone __debugInfo " Highlighting for __autoload slightly different from line above syntax keyword phpSpecialFunction containedin=ALLBUT,phpComment,phpStringDouble,phpStringSingle,phpIdentifier,phpMethodsVar \ __autoload diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index c608aeedeb..78d35e4c15 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic <zpetkovic@acm.org> -" Last Change: 2015 Jun 19 +" Last Change: 2015 Sep 15 " Credits: Neil Schemenauer <nas@python.ca> " Dmitry Vasiliev " @@ -51,24 +51,26 @@ set cpo&vim " Keep Python keywords in alphabetical order inside groups for easy " comparison with the table in the 'Python Language Reference' -" http://docs.python.org/reference/lexical_analysis.html#keywords. +" https://docs.python.org/2/reference/lexical_analysis.html#keywords, +" https://docs.python.org/3/reference/lexical_analysis.html#keywords. " Groups are in the order presented in NAMING CONVENTIONS in syntax.txt. " Exceptions come last at the end of each group (class and def below). " " Keywords 'with' and 'as' are new in Python 2.6 " (use 'from __future__ import with_statement' in Python 2.5). " -" Some compromises had to be made to support both Python 3.0 and 2.6. -" We include Python 3.0 features, but when a definition is duplicated, +" Some compromises had to be made to support both Python 3 and 2. +" We include Python 3 features, but when a definition is duplicated, " the last definition takes precedence. " -" - 'False', 'None', and 'True' are keywords in Python 3.0 but they are -" built-ins in 2.6 and will be highlighted as built-ins below. -" - 'exec' is a built-in in Python 3.0 and will be highlighted as +" - 'False', 'None', and 'True' are keywords in Python 3 but they are +" built-ins in 2 and will be highlighted as built-ins below. +" - 'exec' is a built-in in Python 3 and will be highlighted as " built-in below. -" - 'nonlocal' is a keyword in Python 3.0 and will be highlighted. -" - 'print' is a built-in in Python 3.0 and will be highlighted as -" built-in below (use 'from __future__ import print_function' in 2.6) +" - 'nonlocal' is a keyword in Python 3 and will be highlighted. +" - 'print' is a built-in in Python 3 and will be highlighted as +" built-in below (use 'from __future__ import print_function' in 2) +" - async and await were added in Python 3.5 and are soft keywords. " syn keyword pythonStatement False, None, True syn keyword pythonStatement as assert break continue del exec global @@ -79,6 +81,7 @@ syn keyword pythonRepeat for while syn keyword pythonOperator and in is not or syn keyword pythonException except finally raise try syn keyword pythonInclude from import +syn keyword pythonAsync async await " Decorators (new in Python 2.4) syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite @@ -147,7 +150,8 @@ endif " - 08e0 or 08j are highlighted, " " and so on, as specified in the 'Python Language Reference'. -" http://docs.python.org/reference/lexical_analysis.html#numeric-literals +" https://docs.python.org/2/reference/lexical_analysis.html#numeric-literals +" https://docs.python.org/3/reference/lexical_analysis.html#numeric-literals if !exists("python_no_number_highlight") " numbers (including longs and complex) syn match pythonNumber "\<0[oO]\=\o\+[Ll]\=\>" @@ -159,54 +163,58 @@ if !exists("python_no_number_highlight") syn match pythonNumber \ "\<\d\+\.\%([eE][+-]\=\d\+\)\=[jJ]\=\%(\W\|$\)\@=" syn match pythonNumber - \ "\%(^\|\W\)\@<=\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" + \ "\%(^\|\W\)\zs\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" endif " Group the built-ins in the order in the 'Python Library Reference' for " easier comparison. -" http://docs.python.org/library/constants.html -" http://docs.python.org/library/functions.html -" http://docs.python.org/library/functions.html#non-essential-built-in-functions +" https://docs.python.org/2/library/constants.html +" https://docs.python.org/3/library/constants.html +" http://docs.python.org/2/library/functions.html +" http://docs.python.org/3/library/functions.html +" http://docs.python.org/2/library/functions.html#non-essential-built-in-functions +" http://docs.python.org/3/library/functions.html#non-essential-built-in-functions " Python built-in functions are in alphabetical order. if !exists("python_no_builtin_highlight") " built-in constants - " 'False', 'True', and 'None' are also reserved words in Python 3.0 + " 'False', 'True', and 'None' are also reserved words in Python 3 syn keyword pythonBuiltin False True None syn keyword pythonBuiltin NotImplemented Ellipsis __debug__ " built-in functions - syn keyword pythonBuiltin abs all any bin bool chr classmethod - syn keyword pythonBuiltin compile complex delattr dict dir divmod - syn keyword pythonBuiltin enumerate eval filter float format + syn keyword pythonBuiltin abs all any bin bool bytearray callable chr + syn keyword pythonBuiltin classmethod compile complex delattr dict dir + syn keyword pythonBuiltin divmod enumerate eval filter float format syn keyword pythonBuiltin frozenset getattr globals hasattr hash syn keyword pythonBuiltin help hex id input int isinstance syn keyword pythonBuiltin issubclass iter len list locals map max - syn keyword pythonBuiltin min next object oct open ord pow print - syn keyword pythonBuiltin property range repr reversed round set + syn keyword pythonBuiltin memoryview min next object oct open ord pow + syn keyword pythonBuiltin print property range repr reversed round set syn keyword pythonBuiltin setattr slice sorted staticmethod str syn keyword pythonBuiltin sum super tuple type vars zip __import__ - " Python 2.6 only - syn keyword pythonBuiltin basestring callable cmp execfile file + " Python 2 only + syn keyword pythonBuiltin basestring cmp execfile file syn keyword pythonBuiltin long raw_input reduce reload unichr syn keyword pythonBuiltin unicode xrange - " Python 3.0 only - syn keyword pythonBuiltin ascii bytearray bytes exec memoryview - " non-essential built-in functions; Python 2.6 only + " Python 3 only + syn keyword pythonBuiltin ascii bytes exec + " non-essential built-in functions; Python 2 only syn keyword pythonBuiltin apply buffer coerce intern endif " From the 'Python Library Reference' class hierarchy at the bottom. -" http://docs.python.org/library/exceptions.html +" http://docs.python.org/2/library/exceptions.html +" http://docs.python.org/3/library/exceptions.html if !exists("python_no_exception_highlight") - " builtin base exceptions (only used as base classes for other exceptions) + " builtin base exceptions (used mostly as base classes for other exceptions) syn keyword pythonExceptions BaseException Exception - syn keyword pythonExceptions ArithmeticError EnvironmentError + syn keyword pythonExceptions ArithmeticError BufferError syn keyword pythonExceptions LookupError - " builtin base exception removed in Python 3.0 - syn keyword pythonExceptions StandardError + " builtin base exceptions removed in Python 3 + syn keyword pythonExceptions EnvironmentError StandardError " builtin exceptions (actually raised) - syn keyword pythonExceptions AssertionError AttributeError BufferError + syn keyword pythonExceptions AssertionError AttributeError syn keyword pythonExceptions EOFError FloatingPointError GeneratorExit - syn keyword pythonExceptions IOError ImportError IndentationError + syn keyword pythonExceptions ImportError IndentationError syn keyword pythonExceptions IndexError KeyError KeyboardInterrupt syn keyword pythonExceptions MemoryError NameError NotImplementedError syn keyword pythonExceptions OSError OverflowError ReferenceError @@ -214,13 +222,27 @@ if !exists("python_no_exception_highlight") syn keyword pythonExceptions SystemError SystemExit TabError TypeError syn keyword pythonExceptions UnboundLocalError UnicodeError syn keyword pythonExceptions UnicodeDecodeError UnicodeEncodeError - syn keyword pythonExceptions UnicodeTranslateError ValueError VMSError - syn keyword pythonExceptions WindowsError ZeroDivisionError + syn keyword pythonExceptions UnicodeTranslateError ValueError + syn keyword pythonExceptions ZeroDivisionError + " builtin OS exceptions in Python 3 + syn keyword pythonExceptions BlockingIOError BrokenPipeError + syn keyword pythonExceptions ChildProcessError ConnectionAbortedError + syn keyword pythonExceptions ConnectionError ConnectionRefusedError + syn keyword pythonExceptions ConnectionResetError FileExistsError + syn keyword pythonExceptions FileNotFoundError InterruptedError + syn keyword pythonExceptions IsADirectoryError NotADirectoryError + syn keyword pythonExceptions PermissionError ProcessLookupError + syn keyword pythonExceptions RecursionError StopAsyncIteration + syn keyword pythonExceptions TimeoutError + " builtin exceptions deprecated/removed in Python 3 + syn keyword pythonExceptions IOError VMSError WindowsError " builtin warnings syn keyword pythonExceptions BytesWarning DeprecationWarning FutureWarning syn keyword pythonExceptions ImportWarning PendingDeprecationWarning syn keyword pythonExceptions RuntimeWarning SyntaxWarning UnicodeWarning syn keyword pythonExceptions UserWarning Warning + " builtin warnings in Python 3 + syn keyword pythonExceptions ResourceWarning endif if exists("python_space_error_highlight") @@ -267,6 +289,7 @@ if version >= 508 || !exists("did_python_syn_inits") HiLink pythonOperator Operator HiLink pythonException Exception HiLink pythonInclude Include + HiLink pythonAsync Statement HiLink pythonDecorator Define HiLink pythonFunction Function HiLink pythonComment Comment diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim index 9677823fb1..e48b6686cb 100644 --- a/runtime/syntax/r.vim +++ b/runtime/syntax/r.vim @@ -3,7 +3,9 @@ " Maintainer: Jakson Aquino <jalvesaq@gmail.com> " Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com> " Tom Payne <tom@tompayne.org> -" Last Change: Wed Dec 31, 2014 12:36AM +" Contributor: Johannes Ranke <jranke@uni-bremen.de> +" Homepage: https://github.com/jalvesaq/R-Vim-runtime +" Last Change: Wed Oct 21, 2015 06:33AM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in @@ -30,16 +32,21 @@ syn case match " Comment syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):" -syn match rComment contains=@Spell,rCommentTodo "#.*" +syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*" " Roxygen -syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)" +syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend +syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey +syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained + +syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword + +syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)" syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)" syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" -syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\)" -syn match rOComment contains=@Spell,rOKeyword "#'.*" +syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)" if &filetype == "rhelp" @@ -202,7 +209,6 @@ hi def link rBoolean Boolean hi def link rBraceError Error hi def link rComment Comment hi def link rCommentTodo Todo -hi def link rOComment Comment hi def link rComplex Number hi def link rConditional Conditional hi def link rConstant Constant @@ -230,6 +236,11 @@ hi def link rString String hi def link rStrError Error hi def link rType Type hi def link rOKeyword Title +hi def link rOBlock Comment +hi def link rOTitle Title +hi def link rOCommentKey Comment +hi def link rOExamples SpecialComment + let b:current_syntax="r" diff --git a/runtime/syntax/remind.vim b/runtime/syntax/remind.vim index 93a7178479..98064e043a 100644 --- a/runtime/syntax/remind.vim +++ b/runtime/syntax/remind.vim @@ -1,13 +1,17 @@ " Vim syntax file " Language: Remind -" Maintainer: Davide Alberani <alberanid@libero.it> -" Last Change: 18 Sep 2009 -" Version: 0.5 -" URL: http://erlug.linux.it/~da/vim/syntax/remind.vim +" Maintainer: Davide Alberani <da@erlug.linux.it> +" Last Change: 02 Nov 2015 +" Version: 0.7 +" URL: http://ismito.it/vim/syntax/remind.vim " -" remind is a sophisticated reminder service -" you can download remind from: -" http://www.roaringpenguin.com/penguin/open_source_remind.php +" Remind is a sophisticated calendar and alarm program. +" You can download remind from: +" https://www.roaringpenguin.com/products/remind +" +" Changelog +" version 0.7: updated email and link +" version 0.6: added THROUGH keyword (courtesy of Ben Orchard) if version < 600 syntax clear @@ -19,7 +23,7 @@ endif syn case ignore syn keyword remindCommands REM OMIT SET FSET UNSET -syn keyword remindExpiry UNTIL FROM SCANFROM SCAN WARN SCHED +syn keyword remindExpiry UNTIL FROM SCANFROM SCAN WARN SCHED THROUGH syn keyword remindTag PRIORITY TAG syn keyword remindTimed AT DURATION syn keyword remindMove ONCE SKIP BEFORE AFTER diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim index c1f25699e7..b3c89f8352 100644 --- a/runtime/syntax/rst.vim +++ b/runtime/syntax/rst.vim @@ -2,7 +2,7 @@ " Language: reStructuredText documentation format " Maintainer: Marshall Ward <marshall.ward@gmail.com> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2014-10-03 +" Latest Revision: 2016-01-05 if exists("b:current_syntax") finish @@ -13,8 +13,6 @@ set cpo&vim syn case ignore -syn match rstSections "^\%(\([=`:.'"~^_*+#-]\)\1\+\n\)\=.\+\n\([=`:.'"~^_*+#-]\)\2\+$" - syn match rstTransition /^[=`:.'"~^_*+#-]\{4,}\s*$/ syn cluster rstCruft contains=rstEmphasis,rstStrongEmphasis, @@ -81,7 +79,7 @@ syn region rstHyperlinkTarget matchgroup=rstDirective execute 'syn region rstExDirective contained matchgroup=rstDirective' . \ ' start=+' . s:ReferenceName . '::\_s+' . \ ' skip=+^$+' . - \ ' end=+^\s\@!+ contains=@rstCruft' + \ ' end=+^\s\@!+ contains=@rstCruft,rstLiteralBlock' execute 'syn match rstSubstitutionDefinition contained' . \ ' /|' . s:ReferenceName . '|\_s\+/ nextgroup=@rstDirectives' @@ -123,6 +121,8 @@ call s:DefineInlineMarkup('InlineLiteral', '``', "", '``') call s:DefineInlineMarkup('SubstitutionReference', '|', '|', '|_\{0,2}') call s:DefineInlineMarkup('InlineInternalTargets', '_`', '`', '`') +syn match rstSections "^\%(\([=`:.'"~^_*+#-]\)\1\+\n\)\=.\+\n\([=`:.'"~^_*+#-]\)\2\+$" + " TODO: Can’t remember why these two can’t be defined like the ones above. execute 'syn match rstFootnoteReference contains=@NoSpell' . \ ' +\[\%(\d\+\|#\%(' . s:ReferenceName . '\)\=\|\*\)\]_+' diff --git a/runtime/syntax/screen.vim b/runtime/syntax/screen.vim index 71b3d3efba..d576d29b7a 100644 --- a/runtime/syntax/screen.vim +++ b/runtime/syntax/screen.vim @@ -1,7 +1,8 @@ " Vim syntax file -" Language: screen(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-01-03 +" Language: screen(1) configuration file +" Maintainer: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-09-24 if exists("b:current_syntax") finish @@ -76,12 +77,16 @@ syn keyword screenCommands \ break \ breaktype \ bufferfile + \ bumpleft + \ bumpright \ c1 \ caption \ chacl \ charset \ chdir + \ cjkwidth \ clear + \ collapse \ colon \ command \ compacthist @@ -104,6 +109,7 @@ syn keyword screenCommands \ deflogin \ defmode \ defmonitor + \ defmousetrack \ defnonblock \ defobuflimit \ defscrollback @@ -113,6 +119,7 @@ syn keyword screenCommands \ defutf8 \ defwrap \ defwritelock + \ defzombie \ detach \ digraph \ dinfo @@ -126,7 +133,9 @@ syn keyword screenCommands \ fit \ flow \ focus + \ focusminsize \ gr + \ group \ hardcopy \ hardcopy_append \ hardcopydir @@ -155,6 +164,7 @@ syn keyword screenCommands \ maxwin \ meta \ monitor + \ mousetrack \ msgminwait \ msgwait \ multiuser @@ -182,6 +192,7 @@ syn keyword screenCommands \ register \ remove \ removebuf + \ rendition \ reset \ resize \ screen @@ -197,6 +208,7 @@ syn keyword screenCommands \ sleep \ slowpaste \ sorendition + \ sort \ source \ split \ startup_message @@ -210,6 +222,7 @@ syn keyword screenCommands \ time \ title \ umask + \ unbindall \ unsetenv \ utf8 \ vbell @@ -228,6 +241,7 @@ syn keyword screenCommands \ xon \ zmodem \ zombie + \ zombie_timeout hi def link screenEscape Special hi def link screenComment Comment diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 4087aff46e..909ead81f1 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,11 +2,11 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> -" Last Change: May 29, 2015 -" Version: 137 +" Last Change: Dec 11, 2015 +" Version: 143 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH " For options and settings, please use: :help ft-sh-syntax -" This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr) +" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) " For version 5.x: Clear all syntax items {{{1 " For version 6.x: Quit when a syntax file was already loaded @@ -16,17 +16,6 @@ elseif exists("b:current_syntax") finish endif -" AFAICT "." should be considered part of the iskeyword. Using iskeywords in -" 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") @@ -73,6 +62,7 @@ if !exists("b:is_kornshell") && !exists("b:is_bash") endif " set up default g:sh_fold_enabled {{{1 +" ================================ if !exists("g:sh_fold_enabled") let g:sh_fold_enabled= 0 elseif g:sh_fold_enabled != 0 && !has("folding") @@ -95,6 +85,24 @@ if g:sh_fold_enabled && &fdm == "manual" setl fdm=syntax endif +" Set up folding commands for shell {{{1 +" ================================= +if s:sh_fold_functions + com! -nargs=* ShFoldFunctions <args> fold +else + com! -nargs=* ShFoldFunctions <args> +endif +if s:sh_fold_heredoc + com! -nargs=* ShFoldHereDoc <args> fold +else + com! -nargs=* ShFoldHereDoc <args> +endif +if s:sh_fold_ifdofor + com! -nargs=* ShFoldIfDoFor <args> fold +else + com! -nargs=* ShFoldIfDoFor <args> +endif + " sh syntax is case sensitive {{{1 syn case match @@ -108,10 +116,10 @@ syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref, 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 shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shOption,shPosnParm,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable +syn cluster shCommandSubList contains=shAlias,shArithmetic,shComment,shCmdParenRegion,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shOption,shPosnParm,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial -syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS +syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError 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 @@ -126,9 +134,10 @@ syn cluster shHereList contains=shBeginHere,shHerePayload syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo -syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr +syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator -syn cluster shTestList contains=shCharClass,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr +syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr + " Echo: {{{1 " ==== " This one is needed INSIDE a CommandSub, so that `echo bla` be correct @@ -145,6 +154,11 @@ if exists("b:is_kornshell") || exists("b:is_bash") syn match shStatement "\<alias\>" syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+\)\@=" skip="\\$" end="\>\|`" syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+=\)\@=" skip="\\$" end="=" + + " Touch: {{{1 + " ===== + syn match shTouch '\<touch\>[^;#]*' skipwhite nextgroup=shTouchList contains=shTouchCmd + syn match shTouchCmd '\<touch\>' contained endif " Error Codes: {{{1 @@ -193,15 +207,16 @@ syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")" "======= syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1 +syn region shNoQuote start='\S' skip='\%(\\\\\)*\\.' end='\ze\s' contained syn match shTestOpr contained '[^-+/%]\zs=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern -syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" +syn match shTestOpr contained "<=\|>=\|!=\|==\|=\~\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" syn match shTestPattern contained '\w\+' syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' syn match shTestSingleQuote contained '\\.' syn match shTestSingleQuote contained "'[^']*'" if exists("b:is_kornshell") || exists("b:is_bash") - syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList,shComment - syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList,shComment + syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\%(\\\\\)*\\$+ end="\]\]" contains=@shTestList,shNoQuote,shComment + syn region shDblParen matchgroup=Delimiter start="((" skip=+\%(\\\\\)*\\$+ end="))" contains=@shTestList,shComment endif " Character Class In Range: {{{1 @@ -210,17 +225,11 @@ syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum " Loops: do, if, while, until {{{1 " ====== -if s:sh_fold_ifdofor - syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList - syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList - syn region shFor fold matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn - syn region shForPP fold matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr -else - syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList - syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList - syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn - syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr -endif +ShFoldIfDoFor syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList +ShFoldIfDoFor syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList +ShFoldIfDoFor syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn +ShFoldIfDoFor syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr + if exists("b:is_kornshell") || exists("b:is_bash") syn cluster shCaseList add=shRepeat syn cluster shFunctionList add=shRepeat @@ -238,13 +247,9 @@ 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 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="\<case\>" end="\<esac\>" contains=@shCaseEsacList -else - syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment - syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList -endif +ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment +ShFoldIfDoFor syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList + syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote if exists("b:is_bash") syn region shCaseExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained @@ -286,7 +291,7 @@ 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 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 syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop syn keyword bashStatement command compgen endif @@ -295,7 +300,7 @@ 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 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 tput syn keyword kshStatement command setgroups setsenv endif @@ -321,12 +326,10 @@ elseif !exists("g:sh_no_error") endif syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell -syn region shDoubleQuote matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell syn match shStringSpecial "[^[:print:] \t]" contained syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" -" COMBAK: why is ,shComment on next line??? -syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial,shComment -syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shComment +syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" +syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained " Comments: {{{1 @@ -348,35 +351,22 @@ if version < 600 syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*\**\.\**" matchgroup=shHereDoc05 end="^\.$" contains=@shDblQuoteList syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\**\.\**" matchgroup=shHereDoc06 end="^\s*\.$" contains=@shDblQuoteList -elseif s:sh_fold_heredoc - syn region shHereDoc matchgroup=shHereDoc07 fold start="<<\s*\z([^ \t|]*\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shHereDoc08 fold start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc08 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc09 fold start="<<\s*'\z([^ \t|]*\)'" matchgroup=shHereDoc09 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc10 fold start="<<-\s*\z([^ \t|]*\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shHereDoc11 fold start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc11 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc12 fold start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc13 fold start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shHereDoc13 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc14 fold start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc14 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc15 fold start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shHereDoc15 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc16 fold start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shHereDoc16 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc17 fold start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc17 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc18 fold start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shHereDoc18 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc19 fold start="<<\\\z([^ \t|]*\)" matchgroup=shHereDoc19 end="^\z1\s*$" - else - syn region shHereDoc matchgroup=shHereDoc20 start="<<\s*\\\=\z([^ \t|]*\)" matchgroup=shHereDoc20 end="^\z1\s*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shHereDoc21 start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc21 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc22 start="<<-\s*\z([^ \t|]*\)" matchgroup=shHereDoc22 end="^\s*\z1\s*$" contains=@shDblQuoteList - syn region shHereDoc matchgroup=shHereDoc23 start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shHereDoc23 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc24 start="<<\s*'\z([^ \t|]*\)'" matchgroup=shHereDoc24 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc25 start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc25 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc26 start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shHereDoc26 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc27 start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shHereDoc27 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc28 start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shHereDoc28 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc29 start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shHereDoc29 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc30 start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc30 end="^\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc31 start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc31 end="^\s*\z1\s*$" - syn region shHereDoc matchgroup=shHereDoc32 start="<<\\\z([^ \t|]*\)" matchgroup=shHereDoc32 end="^\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\=\z([^ \t|]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc08 end="^\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<-\s*\z([^ \t|]\+\)" matchgroup=shHereDoc09 end="^\s*\z1\s*$" contains=@shDblQuoteList + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc10 end="^\s*\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<\s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc11 end="^\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc12 end="^\s*\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<\s*\\\_$\_s*\z([^ \t|]\+\)" matchgroup=shHereDoc13 end="^\z1\s*$" contains=@shDblQuoteList + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\s*\\\_$\_s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc14 end="^\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<\s*\\\_$\_s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc15 end="^\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\_$\_s*\z([^ \t|]\+\)" matchgroup=shHereDoc16 end="^\s*\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc17 start="<<-\s*\\\_$\_s*\\\z([^ \t|]\+\)" matchgroup=shHereDoc17 end="^\s*\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc18 start="<<-\s*\\\_$\_s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc18 end="^\s*\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc19 start="<<-\s*\\\_$\_s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc19 end="^\s*\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc20 start="<<\\\z([^ \t|]\+\)" matchgroup=shHereDoc20 end="^\z1\s*$" + ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc21 start="<<-\s*\\\z([^ \t|]\+\)" matchgroup=shHereDoc21 end="^\s*\z1\s*$" endif " Here Strings: {{{1 @@ -408,38 +398,24 @@ if !exists("g:is_posix") endif if exists("b:is_bash") - 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 - syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - syn region shFunctionFour 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 - syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList - syn region shFunctionFour matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained - endif + ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment else - 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 - syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - syn region shFunctionFour fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - else - syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList - syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained - syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList - syn region shFunctionFour matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained - endif + ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment endif " Parameter Dereferencing: {{{1 " ======================== -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 endif +syn match shDerefSimple "\$\%(\k\+\|\d\)" +syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray syn match shDerefSimple "\$[-#*@!?]" syn match shDerefSimple "\$\$" if exists("b:is_bash") || exists("b:is_kornshell") @@ -447,16 +423,28 @@ if exists("b:is_bash") || exists("b:is_kornshell") syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList endif +" ksh: ${!var[*]} array index list syntax: {{{1 +" ======================================== +if exists("b:is_kornshell") + syn region shDeref matchgroup=PreProc start="\${!" end="}" contains=@shDerefVarArray +endif + " bash: ${!prefix*} and ${#parameter}: {{{1 " ==================================== if exists("b:is_bash") syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp syn match shDerefVar contained "{\@<=!\k\+" nextgroup=@shDerefVarList endif +if exists("b:is_kornshell") + syn match shDerefVar contained "{\@<=!\k[[:alnum:]_.]*" nextgroup=@shDerefVarList +endif syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp syn match shDerefVar contained "{\@<=\k\+" nextgroup=@shDerefVarList +if exists("b:is_kornshell") + syn match shDerefVar contained "{\@<=\k[[:alnum:]_.]*" nextgroup=@shDerefVarList +endif " sh ksh bash : ${var[... ]...} array reference: {{{1 syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError @@ -505,6 +493,11 @@ if exists("b:is_bash") 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='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shCommandSubList + + " bash : ${parameter/#substring/replacement} + syn match shDerefPSR contained '/#' nextgroup=shDerefPSRleft + syn region shDerefPSRleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright + syn region shDerefPSRright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' endif " Arithmetic Parenthesized Expressions: {{{1 @@ -575,6 +568,7 @@ hi def link shColon shComment hi def link shDerefOp shOperator hi def link shDerefPOL shDerefOp hi def link shDerefPPS shDerefOp +hi def link shDerefPSR shDerefOp hi def link shDeref shShellVariables hi def link shDerefDelim shOperator hi def link shDerefSimple shDeref @@ -595,6 +589,7 @@ hi def link shHereDoc shString hi def link shHerePayload shHereDoc hi def link shLoop shStatement hi def link shMoreSpecial shSpecial +hi def link shNoQuote shDoubleQuote hi def link shOption shCommandSub hi def link shPattern shString hi def link shParen shArithmetic @@ -612,6 +607,7 @@ hi def link shTestOpr shConditional hi def link shTestPattern shString hi def link shTestDoubleQuote shString hi def link shTestSingleQuote shString +hi def link shTouchCmd shStatement hi def link shVariable shSetList hi def link shWrapLineOperator shOperator @@ -689,17 +685,12 @@ hi def link shHereDoc18 shRedir hi def link shHereDoc19 shRedir hi def link shHereDoc20 shRedir hi def link shHereDoc21 shRedir -hi def link shHereDoc22 shRedir -hi def link shHereDoc23 shRedir -hi def link shHereDoc24 shRedir -hi def link shHereDoc25 shRedir -hi def link shHereDoc26 shRedir -hi def link shHereDoc27 shRedir -hi def link shHereDoc28 shRedir -hi def link shHereDoc29 shRedir -hi def link shHereDoc30 shRedir -hi def link shHereDoc31 shRedir -hi def link shHereDoc32 shRedir + +" Delete shell folding commands {{{1 +" ============================= +delc ShFoldFunctions +delc ShFoldHereDoc +delc ShFoldIfDoFor " Set Current Syntax: {{{1 " =================== diff --git a/runtime/syntax/sqloracle.vim b/runtime/syntax/sqloracle.vim index f9a7c19e3b..8afe2686bf 100644 --- a/runtime/syntax/sqloracle.vim +++ b/runtime/syntax/sqloracle.vim @@ -1,13 +1,12 @@ " Vim syntax file -" Language: SQL, PL/SQL (Oracle 8i) -" Maintainer: Paul Moore <pf_moore AT yahoo.co.uk> -" Last Change: 2005 Dec 23 - -" 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") +" Language: SQL, PL/SQL (Oracle 11g) +" Maintainer: Christian Brabandt +" Repository: https://github.com/chrisbra/vim-sqloracle-syntax +" License: Vim +" Previous Maintainer: Paul Moore +" Last Change: 2015 Nov 24 + +if exists("b:current_syntax") finish endif @@ -15,75 +14,121 @@ syn case ignore " The SQL reserved words, defined as keywords. -syn keyword sqlSpecial false null true +syn keyword sqlSpecial false null true -syn keyword sqlKeyword access add as asc begin by check cluster column -syn keyword sqlKeyword compress connect current cursor decimal default desc +syn keyword sqlKeyword access add as asc begin by case check cluster column +syn keyword sqlKeyword cache compress connect current cursor decimal default desc syn keyword sqlKeyword else elsif end exception exclusive file for from syn keyword sqlKeyword function group having identified if immediate increment -syn keyword sqlKeyword index initial into is level loop maxextents mode modify -syn keyword sqlKeyword nocompress nowait of offline on online start -syn keyword sqlKeyword successful synonym table then to trigger uid +syn keyword sqlKeyword index initial initrans into is level link logging loop +syn keyword sqlKeyword maxextents maxtrans mode modify monitoring +syn keyword sqlKeyword nocache nocompress nologging noparallel nowait of offline on online start +syn keyword sqlKeyword parallel successful synonym table tablespace then to trigger uid syn keyword sqlKeyword unique user validate values view whenever -syn keyword sqlKeyword where with option order pctfree privileges procedure +syn keyword sqlKeyword where with option order pctfree pctused privileges procedure syn keyword sqlKeyword public resource return row rowlabel rownum rows syn keyword sqlKeyword session share size smallint type using syn keyword sqlOperator not and or syn keyword sqlOperator in any some all between exists syn keyword sqlOperator like escape -syn keyword sqlOperator union intersect minus -syn keyword sqlOperator prior distinct +syn keyword sqlOperator union intersect minus +syn keyword sqlOperator prior distinct syn keyword sqlOperator sysdate out -syn keyword sqlStatement alter analyze audit comment commit create -syn keyword sqlStatement delete drop execute explain grant insert lock noaudit -syn keyword sqlStatement rename revoke rollback savepoint select set -syn keyword sqlStatement truncate update +syn keyword sqlStatement analyze audit comment commit +syn keyword sqlStatement delete drop execute explain grant lock noaudit +syn keyword sqlStatement rename revoke rollback savepoint set +syn keyword sqlStatement truncate +" next ones are contained, so folding works. +syn keyword sqlStatement create update alter select insert contained syn keyword sqlType boolean char character date float integer long syn keyword sqlType mlslabel number raw rowid varchar varchar2 varray -" Strings and characters: -syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+ +" Strings: +syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+ +syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+ " Numbers: -syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>" +syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>" " Comments: -syn region sqlComment start="/\*" end="\*/" contains=sqlTodo -syn match sqlComment "--.*$" contains=sqlTodo +syn region sqlComment start="/\*" end="\*/" contains=sqlTodo,@Spell fold +syn match sqlComment "--.*$" contains=sqlTodo,@Spell + +" Setup Folding: +" this is a hack, to get certain statements folded. +" the keywords create/update/alter/select/insert need to +" have contained option. +syn region sqlFold start='^\s*\zs\c\(Create\|Update\|Alter\|Select\|Insert\)' end=';$\|^$' transparent fold contains=ALL syn sync ccomment sqlComment -" Todo. -syn keyword sqlTodo contained TODO FIXME XXX DEBUG NOTE +" Functions: +" (Oracle 11g) +" Aggregate Functions +syn keyword sqlFunction avg collect corr corr_s corr_k count covar_pop covar_samp cume_dist dense_rank first +syn keyword sqlFunction group_id grouping grouping_id last max median min percentile_cont percentile_disc percent_rank rank +syn keyword sqlFunction regr_slope regr_intercept regr_count regr_r2 regr_avgx regr_avgy regr_sxx regr_syy regr_sxy +syn keyword sqlFunction stats_binomial_test stats_crosstab stats_f_test stats_ks_test stats_mode stats_mw_test +syn keyword sqlFunction stats_one_way_anova stats_t_test_one stats_t_test_paired stats_t_test_indep stats_t_test_indepu +syn keyword sqlFunction stats_wsr_test stddev stddev_pop stddev_samp sum +syn keyword sqlFunction sys_xmlagg var_pop var_samp variance xmlagg +" Char Functions +syn keyword sqlFunction ascii chr concat initcap instr length lower lpad ltrim +syn keyword sqlFunction nls_initcap nls_lower nlssort nls_upper regexp_instr regexp_replace +syn keyword sqlFunction regexp_substr replace rpad rtrim soundex substr translate treat trim upper +" Comparison Functions +syn keyword sqlFunction greatest least +" Conversion Functions +syn keyword sqlFunction asciistr bin_to_num cast chartorowid compose convert +syn keyword sqlFunction decompose hextoraw numtodsinterval numtoyminterval rawtohex rawtonhex rowidtochar +syn keyword sqlFunction rowidtonchar scn_to_timestamp timestamp_to_scn to_binary_double to_binary_float +syn keyword sqlFunction to_char to_char to_char to_clob to_date to_dsinterval to_lob to_multi_byte +syn keyword sqlFunction to_nchar to_nchar to_nchar to_nclob to_number to_dsinterval to_single_byte +syn keyword sqlFunction to_timestamp to_timestamp_tz to_yminterval to_yminterval translate unistr +" DataMining Functions +syn keyword sqlFunction cluster_id cluster_probability cluster_set feature_id feature_set +syn keyword sqlFunction feature_value prediction prediction_bounds prediction_cost +syn keyword sqlFunction prediction_details prediction_probability prediction_set +" Datetime Functions +syn keyword sqlFunction add_months current_date current_timestamp dbtimezone extract +syn keyword sqlFunction from_tz last_day localtimestamp months_between new_time +syn keyword sqlFunction next_day numtodsinterval numtoyminterval round sessiontimezone +syn keyword sqlFunction sys_extract_utc sysdate systimestamp to_char to_timestamp +syn keyword sqlFunction to_timestamp_tz to_dsinterval to_yminterval trunc tz_offset +" Numeric Functions +syn keyword sqlFunction abs acos asin atan atan2 bitand ceil cos cosh exp +syn keyword sqlFunction floor ln log mod nanvl power remainder round sign +syn keyword sqlFunction sin sinh sqrt tan tanh trunc width_bucket +" NLS Functions +syn keyword sqlFunction ls_charset_decl_len nls_charset_id nls_charset_name +" Various Functions +syn keyword sqlFunction bfilename cardin coalesce collect decode dump empty_blob empty_clob +syn keyword sqlFunction lnnvl nullif nvl nvl2 ora_hash powermultiset powermultiset_by_cardinality +syn keyword sqlFunction sys_connect_by_path sys_context sys_guid sys_typeid uid user userenv vsizeality +" XML Functions +syn keyword sqlFunction appendchildxml deletexml depth extract existsnode extractvalue insertchildxml +syn keyword sqlFunction insertxmlbefore path sys_dburigen sys_xmlagg sys_xmlgen updatexml xmlagg xmlcast +syn keyword sqlFunction xmlcdata xmlcolattval xmlcomment xmlconcat xmldiff xmlelement xmlexists xmlforest +syn keyword sqlFunction xmlparse xmlpatch xmlpi xmlquery xmlroot xmlsequence xmlserialize xmltable xmltransform +" Todo: +syn keyword sqlTodo TODO FIXME XXX DEBUG NOTE contained " Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_sql_syn_inits") - if version < 508 - let did_sql_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink sqlComment Comment - HiLink sqlKeyword sqlSpecial - HiLink sqlNumber Number - HiLink sqlOperator sqlStatement - HiLink sqlSpecial Special - HiLink sqlStatement Statement - HiLink sqlString String - HiLink sqlType Type - HiLink sqlTodo Todo - - delcommand HiLink -endif - +command -nargs=+ HiLink hi def link <args> +HiLink sqlComment Comment +HiLink sqlFunction Function +HiLink sqlKeyword sqlSpecial +HiLink sqlNumber Number +HiLink sqlOperator sqlStatement +HiLink sqlSpecial Special +HiLink sqlStatement Statement +HiLink sqlString String +HiLink sqlType Type +HiLink sqlTodo Todo + +delcommand HiLink let b:current_syntax = "sql" - " vim: ts=8 diff --git a/runtime/syntax/sshconfig.vim b/runtime/syntax/sshconfig.vim index 6d4de6c64e..ef2ca07976 100644 --- a/runtime/syntax/sshconfig.vim +++ b/runtime/syntax/sshconfig.vim @@ -1,9 +1,11 @@ " Vim syntax file " Language: OpenSSH client configuration file (ssh_config) " Author: David Necas (Yeti) -" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de> -" Last Change: 2012 Feb 24 -" SSH Version: 5.9p1 +" Maintainer: Dominik Fischer <d dot f dot fischer at web dot de> +" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de> +" Contributor: Karsten Hopp <karsten@redhat.com> +" Last Change: 2016 Jan 15 +" SSH Version: 7.1 " " Setup @@ -68,8 +70,8 @@ syn keyword sshconfigSysLogFacility DAEMON USER AUTH AUTHPRIV LOCAL0 LOCAL1 syn keyword sshconfigSysLogFacility LOCAL2 LOCAL3 LOCAL4 LOCAL5 LOCAL6 LOCAL7 syn keyword sshconfigAddressFamily inet inet6 -syn match sshconfigIPQoS "af1[1234]" -syn match sshconfigIPQoS "af2[23]" +syn match sshconfigIPQoS "af1[123]" +syn match sshconfigIPQoS "af2[123]" syn match sshconfigIPQoS "af3[123]" syn match sshconfigIPQoS "af4[123]" syn match sshconfigIPQoS "cs[0-7]" @@ -100,9 +102,15 @@ syn case ignore " Keywords syn keyword sshconfigHostSect Host +syn keyword sshconfigMatch canonical exec host originalhost user localuser all + syn keyword sshconfigKeyword AddressFamily syn keyword sshconfigKeyword BatchMode syn keyword sshconfigKeyword BindAddress +syn keyword sshconfigKeyword CanonicalDomains +syn keyword sshconfigKeyword CanonicalizeFallbackLocal +syn keyword sshconfigKeyword CanonicalizeHostname +syn keyword sshconfigKeyword CanonicalizeMaxDots syn keyword sshconfigKeyword ChallengeResponseAuthentication syn keyword sshconfigKeyword CheckHostIP syn keyword sshconfigKeyword Cipher @@ -138,9 +146,12 @@ syn keyword sshconfigKeyword HostKeyAlgorithms syn keyword sshconfigKeyword HostKeyAlias syn keyword sshconfigKeyword HostName syn keyword sshconfigKeyword HostbasedAuthentication +syn keyword sshconfigKeyword HostbasedKeyTypes syn keyword sshconfigKeyword IPQoS syn keyword sshconfigKeyword IdentitiesOnly syn keyword sshconfigKeyword IdentityFile +syn keyword sshconfigKeyword IgnoreUnknown +syn keyword sshconfigKeyword IPQoS syn keyword sshconfigKeyword KbdInteractiveAuthentication syn keyword sshconfigKeyword KbdInteractiveDevices syn keyword sshconfigKeyword KexAlgorithms @@ -148,6 +159,7 @@ syn keyword sshconfigKeyword LocalCommand syn keyword sshconfigKeyword LocalForward syn keyword sshconfigKeyword LogLevel syn keyword sshconfigKeyword MACs +syn keyword sshconfigKeyword Match syn keyword sshconfigKeyword NoHostAuthenticationForLocalhost syn keyword sshconfigKeyword NumberOfPasswordPrompts syn keyword sshconfigKeyword PKCS11Provider @@ -157,6 +169,8 @@ syn keyword sshconfigKeyword Port syn keyword sshconfigKeyword PreferredAuthentications syn keyword sshconfigKeyword Protocol syn keyword sshconfigKeyword ProxyCommand +syn keyword sshconfigKeyword ProxyUseFDPass +syn keyword sshconfigKeyword PubkeyAcceptedKeyTypes syn keyword sshconfigKeyword PubkeyAuthentication syn keyword sshconfigKeyword RSAAuthentication syn keyword sshconfigKeyword RekeyLimit @@ -175,6 +189,7 @@ syn keyword sshconfigKeyword UseBlacklistedKeys syn keyword sshconfigKeyword UsePrivilegedPort syn keyword sshconfigKeyword User syn keyword sshconfigKeyword UserKnownHostsFile +syn keyword sshconfigKeyword UseRoaming syn keyword sshconfigKeyword VerifyHostKeyDNS syn keyword sshconfigKeyword VisualHostKey syn keyword sshconfigKeyword XAuthLocation @@ -211,6 +226,7 @@ if version >= 508 || !exists("did_sshconfig_syntax_inits") HiLink sshconfigSpecial Special HiLink sshconfigKeyword Keyword HiLink sshconfigHostSect Type + HiLink sshconfigMatch Type delcommand HiLink endif diff --git a/runtime/syntax/sshdconfig.vim b/runtime/syntax/sshdconfig.vim index 53bc09de0d..4203047d2c 100644 --- a/runtime/syntax/sshdconfig.vim +++ b/runtime/syntax/sshdconfig.vim @@ -1,11 +1,13 @@ " Vim syntax file " Language: OpenSSH server configuration file (sshd_config) -" Maintainer: David Necas (Yeti) -" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de> -" Modified By: Thilo Six +" Author: David Necas (Yeti) +" Maintainer: Dominik Fischer <d dot f dot fischer at web dot de> +" Contributor: Thilo Six +" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de> +" Contributor: Karsten Hopp <karsten@redhat.com> " Originally: 2009-07-09 -" Last Change: 2011 Oct 31 -" SSH Version: 5.9p1 +" Last Change: 2016 Jan 12 +" SSH Version: 7.1 " " Setup @@ -39,6 +41,12 @@ syn keyword sshdconfigYesNo yes no none syn keyword sshdconfigAddressFamily any inet inet6 +syn keyword sshdconfigPrivilegeSeparation sandbox + +syn keyword sshdconfigTcpForwarding local remote + +syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only + syn keyword sshdconfigCipher aes128-cbc 3des-cbc blowfish-cbc cast128-cbc syn keyword sshdconfigCipher aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr syn keyword sshdconfigCipher arcfour arcfour128 arcfour256 cast128-cbc @@ -49,7 +57,7 @@ syn keyword sshdconfigMAC hmac-sha2-256 hmac-sha256-96 hmac-sha2-512 syn keyword sshdconfigMAC hmac-sha2-512-96 syn match sshdconfigMAC "\<umac-64@openssh\.com\>" -syn keyword sshdconfigRootLogin without-password forced-commands-only +syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only syn keyword sshdconfigLogLevel QUIET FATAL ERROR INFO VERBOSE syn keyword sshdconfigLogLevel DEBUG DEBUG1 DEBUG2 DEBUG3 @@ -58,8 +66,8 @@ syn keyword sshdconfigSysLogFacility LOCAL2 LOCAL3 LOCAL4 LOCAL5 LOCAL6 LOCAL7 syn keyword sshdconfigCompression delayed -syn match sshdconfigIPQoS "af1[1234]" -syn match sshdconfigIPQoS "af2[23]" +syn match sshdconfigIPQoS "af1[123]" +syn match sshdconfigIPQoS "af2[123]" syn match sshdconfigIPQoS "af3[123]" syn match sshdconfigIPQoS "af4[123]" syn match sshdconfigIPQoS "cs[0-7]" @@ -99,9 +107,13 @@ syn keyword sshdconfigKeyword AcceptEnv syn keyword sshdconfigKeyword AddressFamily syn keyword sshdconfigKeyword AllowAgentForwarding syn keyword sshdconfigKeyword AllowGroups +syn keyword sshdconfigKeyword AllowStreamLocalForwarding syn keyword sshdconfigKeyword AllowTcpForwarding syn keyword sshdconfigKeyword AllowUsers +syn keyword sshdconfigKeyword AuthenticationMethods syn keyword sshdconfigKeyword AuthorizedKeysFile +syn keyword sshdconfigKeyword AuthorizedKeysCommand +syn keyword sshdconfigKeyword AuthorizedKeysCommandUser syn keyword sshdconfigKeyword AuthorizedPrincipalsFile syn keyword sshdconfigKeyword Banner syn keyword sshdconfigKeyword ChallengeResponseAuthentication @@ -122,6 +134,9 @@ syn keyword sshdconfigKeyword GSSAPIStrictAcceptorCheck syn keyword sshdconfigKeyword GatewayPorts syn keyword sshdconfigKeyword HostCertificate syn keyword sshdconfigKeyword HostKey +syn keyword sshdconfigKeyword HostKeyAgent +syn keyword sshdconfigKeyword HostKeyAlgorithms +syn keyword sshdconfigKeyword HostbasedAcceptedKeyTypes syn keyword sshdconfigKeyword HostbasedAuthentication syn keyword sshdconfigKeyword HostbasedUsesNameFromPacketOnly syn keyword sshdconfigKeyword IPQoS @@ -147,15 +162,19 @@ syn keyword sshdconfigKeyword PermitBlacklistedKeys syn keyword sshdconfigKeyword PermitEmptyPasswords syn keyword sshdconfigKeyword PermitOpen syn keyword sshdconfigKeyword PermitRootLogin +syn keyword sshdconfigKeyword PermitTTY syn keyword sshdconfigKeyword PermitTunnel syn keyword sshdconfigKeyword PermitUserEnvironment +syn keyword sshdconfigKeyword PermitUserRC syn keyword sshdconfigKeyword PidFile syn keyword sshdconfigKeyword Port syn keyword sshdconfigKeyword PrintLastLog syn keyword sshdconfigKeyword PrintMotd syn keyword sshdconfigKeyword Protocol +syn keyword sshdconfigKeyword PubkeyAcceptedKeyTypes syn keyword sshdconfigKeyword PubkeyAuthentication syn keyword sshdconfigKeyword RSAAuthentication +syn keyword sshdconfigKeyword RekeyLimit syn keyword sshdconfigKeyword RevokedKeys syn keyword sshdconfigKeyword RhostsRSAAuthentication syn keyword sshdconfigKeyword ServerKeyBits @@ -169,6 +188,7 @@ syn keyword sshdconfigKeyword UseDNS syn keyword sshdconfigKeyword UseLogin syn keyword sshdconfigKeyword UsePAM syn keyword sshdconfigKeyword UsePrivilegeSeparation +syn keyword sshdconfigKeyword VersionAddendum syn keyword sshdconfigKeyword X11DisplayOffset syn keyword sshdconfigKeyword X11Forwarding syn keyword sshdconfigKeyword X11UseLocalhost @@ -184,29 +204,32 @@ if version >= 508 || !exists("did_sshdconfig_syntax_inits") command -nargs=+ HiLink hi def link <args> endif - HiLink sshdconfigComment Comment - HiLink sshdconfigTodo Todo - HiLink sshdconfigHostPort sshdconfigConstant - HiLink sshdconfigTime sshdconfigConstant - HiLink sshdconfigNumber sshdconfigConstant - HiLink sshdconfigConstant Constant - HiLink sshdconfigYesNo sshdconfigEnum - HiLink sshdconfigAddressFamily sshdconfigEnum - HiLink sshdconfigCipher sshdconfigEnum - HiLink sshdconfigMAC sshdconfigEnum - HiLink sshdconfigRootLogin sshdconfigEnum - HiLink sshdconfigLogLevel sshdconfigEnum - HiLink sshdconfigSysLogFacility sshdconfigEnum - HiLink sshdconfigVar sshdconfigEnum - HiLink sshdconfigCompression sshdconfigEnum - HiLink sshdconfigIPQoS sshdconfigEnum - HiLink sshdconfigKexAlgo sshdconfigEnum - HiLink sshdconfigTunnel sshdconfigEnum - HiLink sshdconfigSubsystem sshdconfigEnum - HiLink sshdconfigEnum Function - HiLink sshdconfigSpecial Special - HiLink sshdconfigKeyword Keyword - HiLink sshdconfigMatch Type + HiLink sshdconfigComment Comment + HiLink sshdconfigTodo Todo + HiLink sshdconfigHostPort sshdconfigConstant + HiLink sshdconfigTime sshdconfigConstant + HiLink sshdconfigNumber sshdconfigConstant + HiLink sshdconfigConstant Constant + HiLink sshdconfigYesNo sshdconfigEnum + HiLink sshdconfigAddressFamily sshdconfigEnum + HiLink sshdconfigPrivilegeSeparation sshdconfigEnum + HiLink sshdconfigTcpForwarding sshdconfigEnum + HiLink sshdconfigRootLogin sshdconfigEnum + HiLink sshdconfigCipher sshdconfigEnum + HiLink sshdconfigMAC sshdconfigEnum + HiLink sshdconfigRootLogin sshdconfigEnum + HiLink sshdconfigLogLevel sshdconfigEnum + HiLink sshdconfigSysLogFacility sshdconfigEnum + HiLink sshdconfigVar sshdconfigEnum + HiLink sshdconfigCompression sshdconfigEnum + HiLink sshdconfigIPQoS sshdconfigEnum + HiLink sshdconfigKexAlgo sshdconfigEnum + HiLink sshdconfigTunnel sshdconfigEnum + HiLink sshdconfigSubsystem sshdconfigEnum + HiLink sshdconfigEnum Function + HiLink sshdconfigSpecial Special + HiLink sshdconfigKeyword Keyword + HiLink sshdconfigMatch Type delcommand HiLink endif diff --git a/runtime/syntax/synload.vim b/runtime/syntax/synload.vim index 48b5956b3c..6183f33a59 100644 --- a/runtime/syntax/synload.vim +++ b/runtime/syntax/synload.vim @@ -60,8 +60,8 @@ fun! s:SynSet() endfun -" Handle adding doxygen to other languages (C, C++, C#, IDL) -au Syntax c,cpp,cs,idl,php +" Handle adding doxygen to other languages (C, C++, C#, IDL, java, php, DataScript) +au Syntax c,cpp,cs,idl,java,php,datascript \ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax) \ || (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax) \ | runtime! syntax/doxygen.vim diff --git a/runtime/syntax/systemd.vim b/runtime/syntax/systemd.vim new file mode 100644 index 0000000000..5dfba74408 --- /dev/null +++ b/runtime/syntax/systemd.vim @@ -0,0 +1,8 @@ +" Vim syntax file +" Language: systemd.unit(5) + +if !exists('b:current_syntax') + " Looks a lot like dosini files. + runtime! syntax/dosini.vim + let b:current_syntax = 'systemd' +endif diff --git a/runtime/syntax/teraterm.vim b/runtime/syntax/teraterm.vim new file mode 100644 index 0000000000..521331d8ce --- /dev/null +++ b/runtime/syntax/teraterm.vim @@ -0,0 +1,139 @@ +" Vim syntax file +" Language: Tera Term Language (TTL) +" Based on Tera Term Version 4.86 +" Maintainer: Ken Takata +" URL: https://github.com/k-takata/vim-teraterm +" Last Change: 2015 Jun 24 +" Filenames: *.ttl +" License: VIM License + +if exists("b:current_syntax") + finish +endif + +let s:save_cpo = &cpo +set cpo&vim + +syn case ignore + +syn region ttlComment start=";" end="$" contains=@Spell +syn region ttlComment start="/\*" end="\*/" contains=@Spell +syn region ttlFirstComment start="/\*" end="\*/" contained contains=@Spell + \ nextgroup=ttlStatement,ttlFirstComment + +syn match ttlCharacter "#\%(\d\+\|\$\x\+\)\>" +syn match ttlNumber "\%(\<\d\+\|\$\x\+\)\>" +syn match ttlString "'[^']*'" contains=@Spell +syn match ttlString '"[^"]*"' contains=@Spell +syn cluster ttlConstant contains=ttlCharacter,ttlNumber,ttlString + +syn match ttlLabel ":\s*\w\{1,32}\>" + +syn keyword ttlOperator and or xor not + +syn match ttlVar "\<groupmatchstr\d\>" +syn match ttlVar "\<param\d\>" +syn keyword ttlVar inputstr matchstr paramcnt result timeout mtimeout + + +syn match ttlLine nextgroup=ttlStatement "^" +syn match ttlStatement contained "\s*" + \ nextgroup=ttlIf,ttlElseIf,ttlConditional,ttlRepeat, + \ ttlFirstComment,ttlComment,ttlLabel,@ttlCommand + +syn cluster ttlCommand contains=ttlControlCommand,ttlCommunicationCommand, + \ ttlStringCommand,ttlFileCommand,ttlPasswordCommand, + \ ttlMiscCommand + + +syn keyword ttlIf contained nextgroup=ttlIfExpression if +syn keyword ttlElseIf contained nextgroup=ttlElseIfExpression elseif + +syn match ttlIfExpression contained "\s.*" + \ contains=@ttlConstant,ttlVar,ttlOperator,ttlComment,ttlThen, + \ @ttlCommand +syn match ttlElseIfExpression contained "\s.*" + \ contains=@ttlConstant,ttlVar,ttlOperator,ttlComment,ttlThen + +syn keyword ttlThen contained then +syn keyword ttlConditional contained else endif + +syn keyword ttlRepeat contained for next until enduntil while endwhile +syn match ttlRepeat contained + \ "\<\%(do\|loop\)\%(\s\+\%(while\|until\)\)\?\>" +syn keyword ttlControlCommand contained + \ break call continue end execcmnd exit goto include + \ mpause pause return + + +syn keyword ttlCommunicationCommand contained + \ bplusrecv bplussend callmenu changedir clearscreen + \ closett connect cygconnect disconnect dispstr + \ enablekeyb flushrecv gethostname getmodemstatus + \ gettitle kmtfinish kmtget kmtrecv kmtsend loadkeymap + \ logautoclosemode logclose loginfo logopen logpause + \ logrotate logstart logwrite quickvanrecv + \ quickvansend recvln restoresetup scprecv scpsend + \ send sendbreak sendbroadcast sendfile sendkcode + \ sendln sendlnbroadcast sendmulticast setbaud + \ setdebug setdtr setecho setmulticastname setrts + \ setsync settitle showtt testlink unlink wait + \ wait4all waitevent waitln waitn waitrecv waitregex + \ xmodemrecv xmodemsend ymodemrecv ymodemsend + \ zmodemrecv zmodemsend +syn keyword ttlStringCommand contained + \ code2str expandenv int2str regexoption sprintf + \ sprintf2 str2code str2int strcompare strconcat + \ strcopy strinsert strjoin strlen strmatch strremove + \ strreplace strscan strspecial strsplit strtrim + \ tolower toupper +syn keyword ttlFileCommand contained + \ basename dirname fileclose fileconcat filecopy + \ filecreate filedelete filelock filemarkptr fileopen + \ filereadln fileread filerename filesearch fileseek + \ fileseekback filestat filestrseek filestrseek2 + \ filetruncate fileunlock filewrite filewriteln + \ findfirst findnext findclose foldercreate + \ folderdelete foldersearch getdir getfileattr makepath + \ setdir setfileattr +syn keyword ttlPasswordCommand contained + \ delpassword getpassword ispassword passwordbox + \ setpassword +syn keyword ttlMiscCommand contained + \ beep bringupbox checksum8 checksum8file checksum16 + \ checksum16file checksum32 checksum32file closesbox + \ clipb2var crc16 crc16file crc32 crc32file exec + \ dirnamebox filenamebox getdate getenv getipv4addr + \ getipv6addr getspecialfolder gettime getttdir getver + \ ifdefined inputbox intdim listbox messagebox random + \ rotateleft rotateright setdate setdlgpos setenv + \ setexitcode settime show statusbox strdim uptime + \ var2clipb yesnobox + + +hi def link ttlCharacter Character +hi def link ttlNumber Number +hi def link ttlComment Comment +hi def link ttlFirstComment Comment +hi def link ttlString String +hi def link ttlLabel Label +hi def link ttlIf Conditional +hi def link ttlElseIf Conditional +hi def link ttlThen Conditional +hi def link ttlConditional Conditional +hi def link ttlRepeat Repeat +hi def link ttlControlCommand Keyword +hi def link ttlVar Identifier +hi def link ttlOperator Operator +hi def link ttlCommunicationCommand Keyword +hi def link ttlStringCommand Keyword +hi def link ttlFileCommand Keyword +hi def link ttlPasswordCommand Keyword +hi def link ttlMiscCommand Keyword + +let b:current_syntax = "teraterm" + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: ts=8 sw=2 sts=2 diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index b95ff4d8cb..d31e14bed0 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> -" Last Change: Jun 11, 2015 -" Version: 87 +" Last Change: Oct 20, 2015 +" Version: 90 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -62,11 +62,6 @@ if version >= 508 || !exists("did_tex_syntax_inits") command -nargs=+ HiLink hi def link <args> endif endif -if exists("g:tex_no_error") && g:tex_no_error - let s:tex_no_error= 1 -else - let s:tex_no_error= 0 -endif " by default, enable all region-based highlighting let s:tex_fast= "bcmMprsSvV" @@ -78,8 +73,6 @@ if exists("g:tex_fast") else let s:tex_fast= g:tex_fast endif -else - let s:tex_fast= "bcmMprsSvV" endif " let user determine which classes of concealment will be supported @@ -114,14 +107,21 @@ endif " handle folding {{{1 if !exists("g:tex_fold_enabled") - let g:tex_fold_enabled= 0 + let s:tex_fold_enabled= 0 elseif g:tex_fold_enabled && !has("folding") - let g:tex_fold_enabled= 0 + let s:tex_fold_enabled= 0 echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support" +else + let s:tex_fold_enabled= 1 endif -if g:tex_fold_enabled && &fdm == "manual" +if s:tex_fold_enabled && &fdm == "manual" setl fdm=syntax endif +if s:tex_fold_enabled && has("folding") + com! -nargs=* TexFold <args> fold +else + com! -nargs=* TexFold <args> +endif " (La)TeX keywords: uses the characters 0-9,a-z,A-Z,192-255 only... {{{1 " but _ is the only one that causes problems. @@ -135,40 +135,53 @@ endif if b:tex_stylish setlocal isk+=@-@ endif -if exists("g:tex_nospell") && g:tex_nospell && !exists("g:tex_comment_nospell") - let g:tex_comment_nospell= 1 +if exists("g:tex_no_error") && g:tex_no_error + let s:tex_no_error= 1 +else + let s:tex_no_error= 0 +endif +if exists("g:tex_comment_nospell") && g:tex_comment_nospell + let s:tex_comment_nospell= 1 +else + let s:tex_comment_nospell= 0 +endif +if exists("g:tex_nospell") && g:tex_nospell + let s:tex_nospell = 1 +else + let s:tex_nospell = 0 endif " Clusters: {{{1 " -------- -syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texBeginEnd,texBeginEndName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle -if !exists("s:tex_no_error") || !s:tex_no_error - syn cluster texCmdGroup add=texMathError +syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texBeginEnd,texBeginEndName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle +if !s:tex_no_error + syn cluster texCmdGroup add=texMathError endif -syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement -syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texNoSpell -syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell -syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texItalBoldStyle,texNoSpell -if !exists("g:tex_nospell") || !g:tex_nospell - syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell - syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher +syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement +syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texNoSpell +syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell +syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texItalBoldStyle,texNoSpell +if !s:tex_nospell + syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell + syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher else - syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption - syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher + syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption + syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher endif -syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ -syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter +syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ +syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter if !exists("g:tex_no_math") - syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ - syn cluster texMatchGroup add=@texMathZones - syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 - syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone - syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle - if !exists("s:tex_no_error") || !s:tex_no_error - syn cluster texMathMatchGroup add=texMathError - syn cluster texMathZoneGroup add=texMathError + syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ + syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ + syn cluster texMatchGroup add=@texMathZones + syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 + syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone + syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle + if !s:tex_no_error + syn cluster texMathMatchGroup add=texMathError + syn cluster texMathZoneGroup add=texMathError endif - syn cluster texMathZoneGroup add=@NoSpell + syn cluster texMathZoneGroup add=@NoSpell " following used in the \part \chapter \section \subsection \subsubsection " \paragraph \subparagraph \author \title highlighting syn cluster texDocGroup contains=texPartZone,@texPartGroup @@ -179,35 +192,35 @@ if !exists("g:tex_no_math") syn cluster texSubSubSectionGroup contains=texParaZone syn cluster texParaGroup contains=texSubParaZone if has("conceal") && &enc == 'utf-8' - syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol - syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol + syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol + syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol endif endif " Try to flag {} and () mismatches: {{{1 if s:tex_fast =~ 'm' - if !exists("s:tex_no_error") || !s:tex_no_error - syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError - syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError,@NoSpell + if !s:tex_no_error + syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError + syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell else - syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup - syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup + syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup + syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup endif - if !exists("g:tex_nospell") || !g:tex_nospell - syn region texParen start="(" end=")" contains=@texMatchGroup,@Spell + if !s:tex_nospell + syn region texParen start="(" end=")" transparent contains=@texMatchGroup,@Spell else - syn region texParen start="(" end=")" contains=@texMatchGroup + syn region texParen start="(" end=")" transparent contains=@texMatchGroup endif endif -if !exists("s:tex_no_error") || !s:tex_no_error +if !s:tex_no_error syn match texError "[}\])]" endif if s:tex_fast =~ 'M' if !exists("g:tex_no_math") - if !exists("s:tex_no_error") || !s:tex_no_error + if !s:tex_no_error syn match texMathError "}" contained endif - syn region texMathMatcher matchgroup=Delimiter start="{" skip="\(\\\\\)*\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup + syn region texMathMatcher matchgroup=Delimiter start="{" skip="\%(\\\\\)*\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup endif endif @@ -218,7 +231,7 @@ if exists("g:tex_tex") || b:tex_stylish syn match texStatement "\\[a-zA-Z@]\+" else syn match texStatement "\\\a\+" - if !exists("s:tex_no_error") || !s:tex_no_error + if !s:tex_no_error syn match texError "\\\a*@[a-zA-Z@]*" endif endif @@ -226,7 +239,6 @@ endif " TeX/LaTeX delimiters: {{{1 syn match texDelimiter "&" syn match texDelimiter "\\\\" -"%syn match texDelimiter "[{}]" " Tex/Latex Options: {{{1 syn match texOption "[^\\]\zs#\d\+\|^#\d\+" @@ -258,7 +270,7 @@ if s:tex_fast =~ 'm' endif " Preamble syntax-based folding support: {{{1 -if g:tex_fold_enabled && has("folding") +if s:tex_fold_enabled && has("folding") syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texPreambleMatchGroup endif @@ -336,55 +348,28 @@ syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained " Sections, subsections, etc: {{{1 if s:tex_fast =~ 'p' - if !exists("g:tex_nospell") || !g:tex_nospell - if g:tex_fold_enabled && has("folding") - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup,@Spell - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup,@Spell - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@Spell - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell - else - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell - syn region texSpellZone matchgroup=texSpellZone start="%spellzone_start" end="%spellzone_end" contains=@Spell - endif - else - if g:tex_fold_enabled && has("folding") - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup - else - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup - endif + if !s:tex_nospell + TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell + TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell + TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell + TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell + TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell + TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell + TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell + TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell + TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell + TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell + else + TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup + TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup + TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup + TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup + TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup + TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup + TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup + TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup + TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup + TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup endif endif @@ -406,8 +391,8 @@ if s:tex_fast =~ 'b' endif " Bad Math (mismatched): {{{1 -if !exists("g:tex_no_math") && (!exists("s:tex_no_error") || !s:tex_no_error) - syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|smallmatrix\|xxalignat\)\s*}" +if !exists("g:tex_no_math") && !s:tex_no_error + syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}" syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}" syn match texBadMath "\\[\])]" endif @@ -421,7 +406,7 @@ if !exists("g:tex_no_math") fun! TexNewMathZone(sfx,mathzone,starform) let grpname = "texMathZone".a:sfx let syncname = "texSyncMathZone".a:sfx - if g:tex_fold_enabled + if s:tex_fold_enabled let foldcmd= " fold" else let foldcmd= "" @@ -456,8 +441,9 @@ if !exists("g:tex_no_math") call TexNewMathZone("G","gather",1) call TexNewMathZone("H","math",1) call TexNewMathZone("I","multline",1) - call TexNewMathZone("J","xalignat",1) - call TexNewMathZone("K","xxalignat",0) + call TexNewMathZone("J","subequations",0) + call TexNewMathZone("K","xalignat",1) + call TexNewMathZone("L","xxalignat",0) " Inline Math Zones: {{{2 if s:tex_fast =~ 'M' @@ -469,7 +455,7 @@ if !exists("g:tex_no_math") else syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup - syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup + syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\%(\\\\\)*\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup endif syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup @@ -564,7 +550,7 @@ endif " Comments: {{{1 " Normal TeX LaTeX : %.... " Documented TeX Format: ^^A... -and- leading %s (only) -if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell +if !s:tex_comment_nospell syn cluster texCommentGroup contains=texTodo,@Spell else syn cluster texCommentGroup contains=texTodo,@NoSpell @@ -573,25 +559,23 @@ syn case ignore syn keyword texTodo contained combak fixme todo xxx syn case match if s:extfname == "dtx" - syn match texComment "\^\^A.*$" contains=@texCommentGroup - syn match texComment "^%\+" contains=@texCommentGroup + syn match texComment "\^\^A.*$" contains=@texCommentGroup + syn match texComment "^%\+" contains=@texCommentGroup else - if g:tex_fold_enabled - " allows syntax-folding of 2 or more contiguous comment lines - " single-line comments are not folded - syn match texComment "%.*$" contains=@texCommentGroup - if s:tex_fast =~ 'c' - syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold - syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" fold contains=@texFoldGroup,@NoSpell - syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" fold contains=@Spell,@texFoldGroup - endif - else - syn match texComment "%.*$" contains=@texCommentGroup - if s:tex_fast =~ 'c' - syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell - syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" contains=@Spell,@texFoldGroup - endif + if s:tex_fold_enabled + " allows syntax-folding of 2 or more contiguous comment lines + " single-line comments are not folded + syn match texComment "%.*$" contains=@texCommentGroup + if s:tex_fast =~ 'c' + TexFold syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' contains=@texCommentGroup + TexFold syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell endif + else + syn match texComment "%.*$" contains=@texCommentGroup + if s:tex_fast =~ 'c' + syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell + endif + endif endif " Separate lines used for verb` and verb# so that the end conditions {{{1 @@ -673,7 +657,7 @@ syn match texLength "\<\d\+\([.,]\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\ syn match texString "\(``\|''\|,,\)" " makeatletter -- makeatother sections -if !exists("s:tex_no_error") || !s:tex_no_error +if !s:tex_no_error if s:tex_fast =~ 'S' syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained endif @@ -1353,6 +1337,7 @@ if did_tex_syntax_inits == 1 endif " Cleanup: {{{1 +delc TexFold unlet s:extfname let b:current_syntax = "tex" let &cpo = s:keepcpo diff --git a/runtime/syntax/vb.vim b/runtime/syntax/vb.vim index 14f9e64850..0c05b35fbd 100644 --- a/runtime/syntax/vb.vim +++ b/runtime/syntax/vb.vim @@ -223,7 +223,7 @@ syn keyword vbStatement Explicit FileCopy For ForEach Function Get GoSub syn keyword vbStatement GoTo Gosub Implements Kill LSet Let Lib LineInput syn keyword vbStatement Load Lock Loop Mid MkDir Name Next On OnError Open syn keyword vbStatement Option Preserve Private Property Public Put RSet -syn keyword vbStatement RaiseEvent Randomize ReDim Redim Rem Reset Resume +syn keyword vbStatement RaiseEvent Randomize ReDim Redim Reset Resume syn keyword vbStatement Return RmDir SavePicture SaveSetting Seek SendKeys syn keyword vbStatement Sendkeys Set SetAttr Static Step Stop Sub Time syn keyword vbStatement Type Unload Unlock Until Wend While Width With diff --git a/runtime/syntax/vhdl.vim b/runtime/syntax/vhdl.vim index c76b046d8c..916bd9635d 100644 --- a/runtime/syntax/vhdl.vim +++ b/runtime/syntax/vhdl.vim @@ -3,8 +3,7 @@ " Maintainer: Daniel Kho <daniel.kho@tauhop.com> " Previous Maintainer: Czo <Olivier.Sirol@lip6.fr> " Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn> -" Last Changed: 2015 Apr 25 by Daniel Kho -" $Id: vhdl.vim,v 1.1 2004/06/13 15:34:56 vimboss Exp $ +" Last Changed: 2015 Dec 4 by Daniel Kho " VHSIC (Very High Speed Integrated Circuit) Hardware Description Language @@ -19,195 +18,223 @@ endif let s:cpo_save = &cpo set cpo&vim -" This is not VHDL. I use the C-Preprocessor cpp to generate different binaries -" from one VHDL source file. Unfortunately there is no preprocessor for VHDL -" available. If you don't like this, please remove the following lines. -"syn match cDefine "^#ifdef[ ]\+[A-Za-z_]\+" -"syn match cDefine "^#endif" - " case is not significant -syn case ignore +syn case ignore " VHDL keywords -syn keyword vhdlStatement access after alias all assert -syn keyword vhdlStatement architecture array attribute -syn keyword vhdlStatement assume assume_guarantee -syn keyword vhdlStatement begin block body buffer bus -syn keyword vhdlStatement case component configuration constant -syn keyword vhdlStatement context cover -syn keyword vhdlStatement default disconnect downto -syn keyword vhdlStatement elsif end entity exit -syn keyword vhdlStatement file for function -syn keyword vhdlStatement fairness force -syn keyword vhdlStatement generate generic group guarded -syn keyword vhdlStatement impure in inertial inout is -syn keyword vhdlStatement label library linkage literal loop -syn keyword vhdlStatement map -syn keyword vhdlStatement new next null -syn keyword vhdlStatement of on open others out -syn keyword vhdlStatement package port postponed procedure process pure -syn keyword vhdlStatement parameter property protected -syn keyword vhdlStatement range record register reject report return -syn keyword vhdlStatement release restrict restrict_guarantee -syn keyword vhdlStatement select severity signal shared -syn keyword vhdlStatement subtype -syn keyword vhdlStatement sequence strong -syn keyword vhdlStatement then to transport type -syn keyword vhdlStatement unaffected units until use -syn keyword vhdlStatement variable -syn keyword vhdlStatement vmode vprop vunit -syn keyword vhdlStatement wait when while with -syn keyword vhdlStatement note warning error failure - -" Special match for "if" and "else" since "else if" shouldn't be highlighted. -" The right keyword is "elsif" -syn match vhdlStatement "\<\(if\|else\)\>" -syn match vhdlNone "\<else\s\+if\>$" -syn match vhdlNone "\<else\s\+if\>\s" +syn keyword vhdlStatement access after alias all assert +syn keyword vhdlStatement architecture array attribute +syn keyword vhdlStatement assume assume_guarantee +syn keyword vhdlStatement begin block body buffer bus +syn keyword vhdlStatement case component configuration constant +syn keyword vhdlStatement context cover +syn keyword vhdlStatement default disconnect downto +syn keyword vhdlStatement elsif end entity exit +syn keyword vhdlStatement file for function +syn keyword vhdlStatement fairness force +syn keyword vhdlStatement generate generic group guarded +syn keyword vhdlStatement impure in inertial inout is +syn keyword vhdlStatement label library linkage literal loop +syn keyword vhdlStatement map +syn keyword vhdlStatement new next null +syn keyword vhdlStatement of on open others out +syn keyword vhdlStatement package port postponed procedure process pure +syn keyword vhdlStatement parameter property protected +syn keyword vhdlStatement range record register reject report return +syn keyword vhdlStatement release restrict restrict_guarantee +syn keyword vhdlStatement select severity signal shared +syn keyword vhdlStatement subtype +syn keyword vhdlStatement sequence strong +syn keyword vhdlStatement then to transport type +syn keyword vhdlStatement unaffected units until use +syn keyword vhdlStatement variable +syn keyword vhdlStatement vmode vprop vunit +syn keyword vhdlStatement wait when while with +syn keyword vhdlStatement note warning error failure + +" Linting of conditionals. +syn match vhdlStatement "\<\(if\|else\)\>" +syn match vhdlError "\<else\s\+if\>" " Predefined VHDL types -syn keyword vhdlType bit bit_vector -syn keyword vhdlType character boolean integer real time -syn keyword vhdlType boolean_vector integer_vector real_vector time_vector -syn keyword vhdlType string severity_level +syn keyword vhdlType bit bit_vector +syn keyword vhdlType character boolean integer real time +syn keyword vhdlType boolean_vector integer_vector real_vector time_vector +syn keyword vhdlType string severity_level " Predefined standard ieee VHDL types -syn keyword vhdlType positive natural signed unsigned -syn keyword vhdlType line text -syn keyword vhdlType std_logic std_logic_vector -syn keyword vhdlType std_ulogic std_ulogic_vector -" Predefined non standard VHDL types for Mentor Graphics Sys1076/QuickHDL -"syn keyword vhdlType qsim_state qsim_state_vector -"syn keyword vhdlType qsim_12state qsim_12state_vector -"syn keyword vhdlType qsim_strength -" Predefined non standard VHDL types for Alliance VLSI CAD -"syn keyword vhdlType mux_bit mux_vector reg_bit reg_vector wor_bit wor_vector +syn keyword vhdlType positive natural signed unsigned +syn keyword vhdlType unresolved_signed unresolved_unsigned u_signed u_unsigned +syn keyword vhdlType line text +syn keyword vhdlType std_logic std_logic_vector +syn keyword vhdlType std_ulogic std_ulogic_vector " array attributes -syn match vhdlAttribute "\'high" -syn match vhdlAttribute "\'left" -syn match vhdlAttribute "\'length" -syn match vhdlAttribute "\'low" -syn match vhdlAttribute "\'range" -syn match vhdlAttribute "\'reverse_range" -syn match vhdlAttribute "\'right" -syn match vhdlAttribute "\'ascending" +syn match vhdlAttribute "\'high" +syn match vhdlAttribute "\'left" +syn match vhdlAttribute "\'length" +syn match vhdlAttribute "\'low" +syn match vhdlAttribute "\'range" +syn match vhdlAttribute "\'reverse_range" +syn match vhdlAttribute "\'right" +syn match vhdlAttribute "\'ascending" " block attributes -syn match vhdlAttribute "\'behaviour" -syn match vhdlAttribute "\'structure" -syn match vhdlAttribute "\'simple_name" -syn match vhdlAttribute "\'instance_name" -syn match vhdlAttribute "\'path_name" -syn match vhdlAttribute "\'foreign" +syn match vhdlAttribute "\'simple_name" +syn match vhdlAttribute "\'instance_name" +syn match vhdlAttribute "\'path_name" +syn match vhdlAttribute "\'foreign" " VHPI " signal attribute -syn match vhdlAttribute "\'active" -syn match vhdlAttribute "\'delayed" -syn match vhdlAttribute "\'event" -syn match vhdlAttribute "\'last_active" -syn match vhdlAttribute "\'last_event" -syn match vhdlAttribute "\'last_value" -syn match vhdlAttribute "\'quiet" -syn match vhdlAttribute "\'stable" -syn match vhdlAttribute "\'transaction" -syn match vhdlAttribute "\'driving" -syn match vhdlAttribute "\'driving_value" +syn match vhdlAttribute "\'active" +syn match vhdlAttribute "\'delayed" +syn match vhdlAttribute "\'event" +syn match vhdlAttribute "\'last_active" +syn match vhdlAttribute "\'last_event" +syn match vhdlAttribute "\'last_value" +syn match vhdlAttribute "\'quiet" +syn match vhdlAttribute "\'stable" +syn match vhdlAttribute "\'transaction" +syn match vhdlAttribute "\'driving" +syn match vhdlAttribute "\'driving_value" " type attributes -syn match vhdlAttribute "\'base" -syn match vhdlAttribute "\'high" -syn match vhdlAttribute "\'left" -syn match vhdlAttribute "\'leftof" -syn match vhdlAttribute "\'low" -syn match vhdlAttribute "\'pos" -syn match vhdlAttribute "\'pred" -syn match vhdlAttribute "\'rightof" -syn match vhdlAttribute "\'succ" -syn match vhdlAttribute "\'val" -syn match vhdlAttribute "\'image" -syn match vhdlAttribute "\'value" - -syn keyword vhdlBoolean true false +syn match vhdlAttribute "\'base" +syn match vhdlAttribute "\'subtype" +syn match vhdlAttribute "\'element" +syn match vhdlAttribute "\'leftof" +syn match vhdlAttribute "\'pos" +syn match vhdlAttribute "\'pred" +syn match vhdlAttribute "\'rightof" +syn match vhdlAttribute "\'succ" +syn match vhdlAttribute "\'val" +syn match vhdlAttribute "\'image" +syn match vhdlAttribute "\'value" + +syn keyword vhdlBoolean true false " for this vector values case is significant -syn case match +syn case match " Values for standard VHDL types -syn match vhdlVector "\'[0L1HXWZU\-\?]\'" -" Values for non standard VHDL types qsim_12state for Mentor Graphics Sys1076/QuickHDL -"syn keyword vhdlVector S0S S1S SXS S0R S1R SXR S0Z S1Z SXZ S0I S1I SXI -syn case ignore +syn match vhdlVector "\'[0L1HXWZU\-\?]\'" +syn case ignore -syn match vhdlVector "B\"[01_]\+\"" -syn match vhdlVector "O\"[0-7_]\+\"" -syn match vhdlVector "X\"[0-9a-f_]\+\"" -syn match vhdlCharacter "'.'" -syn region vhdlString start=+"+ end=+"+ +syn match vhdlVector "B\"[01_]\+\"" +syn match vhdlVector "O\"[0-7_]\+\"" +syn match vhdlVector "X\"[0-9a-f_]\+\"" +syn match vhdlCharacter "'.'" +syn region vhdlString start=+"+ end=+"+ " floating numbers -syn match vhdlNumber "-\=\<\d\+\.\d\+\(E[+\-]\=\d\+\)\>" -syn match vhdlNumber "-\=\<\d\+\.\d\+\>" -syn match vhdlNumber "0*2#[01_]\+\.[01_]\+#\(E[+\-]\=\d\+\)\=" -syn match vhdlNumber "0*16#[0-9a-f_]\+\.[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" +syn match vhdlNumber "-\=\<\d\+\.\d\+\(E[+\-]\=\d\+\)\>" +syn match vhdlNumber "-\=\<\d\+\.\d\+\>" +syn match vhdlNumber "0*2#[01_]\+\.[01_]\+#\(E[+\-]\=\d\+\)\=" +syn match vhdlNumber "0*16#[0-9a-f_]\+\.[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" " integer numbers -syn match vhdlNumber "-\=\<\d\+\(E[+\-]\=\d\+\)\>" -syn match vhdlNumber "-\=\<\d\+\>" -syn match vhdlNumber "0*2#[01_]\+#\(E[+\-]\=\d\+\)\=" -syn match vhdlNumber "0*16#[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" +syn match vhdlNumber "-\=\<\d\+\(E[+\-]\=\d\+\)\>" +syn match vhdlNumber "-\=\<\d\+\>" +syn match vhdlNumber "0*2#[01_]\+#\(E[+\-]\=\d\+\)\=" +syn match vhdlNumber "0*16#[0-9a-f_]\+#\(E[+\-]\=\d\+\)\=" + " operators -syn keyword vhdlOperator and nand or nor xor xnor -syn keyword vhdlOperator rol ror sla sll sra srl -syn keyword vhdlOperator mod rem abs not -syn match vhdlOperator "[&><=:+\-*\/|]" -syn match vhdlSpecial "[().,;]" +syn keyword vhdlOperator and nand or nor xor xnor +syn keyword vhdlOperator rol ror sla sll sra srl +syn keyword vhdlOperator mod rem abs not + +" Concatenation and math operators +syn match vhdlOperator "&\|+\|-\|\*\|\/" + +" Equality and comparison operators +syn match vhdlOperator "=\|\/=\|>\|<\|>=" + +" Assignment operators +syn match vhdlOperator "<=\|:=" +syn match vhdlOperator "=>" + +" VHDL-2008 conversion, matching equality/non-equality operators +syn match vhdlOperator "??\|?=\|?\/=\|?<\|?<=\|?>\|?>=" + +" VHDL-2008 external names +syn match vhdlOperator "<<\|>>" + +" Linting for illegal operators +" '=' +syn match vhdlError "\(=\)[<=&+\-\*\/\\]\+" +syn match vhdlError "[=&+\-\*\\]\+\(=\)" +" '>', '<' +" Allow external names: '<< ... >>' +syn match vhdlError "\(>\)[<&+\-\/\\]\+" +syn match vhdlError "[&+\-\/\\]\+\(>\)" +syn match vhdlError "\(<\)[&+\-\/\\]\+" +syn match vhdlError "[>=&+\-\/\\]\+\(<\)" +" Covers most operators +" support negative sign after operators. E.g. q<=-b; +syn match vhdlError "\(&\|+\|\-\|\*\*\|\/=\|??\|?=\|?\/=\|?<=\|?>=\|>=\|<=\|:=\|=>\)[<>=&+\*\\?:]\+" +syn match vhdlError "[<>=&+\-\*\\:]\+\(&\|+\|\*\*\|\/=\|??\|?=\|?\/=\|?<\|?<=\|?>\|?>=\|>=\|<=\|:=\|=>\)" +syn match vhdlError "\(?<\|?>\)[<>&+\*\/\\?:]\+" +syn match vhdlError "\(<<\|>>\)[<>&+\*\/\\?:]\+" + +"syn match vhdlError "[?]\+\(&\|+\|\-\|\*\*\|??\|?=\|?\/=\|?<\|?<=\|?>\|?>=\|:=\|=>\)" +" '/' +syn match vhdlError "\(\/\)[<>&+\-\*\/\\?:]\+" +syn match vhdlError "[<>=&+\-\*\/\\:]\+\(\/\)" + +syn match vhdlSpecial "<>" +syn match vhdlSpecial "[().,;]" + + " time -syn match vhdlTime "\<\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" -syn match vhdlTime "\<\d\+\.\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" - -syn keyword vhdlTodo contained TODO NOTE -syn keyword vhdlFixme contained FIXME - -" Regex for space is '\s' -" Any number of spaces: \s* -" At least one space: \s+ -syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell -syn match vhdlComment "--.*" contains=vhdlTodo,vhdlFixme,@Spell -syn match vhdlPreProc "/\* synthesis .* \*/" -syn match vhdlPreProc "/\* pragma .* \*/" -syn match vhdlPreProc "/\* synopsys .* \*/" -syn match vhdlPreProc "--\s*synthesis .*" -syn match vhdlPreProc "--\s*pragma .*" -syn match vhdlPreProc "--\s*synopsys .*" -" syn match vhdlGlobal "[\'$#~!%@?\^\[\]{}\\]" +syn match vhdlTime "\<\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" +syn match vhdlTime "\<\d\+\.\d\+\s\+\(\([fpnum]s\)\|\(sec\)\|\(min\)\|\(hr\)\)\>" + +syn case match +syn keyword vhdlTodo contained TODO NOTE +syn keyword vhdlFixme contained FIXME +syn case ignore + +syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell +syn match vhdlComment "\(^\|\s\)--.*" contains=vhdlTodo,vhdlFixme,@Spell + +" Industry-standard directives. These are not standard VHDL, but are commonly +" used in the industry. +syn match vhdlPreProc "/\*\s*synthesis\s\+translate_\(on\|off\)\s*\*/" +"syn match vhdlPreProc "/\*\s*simulation\s\+translate_\(on\|off\)\s*\*/" +syn match vhdlPreProc "/\*\s*pragma\s\+synthesis_\(on\|off\)\s*\*/" +syn match vhdlPreProc "/\*\s*synopsys\s\+translate_\(on\|off\)\s*\*/" + +syn match vhdlPreProc "\(^\|\s\)--\s*synthesis\s\+translate_\(on\|off\)\s*" +"syn match vhdlPreProc "\(^\|\s\)--\s*simulation\s\+translate_\(on\|off\)\s*" +syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+synthesis_\(on\|off\)\s*" +syn match vhdlPreProc "\(^\|\s\)--\s*synopsys\s\+translate_\(on\|off\)\s*" "Modify the following as needed. The trade-off is performance versus functionality. -syn sync minlines=200 +syn sync minlines=600 " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_vhdl_syntax_inits") - if version < 508 - let did_vhdl_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink vhdlSpecial Special - HiLink vhdlStatement Statement - HiLink vhdlCharacter Character - HiLink vhdlString String - HiLink vhdlVector Number - HiLink vhdlBoolean Number - HiLink vhdlTodo Todo - HiLink vhdlFixme Fixme - HiLink vhdlComment Comment - HiLink vhdlNumber Number - HiLink vhdlTime Number - HiLink vhdlType Type - HiLink vhdlOperator Operator -" HiLink vhdlGlobal Error - HiLink vhdlAttribute Special - HiLink vhdlPreProc PreProc - - delcommand HiLink + if version < 508 + let did_vhdl_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink vhdlSpecial Special + HiLink vhdlStatement Statement + HiLink vhdlCharacter Character + HiLink vhdlString String + HiLink vhdlVector Number + HiLink vhdlBoolean Number + HiLink vhdlTodo Todo + HiLink vhdlFixme Fixme + HiLink vhdlComment Comment + HiLink vhdlNumber Number + HiLink vhdlTime Number + HiLink vhdlType Type + HiLink vhdlOperator Operator + HiLink vhdlError Error + HiLink vhdlAttribute Special + HiLink vhdlPreProc PreProc + + delcommand HiLink endif let b:current_syntax = "vhdl" diff --git a/runtime/syntax/zsh.vim b/runtime/syntax/zsh.vim index 5e588e7d6c..162577669f 100644 --- a/runtime/syntax/zsh.vim +++ b/runtime/syntax/zsh.vim @@ -2,7 +2,7 @@ " Language: Zsh shell script " Maintainer: Christian Brabandt <cb@256bit.org> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2015-05-29 +" Latest Revision: 2015-12-25 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-zsh @@ -125,20 +125,29 @@ syn keyword zshCommands alias autoload bg bindkey break bye cap cd \ zsocket zstyle ztcp " Options, generated by: echo ${(j:\n:)options[(I)*]} | sort +" Create a list of option names from zsh source dir: +" #!/bin/zsh +" topdir=/path/to/zsh-xxx +" grep '^pindex([A-Za-z_]*)$' $topdir/Src/Doc/Zsh/optionsyo | +" while read opt +" do +" echo ${${(L)opt#pindex\(}%\)} +" done + syn case ignore syn keyword zshOptions aliases allexport all_export alwayslastprompt - \ always_lastprompt alwaystoend always_to_end - \ appendhistory append_history autocd autocontinue + \ always_last_prompt always_lastprompt alwaystoend always_to_end appendcreate + \ append_create appendhistory append_history autocd auto_cd autocontinue \ auto_continue autolist auto_list \ automenu auto_menu autonamedirs auto_name_dirs \ autoparamkeys auto_param_keys autoparamslash \ auto_param_slash autopushd auto_pushd autoremoveslash - \ auto_remove_slash autoresume auto_resume badpattern + \ auto_remove_slash autoresume auto_resume badpattern bad_pattern \ banghist bang_hist bareglobqual bare_glob_qual \ bashautolist bash_auto_list bashrematch bash_rematch - \ beep bgnice braceccl brace_ccl braceexpand brace_expand + \ beep bgnice bg_nice braceccl brace_ccl braceexpand brace_expand \ bsdecho bsd_echo caseglob case_glob casematch case_match - \ cbases cdablevars cd_able_vars chasedots chase_dots + \ cbases c_bases cdablevars cdable_vars cd_able_vars chasedots chase_dots \ chaselinks chase_links checkjobs check_jobs \ clobber combiningchars combining_chars completealiases \ complete_aliases completeinword complete_in_word @@ -146,17 +155,17 @@ syn keyword zshOptions aliases allexport all_export alwayslastprompt \ correctall correct_all cprecedences c_precedences \ cshjunkiehistory csh_junkie_history cshjunkieloops \ csh_junkie_loops cshjunkiequotes csh_junkie_quotes - \ cshnullcmd csh_null_cmd cshnullglob csh_null_glob + \ csh_nullcmd csh_null_cmd cshnullcmd csh_null_cmd cshnullglob csh_null_glob \ debugbeforecmd debug_before_cmd dotglob dot_glob dvorak \ emacs equals errexit err_exit errreturn err_return evallineno \ eval_lineno exec extendedglob extended_glob extendedhistory \ extended_history flowcontrol flow_control forcefloat - \ force_float functionargzero function_arg_zero glob globalexport + \ force_float functionargzero function_argzero function_arg_zero glob globalexport \ global_export globalrcs global_rcs globassign glob_assign \ globcomplete glob_complete globdots glob_dots glob_subst - \ globsubst hashall hash_all hashcmds hash_cmds hashdirs - \ hash_dirs hashexecutablesonly hash_executables_only hashlistall - \ hash_list_all histallowclobber hist_allow_clobber histappend + \ globsubst globstarshort glob_star_short hashall hash_all hashcmds + \ hash_cmds hashdirs hash_dirs hashexecutablesonly hash_executables_only + \ hashlistall hash_list_all histallowclobber hist_allow_clobber histappend \ hist_append histbeep hist_beep hist_expand hist_expire_dups_first \ histexpand histexpiredupsfirst histfcntllock hist_fcntl_lock \ histfindnodups hist_find_no_dups histignorealldups @@ -184,7 +193,7 @@ syn keyword zshOptions aliases allexport all_export alwayslastprompt \ numeric_glob_sort octalzeroes octal_zeroes onecmd one_cmd \ overstrike over_strike pathdirs path_dirs pathscript \ path_script physical pipefail pipe_fail posixaliases - \ posix_aliases posixargzero posix_arg_zero posixbuiltins + \ posix_aliases posixargzero posix_arg_zero posix_argzero posixbuiltins \ posix_builtins posixcd posix_cd posixidentifiers posix_identifiers \ posixjobs posix_jobs posixstrings posix_strings posixtraps \ posix_traps printeightbit print_eight_bit printexitvalue @@ -192,8 +201,8 @@ syn keyword zshOptions aliases allexport all_export alwayslastprompt \ prompt_cr promptpercent prompt_percent promptsp prompt_sp \ promptsubst prompt_subst promptvars prompt_vars pushdignoredups \ pushd_ignore_dups pushdminus pushd_minus pushdsilent pushd_silent - \ pushdtohome pushd_to_home rcexpandparam rc_expandparam rcquotes - \ rc_quotes rcs recexact rec_exact rematchpcre re_match_pcre + \ pushdtohome pushd_to_home rcexpandparam rc_expandparam rc_expand_param rcquotes + \ rc_quotes rcs recexact rec_exact rematchpcre re_match_pcre rematch_pcre \ restricted rmstarsilent rm_star_silent rmstarwait rm_star_wait \ sharehistory share_history shfileexpansion sh_file_expansion \ shglob sh_glob shinstdin shin_stdin shnullcmd sh_nullcmd @@ -201,22 +210,22 @@ syn keyword zshOptions aliases allexport all_export alwayslastprompt \ sh_word_split singlecommand single_command singlelinezle single_line_zle \ sourcetrace source_trace stdin sunkeyboardhack sun_keyboard_hack \ trackall track_all transientrprompt transient_rprompt - \ trapsasync trapasync typesetsilent type_set_silent unset verbose vi + \ trapsasync traps_async typesetsilent type_set_silent typeset_silent unset verbose vi \ warncreateglobal warn_create_global xtrace zle syn keyword zshOptions noaliases no_aliases noallexport no_allexport noall_export no_all_export noalwayslastprompt no_alwayslastprompt - \ noalways_lastprompt no_always_lastprompt noalwaystoend no_alwaystoend noalways_to_end no_always_to_end - \ noappendhistory no_appendhistory noappend_history no_append_history noautocd no_autocd noautocontinue no_autocontinue - \ noauto_continue no_auto_continue noautolist no_autolist noauto_list no_auto_list - \ noautomenu no_automenu noauto_menu no_auto_menu noautonamedirs no_autonamedirs noauto_name_dirs no_auto_name_dirs - \ noautoparamkeys no_autoparamkeys noauto_param_keys no_auto_param_keys noautoparamslash no_autoparamslash + \ noalways_lastprompt no_always_lastprompt no_always_last_prompt noalwaystoend no_alwaystoend noalways_to_end no_always_to_end + \ noappendcreate no_appendcreate no_append_create noappendhistory no_appendhistory noappend_history no_append_history noautocd + \ no_autocd no_auto_cd noautocontinue no_autocontinue noauto_continue no_auto_continue noautolist no_autolist noauto_list + \ no_auto_list noautomenu no_automenu noauto_menu no_auto_menu noautonamedirs no_autonamedirs noauto_name_dirs + \ no_auto_name_dirs noautoparamkeys no_autoparamkeys noauto_param_keys no_auto_param_keys noautoparamslash no_autoparamslash \ noauto_param_slash no_auto_param_slash noautopushd no_autopushd noauto_pushd no_auto_pushd noautoremoveslash no_autoremoveslash - \ noauto_remove_slash no_auto_remove_slash noautoresume no_autoresume noauto_resume no_auto_resume nobadpattern no_badpattern + \ noauto_remove_slash no_auto_remove_slash noautoresume no_autoresume noauto_resume no_auto_resume nobadpattern no_badpattern no_bad_pattern \ nobanghist no_banghist nobang_hist no_bang_hist nobareglobqual no_bareglobqual nobare_glob_qual no_bare_glob_qual \ nobashautolist no_bashautolist nobash_auto_list no_bash_auto_list nobashrematch no_bashrematch nobash_rematch no_bash_rematch - \ nobeep no_beep nobgnice no_bgnice nobraceccl no_braceccl nobrace_ccl no_brace_ccl nobraceexpand no_braceexpand nobrace_expand no_brace_expand + \ nobeep no_beep nobgnice no_bgnice no_bg_nice nobraceccl no_braceccl nobrace_ccl no_brace_ccl nobraceexpand no_braceexpand nobrace_expand no_brace_expand \ nobsdecho no_bsdecho nobsd_echo no_bsd_echo nocaseglob no_caseglob nocase_glob no_case_glob nocasematch no_casematch nocase_match no_case_match - \ nocbases no_cbases nocdablevars no_cdablevars nocd_able_vars no_cd_able_vars nochasedots no_chasedots nochase_dots no_chase_dots + \ nocbases no_cbases no_c_bases nocdablevars no_cdablevars no_cdable_vars nocd_able_vars no_cd_able_vars nochasedots no_chasedots nochase_dots no_chase_dots \ nochaselinks no_chaselinks nochase_links no_chase_links nocheckjobs no_checkjobs nocheck_jobs no_check_jobs \ noclobber no_clobber nocombiningchars no_combiningchars nocombining_chars no_combining_chars nocompletealiases no_completealiases \ nocomplete_aliases no_complete_aliases nocompleteinword no_completeinword nocomplete_in_word no_complete_in_word @@ -224,14 +233,15 @@ syn keyword zshOptions noaliases no_aliases noallexport no_allexport no \ nocorrectall no_correctall nocorrect_all no_correct_all nocprecedences no_cprecedences noc_precedences no_c_precedences \ nocshjunkiehistory no_cshjunkiehistory nocsh_junkie_history no_csh_junkie_history nocshjunkieloops no_cshjunkieloops \ nocsh_junkie_loops no_csh_junkie_loops nocshjunkiequotes no_cshjunkiequotes nocsh_junkie_quotes no_csh_junkie_quotes - \ nocshnullcmd no_cshnullcmd nocsh_null_cmd no_csh_null_cmd nocshnullglob no_cshnullglob nocsh_null_glob no_csh_null_glob + \ nocshnullcmd no_cshnullcmd no_csh_nullcmd nocsh_null_cmd no_csh_null_cmd nocshnullglob no_cshnullglob nocsh_null_glob no_csh_null_glob \ nodebugbeforecmd no_debugbeforecmd nodebug_before_cmd no_debug_before_cmd nodotglob no_dotglob nodot_glob no_dot_glob nodvorak no_dvorak \ noemacs no_emacs noequals no_equals noerrexit no_errexit noerr_exit no_err_exit noerrreturn no_errreturn noerr_return no_err_return noevallineno no_evallineno \ noeval_lineno no_eval_lineno noexec no_exec noextendedglob no_extendedglob noextended_glob no_extended_glob noextendedhistory no_extendedhistory \ noextended_history no_extended_history noflowcontrol no_flowcontrol noflow_control no_flow_control noforcefloat no_forcefloat - \ noforce_float no_force_float nofunctionargzero no_functionargzero nofunction_arg_zero no_function_arg_zero noglob no_glob noglobalexport no_globalexport + \ noforce_float no_force_float nofunctionargzero no_functionargzero nofunction_arg_zero no_function_argzero no_function_arg_zero noglob no_glob noglobalexport no_globalexport \ noglobal_export no_global_export noglobalrcs no_globalrcs noglobal_rcs no_global_rcs noglobassign no_globassign noglob_assign no_glob_assign - \ noglobcomplete no_globcomplete noglob_complete no_glob_complete noglobdots no_globdots noglob_dots no_glob_dots noglob_subst no_glob_subst + \ noglobcomplete no_globcomplete noglob_complete no_glob_complete noglobdots no_globdots noglob_dots no_glob_dots + \ noglobstarshort no_glob_star_short noglob_subst no_glob_subst \ noglobsubst no_globsubst nohashall no_hashall nohash_all no_hash_all nohashcmds no_hashcmds nohash_cmds no_hash_cmds nohashdirs no_hashdirs \ nohash_dirs no_hash_dirs nohashexecutablesonly no_hashexecutablesonly nohash_executables_only no_hash_executables_only nohashlistall no_hashlistall \ nohash_list_all no_hash_list_all nohistallowclobber no_histallowclobber nohist_allow_clobber no_hist_allow_clobber nohistappend no_histappend @@ -262,7 +272,7 @@ syn keyword zshOptions noaliases no_aliases noallexport no_allexport no \ nonumeric_glob_sort no_numeric_glob_sort nooctalzeroes no_octalzeroes nooctal_zeroes no_octal_zeroes noonecmd no_onecmd noone_cmd no_one_cmd \ nooverstrike no_overstrike noover_strike no_over_strike nopathdirs no_pathdirs nopath_dirs no_path_dirs nopathscript no_pathscript \ nopath_script no_path_script nophysical no_physical nopipefail no_pipefail nopipe_fail no_pipe_fail noposixaliases no_posixaliases - \ noposix_aliases no_posix_aliases noposixargzero no_posixargzero noposix_arg_zero no_posix_arg_zero noposixbuiltins no_posixbuiltins + \ noposix_aliases no_posix_aliases noposixargzero no_posixargzero no_posix_argzero noposix_arg_zero no_posix_arg_zero noposixbuiltins no_posixbuiltins \ noposix_builtins no_posix_builtins noposixcd no_posixcd noposix_cd no_posix_cd noposixidentifiers no_posixidentifiers noposix_identifiers no_posix_identifiers \ noposixjobs no_posixjobs noposix_jobs no_posix_jobs noposixstrings no_posixstrings noposix_strings no_posix_strings noposixtraps no_posixtraps \ noposix_traps no_posix_traps noprinteightbit no_printeightbit noprint_eight_bit no_print_eight_bit noprintexitvalue no_printexitvalue @@ -270,8 +280,8 @@ syn keyword zshOptions noaliases no_aliases noallexport no_allexport no \ noprompt_cr no_prompt_cr nopromptpercent no_promptpercent noprompt_percent no_prompt_percent nopromptsp no_promptsp noprompt_sp no_prompt_sp \ nopromptsubst no_promptsubst noprompt_subst no_prompt_subst nopromptvars no_promptvars noprompt_vars no_prompt_vars nopushdignoredups no_pushdignoredups \ nopushd_ignore_dups no_pushd_ignore_dups nopushdminus no_pushdminus nopushd_minus no_pushd_minus nopushdsilent no_pushdsilent nopushd_silent no_pushd_silent - \ nopushdtohome no_pushdtohome nopushd_to_home no_pushd_to_home norcexpandparam no_rcexpandparam norc_expandparam no_rc_expandparam norcquotes no_rcquotes - \ norc_quotes no_rc_quotes norcs no_rcs norecexact no_recexact norec_exact no_rec_exact norematchpcre no_rematchpcre nore_match_pcre no_re_match_pcre + \ nopushdtohome no_pushdtohome nopushd_to_home no_pushd_to_home norcexpandparam no_rcexpandparam norc_expandparam no_rc_expandparam no_rc_expand_param norcquotes no_rcquotes + \ norc_quotes no_rc_quotes norcs no_rcs norecexact no_recexact norec_exact no_rec_exact norematchpcre no_rematchpcre nore_match_pcre no_re_match_pcre no_rematch_pcre \ norestricted no_restricted normstarsilent no_rmstarsilent norm_star_silent no_rm_star_silent normstarwait no_rmstarwait norm_star_wait no_rm_star_wait \ nosharehistory no_sharehistory noshare_history no_share_history noshfileexpansion no_shfileexpansion nosh_file_expansion no_sh_file_expansion \ noshglob no_shglob nosh_glob no_sh_glob noshinstdin no_shinstdin noshin_stdin no_shin_stdin noshnullcmd no_shnullcmd nosh_nullcmd no_sh_nullcmd @@ -279,11 +289,11 @@ syn keyword zshOptions noaliases no_aliases noallexport no_allexport no \ nosh_word_split no_sh_word_split nosinglecommand no_singlecommand nosingle_command no_single_command nosinglelinezle no_singlelinezle nosingle_line_zle no_single_line_zle \ nosourcetrace no_sourcetrace nosource_trace no_source_trace nostdin no_stdin nosunkeyboardhack no_sunkeyboardhack nosun_keyboard_hack no_sun_keyboard_hack \ notrackall no_trackall notrack_all no_track_all notransientrprompt no_transientrprompt notransient_rprompt no_transient_rprompt - \ notrapsasync no_trapsasync notrapasync no_trapasync notypesetsilent no_typesetsilent notype_set_silent no_type_set_silent nounset no_unset noverbose no_verbose novi no_vi - \ nowarncreateglobal no_warncreateglobal nowarn_create_global no_warn_create_global noxtrace no_xtrace nozle no_zle + \ notrapsasync no_trapsasync notrapasync no_trapasync no_traps_async notypesetsilent no_typesetsilent notype_set_silent no_type_set_silent no_typeset_silent \nounset no_unset + \ noverbose no_verbose novi no_vi nowarncreateglobal no_warncreateglobal nowarn_create_global no_warn_create_global noxtrace no_xtrace nozle no_zle syn case match -syn keyword zshTypes float integer local typeset declare +syn keyword zshTypes float integer local typeset declare private " XXX: this may be too much " syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' @@ -303,7 +313,7 @@ syn region zshMathSubst matchgroup=zshSubstDelim transparent \ start='\$((' skip='\\)' \ matchgroup=zshSubstDelim end='))' \ contains=zshParentheses,@zshSubst,zshNumber, - \ @zshDerefs,zshString + \ @zshDerefs,zshString keepend syn region zshBrackets contained transparent start='{' skip='\\}' \ end='}' syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}' diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim index 48c7a3535a..c53dde8ceb 100644 --- a/runtime/vimrc_example.vim +++ b/runtime/vimrc_example.vim @@ -1,8 +1,8 @@ " An example for a vimrc file. " " To use it, copy it to -" for Unix: ~/.vimrc -" for Windows: $VIM\_vimrc +" for Unix: $HOME/.config/nvim/init.vim +" for Windows: %LOCALAPPDATA%\nvim\init.vim set backup " keep a backup file (restore to previous version) set undofile " keep an undo file (undo changes after closing) |