mirror of
https://github.com/zoriya/vim.git
synced 2026-01-09 08:08:05 +00:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b9aecc3a5 | ||
|
|
673af4d304 | ||
|
|
2eec59e30b | ||
|
|
f878bf0da2 | ||
|
|
e6ae6225b4 | ||
|
|
774267bbb9 | ||
|
|
a7b64ce74e | ||
|
|
cac867ad18 | ||
|
|
1dc28783fa | ||
|
|
182dc4f2ab | ||
|
|
e64faa6645 | ||
|
|
d6e391862c | ||
|
|
b52f4c02e6 | ||
|
|
b09d983c78 | ||
|
|
12e4014092 | ||
|
|
66e83d7db0 | ||
|
|
d2470e9fbe | ||
|
|
d7a06b1d71 | ||
|
|
8dd7901a66 | ||
|
|
9bad29decf | ||
|
|
080504921d | ||
|
|
0fabe3fdbe | ||
|
|
09ea9fcf3f | ||
|
|
745fc029ba | ||
|
|
e3c7b86aab | ||
|
|
7fcff1f781 | ||
|
|
ca12d7c004 | ||
|
|
053bb60f44 | ||
|
|
bc0ea8f75e | ||
|
|
10f3a79e89 | ||
|
|
ba40447ab1 | ||
|
|
097c992c46 | ||
|
|
884f6e44e0 | ||
|
|
fbc0d2ea1e | ||
|
|
6fa41fb374 |
1
Filelist
1
Filelist
@@ -57,6 +57,7 @@ SRC_ALL = \
|
||||
src/popupmnu.c \
|
||||
src/quickfix.c \
|
||||
src/regexp.c \
|
||||
src/regexp_nfa.c \
|
||||
src/regexp.h \
|
||||
src/screen.c \
|
||||
src/search.c \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" netrw.vim: Handles file transfer and remote directory listing across
|
||||
" AUTOLOAD SECTION
|
||||
" Date: Apr 16, 2013
|
||||
" Version: 148
|
||||
" Date: May 18, 2013
|
||||
" Version: 149
|
||||
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
|
||||
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
|
||||
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
|
||||
@@ -22,7 +22,7 @@
|
||||
if &cp || exists("g:loaded_netrw")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrw = "v148"
|
||||
let g:loaded_netrw = "v149"
|
||||
if v:version < 703 || (v:version == 703 && !has("patch465"))
|
||||
echohl WarningMsg
|
||||
echo "***warning*** this version of netrw needs vim 7.3.465 or later"
|
||||
@@ -49,12 +49,12 @@ set cpo&vim
|
||||
" 0=note = s:NOTE
|
||||
" 1=warning = s:WARNING
|
||||
" 2=error = s:ERROR
|
||||
" Apr 02, 2013 : max errnum currently is 92
|
||||
" May 01, 2013 : max errnum currently is 93
|
||||
fun! netrw#ErrorMsg(level,msg,errnum)
|
||||
" call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow)
|
||||
|
||||
if a:level < g:netrw_errorlvl
|
||||
" call Dret("netrw#ErrorMsg : suppressing level=".a:level." since g;netrw_errorlvl=".g:netrw_errorlvl)
|
||||
" call Dret("netrw#ErrorMsg : suppressing level=".a:level." since g:netrw_errorlvl=".g:netrw_errorlvl)
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -128,7 +128,7 @@ endfun
|
||||
" 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)
|
||||
if !exists(a:varname)
|
||||
if type(a:value) == 0
|
||||
exe "let ".a:varname."=".a:value
|
||||
@@ -202,7 +202,20 @@ if !exists("g:netrw_http_cmd")
|
||||
endif
|
||||
call s:NetrwInit("g:netrw_rcp_cmd" , "rcp")
|
||||
call s:NetrwInit("g:netrw_rsync_cmd", "rsync")
|
||||
call s:NetrwInit("g:netrw_scp_cmd" , "scp -q")
|
||||
if !exists("g:netrw_scp_cmd")
|
||||
if executable("scp")
|
||||
call s:NetrwInit("g:netrw_scp_cmd" , "scp -q")
|
||||
elseif executable("pscp")
|
||||
if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable('c:\private.ppk')
|
||||
call s:NetrwInit("g:netrw_scp_cmd", 'pscp -i c:\private.ppk')
|
||||
else
|
||||
call s:NetrwInit("g:netrw_scp_cmd", 'pscp -q')
|
||||
endif
|
||||
else
|
||||
call s:NetrwInit("g:netrw_scp_cmd" , "scp -q")
|
||||
endif
|
||||
endif
|
||||
|
||||
call s:NetrwInit("g:netrw_sftp_cmd" , "sftp")
|
||||
call s:NetrwInit("g:netrw_ssh_cmd" , "ssh")
|
||||
|
||||
@@ -278,19 +291,23 @@ if !exists("g:netrw_ignorenetrc")
|
||||
endif
|
||||
call s:NetrwInit("g:netrw_keepdir",1)
|
||||
if !exists("g:netrw_list_cmd")
|
||||
|
||||
if g:netrw_scp_cmd =~ '^pscp' && executable("pscp")
|
||||
" provide a 'pscp' listing command
|
||||
if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable("c:\\private.ppk")
|
||||
" provide a pscp-based listing command
|
||||
let g:netrw_scp_cmd ="pscp -i C:\\private.ppk"
|
||||
endif
|
||||
let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:"
|
||||
|
||||
elseif executable(g:netrw_ssh_cmd)
|
||||
" provide a default listing command
|
||||
" provide a scp-based default listing command
|
||||
let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa"
|
||||
|
||||
else
|
||||
" call Decho(g:netrw_ssh_cmd." is not executable")
|
||||
let g:netrw_list_cmd= ""
|
||||
endif
|
||||
|
||||
endif
|
||||
call s:NetrwInit("g:netrw_list_hide","")
|
||||
" Default values - lh-lz ---------- {{{3
|
||||
@@ -474,7 +491,7 @@ endif
|
||||
" NetrwBrowse.
|
||||
" 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("$"))
|
||||
" 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"))
|
||||
|
||||
if !exists("{a:vt}netrw_optionsave")
|
||||
@@ -730,10 +747,16 @@ 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("%"))
|
||||
if !exists("b:netrw_curdir")
|
||||
let b:netrw_curdir= getcwd()
|
||||
if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
|
||||
let b:netrw_curdir= substitute(b:netrw_curdir,'\','/','g')
|
||||
endif
|
||||
" call Decho("(Explore) set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)")
|
||||
endif
|
||||
let curdir = simplify(b:netrw_curdir)
|
||||
let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
|
||||
if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16"))
|
||||
let curdir= substitute(curdir,'\','/','g')
|
||||
endif
|
||||
" call Decho("(Explore) curdir<".curdir."> curfiledir<".curfiledir.">")
|
||||
|
||||
" save registers
|
||||
@@ -793,7 +816,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
|
||||
keepj norm! 0
|
||||
|
||||
if a:0 > 0
|
||||
" call Decho("(Explore) case [a:0=".a:0."] > 0")
|
||||
" call Decho("(Explore) case [a:0=".a:0."] > 0: a:1<".a:1.">")
|
||||
if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin))
|
||||
" call Decho("(Explore) ..case a:1<".a:1.">: starts with ~ and unix or cygwin")
|
||||
let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),''))
|
||||
@@ -809,7 +832,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
|
||||
" call Decho("(Explore) ..case a:1<".a:1.">: matches ending $")
|
||||
let dirname= simplify(expand(a:1))
|
||||
" call Decho("(Explore) ..using user-specified dirname<".dirname."> with $env-var")
|
||||
elseif a:1 !~ '^\*\{1,2}/'
|
||||
elseif a:1 !~ '^\*\{1,2}/' && a:1 !~ '^\a\{3,}://'
|
||||
" call Decho("(Explore) ..case a:1<".a:1.">: other, not pattern or filepattern")
|
||||
let dirname= simplify(a:1)
|
||||
" call Decho("(Explore) ..using user-specified dirname<".dirname.">")
|
||||
@@ -835,7 +858,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
|
||||
|
||||
if dirname =~ '^\*//'
|
||||
" starpat=1: Explore *//pattern (current directory only search for files containing pattern)
|
||||
" call Decho("(Explore) case Explore *//pattern")
|
||||
" call Decho("(Explore) case starpat=1: Explore *//pattern")
|
||||
let pattern= substitute(dirname,'^\*//\(.*\)$','\1','')
|
||||
let starpat= 1
|
||||
" call Decho("(Explore) ..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">")
|
||||
@@ -843,14 +866,14 @@ fun! netrw#Explore(indx,dosplit,style,...)
|
||||
|
||||
elseif dirname =~ '^\*\*//'
|
||||
" starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
|
||||
" call Decho("(Explore) case Explore **//pattern")
|
||||
" call Decho("(Explore) case starpat=2: Explore **//pattern")
|
||||
let pattern= substitute(dirname,'^\*\*//','','')
|
||||
let starpat= 2
|
||||
" call Decho("(Explore) ..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">")
|
||||
|
||||
elseif dirname =~ '/\*\*/'
|
||||
" handle .../**/.../filepat
|
||||
" call Decho("(Explore) case Explore .../**/.../filepat")
|
||||
" call Decho("(Explore) case starpat=4: Explore .../**/.../filepat")
|
||||
let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','')
|
||||
if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16")))
|
||||
let b:netrw_curdir = prefixdir
|
||||
@@ -863,32 +886,40 @@ fun! netrw#Explore(indx,dosplit,style,...)
|
||||
" call Decho("(Explore) ..case Explore ../**/../filepat (starpat=".starpat.")")
|
||||
|
||||
elseif dirname =~ '^\*/'
|
||||
" starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
|
||||
" case starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
|
||||
let starpat= 3
|
||||
" call Decho("(Explore) case Explore */filepat (starpat=".starpat.")")
|
||||
" call Decho("(Explore) case starpat=3: Explore */filepat (starpat=".starpat.")")
|
||||
|
||||
elseif dirname=~ '^\*\*/'
|
||||
" starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
|
||||
let starpat= 4
|
||||
" call Decho("(Explore) case Explore **/filepat (starpat=".starpat.")")
|
||||
" call Decho("(Explore) case starpat=4: Explore **/filepat (starpat=".starpat.")")
|
||||
|
||||
else
|
||||
let starpat= 0
|
||||
" call Decho("(Explore) default case: starpat=".starpat)
|
||||
" call Decho("(Explore) case starpat=0: default")
|
||||
endif
|
||||
|
||||
if starpat == 0 && a:indx >= 0
|
||||
" [Explore Hexplore Vexplore Sexplore] [dirname]
|
||||
" call Decho("(Explore) case starpat==0 && a:indx=".a:indx.": dirname<".dirname."> Explore Hexplore Vexplore Sexplore")
|
||||
" call Decho("(Explore) case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore")
|
||||
if dirname == ""
|
||||
let dirname= curfiledir
|
||||
" call Decho("(Explore) ..empty dirname, using current file's directory<".dirname.">")
|
||||
endif
|
||||
if dirname =~ '^scp:' || dirname =~ '^ftp:'
|
||||
" call Decho("(Explore) ..calling NetrwBrowse(0,dirname<".dirname.">)")
|
||||
call s:NetrwBrowse(0,dirname)
|
||||
if dirname =~ '^scp://' || dirname =~ '^ftp://'
|
||||
call netrw#Nread(2,dirname)
|
||||
"call s:NetrwBrowse(0,dirname)
|
||||
else
|
||||
if dirname == ""|let dirname= getcwd()|endif
|
||||
if dirname == ""
|
||||
let dirname= getcwd()
|
||||
elseif (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin
|
||||
if dirname !~ '^[a-zA-Z]:'
|
||||
let dirname= b:netrw_curdir."/".dirname
|
||||
endif
|
||||
elseif dirname !~ '^/'
|
||||
let dirname= b:netrw_curdir."/".dirname
|
||||
endif
|
||||
" call Decho("(Explore) ..calling LocalBrowseCheck(dirname<".dirname.">)")
|
||||
call netrw#LocalBrowseCheck(dirname)
|
||||
" call Decho("(Explore) win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly)
|
||||
@@ -1508,7 +1539,7 @@ endfun
|
||||
" =2 replace with remote file
|
||||
" =3 obtain file, but leave in temporary format
|
||||
fun! netrw#NetRead(mode,...)
|
||||
" call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw)
|
||||
" call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw.((a:0 > 0)? " a:1<".a:1.">" : ""))
|
||||
|
||||
" NetRead: save options {{{3
|
||||
call s:NetrwOptionSave("w:")
|
||||
@@ -2404,7 +2435,6 @@ fun! s:NetrwGetFile(readcmd, tfile, method)
|
||||
" call Decho("detect filetype of local version of remote file")
|
||||
let iskkeep= &l:isk
|
||||
setl isk-=/
|
||||
" filetype detect " COMBAK - trying filetype detect in NetrwOptionRestore Jan 24, 2013
|
||||
let &l:isk= iskkeep
|
||||
" call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!")
|
||||
let line1 = 1
|
||||
@@ -2611,8 +2641,7 @@ fun! s:NetrwMethod(choice)
|
||||
" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">")
|
||||
" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">")
|
||||
if g:netrw_ftp_cmd =~ '-[sS]:\S*MACHINE\>'
|
||||
let machine = substitute(g:netrw_machine,'\([^.]\+\)\.\S*','\1','')
|
||||
let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\<MACHINE\>',machine.".ftp",'')
|
||||
let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\<MACHINE\>',g:netrw_machine,'')
|
||||
" call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">")
|
||||
endif
|
||||
let b:netrw_method= 2
|
||||
@@ -3477,7 +3506,6 @@ 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("(NetrwBrowse) tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly)
|
||||
" call Dredir("ls!")
|
||||
" s:NetrwBrowse: initialize history {{{3
|
||||
if !exists("s:netrw_initbookhist")
|
||||
keepj call s:NetrwBookHistRead()
|
||||
@@ -3759,6 +3787,7 @@ endfun
|
||||
" 1=re-used buffer
|
||||
fun! s:NetrwGetBuffer(islocal,dirname)
|
||||
" call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle)
|
||||
" call Decho("(NetrwGetBuffer) modiable=".&mod." modifiable=".&ma." readonly=".&ro)
|
||||
let dirname= a:dirname
|
||||
|
||||
" re-use buffer if possible {{{3
|
||||
@@ -3767,8 +3796,9 @@ fun! s:NetrwGetBuffer(islocal,dirname)
|
||||
" find NetrwTreeList buffer if there is one
|
||||
" call Decho("(NetrwGetBuffer) case liststyle=treelist: find NetrwTreeList buffer if there is one")
|
||||
if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0
|
||||
" call Decho("(NetrwGetBuffer) re-use w:netrw_treebufnr=".w:netrw_treebufnr)
|
||||
sil keepj %d
|
||||
" call Decho("(NetrwGetBuffer) re-using w:netrw_treebufnr=".w:netrw_treebufnr)
|
||||
setl mod
|
||||
sil! keepj %d
|
||||
let eikeep= &ei
|
||||
set ei=all
|
||||
exe "sil! keepalt b ".w:netrw_treebufnr
|
||||
@@ -3782,7 +3812,6 @@ fun! s:NetrwGetBuffer(islocal,dirname)
|
||||
else
|
||||
" find buffer number of buffer named precisely the same as dirname {{{3
|
||||
" call Decho("(NetrwGetBuffer) case listtyle not treelist: find buffer numnber of buffer named precisely the same as dirname--")
|
||||
" call Dredir("ls!")
|
||||
|
||||
" get dirname and associated buffer number
|
||||
let bufnum = bufnr(escape(dirname,'\'))
|
||||
@@ -4079,7 +4108,6 @@ fun! s:NetrwListSettings(islocal)
|
||||
if g:netrw_use_noswf
|
||||
setl noswf
|
||||
endif
|
||||
" call Dredir("ls!")
|
||||
" call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1))
|
||||
exe "setl ts=".(g:netrw_maxfilenamelen+1)
|
||||
setl isk+=.,~,-
|
||||
@@ -4211,14 +4239,14 @@ 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)
|
||||
let bmd= escape(bmd,g:netrw_menu_escape)
|
||||
let ebmd= escape(bmd,g:netrw_menu_escape)
|
||||
" call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.ebmd.' :e '.bmd)
|
||||
|
||||
" show bookmarks for goto menu
|
||||
exe 'sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmd.' :e '.bmd."\<cr>"
|
||||
exe 'sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.ebmd.' :e '.bmd."\<cr>"
|
||||
|
||||
" show bookmarks for deletion menu
|
||||
exe 'sil! menu '.g:NetrwMenuPriority.".8.2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete.'.bmd.' '.cnt."mB"
|
||||
exe 'sil! menu '.g:NetrwMenuPriority.".8.2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete.'.ebmd.' '.cnt."mB"
|
||||
let cnt= cnt + 1
|
||||
endfor
|
||||
|
||||
@@ -4264,7 +4292,6 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
|
||||
let @@= ykeep
|
||||
" call Decho("(NetrwBrowseChgDir) b:netrw_curdir doesn't exist!")
|
||||
" call Decho("(NetrwBrowseChgDir) getcwd<".getcwd().">")
|
||||
" call Dredir("ls!")
|
||||
" call Dret("s:NetrwBrowseChgDir")
|
||||
return
|
||||
endif
|
||||
@@ -5467,8 +5494,13 @@ endfun
|
||||
" directories. Uses the local-buffer marked file list.
|
||||
" Returns 1=success (used by NetrwMarkFileMove())
|
||||
" 0=failure
|
||||
fun! s:NetrwMarkFileCopy(islocal)
|
||||
" call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---').">")
|
||||
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 curbufnr = bufnr("%")
|
||||
|
||||
@@ -5495,8 +5527,45 @@ fun! s:NetrwMarkFileCopy(islocal)
|
||||
" call Dfunc("s:NetrwMarkFileMove : g:netrw_localcopycmd<".g:netrw_localcopycmd."> n/a!")
|
||||
return
|
||||
endif
|
||||
let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)"))
|
||||
let tgt = shellescape(s:netrwmftgt)
|
||||
|
||||
" copy marked files while within the same directory (ie. allow renaming)
|
||||
if simplify(s:netrwmftgt) == simplify(b:netrw_curdir)
|
||||
if len(s:netrwmarkfilelist_{bufnr('%')}) == 1
|
||||
" only one marked file
|
||||
let args = shellescape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0])
|
||||
let oldname = s:netrwmarkfilelist_{bufnr('%')}[0]
|
||||
elseif a:0 == 1
|
||||
" this happens when the next case was used to recursively call s:NetrwMarkFileCopy()
|
||||
let args = shellescape(b:netrw_curdir."/".a:1)
|
||||
let oldname = a:1
|
||||
else
|
||||
" copy multiple marked files inside the same directory
|
||||
let s:recursive= 1
|
||||
for oldname in s:netrwmarkfilelist_{bufnr("%")}
|
||||
let ret= s:NetrwMarkFileCopy(a:islocal,oldname)
|
||||
if ret == 0
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
unlet s:recursive
|
||||
call s:NetrwUnmarkList(curbufnr,curdir)
|
||||
" call Dret("s:NetrwMarkFileCopy ".ret)
|
||||
return ret
|
||||
endif
|
||||
|
||||
call inputsave()
|
||||
let newname= input("Copy ".oldname." to : ",oldname,"file")
|
||||
call inputrestore()
|
||||
if newname == ""
|
||||
" call Dret("s:NetrwMarkFileCopy 0")
|
||||
return 0
|
||||
endif
|
||||
let args= shellescape(oldname)
|
||||
let tgt = shellescape(s:netrwmftgt.'/'.newname)
|
||||
else
|
||||
let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)"))
|
||||
let tgt = shellescape(s:netrwmftgt)
|
||||
endif
|
||||
if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
|
||||
let args= substitute(args,'/','\\','g')
|
||||
let tgt = substitute(tgt, '/','\\','g')
|
||||
@@ -5525,10 +5594,12 @@ fun! s:NetrwMarkFileCopy(islocal)
|
||||
keepj 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")
|
||||
keepj call netrw#NetrwObtain(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")
|
||||
let curdir = getcwd()
|
||||
let tmpdir = s:GetTempfile("")
|
||||
@@ -5570,10 +5641,11 @@ fun! s:NetrwMarkFileCopy(islocal)
|
||||
" -------
|
||||
" cleanup
|
||||
" -------
|
||||
" call Decho("cleanup")
|
||||
|
||||
" remove markings from local buffer
|
||||
call s:NetrwUnmarkList(curbufnr,curdir)
|
||||
" call Decho("cleanup")
|
||||
if !exists("s:recursive")
|
||||
" remove markings from local buffer
|
||||
call s:NetrwUnmarkList(curbufnr,curdir)
|
||||
endif
|
||||
|
||||
" refresh buffers
|
||||
if !s:netrwmftgt_islocal
|
||||
@@ -5861,7 +5933,6 @@ fun! s:NetrwMarkFileVimCmd(islocal)
|
||||
exe cmd
|
||||
exe "sil! keepalt wq!"
|
||||
else
|
||||
" COMBAK -- not supported yet
|
||||
" call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET")
|
||||
echo "sorry, \"mX\" not supported yet for remote files"
|
||||
endif
|
||||
@@ -7489,11 +7560,20 @@ fun! s:NetrwWideListing()
|
||||
sil! let @*= keepregstar
|
||||
exe "sil! keepj ".w:netrw_bannercnt.',$s/\s\+$//e'
|
||||
keepj call histdel("/",-1)
|
||||
exe "nmap <buffer> <silent> w /^\\\\|\\s\\s\\zs\\S/\<cr>"
|
||||
exe "nmap <buffer> <silent> b ?^\\\\|\\s\\s\\zs\\S?\<cr>"
|
||||
" call Decho("NetrwWideListing) setl noma nomod ro")
|
||||
setl noma nomod ro
|
||||
" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)")
|
||||
" call Dret("NetrwWideListing")
|
||||
return
|
||||
else
|
||||
if hasmapto("w","n")
|
||||
sil! nunmap <buffer> w
|
||||
endif
|
||||
if hasmapto("b","n")
|
||||
sil! nunmap <buffer> b
|
||||
endif
|
||||
endif
|
||||
|
||||
endfun
|
||||
@@ -7537,7 +7617,11 @@ fun! s:PerformListing(islocal)
|
||||
" call Decho("(PerformListing) set up banner")
|
||||
keepj call setline(1,'" ============================================================================')
|
||||
keepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')')
|
||||
keepj call setline(3,'" '.b:netrw_curdir)
|
||||
if exists("g:netrw_bannerbackslash") && g:netrw_bannerbackslash
|
||||
keepj call setline(3,'" '.substitute(b:netrw_curdir,'/','\\','g'))
|
||||
else
|
||||
keepj call setline(3,'" '.b:netrw_curdir)
|
||||
endif
|
||||
let w:netrw_bannercnt= 3
|
||||
keepj exe "sil! keepj ".w:netrw_bannercnt
|
||||
else
|
||||
@@ -7606,7 +7690,7 @@ fun! s:PerformListing(islocal)
|
||||
if g:netrw_banner
|
||||
let w:netrw_bannercnt= w:netrw_bannercnt + 1
|
||||
exe "sil! keepj ".w:netrw_bannercnt
|
||||
" call Decho("(PerformListing) bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"))
|
||||
" call Decho("(PerformListing) w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"))
|
||||
endif
|
||||
|
||||
" get list of files
|
||||
@@ -7616,12 +7700,13 @@ fun! s:PerformListing(islocal)
|
||||
else " remote
|
||||
keepj call s:NetrwRemoteListing()
|
||||
endif
|
||||
" call Decho("(PerformListing) g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)")
|
||||
|
||||
" manipulate the directory listing (hide, sort) {{{3
|
||||
if !exists("w:netrw_bannercnt")
|
||||
let w:netrw_bannercnt= 0
|
||||
endif
|
||||
" call Decho("(PerformListing) g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)")
|
||||
|
||||
if !g:netrw_banner || line("$") >= w:netrw_bannercnt
|
||||
" call Decho("(PerformListing) manipulate directory listing (hide)")
|
||||
" call Decho("(PerformListing) g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">")
|
||||
@@ -7763,10 +7848,18 @@ fun! s:NetrwRemoteListing()
|
||||
" call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">)")
|
||||
|
||||
call s:RemotePathAnalysis(b:netrw_curdir)
|
||||
" call Decho("b:netrw_method#".(exists("b:netrw_method")? b:netrw_method : 'n/a'))
|
||||
" call Decho("g:netrw_list_cmd<".(exists("g:netrw_list_cmd")? g:netrw_list_cmd : 'n/a').">")
|
||||
" call Decho("ssh is ".(executable("ssh")? "" : "not ")."executable")
|
||||
" call Decho("ftp is ".(executable("ftp")? "" : "not ")."executable")
|
||||
" call Decho("sftp is ".(executable("sftp")? "" : "not ")."executable")
|
||||
|
||||
" sanity check:
|
||||
if exists("b:netrw_method") && b:netrw_method =~ '[235]'
|
||||
" call Decho("b:netrw_method=".b:netrw_method)
|
||||
" b:netrw_method = 2: ftp+.netrc
|
||||
" b:netrw_method = 3: ftp+machine,id,p/w,filename (ie. no .netrc)
|
||||
" b:netrw_method = 5: wget (http)
|
||||
" call Decho("b:netrw_method=".b:netrw_method." (for ".s:method.")")
|
||||
if !executable("ftp")
|
||||
if !exists("g:netrw_quiet")
|
||||
call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ftp",18)
|
||||
@@ -7776,10 +7869,11 @@ fun! s:NetrwRemoteListing()
|
||||
return
|
||||
endif
|
||||
|
||||
elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ''
|
||||
elseif s:method == "scp" && (!exists("g:netrw_list_cmd") || g:netrw_list_cmd == '')
|
||||
" call Decho("g:netrw_list_cmd<".(exists("g:netrw_list_cmd")? g:netrw_list_cmd : 'n/a').">")
|
||||
if !exists("g:netrw_quiet")
|
||||
if g:netrw_list_cmd == ""
|
||||
keepj call netrw#ErrorMsg(s:ERROR,g:netrw_ssh_cmd." is not executable on your system",47)
|
||||
if !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ""
|
||||
keepj call netrw#ErrorMsg(s:ERROR,"neither ssh nor ftp"." is executable on your system",47)
|
||||
else
|
||||
keepj call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19)
|
||||
endif
|
||||
@@ -7791,15 +7885,15 @@ fun! s:NetrwRemoteListing()
|
||||
endif " (remote handling sanity check)
|
||||
|
||||
if exists("b:netrw_method")
|
||||
" call Decho("setting w:netrw_method<".b:netrw_method.">")
|
||||
" call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">")
|
||||
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")
|
||||
let s:method = "ftp"
|
||||
let listcmd = g:netrw_ftp_list_cmd
|
||||
let s:method = "ftp"
|
||||
let listcmd = g:netrw_ftp_list_cmd
|
||||
if g:netrw_sort_by =~ '^t'
|
||||
let listcmd= g:netrw_ftp_timelist_cmd
|
||||
elseif g:netrw_sort_by =~ '^s'
|
||||
@@ -7822,15 +7916,14 @@ fun! s:NetrwRemoteListing()
|
||||
sil! keepj %s/\r$//e
|
||||
keepj call histdel("/",-1)
|
||||
|
||||
" if there's no ../ listed, then put ./ and ../ in
|
||||
" if there's no ../ listed, then put ../ in
|
||||
let line1= line(".")
|
||||
exe "sil! keepj ".w:netrw_bannercnt
|
||||
let line2= search('\.\.\/\%(\s\|$\)','cnW')
|
||||
" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt)
|
||||
if line2 == 0
|
||||
" call Decho("netrw is putting ./ and ../ into listing")
|
||||
" call Decho("netrw is putting ../ into listing")
|
||||
sil! keepj put='../'
|
||||
sil! keepj put='./'
|
||||
endif
|
||||
exe "sil! keepj ".line1
|
||||
sil! keepj norm! 0
|
||||
@@ -7899,13 +7992,12 @@ fun! s:NetrwRemoteListing()
|
||||
while getline('.') =~ g:netrw_ftp_browse_reject
|
||||
sil! keepj d
|
||||
endwhile
|
||||
" if there's no ../ listed, then put ./ and ../ in
|
||||
" if there's no ../ listed, then put ../ in
|
||||
let line1= line(".")
|
||||
sil! keepj 1
|
||||
sil! keepj call search('^\.\.\/\%(\s\|$\)','W')
|
||||
let line2= line(".")
|
||||
if line2 == 0
|
||||
exe 'sil! keepj '.w:netrw_bannercnt."put='./'"
|
||||
if b:netrw_curdir != '/'
|
||||
exe 'sil! keepj '.w:netrw_bannercnt."put='../'"
|
||||
endif
|
||||
@@ -8103,8 +8195,17 @@ endfun
|
||||
" and reverse sorts will be requested of the server but not otherwise
|
||||
" enforced here.
|
||||
fun! s:NetrwRemoteFtpCmd(path,listcmd)
|
||||
" call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) netrw_method=".w:netrw_method)
|
||||
" call Decho("line($)=".line("$")." bannercnt=".w:netrw_bannercnt)
|
||||
" 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)
|
||||
if !exists("w:netrw_method")
|
||||
if exists("b:netrw_method")
|
||||
let w:netrw_method= b:netrw_method
|
||||
else
|
||||
call netrw#ErrorMsg(2,"(s:NetrwRemoteFtpCmd) internal netrw error",93)
|
||||
" call Dret("NetrwRemoteFtpCmd")
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
" because WinXX ftp uses unix style input
|
||||
let ffkeep= &ff
|
||||
@@ -8359,7 +8460,7 @@ fun! netrw#LocalBrowseCheck(dirname)
|
||||
" call Dredir("LocalBrowseCheck","ls!")|redraw!|sleep 3
|
||||
let ykeep= @@
|
||||
if isdirectory(a:dirname)
|
||||
" call Decho("(LocalBrowseCheck) 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)
|
||||
" call Decho("(LocalBrowseCheck) 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#NetrwSavePosn()
|
||||
if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1
|
||||
sil! keepj keepalt call s:NetrwBrowse(1,a:dirname)
|
||||
@@ -8407,9 +8508,11 @@ fun! s:LocalListing()
|
||||
let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1)
|
||||
" call Decho("(LocalListing) filelist=".filelist)
|
||||
|
||||
if index(filelist,'..') == -1 && b:netrw_curdir != '/'
|
||||
if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16"))
|
||||
" call Decho("(LocalListing) filelist=".string(filelist))
|
||||
elseif index(filelist,'..') == -1 && b:netrw_curdir !~ '/'
|
||||
" include ../ in the glob() entry if its missing
|
||||
" call Decho("(LocalListing) forcibly tacking on \"..\"")
|
||||
" call Decho("(LocalListing) forcibly including on \"..\"")
|
||||
let filelist= filelist+[s:ComposePath(b:netrw_curdir,"../")]
|
||||
" call Decho("(LocalListing) filelist=".string(filelist))
|
||||
endif
|
||||
@@ -8903,6 +9006,26 @@ endfun
|
||||
" ---------------------------------------------------------------------
|
||||
" Support Functions: {{{1
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" 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.">)")
|
||||
if (!g:netrw_cygwin || &shell !~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16"))
|
||||
" remove cygdrive prefix, if present
|
||||
let path = substitute(a:path,'/cygdrive/\(.\)','\1:','')
|
||||
" remove trailing slash (Win95)
|
||||
let path = substitute(path, '\(\\\|/\)$', '', 'g')
|
||||
" remove escaped spaces
|
||||
let path = substitute(path, '\ ', ' ', 'g')
|
||||
" convert slashes to backslashes
|
||||
let path = substitute(path, '/', '\', 'g')
|
||||
else
|
||||
let path= a:path
|
||||
endif
|
||||
" call Dret("netrw#WinPath <".path.">")
|
||||
return path
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" netrw#NetrwRestorePosn: restores the cursor and file position as saved by NetrwSavePosn() {{{2
|
||||
fun! netrw#NetrwRestorePosn(...)
|
||||
@@ -8968,6 +9091,21 @@ fun! netrw#NetrwSavePosn()
|
||||
return ret
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" netrw#NetrwAccess: intended to provide access to variable values for netrw's test suite {{{2
|
||||
" 0: marked file list of current buffer
|
||||
" 1: marked file target
|
||||
fun! netrw#NetrwAccess(ilist)
|
||||
if a:ilist == 0
|
||||
if exists("s:netrwmarkfilelist_".bufnr('%'))
|
||||
return s:netrwmarkfilelist_{bufnr('%')}
|
||||
else
|
||||
return "no-list-buf#".bufnr('%')
|
||||
endif
|
||||
elseif a:ilist == 1
|
||||
return s:netrwmftgt
|
||||
endfun
|
||||
|
||||
" ------------------------------------------------------------------------
|
||||
" netrw#RFC2396: converts %xx into characters {{{2
|
||||
fun! netrw#RFC2396(fname)
|
||||
@@ -9223,7 +9361,7 @@ endfun
|
||||
" ---------------------------------------------------------------------
|
||||
" s:RestoreCursorline: restores cursorline/cursorcolumn to original user settings {{{2
|
||||
fun! s:RestoreCursorline()
|
||||
" call Dfunc("s:RestoreCursorline() currently, cul=".&l:cursorline." cuc=".&l:cursorcolumn." win#".winnr()." buf#".bufnr("%"))
|
||||
" call Dfunc("s:RestoreCursorline() currently, cul=".&l:cursorline." cuc=".&l:cursorcolumn." win#".winnr()." buf#".bufnr("%")." mod=".&mod)
|
||||
if exists("s:netrw_usercul")
|
||||
let &l:cursorline = s:netrw_usercul
|
||||
endif
|
||||
@@ -9292,11 +9430,7 @@ fun! s:NetrwEnew(...)
|
||||
keepj call s:NetrwOptionRestore("w:")
|
||||
" call Decho("generate a buffer with keepjumps keepalt enew!")
|
||||
let netrw_keepdiff= &l:diff
|
||||
" COMBAK: Benzinger: using tree mode, vim -o Foo/ file shows Foo/ Foo/ instead. Place return here, problem goes away (beeps result, but who knows)
|
||||
" call Dredir("Benzinger 1:","ls!")
|
||||
keepj keepalt enew!
|
||||
" call Dredir("Benzinger 2:","ls!")
|
||||
" COMBAK: Benzinger: using tree mode, vim -o Foo/ file shows Foo/ Foo/ instead. Place return here, problem remains.
|
||||
let &l:diff= netrw_keepdiff
|
||||
" call Decho("bufnr($)=".bufnr("$"))
|
||||
keepj call s:NetrwOptionSave("w:")
|
||||
@@ -9715,27 +9849,7 @@ fun! s:UseBufWinVars()
|
||||
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.">)")
|
||||
if (!g:netrw_cygwin || &shell !~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16"))
|
||||
" remove cygdrive prefix, if present
|
||||
let path = substitute(a:path,'/cygdrive/\(.\)','\1:','')
|
||||
" remove trailing slash (Win95)
|
||||
let path = substitute(path, '\(\\\|/\)$', '', 'g')
|
||||
" remove escaped spaces
|
||||
let path = substitute(path, '\ ', ' ', 'g')
|
||||
" convert slashes to backslashes
|
||||
let path = substitute(path, '/', '\', 'g')
|
||||
else
|
||||
let path= a:path
|
||||
endif
|
||||
" call Dret("netrw#WinPath <".path.">")
|
||||
return path
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Settings Restoration: {{{2
|
||||
" Settings Restoration: {{{1
|
||||
let &cpo= s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
" netrwFileHandlers: contains various extension-based file handlers for
|
||||
" netrw's browsers' x command ("eXecute launcher")
|
||||
" Author: Charles E. Campbell
|
||||
" Date: Mar 14, 2012
|
||||
" Version: 11a
|
||||
" Date: May 03, 2013
|
||||
" Version: 11b ASTRO-ONLY
|
||||
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
@@ -20,7 +20,7 @@
|
||||
if exists("g:loaded_netrwFileHandlers") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwFileHandlers= "v11a"
|
||||
let g:loaded_netrwFileHandlers= "v11b"
|
||||
if v:version < 702
|
||||
echohl WarningMsg
|
||||
echo "***warning*** this version of netrwFileHandlers needs vim 7.2"
|
||||
@@ -34,10 +34,10 @@ set cpo&vim
|
||||
" netrwFileHandlers#Invoke: {{{1
|
||||
fun! netrwFileHandlers#Invoke(exten,fname)
|
||||
" call Dfunc("netrwFileHandlers#Invoke(exten<".a:exten."> fname<".a:fname.">)")
|
||||
let fname= a:fname
|
||||
let exten= a:exten
|
||||
" list of supported special characters. Consider rcs,v --- that can be
|
||||
" supported with a NFH_rcsCOMMAv() handler
|
||||
if a:fname =~ '[@:,$!=\-+%?;~]'
|
||||
if exten =~ '[@:,$!=\-+%?;~]'
|
||||
let specials= {
|
||||
\ '@' : 'AT',
|
||||
\ ':' : 'COLON',
|
||||
@@ -51,18 +51,18 @@ fun! netrwFileHandlers#Invoke(exten,fname)
|
||||
\ '?' : 'QUESTION',
|
||||
\ ';' : 'SEMICOLON',
|
||||
\ '~' : 'TILDE'}
|
||||
let fname= substitute(a:fname,'[@:,$!=\-+%?;~]','\=specials[submatch(0)]','ge')
|
||||
let exten= substitute(a:exten,'[@:,$!=\-+%?;~]','\=specials[submatch(0)]','ge')
|
||||
" call Decho('fname<'.fname.'> done with dictionary')
|
||||
endif
|
||||
|
||||
if a:exten != "" && exists("*NFH_".a:exten)
|
||||
if a:exten != "" && exists("*NFH_".exten)
|
||||
" support user NFH_*() functions
|
||||
" call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")')
|
||||
exe "let ret= NFH_".a:exten.'("'.fname.'")'
|
||||
elseif a:exten != "" && exists("*s:NFH_".a:exten)
|
||||
exe "let ret= NFH_".exten.'("'.a:fname.'")'
|
||||
elseif a:exten != "" && exists("*s:NFH_".exten)
|
||||
" use builtin-NFH_*() functions
|
||||
" call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")')
|
||||
exe "let ret= s:NFH_".a:exten.'("'.fname.'")'
|
||||
exe "let ret= s:NFH_".a:exten.'("'.a:fname.'")'
|
||||
endif
|
||||
|
||||
" call Dret("netrwFileHandlers#Invoke 0 : ret=".ret)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" netrwSettings.vim: makes netrw settings simpler
|
||||
" Date: Sep 03, 2008
|
||||
" Date: May 03, 2013
|
||||
" Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz>
|
||||
" Version: 13
|
||||
" Version: 14a ASTRO-ONLY
|
||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
@@ -19,7 +19,7 @@
|
||||
if exists("g:loaded_netrwSettings") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwSettings = "v13"
|
||||
let g:loaded_netrwSettings = "v14a"
|
||||
if v:version < 700
|
||||
echohl WarningMsg
|
||||
echo "***warning*** this version of netrwSettings needs vim 7.0"
|
||||
@@ -88,6 +88,7 @@ fun! netrwSettings#NetrwSettings()
|
||||
put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
|
||||
put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
|
||||
put = 'let g:netrw_sshport = '.g:netrw_sshport
|
||||
put = 'let g:netrw_silent = '.g:netrw_silent
|
||||
put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
|
||||
put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
|
||||
let s:netrw_xfer_stop= line(".")
|
||||
@@ -99,27 +100,50 @@ fun! netrwSettings#NetrwSettings()
|
||||
put ='+ Netrw Browser Control'
|
||||
put = 'let g:netrw_alto = '.g:netrw_alto
|
||||
put = 'let g:netrw_altv = '.g:netrw_altv
|
||||
put = 'let g:netrw_banner = '.g:netrw_banner
|
||||
if exists("g:netrw_bannerbackslash")
|
||||
put = 'let g:netrw_bannerbackslash = '.g:netrw_bannerbackslash
|
||||
else
|
||||
put = '\" let g:netrw_bannerbackslash = (not defined)'
|
||||
endif
|
||||
put = 'let g:netrw_browse_split = '.g:netrw_browse_split
|
||||
if exists("g:netrw_browsex_viewer")
|
||||
put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
|
||||
put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
|
||||
else
|
||||
put = 'let g:netrw_browsex_viewer = (not defined)'
|
||||
put = '\" let g:netrw_browsex_viewer = (not defined)'
|
||||
endif
|
||||
put = 'let g:netrw_compress = '.g:netrw_compress
|
||||
if exists("g:Netrw_corehandler")
|
||||
put = 'let g:Netrw_corehandler = '.g:Netrw_corehandler
|
||||
else
|
||||
put = '\" let g:Netrw_corehandler = (not defined)'
|
||||
endif
|
||||
put = 'let g:netrw_ctags = '.g:netrw_ctags
|
||||
put = 'let g:netrw_cursor = '.g:netrw_cursor
|
||||
let decompressline= line("$")
|
||||
put ='let g:netrw_decompress...'
|
||||
put = 'let g:netrw_decompress = '.string(g:netrw_decompress)
|
||||
if exists("g:netrw_dynamic_maxfilenamelen")
|
||||
put = 'let g:netrw_dynamic_maxfilenamelen='.g:netrw_dynamic_maxfilenamelen
|
||||
else
|
||||
put = '\" let g:netrw_dynamic_maxfilenamelen= (not defined)'
|
||||
endif
|
||||
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
|
||||
put = 'let g:netrw_errorlvl = '.g:netrw_errorlvl
|
||||
put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
|
||||
let fnameescline= line("$")
|
||||
put = 'let g:netrw_fname_escape...'
|
||||
put = 'let g:netrw_fname_escape = '.string(g:netrw_fname_escape)
|
||||
put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
|
||||
put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
|
||||
put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
|
||||
put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
|
||||
let globescline= line("$")
|
||||
put ='let g:netrw_glob_escape...'
|
||||
put = 'let g:netrw_glob_escape = '.string(g:netrw_glob_escape)
|
||||
put = 'let g:netrw_hide = '.g:netrw_hide
|
||||
if exists("g:netrw_home")
|
||||
put = 'let g:netrw_home = '.g:netrw_home
|
||||
else
|
||||
put = '\" let g:netrw_home = (not defined)'
|
||||
endif
|
||||
put = 'let g:netrw_keepdir = '.g:netrw_keepdir
|
||||
put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
|
||||
put = 'let g:netrw_list_hide = '.g:netrw_list_hide
|
||||
@@ -127,23 +151,30 @@ fun! netrwSettings#NetrwSettings()
|
||||
put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
|
||||
put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir
|
||||
put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
|
||||
put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir
|
||||
put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir
|
||||
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
|
||||
put = 'let g:netrw_menu = '.g:netrw_menu
|
||||
put = 'let g:netrw_mousemaps = '.g:netrw_mousemaps
|
||||
put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
|
||||
if exists("g:netrw_nobeval")
|
||||
put = 'let g:netrw_nobeval = '.g:netrw_nobeval
|
||||
else
|
||||
put = '\" let g:netrw_nobeval = (not defined)'
|
||||
endif
|
||||
put = 'let g:netrw_remote_mkdir = '.g:netrw_remote_mkdir
|
||||
put = 'let g:netrw_preview = '.g:netrw_preview
|
||||
put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
|
||||
put = 'let g:netrw_retmap = '.g:netrw_retmap
|
||||
put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
|
||||
put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
|
||||
put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
|
||||
put = 'let g:netrw_silent = '.g:netrw_silent
|
||||
put = 'let g:netrw_sort_by = '.g:netrw_sort_by
|
||||
put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
|
||||
put = 'let g:netrw_sort_options = '.g:netrw_sort_options
|
||||
put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
|
||||
put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax
|
||||
put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
|
||||
put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
|
||||
put = 'let g:netrw_scpport = '.g:netrw_scpport
|
||||
put = 'let g:netrw_sepchr = '.g:netrw_sepchr
|
||||
put = 'let g:netrw_sshport = '.g:netrw_sshport
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*autocmd.txt* For Vim version 7.3. Last change: 2013 Mar 19
|
||||
*autocmd.txt* For Vim version 7.3. Last change: 2013 May 19
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -691,8 +691,11 @@ InsertCharPre When a character is typed in Insert mode,
|
||||
InsertEnter Just before starting Insert mode. Also for
|
||||
Replace mode and Virtual Replace mode. The
|
||||
|v:insertmode| variable indicates the mode.
|
||||
Be careful not to move the cursor or do
|
||||
anything else that the user does not expect.
|
||||
Be careful not to do anything else that the
|
||||
user does not expect.
|
||||
The cursor is restored afterwards. If you do
|
||||
not want that set |v:char| to a non-empty
|
||||
string.
|
||||
*InsertLeave*
|
||||
InsertLeave When leaving Insert mode. Also when using
|
||||
CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.3. Last change: 2013 May 17
|
||||
*eval.txt* For Vim version 7.3. Last change: 2013 May 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1297,7 +1297,7 @@ v:beval_winnr The number of the window, over which the mouse pointer is. Only
|
||||
*v:char* *char-variable*
|
||||
v:char Argument for evaluating 'formatexpr' and used for the typed
|
||||
character when using <expr> in an abbreviation |:map-<expr>|.
|
||||
It is also used by the |InsertCharPre| event.
|
||||
It is also used by the |InsertCharPre| and |InsertEnter| events.
|
||||
|
||||
*v:charconvert_from* *charconvert_from-variable*
|
||||
v:charconvert_from
|
||||
@@ -4639,7 +4639,7 @@ pumvisible() *pumvisible()*
|
||||
This can be used to avoid some things that would remove the
|
||||
popup menu.
|
||||
|
||||
*E860* *E861*
|
||||
*E860*
|
||||
py3eval({expr}) *py3eval()*
|
||||
Evaluate Python expression {expr} and return its result
|
||||
converted to Vim data structures.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*if_pyth.txt* For Vim version 7.3. Last change: 2013 May 17
|
||||
*if_pyth.txt* For Vim version 7.3. Last change: 2013 May 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Paul Moore
|
||||
@@ -11,9 +11,10 @@ The Python Interface to Vim *python* *Python*
|
||||
3. Buffer objects |python-buffer|
|
||||
4. Range objects |python-range|
|
||||
5. Window objects |python-window|
|
||||
6. pyeval(), py3eval() Vim functions |python-pyeval|
|
||||
7. Dynamic loading |python-dynamic|
|
||||
8. Python 3 |python3|
|
||||
6. Tab page objects |python-tabpage|
|
||||
7. pyeval(), py3eval() Vim functions |python-pyeval|
|
||||
8. Dynamic loading |python-dynamic|
|
||||
9. Python 3 |python3|
|
||||
|
||||
{Vi does not have any of these commands}
|
||||
|
||||
@@ -176,7 +177,7 @@ vim.bindeval(str) *python-bindeval*
|
||||
list or dictionary. Thus modifications to these objects imply
|
||||
modifications of the original.
|
||||
|
||||
Additionally, vimlist and vimdictionary type have read-write
|
||||
Additionally, vim.List and vim.Dictionary type have read-write
|
||||
`.locked` attribute that returns
|
||||
Value Meaning ~
|
||||
zero Variable is not locked
|
||||
@@ -189,14 +190,15 @@ vim.bindeval(str) *python-bindeval*
|
||||
case these locks are ignored by anything except |:let|: |extend()|
|
||||
does not care, neither does python interface).
|
||||
|
||||
Vimdictionary type also supports `.scope` attribute which is one of
|
||||
vim.Dictionary type also supports `.scope` attribute which is one
|
||||
of
|
||||
Value Meaning ~
|
||||
zero Dictionary is not a scope one
|
||||
vim.VAR_DEF_SCOPE Function-local or global scope dictionary
|
||||
vim.VAR_SCOPE Other scope dictionary
|
||||
|
||||
2. if expression evaluates to a function reference, then it returns
|
||||
callable vimfunction object. Use self keyword argument to assign
|
||||
callable vim.Function object. Use self keyword argument to assign
|
||||
|self| object for dictionary functions.
|
||||
|
||||
Note: this function has the same behavior as |lua-eval| (except that
|
||||
@@ -205,6 +207,10 @@ vim.bindeval(str) *python-bindeval*
|
||||
relying on outputs of vim.eval() being a copy of original or
|
||||
vim.eval("1") returning a string.
|
||||
|
||||
You can use "List", "Dictionary" and "Function" vim module attributes
|
||||
to test whether object has given type. These types are currently not
|
||||
subclassable, neither they contain constructors, so you can use them
|
||||
only for checks like `isinstance(obj, vim.List)`.
|
||||
|
||||
|
||||
Error object of the "vim" module
|
||||
@@ -302,6 +308,9 @@ vim.options *python-options*
|
||||
buffer-local options and |python-window| objects to access to
|
||||
window-local options.
|
||||
|
||||
Type of this object is available via "Options" attribute of vim
|
||||
module.
|
||||
|
||||
Output from Python *python-output*
|
||||
Vim displays all Python code output in the Vim message area. Normal
|
||||
output appears as information messages, and error output appears as
|
||||
@@ -371,6 +380,8 @@ Note that when adding a line it must not contain a line break character '\n'.
|
||||
A trailing '\n' is allowed and ignored, so that you can do: >
|
||||
:py b.append(f.readlines())
|
||||
|
||||
Buffer object type is available using "Buffer" attribute of vim module.
|
||||
|
||||
Examples (assume b is the current buffer) >
|
||||
:py print b.name # write the buffer file name
|
||||
:py b[0] = "hello!!!" # replace the top line
|
||||
@@ -412,6 +423,8 @@ The range object methods are:
|
||||
for Python's built-in list objects.
|
||||
r.append(list, nr) Idem, after line "nr"
|
||||
|
||||
Range object type is available using "Range" attribute of vim module.
|
||||
|
||||
Example (assume r is the current range):
|
||||
# Send all lines in a range to the default printer
|
||||
vim.command("%d,%dhardcopy!" % (r.start+1,r.end+1))
|
||||
@@ -456,6 +469,8 @@ Window attributes are:
|
||||
The height attribute is writable only if the screen is split horizontally.
|
||||
The width attribute is writable only if the screen is split vertically.
|
||||
|
||||
Window object type is available using "Window" attribute of vim module.
|
||||
|
||||
==============================================================================
|
||||
6. Tab page objects *python-tabpage*
|
||||
|
||||
@@ -474,14 +489,16 @@ Tab page attributes are:
|
||||
vars The tab page |t:| variables.
|
||||
window Current tabpage window.
|
||||
|
||||
TabPage object type is available using "TabPage" attribute of vim module.
|
||||
|
||||
==============================================================================
|
||||
6. pyeval() and py3eval() Vim functions *python-pyeval*
|
||||
7. pyeval() and py3eval() Vim functions *python-pyeval*
|
||||
|
||||
To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()|
|
||||
functions to evaluate Python expressions and pass their values to VimL.
|
||||
|
||||
==============================================================================
|
||||
7. Dynamic loading *python-dynamic*
|
||||
8. Dynamic loading *python-dynamic*
|
||||
|
||||
On MS-Windows the Python library can be loaded dynamically. The |:version|
|
||||
output then includes |+python/dyn|.
|
||||
@@ -498,7 +515,7 @@ Currently the name is "python24.dll". That is for Python 2.4. To know for
|
||||
sure edit "gvim.exe" and search for "python\d*.dll\c".
|
||||
|
||||
==============================================================================
|
||||
8. Python 3 *python3*
|
||||
9. Python 3 *python3*
|
||||
|
||||
*:py3* *:python3*
|
||||
The `:py3` and `:python3` commands work similar to `:python`. A simple check
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*indent.txt* For Vim version 7.3. Last change: 2012 Aug 30
|
||||
*indent.txt* For Vim version 7.3. Last change: 2013 May 20
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -740,12 +740,12 @@ those useless characters first with a command like: >
|
||||
:%s /\r$//g
|
||||
|
||||
Or, you can simply |:let| the variable PHP_removeCRwhenUnix to 1 and the
|
||||
script will silently remove them when Vim loads a PHP file (at each|BufRead|).
|
||||
script will silently remove them when Vim loads a PHP file (at each |BufRead|).
|
||||
|
||||
OPTIONS: ~
|
||||
|
||||
PHP indenting can be altered in several ways by modifying the values of some
|
||||
variables:
|
||||
global variables:
|
||||
|
||||
*php-comment*
|
||||
To not enable auto-formating of comments by default (if you want to use your
|
||||
@@ -753,10 +753,21 @@ own 'formatoptions'): >
|
||||
:let g:PHP_autoformatcomment = 0
|
||||
|
||||
Else, 't' will be removed from the 'formatoptions' string and "qrowcb" will be
|
||||
added, see|fo-table|for more information.
|
||||
added, see |fo-table| for more information.
|
||||
-------------
|
||||
|
||||
To add an extra indent to every PHP lines with N being the number of
|
||||
To add extra indentation to single-line comments: >
|
||||
:let g:PHP_outdentSLComments = N
|
||||
|
||||
With N being the number of 'shiftwidth' to add.
|
||||
|
||||
Only single-line comments will be affected such as: >
|
||||
# Comment
|
||||
// Comment
|
||||
/* Comment */
|
||||
-------------
|
||||
|
||||
To add extra indentation to every PHP lines with N being the number of
|
||||
'shiftwidth' to add: >
|
||||
:let g:PHP_default_indenting = N
|
||||
|
||||
@@ -772,7 +783,7 @@ For example, with N = 1, this will give:
|
||||
|
||||
$command_hist = TRUE;
|
||||
?>
|
||||
(Notice the extra indent between the PHP container markers and the code)
|
||||
(Notice the extra indentation between the PHP container markers and the code)
|
||||
-------------
|
||||
|
||||
To indent PHP tags as the surrounding code: >
|
||||
@@ -804,8 +815,10 @@ NOTE: Indenting will be a bit slower if this option is used because some
|
||||
To indent 'case:' and 'default:' statements in switch() blocks: >
|
||||
:let g:PHP_vintage_case_default_indent = 1
|
||||
|
||||
(Since in PHP braces are not required inside 'case/default' blocks, by default they are indented at the same level than the 'switch()' to avoid
|
||||
unnecessary indentation)
|
||||
In PHP braces are not required inside 'case/default' blocks therefore 'case:'
|
||||
and 'default:' are indented at the same level than the 'switch()' to avoid
|
||||
meaningless indentation. You can use the above option to return to the
|
||||
traditional way.
|
||||
|
||||
|
||||
PYTHON *ft-python-indent*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*mbyte.txt* For Vim version 7.3. Last change: 2012 Oct 06
|
||||
*mbyte.txt* For Vim version 7.3. Last change: 2013 May 18
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar et al.
|
||||
@@ -48,9 +48,9 @@ COMPILING
|
||||
If you already have a compiled Vim program, check if the |+multi_byte| feature
|
||||
is included. The |:version| command can be used for this.
|
||||
|
||||
If +multi_byte is not included, you should compile Vim with "big" features.
|
||||
You can further tune what features are included. See the INSTALL files in the
|
||||
source directory.
|
||||
If +multi_byte is not included, you should compile Vim with "normal", "big" or
|
||||
"huge" features. You can further tune what features are included. See the
|
||||
INSTALL files in the source directory.
|
||||
|
||||
|
||||
LOCALE
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 7.3. Last change: 2013 Apr 27
|
||||
*options.txt* For Vim version 7.3. Last change: 2013 May 17
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -5516,6 +5516,19 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
matches will be highlighted. This is used to avoid that Vim hangs
|
||||
when using a very complicated pattern.
|
||||
|
||||
*'regexpengine''* *'re'*
|
||||
'regexpengine' 're' number (default 0)
|
||||
global
|
||||
{not in Vi}
|
||||
This selects the default regexp engine. |two-engines|
|
||||
The possible values are:
|
||||
0 automatic selection
|
||||
1 old engine
|
||||
2 NFA engine
|
||||
Note that when using the NFA engine and the pattern contains something
|
||||
that is not supported the pattern will not match. This is only useful
|
||||
for debugging the regexp engine.
|
||||
|
||||
*'relativenumber'* *'rnu'* *'norelativenumber'* *'nornu'*
|
||||
'relativenumber' 'rnu' boolean (default off)
|
||||
local to window
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*pattern.txt* For Vim version 7.3. Last change: 2013 Apr 20
|
||||
*pattern.txt* For Vim version 7.3. Last change: 2013 May 17
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -350,6 +350,27 @@ For starters, read chapter 27 of the user manual |usr_27.txt|.
|
||||
or \z( pattern \) |/\z(|
|
||||
|
||||
|
||||
*/\%#=* *two-engines*
|
||||
Vim includes two regexp engines:
|
||||
1. An old, backtracking engine that supports everything.
|
||||
2. A new, NFA engine that works much faster on some patterns, but does not
|
||||
support everything.
|
||||
|
||||
Vim will automatically select the right engine for you. However, if you run
|
||||
into a problem or want to specifically select one engine or the other, you can
|
||||
prepend one of the following to the pattern:
|
||||
|
||||
\%#=0 Force automatic selection. Only has an effect when
|
||||
'regexpengine' has been set to a non-zero value.
|
||||
\%#=1 Force using the old engine.
|
||||
\%#=2 Force using the NFA engine.
|
||||
|
||||
You can also use the 'regexpengine' option to change the default.
|
||||
|
||||
*E864* *E868* *E874* *E875* *E876* *E877* *E878*
|
||||
If selecting the NFA engine and it runs into something that is not implemented
|
||||
the pattern will not match. This is only useful when debugging Vim.
|
||||
|
||||
==============================================================================
|
||||
3. Magic */magic*
|
||||
|
||||
@@ -396,9 +417,10 @@ pattern.
|
||||
|
||||
==============================================================================
|
||||
4. Overview of pattern items *pattern-overview*
|
||||
*E865* *E866* *E867* *E869*
|
||||
|
||||
Overview of multi items. */multi* *E61* *E62*
|
||||
More explanation and examples below, follow the links. *E64*
|
||||
More explanation and examples below, follow the links. *E64* *E871*
|
||||
|
||||
multi ~
|
||||
'magic' 'nomagic' matches of the preceding atom ~
|
||||
@@ -508,12 +530,14 @@ Character classes {not in Vi}: */character-classes*
|
||||
|
||||
|/\c| \c \c ignore case, do not use the 'ignorecase' option
|
||||
|/\C| \C \C match case, do not use the 'ignorecase' option
|
||||
|/\Z| \Z \Z ignore differences in Unicode "combining characters".
|
||||
Useful when searching voweled Hebrew or Arabic text.
|
||||
|
||||
|/\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"
|
||||
|/\V| \V \V the following chars in the pattern are "very nomagic"
|
||||
|/\Z| \Z \Z ignore differences in Unicode "combining characters".
|
||||
Useful when searching voweled Hebrew or Arabic text.
|
||||
|/\%#=| \%#=1 \%#=1 select regexp engine |/zero-width|
|
||||
|
||||
|/\%d| \%d \%d match specified decimal character (eg \%d123)
|
||||
|/\%x| \%x \%x match specified hex character (eg \%x2a)
|
||||
@@ -581,7 +605,7 @@ overview.
|
||||
\? Just like \=. Cannot be used when searching backwards with the "?"
|
||||
command. {not in Vi}
|
||||
|
||||
*/\{* *E58* *E60* *E554*
|
||||
*/\{* *E58* *E60* *E554* *E870*
|
||||
\{n,m} Matches n to m of the preceding atom, as many as possible
|
||||
\{n} Matches n of the preceding atom
|
||||
\{n,} Matches at least n of the preceding atom, as many as possible
|
||||
@@ -962,7 +986,8 @@ match ASCII characters, as indicated by the range.
|
||||
~ matches the last given substitute string */~* */\~*
|
||||
|
||||
\(\) A pattern enclosed by escaped parentheses. */\(* */\(\)* */\)*
|
||||
E.g., "\(^a\)" matches 'a' at the start of a line. *E51* *E54* *E55*
|
||||
E.g., "\(^a\)" matches 'a' at the start of a line.
|
||||
*E51* *E54* *E55* *E872* *E873*
|
||||
|
||||
\1 Matches the same string that was matched by */\1* *E65*
|
||||
the first sub-expression in \( and \). {not in Vi}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*pi_netrw.txt* For Vim version 7.3. Last change: 2013 Apr 19
|
||||
*pi_netrw.txt* For Vim version 7.3. Last change: 2013 May 18
|
||||
|
||||
------------------------------------------------
|
||||
NETRW REFERENCE MANUAL by Charles E. Campbell
|
||||
@@ -146,13 +146,13 @@ and has lines resembling >
|
||||
<
|
||||
Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: >
|
||||
|
||||
let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE'
|
||||
let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\MyUserName\MACHINE'
|
||||
<
|
||||
Netrw will substitute the host's machine name for MACHINE from the url it is
|
||||
Netrw will substitute the host's machine name for "MACHINE" from the url it is
|
||||
attempting to open, and so one may specify >
|
||||
userid
|
||||
password
|
||||
for each site in a separate file in c:\Users\Myself\.
|
||||
for each site in a separate file: c:\Users\MyUserName\MachineName.
|
||||
|
||||
Now about browsing -- when you just want to look around before editing a
|
||||
file. For browsing on your current host, just "edit" a directory: >
|
||||
@@ -321,6 +321,8 @@ CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* {{{2
|
||||
:call NetUserPass("uid") -- prompts for password
|
||||
:call NetUserPass("uid","password") -- sets global uid and password
|
||||
|
||||
(Related topics: |ftp| |netrw-userpass| |netrw-start|)
|
||||
|
||||
NETRW VARIABLES AND SETTINGS *netrw-variables* {{{2
|
||||
(Also see:
|
||||
|netrw-browser-var| : netrw browser option variables
|
||||
@@ -927,6 +929,7 @@ itself:
|
||||
endfunction
|
||||
endif
|
||||
>
|
||||
(Related topics: |ftp| |netrw-userpass| |netrw-start|)
|
||||
|
||||
==============================================================================
|
||||
9. Browsing *netrw-browsing* *netrw-browse* *netrw-help* {{{1
|
||||
@@ -2125,6 +2128,10 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
NOTE: suppressing the banner is a new feature
|
||||
which may cause problems.
|
||||
|
||||
*g:netrw_bannerbackslash* if this variable exists and is not zero, the
|
||||
banner will be displayed with backslashes
|
||||
rather than forward slashes.
|
||||
|
||||
*g:netrw_browse_split* when browsing, <cr> will open the file by:
|
||||
=0: re-using the same window
|
||||
=1: horizontally splitting the window first
|
||||
@@ -2306,14 +2313,14 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
Copies marked files (|netrw-mf|) to target
|
||||
directory (|netrw-mt|, |netrw-mc|)
|
||||
|
||||
*g:netrw_localmkdir* command for making a local directory
|
||||
default: "mkdir"
|
||||
|
||||
*g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin
|
||||
="move" Windows
|
||||
Moves marked files (|netrw-mf|) to target
|
||||
directory (|netrw-mt|, |netrw-mm|)
|
||||
|
||||
*g:netrw_localmkdir* command for making a local directory
|
||||
default: "mkdir"
|
||||
|
||||
*g:netrw_localrmdir* remove directory command (rmdir)
|
||||
default: "rmdir"
|
||||
|
||||
@@ -2416,11 +2423,6 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
< into one's <.vimrc> to use one's own
|
||||
preferences.
|
||||
|
||||
*g:netrw_ssh_cmd* One may specify an executable command
|
||||
to use instead of ssh for remote actions
|
||||
such as listing, file removal, etc.
|
||||
default: ssh
|
||||
|
||||
*g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines,
|
||||
messages, banners, and whatnot that one doesn't
|
||||
want masquerading as "directories" and "files".
|
||||
@@ -2428,6 +2430,11 @@ your browsing preferences. (see also: |netrw-settings|)
|
||||
messages. By default its value is:
|
||||
'^total\s\+\d\+$'
|
||||
|
||||
*g:netrw_ssh_cmd* One may specify an executable command
|
||||
to use instead of ssh for remote actions
|
||||
such as listing, file removal, etc.
|
||||
default: ssh
|
||||
|
||||
|
||||
*g:netrw_tmpfile_escape* =' &;'
|
||||
escape() is applied to all temporary files
|
||||
@@ -2990,6 +2997,19 @@ which is loaded automatically at startup (assuming :set nocp).
|
||||
==============================================================================
|
||||
12. History *netrw-history* {{{1
|
||||
|
||||
v149: Apr 18, 2013 * in wide listing format, now have maps for
|
||||
w and b to move to next/previous file
|
||||
Apr 26, 2013 * one may now copy files in the same
|
||||
directory; netrw will issue requests for
|
||||
what names the files should be copied under
|
||||
Apr 29, 2013 * Trying Benzinger's problem again. Seems
|
||||
that commenting out the BufEnter and
|
||||
installing VimEnter (only) works. Weird
|
||||
problem! (tree listing, vim -O Dir1 Dir2)
|
||||
May 01, 2013 * :Explore ftp://... wasn't working. Fixed.
|
||||
May 02, 2013 * introduced |g:netrw_bannerbackslash| as
|
||||
requested by Paul Domaskis.
|
||||
May 18, 2013 * More fixes for windows (not cygwin)
|
||||
v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct
|
||||
choice of listing style, hiding style, and
|
||||
sorting style
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*quickref.txt* For Vim version 7.3. Last change: 2013 Apr 05
|
||||
*quickref.txt* For Vim version 7.3. Last change: 2013 May 20
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -824,6 +824,7 @@ Short explanation of each option: *option-list*
|
||||
'quoteescape' 'qe' escape characters used in a string
|
||||
'readonly' 'ro' disallow writing the buffer
|
||||
'redrawtime' 'rdt' timeout for 'hlsearch' and |:match| highlighting
|
||||
'regexpengine' 're' default regexp engine to use
|
||||
'relativenumber' 'rnu' show relative line number in front of each line
|
||||
'remap' allow mappings to work recursively
|
||||
'report' threshold for reporting nr. of lines changed
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*starting.txt* For Vim version 7.3. Last change: 2012 Mar 16
|
||||
*starting.txt* For Vim version 7.3. Last change: 2013 May 20
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -438,6 +438,8 @@ a slash. Thus "-R" means recovery and "-/R" readonly.
|
||||
option should be used when Vim is started by a program that
|
||||
will wait for the edit session to finish (e.g., mail or
|
||||
readnews). See |amiga-window|.
|
||||
|
||||
MS-Windows: This option is not always supported.
|
||||
{not in Vi}
|
||||
|
||||
|
||||
|
||||
@@ -736,9 +736,11 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
|
||||
'quote motion.txt /*'quote*
|
||||
'quoteescape' options.txt /*'quoteescape'*
|
||||
'rdt' options.txt /*'rdt'*
|
||||
're' options.txt /*'re'*
|
||||
'readonly' options.txt /*'readonly'*
|
||||
'redraw' vi_diff.txt /*'redraw'*
|
||||
'redrawtime' options.txt /*'redrawtime'*
|
||||
'regexpengine'' options.txt /*'regexpengine''*
|
||||
'relativenumber' options.txt /*'relativenumber'*
|
||||
'remap' options.txt /*'remap'*
|
||||
'report' options.txt /*'report'*
|
||||
@@ -1389,6 +1391,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
|
||||
/\ pattern.txt /*\/\\*
|
||||
/\$ pattern.txt /*\/\\$*
|
||||
/\%# pattern.txt /*\/\\%#*
|
||||
/\%#= pattern.txt /*\/\\%#=*
|
||||
/\%$ pattern.txt /*\/\\%$*
|
||||
/\%'m pattern.txt /*\/\\%'m*
|
||||
/\%( pattern.txt /*\/\\%(*
|
||||
@@ -4258,10 +4261,24 @@ E858 eval.txt /*E858*
|
||||
E859 eval.txt /*E859*
|
||||
E86 windows.txt /*E86*
|
||||
E860 eval.txt /*E860*
|
||||
E861 eval.txt /*E861*
|
||||
E862 eval.txt /*E862*
|
||||
E863 if_pyth.txt /*E863*
|
||||
E864 pattern.txt /*E864*
|
||||
E865 pattern.txt /*E865*
|
||||
E866 pattern.txt /*E866*
|
||||
E867 pattern.txt /*E867*
|
||||
E868 pattern.txt /*E868*
|
||||
E869 pattern.txt /*E869*
|
||||
E87 windows.txt /*E87*
|
||||
E870 pattern.txt /*E870*
|
||||
E871 pattern.txt /*E871*
|
||||
E872 pattern.txt /*E872*
|
||||
E873 pattern.txt /*E873*
|
||||
E874 pattern.txt /*E874*
|
||||
E875 pattern.txt /*E875*
|
||||
E876 pattern.txt /*E876*
|
||||
E877 pattern.txt /*E877*
|
||||
E878 pattern.txt /*E878*
|
||||
E88 windows.txt /*E88*
|
||||
E89 message.txt /*E89*
|
||||
E90 message.txt /*E90*
|
||||
@@ -5885,6 +5902,7 @@ g:html_whole_filler syntax.txt /*g:html_whole_filler*
|
||||
g:netrw_alto pi_netrw.txt /*g:netrw_alto*
|
||||
g:netrw_altv pi_netrw.txt /*g:netrw_altv*
|
||||
g:netrw_banner pi_netrw.txt /*g:netrw_banner*
|
||||
g:netrw_bannerbackslash pi_netrw.txt /*g:netrw_bannerbackslash*
|
||||
g:netrw_browse_split pi_netrw.txt /*g:netrw_browse_split*
|
||||
g:netrw_browsex_viewer pi_netrw.txt /*g:netrw_browsex_viewer*
|
||||
g:netrw_bufsettings pi_netrw.txt /*g:netrw_bufsettings*
|
||||
@@ -8172,6 +8190,7 @@ try-nested eval.txt /*try-nested*
|
||||
try-nesting eval.txt /*try-nesting*
|
||||
tutor usr_01.txt /*tutor*
|
||||
twice if_cscop.txt /*twice*
|
||||
two-engines pattern.txt /*two-engines*
|
||||
type() eval.txt /*type()*
|
||||
type-mistakes tips.txt /*type-mistakes*
|
||||
typecorr-settings usr_41.txt /*typecorr-settings*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.3. Last change: 2013 May 17
|
||||
*todo.txt* For Vim version 7.3. Last change: 2013 May 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -34,8 +34,18 @@ not be repeated below, unless there is extra information.
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
Rename src/Makefile and create a new one like toplevel Makefile that creates
|
||||
auto/config.mk when it's not there? (Ben Schmidt, 2011 Feb 11)
|
||||
|
||||
--- Python interface
|
||||
|
||||
Python: thread with refactoring patches. (ZyX, May 19, 16:46 and later)
|
||||
9
|
||||
10
|
||||
11
|
||||
|
||||
Configure doesn't find Python 3 on Ubuntu 13.04. (Ken Takata, Apr 13)
|
||||
|
||||
Python SystemExit exception is not handled properly. Patch to catch the
|
||||
exception and give an error. (Yasuhiro Matsumoto)
|
||||
Does not work, tests fail.
|
||||
@@ -45,9 +55,10 @@ Patch to print the result of a :python command. (Maxim Philippov
|
||||
Patch no longer applies.
|
||||
|
||||
":python os.chdir('/tmp')" makes short buffer names invalid. (Xavier de Gaye)
|
||||
Check directory and call shorten_fnames()? Better: make os.chdir()
|
||||
invoke the interal :cd implementation, that takes care of all side
|
||||
effects.
|
||||
Patch to make os.chdir() handle side effects. (Xavier de Gaye, 2013 May 17)
|
||||
Update May 19, also for os.fchdir().
|
||||
Adds a $VIMRUNTIME/python directory.
|
||||
ZyX: OK to add python and python3 directory.
|
||||
|
||||
Mac: OS/X 10.4 with Python 2.5 installed: configure finds an extra argument
|
||||
that breaks the build. (Brian Victor, 2008 Sep 1)
|
||||
@@ -65,34 +76,74 @@ Vim script. Requires converting the arguments and return value.
|
||||
--- runtime files
|
||||
|
||||
Syntax file for protocol buffers. (Feng Xiao, 2013 May 9)
|
||||
Has an ugly copyright notice. No conflict with Vim license?
|
||||
Has an ugly copyright notice.
|
||||
Add statement that it does not conflict with Vim license.
|
||||
|
||||
Patch for JavaScript syntax. (Kevin Locke, 2013 May 9)
|
||||
Claudio didn't respond yet.
|
||||
|
||||
--- Fast regexp engine
|
||||
|
||||
Including NFA regexp code. Latest version probably is:
|
||||
https://code.google.com/p/vim-soc2008-regexp/source/browse/trunk/vim72-re/src/regexp_nfa.c
|
||||
Patch updated by Ken Takata. (May 13)
|
||||
Duplicate condition in line 1094. (Ken Takata) Should be 'r'?
|
||||
|
||||
To be able to run tests:
|
||||
- set defaultre=old / nfa / auto
|
||||
- In pattern use "\%#= to set the engine: 0 = automatic, 1 = old 2 = nfa
|
||||
Multi-byte problem? Marc Weber
|
||||
echo matchlist('1', '\%#=1\o{\?Ä\Z')
|
||||
echo matchlist('1', '\%#=2\o{\?Ä\Z')
|
||||
|
||||
Difference in matching this pattern: (Marc Weber)
|
||||
echo matchlist("t", '\%#=1ú\Z')
|
||||
echo matchlist("t", '\%#=2ú\Z')
|
||||
|
||||
Difference in matching this pattern:
|
||||
echo matchlist('google', '\%#=1\<go*\|go')
|
||||
echo matchlist('google', '\%#=2\<go*\|go')
|
||||
|
||||
Difference in matching this pattern: (Marc Weber)
|
||||
echo matchlist("\na", '\%#=1\_F')
|
||||
echo matchlist("\na", '\%#=0\_F')
|
||||
echo matchlist("\na", '\%#=2\_F')
|
||||
|
||||
Don't set curbuf, use reg_buf.
|
||||
|
||||
Estimation of number of items is wrong, can be much larger.
|
||||
When running out of space, retry with more space?
|
||||
|
||||
nfa_regcomp() should not use nstate_max but the actual number of states for
|
||||
allocating the prog?
|
||||
|
||||
Get example files for many languages. Compare syntax highlighting with old and
|
||||
new regexp, find regexp constructs where NFA does not work correctly.
|
||||
Idea for comparing output: use format.vim (ZyX, 2013 May 12)
|
||||
MakeSynChk from Charles Campbell. (May 14)
|
||||
source ~/vim/regexp/runold.vim to update the "old" files.
|
||||
source ~/vim/regexp/runnew.vim to update the "new" files
|
||||
source ~/vim/regexp/diff.vim to find differences
|
||||
Diffs in these files:
|
||||
- csh02: line 2, "13" is not highlighted after -misc-fixed-bold-r-normal-
|
||||
as cshNumber
|
||||
- csh02: line 7, similar problem.
|
||||
- tst28.tex line 8 \alpha in texStatement instead of texGreek
|
||||
|
||||
It's very slow compared to the old engine...
|
||||
Performance tests:
|
||||
- ~/vim/test/veryslow.js (file from Daniel Fetchinson)
|
||||
- ~/vim/test/veryslow.js display last line (file from Daniel Fetchinson)
|
||||
- ~/vim/test/slowsearch
|
||||
- ~/vim/test/rgb.vim
|
||||
- ~/vim/text/FeiqCfg.xml (file from Netjune)
|
||||
- ~/vim/text/edl.svg (also XML)
|
||||
- search for a.*e*exn in the vim executable. Go to last line to use
|
||||
'hlsearch'.
|
||||
- Slow combination of folding and PHP syntax highlighting. Script to
|
||||
reproduce it. Caused by "syntax sync fromstart" in combination with patch
|
||||
7.2.274. (Christian Brabandt, 2010 May 27) Generally, folding with
|
||||
'foldmethod' set to "syntax" is slow. Do profiling to find out why.
|
||||
- Does not use any of the optimizations, such as required start pattern.
|
||||
- When lists are empty in nfa_regmatch() and match is true, it keeps looping
|
||||
without doing anything.
|
||||
|
||||
"\ze" is currently disabled for NFA, can this be fixed?
|
||||
|
||||
"\_[0-9]\?\>" does not match at end of line, disabled.
|
||||
|
||||
Items with \%u, \%x, \%o, \%d do not work with the new engine.
|
||||
|
||||
--- bug fixes
|
||||
|
||||
@@ -145,6 +196,12 @@ Patch by Christian Brabandt, Feb 16.
|
||||
'cursorline' is drawn incorrectly in diff mode. Patch by Christian Brabandt,
|
||||
2012 Apr 2.
|
||||
|
||||
When someone does a silly thing such as setting rows and columns to 65535,
|
||||
handle the out-of-memory and set them to sane values? (jimmywang, 2013 May 17)
|
||||
|
||||
InsertEnter doesn't prevent the cursor from moving when it goes to another
|
||||
line.
|
||||
|
||||
--- slightly incompatible changes
|
||||
|
||||
Patch to load ~/.vim/vimrc when ~/.vimrc isn't found. (Lech Lorens, 2013 Apr
|
||||
@@ -203,9 +260,11 @@ Patch to invert characters differently in GTK. (Yukihiro Nakadaira, 2013 May
|
||||
5)
|
||||
|
||||
Patch to add the bufferlist() function. (Yegappan Lakshmanan, 2013 May 5)
|
||||
May 17: with winlist() and tabpagelist().
|
||||
May 19: with local variables.
|
||||
|
||||
Patch to allow setting w:quickfix_title via setqflist() and setloclist()
|
||||
functions. (Christian Brabandt, 2013 May 8, update May 11)
|
||||
functions. (Christian Brabandt, 2013 May 8, update May 21)
|
||||
|
||||
Patch to support 'u' in interactive substitute. (Christian Brabandt, 2012 Sep
|
||||
28) With tests: Oct 9.
|
||||
@@ -779,12 +838,6 @@ Problem with stop directory in findfile(). (Adam Simpkins, 2009 Aug 26)
|
||||
Using ']' as the end of a range in a pattern requires double escaping:
|
||||
/[@-\\]] (Andy Wokula, 2011 Jun 28)
|
||||
|
||||
Slow combination of folding and PHP syntax highlighting. Script to reproduce
|
||||
it. Caused by "syntax sync fromstart" in combination with patch 7.2.274.
|
||||
(Christian Brabandt, 2010 May 27)
|
||||
Generally, folding with 'foldmethod' set to "syntax" is slow. Do profiling to
|
||||
find out why.
|
||||
|
||||
Syntax priority problem. (Charles Campbell, 2011 Sep 15)
|
||||
|
||||
When completion inserts the first match, it may trigger the line to be folded.
|
||||
@@ -1737,10 +1790,8 @@ Patch to support horizontal scroll wheel in GTK. Untested. (Bjorn Winckler,
|
||||
2010 Jun 30)
|
||||
|
||||
|
||||
At next release 7.4:
|
||||
At next release:
|
||||
- Build a huge version by default.
|
||||
- Rename src/Makefile and create a new one like toplevel Makefile that
|
||||
creates auto/config.mk when it's not there? (Ben Schmidt, 2011 Feb 11)
|
||||
- Improve plugin handling: Automatic updates, handle dependencies?
|
||||
E.g. Vundle: https://github.com/gmarik/vundle
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*various.txt* For Vim version 7.3. Last change: 2012 Dec 06
|
||||
*various.txt* For Vim version 7.3. Last change: 2013 May 18
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -368,7 +368,7 @@ N *+mouse_sysmouse* Unix only: *BSD console mouse handling |sysmouse|
|
||||
B *+mouse_sgr* Unix only: sgr mouse handling |sgr-mouse|
|
||||
B *+mouse_urxvt* Unix only: urxvt mouse handling |urxvt-mouse|
|
||||
N *+mouse_xterm* Unix only: xterm mouse handling |xterm-mouse|
|
||||
B *+multi_byte* 16 and 32 bit characters |multibyte|
|
||||
N *+multi_byte* 16 and 32 bit characters |multibyte|
|
||||
*+multi_byte_ime* Win32 input method for multibyte chars |multibyte-ime|
|
||||
N *+multi_lang* non-English language support |multi-lang|
|
||||
m *+mzscheme* Mzscheme interface |mzscheme|
|
||||
|
||||
@@ -2,21 +2,23 @@
|
||||
" Language: PHP
|
||||
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
|
||||
" URL: http://www.2072productions.com/vim/indent/php.vim
|
||||
" Last Change: 2010 Jully 26th
|
||||
" Newsletter: http://www.2072productions.com/?to=php-indent-for-vim-newsletter.php
|
||||
" Version: 1.33
|
||||
" Home: https://github.com/2072/PHP-Indenting-for-VIm
|
||||
" Last Change: 2013 May 10th
|
||||
" Version: 1.37
|
||||
"
|
||||
"
|
||||
" If you find a bug, please report it on GitHub:
|
||||
" http://github.com/2072/PHP-Indenting-for-VIm/issues
|
||||
" with an example of code that breaks the algorithm.
|
||||
" Type :help php-indent for available options
|
||||
"
|
||||
" A fully commented version of this file is available on github
|
||||
"
|
||||
"
|
||||
" Thanks a lot for using this script.
|
||||
"
|
||||
" If you find a bug, please open a ticket on github.org
|
||||
" ( https://github.com/2072/PHP-Indenting-for-VIm/issues ) with an example of
|
||||
" code that breaks the algorithm.
|
||||
"
|
||||
|
||||
" NOTE: This script must be used with PHP syntax ON and with the php syntax
|
||||
" script by Lutz Eymers (http://www.ipdienste.net/data/php.vim ) or with the
|
||||
" script by Lutz Eymers (http://www.isp.de/data/php.vim ) or with the
|
||||
" script by Peter Hodge (http://www.vim.org/scripts/script.php?script_id=1571 )
|
||||
" the later is bunbdled by default with Vim 7.
|
||||
"
|
||||
@@ -26,7 +28,7 @@
|
||||
" script will automatically put HereDoc end identifiers at col 1 if
|
||||
" they are followed by a ';').
|
||||
"
|
||||
"
|
||||
|
||||
" NOTE: If you are editing files in Unix file format and that (by accident)
|
||||
" there are '\r' before new lines, this script won't be able to proceed
|
||||
" correctly and will make many mistakes because it won't be able to match
|
||||
@@ -38,8 +40,6 @@
|
||||
" or simply 'let' the option PHP_removeCRwhenUnix to 1 and the script will
|
||||
" silently remove them when VIM load this script (at each bufread).
|
||||
"
|
||||
" Options: See :help php-indent for available options.
|
||||
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
@@ -50,12 +50,19 @@ let b:did_indent = 1
|
||||
let php_sync_method = 0
|
||||
|
||||
|
||||
|
||||
if exists("PHP_default_indenting")
|
||||
let b:PHP_default_indenting = PHP_default_indenting * &sw
|
||||
else
|
||||
let b:PHP_default_indenting = 0
|
||||
endif
|
||||
|
||||
if exists("PHP_outdentSLComments")
|
||||
let b:PHP_outdentSLComments = PHP_outdentSLComments * &sw
|
||||
else
|
||||
let b:PHP_outdentSLComments = 0
|
||||
endif
|
||||
|
||||
if exists("PHP_BracesAtCodeLevel")
|
||||
let b:PHP_BracesAtCodeLevel = PHP_BracesAtCodeLevel
|
||||
else
|
||||
@@ -116,13 +123,20 @@ endif
|
||||
|
||||
if exists("*GetPhpIndent")
|
||||
call ResetPhpOptions()
|
||||
finish
|
||||
finish " XXX -- comment this line for easy dev
|
||||
endif
|
||||
|
||||
let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
|
||||
let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
|
||||
|
||||
|
||||
function! DebugPrintReturn(scriptLine)
|
||||
|
||||
echo "debug:" . a:scriptLine
|
||||
call getchar()
|
||||
|
||||
endfunction
|
||||
|
||||
function! GetLastRealCodeLNum(startline) " {{{
|
||||
|
||||
let lnum = a:startline
|
||||
@@ -189,8 +203,6 @@ function! GetLastRealCodeLNum(startline) " {{{
|
||||
let b:InPHPcode_and_script = 0
|
||||
endif
|
||||
|
||||
|
||||
|
||||
return lnum
|
||||
endfunction " }}}
|
||||
|
||||
@@ -198,11 +210,11 @@ function! Skippmatch2()
|
||||
|
||||
let line = getline(".")
|
||||
|
||||
if line =~ '\%(".*\)\@<=/\*\%(.*"\)\@=' || line =~ '\%(\%(//\|#\).*\)\@<=/\*'
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
if line =~ "\\([\"']\\).*/\\*.*\\1" || line =~ '\%(//\|#\).*/\*'
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfun
|
||||
|
||||
function! Skippmatch() " {{{
|
||||
@@ -314,7 +326,7 @@ function! IslinePHP (lnum, tofind) " {{{
|
||||
endif
|
||||
endfunction " }}}
|
||||
|
||||
let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|else\)'
|
||||
let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\)'
|
||||
let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|else\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|interface\>\|abstract\>\|try\>\|catch\>\)'
|
||||
|
||||
let s:autoresetoptions = 0
|
||||
@@ -361,14 +373,12 @@ function! GetPhpIndent()
|
||||
if !b:PHP_indentinghuge && b:PHP_lastindented > b:PHP_indentbeforelast
|
||||
if b:PHP_indentbeforelast
|
||||
let b:PHP_indentinghuge = 1
|
||||
echom 'Large indenting detected, speed optimizations engaged (v1.33)'
|
||||
endif
|
||||
let b:PHP_indentbeforelast = b:PHP_lastindented
|
||||
endif
|
||||
|
||||
if b:InPHPcode_checked && prevnonblank(v:lnum - 1) != b:PHP_lastindented
|
||||
if b:PHP_indentinghuge
|
||||
echom 'Large indenting deactivated'
|
||||
let b:PHP_indentinghuge = 0
|
||||
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
|
||||
endif
|
||||
@@ -425,7 +435,7 @@ function! GetPhpIndent()
|
||||
else
|
||||
let b:InPHPcode = 0
|
||||
let b:UserIsTypingComment = 0
|
||||
let b:InPHPcode_tofind = '<?\%(.*?>\)\@!\|<script.*>'
|
||||
let b:InPHPcode_tofind = s:PHP_startindenttag
|
||||
endif
|
||||
endif "!b:InPHPcode_checked }}}
|
||||
|
||||
@@ -493,7 +503,9 @@ function! GetPhpIndent()
|
||||
endif
|
||||
|
||||
" Indent successive // or # comment the same way the first is {{{
|
||||
let addSpecial = 0
|
||||
if cline =~ '^\s*\%(//\|#\|/\*.*\*/\s*$\)'
|
||||
let addSpecial = b:PHP_outdentSLComments
|
||||
if b:PHP_LastIndentedWasComment == 1
|
||||
return indent(real_PHP_lastindented)
|
||||
endif
|
||||
@@ -550,7 +562,7 @@ function! GetPhpIndent()
|
||||
endif
|
||||
|
||||
if lnum == 0
|
||||
return b:PHP_default_indenting
|
||||
return b:PHP_default_indenting + addSpecial
|
||||
endif
|
||||
|
||||
|
||||
@@ -577,17 +589,17 @@ function! GetPhpIndent()
|
||||
endif
|
||||
|
||||
|
||||
if last_line =~ '[;}]'.endline && last_line !~ '^)' && last_line !~# s:defaultORcase
|
||||
if last_line =~ '[;}]'.endline && last_line !~ '^[)\]]' && last_line !~# s:defaultORcase
|
||||
if ind==b:PHP_default_indenting
|
||||
return b:PHP_default_indenting
|
||||
return b:PHP_default_indenting + addSpecial
|
||||
elseif b:PHP_indentinghuge && ind==b:PHP_CurrentIndentLevel && cline !~# '^\s*\%(else\|\%(case\|default\).*:\|[})];\=\)' && last_line !~# '^\s*\%(\%(}\s*\)\=else\)' && getline(GetLastRealCodeLNum(lnum - 1))=~';'.endline
|
||||
return b:PHP_CurrentIndentLevel
|
||||
return b:PHP_CurrentIndentLevel + addSpecial
|
||||
endif
|
||||
endif
|
||||
|
||||
let LastLineClosed = 0
|
||||
|
||||
let terminated = '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.endline
|
||||
let terminated = '\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.endline
|
||||
|
||||
let unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@<!\<e'.'lse\>\)'.endline
|
||||
|
||||
@@ -618,19 +630,23 @@ function! GetPhpIndent()
|
||||
endwhile
|
||||
|
||||
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
|
||||
let ind = ind + &sw
|
||||
return ind
|
||||
let ind = ind + &sw " we indent one level further when the preceding line is not stated
|
||||
return ind + addSpecial
|
||||
|
||||
elseif (ind != b:PHP_default_indenting || last_line =~ '^)' ) && last_line =~ terminated
|
||||
elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated " Added || last_line =~ '^)' on 2007-12-30 (array indenting problem broke other things)
|
||||
let previous_line = last_line
|
||||
let last_line_num = lnum
|
||||
let LastLineClosed = 1
|
||||
|
||||
while 1
|
||||
if previous_line =~ '^\s*}'
|
||||
let last_line_num = FindOpenBracket(last_line_num)
|
||||
if previous_line =~ '^\s*}\|;\s*}'.endline " XXX
|
||||
|
||||
if getline(last_line_num) =~ '^\s*{'
|
||||
call cursor(last_line_num, 1)
|
||||
call search('}\|;\s*}'.endline, 'W')
|
||||
let oldLastLine = last_line_num
|
||||
let last_line_num = searchpair('{', '', '}', 'bW', 'Skippmatch()')
|
||||
|
||||
if oldLastLine == last_line_num || getline(last_line_num) =~ '^\s*{'
|
||||
let last_line_num = GetLastRealCodeLNum(last_line_num - 1)
|
||||
endif
|
||||
|
||||
@@ -674,7 +690,7 @@ function! GetPhpIndent()
|
||||
let ind = indent(last_match)
|
||||
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
|
||||
|
||||
return ind
|
||||
return ind + addSpecial
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -693,7 +709,7 @@ function! GetPhpIndent()
|
||||
if !LastLineClosed
|
||||
|
||||
|
||||
if last_line =~# '[{(]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline
|
||||
if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline
|
||||
|
||||
if !b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{'
|
||||
let ind = ind + &sw
|
||||
@@ -702,7 +718,7 @@ function! GetPhpIndent()
|
||||
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
|
||||
let b:PHP_CurrentIndentLevel = ind
|
||||
|
||||
return ind
|
||||
return ind + addSpecial
|
||||
endif
|
||||
|
||||
elseif last_line =~ '\S\+\s*),'.endline
|
||||
@@ -712,22 +728,21 @@ function! GetPhpIndent()
|
||||
if openedparent != lnum
|
||||
let ind = indent(openedparent)
|
||||
endif
|
||||
|
||||
|
||||
elseif last_line =~ '^\s*'.s:blockstart
|
||||
let ind = ind + &sw
|
||||
|
||||
|
||||
|
||||
elseif AntepenultimateLine =~ '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase
|
||||
elseif AntepenultimateLine =~ '\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
if cline =~ '^\s*);\='
|
||||
if cline =~ '^\s*[)\]];\='
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
let b:PHP_CurrentIndentLevel = ind
|
||||
return ind
|
||||
return ind + addSpecial
|
||||
endfunction
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
"
|
||||
" Menu Translations: Japanese (EUC-JP)
|
||||
" Translated By: MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
" Last Change: 24-Feb-2013.
|
||||
" Last Change: 12-May-2013.
|
||||
"
|
||||
" Copyright (C) 2001-12 MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
" Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
|
||||
|
||||
" Quit when menu translations have already been done.
|
||||
@@ -299,50 +299,6 @@ menutrans Co&lor\ test
|
||||
menutrans &Highlight\ test <09>ϥ<EFBFBD><EFBFBD>饤<EFBFBD>ȥƥ<EFBFBD><EFBFBD><EFBFBD>(&H)
|
||||
menutrans &Convert\ to\ HTML HTML<EFBFBD>إ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD>(&C)
|
||||
|
||||
" Japanese specific menu
|
||||
" <20><><EFBFBD>ݤ<EFBFBD>iconv<6E><76><EFBFBD>衢ɬ<E8A1A2><C9AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꤷ<EFBFBD><EAA4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3A5B3A1>ɤˤʤ<CBA4><CAA4>櫓<EFBFBD>ǤϤʤ<CFA4><CAA4><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD>
|
||||
if has('iconv')
|
||||
" iconv<6E>ΥС<CEA5><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD>
|
||||
let s:support_jisx0213 = (iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb") ? 1 : 0
|
||||
|
||||
" <20>ɤ߹<C9A4><DFB9><EFBFBD>
|
||||
an 10.395 &File.-SEPICONV- <Nop>
|
||||
an 10.396.100.100 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD><EFBFBD>(&O)\.\.\..SJIS(&S)<Tab>fenc=cp932 :browse confirm e ++enc=cp932<CR>
|
||||
if !s:support_jisx0213
|
||||
an 10.396.100.110 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD><EFBFBD>(&O)\.\.\..EUC(&E)<Tab>fenc=euc-jp :browse confirm e ++enc=euc-jp<CR>
|
||||
an 10.396.100.120 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD><EFBFBD>(&O)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp :browse confirm e ++enc=iso-2022-jp<CR>
|
||||
else
|
||||
an 10.396.100.110 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD><EFBFBD>(&O)\.\.\..EUC(&E)<Tab>fenc=euc-jisx0213 :browse confirm e ++enc=euc-jisx0213<CR>
|
||||
an 10.396.100.120 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD><EFBFBD>(&O)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp-3 :browse confirm e ++enc=iso-2022-jp-3<CR>
|
||||
endif
|
||||
an 10.396.100.130 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD><EFBFBD>(&O)\.\.\..UTF-8(&8)<Tab>fenc=utf-8 :browse confirm e ++enc=utf-8<CR>
|
||||
|
||||
" <20><><EFBFBD>ɹ<EFBFBD>
|
||||
an 10.396.110.100 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD>ɹ<EFBFBD>(&R)\.\.\..SJIS(&S)<Tab>fenc=cp932 :e ++enc=cp932<CR>
|
||||
if !s:support_jisx0213
|
||||
an 10.396.110.110 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD>ɹ<EFBFBD>(&R)\.\.\..EUC(&E)<Tab>fenc=euc-jp :e ++enc=euc-jp<CR>
|
||||
an 10.396.110.120 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD>ɹ<EFBFBD>(&R)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp :e ++enc=iso-2022-jp<CR>
|
||||
else
|
||||
an 10.396.110.110 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD>ɹ<EFBFBD>(&R)\.\.\..EUC(&E)<Tab>fenc=euc-jisx0213 :e ++enc=euc-jisx0213<CR>
|
||||
an 10.396.110.120 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD>ɹ<EFBFBD>(&R)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp-3 :e ++enc=iso-2022-jp-3<CR>
|
||||
endif
|
||||
an 10.396.110.130 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><><EFBFBD>ɹ<EFBFBD>(&R)\.\.\..UTF-8(&8)<Tab>fenc=utf-8 :e ++enc=utf-8<CR>
|
||||
|
||||
" <20><>¸
|
||||
an 10.396.115 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..-SEP1- <Nop>
|
||||
an 10.396.120.100 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><>¸(&S)\.\.\..SJIS(&S)<Tab>fenc=cp932 :set fenc=cp932 \| w<CR>
|
||||
if !s:support_jisx0213
|
||||
an 10.396.120.110 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><>¸(&S)\.\.\..EUC(&E)<Tab>fenc=euc-jp :set fenc=euc-jp \| w<CR>
|
||||
an 10.396.120.120 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><>¸(&S)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp :set fenc=iso-2022-jp \| w<CR>
|
||||
else
|
||||
an 10.396.120.110 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><>¸(&S)\.\.\..EUC(&E)<Tab>fenc=euc-jisx0213 :set fenc=euc-jisx0213 \| w<CR>
|
||||
an 10.396.120.120 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><>¸(&S)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp-3 :set fenc=iso-2022-jp-3 \| w<CR>
|
||||
endif
|
||||
an 10.396.120.130 &File.<2E><><EFBFBD><EFBFBD><F3A5B3A1>ɻ<EFBFBD><EFBFBD><EFBFBD>(&E)\.\.\..<2E><>¸(&S)\.\.\..UTF-8(&8)<Tab>fenc=utf-8 :set fenc=utf-8 \| w<CR>
|
||||
|
||||
unlet s:support_jisx0213
|
||||
endif
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
"
|
||||
" Menu Translations: Japanese (UTF-8)
|
||||
" Translated By: MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
" Last Change: 24-Feb-2013.
|
||||
" Last Change: 12-May-2013.
|
||||
"
|
||||
" Copyright (C) 2001-12 MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
" Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
|
||||
|
||||
" Quit when menu translations have already been done.
|
||||
@@ -299,50 +299,6 @@ menutrans Co&lor\ test カラーテスト(&L)
|
||||
menutrans &Highlight\ test ハイライトテスト(&H)
|
||||
menutrans &Convert\ to\ HTML HTMLへコンバート(&C)
|
||||
|
||||
" Japanese specific menu
|
||||
" 成否はiconv次第、必ずしも指定したエンコードになるわけではないことに注意
|
||||
if has('iconv')
|
||||
" iconvのバージョン判定
|
||||
let s:support_jisx0213 = (iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb") ? 1 : 0
|
||||
|
||||
" 読み込み
|
||||
an 10.395 &File.-SEPICONV- <Nop>
|
||||
an 10.396.100.100 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..SJIS(&S)<Tab>fenc=cp932 :browse confirm e ++enc=cp932<CR>
|
||||
if !s:support_jisx0213
|
||||
an 10.396.100.110 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..EUC(&E)<Tab>fenc=euc-jp :browse confirm e ++enc=euc-jp<CR>
|
||||
an 10.396.100.120 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp :browse confirm e ++enc=iso-2022-jp<CR>
|
||||
else
|
||||
an 10.396.100.110 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..EUC(&E)<Tab>fenc=euc-jisx0213 :browse confirm e ++enc=euc-jisx0213<CR>
|
||||
an 10.396.100.120 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp-3 :browse confirm e ++enc=iso-2022-jp-3<CR>
|
||||
endif
|
||||
an 10.396.100.130 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..UTF-8(&8)<Tab>fenc=utf-8 :browse confirm e ++enc=utf-8<CR>
|
||||
|
||||
" 再読込
|
||||
an 10.396.110.100 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..SJIS(&S)<Tab>fenc=cp932 :e ++enc=cp932<CR>
|
||||
if !s:support_jisx0213
|
||||
an 10.396.110.110 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..EUC(&E)<Tab>fenc=euc-jp :e ++enc=euc-jp<CR>
|
||||
an 10.396.110.120 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp :e ++enc=iso-2022-jp<CR>
|
||||
else
|
||||
an 10.396.110.110 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..EUC(&E)<Tab>fenc=euc-jisx0213 :e ++enc=euc-jisx0213<CR>
|
||||
an 10.396.110.120 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp-3 :e ++enc=iso-2022-jp-3<CR>
|
||||
endif
|
||||
an 10.396.110.130 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..UTF-8(&8)<Tab>fenc=utf-8 :e ++enc=utf-8<CR>
|
||||
|
||||
" 保存
|
||||
an 10.396.115 &File.エンコード指定(&E)\.\.\..-SEP1- <Nop>
|
||||
an 10.396.120.100 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..SJIS(&S)<Tab>fenc=cp932 :set fenc=cp932 \| w<CR>
|
||||
if !s:support_jisx0213
|
||||
an 10.396.120.110 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..EUC(&E)<Tab>fenc=euc-jp :set fenc=euc-jp \| w<CR>
|
||||
an 10.396.120.120 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp :set fenc=iso-2022-jp \| w<CR>
|
||||
else
|
||||
an 10.396.120.110 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..EUC(&E)<Tab>fenc=euc-jisx0213 :set fenc=euc-jisx0213 \| w<CR>
|
||||
an 10.396.120.120 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp-3 :set fenc=iso-2022-jp-3 \| w<CR>
|
||||
endif
|
||||
an 10.396.120.130 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..UTF-8(&8)<Tab>fenc=utf-8 :set fenc=utf-8 \| w<CR>
|
||||
|
||||
unlet s:support_jisx0213
|
||||
endif
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
"
|
||||
" Menu Translations: Japanese (CP932)
|
||||
" Translated By: MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
" Last Change: 24-Feb-2013.
|
||||
" Last Change: 12-May-2013.
|
||||
"
|
||||
" Copyright (C) 2001-12 MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
" Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
|
||||
|
||||
" Quit when menu translations have already been done.
|
||||
@@ -299,50 +299,6 @@ menutrans Co&lor\ test
|
||||
menutrans &Highlight\ test <09>n<EFBFBD>C<EFBFBD><EFBFBD><EFBFBD>C<EFBFBD>g<EFBFBD>e<EFBFBD>X<EFBFBD>g(&H)
|
||||
menutrans &Convert\ to\ HTML HTML<EFBFBD>փR<EFBFBD><EFBFBD><EFBFBD>o<EFBFBD>[<5B>g(&C)
|
||||
|
||||
" Japanese specific menu
|
||||
" <20><><EFBFBD>ۂ<EFBFBD>iconv<6E><76><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>K<EFBFBD><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD>肵<EFBFBD><E882B5><EFBFBD>G<EFBFBD><47><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>ɂȂ<C982><C882>킯<EFBFBD>ł͂Ȃ<CD82><C882><EFBFBD><EFBFBD>Ƃɒ<C682><C992><EFBFBD>
|
||||
if has('iconv')
|
||||
" iconv<6E>̃o<CC83>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
let s:support_jisx0213 = (iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb") ? 1 : 0
|
||||
|
||||
" <20>ǂݍ<C782><DD8D><EFBFBD>
|
||||
an 10.395 &File.-SEPICONV- <Nop>
|
||||
an 10.396.100.100 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>J<EFBFBD><EFBFBD>(&O)\.\.\..SJIS(&S)<Tab>fenc=cp932 :browse confirm e ++enc=cp932<CR>
|
||||
if !s:support_jisx0213
|
||||
an 10.396.100.110 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>J<EFBFBD><EFBFBD>(&O)\.\.\..EUC(&E)<Tab>fenc=euc-jp :browse confirm e ++enc=euc-jp<CR>
|
||||
an 10.396.100.120 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>J<EFBFBD><EFBFBD>(&O)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp :browse confirm e ++enc=iso-2022-jp<CR>
|
||||
else
|
||||
an 10.396.100.110 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>J<EFBFBD><EFBFBD>(&O)\.\.\..EUC(&E)<Tab>fenc=euc-jisx0213 :browse confirm e ++enc=euc-jisx0213<CR>
|
||||
an 10.396.100.120 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>J<EFBFBD><EFBFBD>(&O)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp-3 :browse confirm e ++enc=iso-2022-jp-3<CR>
|
||||
endif
|
||||
an 10.396.100.130 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>J<EFBFBD><EFBFBD>(&O)\.\.\..UTF-8(&8)<Tab>fenc=utf-8 :browse confirm e ++enc=utf-8<CR>
|
||||
|
||||
" <20>ēǍ<C493>
|
||||
an 10.396.110.100 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ēǍ<EFBFBD>(&R)\.\.\..SJIS(&S)<Tab>fenc=cp932 :e ++enc=cp932<CR>
|
||||
if !s:support_jisx0213
|
||||
an 10.396.110.110 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ēǍ<EFBFBD>(&R)\.\.\..EUC(&E)<Tab>fenc=euc-jp :e ++enc=euc-jp<CR>
|
||||
an 10.396.110.120 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ēǍ<EFBFBD>(&R)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp :e ++enc=iso-2022-jp<CR>
|
||||
else
|
||||
an 10.396.110.110 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ēǍ<EFBFBD>(&R)\.\.\..EUC(&E)<Tab>fenc=euc-jisx0213 :e ++enc=euc-jisx0213<CR>
|
||||
an 10.396.110.120 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ēǍ<EFBFBD>(&R)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp-3 :e ++enc=iso-2022-jp-3<CR>
|
||||
endif
|
||||
an 10.396.110.130 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ēǍ<EFBFBD>(&R)\.\.\..UTF-8(&8)<Tab>fenc=utf-8 :e ++enc=utf-8<CR>
|
||||
|
||||
" <20>ۑ<EFBFBD>
|
||||
an 10.396.115 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..-SEP1- <Nop>
|
||||
an 10.396.120.100 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ۑ<EFBFBD>(&S)\.\.\..SJIS(&S)<Tab>fenc=cp932 :set fenc=cp932 \| w<CR>
|
||||
if !s:support_jisx0213
|
||||
an 10.396.120.110 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ۑ<EFBFBD>(&S)\.\.\..EUC(&E)<Tab>fenc=euc-jp :set fenc=euc-jp \| w<CR>
|
||||
an 10.396.120.120 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ۑ<EFBFBD>(&S)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp :set fenc=iso-2022-jp \| w<CR>
|
||||
else
|
||||
an 10.396.120.110 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ۑ<EFBFBD>(&S)\.\.\..EUC(&E)<Tab>fenc=euc-jisx0213 :set fenc=euc-jisx0213 \| w<CR>
|
||||
an 10.396.120.120 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ۑ<EFBFBD>(&S)\.\.\..JIS(&J)<Tab>fenc=iso-2022-jp-3 :set fenc=iso-2022-jp-3 \| w<CR>
|
||||
endif
|
||||
an 10.396.120.130 &File.<2E>G<EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD>w<EFBFBD><EFBFBD>(&E)\.\.\..<2E>ۑ<EFBFBD>(&S)\.\.\..UTF-8(&8)<Tab>fenc=utf-8 :set fenc=utf-8 \| w<CR>
|
||||
|
||||
unlet s:support_jisx0213
|
||||
endif
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" These commands create the option window.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2013 Apr 05
|
||||
" Last Change: 2013 May 20
|
||||
|
||||
" If there already is an option window, jump to that one.
|
||||
if bufwinnr("option-window") > 0
|
||||
@@ -258,6 +258,8 @@ call append("$", "incsearch\tshow match for partly typed search command")
|
||||
call <SID>BinOptionG("is", &is)
|
||||
call append("$", "magic\tchange the way backslashes are used in search patterns")
|
||||
call <SID>BinOptionG("magic", &magic)
|
||||
call append("$", "regexpengine\tselect the default regexp engine used")
|
||||
call <SID>OptionG("re", &re)
|
||||
call append("$", "ignorecase\tignore case when using a search pattern")
|
||||
call <SID>BinOptionG("ic", &ic)
|
||||
call append("$", "smartcase\toverride 'ignorecase' when pattern has upper case characters")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
|
||||
" PLUGIN SECTION
|
||||
" Date: Dec 06, 2012
|
||||
" Date: Apr 30, 2013
|
||||
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
|
||||
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
|
||||
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
|
||||
@@ -20,13 +20,15 @@
|
||||
if &cp || exists("g:loaded_netrwPlugin")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwPlugin = "v148"
|
||||
"DechoTabOn
|
||||
let g:loaded_netrwPlugin = "v149"
|
||||
if v:version < 702
|
||||
echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None
|
||||
finish
|
||||
endif
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
"DechoTabOn
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Public Interface: {{{1
|
||||
@@ -34,9 +36,7 @@ set cpo&vim
|
||||
" Local Browsing: {{{2
|
||||
augroup FileExplorer
|
||||
au!
|
||||
" au BufReadCmd *[/\\] sil! call s:LocalBrowse(expand("<amatch>"))
|
||||
" au BufEnter *[^/\\] sil! call s:LocalBrowse(expand("<amatch>"))
|
||||
" au VimEnter *[^/\\] sil! call s:VimEnter(expand("<amatch>"))
|
||||
" SEE Benzinger problem...
|
||||
au BufEnter * sil! call s:LocalBrowse(expand("<amatch>"))
|
||||
au VimEnter * sil! call s:VimEnter(expand("<amatch>"))
|
||||
if has("win32") || has("win95") || has("win64") || has("win16")
|
||||
@@ -47,7 +47,7 @@ augroup END
|
||||
" Network Browsing Reading Writing: {{{2
|
||||
augroup Network
|
||||
au!
|
||||
au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>"))
|
||||
au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>"))
|
||||
au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>"))
|
||||
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>"))
|
||||
au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>"))
|
||||
@@ -92,27 +92,37 @@ fun! s:LocalBrowse(dirname)
|
||||
" unfortunate interaction -- debugging calls can't be used here;
|
||||
" the BufEnter event causes triggering when attempts to write to
|
||||
" the DBG buffer are made.
|
||||
if !exists("s:vimentered")
|
||||
return
|
||||
endif
|
||||
" call Decho("s:LocalBrowse(dirname<".a:dirname.">){")
|
||||
" echomsg "dirname<".a:dirname.">"
|
||||
if has("amiga")
|
||||
" The check against '' is made for the Amiga, where the empty
|
||||
" string is the current directory and not checking would break
|
||||
" things such as the help command.
|
||||
" call Decho("(LocalBrowse) dirname<".a:dirname."> (amiga)")
|
||||
if a:dirname != '' && isdirectory(a:dirname)
|
||||
sil! call netrw#LocalBrowseCheck(a:dirname)
|
||||
endif
|
||||
elseif isdirectory(a:dirname)
|
||||
" echomsg "dirname<".dirname."> isdir"
|
||||
" call Decho("(LocalBrowse) dirname<".a:dirname."> (not amiga)")
|
||||
sil! call netrw#LocalBrowseCheck(a:dirname)
|
||||
endif
|
||||
" not a directory, ignore it
|
||||
" call Decho("|return s:LocalBrowse }")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" s:VimEnter: {{{2
|
||||
fun! s:VimEnter(dirname)
|
||||
let curwin= winnr()
|
||||
" call Decho("VimEnter(dirname<".a:dirname.">){")
|
||||
let curwin = winnr()
|
||||
let s:vimentered = 1
|
||||
windo if a:dirname != expand("%")|call s:LocalBrowse(expand("%:p"))|endif
|
||||
exe curwin."wincmd w"
|
||||
" call Decho("|return VimEnter }")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" 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: 2012 Dec 31
|
||||
" Last Change: 2013 May 05
|
||||
" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/debcontrol.vim
|
||||
|
||||
" Standard syntax initialization
|
||||
@@ -38,7 +38,7 @@ syn match debcontrolDmUpload contained "\cyes"
|
||||
syn match debcontrolHTTPUrl contained "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
|
||||
syn match debcontrolVcsSvn contained "\vsvn%(\+ssh)?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
|
||||
syn match debcontrolVcsCvs contained "\v%(\-d *)?:pserver:[^@]+\@[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?:/[^[:space:]]*%( [^[:space:]]+)?$"
|
||||
syn match debcontrolVcsGit contained "\v%(git|http)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
|
||||
syn match debcontrolVcsGit contained "\v%(git|http)://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?%(\s+-b\s+[^ ~^:?*[\\]+)?$"
|
||||
|
||||
" An email address
|
||||
syn match debcontrolEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
" Vim syntax file
|
||||
" Language: fstab file
|
||||
" Maintaner: Radu Dineiu <radu.dineiu@gmail.com>
|
||||
" URL: http://ld.yi.org/vim/fstab.vim
|
||||
" Last Change: 2009 Feb 04
|
||||
" Version: 0.93
|
||||
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
|
||||
" URL: https://raw.github.com/rid9/vim-fstab/master/fstab.vim
|
||||
" Last Change: 2013 May 21
|
||||
" Version: 1.0
|
||||
"
|
||||
" Credits:
|
||||
" David Necas (Yeti) <yeti@physics.muni.cz>
|
||||
@@ -11,10 +11,13 @@
|
||||
" Georgi Georgiev <chutz@gg3.net>
|
||||
" James Vega <jamessan@debian.org>
|
||||
" Elias Probst <mail@eliasprobst.eu>
|
||||
"
|
||||
|
||||
" Options:
|
||||
" let fstab_unknown_fs_errors = 1
|
||||
" highlight unknown filesystems as errors
|
||||
"
|
||||
" let fstab_unknown_device_errors = 0
|
||||
" do not highlight unknown devices as errors
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
@@ -22,15 +25,18 @@ elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" General
|
||||
syn cluster fsGeneralCluster contains=fsComment
|
||||
syn match fsComment /\s*#.*/
|
||||
syn match fsComment /\s*#.*/ contains=@Spell
|
||||
syn match fsOperator /[,=:#]/
|
||||
|
||||
" Device
|
||||
syn cluster fsDeviceCluster contains=fsOperator,fsDeviceKeyword,fsDeviceError
|
||||
syn match fsDeviceError /\%([^a-zA-Z0-9_\/#@:\.-]\|^\w\{-}\ze\W\)/ contained
|
||||
syn keyword fsDeviceKeyword contained none proc linproc tmpfs devpts sysfs usbfs
|
||||
syn keyword fsDeviceKeyword contained none proc linproc tmpfs devpts devtmpfs sysfs usbfs
|
||||
syn keyword fsDeviceKeyword contained LABEL nextgroup=fsDeviceLabel
|
||||
syn keyword fsDeviceKeyword contained UUID nextgroup=fsDeviceUUID
|
||||
syn keyword fsDeviceKeyword contained sshfs nextgroup=fsDeviceSshfs
|
||||
@@ -47,7 +53,7 @@ syn keyword fsMountPointKeyword contained none swap
|
||||
" Type
|
||||
syn cluster fsTypeCluster contains=fsTypeKeyword,fsTypeUnknown
|
||||
syn match fsTypeUnknown /\s\+\zs\w\+/ contained
|
||||
syn keyword fsTypeKeyword contained adfs ados affs atfs audiofs auto autofs befs bfs cd9660 cfs cifs coda cramfs devfs devpts e2compr efs ext2 ext2fs ext3 ext4 fdesc ffs filecore fuse hfs hpfs iso9660 jffs jffs2 jfs kernfs lfs linprocfs mfs minix msdos ncpfs nfs none ntfs null nwfs overlay ovlfs portal proc procfs ptyfs qnx4 reiserfs romfs shm smbfs sshfs std subfs swap sysfs sysv tcfs tmpfs udf ufs umap umsdos union usbfs userfs vfat vs3fs vxfs wrapfs wvfs xfs zisofs
|
||||
syn keyword fsTypeKeyword contained adfs ados affs anon_inodefs atfs audiofs auto autofs bdev befs bfs btrfs binfmt_misc cd9660 cfs cgroup cifs coda configfs cpuset cramfs devfs devpts devtmpfs e2compr efs ext2 ext2fs ext3 ext4 fdesc ffs filecore fuse fuseblk fusectl hfs hpfs hugetlbfs iso9660 jffs jffs2 jfs kernfs lfs linprocfs mfs minix mqueue msdos ncpfs nfs nfsd nilfs2 none ntfs null nwfs overlay ovlfs pipefs portal proc procfs pstore ptyfs qnx4 reiserfs ramfs romfs securityfs shm smbfs squashfs sockfs sshfs std subfs swap sysfs sysv tcfs tmpfs udf ufs umap umsdos union usbfs userfs vfat vs3fs vxfs wrapfs wvfs xenfs xfs zisofs
|
||||
|
||||
" Options
|
||||
" -------
|
||||
@@ -71,6 +77,11 @@ syn match fsOptionsKeywords contained /\<\%(prefix\|volume\|root\)=/ nextgroup=f
|
||||
syn match fsOptionsKeywords contained /\<bs=/ nextgroup=fsOptionsSize
|
||||
syn keyword fsOptionsKeywords contained protect usemp verbose
|
||||
|
||||
" Options: btrfs
|
||||
syn match fsOptionsKeywords contained /\<\%(subvol\|subvolid\|subvolrootid\|device\|compress\|compress-force\|fatal_errors\)=/ nextgroup=fsOptionsString
|
||||
syn match fsOptionsKeywords contained /\<\%(max_inline\|alloc_start\|thread_pool\|metadata_ratio\|check_int_print_mask\)=/ nextgroup=fsOptionsNumber
|
||||
syn keyword fsOptionsKeywords contained degraded nodatasum nodatacow nobarrier ssd ssd_spread noacl notreelog flushoncommit space_cache nospace_cache clear_cache user_subvol_rm_allowed autodefrag inode_cache enospc_debug recovery check_int check_int_data skip_balance discard
|
||||
|
||||
" Options: cd9660
|
||||
syn keyword fsOptionsKeywords contained extatt gens norrip nostrictjoilet
|
||||
|
||||
@@ -84,7 +95,7 @@ syn match fsOptionsKeywords contained /\<\%(res[gu]id\|sb\)=/ nextgroup=fsOption
|
||||
syn keyword fsOptionsExt2Check contained none normal strict
|
||||
syn keyword fsOptionsExt2Errors contained continue panic
|
||||
syn match fsOptionsExt2Errors contained /\<remount-ro\>/
|
||||
syn keyword fsOptionsKeywords contained acl bsddf minixdf debug grpid bsdgroups minixdf noacl nocheck nogrpid oldalloc orlov sysvgroups nouid32 nobh user_xattr nouser_xattr
|
||||
syn keyword fsOptionsKeywords contained acl bsddf minixdf debug grpid bsdgroups minixdf nocheck nogrpid oldalloc orlov sysvgroups nouid32 nobh user_xattr nouser_xattr
|
||||
|
||||
" Options: ext3
|
||||
syn match fsOptionsKeywords contained /\<journal=/ nextgroup=fsOptionsExt3Journal
|
||||
@@ -92,7 +103,7 @@ syn match fsOptionsKeywords contained /\<data=/ nextgroup=fsOptionsExt3Data
|
||||
syn match fsOptionsKeywords contained /\<commit=/ nextgroup=fsOptionsNumber
|
||||
syn keyword fsOptionsExt3Journal contained update inum
|
||||
syn keyword fsOptionsExt3Data contained journal ordered writeback
|
||||
syn keyword fsOptionsKeywords contained noload user_xattr nouser_xattr acl noacl
|
||||
syn keyword fsOptionsKeywords contained noload user_xattr nouser_xattr acl
|
||||
|
||||
" Options: ext4
|
||||
syn match fsOptionsKeywords contained /\<journal=/ nextgroup=fsOptionsExt4Journal
|
||||
@@ -216,7 +227,7 @@ syn match fsOptions /\s\+.\{-}\s/me=e-1 nextgroup=fsFreqPass contains=@fsOptions
|
||||
syn match fsFreqPass /\s\+.\{-}$/ contains=@fsFreqPassCluster,@fsGeneralCluster contained
|
||||
|
||||
" Whole line comments
|
||||
syn match fsCommentLine /^#.*$/
|
||||
syn match fsCommentLine /^#.*$/ contains=@Spell
|
||||
|
||||
if version >= 508 || !exists("did_config_syntax_inits")
|
||||
if version < 508
|
||||
@@ -241,7 +252,10 @@ if version >= 508 || !exists("did_config_syntax_inits")
|
||||
HiLink fsTypeUnknown Error
|
||||
endif
|
||||
|
||||
HiLink fsDeviceError Error
|
||||
if !exists('fstab_unknown_device_errors') || fstab_unknown_device_errors == 1
|
||||
HiLink fsDeviceError Error
|
||||
endif
|
||||
|
||||
HiLink fsMountPointError Error
|
||||
HiLink fsMountPointKeyword Keyword
|
||||
HiLink fsFreqPassError Error
|
||||
@@ -277,4 +291,7 @@ endif
|
||||
|
||||
let b:current_syntax = "fstab"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: ts=8 ft=vim
|
||||
|
||||
@@ -102,12 +102,11 @@ syn match rComplex "\<\d\+[Ee][-+]\=\d\+i"
|
||||
|
||||
syn match rOperator "&"
|
||||
syn match rOperator '-'
|
||||
syn match rOperator '*'
|
||||
syn match rOperator '\*'
|
||||
syn match rOperator '+'
|
||||
syn match rOperator '='
|
||||
syn match rOperator "[|!<>^~`/:@]"
|
||||
syn match rOperator "%\{2}\|%\*%\|%\/%\|%in%\|%o%\|%x%"
|
||||
syn match rOpError '*\{3}'
|
||||
syn match rOpError '//'
|
||||
syn match rOpError '&&&'
|
||||
syn match rOpError '|||'
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
" Vim syntax file
|
||||
" Language: resolver configuration file
|
||||
" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
|
||||
" Original Maintaner: Radu Dineiu <littledragon@altern.org>
|
||||
" License: This file can be redistributed and/or modified under the same terms
|
||||
" as Vim itself.
|
||||
" Last Change: 2012-05-24
|
||||
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
|
||||
" URL: https://raw.github.com/rid9/vim-resolv/master/resolv.vim
|
||||
" Last Change: 2013 May 21
|
||||
" Version: 1.0
|
||||
"
|
||||
" Credits:
|
||||
" David Necas (Yeti) <yeti@physics.muni.cz>
|
||||
" Stefano Zacchiroli <zack@debian.org>
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
@@ -14,18 +17,18 @@ endif
|
||||
|
||||
" Errors, comments and operators
|
||||
syn match resolvError /./
|
||||
syn match resolvComment /\s*[#;].*$/ contains=@Spell
|
||||
syn match resolvOperator /[/:]/ contained
|
||||
syn match resolvComment /\s*[#;].*$/
|
||||
syn match resolvOperator /[\/:]/ contained
|
||||
|
||||
" IP
|
||||
syn cluster resolvIPCluster contains=resolvIPError,resolvIPSpecial
|
||||
syn match resolvIPError /\%(\d\{4,}\|25[6-9]\|2[6-9]\d\|[3-9]\d\{2}\)[.0-9]*/ contained
|
||||
syn match resolvIPError /\%(\d\{4,}\|25[6-9]\|2[6-9]\d\|[3-9]\d\{2}\)[\.0-9]*/ contained
|
||||
syn match resolvIPSpecial /\%(127\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\)/ contained
|
||||
|
||||
" General
|
||||
syn match resolvIP contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}/ contains=@resolvIPCluster
|
||||
syn match resolvIPNetmask contained /\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\/\%(\%(\d\{1,4}\.\)\{,3}\d\{1,4}\)\)\?/ contains=resolvOperator,@resolvIPCluster
|
||||
syn match resolvHostname contained /\w\{-}\.[-0-9A-Za-z_.]*/
|
||||
syn match resolvHostname contained /\w\{-}\.[-0-9A-Za-z_\.]*/
|
||||
|
||||
" Particular
|
||||
syn match resolvIPNameserver contained /\%(\%(\d\{1,4}\.\)\{3}\d\{1,4}\%(\s\|$\)\)\+/ contains=@resolvIPCluster
|
||||
@@ -41,8 +44,6 @@ syn match resolvSortList /^\s*sortlist\>/ nextgroup=resolvIPNetmaskSortList skip
|
||||
syn match resolvOptions /^\s*options\>/ nextgroup=resolvOption skipwhite
|
||||
|
||||
" Options
|
||||
" FIXME: The manual page and the source code do not exactly agree on the set
|
||||
" of allowed options
|
||||
syn match resolvOption /\<\%(debug\|no_tld_query\|rotate\|no-check-names\|inet6\)\>/ contained nextgroup=resolvOption skipwhite
|
||||
syn match resolvOption /\<\%(ndots\|timeout\|attempts\):\d\+\>/ contained contains=resolvOperator nextgroup=resolvOption skipwhite
|
||||
|
||||
|
||||
@@ -672,6 +672,9 @@ endif
|
||||
$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP)
|
||||
$(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
|
||||
|
||||
$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
|
||||
$(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
|
||||
|
||||
$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
|
||||
$(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
|
||||
|
||||
|
||||
@@ -765,6 +765,9 @@ if_perl.c: if_perl.xs typemap
|
||||
$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
|
||||
$(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
|
||||
|
||||
$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL)
|
||||
$(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o
|
||||
|
||||
$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
|
||||
$(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# !!!! After changing features do "nmake clean" first !!!!
|
||||
#
|
||||
# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is BIG)
|
||||
# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is BIG)
|
||||
#
|
||||
# GUI interface: GUI=yes (default is no)
|
||||
#
|
||||
@@ -87,20 +87,20 @@
|
||||
# GETTEXT=[yes or no] (default is yes)
|
||||
# See http://sourceforge.net/projects/gettext/
|
||||
#
|
||||
# PostScript printing: POSTSCRIPT=yes (default is no)
|
||||
# PostScript printing: POSTSCRIPT=yes (default is no)
|
||||
#
|
||||
# Netbeans Support: NETBEANS=[yes or no] (default is yes if GUI is yes)
|
||||
# Netbeans Support: NETBEANS=[yes or no] (default is yes if GUI is yes)
|
||||
#
|
||||
# XPM Image Support: XPM=[path to XPM directory]
|
||||
# Default is "xpm", using the files included in the distribution.
|
||||
# Use "no" to disable this feature.
|
||||
# XPM Image Support: XPM=[path to XPM directory]
|
||||
# Default is "xpm", using the files included in the distribution.
|
||||
# Use "no" to disable this feature.
|
||||
#
|
||||
# Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED)
|
||||
# Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED)
|
||||
#
|
||||
# Processor Version: CPUNR=[i386, i486, i586, i686, pentium4] (default is
|
||||
# i386)
|
||||
# Processor Version: CPUNR=[i386, i486, i586, i686, pentium4] (default is
|
||||
# i386)
|
||||
#
|
||||
# Version Support: WINVER=[0x0400, 0x0500] (default is 0x0400)
|
||||
# Version Support: WINVER=[0x0400, 0x0500] (default is 0x0400)
|
||||
#
|
||||
# Debug version: DEBUG=yes
|
||||
# Mapfile: MAP=[no, yes or lines] (default is yes)
|
||||
@@ -108,10 +108,12 @@
|
||||
# yes: Write a normal mapfile.
|
||||
# lines: Write a mapfile with line numbers (only for VC6 and later)
|
||||
#
|
||||
# Netbeans Debugging Support: NBDEBUG=[yes or no] (should be no, yes
|
||||
# doesn't work)
|
||||
# Netbeans Debugging Support: NBDEBUG=[yes or no] (should be no, yes
|
||||
# doesn't work)
|
||||
#
|
||||
# Visual C Version: MSVCVER=m.n (default derived from nmake if undefined)
|
||||
# Visual C Version: MSVCVER=m.n (default derived from nmake if undefined)
|
||||
#
|
||||
# Static Code Analysis: ANALYZE=yes (works with VS2012 only)
|
||||
#
|
||||
# You can combine any of these interfaces
|
||||
#
|
||||
@@ -479,6 +481,11 @@ OPTFLAG = $(OPTFLAG) /GL
|
||||
CFLAGS=$(CFLAGS) $(WP64CHECK)
|
||||
!endif
|
||||
|
||||
# Static code analysis generally available starting with VS2012
|
||||
!if ("$(ANALYZE)" == "yes") && ("$(MSVCVER)" == "11.0")
|
||||
CFLAGS=$(CFLAGS) /analyze
|
||||
!endif
|
||||
|
||||
CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG $(CPUARG)
|
||||
RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG
|
||||
! ifdef USE_MSVCRT
|
||||
@@ -1166,7 +1173,7 @@ $(OUTDIR)/popupmnu.obj: $(OUTDIR) popupmnu.c $(INCL)
|
||||
|
||||
$(OUTDIR)/quickfix.obj: $(OUTDIR) quickfix.c $(INCL)
|
||||
|
||||
$(OUTDIR)/regexp.obj: $(OUTDIR) regexp.c $(INCL)
|
||||
$(OUTDIR)/regexp.obj: $(OUTDIR) regexp.c regexp_nfa.c $(INCL)
|
||||
|
||||
$(OUTDIR)/screen.obj: $(OUTDIR) screen.c $(INCL)
|
||||
|
||||
|
||||
25
src/Makefile
25
src/Makefile
@@ -454,7 +454,7 @@ CClink = $(CC)
|
||||
|
||||
# MULTIBYTE - To edit multi-byte characters.
|
||||
# Uncomment this when you want to edit a multibyte language.
|
||||
# It's automatically enabled with big features or IME support.
|
||||
# It's automatically enabled with normal features, GTK or IME support.
|
||||
# Note: Compile on a machine where setlocale() actually works, otherwise the
|
||||
# configure tests may fail.
|
||||
#CONF_OPT_MULTIBYTE = --enable-multibyte
|
||||
@@ -1861,6 +1861,19 @@ unittest unittests: $(UNITTEST_TARGETS)
|
||||
./$$t || exit 1; echo $$t passed; \
|
||||
done
|
||||
|
||||
# Run individual test, assuming that Vim was already compiled.
|
||||
test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 \
|
||||
test11 test12 test13 test14 test15 test16 test17 test18 test19 \
|
||||
test21 test22 test23 test24 test25 test26 test27 test28 test29 \
|
||||
test31 test32 test33 test34 test35 test36 test37 test38 test39 \
|
||||
test41 test42 test43 test44 test45 test46 test47 test48 test49 \
|
||||
test51 test52 test53 test54 test55 test56 test57 test58 test59 \
|
||||
test61 test62 test63 test64 test65 test66 test67 test68 test69 \
|
||||
test71 test72 test73 test74 test75 test76 test77 test78 test79 \
|
||||
test81 test82 test83 test84 test85 test86 test87 test88 test89 \
|
||||
test91 test92 test93 test94 test95 test96 test97 test98 test99:
|
||||
cd testdir; rm $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET)
|
||||
|
||||
testclean:
|
||||
cd testdir; $(MAKE) -f Makefile clean
|
||||
if test -d $(PODIR); then \
|
||||
@@ -2664,7 +2677,7 @@ objects/popupmnu.o: popupmnu.c
|
||||
objects/quickfix.o: quickfix.c
|
||||
$(CCC) -o $@ quickfix.c
|
||||
|
||||
objects/regexp.o: regexp.c
|
||||
objects/regexp.o: regexp.c regexp_nfa.c
|
||||
$(CCC) -o $@ regexp.c
|
||||
|
||||
objects/screen.o: screen.c
|
||||
@@ -2938,10 +2951,10 @@ objects/quickfix.o: quickfix.c vim.h auto/config.h feature.h os_unix.h \
|
||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \
|
||||
regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \
|
||||
globals.h farsi.h arabic.h
|
||||
objects/regexp.o: regexp.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \
|
||||
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
|
||||
gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \
|
||||
arabic.h
|
||||
objects/regexp.o: regexp.c regexp_nfa.c vim.h auto/config.h feature.h os_unix.h \
|
||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \
|
||||
regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \
|
||||
globals.h farsi.h arabic.h
|
||||
objects/screen.o: screen.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \
|
||||
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
|
||||
gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \
|
||||
|
||||
16
src/edit.c
16
src/edit.c
@@ -382,13 +382,21 @@ edit(cmdchar, startln, count)
|
||||
else
|
||||
ptr = (char_u *)"i";
|
||||
set_vim_var_string(VV_INSERTMODE, ptr, 1);
|
||||
set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
|
||||
# endif
|
||||
apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf);
|
||||
|
||||
/* Since Insert mode was not started yet a call to check_cursor_col()
|
||||
* may have moved the cursor, especially with the "A" command. */
|
||||
if (curwin->w_cursor.col != save_cursor.col
|
||||
&& curwin->w_cursor.lnum == save_cursor.lnum)
|
||||
/* Make sure the cursor didn't move. Do call check_cursor_col() in
|
||||
* case the text was modified. Since Insert mode was not started yet
|
||||
* a call to check_cursor_col() may move the cursor, especially with
|
||||
* the "A" command, thus set State to avoid that. Also check that the
|
||||
* line number is still valid (lines may have been deleted).
|
||||
* Do not restore if v:char was set to a non-empty string. */
|
||||
if (!equalpos(curwin->w_cursor, save_cursor)
|
||||
# ifdef FEAT_EVAL
|
||||
&& *get_vim_var_str(VV_CHAR) == NUL
|
||||
# endif
|
||||
&& save_cursor.lnum <= curbuf->b_ml.ml_line_count)
|
||||
{
|
||||
int save_state = State;
|
||||
|
||||
|
||||
@@ -1447,6 +1447,11 @@ gui_mch_init_check(void)
|
||||
using_gnome = 1;
|
||||
#endif
|
||||
|
||||
/* This defaults to argv[0], but we want it to match the name of the
|
||||
* shipped gvim.desktop so that Vim's windows can be associated with this
|
||||
* file. */
|
||||
g_set_prgname("gvim");
|
||||
|
||||
/* Don't use gtk_init() or gnome_init(), it exits on failure. */
|
||||
if (!gtk_init_check(&gui_argc, &gui_argv))
|
||||
{
|
||||
|
||||
1006
src/if_py_both.h
1006
src/if_py_both.h
File diff suppressed because it is too large
Load Diff
248
src/if_python.c
248
src/if_python.c
@@ -56,8 +56,6 @@
|
||||
# define PY_SSIZE_T_CLEAN
|
||||
#endif
|
||||
|
||||
static void init_structs(void);
|
||||
|
||||
#define PyBytes_FromString PyString_FromString
|
||||
#define PyBytes_Check PyString_Check
|
||||
|
||||
@@ -226,6 +224,9 @@ struct PyMethodDef { Py_ssize_t a; };
|
||||
# define Py_Finalize dll_Py_Finalize
|
||||
# define Py_IsInitialized dll_Py_IsInitialized
|
||||
# define _PyObject_New dll__PyObject_New
|
||||
# define _PyObject_GC_New dll__PyObject_GC_New
|
||||
# define PyObject_GC_Del dll_PyObject_GC_Del
|
||||
# define PyObject_GC_UnTrack dll_PyObject_GC_UnTrack
|
||||
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
|
||||
# define _PyObject_NextNotImplemented (*dll__PyObject_NextNotImplemented)
|
||||
# endif
|
||||
@@ -333,6 +334,9 @@ static void(*dll_Py_Initialize)(void);
|
||||
static void(*dll_Py_Finalize)(void);
|
||||
static int(*dll_Py_IsInitialized)(void);
|
||||
static PyObject*(*dll__PyObject_New)(PyTypeObject *, PyObject *);
|
||||
static PyObject*(*dll__PyObject_GC_New)(PyTypeObject *);
|
||||
static void(*dll_PyObject_GC_Del)(void *);
|
||||
static void(*dll_PyObject_GC_UnTrack)(void *);
|
||||
static PyObject*(*dll__PyObject_Init)(PyObject *, PyTypeObject *);
|
||||
static PyObject* (*dll_PyObject_GetIter)(PyObject *);
|
||||
static int (*dll_PyObject_IsTrue)(PyObject *);
|
||||
@@ -476,6 +480,9 @@ static struct
|
||||
{"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize},
|
||||
{"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized},
|
||||
{"_PyObject_New", (PYTHON_PROC*)&dll__PyObject_New},
|
||||
{"_PyObject_GC_New", (PYTHON_PROC*)&dll__PyObject_GC_New},
|
||||
{"PyObject_GC_Del", (PYTHON_PROC*)&dll_PyObject_GC_Del},
|
||||
{"PyObject_GC_UnTrack", (PYTHON_PROC*)&dll_PyObject_GC_UnTrack},
|
||||
{"PyObject_Init", (PYTHON_PROC*)&dll__PyObject_Init},
|
||||
{"PyObject_GetIter", (PYTHON_PROC*)&dll_PyObject_GetIter},
|
||||
{"PyObject_IsTrue", (PYTHON_PROC*)&dll_PyObject_IsTrue},
|
||||
@@ -634,7 +641,7 @@ static int initialised = 0;
|
||||
#define DICTKEY_UNREF
|
||||
#define DICTKEY_DECL
|
||||
|
||||
#define DESTRUCTOR_FINISH(self) Py_DECREF(self);
|
||||
#define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
|
||||
#define WIN_PYTHON_REF(win) win->w_python_ref
|
||||
#define BUF_PYTHON_REF(buf) buf->b_python_ref
|
||||
@@ -659,18 +666,8 @@ static PyObject *FunctionGetattr(PyObject *, char *);
|
||||
* Internal function prototypes.
|
||||
*/
|
||||
|
||||
static PyObject *globals;
|
||||
|
||||
static void PythonIO_Flush(void);
|
||||
static int PythonIO_Init(void);
|
||||
static int PythonMod_Init(void);
|
||||
|
||||
/* Utility functions for the vim/python interface
|
||||
* ----------------------------------------------
|
||||
*/
|
||||
|
||||
static int SetBufferLineList(buf_T *, PyInt, PyInt, PyObject *, PyInt *);
|
||||
|
||||
|
||||
/******************************************************
|
||||
* 1. Python interpreter main program.
|
||||
@@ -783,7 +780,7 @@ Python_Init(void)
|
||||
get_exceptions();
|
||||
#endif
|
||||
|
||||
if (PythonIO_Init())
|
||||
if (PythonIO_Init_io())
|
||||
goto fail;
|
||||
|
||||
if (PythonMod_Init())
|
||||
@@ -817,7 +814,7 @@ Python_Init(void)
|
||||
fail:
|
||||
/* We call PythonIO_Flush() here to print any Python errors.
|
||||
* This is OK, as it is possible to call this function even
|
||||
* if PythonIO_Init() has not completed successfully (it will
|
||||
* if PythonIO_Init_io() has not completed successfully (it will
|
||||
* not do anything in this case).
|
||||
*/
|
||||
PythonIO_Flush();
|
||||
@@ -828,7 +825,7 @@ fail:
|
||||
* External interface
|
||||
*/
|
||||
static void
|
||||
DoPythonCommand(exarg_T *eap, const char *cmd, typval_T *rettv)
|
||||
DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg)
|
||||
{
|
||||
#ifndef PY_CAN_RECURSE
|
||||
static int recursive = 0;
|
||||
@@ -861,16 +858,8 @@ DoPythonCommand(exarg_T *eap, const char *cmd, typval_T *rettv)
|
||||
if (Python_Init())
|
||||
goto theend;
|
||||
|
||||
if (rettv == NULL)
|
||||
{
|
||||
RangeStart = eap->line1;
|
||||
RangeEnd = eap->line2;
|
||||
}
|
||||
else
|
||||
{
|
||||
RangeStart = (PyInt) curwin->w_cursor.lnum;
|
||||
RangeEnd = RangeStart;
|
||||
}
|
||||
init_range(arg);
|
||||
|
||||
Python_Release_Vim(); /* leave vim */
|
||||
|
||||
#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
|
||||
@@ -892,27 +881,7 @@ DoPythonCommand(exarg_T *eap, const char *cmd, typval_T *rettv)
|
||||
Python_RestoreThread(); /* enter python */
|
||||
#endif
|
||||
|
||||
if (rettv == NULL)
|
||||
PyRun_SimpleString((char *)(cmd));
|
||||
else
|
||||
{
|
||||
PyObject *r;
|
||||
|
||||
r = PyRun_String((char *)(cmd), Py_eval_input, globals, globals);
|
||||
if (r == NULL)
|
||||
{
|
||||
if (PyErr_Occurred() && !msg_silent)
|
||||
PyErr_PrintEx(0);
|
||||
EMSG(_("E858: Eval did not return a valid python object"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ConvertFromPyObject(r, rettv) == -1)
|
||||
EMSG(_("E859: Failed to convert returned python object to vim value"));
|
||||
Py_DECREF(r);
|
||||
}
|
||||
PyErr_Clear();
|
||||
}
|
||||
run((char *) cmd, arg, &pygilstate);
|
||||
|
||||
#ifdef PY_CAN_RECURSE
|
||||
PyGILState_Release(pygilstate);
|
||||
@@ -952,10 +921,10 @@ ex_python(exarg_T *eap)
|
||||
script = script_get(eap, eap->arg);
|
||||
if (!eap->skip)
|
||||
{
|
||||
if (script == NULL)
|
||||
DoPythonCommand(eap, (char *)eap->arg, NULL);
|
||||
else
|
||||
DoPythonCommand(eap, (char *)script, NULL);
|
||||
DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
|
||||
(rangeinitializer) init_range_cmd,
|
||||
(runner) run_cmd,
|
||||
(void *) eap);
|
||||
}
|
||||
vim_free(script);
|
||||
}
|
||||
@@ -1001,94 +970,19 @@ ex_pyfile(exarg_T *eap)
|
||||
*p++ = '\0';
|
||||
|
||||
/* Execute the file */
|
||||
DoPythonCommand(eap, buffer, NULL);
|
||||
DoPyCommand(buffer,
|
||||
(rangeinitializer) init_range_cmd,
|
||||
(runner) run_cmd,
|
||||
(void *) eap);
|
||||
}
|
||||
|
||||
void
|
||||
ex_pydo(exarg_T *eap)
|
||||
{
|
||||
linenr_T i;
|
||||
const char *code_hdr = "def " DOPY_FUNC "(line, linenr):\n ";
|
||||
const char *s = (const char *) eap->arg;
|
||||
size_t len;
|
||||
char *code;
|
||||
int status;
|
||||
PyObject *pyfunc, *pymain;
|
||||
PyGILState_STATE pygilstate;
|
||||
|
||||
if (Python_Init())
|
||||
return;
|
||||
|
||||
if (u_save(eap->line1 - 1, eap->line2 + 1) != OK)
|
||||
{
|
||||
EMSG(_("cannot save undo information"));
|
||||
return;
|
||||
}
|
||||
len = strlen(code_hdr) + strlen(s);
|
||||
code = malloc(len + 1);
|
||||
STRCPY(code, code_hdr);
|
||||
STRNCAT(code, s, len + 1);
|
||||
pygilstate = PyGILState_Ensure();
|
||||
status = PyRun_SimpleString(code);
|
||||
vim_free(code);
|
||||
if (status)
|
||||
{
|
||||
EMSG(_("failed to run the code"));
|
||||
return;
|
||||
}
|
||||
status = 0; /* good */
|
||||
pymain = PyImport_AddModule("__main__");
|
||||
pyfunc = PyObject_GetAttrString(pymain, DOPY_FUNC);
|
||||
PyGILState_Release(pygilstate);
|
||||
|
||||
for (i = eap->line1; i <= eap->line2; i++)
|
||||
{
|
||||
const char *line;
|
||||
PyObject *pyline, *pylinenr, *pyret;
|
||||
|
||||
line = (char *)ml_get(i);
|
||||
pygilstate = PyGILState_Ensure();
|
||||
pyline = PyString_FromStringAndSize(line, strlen(line));
|
||||
pylinenr = PyLong_FromLong(i);
|
||||
pyret = PyObject_CallFunctionObjArgs(pyfunc, pyline, pylinenr, NULL);
|
||||
Py_DECREF(pyline);
|
||||
Py_DECREF(pylinenr);
|
||||
if (!pyret)
|
||||
{
|
||||
PyErr_PrintEx(0);
|
||||
PythonIO_Flush();
|
||||
status = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pyret && pyret != Py_None)
|
||||
{
|
||||
if (!PyString_Check(pyret))
|
||||
{
|
||||
EMSG(_("E863: return value must be an instance of str"));
|
||||
Py_XDECREF(pyret);
|
||||
status = 1;
|
||||
goto out;
|
||||
}
|
||||
ml_replace(i, (char_u *) PyString_AsString(pyret), 1);
|
||||
changed();
|
||||
#ifdef SYNTAX_HL
|
||||
syn_changed(i); /* recompute syntax hl. for this line */
|
||||
#endif
|
||||
}
|
||||
Py_XDECREF(pyret);
|
||||
PythonIO_Flush();
|
||||
PyGILState_Release(pygilstate);
|
||||
}
|
||||
pygilstate = PyGILState_Ensure();
|
||||
out:
|
||||
Py_DECREF(pyfunc);
|
||||
PyObject_SetAttrString(pymain, DOPY_FUNC, NULL);
|
||||
PyGILState_Release(pygilstate);
|
||||
if (status)
|
||||
return;
|
||||
check_cursor();
|
||||
update_curbuf(NOT_VALID);
|
||||
DoPyCommand((char *)eap->arg,
|
||||
(rangeinitializer) init_range_cmd,
|
||||
(runner)run_do,
|
||||
(void *)eap);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
@@ -1107,24 +1001,10 @@ OutputGetattr(PyObject *self, char *name)
|
||||
return Py_FindMethod(OutputMethods, self, name);
|
||||
}
|
||||
|
||||
/***************/
|
||||
|
||||
static int
|
||||
PythonIO_Init(void)
|
||||
{
|
||||
/* Fixups... */
|
||||
PyType_Ready(&OutputType);
|
||||
|
||||
return PythonIO_Init_io();
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* 3. Implementation of the Vim module for Python
|
||||
*/
|
||||
|
||||
static PyObject *ConvertToPyObject(typval_T *);
|
||||
static int ConvertFromPyObject(PyObject *, typval_T *);
|
||||
|
||||
/* Window type - Implementation functions
|
||||
* --------------------------------------
|
||||
*/
|
||||
@@ -1359,47 +1239,26 @@ python_tabpage_free(tabpage_T *tab)
|
||||
}
|
||||
#endif
|
||||
|
||||
static BufMapObject TheBufferMap =
|
||||
static int
|
||||
add_object(PyObject *dict, const char *name, PyObject *object)
|
||||
{
|
||||
PyObject_HEAD_INIT(&BufMapType)
|
||||
};
|
||||
|
||||
static WinListObject TheWindowList =
|
||||
{
|
||||
PyObject_HEAD_INIT(&WinListType)
|
||||
NULL
|
||||
};
|
||||
|
||||
static CurrentObject TheCurrent =
|
||||
{
|
||||
PyObject_HEAD_INIT(&CurrentType)
|
||||
};
|
||||
|
||||
static TabListObject TheTabPageList =
|
||||
{
|
||||
PyObject_HEAD_INIT(&TabListType)
|
||||
};
|
||||
if (PyDict_SetItemString(dict, (char *) name, object))
|
||||
return -1;
|
||||
Py_DECREF(object);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
PythonMod_Init(void)
|
||||
{
|
||||
PyObject *mod;
|
||||
PyObject *dict;
|
||||
PyObject *tmp;
|
||||
|
||||
/* The special value is removed from sys.path in Python_Init(). */
|
||||
static char *(argv[2]) = {"/must>not&exist/foo", NULL};
|
||||
|
||||
/* Fixups... */
|
||||
PyType_Ready(&IterType);
|
||||
PyType_Ready(&BufferType);
|
||||
PyType_Ready(&RangeType);
|
||||
PyType_Ready(&WindowType);
|
||||
PyType_Ready(&TabPageType);
|
||||
PyType_Ready(&BufMapType);
|
||||
PyType_Ready(&WinListType);
|
||||
PyType_Ready(&TabListType);
|
||||
PyType_Ready(&CurrentType);
|
||||
PyType_Ready(&OptionsType);
|
||||
if (init_types())
|
||||
return -1;
|
||||
|
||||
/* Set sys.argv[] to avoid a crash in warn(). */
|
||||
PySys_SetArgv(1, argv);
|
||||
@@ -1407,31 +1266,7 @@ PythonMod_Init(void)
|
||||
mod = Py_InitModule4("vim", VimMethods, (char *)NULL, (PyObject *)NULL, PYTHON_API_VERSION);
|
||||
dict = PyModule_GetDict(mod);
|
||||
|
||||
VimError = PyErr_NewException("vim.error", NULL, NULL);
|
||||
|
||||
PyDict_SetItemString(dict, "error", VimError);
|
||||
PyDict_SetItemString(dict, "buffers", (PyObject *)(void *)&TheBufferMap);
|
||||
PyDict_SetItemString(dict, "current", (PyObject *)(void *)&TheCurrent);
|
||||
PyDict_SetItemString(dict, "windows", (PyObject *)(void *)&TheWindowList);
|
||||
PyDict_SetItemString(dict, "tabpages", (PyObject *)(void *)&TheTabPageList);
|
||||
tmp = DictionaryNew(&globvardict);
|
||||
PyDict_SetItemString(dict, "vars", tmp);
|
||||
Py_DECREF(tmp);
|
||||
tmp = DictionaryNew(&vimvardict);
|
||||
PyDict_SetItemString(dict, "vvars", tmp);
|
||||
Py_DECREF(tmp);
|
||||
tmp = OptionsNew(SREQ_GLOBAL, NULL, dummy_check, NULL);
|
||||
PyDict_SetItemString(dict, "options", tmp);
|
||||
Py_DECREF(tmp);
|
||||
PyDict_SetItemString(dict, "VAR_LOCKED", PyInt_FromLong(VAR_LOCKED));
|
||||
PyDict_SetItemString(dict, "VAR_FIXED", PyInt_FromLong(VAR_FIXED));
|
||||
PyDict_SetItemString(dict, "VAR_SCOPE", PyInt_FromLong(VAR_SCOPE));
|
||||
PyDict_SetItemString(dict, "VAR_DEF_SCOPE", PyInt_FromLong(VAR_DEF_SCOPE));
|
||||
|
||||
if (PyErr_Occurred())
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return populate_module(dict, add_object);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
@@ -1525,7 +1360,10 @@ FunctionGetattr(PyObject *self, char *name)
|
||||
void
|
||||
do_pyeval (char_u *str, typval_T *rettv)
|
||||
{
|
||||
DoPythonCommand(NULL, (char *) str, rettv);
|
||||
DoPyCommand((char *) str,
|
||||
(rangeinitializer) init_range_eval,
|
||||
(runner) run_eval,
|
||||
(void *) rettv);
|
||||
switch(rettv->v_type)
|
||||
{
|
||||
case VAR_DICT: ++rettv->vval.v_dict->dv_refcount; break;
|
||||
|
||||
305
src/if_python3.c
305
src/if_python3.c
@@ -68,8 +68,6 @@
|
||||
# define PY_SSIZE_T_CLEAN
|
||||
#endif
|
||||
|
||||
static void init_structs(void);
|
||||
|
||||
/* The "surrogateescape" error handler is new in Python 3.1 */
|
||||
#if PY_VERSION_HEX >= 0x030100f0
|
||||
# define CODEC_ERROR_HANDLER "surrogateescape"
|
||||
@@ -215,6 +213,9 @@ static void init_structs(void);
|
||||
# define PyObject_Malloc py3_PyObject_Malloc
|
||||
# define PyObject_Free py3_PyObject_Free
|
||||
# endif
|
||||
# define _PyObject_GC_New py3__PyObject_GC_New
|
||||
# define PyObject_GC_Del py3_PyObject_GC_Del
|
||||
# define PyObject_GC_UnTrack py3_PyObject_GC_UnTrack
|
||||
# define PyType_GenericAlloc py3_PyType_GenericAlloc
|
||||
# define PyType_GenericNew py3_PyType_GenericNew
|
||||
# define PyModule_Create2 py3_PyModule_Create2
|
||||
@@ -336,6 +337,9 @@ static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *);
|
||||
static void (*py3_PyObject_Free)(void*);
|
||||
static void* (*py3_PyObject_Malloc)(size_t);
|
||||
# endif
|
||||
static PyObject*(*py3__PyObject_GC_New)(PyTypeObject *);
|
||||
static void(*py3_PyObject_GC_Del)(void *);
|
||||
static void(*py3_PyObject_GC_UnTrack)(void *);
|
||||
static int (*py3_PyType_IsSubtype)(PyTypeObject *, PyTypeObject *);
|
||||
|
||||
static HINSTANCE hinstPy3 = 0; /* Instance of python.dll */
|
||||
@@ -465,6 +469,9 @@ static struct
|
||||
{"PyObject_Malloc", (PYTHON_PROC*)&py3_PyObject_Malloc},
|
||||
{"PyObject_Free", (PYTHON_PROC*)&py3_PyObject_Free},
|
||||
# endif
|
||||
{"_PyObject_GC_New", (PYTHON_PROC*)&py3__PyObject_GC_New},
|
||||
{"PyObject_GC_Del", (PYTHON_PROC*)&py3_PyObject_GC_Del},
|
||||
{"PyObject_GC_UnTrack", (PYTHON_PROC*)&py3_PyObject_GC_UnTrack},
|
||||
{"PyType_IsSubtype", (PYTHON_PROC*)&py3_PyType_IsSubtype},
|
||||
{"PyCapsule_New", (PYTHON_PROC*)&py3_PyCapsule_New},
|
||||
{"PyCapsule_GetPointer", (PYTHON_PROC*)&py3_PyCapsule_GetPointer},
|
||||
@@ -610,8 +617,6 @@ get_py3_exceptions()
|
||||
}
|
||||
#endif /* DYNAMIC_PYTHON3 */
|
||||
|
||||
static PyObject *BufferDir(PyObject *, PyObject *);
|
||||
|
||||
static int py3initialised = 0;
|
||||
|
||||
#define PYINITIALISED py3initialised
|
||||
@@ -642,7 +647,7 @@ static int py3initialised = 0;
|
||||
if (bytes != NULL) \
|
||||
Py_XDECREF(bytes);
|
||||
|
||||
#define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
#define DESTRUCTOR_FINISH(self) Py_TYPE(self)->tp_free((PyObject*)self)
|
||||
|
||||
#define WIN_PYTHON_REF(win) win->w_python3_ref
|
||||
#define BUF_PYTHON_REF(buf) buf->b_python3_ref
|
||||
@@ -670,6 +675,7 @@ call_PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
|
||||
return PyType_GenericAlloc(type,nitems);
|
||||
}
|
||||
|
||||
static PyObject *BufferDir(PyObject *);
|
||||
static PyObject *OutputGetattro(PyObject *, PyObject *);
|
||||
static int OutputSetattro(PyObject *, PyObject *, PyObject *);
|
||||
static PyObject *BufferGetattro(PyObject *, PyObject *);
|
||||
@@ -703,9 +709,6 @@ static struct PyModuleDef vimmodule;
|
||||
* Internal function prototypes.
|
||||
*/
|
||||
|
||||
static PyObject *globals;
|
||||
|
||||
static int PythonIO_Init(void);
|
||||
static PyObject *Py3Init_vim(void);
|
||||
|
||||
/******************************************************
|
||||
@@ -785,7 +788,7 @@ Python3_Init(void)
|
||||
get_py3_exceptions();
|
||||
#endif
|
||||
|
||||
if (PythonIO_Init())
|
||||
if (PythonIO_Init_io())
|
||||
goto fail;
|
||||
|
||||
globals = PyModule_GetDict(PyImport_AddModule("__main__"));
|
||||
@@ -816,7 +819,7 @@ Python3_Init(void)
|
||||
fail:
|
||||
/* We call PythonIO_Flush() here to print any Python errors.
|
||||
* This is OK, as it is possible to call this function even
|
||||
* if PythonIO_Init() has not completed successfully (it will
|
||||
* if PythonIO_Init_io() has not completed successfully (it will
|
||||
* not do anything in this case).
|
||||
*/
|
||||
PythonIO_Flush();
|
||||
@@ -827,7 +830,7 @@ fail:
|
||||
* External interface
|
||||
*/
|
||||
static void
|
||||
DoPy3Command(exarg_T *eap, const char *cmd, typval_T *rettv)
|
||||
DoPyCommand(const char *cmd, rangeinitializer init_range, runner run, void *arg)
|
||||
{
|
||||
#if defined(MACOS) && !defined(MACOS_X_UNIX)
|
||||
GrafPtr oldPort;
|
||||
@@ -848,16 +851,8 @@ DoPy3Command(exarg_T *eap, const char *cmd, typval_T *rettv)
|
||||
if (Python3_Init())
|
||||
goto theend;
|
||||
|
||||
if (rettv == NULL)
|
||||
{
|
||||
RangeStart = eap->line1;
|
||||
RangeEnd = eap->line2;
|
||||
}
|
||||
else
|
||||
{
|
||||
RangeStart = (PyInt) curwin->w_cursor.lnum;
|
||||
RangeEnd = RangeStart;
|
||||
}
|
||||
init_range(arg);
|
||||
|
||||
Python_Release_Vim(); /* leave vim */
|
||||
|
||||
#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
|
||||
@@ -881,28 +876,8 @@ DoPy3Command(exarg_T *eap, const char *cmd, typval_T *rettv)
|
||||
(char *)ENC_OPT, CODEC_ERROR_HANDLER);
|
||||
cmdbytes = PyUnicode_AsEncodedString(cmdstr, "utf-8", CODEC_ERROR_HANDLER);
|
||||
Py_XDECREF(cmdstr);
|
||||
if (rettv == NULL)
|
||||
PyRun_SimpleString(PyBytes_AsString(cmdbytes));
|
||||
else
|
||||
{
|
||||
PyObject *r;
|
||||
|
||||
r = PyRun_String(PyBytes_AsString(cmdbytes), Py_eval_input,
|
||||
globals, globals);
|
||||
if (r == NULL)
|
||||
{
|
||||
if (PyErr_Occurred() && !msg_silent)
|
||||
PyErr_PrintEx(0);
|
||||
EMSG(_("E860: Eval did not return a valid python 3 object"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ConvertFromPyObject(r, rettv) == -1)
|
||||
EMSG(_("E861: Failed to convert returned python 3 object to vim value"));
|
||||
Py_DECREF(r);
|
||||
}
|
||||
PyErr_Clear();
|
||||
}
|
||||
run(PyBytes_AsString(cmdbytes), arg, &pygilstate);
|
||||
Py_XDECREF(cmdbytes);
|
||||
|
||||
PyGILState_Release(pygilstate);
|
||||
@@ -936,10 +911,10 @@ ex_py3(exarg_T *eap)
|
||||
script = script_get(eap, eap->arg);
|
||||
if (!eap->skip)
|
||||
{
|
||||
if (script == NULL)
|
||||
DoPy3Command(eap, (char *)eap->arg, NULL);
|
||||
else
|
||||
DoPy3Command(eap, (char *)script, NULL);
|
||||
DoPyCommand(script == NULL ? (char *) eap->arg : (char *) script,
|
||||
(rangeinitializer) init_range_cmd,
|
||||
(runner) run_cmd,
|
||||
(void *) eap);
|
||||
}
|
||||
vim_free(script);
|
||||
}
|
||||
@@ -1000,101 +975,19 @@ ex_py3file(exarg_T *eap)
|
||||
|
||||
|
||||
/* Execute the file */
|
||||
DoPy3Command(eap, buffer, NULL);
|
||||
DoPyCommand(buffer,
|
||||
(rangeinitializer) init_range_cmd,
|
||||
(runner) run_cmd,
|
||||
(void *) eap);
|
||||
}
|
||||
|
||||
void
|
||||
ex_py3do(exarg_T *eap)
|
||||
{
|
||||
linenr_T i;
|
||||
const char *code_hdr = "def " DOPY_FUNC "(line, linenr):\n ";
|
||||
const char *s = (const char *) eap->arg;
|
||||
size_t len;
|
||||
char *code;
|
||||
int status;
|
||||
PyObject *pyfunc, *pymain;
|
||||
PyGILState_STATE pygilstate;
|
||||
|
||||
if (Python3_Init())
|
||||
goto theend;
|
||||
|
||||
if (u_save(eap->line1 - 1, eap->line2 + 1) != OK)
|
||||
{
|
||||
EMSG(_("cannot save undo information"));
|
||||
return;
|
||||
}
|
||||
len = strlen(code_hdr) + strlen(s);
|
||||
code = malloc(len + 1);
|
||||
STRCPY(code, code_hdr);
|
||||
STRNCAT(code, s, len + 1);
|
||||
pygilstate = PyGILState_Ensure();
|
||||
status = PyRun_SimpleString(code);
|
||||
vim_free(code);
|
||||
if (status)
|
||||
{
|
||||
EMSG(_("failed to run the code"));
|
||||
return;
|
||||
}
|
||||
status = 0; /* good */
|
||||
pymain = PyImport_AddModule("__main__");
|
||||
pyfunc = PyObject_GetAttrString(pymain, DOPY_FUNC);
|
||||
PyGILState_Release(pygilstate);
|
||||
|
||||
for (i = eap->line1; i <= eap->line2; i++)
|
||||
{
|
||||
const char *line;
|
||||
PyObject *pyline, *pylinenr, *pyret, *pybytes;
|
||||
|
||||
line = (char *)ml_get(i);
|
||||
pygilstate = PyGILState_Ensure();
|
||||
pyline = PyUnicode_Decode(line, strlen(line),
|
||||
(char *)ENC_OPT, CODEC_ERROR_HANDLER);
|
||||
pylinenr = PyLong_FromLong(i);
|
||||
pyret = PyObject_CallFunctionObjArgs(pyfunc, pyline, pylinenr, NULL);
|
||||
Py_DECREF(pyline);
|
||||
Py_DECREF(pylinenr);
|
||||
if (!pyret)
|
||||
{
|
||||
PyErr_PrintEx(0);
|
||||
PythonIO_Flush();
|
||||
status = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pyret && pyret != Py_None)
|
||||
{
|
||||
if (!PyUnicode_Check(pyret))
|
||||
{
|
||||
EMSG(_("E863: return value must be an instance of str"));
|
||||
Py_XDECREF(pyret);
|
||||
status = 1;
|
||||
goto out;
|
||||
}
|
||||
pybytes = PyUnicode_AsEncodedString(pyret,
|
||||
(char *)ENC_OPT, CODEC_ERROR_HANDLER);
|
||||
ml_replace(i, (char_u *) PyBytes_AsString(pybytes), 1);
|
||||
Py_DECREF(pybytes);
|
||||
changed();
|
||||
#ifdef SYNTAX_HL
|
||||
syn_changed(i); /* recompute syntax hl. for this line */
|
||||
#endif
|
||||
}
|
||||
Py_XDECREF(pyret);
|
||||
PythonIO_Flush();
|
||||
PyGILState_Release(pygilstate);
|
||||
}
|
||||
pygilstate = PyGILState_Ensure();
|
||||
out:
|
||||
Py_DECREF(pyfunc);
|
||||
PyObject_SetAttrString(pymain, DOPY_FUNC, NULL);
|
||||
PyGILState_Release(pygilstate);
|
||||
if (status)
|
||||
return;
|
||||
check_cursor();
|
||||
update_curbuf(NOT_VALID);
|
||||
|
||||
theend:
|
||||
return;
|
||||
DoPyCommand((char *)eap->arg,
|
||||
(rangeinitializer)init_range_cmd,
|
||||
(runner)run_do,
|
||||
(void *)eap);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
@@ -1120,16 +1013,7 @@ OutputSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
||||
{
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
|
||||
return OutputSetattr(self, name, val);
|
||||
}
|
||||
|
||||
/***************/
|
||||
|
||||
static int
|
||||
PythonIO_Init(void)
|
||||
{
|
||||
PyType_Ready(&OutputType);
|
||||
return PythonIO_Init_io();
|
||||
return OutputSetattr((OutputObject *)(self), name, val);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
@@ -1148,12 +1032,9 @@ PythonIO_Init(void)
|
||||
|
||||
#define BufferType_Check(obj) ((obj)->ob_base.ob_type == &BufferType)
|
||||
|
||||
static Py_ssize_t BufferLength(PyObject *);
|
||||
static PyObject *BufferItem(PyObject *, Py_ssize_t);
|
||||
static PyObject* BufferSubscript(PyObject *self, PyObject *idx);
|
||||
static Py_ssize_t BufferAsSubscript(PyObject *self, PyObject *idx, PyObject *val);
|
||||
|
||||
|
||||
/* Line range type - Implementation functions
|
||||
* --------------------------------------
|
||||
*/
|
||||
@@ -1209,7 +1090,7 @@ BufferGetattro(PyObject *self, PyObject*nameobj)
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
BufferDir(PyObject *self UNUSED, PyObject *args UNUSED)
|
||||
BufferDir(PyObject *self UNUSED)
|
||||
{
|
||||
return Py_BuildValue("[sssss]", "name", "number",
|
||||
"append", "mark", "range");
|
||||
@@ -1223,7 +1104,7 @@ BufferSubscript(PyObject *self, PyObject* idx)
|
||||
if (PyLong_Check(idx))
|
||||
{
|
||||
long _idx = PyLong_AsLong(idx);
|
||||
return BufferItem(self,_idx);
|
||||
return BufferItem((BufferObject *)(self), _idx);
|
||||
} else if (PySlice_Check(idx))
|
||||
{
|
||||
Py_ssize_t start, stop, step, slicelen;
|
||||
@@ -1238,7 +1119,7 @@ BufferSubscript(PyObject *self, PyObject* idx)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return BufferSlice(self, start, stop);
|
||||
return BufferSlice((BufferObject *)(self), start, stop);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1342,7 +1223,7 @@ RangeSubscript(PyObject *self, PyObject* idx)
|
||||
if (PyLong_Check(idx))
|
||||
{
|
||||
long _idx = PyLong_AsLong(idx);
|
||||
return RangeItem(self,_idx);
|
||||
return RangeItem((RangeObject *)(self), _idx);
|
||||
} else if (PySlice_Check(idx))
|
||||
{
|
||||
Py_ssize_t start, stop, step, slicelen;
|
||||
@@ -1354,7 +1235,7 @@ RangeSubscript(PyObject *self, PyObject* idx)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return RangeSlice(self, start, stop);
|
||||
return RangeSlice((RangeObject *)(self), start, stop);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1435,7 +1316,7 @@ WindowSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
||||
{
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
|
||||
return WindowSetattr(self, name, val);
|
||||
return WindowSetattr((WindowObject *)(self), name, val);
|
||||
}
|
||||
|
||||
/* Tab page list object - Definitions
|
||||
@@ -1489,8 +1370,6 @@ CurrentSetattro(PyObject *self, PyObject *nameobj, PyObject *value)
|
||||
/* Dictionary object - Definitions
|
||||
*/
|
||||
|
||||
static PyInt DictionaryLength(PyObject *);
|
||||
|
||||
static PyObject *
|
||||
DictionaryGetattro(PyObject *self, PyObject *nameobj)
|
||||
{
|
||||
@@ -1510,15 +1389,12 @@ DictionaryGetattro(PyObject *self, PyObject *nameobj)
|
||||
DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
||||
{
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
return DictionarySetattr(self, name, val);
|
||||
return DictionarySetattr((DictionaryObject *)(self), name, val);
|
||||
}
|
||||
|
||||
/* List object - Definitions
|
||||
*/
|
||||
|
||||
static PyInt ListLength(PyObject *);
|
||||
static PyObject *ListItem(PyObject *, Py_ssize_t);
|
||||
|
||||
static PySequenceMethods ListAsSeq = {
|
||||
(lenfunc) ListLength, /* sq_length, len(x) */
|
||||
(binaryfunc) 0, /* RangeConcat, sq_concat, x+y */
|
||||
@@ -1542,21 +1418,21 @@ static PyMappingMethods ListAsMapping = {
|
||||
};
|
||||
|
||||
static PyObject *
|
||||
ListSubscript(PyObject *self, PyObject* idxObject)
|
||||
ListSubscript(PyObject *self, PyObject* idx)
|
||||
{
|
||||
if (PyLong_Check(idxObject))
|
||||
if (PyLong_Check(idx))
|
||||
{
|
||||
long idx = PyLong_AsLong(idxObject);
|
||||
return ListItem(self, idx);
|
||||
long _idx = PyLong_AsLong(idx);
|
||||
return ListItem((ListObject *)(self), _idx);
|
||||
}
|
||||
else if (PySlice_Check(idxObject))
|
||||
else if (PySlice_Check(idx))
|
||||
{
|
||||
Py_ssize_t start, stop, step, slicelen;
|
||||
|
||||
if (PySlice_GetIndicesEx(idxObject, ListLength(self), &start, &stop,
|
||||
&step, &slicelen) < 0)
|
||||
if (PySlice_GetIndicesEx(idx, ListLength((ListObject *)(self)),
|
||||
&start, &stop, &step, &slicelen) < 0)
|
||||
return NULL;
|
||||
return ListSlice(self, start, stop);
|
||||
return ListSlice((ListObject *)(self), start, stop);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1566,21 +1442,21 @@ ListSubscript(PyObject *self, PyObject* idxObject)
|
||||
}
|
||||
|
||||
static Py_ssize_t
|
||||
ListAsSubscript(PyObject *self, PyObject *idxObject, PyObject *obj)
|
||||
ListAsSubscript(PyObject *self, PyObject *idx, PyObject *obj)
|
||||
{
|
||||
if (PyLong_Check(idxObject))
|
||||
if (PyLong_Check(idx))
|
||||
{
|
||||
long idx = PyLong_AsLong(idxObject);
|
||||
return ListAssItem(self, idx, obj);
|
||||
long _idx = PyLong_AsLong(idx);
|
||||
return ListAssItem((ListObject *)(self), _idx, obj);
|
||||
}
|
||||
else if (PySlice_Check(idxObject))
|
||||
else if (PySlice_Check(idx))
|
||||
{
|
||||
Py_ssize_t start, stop, step, slicelen;
|
||||
|
||||
if (PySlice_GetIndicesEx(idxObject, ListLength(self), &start, &stop,
|
||||
&step, &slicelen) < 0)
|
||||
if (PySlice_GetIndicesEx(idx, ListLength((ListObject *)(self)),
|
||||
&start, &stop, &step, &slicelen) < 0)
|
||||
return -1;
|
||||
return ListAssSlice(self, start, stop, obj);
|
||||
return ListAssSlice((ListObject *)(self), start, stop, obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1604,7 +1480,7 @@ ListGetattro(PyObject *self, PyObject *nameobj)
|
||||
ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
|
||||
{
|
||||
GET_ATTR_STRING(name, nameobj);
|
||||
return ListSetattr(self, name, val);
|
||||
return ListSetattr((ListObject *)(self), name, val);
|
||||
}
|
||||
|
||||
/* Function object - Definitions
|
||||
@@ -1661,48 +1537,16 @@ python3_tabpage_free(tabpage_T *tab)
|
||||
}
|
||||
#endif
|
||||
|
||||
static BufMapObject TheBufferMap =
|
||||
{
|
||||
PyObject_HEAD_INIT(&BufMapType)
|
||||
};
|
||||
|
||||
static WinListObject TheWindowList =
|
||||
{
|
||||
PyObject_HEAD_INIT(&WinListType)
|
||||
NULL
|
||||
};
|
||||
|
||||
static CurrentObject TheCurrent =
|
||||
{
|
||||
PyObject_HEAD_INIT(&CurrentType)
|
||||
};
|
||||
|
||||
static TabListObject TheTabPageList =
|
||||
{
|
||||
PyObject_HEAD_INIT(&TabListType)
|
||||
};
|
||||
|
||||
static PyObject *
|
||||
Py3Init_vim(void)
|
||||
{
|
||||
PyObject *mod;
|
||||
PyObject *tmp;
|
||||
|
||||
/* The special value is removed from sys.path in Python3_Init(). */
|
||||
static wchar_t *(argv[2]) = {L"/must>not&exist/foo", NULL};
|
||||
|
||||
PyType_Ready(&IterType);
|
||||
PyType_Ready(&BufferType);
|
||||
PyType_Ready(&RangeType);
|
||||
PyType_Ready(&WindowType);
|
||||
PyType_Ready(&TabPageType);
|
||||
PyType_Ready(&BufMapType);
|
||||
PyType_Ready(&WinListType);
|
||||
PyType_Ready(&TabListType);
|
||||
PyType_Ready(&CurrentType);
|
||||
PyType_Ready(&DictionaryType);
|
||||
PyType_Ready(&ListType);
|
||||
PyType_Ready(&FunctionType);
|
||||
PyType_Ready(&OptionsType);
|
||||
if (init_types())
|
||||
return NULL;
|
||||
|
||||
/* Set sys.argv[] to avoid a crash in warn(). */
|
||||
PySys_SetArgv(1, argv);
|
||||
@@ -1711,35 +1555,7 @@ Py3Init_vim(void)
|
||||
if (mod == NULL)
|
||||
return NULL;
|
||||
|
||||
VimError = PyErr_NewException("vim.error", NULL, NULL);
|
||||
|
||||
Py_INCREF(VimError);
|
||||
PyModule_AddObject(mod, "error", VimError);
|
||||
Py_INCREF((PyObject *)(void *)&TheBufferMap);
|
||||
PyModule_AddObject(mod, "buffers", (PyObject *)(void *)&TheBufferMap);
|
||||
Py_INCREF((PyObject *)(void *)&TheCurrent);
|
||||
PyModule_AddObject(mod, "current", (PyObject *)(void *)&TheCurrent);
|
||||
Py_INCREF((PyObject *)(void *)&TheWindowList);
|
||||
PyModule_AddObject(mod, "windows", (PyObject *)(void *)&TheWindowList);
|
||||
Py_INCREF((PyObject *)(void *)&TheTabPageList);
|
||||
PyModule_AddObject(mod, "tabpages", (PyObject *)(void *)&TheTabPageList);
|
||||
|
||||
PyModule_AddObject(mod, "vars", DictionaryNew(&globvardict));
|
||||
PyModule_AddObject(mod, "vvars", DictionaryNew(&vimvardict));
|
||||
PyModule_AddObject(mod, "options",
|
||||
OptionsNew(SREQ_GLOBAL, NULL, dummy_check, NULL));
|
||||
|
||||
#define ADD_INT_CONSTANT(name, value) \
|
||||
tmp = PyLong_FromLong(value); \
|
||||
Py_INCREF(tmp); \
|
||||
PyModule_AddObject(mod, name, tmp)
|
||||
|
||||
ADD_INT_CONSTANT("VAR_LOCKED", VAR_LOCKED);
|
||||
ADD_INT_CONSTANT("VAR_FIXED", VAR_FIXED);
|
||||
ADD_INT_CONSTANT("VAR_SCOPE", VAR_SCOPE);
|
||||
ADD_INT_CONSTANT("VAR_DEF_SCOPE", VAR_DEF_SCOPE);
|
||||
|
||||
if (PyErr_Occurred())
|
||||
if (populate_module(mod, PyModule_AddObject))
|
||||
return NULL;
|
||||
|
||||
return mod;
|
||||
@@ -1790,7 +1606,10 @@ LineToString(const char *str)
|
||||
void
|
||||
do_py3eval (char_u *str, typval_T *rettv)
|
||||
{
|
||||
DoPy3Command(NULL, (char *) str, rettv);
|
||||
DoPyCommand((char *) str,
|
||||
(rangeinitializer) init_range_eval,
|
||||
(runner) run_eval,
|
||||
(void *) rettv);
|
||||
switch(rettv->v_type)
|
||||
{
|
||||
case VAR_DICT: ++rettv->vval.v_dict->dv_refcount; break;
|
||||
|
||||
@@ -158,8 +158,10 @@ static void error_print(int);
|
||||
static void ruby_io_init(void);
|
||||
static void ruby_vim_init(void);
|
||||
|
||||
#if defined(__ia64) && !defined(ruby_init_stack)
|
||||
# define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
|
||||
#if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
|
||||
# if defined(__ia64) && !defined(ruby_init_stack)
|
||||
# define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(DYNAMIC_RUBY) || defined(PROTO)
|
||||
@@ -231,12 +233,14 @@ static void ruby_vim_init(void);
|
||||
# define rb_float_new dll_rb_float_new
|
||||
# define rb_ary_new dll_rb_ary_new
|
||||
# define rb_ary_push dll_rb_ary_push
|
||||
# ifdef __ia64
|
||||
# define rb_ia64_bsp dll_rb_ia64_bsp
|
||||
# undef ruby_init_stack
|
||||
# define ruby_init_stack(addr) dll_ruby_init_stack((addr), rb_ia64_bsp())
|
||||
# else
|
||||
# define ruby_init_stack dll_ruby_init_stack
|
||||
# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
|
||||
# ifdef __ia64
|
||||
# define rb_ia64_bsp dll_rb_ia64_bsp
|
||||
# undef ruby_init_stack
|
||||
# define ruby_init_stack(addr) dll_ruby_init_stack((addr), rb_ia64_bsp())
|
||||
# else
|
||||
# define ruby_init_stack dll_ruby_init_stack
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
# define rb_str2cstr dll_rb_str2cstr
|
||||
@@ -346,11 +350,13 @@ static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
|
||||
static VALUE (*dll_rb_float_new) (double);
|
||||
static VALUE (*dll_rb_ary_new) (void);
|
||||
static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
|
||||
# ifdef __ia64
|
||||
# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
|
||||
# ifdef __ia64
|
||||
static void * (*dll_rb_ia64_bsp) (void);
|
||||
static void (*dll_ruby_init_stack)(VALUE*, void*);
|
||||
# else
|
||||
# else
|
||||
static void (*dll_ruby_init_stack)(VALUE*);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# ifdef RUBY19_OR_LATER
|
||||
@@ -491,10 +497,6 @@ static struct
|
||||
# endif
|
||||
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
|
||||
{"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
|
||||
# ifdef __ia64
|
||||
{"rb_ia64_bsp", (RUBY_PROC*)&dll_rb_ia64_bsp},
|
||||
# endif
|
||||
{"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
|
||||
# if DYNAMIC_RUBY_VER <= 19
|
||||
{"rb_float_new", (RUBY_PROC*)&dll_rb_float_new},
|
||||
# else
|
||||
@@ -512,6 +514,12 @@ static struct
|
||||
{"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
|
||||
{"rb_require", (RUBY_PROC*)&dll_rb_require},
|
||||
{"ruby_process_options", (RUBY_PROC*)&dll_ruby_process_options},
|
||||
# endif
|
||||
# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
|
||||
# ifdef __ia64
|
||||
{"rb_ia64_bsp", (RUBY_PROC*)&dll_rb_ia64_bsp},
|
||||
# endif
|
||||
{"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
|
||||
# endif
|
||||
{"", NULL},
|
||||
};
|
||||
@@ -735,7 +743,7 @@ static int ensure_ruby_initialized(void)
|
||||
NtInitialize(&argc, &argv);
|
||||
#endif
|
||||
{
|
||||
#if defined(RUBY_VERSION) && RUBY_VERSION >= 18
|
||||
#if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
|
||||
ruby_init_stack(ruby_stack_start);
|
||||
#endif
|
||||
ruby_init();
|
||||
|
||||
@@ -701,6 +701,7 @@ normal_cmd(oap, toplevel)
|
||||
else
|
||||
c = 'c';
|
||||
msg_nowait = TRUE; /* don't delay going to insert mode */
|
||||
old_mapped_len = 0; /* do go to Insert mode */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2077,6 +2077,9 @@ static struct vimoption
|
||||
(char_u *)NULL, PV_NONE,
|
||||
#endif
|
||||
{(char_u *)2000L, (char_u *)0L} SCRIPTID_INIT},
|
||||
{"regexpengine", "re", P_NUM|P_VI_DEF,
|
||||
(char_u *)&p_re, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
|
||||
{"relativenumber", "rnu", P_BOOL|P_VI_DEF|P_RWIN,
|
||||
(char_u *)VAR_WIN, PV_RNU,
|
||||
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
|
||||
@@ -8604,6 +8607,11 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
|
||||
errmsg = e_positive;
|
||||
p_hi = 0;
|
||||
}
|
||||
if (p_re < 0 || p_re > 2)
|
||||
{
|
||||
errmsg = e_invarg;
|
||||
p_re = 0;
|
||||
}
|
||||
if (p_report < 0)
|
||||
{
|
||||
errmsg = e_positive;
|
||||
|
||||
@@ -653,6 +653,7 @@ EXTERN char_u *p_cdpath; /* 'cdpath' */
|
||||
EXTERN long p_rdt; /* 'redrawtime' */
|
||||
#endif
|
||||
EXTERN int p_remap; /* 'remap' */
|
||||
EXTERN long p_re; /* 'regexpengine' */
|
||||
EXTERN long p_report; /* 'report' */
|
||||
#if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
|
||||
EXTERN long p_pvh; /* 'previewheight' */
|
||||
|
||||
@@ -37,6 +37,7 @@ LANGUAGES = \
|
||||
CONVERTED = \
|
||||
cs.cp1250 \
|
||||
ja.sjis \
|
||||
ja.euc-jp \
|
||||
pl.cp1250 \
|
||||
pl.UTF-8 \
|
||||
ru.cp1251 \
|
||||
@@ -77,6 +78,7 @@ MOFILES = \
|
||||
MOCONVERTED = \
|
||||
cs.cp1250.mo \
|
||||
ja.sjis.mo \
|
||||
ja.euc-jp.mo \
|
||||
pl.cp1250.mo \
|
||||
pl.UTF-8.mo \
|
||||
ru.cp1251.mo \
|
||||
@@ -115,6 +117,7 @@ CHECKFILES = \
|
||||
zh_TW.ck \
|
||||
cs.cp1250.ck \
|
||||
ja.sjis.ck \
|
||||
ja.euc-jp.ck \
|
||||
pl.cp1250.ck \
|
||||
pl.UTF-8.ck \
|
||||
ru.cp1251.ck \
|
||||
@@ -193,11 +196,15 @@ nb.po: no.po
|
||||
ja.sjis.po: ja.po
|
||||
@$(MAKE) sjiscorr
|
||||
rm -f ja.sjis.po
|
||||
iconv -f euc-jp -t cp932 ja.po | ./sjiscorr > ja.sjis.po
|
||||
iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po
|
||||
|
||||
sjiscorr: sjiscorr.c
|
||||
$(CC) -o sjiscorr sjiscorr.c
|
||||
|
||||
ja.euc-jp.po: ja.po
|
||||
iconv -f utf-8 -t euc-jp ja.po | \
|
||||
sed -e 's/charset=utf-8/charset=euc-jp/' -e 's/# Original translations/# Generated from ja.po, DO NOT EDIT/' > ja.euc-jp.po
|
||||
|
||||
# Convert cs.po to create cs.cp1250.po.
|
||||
cs.cp1250.po: cs.po
|
||||
rm -f cs.cp1250.po
|
||||
|
||||
@@ -107,3 +107,25 @@ language.
|
||||
make xx.mo
|
||||
|
||||
Look out for syntax errors and fix them.
|
||||
|
||||
|
||||
USING GETTEXT WITHOUT ICONV
|
||||
|
||||
When using gettext which doesn't support iconv, the encoding of the .mo file
|
||||
must match your active encoding. For that you must convert and change
|
||||
encoding of *.po file in advance of generating the *.mo file. For example, to
|
||||
convert ja.po to EUC-JP (supposed as your system encoding):
|
||||
|
||||
(1) Convert the file encoding:
|
||||
|
||||
mv ja.po ja.po.orig
|
||||
iconv -f utf-8 -t euc-jp ja.po.orig > ja.po
|
||||
|
||||
(2) Rewrite charset declaration in the file:
|
||||
|
||||
Open ja.po find this line:
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
You should change "charset" like this:
|
||||
"Content-Type: text/plain; charset=euc-jp\n"
|
||||
|
||||
There are examples in the Makefile for the conversions already supported.
|
||||
|
||||
6683
src/po/ja.euc-jp.po
Normal file
6683
src/po/ja.euc-jp.po
Normal file
File diff suppressed because it is too large
Load Diff
3752
src/po/ja.po
3752
src/po/ja.po
File diff suppressed because it is too large
Load Diff
@@ -3,17 +3,19 @@
|
||||
# Do ":help uganda" in Vim to read copying and usage conditions.
|
||||
# Do ":help credits" in Vim to see a list of people who contributed.
|
||||
#
|
||||
# Last Change: 17-Apr-2013.
|
||||
# Last Change: 2013 May 19
|
||||
#
|
||||
# Copyright (C) 2001-12 MURAOKA Taro <koron.kaoriya@gmail.com>
|
||||
# THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
|
||||
#
|
||||
# Original translations.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Vim 7.3\n"
|
||||
"Project-Id-Version: Vim 7.4\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2013-04-17 19:56+0900\n"
|
||||
"PO-Revision-Date: 2013-04-17 20:00+0900\n"
|
||||
"POT-Creation-Date: 2013-05-19 12:20+0900\n"
|
||||
"PO-Revision-Date: 2013-05-19 12:30+0900\n"
|
||||
"Last-Translator: MURAOKA Taro <koron.kaoriya@gmail.com>\n"
|
||||
"Language-Team: MURAOKA Taro <koron.kaoriya@gmail.com>\n"
|
||||
"Language: Japanese\n"
|
||||
@@ -2656,9 +2658,11 @@ msgstr "E858:
|
||||
msgid "E859: Failed to convert returned python object to vim value"
|
||||
msgstr "E859: <20>Ԃ<EFBFBD><D482>ꂽpython<6F>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67>vim<69>̒l<CC92>ɕϊ<C995><CF8A>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD>"
|
||||
|
||||
#, c-format
|
||||
msgid "<buffer object (deleted) at %p>"
|
||||
msgstr "<<3C>o<EFBFBD>b<EFBFBD>t<EFBFBD>@<40>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g (<28><><EFBFBD><EFBFBD><EFBFBD>ς<EFBFBD>) %p>"
|
||||
msgid "failed to run the code"
|
||||
msgstr "<22>R<EFBFBD>[<5B>h<EFBFBD>̎<EFBFBD><CC8E>s<EFBFBD>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "E863: return value must be an instance of str"
|
||||
msgstr "E863: <20>߂<EFBFBD><DF82>l<EFBFBD>͕<EFBFBD><CD95><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>łȂ<C582><C882><EFBFBD><EFBFBD>Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "E837: This Vim cannot execute :py3 after using :python"
|
||||
msgstr "E837: <20><><EFBFBD><EFBFBD>Vim<69>ł<EFBFBD> :python <20><><EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> :py3 <20><><EFBFBD>g<EFBFBD><67><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
@@ -2669,6 +2673,9 @@ msgstr "E860:
|
||||
msgid "E861: Failed to convert returned python 3 object to vim value"
|
||||
msgstr "E861: <20>Ԃ<EFBFBD><D482>ꂽpython 3<>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67>vim<69>̒l<CC92>ɕϊ<C995><CF8A>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD>"
|
||||
|
||||
msgid "index must be int or slice"
|
||||
msgstr "<22>C<EFBFBD><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X<EFBFBD>͐<EFBFBD><CD90><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD>C<EFBFBD>X<EFBFBD>łȂ<C582><C882><EFBFBD><EFBFBD>Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "E265: $_ must be an instance of String"
|
||||
msgstr "E265: $_ <20>͕<EFBFBD><CD95><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃C<CC83><43><EFBFBD>X<EFBFBD>^<5E><><EFBFBD>X<EFBFBD>łȂ<C582><C882><EFBFBD><EFBFBD>Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
@@ -6521,33 +6528,27 @@ msgstr "writelines()
|
||||
msgid "E264: Python: Error initialising I/O objects"
|
||||
msgstr "E264: Python: I/O<>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>̏<EFBFBD><CC8F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>G<EFBFBD><47><EFBFBD>["
|
||||
|
||||
msgid "no such buffer"
|
||||
msgstr "<22><><EFBFBD>̂悤<CC82>ȃo<C883>b<EFBFBD>t<EFBFBD>@<40>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "empty keys are not allowed"
|
||||
msgstr "<22><><EFBFBD>̃L<CC83>[<5B>͋<EFBFBD><CD8B><EFBFBD><C282><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "failed to add key to dictionary"
|
||||
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD>ւ̃L<CC83>[<5B>̒lj<CC92><C789>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "Cannot delete DictionaryObject attributes"
|
||||
msgstr "DictionaryObject<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "Cannot modify fixed dictionary"
|
||||
msgstr "<22>Œ肳<C592>ꂽ<EFBFBD><EA82BD><EFBFBD><EFBFBD><EFBFBD>͕ύX<CF8D>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "Only boolean objects are allowed"
|
||||
msgstr "boolean<61>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><C282><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD>"
|
||||
|
||||
msgid "Cannot set this attribute"
|
||||
msgstr "<22><><EFBFBD>̑<EFBFBD><CC91><EFBFBD><EFBFBD>͐ݒ<CD90><DD92>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "no such key in dictionary"
|
||||
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD>ɂ<EFBFBD><C982>̂悤<CC82>ȃL<C883>[<5B>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "dict is locked"
|
||||
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD>̓<EFBFBD><CD83>b<EFBFBD>N<EFBFBD><4E><EFBFBD><EFBFBD><EFBFBD>Ă<EFBFBD><C482>܂<EFBFBD>"
|
||||
|
||||
msgid "failed to add key to dictionary"
|
||||
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD>ւ̃L<CC83>[<5B>̒lj<CC92><C789>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "list index out of range"
|
||||
msgstr "<22><><EFBFBD>X<EFBFBD>g<EFBFBD>͈͊O<CD8A>̃C<CC83><43><EFBFBD>f<EFBFBD>b<EFBFBD>N<EFBFBD>X<EFBFBD>ł<EFBFBD>"
|
||||
|
||||
msgid "internal error: failed to get vim list item"
|
||||
msgstr "<22><><EFBFBD><EFBFBD><EFBFBD>G<EFBFBD><47><EFBFBD>[: vim<69>̃<EFBFBD><CC83>X<EFBFBD>g<EFBFBD>v<EFBFBD>f<EFBFBD>̎擾<CC8E>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
@@ -6569,15 +6570,54 @@ msgstr "
|
||||
msgid "can only concatenate with lists"
|
||||
msgstr "<22><><EFBFBD>X<EFBFBD>g<EFBFBD>Ƃ̂ݐڑ<DD90><DA91>ł<EFBFBD><C582>܂<EFBFBD>"
|
||||
|
||||
msgid "Cannot modify fixed list"
|
||||
msgid "cannot delete vim.dictionary attributes"
|
||||
msgstr "vim.dictionary<72><79><EFBFBD><EFBFBD><EFBFBD>͏<EFBFBD><CD8F><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "cannot modify fixed list"
|
||||
msgstr "<22>Œ肳<C592>ꂽ<EFBFBD><EA82BD><EFBFBD>X<EFBFBD>g<EFBFBD>͕ύX<CF8D>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "cannot set this attribute"
|
||||
msgstr "<22><><EFBFBD>̑<EFBFBD><CC91><EFBFBD><EFBFBD>͐ݒ<CD90><DD92>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "'self' argument must be a dictionary"
|
||||
msgstr "'self' <20><><EFBFBD><EFBFBD><EFBFBD>͎<EFBFBD><CD8E><EFBFBD><EFBFBD>^<5E>̒l<CC92>łȂ<C582><C882><EFBFBD><EFBFBD>Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "failed to run function"
|
||||
msgstr "<22><EFBFBD><D690>̎<EFBFBD><CC8E>s<EFBFBD>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "unable to get option value"
|
||||
msgstr "<22>I<EFBFBD>v<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̒l<CC92>͎擾<CD8E>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "unable to unset global option"
|
||||
msgstr "<22>O<EFBFBD><4F><EFBFBD>[<5B>o<EFBFBD><6F><EFBFBD>I<EFBFBD>v<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̐ݒ<CC90><DD92><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͂ł<CD82><C582>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "unable to unset option without global value"
|
||||
msgstr "<22>O<EFBFBD><4F><EFBFBD>[<5B>o<EFBFBD><6F><EFBFBD>ϐ<EFBFBD><CF90><EFBFBD><EFBFBD>g<EFBFBD>킸<EFBFBD>ɃI<C983>v<EFBFBD>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>̐ݒ<CC90><DD92><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͂ł<CD82><C582>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "object must be integer"
|
||||
msgstr "<22>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>͐<EFBFBD><CD90><EFBFBD><EFBFBD>łȂ<C582><C882><EFBFBD><EFBFBD>Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "object must be string"
|
||||
msgstr "<22>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>͕<EFBFBD><CD95><EFBFBD><EFBFBD><EFBFBD><EFBFBD>łȂ<C582><C882><EFBFBD><EFBFBD>Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "attempt to refer to deleted tab page"
|
||||
msgstr "<22>폜<EFBFBD><ED8F9C><EFBFBD>ꂽ<EFBFBD>^<5E>u<EFBFBD><75><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682>悤<EFBFBD>Ƃ<EFBFBD><C682>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
#, c-format
|
||||
msgid "<tabpage object (deleted) at %p>"
|
||||
msgstr "<<3C>^<5E>u<EFBFBD>y<EFBFBD>[<5B>W<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g (<28><><EFBFBD><EFBFBD><EFBFBD>ς<EFBFBD>) %p>"
|
||||
|
||||
#, c-format
|
||||
msgid "<tabpage object (unknown) at %p>"
|
||||
msgstr "<<3C>^<5E>u<EFBFBD>y<EFBFBD>[<5B>W<EFBFBD>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g (<28>s<EFBFBD><73>) %p>"
|
||||
|
||||
#, c-format
|
||||
msgid "<tabpage %d>"
|
||||
msgstr "<<3C>^<5E>u<EFBFBD>y<EFBFBD>[<5B>W %d>"
|
||||
|
||||
msgid "no such tab page"
|
||||
msgstr "<22><><EFBFBD>̂悤<CC82>ȃ^<5E>u<EFBFBD>y<EFBFBD>[<5B>W<EFBFBD>͂<EFBFBD><CD82><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "attempt to refer to deleted window"
|
||||
msgstr "<22>폜<EFBFBD><ED8F9C><EFBFBD>ꂽ<EFBFBD>E<EFBFBD>B<EFBFBD><42><EFBFBD>h<EFBFBD>E<EFBFBD><45><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682>悤<EFBFBD>Ƃ<EFBFBD><C682>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
@@ -6605,6 +6645,34 @@ msgstr "
|
||||
msgid "attempt to refer to deleted buffer"
|
||||
msgstr "<22>폜<EFBFBD><ED8F9C><EFBFBD>ꂽ<EFBFBD>o<EFBFBD>b<EFBFBD>t<EFBFBD>@<40><><EFBFBD>Q<EFBFBD>Ƃ<EFBFBD><C682>悤<EFBFBD>Ƃ<EFBFBD><C682>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
#, c-format
|
||||
msgid "<buffer object (deleted) at %p>"
|
||||
msgstr "<<3C>o<EFBFBD>b<EFBFBD>t<EFBFBD>@<40>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g (<28><><EFBFBD><EFBFBD><EFBFBD>ς<EFBFBD>) %p>"
|
||||
|
||||
msgid "key must be integer"
|
||||
msgstr "<22>L<EFBFBD>[<5B>͐<EFBFBD><CD90><EFBFBD><EFBFBD>l<EFBFBD>łȂ<C582><C882><EFBFBD><EFBFBD>Ȃ<CE82><C882>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "expected vim.buffer object"
|
||||
msgstr "vim.buffer<65>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>҂<EFBFBD><D282>Ă<EFBFBD><C482>܂<EFBFBD>"
|
||||
|
||||
msgid "failed to switch to given buffer"
|
||||
msgstr "<22>w<EFBFBD>肳<EFBFBD>ꂽ<EFBFBD>o<EFBFBD>b<EFBFBD>t<EFBFBD>@<40>ւ̐<CC90><D882>ւ<EFBFBD><D682>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
msgid "expected vim.window object"
|
||||
msgstr "vim.window<6F>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>҂<EFBFBD><D282>Ă<EFBFBD><C482>܂<EFBFBD>"
|
||||
|
||||
msgid "failed to find window in the current tab page"
|
||||
msgstr "<22><><EFBFBD>݂̃^<5E>u<EFBFBD>ɂ͎w<CD8E>肳<EFBFBD>ꂽ<EFBFBD>E<EFBFBD>B<EFBFBD><42><EFBFBD>h<EFBFBD>E<EFBFBD><45><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD>"
|
||||
|
||||
msgid "did not switch to the specified window"
|
||||
msgstr "<22>w<EFBFBD>肳<EFBFBD>ꂽ<EFBFBD>E<EFBFBD>B<EFBFBD><42><EFBFBD>h<EFBFBD>E<EFBFBD>ɐ<C990><D882>ւ<EFBFBD><D682>܂<EFBFBD><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD>"
|
||||
|
||||
msgid "expected vim.tabpage object"
|
||||
msgstr "vim.tabpage<67>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>҂<EFBFBD><D282>Ă<EFBFBD><C482>܂<EFBFBD>"
|
||||
|
||||
msgid "did not switch to the specified tab page"
|
||||
msgstr "<22>w<EFBFBD>肳<EFBFBD>ꂽ<EFBFBD>^<5E>u<EFBFBD>y<EFBFBD>[<5B>W<EFBFBD>ɐ<C990><D882>ւ<EFBFBD><D682>܂<EFBFBD><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD>"
|
||||
|
||||
msgid "unable to convert to vim structure"
|
||||
msgstr "vim<69>̍\\<5C><><EFBFBD>̂ɕϊ<C995><CF8A>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD>"
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ main(argc, argv)
|
||||
{
|
||||
for (p = buffer; *p != 0; p++)
|
||||
{
|
||||
if (strncmp(p, "charset=euc-jp", 14) == 0)
|
||||
if (strncmp(p, "charset=utf-8", 13) == 0)
|
||||
{
|
||||
fputs("charset=cp932", stdout);
|
||||
p += 13;
|
||||
p += 12;
|
||||
}
|
||||
else if (strncmp(p, "ja.po - Japanese message file", 29) == 0)
|
||||
{
|
||||
|
||||
456
src/regexp.c
456
src/regexp.c
@@ -38,9 +38,22 @@
|
||||
* Named character class support added by Walter Briscoe (1998 Jul 01)
|
||||
*/
|
||||
|
||||
/* Uncomment the first if you do not want to see debugging logs or files
|
||||
* related to regular expressions, even when compiling with -DDEBUG.
|
||||
* Uncomment the second to get the regexp debugging. */
|
||||
/* #undef DEBUG */
|
||||
/* #define DEBUG */
|
||||
|
||||
#include "vim.h"
|
||||
|
||||
#undef DEBUG
|
||||
#ifdef DEBUG
|
||||
/* show/save debugging data when BT engine is used */
|
||||
# define BT_REGEXP_DUMP
|
||||
/* save the debugging data to a file instead of displaying it */
|
||||
# define BT_REGEXP_LOG
|
||||
# define BT_REGEXP_DEBUG_LOG
|
||||
# define BT_REGEXP_DEBUG_LOG_NAME "bt_regexp_debug.log"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The "internal use only" fields in regexp.h are present to pass info from
|
||||
@@ -326,9 +339,10 @@ toggle_Magic(x)
|
||||
/* Used for an error (down from) vim_regcomp(): give the error message, set
|
||||
* rc_did_emsg and return NULL */
|
||||
#define EMSG_RET_NULL(m) return (EMSG(m), rc_did_emsg = TRUE, (void *)NULL)
|
||||
#define EMSG_M_RET_NULL(m, c) return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = TRUE, (void *)NULL)
|
||||
#define EMSG_RET_FAIL(m) return (EMSG(m), rc_did_emsg = TRUE, FAIL)
|
||||
#define EMSG_ONE_RET_NULL EMSG_M_RET_NULL(_("E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL)
|
||||
#define EMSG2_RET_NULL(m, c) return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = TRUE, (void *)NULL)
|
||||
#define EMSG2_RET_FAIL(m, c) return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = TRUE, FAIL)
|
||||
#define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_("E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL)
|
||||
|
||||
#define MAX_LIMIT (32767L << 16L)
|
||||
|
||||
@@ -336,11 +350,18 @@ static int re_multi_type __ARGS((int));
|
||||
static int cstrncmp __ARGS((char_u *s1, char_u *s2, int *n));
|
||||
static char_u *cstrchr __ARGS((char_u *, int));
|
||||
|
||||
#ifdef BT_REGEXP_DUMP
|
||||
static void regdump __ARGS((char_u *, bt_regprog_T *));
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
static void regdump __ARGS((char_u *, regprog_T *));
|
||||
static char_u *regprop __ARGS((char_u *));
|
||||
#endif
|
||||
|
||||
static char_u e_missingbracket[] = N_("E769: Missing ] after %s[");
|
||||
static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
|
||||
static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
|
||||
static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)");
|
||||
|
||||
#define NOT_MULTI 0
|
||||
#define MULTI_ONE 1
|
||||
#define MULTI_MULT 2
|
||||
@@ -630,7 +651,13 @@ static char_u META_flags[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
static int curchr;
|
||||
static int curchr; /* currently parsed character */
|
||||
/* Previous character. Note: prevchr is sometimes -1 when we are not at the
|
||||
* start, eg in /[ ^I]^ the pattern was never found even if it existed,
|
||||
* because ^ was taken to be magic -- webb */
|
||||
static int prevchr;
|
||||
static int prevprevchr; /* previous-previous character */
|
||||
static int nextchr; /* used for ungetchr() */
|
||||
|
||||
/* arguments for reg() */
|
||||
#define REG_NOPAREN 0 /* toplevel reg() */
|
||||
@@ -680,6 +707,9 @@ static int read_limits __ARGS((long *, long *));
|
||||
static void regtail __ARGS((char_u *, char_u *));
|
||||
static void regoptail __ARGS((char_u *, char_u *));
|
||||
|
||||
static regengine_T bt_regengine;
|
||||
static regengine_T nfa_regengine;
|
||||
|
||||
/*
|
||||
* Return TRUE if compiled regular expression "prog" can match a line break.
|
||||
*/
|
||||
@@ -762,6 +792,7 @@ char *EQUIVAL_CLASS_C[16] = {
|
||||
/*
|
||||
* Produce the bytes for equivalence class "c".
|
||||
* Currently only handles latin1, latin9 and utf-8.
|
||||
* NOTE: When changing this function, also change nfa_emit_equi_class()
|
||||
*/
|
||||
static void
|
||||
reg_equi_class(c)
|
||||
@@ -1239,8 +1270,11 @@ skip_regexp(startp, dirc, magic, newp)
|
||||
return p;
|
||||
}
|
||||
|
||||
static regprog_T *bt_regcomp __ARGS((char_u *expr, int re_flags));
|
||||
|
||||
/*
|
||||
* vim_regcomp() - compile a regular expression into internal code
|
||||
* bt_regcomp() - compile a regular expression into internal code for the
|
||||
* traditional back track matcher.
|
||||
* Returns the program in allocated space. Returns NULL for an error.
|
||||
*
|
||||
* We can't allocate space until we know how big the compiled form will be,
|
||||
@@ -1259,12 +1293,12 @@ skip_regexp(startp, dirc, magic, newp)
|
||||
* of the structure of the compiled regexp.
|
||||
* "re_flags": RE_MAGIC and/or RE_STRING.
|
||||
*/
|
||||
regprog_T *
|
||||
vim_regcomp(expr, re_flags)
|
||||
static regprog_T *
|
||||
bt_regcomp(expr, re_flags)
|
||||
char_u *expr;
|
||||
int re_flags;
|
||||
{
|
||||
regprog_T *r;
|
||||
bt_regprog_T *r;
|
||||
char_u *scan;
|
||||
char_u *longest;
|
||||
int len;
|
||||
@@ -1291,7 +1325,7 @@ vim_regcomp(expr, re_flags)
|
||||
#endif
|
||||
|
||||
/* Allocate space. */
|
||||
r = (regprog_T *)lalloc(sizeof(regprog_T) + regsize, TRUE);
|
||||
r = (bt_regprog_T *)lalloc(sizeof(bt_regprog_T) + regsize, TRUE);
|
||||
if (r == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -1386,10 +1420,11 @@ vim_regcomp(expr, re_flags)
|
||||
r->regmlen = len;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
#ifdef BT_REGEXP_DUMP
|
||||
regdump(expr, r);
|
||||
#endif
|
||||
return r;
|
||||
r->engine = &bt_regengine;
|
||||
return (regprog_T *)r;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1436,7 +1471,7 @@ vim_regcomp_had_eol()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* reg - regular expression, i.e. main body or parenthesized thing
|
||||
* Parse regular expression, i.e. main body or parenthesized thing.
|
||||
*
|
||||
* Caller must absorb opening parenthesis.
|
||||
*
|
||||
@@ -1473,7 +1508,7 @@ reg(paren, flagp)
|
||||
{
|
||||
/* Make a MOPEN node. */
|
||||
if (regnpar >= NSUBEXP)
|
||||
EMSG_M_RET_NULL(_("E51: Too many %s("), reg_magic == MAGIC_ALL);
|
||||
EMSG2_RET_NULL(_("E51: Too many %s("), reg_magic == MAGIC_ALL);
|
||||
parno = regnpar;
|
||||
++regnpar;
|
||||
ret = regnode(MOPEN + parno);
|
||||
@@ -1534,14 +1569,14 @@ reg(paren, flagp)
|
||||
else
|
||||
#endif
|
||||
if (paren == REG_NPAREN)
|
||||
EMSG_M_RET_NULL(_("E53: Unmatched %s%%("), reg_magic == MAGIC_ALL);
|
||||
EMSG2_RET_NULL(_(e_unmatchedpp), reg_magic == MAGIC_ALL);
|
||||
else
|
||||
EMSG_M_RET_NULL(_("E54: Unmatched %s("), reg_magic == MAGIC_ALL);
|
||||
EMSG2_RET_NULL(_(e_unmatchedp), reg_magic == MAGIC_ALL);
|
||||
}
|
||||
else if (paren == REG_NOPAREN && peekchr() != NUL)
|
||||
{
|
||||
if (curchr == Magic(')'))
|
||||
EMSG_M_RET_NULL(_("E55: Unmatched %s)"), reg_magic == MAGIC_ALL);
|
||||
EMSG2_RET_NULL(_(e_unmatchedpar), reg_magic == MAGIC_ALL);
|
||||
else
|
||||
EMSG_RET_NULL(_(e_trailing)); /* "Can't happen". */
|
||||
/* NOTREACHED */
|
||||
@@ -1556,7 +1591,7 @@ reg(paren, flagp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle one alternative of an | operator.
|
||||
* Parse one alternative of an | operator.
|
||||
* Implements the & operator.
|
||||
*/
|
||||
static char_u *
|
||||
@@ -1599,7 +1634,7 @@ regbranch(flagp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle one alternative of an | or & operator.
|
||||
* Parse one alternative of an | or & operator.
|
||||
* Implements the concatenation operator.
|
||||
*/
|
||||
static char_u *
|
||||
@@ -1679,7 +1714,7 @@ regconcat(flagp)
|
||||
}
|
||||
|
||||
/*
|
||||
* regpiece - something followed by possible [*+=]
|
||||
* Parse something followed by possible [*+=].
|
||||
*
|
||||
* Note that the branching code sequences used for = and the general cases
|
||||
* of * and + are somewhat optimized: they use the same NOTHING node as
|
||||
@@ -1759,7 +1794,7 @@ regpiece(flagp)
|
||||
}
|
||||
}
|
||||
if (lop == END)
|
||||
EMSG_M_RET_NULL(_("E59: invalid character after %s@"),
|
||||
EMSG2_RET_NULL(_("E59: invalid character after %s@"),
|
||||
reg_magic == MAGIC_ALL);
|
||||
/* Look behind must match with behind_pos. */
|
||||
if (lop == BEHIND || lop == NOBEHIND)
|
||||
@@ -1793,7 +1828,7 @@ regpiece(flagp)
|
||||
else
|
||||
{
|
||||
if (num_complex_braces >= 10)
|
||||
EMSG_M_RET_NULL(_("E60: Too many complex %s{...}s"),
|
||||
EMSG2_RET_NULL(_("E60: Too many complex %s{...}s"),
|
||||
reg_magic == MAGIC_ALL);
|
||||
reginsert(BRACE_COMPLEX + num_complex_braces, ret);
|
||||
regoptail(ret, regnode(BACK));
|
||||
@@ -1820,8 +1855,20 @@ regpiece(flagp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* When making changes to classchars also change nfa_classcodes. */
|
||||
static char_u *classchars = (char_u *)".iIkKfFpPsSdDxXoOwWhHaAlLuU";
|
||||
static int classcodes[] = {
|
||||
ANY, IDENT, SIDENT, KWORD, SKWORD,
|
||||
FNAME, SFNAME, PRINT, SPRINT,
|
||||
WHITE, NWHITE, DIGIT, NDIGIT,
|
||||
HEX, NHEX, OCTAL, NOCTAL,
|
||||
WORD, NWORD, HEAD, NHEAD,
|
||||
ALPHA, NALPHA, LOWER, NLOWER,
|
||||
UPPER, NUPPER
|
||||
};
|
||||
|
||||
/*
|
||||
* regatom - the lowest level
|
||||
* Parse the lowest level.
|
||||
*
|
||||
* Optimization: gobbles an entire sequence of ordinary characters so that
|
||||
* it can turn them into a single node, which is smaller to store and
|
||||
@@ -1836,15 +1883,6 @@ regatom(flagp)
|
||||
int cpo_lit; /* 'cpoptions' contains 'l' flag */
|
||||
int cpo_bsl; /* 'cpoptions' contains '\' flag */
|
||||
int c;
|
||||
static char_u *classchars = (char_u *)".iIkKfFpPsSdDxXoOwWhHaAlLuU";
|
||||
static int classcodes[] = {ANY, IDENT, SIDENT, KWORD, SKWORD,
|
||||
FNAME, SFNAME, PRINT, SPRINT,
|
||||
WHITE, NWHITE, DIGIT, NDIGIT,
|
||||
HEX, NHEX, OCTAL, NOCTAL,
|
||||
WORD, NWORD, HEAD, NHEAD,
|
||||
ALPHA, NALPHA, LOWER, NLOWER,
|
||||
UPPER, NUPPER
|
||||
};
|
||||
char_u *p;
|
||||
int extra = 0;
|
||||
|
||||
@@ -2140,7 +2178,7 @@ regatom(flagp)
|
||||
while ((c = getchr()) != ']')
|
||||
{
|
||||
if (c == NUL)
|
||||
EMSG_M_RET_NULL(_("E69: Missing ] after %s%%["),
|
||||
EMSG2_RET_NULL(_("E69: Missing ] after %s%%["),
|
||||
reg_magic == MAGIC_ALL);
|
||||
br = regnode(BRANCH);
|
||||
if (ret == NULL)
|
||||
@@ -2156,7 +2194,7 @@ regatom(flagp)
|
||||
return NULL;
|
||||
}
|
||||
if (ret == NULL)
|
||||
EMSG_M_RET_NULL(_("E70: Empty %s%%[]"),
|
||||
EMSG2_RET_NULL(_("E70: Empty %s%%[]"),
|
||||
reg_magic == MAGIC_ALL);
|
||||
lastbranch = regnode(BRANCH);
|
||||
br = regnode(NOTHING);
|
||||
@@ -2200,7 +2238,7 @@ regatom(flagp)
|
||||
}
|
||||
|
||||
if (i < 0)
|
||||
EMSG_M_RET_NULL(
|
||||
EMSG2_RET_NULL(
|
||||
_("E678: Invalid character after %s%%[dxouU]"),
|
||||
reg_magic == MAGIC_ALL);
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -2272,7 +2310,7 @@ regatom(flagp)
|
||||
}
|
||||
}
|
||||
|
||||
EMSG_M_RET_NULL(_("E71: Invalid character after %s%%"),
|
||||
EMSG2_RET_NULL(_("E71: Invalid character after %s%%"),
|
||||
reg_magic == MAGIC_ALL);
|
||||
}
|
||||
}
|
||||
@@ -2567,8 +2605,7 @@ collection:
|
||||
break;
|
||||
}
|
||||
else if (reg_strict)
|
||||
EMSG_M_RET_NULL(_("E769: Missing ] after %s["),
|
||||
reg_magic > MAGIC_OFF);
|
||||
EMSG2_RET_NULL(_(e_missingbracket), reg_magic > MAGIC_OFF);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
|
||||
@@ -2659,7 +2696,7 @@ use_multibytecode(c)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* emit a node
|
||||
* Emit a node.
|
||||
* Return pointer to generated code.
|
||||
*/
|
||||
static char_u *
|
||||
@@ -2711,7 +2748,7 @@ regmbc(c)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* reginsert - insert an operator in front of already-emitted operand
|
||||
* Insert an operator in front of already-emitted operand
|
||||
*
|
||||
* Means relocating the operand.
|
||||
*/
|
||||
@@ -2742,7 +2779,7 @@ reginsert(op, opnd)
|
||||
}
|
||||
|
||||
/*
|
||||
* reginsert_limits - insert an operator in front of already-emitted operand.
|
||||
* Insert an operator in front of already-emitted operand.
|
||||
* The operator has the given limit values as operands. Also set next pointer.
|
||||
*
|
||||
* Means relocating the operand.
|
||||
@@ -2794,7 +2831,7 @@ re_put_long(p, val)
|
||||
}
|
||||
|
||||
/*
|
||||
* regtail - set the next-pointer at the end of a node chain
|
||||
* Set the next-pointer at the end of a node chain.
|
||||
*/
|
||||
static void
|
||||
regtail(p, val)
|
||||
@@ -2835,7 +2872,7 @@ regtail(p, val)
|
||||
}
|
||||
|
||||
/*
|
||||
* regoptail - regtail on item after a BRANCH; nop if none
|
||||
* Like regtail, on item after a BRANCH; nop if none.
|
||||
*/
|
||||
static void
|
||||
regoptail(p, val)
|
||||
@@ -2851,22 +2888,15 @@ regoptail(p, val)
|
||||
}
|
||||
|
||||
/*
|
||||
* getchr() - get the next character from the pattern. We know about
|
||||
* magic and such, so therefore we need a lexical analyzer.
|
||||
* Functions for getting characters from the regexp input.
|
||||
*/
|
||||
|
||||
/* static int curchr; */
|
||||
static int prevprevchr;
|
||||
static int prevchr;
|
||||
static int nextchr; /* used for ungetchr() */
|
||||
/*
|
||||
* Note: prevchr is sometimes -1 when we are not at the start,
|
||||
* eg in /[ ^I]^ the pattern was never found even if it existed, because ^ was
|
||||
* taken to be magic -- webb
|
||||
*/
|
||||
static int at_start; /* True when on the first character */
|
||||
static int prev_at_start; /* True when on the second character */
|
||||
|
||||
/*
|
||||
* Start parsing at "str".
|
||||
*/
|
||||
static void
|
||||
initchr(str)
|
||||
char_u *str;
|
||||
@@ -2878,6 +2908,9 @@ initchr(str)
|
||||
prev_at_start = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the next character without advancing.
|
||||
*/
|
||||
static int
|
||||
peekchr()
|
||||
{
|
||||
@@ -3086,6 +3119,10 @@ skipchr_keepstart()
|
||||
prevprevchr = prpr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the next character from the pattern. We know about magic and such, so
|
||||
* therefore we need a lexical analyzer.
|
||||
*/
|
||||
static int
|
||||
getchr()
|
||||
{
|
||||
@@ -3340,8 +3377,8 @@ typedef struct regbehind_S
|
||||
} regbehind_T;
|
||||
|
||||
static char_u *reg_getline __ARGS((linenr_T lnum));
|
||||
static long vim_regexec_both __ARGS((char_u *line, colnr_T col, proftime_T *tm));
|
||||
static long regtry __ARGS((regprog_T *prog, colnr_T col));
|
||||
static long bt_regexec_both __ARGS((char_u *line, colnr_T col, proftime_T *tm));
|
||||
static long regtry __ARGS((bt_regprog_T *prog, colnr_T col));
|
||||
static void cleanup_subexpr __ARGS((void));
|
||||
#ifdef FEAT_SYN_HL
|
||||
static void cleanup_zsubexpr __ARGS((void));
|
||||
@@ -3398,7 +3435,7 @@ static colnr_T ireg_maxcol;
|
||||
/*
|
||||
* Sometimes need to save a copy of a line. Since alloc()/free() is very
|
||||
* slow, we keep one allocated piece of memory and only re-allocate it when
|
||||
* it's too small. It's freed in vim_regexec_both() when finished.
|
||||
* it's too small. It's freed in bt_regexec_both() when finished.
|
||||
*/
|
||||
static char_u *reg_tofree = NULL;
|
||||
static unsigned reg_tofreelen;
|
||||
@@ -3556,6 +3593,8 @@ static lpos_T reg_endzpos[NSUBEXP]; /* idem, end pos */
|
||||
/* TRUE if using multi-line regexp. */
|
||||
#define REG_MULTI (reg_match == NULL)
|
||||
|
||||
static int bt_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
|
||||
|
||||
/*
|
||||
* Match a regexp against a string.
|
||||
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
|
||||
@@ -3563,8 +3602,8 @@ static lpos_T reg_endzpos[NSUBEXP]; /* idem, end pos */
|
||||
*
|
||||
* Return TRUE if there is a match, FALSE if not.
|
||||
*/
|
||||
int
|
||||
vim_regexec(rmp, line, col)
|
||||
static int
|
||||
bt_regexec(rmp, line, col)
|
||||
regmatch_T *rmp;
|
||||
char_u *line; /* string to match against */
|
||||
colnr_T col; /* column to start looking for match */
|
||||
@@ -3580,16 +3619,19 @@ vim_regexec(rmp, line, col)
|
||||
ireg_icombine = FALSE;
|
||||
#endif
|
||||
ireg_maxcol = 0;
|
||||
return (vim_regexec_both(line, col, NULL) != 0);
|
||||
return (bt_regexec_both(line, col, NULL) != 0);
|
||||
}
|
||||
|
||||
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
|
||||
|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
|
||||
|
||||
static int bt_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
|
||||
|
||||
/*
|
||||
* Like vim_regexec(), but consider a "\n" in "line" to be a line break.
|
||||
*/
|
||||
int
|
||||
vim_regexec_nl(rmp, line, col)
|
||||
static int
|
||||
bt_regexec_nl(rmp, line, col)
|
||||
regmatch_T *rmp;
|
||||
char_u *line; /* string to match against */
|
||||
colnr_T col; /* column to start looking for match */
|
||||
@@ -3605,10 +3647,12 @@ vim_regexec_nl(rmp, line, col)
|
||||
ireg_icombine = FALSE;
|
||||
#endif
|
||||
ireg_maxcol = 0;
|
||||
return (vim_regexec_both(line, col, NULL) != 0);
|
||||
return (bt_regexec_both(line, col, NULL) != 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static long bt_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
|
||||
|
||||
/*
|
||||
* Match a regexp against multiple lines.
|
||||
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
|
||||
@@ -3617,8 +3661,8 @@ vim_regexec_nl(rmp, line, col)
|
||||
* Return zero if there is no match. Return number of lines contained in the
|
||||
* match otherwise.
|
||||
*/
|
||||
long
|
||||
vim_regexec_multi(rmp, win, buf, lnum, col, tm)
|
||||
static long
|
||||
bt_regexec_multi(rmp, win, buf, lnum, col, tm)
|
||||
regmmatch_T *rmp;
|
||||
win_T *win; /* window in which to search or NULL */
|
||||
buf_T *buf; /* buffer in which to search */
|
||||
@@ -3641,7 +3685,7 @@ vim_regexec_multi(rmp, win, buf, lnum, col, tm)
|
||||
#endif
|
||||
ireg_maxcol = rmp->rmm_maxcol;
|
||||
|
||||
r = vim_regexec_both(NULL, col, tm);
|
||||
r = bt_regexec_both(NULL, col, tm);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -3651,12 +3695,12 @@ vim_regexec_multi(rmp, win, buf, lnum, col, tm)
|
||||
* lines ("line" is NULL, use reg_getline()).
|
||||
*/
|
||||
static long
|
||||
vim_regexec_both(line, col, tm)
|
||||
bt_regexec_both(line, col, tm)
|
||||
char_u *line;
|
||||
colnr_T col; /* column to start looking for match */
|
||||
proftime_T *tm UNUSED; /* timeout limit or NULL */
|
||||
{
|
||||
regprog_T *prog;
|
||||
bt_regprog_T *prog;
|
||||
char_u *s;
|
||||
long retval = 0L;
|
||||
|
||||
@@ -3682,14 +3726,14 @@ vim_regexec_both(line, col, tm)
|
||||
|
||||
if (REG_MULTI)
|
||||
{
|
||||
prog = reg_mmatch->regprog;
|
||||
prog = (bt_regprog_T *)reg_mmatch->regprog;
|
||||
line = reg_getline((linenr_T)0);
|
||||
reg_startpos = reg_mmatch->startpos;
|
||||
reg_endpos = reg_mmatch->endpos;
|
||||
}
|
||||
else
|
||||
{
|
||||
prog = reg_match->regprog;
|
||||
prog = (bt_regprog_T *)reg_match->regprog;
|
||||
reg_startp = reg_match->startp;
|
||||
reg_endp = reg_match->endp;
|
||||
}
|
||||
@@ -3931,7 +3975,7 @@ unref_extmatch(em)
|
||||
*/
|
||||
static long
|
||||
regtry(prog, col)
|
||||
regprog_T *prog;
|
||||
bt_regprog_T *prog;
|
||||
colnr_T col;
|
||||
{
|
||||
reginput = regline + col;
|
||||
@@ -4063,7 +4107,7 @@ regmatch(scan)
|
||||
#define RA_NOMATCH 5 /* didn't match */
|
||||
|
||||
/* Make "regstack" and "backpos" empty. They are allocated and freed in
|
||||
* vim_regexec_both() to reduce malloc()/free() calls. */
|
||||
* bt_regexec_both() to reduce malloc()/free() calls. */
|
||||
regstack.ga_len = 0;
|
||||
backpos.ga_len = 0;
|
||||
|
||||
@@ -4072,14 +4116,14 @@ regmatch(scan)
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
/* Some patterns my cause a long time to match, even though they are not
|
||||
/* Some patterns may cause a long time to match, even though they are not
|
||||
* illegal. E.g., "\([a-z]\+\)\+Q". Allow breaking them with CTRL-C. */
|
||||
fast_breakcheck();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (scan != NULL && regnarrate)
|
||||
{
|
||||
mch_errmsg(regprop(scan));
|
||||
mch_errmsg((char *)regprop(scan));
|
||||
mch_errmsg("(\n");
|
||||
}
|
||||
#endif
|
||||
@@ -4100,7 +4144,7 @@ regmatch(scan)
|
||||
#ifdef DEBUG
|
||||
if (regnarrate)
|
||||
{
|
||||
mch_errmsg(regprop(scan));
|
||||
mch_errmsg((char *)regprop(scan));
|
||||
mch_errmsg("...\n");
|
||||
# ifdef FEAT_SYN_HL
|
||||
if (re_extmatch_in != NULL)
|
||||
@@ -4112,7 +4156,7 @@ regmatch(scan)
|
||||
{
|
||||
mch_errmsg(" \"");
|
||||
if (re_extmatch_in->matches[i] != NULL)
|
||||
mch_errmsg(re_extmatch_in->matches[i]);
|
||||
mch_errmsg((char *)re_extmatch_in->matches[i]);
|
||||
mch_errmsg("\"\n");
|
||||
}
|
||||
}
|
||||
@@ -5714,7 +5758,7 @@ regrepeat(p, maxcount)
|
||||
case SIDENT + ADD_NL:
|
||||
while (count < maxcount)
|
||||
{
|
||||
if (vim_isIDc(*scan) && (testval || !VIM_ISDIGIT(*scan)))
|
||||
if (vim_isIDc(PTR2CHAR(scan)) && (testval || !VIM_ISDIGIT(*scan)))
|
||||
{
|
||||
mb_ptr_adv(scan);
|
||||
}
|
||||
@@ -5775,7 +5819,7 @@ regrepeat(p, maxcount)
|
||||
case SFNAME + ADD_NL:
|
||||
while (count < maxcount)
|
||||
{
|
||||
if (vim_isfilec(*scan) && (testval || !VIM_ISDIGIT(*scan)))
|
||||
if (vim_isfilec(PTR2CHAR(scan)) && (testval || !VIM_ISDIGIT(*scan)))
|
||||
{
|
||||
mb_ptr_adv(scan);
|
||||
}
|
||||
@@ -6091,9 +6135,14 @@ regnext(p)
|
||||
static int
|
||||
prog_magic_wrong()
|
||||
{
|
||||
if (UCHARAT(REG_MULTI
|
||||
? reg_mmatch->regprog->program
|
||||
: reg_match->regprog->program) != REGMAGIC)
|
||||
regprog_T *prog;
|
||||
|
||||
prog = REG_MULTI ? reg_mmatch->regprog : reg_match->regprog;
|
||||
if (prog->engine == &nfa_regengine)
|
||||
/* For NFA matcher we don't check the magic */
|
||||
return FALSE;
|
||||
|
||||
if (UCHARAT(((bt_regprog_T *)prog)->program) != REGMAGIC)
|
||||
{
|
||||
EMSG(_(e_re_corr));
|
||||
return TRUE;
|
||||
@@ -6318,7 +6367,7 @@ re_num_cmp(val, scan)
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef BT_REGEXP_DUMP
|
||||
|
||||
/*
|
||||
* regdump - dump a regexp onto stdout in vaguely comprehensible form
|
||||
@@ -6326,14 +6375,22 @@ re_num_cmp(val, scan)
|
||||
static void
|
||||
regdump(pattern, r)
|
||||
char_u *pattern;
|
||||
regprog_T *r;
|
||||
bt_regprog_T *r;
|
||||
{
|
||||
char_u *s;
|
||||
int op = EXACTLY; /* Arbitrary non-END op. */
|
||||
char_u *next;
|
||||
char_u *end = NULL;
|
||||
FILE *f;
|
||||
|
||||
printf("\r\nregcomp(%s):\r\n", pattern);
|
||||
#ifdef BT_REGEXP_LOG
|
||||
f = fopen("bt_regexp_log.log", "a");
|
||||
#else
|
||||
f = stdout;
|
||||
#endif
|
||||
if (f == NULL)
|
||||
return;
|
||||
fprintf(f, "-------------------------------------\n\r\nregcomp(%s):\r\n", pattern);
|
||||
|
||||
s = r->program + 1;
|
||||
/*
|
||||
@@ -6343,18 +6400,18 @@ regdump(pattern, r)
|
||||
while (op != END || s <= end)
|
||||
{
|
||||
op = OP(s);
|
||||
printf("%2d%s", (int)(s - r->program), regprop(s)); /* Where, what. */
|
||||
fprintf(f, "%2d%s", (int)(s - r->program), regprop(s)); /* Where, what. */
|
||||
next = regnext(s);
|
||||
if (next == NULL) /* Next ptr. */
|
||||
printf("(0)");
|
||||
fprintf(f, "(0)");
|
||||
else
|
||||
printf("(%d)", (int)((s - r->program) + (next - s)));
|
||||
fprintf(f, "(%d)", (int)((s - r->program) + (next - s)));
|
||||
if (end < next)
|
||||
end = next;
|
||||
if (op == BRACE_LIMITS)
|
||||
{
|
||||
/* Two short ints */
|
||||
printf(" minval %ld, maxval %ld", OPERAND_MIN(s), OPERAND_MAX(s));
|
||||
fprintf(f, " minval %ld, maxval %ld", OPERAND_MIN(s), OPERAND_MAX(s));
|
||||
s += 8;
|
||||
}
|
||||
s += 3;
|
||||
@@ -6363,25 +6420,33 @@ regdump(pattern, r)
|
||||
|| op == EXACTLY)
|
||||
{
|
||||
/* Literal string, where present. */
|
||||
fprintf(f, "\nxxxxxxxxx\n");
|
||||
while (*s != NUL)
|
||||
printf("%c", *s++);
|
||||
fprintf(f, "%c", *s++);
|
||||
fprintf(f, "\nxxxxxxxxx\n");
|
||||
s++;
|
||||
}
|
||||
printf("\r\n");
|
||||
fprintf(f, "\r\n");
|
||||
}
|
||||
|
||||
/* Header fields of interest. */
|
||||
if (r->regstart != NUL)
|
||||
printf("start `%s' 0x%x; ", r->regstart < 256
|
||||
fprintf(f, "start `%s' 0x%x; ", r->regstart < 256
|
||||
? (char *)transchar(r->regstart)
|
||||
: "multibyte", r->regstart);
|
||||
if (r->reganch)
|
||||
printf("anchored; ");
|
||||
fprintf(f, "anchored; ");
|
||||
if (r->regmust != NULL)
|
||||
printf("must have \"%s\"", r->regmust);
|
||||
printf("\r\n");
|
||||
}
|
||||
fprintf(f, "must have \"%s\"", r->regmust);
|
||||
fprintf(f, "\r\n");
|
||||
|
||||
#ifdef BT_REGEXP_LOG
|
||||
fclose(f);
|
||||
#endif
|
||||
}
|
||||
#endif /* BT_REGEXP_DUMP */
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* regprop - printable representation of opcode
|
||||
*/
|
||||
@@ -6389,12 +6454,12 @@ regdump(pattern, r)
|
||||
regprop(op)
|
||||
char_u *op;
|
||||
{
|
||||
char_u *p;
|
||||
static char_u buf[50];
|
||||
char *p;
|
||||
static char buf[50];
|
||||
|
||||
(void) strcpy(buf, ":");
|
||||
STRCPY(buf, ":");
|
||||
|
||||
switch (OP(op))
|
||||
switch ((int) OP(op))
|
||||
{
|
||||
case BOL:
|
||||
p = "BOL";
|
||||
@@ -6761,10 +6826,10 @@ regprop(op)
|
||||
break;
|
||||
}
|
||||
if (p != NULL)
|
||||
(void) strcat(buf, p);
|
||||
return buf;
|
||||
STRCAT(buf, p);
|
||||
return (char_u *)buf;
|
||||
}
|
||||
#endif
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
static void mb_decompose __ARGS((int c, int *c1, int *c2, int *c3));
|
||||
@@ -6834,7 +6899,7 @@ mb_decompose(c, c1, c2, c3)
|
||||
{
|
||||
decomp_T d;
|
||||
|
||||
if (c >= 0x4b20 && c <= 0xfb4f)
|
||||
if (c >= 0xfb20 && c <= 0xfb4f)
|
||||
{
|
||||
d = decomp_table[c - 0xfb20];
|
||||
*c1 = d.a;
|
||||
@@ -7667,3 +7732,188 @@ reg_submatch(no)
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
static regengine_T bt_regengine =
|
||||
{
|
||||
bt_regcomp,
|
||||
bt_regexec,
|
||||
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
|
||||
|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
|
||||
bt_regexec_nl,
|
||||
#endif
|
||||
bt_regexec_multi
|
||||
#ifdef DEBUG
|
||||
,(char_u *)""
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#include "regexp_nfa.c"
|
||||
|
||||
static regengine_T nfa_regengine =
|
||||
{
|
||||
nfa_regcomp,
|
||||
nfa_regexec,
|
||||
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
|
||||
|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
|
||||
nfa_regexec_nl,
|
||||
#endif
|
||||
nfa_regexec_multi
|
||||
#ifdef DEBUG
|
||||
,(char_u *)""
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Which regexp engine to use? Needed for vim_regcomp().
|
||||
* Must match with 'regexpengine'. */
|
||||
static int regexp_engine = 0;
|
||||
#define AUTOMATIC_ENGINE 0
|
||||
#define BACKTRACKING_ENGINE 1
|
||||
#define NFA_ENGINE 2
|
||||
#ifdef DEBUG
|
||||
static char_u regname[][30] = {
|
||||
"AUTOMATIC Regexp Engine",
|
||||
"BACKTACKING Regexp Engine",
|
||||
"NFA Regexp Engine"
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile a regular expression into internal code.
|
||||
* Returns the program in allocated memory. Returns NULL for an error.
|
||||
*/
|
||||
regprog_T *
|
||||
vim_regcomp(expr_arg, re_flags)
|
||||
char_u *expr_arg;
|
||||
int re_flags;
|
||||
{
|
||||
regprog_T *prog = NULL;
|
||||
char_u *expr = expr_arg;
|
||||
|
||||
syntax_error = FALSE;
|
||||
regexp_engine = p_re;
|
||||
|
||||
/* Check for prefix "\%#=", that sets the regexp engine */
|
||||
if (STRNCMP(expr, "\\%#=", 4) == 0)
|
||||
{
|
||||
int newengine = expr[4] - '0';
|
||||
|
||||
if (newengine == AUTOMATIC_ENGINE
|
||||
|| newengine == BACKTRACKING_ENGINE
|
||||
|| newengine == NFA_ENGINE)
|
||||
{
|
||||
regexp_engine = expr[4] - '0';
|
||||
expr += 5;
|
||||
#ifdef DEBUG
|
||||
EMSG3("New regexp mode selected (%d): %s", regexp_engine,
|
||||
regname[newengine]);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
EMSG(_("E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be used "));
|
||||
regexp_engine = AUTOMATIC_ENGINE;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
bt_regengine.expr = expr;
|
||||
nfa_regengine.expr = expr;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* First try the NFA engine, unless backtracking was requested.
|
||||
*/
|
||||
if (regexp_engine != BACKTRACKING_ENGINE)
|
||||
prog = nfa_regengine.regcomp(expr, re_flags);
|
||||
else
|
||||
prog = bt_regengine.regcomp(expr, re_flags);
|
||||
|
||||
if (prog == NULL) /* error compiling regexp with initial engine */
|
||||
{
|
||||
#ifdef BT_REGEXP_DEBUG_LOG
|
||||
if (regexp_engine != BACKTRACKING_ENGINE) /* debugging log for NFA */
|
||||
{
|
||||
FILE *f;
|
||||
f = fopen(BT_REGEXP_DEBUG_LOG_NAME, "a");
|
||||
if (f)
|
||||
{
|
||||
if (!syntax_error)
|
||||
fprintf(f, "NFA engine could not handle \"%s\"\n", expr);
|
||||
else
|
||||
fprintf(f, "Syntax error in \"%s\"\n", expr);
|
||||
fclose(f);
|
||||
}
|
||||
else
|
||||
EMSG2("(NFA) Could not open \"%s\" to write !!!",
|
||||
BT_REGEXP_DEBUG_LOG_NAME);
|
||||
/*
|
||||
if (syntax_error)
|
||||
EMSG("NFA Regexp: Syntax Error !");
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* If NFA engine failed, then revert to the backtracking engine.
|
||||
* Except when there was a syntax error, which was properly handled by
|
||||
* NFA engine.
|
||||
*/
|
||||
if (regexp_engine == AUTOMATIC_ENGINE)
|
||||
if (!syntax_error)
|
||||
prog = bt_regengine.regcomp(expr, re_flags);
|
||||
|
||||
} /* endif prog==NULL */
|
||||
|
||||
|
||||
return prog;
|
||||
}
|
||||
|
||||
/*
|
||||
* Match a regexp against a string.
|
||||
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
|
||||
* Uses curbuf for line count and 'iskeyword'.
|
||||
*
|
||||
* Return TRUE if there is a match, FALSE if not.
|
||||
*/
|
||||
int
|
||||
vim_regexec(rmp, line, col)
|
||||
regmatch_T *rmp;
|
||||
char_u *line; /* string to match against */
|
||||
colnr_T col; /* column to start looking for match */
|
||||
{
|
||||
return rmp->regprog->engine->regexec(rmp, line, col);
|
||||
}
|
||||
|
||||
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
|
||||
|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
|
||||
/*
|
||||
* Like vim_regexec(), but consider a "\n" in "line" to be a line break.
|
||||
*/
|
||||
int
|
||||
vim_regexec_nl(rmp, line, col)
|
||||
regmatch_T *rmp;
|
||||
char_u *line;
|
||||
colnr_T col;
|
||||
{
|
||||
return rmp->regprog->engine->regexec_nl(rmp, line, col);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Match a regexp against multiple lines.
|
||||
* "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
|
||||
* Uses curbuf for line count and 'iskeyword'.
|
||||
*
|
||||
* Return zero if there is no match. Return number of lines contained in the
|
||||
* match otherwise.
|
||||
*/
|
||||
long
|
||||
vim_regexec_multi(rmp, win, buf, lnum, col, tm)
|
||||
regmmatch_T *rmp;
|
||||
win_T *win; /* window in which to search or NULL */
|
||||
buf_T *buf; /* buffer in which to search */
|
||||
linenr_T lnum; /* nr of line to start looking for match */
|
||||
colnr_T col; /* column to start looking for match */
|
||||
proftime_T *tm; /* timeout limit or NULL */
|
||||
{
|
||||
return rmp->regprog->engine->regexec_multi(rmp, win, buf, lnum, col, tm);
|
||||
}
|
||||
|
||||
78
src/regexp.h
78
src/regexp.h
@@ -21,21 +21,77 @@
|
||||
*/
|
||||
#define NSUBEXP 10
|
||||
|
||||
/*
|
||||
* In the NFA engine: how many braces are allowed.
|
||||
* TODO(RE): Use dynamic memory allocation instead of static, like here
|
||||
*/
|
||||
#define NFA_MAX_BRACES 20
|
||||
|
||||
typedef struct regengine regengine_T;
|
||||
|
||||
typedef struct thread thread_T;
|
||||
|
||||
/*
|
||||
* Structure returned by vim_regcomp() to pass on to vim_regexec().
|
||||
* This is the general structure. For the actual matcher, two specific
|
||||
* structures are used. See code below.
|
||||
*/
|
||||
typedef struct regprog
|
||||
{
|
||||
regengine_T *engine;
|
||||
unsigned regflags;
|
||||
} regprog_T;
|
||||
|
||||
/*
|
||||
* Structure used by the back track matcher.
|
||||
* These fields are only to be used in regexp.c!
|
||||
* See regep.c for an explanation.
|
||||
* See regexp.c for an explanation.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* These two members implement regprog_T */
|
||||
regengine_T *engine;
|
||||
unsigned regflags;
|
||||
|
||||
int regstart;
|
||||
char_u reganch;
|
||||
char_u *regmust;
|
||||
int regmlen;
|
||||
unsigned regflags;
|
||||
char_u reghasz;
|
||||
char_u program[1]; /* actually longer.. */
|
||||
} regprog_T;
|
||||
char_u program[1]; /* actually longer.. */
|
||||
} bt_regprog_T;
|
||||
|
||||
/*
|
||||
* Structure representing a NFA state.
|
||||
* A NFA state may have no outgoing edge, when it is a NFA_MATCH state.
|
||||
*/
|
||||
typedef struct nfa_state nfa_state_T;
|
||||
struct nfa_state
|
||||
{
|
||||
int c;
|
||||
nfa_state_T *out;
|
||||
nfa_state_T *out1;
|
||||
int id;
|
||||
int lastlist;
|
||||
int visits;
|
||||
thread_T *lastthread;
|
||||
int negated;
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure used by the NFA matcher.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* These two members implement regprog_T */
|
||||
regengine_T *engine;
|
||||
unsigned regflags;
|
||||
|
||||
regprog_T regprog;
|
||||
nfa_state_T *start;
|
||||
int nstate;
|
||||
nfa_state_T state[0]; /* actually longer.. */
|
||||
} nfa_regprog_T;
|
||||
|
||||
/*
|
||||
* Structure to be used for single-line matching.
|
||||
@@ -78,4 +134,18 @@ typedef struct
|
||||
char_u *matches[NSUBEXP];
|
||||
} reg_extmatch_T;
|
||||
|
||||
struct regengine
|
||||
{
|
||||
regprog_T *(*regcomp)(char_u*, int);
|
||||
int (*regexec)(regmatch_T*, char_u*, colnr_T);
|
||||
#if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
|
||||
|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
|
||||
int (*regexec_nl)(regmatch_T*, char_u*, colnr_T);
|
||||
#endif
|
||||
long (*regexec_multi)(regmmatch_T*, win_T*, buf_T*, linenr_T, colnr_T, proftime_T*);
|
||||
#ifdef DEBUG
|
||||
char_u *expr;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* _REGEXP_H */
|
||||
|
||||
3848
src/regexp_nfa.c
Normal file
3848
src/regexp_nfa.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -63,15 +63,16 @@ typedef struct growarray
|
||||
|
||||
#define GA_EMPTY {0, 0, 0, 0, NULL}
|
||||
|
||||
/*
|
||||
* This is here because regexp.h needs pos_T and below regprog_T is used.
|
||||
*/
|
||||
#include "regexp.h"
|
||||
|
||||
typedef struct window_S win_T;
|
||||
typedef struct wininfo_S wininfo_T;
|
||||
typedef struct frame_S frame_T;
|
||||
typedef int scid_T; /* script ID */
|
||||
typedef struct file_buffer buf_T; /* forward declaration */
|
||||
|
||||
/*
|
||||
* This is here because regexp.h needs pos_T and below regprog_T is used.
|
||||
*/
|
||||
#include "regexp.h"
|
||||
|
||||
/*
|
||||
* This is here because gui.h needs the pos_T and win_T, and win_T needs gui.h
|
||||
@@ -526,8 +527,6 @@ typedef struct
|
||||
# endif
|
||||
} cmdmod_T;
|
||||
|
||||
typedef struct file_buffer buf_T; /* forward declaration */
|
||||
|
||||
#define MF_SEED_LEN 8
|
||||
|
||||
struct memfile
|
||||
|
||||
@@ -33,7 +33,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
||||
test76.out test77.out test78.out test79.out test80.out \
|
||||
test81.out test82.out test83.out test84.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
test94.out test95.out
|
||||
|
||||
.SUFFIXES: .in .out
|
||||
|
||||
@@ -144,3 +144,4 @@ test91.out: test91.in
|
||||
test92.out: test92.in
|
||||
test93.out: test93.in
|
||||
test94.out: test94.in
|
||||
test95.out: test95.in
|
||||
|
||||
@@ -32,7 +32,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
||||
test79.out test80.out test81.out test82.out test83.out \
|
||||
test84.out test85.out test86.out test87.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
test94.out test95.out
|
||||
|
||||
SCRIPTS32 = test50.out test70.out
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
||||
test79.out test80.out test81.out test82.out test83.out \
|
||||
test84.out test85.out test86.out test87.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
test94.out test95.out
|
||||
|
||||
SCRIPTS32 = test50.out test70.out
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
||||
test76.out test77.out test78.out test79.out test80.out \
|
||||
test81.out test82.out test83.out test84.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
test94.out test95.out
|
||||
|
||||
.SUFFIXES: .in .out
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
||||
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
||||
#
|
||||
# Last change: 2013 Apr 12
|
||||
# Last change: 2013 May 18
|
||||
#
|
||||
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
||||
# Edit the lines in the Configuration section below to select.
|
||||
@@ -77,7 +77,8 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
|
||||
test71.out test72.out test74.out test75.out test76.out \
|
||||
test77.out test78.out test79.out test80.out test81.out \
|
||||
test82.out test83.out test84.out test88.out test89.out \
|
||||
test90.out test91.out test92.out test93.out test94.out
|
||||
test90.out test91.out test92.out test93.out test94.out \
|
||||
test95.out
|
||||
|
||||
# Known problems:
|
||||
# Test 30: a problem around mac format - unknown reason
|
||||
|
||||
@@ -29,7 +29,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
||||
test79.out test80.out test81.out test82.out test83.out \
|
||||
test84.out test85.out test86.out test87.out test88.out \
|
||||
test89.out test90.out test91.out test92.out test93.out \
|
||||
test94.out
|
||||
test94.out test95.out
|
||||
|
||||
SCRIPTS_GUI = test16.out
|
||||
|
||||
@@ -85,13 +85,16 @@ test1.out: test1.in
|
||||
fi"
|
||||
|
||||
# Check if the test.out file matches test.ok.
|
||||
@/bin/sh -c "if test -f test.out; then\
|
||||
@/bin/sh -c "if test -f test.out; then \
|
||||
if diff test.out $*.ok; \
|
||||
then mv -f test.out $*.out; \
|
||||
else echo $* FAILED >>test.log; mv -f test.out $*.failed; \
|
||||
fi \
|
||||
else echo $* NO OUTPUT >>test.log; \
|
||||
fi"
|
||||
@/bin/sh -c "if test -f valgrind; then\
|
||||
mv -f valgrind valgrind.$*; \
|
||||
fi"
|
||||
-rm -rf X* test.ok viminfo
|
||||
|
||||
test49.out: test49.vim
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Test for regexp patterns.
|
||||
Test for regexp patterns without multi-byte support.
|
||||
See test95 for multi-byte tests.
|
||||
|
||||
A pattern that gives the expected result produces OK, so that we know it was
|
||||
actually tried.
|
||||
@@ -14,6 +15,11 @@ STARTTEST
|
||||
:" etc.
|
||||
:" When there is no match use only the first two items.
|
||||
:let tl = []
|
||||
|
||||
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
:"""" Previously written tests """"""""""""""""""""""""""""""""
|
||||
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
:call add(tl, ['ab', 'aab', 'ab'])
|
||||
:call add(tl, ['b', 'abcdef', 'b'])
|
||||
:call add(tl, ['bc*', 'abccccdef', 'bcccc'])
|
||||
@@ -132,6 +138,169 @@ STARTTEST
|
||||
:"
|
||||
:call add(tl, ['\v(a*)+', 'aaaa', 'aaaa', ''])
|
||||
:call add(tl, ['x', 'abcdef'])
|
||||
|
||||
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
:""""" Simple tests """""""""""""""""""""""""""""""""""""""""""
|
||||
:""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
:" Search single groups
|
||||
:call add(tl, ['ab', 'aab', 'ab'])
|
||||
:call add(tl, ['ab', 'baced'])
|
||||
:call add(tl, ['ab', ' ab ', 'ab'])
|
||||
|
||||
:" Search multi-modifiers
|
||||
:call add(tl, ['x*', 'xcd', 'x'])
|
||||
:call add(tl, ['x*', 'xxxxxxxxxxxxxxxxsofijiojgf', 'xxxxxxxxxxxxxxxx'])
|
||||
:call add(tl, ['x*', 'abcdoij', '']) " empty match is good
|
||||
:call add(tl, ['x\+', 'abcdoin']) " no match here
|
||||
:call add(tl, ['x\+', 'abcdeoijdfxxiuhfij', 'xx'])
|
||||
:call add(tl, ['x\+', 'xxxxx', 'xxxxx'])
|
||||
:call add(tl, ['x\+', 'abc x siufhiush xxxxxxxxx', 'x'])
|
||||
:call add(tl, ['x\=', 'x sdfoij', 'x'])
|
||||
:call add(tl, ['x\=', 'abc sfoij', '']) " empty match is good
|
||||
:call add(tl, ['x\=', 'xxxxxxxxx c', 'x'])
|
||||
:call add(tl, ['x\?', 'x sdfoij', 'x'])
|
||||
:call add(tl, ['x\?', 'abc sfoij', '']) " empty match is good
|
||||
:call add(tl, ['x\?', 'xxxxxxxxxx c', 'x'])
|
||||
|
||||
:call add(tl, ['a\{0,0}', 'abcdfdoij', ''])
|
||||
:call add(tl, ['a\{0,1}', 'asiubid axxxaaa', 'a']) " same thing as 'a?'
|
||||
:call add(tl, ['a\{1,0}', 'asiubid axxxaaa', 'a']) " same thing as 'a\{0,1}'
|
||||
:call add(tl, ['a\{3,6}', 'aa siofuh'])
|
||||
:call add(tl, ['a\{3,6}', 'aaaaa asfoij afaa', 'aaaaa'])
|
||||
:call add(tl, ['a\{3,6}', 'aaaaaaaa', 'aaaaaa'])
|
||||
:call add(tl, ['a\{0}', 'asoiuj', ''])
|
||||
:call add(tl, ['a\{2}', 'aaaa', 'aa'])
|
||||
:call add(tl, ['a\{2}', 'iuash fiusahfliusah fiushfilushfi uhsaifuh askfj nasfvius afg aaaa sfiuhuhiushf', 'aa'])
|
||||
:call add(tl, ['a\{2}', 'abcdefghijklmnopqrestuvwxyz1234567890'])
|
||||
:call add(tl, ['a\{0,}', 'oij sdigfusnf', '']) " same thing as 'a*'
|
||||
:call add(tl, ['a\{0,}', 'aaaaa aa', 'aaaaa'])
|
||||
:call add(tl, ['a\{2,}', 'sdfiougjdsafg'])
|
||||
:call add(tl, ['a\{2,}', 'aaaaasfoij ', 'aaaaa'])
|
||||
:call add(tl, ['a\{,0}', 'oidfguih iuhi hiu aaaa', ''])
|
||||
:call add(tl, ['a\{,5}', 'abcd', 'a'])
|
||||
:call add(tl, ['a\{,5}', 'aaaaaaaaaa', 'aaaaa'])
|
||||
:call add(tl, ['a\{}', 'bbbcddiuhfcd', '']) " same thing as 'a*'
|
||||
:call add(tl, ['a\{}', 'aaaaioudfh coisf jda', 'aaaa'])
|
||||
|
||||
:call add(tl, ['a\{-0,0}', 'abcdfdoij', ''])
|
||||
:call add(tl, ['a\{-0,1}', 'asiubid axxxaaa', '']) " anti-greedy version of 'a?'
|
||||
:call add(tl, ['a\{-3,6}', 'aa siofuh'])
|
||||
:call add(tl, ['a\{-3,6}', 'aaaaa asfoij afaa', 'aaa'])
|
||||
:call add(tl, ['a\{-3,6}', 'aaaaaaaa', 'aaa'])
|
||||
:call add(tl, ['a\{-0}', 'asoiuj', ''])
|
||||
:call add(tl, ['a\{-2}', 'aaaa', 'aa'])
|
||||
:call add(tl, ['a\{-2}', 'abcdefghijklmnopqrestuvwxyz1234567890'])
|
||||
:call add(tl, ['a\{-0,}', 'oij sdigfusnf', ''])
|
||||
:call add(tl, ['a\{-0,}', 'aaaaa aa', ''])
|
||||
:call add(tl, ['a\{-2,}', 'sdfiougjdsafg'])
|
||||
:call add(tl, ['a\{-2,}', 'aaaaasfoij ', 'aa'])
|
||||
:call add(tl, ['a\{-,0}', 'oidfguih iuhi hiu aaaa', ''])
|
||||
:call add(tl, ['a\{-,5}', 'abcd', ''])
|
||||
:call add(tl, ['a\{-,5}', 'aaaaaaaaaa', ''])
|
||||
:call add(tl, ['a\{-}', 'bbbcddiuhfcd', '']) " anti-greedy version of 'a*'
|
||||
:call add(tl, ['a\{-}', 'aaaaioudfh coisf jda', ''])
|
||||
|
||||
:" Test groups of characters and submatches
|
||||
:call add(tl, ['\(abc\)*', 'abcabcabc', 'abcabcabc', 'abc'])
|
||||
:call add(tl, ['\(ab\)\+', 'abababaaaaa', 'ababab', 'ab'])
|
||||
:call add(tl, ['\(abaaaaa\)*cd', 'cd', 'cd', ''])
|
||||
:call add(tl, ['\(test1\)\? \(test2\)\?', 'test1 test3', 'test1 ', 'test1', ''])
|
||||
:call add(tl, ['\(test1\)\= \(test2\) \(test4443\)\=', ' test2 test4443 yupiiiiiiiiiii', ' test2 test4443', '', 'test2', 'test4443'])
|
||||
:call add(tl, ['\(\(sub1\) hello \(sub 2\)\)', 'asterix sub1 hello sub 2 obelix', 'sub1 hello sub 2', 'sub1 hello sub 2', 'sub1', 'sub 2'])
|
||||
:call add(tl, ['\(\(\(yyxxzz\)\)\)', 'abcdddsfiusfyyzzxxyyxxzz', 'yyxxzz', 'yyxxzz', 'yyxxzz', 'yyxxzz'])
|
||||
:call add(tl, ['\v((ab)+|c+)+', 'abcccaba', 'abcccab', 'ab', 'ab'])
|
||||
:call add(tl, ['\v((ab)|c*)+', 'abcccaba', 'abcccab', '', 'ab'])
|
||||
:call add(tl, ['\v(a(c*)+b)+', 'acbababaaa', 'acbabab', 'ab', ''])
|
||||
:call add(tl, ['\v(a|b*)+', 'aaaa', 'aaaa', ''])
|
||||
|
||||
:" Test greedy-ness and lazy-ness
|
||||
:call add(tl, ['a\{-2,7}','aaaaaaaaaaaaa', 'aa'])
|
||||
:call add(tl, ['a\{2,7}','aaaaaaaaaaaaaaaaaaaa', 'aaaaaaa'])
|
||||
:call add(tl, ['\vx(.{-,8})yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz','ayxa','xayzxayz'])
|
||||
:call add(tl, ['\vx(.*)yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz', 'ayxayzxayzxa',''])
|
||||
:call add(tl, ['\v(a{1,2}){-2,3}','aaaaaaa','aaaa','aa'])
|
||||
:call add(tl, ['\v(a{-1,3})+','aa','aa','a'])
|
||||
|
||||
:" Test Character classes
|
||||
:call add(tl, ['\d\+e\d\d','test 10e23 fd','10e23'])
|
||||
|
||||
:" Test collections and character range []
|
||||
:call add(tl, ['\v[a]', 'abcd', 'a'])
|
||||
:call add(tl, ['a[bcd]', 'abcd', 'ab'])
|
||||
:call add(tl, ['a[b-d]', 'acbd', 'ac'])
|
||||
:call add(tl, ['[a-d][e-f][x-x]d', 'cexdxx', 'cexd'])
|
||||
:call add(tl, ['\v[[:alpha:]]+', 'abcdefghijklmnopqrstuvwxyz6','abcdefghijklmnopqrstuvwxyz'])
|
||||
:call add(tl, ['[[:alpha:]\+]', '6x8','x'])
|
||||
:call add(tl, ['[^abc]\+','abcabcabc'])
|
||||
:call add(tl, ['[^abc]','defghiasijvoinasoiunbvb','d'])
|
||||
:call add(tl, ['[^abc]\+','ddddddda','ddddddd'])
|
||||
:call add(tl, ['[^a-d]\+','aaaAAAZIHFNCddd','AAAZIHFNC'])
|
||||
:call add(tl, ['[a-f]*','iiiiiiii',''])
|
||||
:call add(tl, ['[a-f]*','abcdefgh','abcdef'])
|
||||
:call add(tl, ['[^a-f]\+','abcdefgh','gh'])
|
||||
:call add(tl, ['[a-c]\{-3,6}','abcabc','abc'])
|
||||
:call add(tl, ['[^[:alpha:]]\+','abcccadfoij7787ysf287yrnccdu','7787'])
|
||||
:call add(tl, ['[-a]', '-', '-'])
|
||||
:call add(tl, ['[a-]', '-', '-'])
|
||||
:call add(tl, ['[-./[:alnum:]_~]\+', 'log13.file', 'log13.file']) " filename regexp
|
||||
:call add(tl, ['[\]\^\-\\]\+', '\^\\\-\---^', '\^\\\-\---^']) " special chars
|
||||
:call add(tl, ['[[.a.]]\+', 'aa', 'aa']) " collation elem
|
||||
:call add(tl, ['abc[0-9]*ddd', 'siuhabc ii']) " middle of regexp
|
||||
:call add(tl, ['abc[0-9]*ddd', 'adf abc44482ddd oijs', 'abc44482ddd'])
|
||||
:call add(tl, ['\_[0-9]\+', 'asfi9888u', '9888'])
|
||||
:call add(tl, ['[0-9\n]\+', 'asfi9888u', '9888'])
|
||||
|
||||
|
||||
:"""" Test recognition of some character classes
|
||||
:call add(tl, ['[0-9]', '8', '8'])
|
||||
:call add(tl, ['[^0-9]', '8'])
|
||||
:call add(tl, ['[0-9a-fA-F]*', '0a7', '0a7'])
|
||||
:call add(tl, ['[^0-9A-Fa-f]\+', '0a7'])
|
||||
:call add(tl, ['[a-z_A-Z0-9]\+', 'aso_sfoij', 'aso_sfoij'])
|
||||
:call add(tl, ['[a-z]', 'a', 'a'])
|
||||
:call add(tl, ['[a-zA-Z]', 'a', 'a'])
|
||||
:call add(tl, ['[A-Z]', 'a'])
|
||||
:call add(tl, ['\C[^A-Z]\+', 'ABCOIJDEOIFNSD jsfoij sa', ' jsfoij sa'])
|
||||
|
||||
:"""" Tests for \z features
|
||||
:call add(tl, ['xx \ze test', 'xx ']) " must match after \ze
|
||||
:call add(tl, ['abc\zeend', 'oij abcend', 'abc'])
|
||||
:call add(tl, ['abc\zsdd', 'ddabcddxyzt', 'dd'])
|
||||
:call add(tl, ['aa \zsax', ' ax']) " must match before \zs
|
||||
:call add(tl, ['abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
|
||||
:call add(tl, ['\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
|
||||
|
||||
:"""" Tests for \@ features
|
||||
:call add(tl, ['abc\@=', 'abc', 'ab'])
|
||||
:call add(tl, ['abc\@=cd', 'abcd', 'abcd'])
|
||||
:call add(tl, ['abc\@=', 'ababc', 'ab'])
|
||||
:call add(tl, ['abcd\@=e', 'abcd']) " will never match, no matter the input text
|
||||
:call add(tl, ['abcd\@=e', 'any text in here ... ']) " will never match
|
||||
:call add(tl, ['\v(abc)@=..', 'xabcd', 'ab', 'abc'])
|
||||
:call add(tl, ['\(.*John\)\@=.*Bob', 'here is John, and here is B']) " no match
|
||||
:call add(tl, ['\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend'])
|
||||
:call add(tl, ['.*John\&.*Bob', 'here is John, and here is B']) " no match
|
||||
:call add(tl, ['.*John\&.*Bob', 'John is Bobs friend', 'John is Bob'])
|
||||
:call add(tl, ['\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1'])
|
||||
|
||||
:"""" Combining different tests and features
|
||||
:call add(tl, ['[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
|
||||
:call add(tl, ['', 'abcd', ''])
|
||||
:call add(tl, ['\v(())', 'any possible text', ''])
|
||||
:call add(tl, ['\v%(ab(xyz)c)', ' abxyzc ', 'abxyzc', 'xyz'])
|
||||
:call add(tl, ['\v(test|)empty', 'tesempty', 'empty', ''])
|
||||
:call add(tl, ['\v(a|aa)(a|aa)', 'aaa', 'aa', 'a', 'a'])
|
||||
|
||||
:"""" \%u and friends
|
||||
:call add(tl, ['\%d32', 'yes no', ' '])
|
||||
:call add(tl, ['\%o40', 'yes no', ' '])
|
||||
:call add(tl, ['\%x20', 'yes no', ' '])
|
||||
:call add(tl, ['\%u0020', 'yes no', ' '])
|
||||
:call add(tl, ['\%U00000020', 'yes no', ' '])
|
||||
|
||||
:"""" Run the tests
|
||||
|
||||
:"
|
||||
:for t in tl
|
||||
: let l = matchlist(t[1], t[0])
|
||||
@@ -143,7 +312,7 @@ STARTTEST
|
||||
: elseif len(t) > 2 && l[0] != t[2]
|
||||
: $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", match: \"' . l[0] . '\", expected: \"' . t[2] . '\"'
|
||||
: else
|
||||
: $put ='OK'
|
||||
: $put ='OK - ' . t[0]
|
||||
: endif
|
||||
: if len(l) > 0
|
||||
:" check all the nine submatches
|
||||
@@ -161,7 +330,17 @@ STARTTEST
|
||||
: endif
|
||||
:endfor
|
||||
:unlet t tl e l
|
||||
:/^Results/,$wq! test.out
|
||||
|
||||
:" Check that \_[0-9] matching EOL does not break a following \>
|
||||
:" This only works on a buffer line, not with expression evaluation
|
||||
/^Find this
|
||||
/\<\(\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\.\)\{3\}\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\>
|
||||
y$Gop:"
|
||||
|
||||
:/\%#=1^Results/,$wq! test.out
|
||||
ENDTEST
|
||||
|
||||
Find this:
|
||||
localnet/192.168.0.1
|
||||
|
||||
Results of test64:
|
||||
|
||||
@@ -1,102 +1,234 @@
|
||||
Results of test64:
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK
|
||||
OK - ab
|
||||
OK - b
|
||||
OK - bc*
|
||||
OK - bc\{-}
|
||||
OK - bc\{-}\(d\)
|
||||
OK - bc*
|
||||
OK - c*
|
||||
OK - bc*
|
||||
OK - c*
|
||||
OK - bc\+
|
||||
OK - bc\+
|
||||
OK - a\|ab
|
||||
OK - c\?
|
||||
OK - bc\?
|
||||
OK - bc\?
|
||||
OK - \va{1}
|
||||
OK - \va{2}
|
||||
OK - \va{2}
|
||||
OK - \va{2}
|
||||
OK - \va{2}
|
||||
OK - \va{2}
|
||||
OK - \va{2}
|
||||
OK - \vb{1}
|
||||
OK - \vba{2}
|
||||
OK - \vba{3}
|
||||
OK - \v(ab){1}
|
||||
OK - \v(ab){1}
|
||||
OK - \v(ab){1}
|
||||
OK - \v(ab){0,2}
|
||||
OK - \v(ab){0,2}
|
||||
OK - \v(ab){1,2}
|
||||
OK - \v(ab){1,2}
|
||||
OK - \v(ab){2,4}
|
||||
OK - \v(ab){2,4}
|
||||
OK - \v(ab){2}
|
||||
OK - \v(ab){2}
|
||||
OK - \v(ab){2}
|
||||
OK - \v(ab){2}
|
||||
OK - \v((ab){2}){2}
|
||||
OK - \v((ab){2}){2}
|
||||
OK - \v(a{1}){1}
|
||||
OK - \v(a{2}){1}
|
||||
OK - \v(a{2}){1}
|
||||
OK - \v(a{2}){1}
|
||||
OK - \v(a{1}){2}
|
||||
OK - \v(a{1}){2}
|
||||
OK - \v(a{2})+
|
||||
OK - \v(a{2})+
|
||||
OK - \v(a{2}){1}
|
||||
OK - \v(a{1}){2}
|
||||
OK - \v(a{1}){1}
|
||||
OK - \v(a{2}){2}
|
||||
OK - \v(a{2}){2}
|
||||
OK - \v(a+){2}
|
||||
OK - \v(a{3}){2}
|
||||
OK - \v(a{1,2}){2}
|
||||
OK - \v(a{1,3}){2}
|
||||
OK - \v(a{1,3}){2}
|
||||
OK - \v(a{1,3}){3}
|
||||
OK - \v(a{1,2}){2}
|
||||
OK - \v(a+)+
|
||||
OK - \v(a+)+
|
||||
OK - \v(a+){1,2}
|
||||
OK - \v(a+)(a+)
|
||||
OK - \v(a{3})+
|
||||
OK - \v(a|b|c)+
|
||||
OK - \v(a|b|c){2}
|
||||
OK - \v(abc){2}
|
||||
OK - \v(abc){2}
|
||||
OK - a*
|
||||
OK - \v(a*)+
|
||||
OK - \v((ab)+)+
|
||||
OK - \v(((ab)+)+)+
|
||||
OK - \v(((ab)+)+)+
|
||||
OK - \v(a{0,2})+
|
||||
OK - \v(a*)+
|
||||
OK - \v((a*)+)+
|
||||
OK - \v((ab)*)+
|
||||
OK - \va{1,3}
|
||||
OK - \va{2,3}
|
||||
OK - \v((ab)+|c*)+
|
||||
OK - \v(a{2})|(b{3})
|
||||
OK - \va{2}|b{2}
|
||||
OK - \v(a)+|(c)+
|
||||
OK - \vab{2,3}c
|
||||
OK - \vab{2,3}c
|
||||
OK - \vab{2,3}cd{2,3}e
|
||||
OK - \va(bc){2}d
|
||||
OK - \va*a{2}
|
||||
OK - \va*a{2}
|
||||
OK - \va*a{2}
|
||||
OK - \va*a{2}
|
||||
OK - \va*b*|a*c*
|
||||
OK - \va{1}b{1}|a{1}b{1}
|
||||
OK - \v(a)
|
||||
OK - \v(a)(b)
|
||||
OK - \v(ab)(b)(c)
|
||||
OK - \v((a)(b))
|
||||
OK - \v(a)|(b)
|
||||
OK - \v(a*)+
|
||||
OK - x
|
||||
OK - ab
|
||||
OK - ab
|
||||
OK - ab
|
||||
OK - x*
|
||||
OK - x*
|
||||
OK - x*
|
||||
OK - x\+
|
||||
OK - x\+
|
||||
OK - x\+
|
||||
OK - x\+
|
||||
OK - x\=
|
||||
OK - x\=
|
||||
OK - x\=
|
||||
OK - x\?
|
||||
OK - x\?
|
||||
OK - x\?
|
||||
OK - a\{0,0}
|
||||
OK - a\{0,1}
|
||||
OK - a\{1,0}
|
||||
OK - a\{3,6}
|
||||
OK - a\{3,6}
|
||||
OK - a\{3,6}
|
||||
OK - a\{0}
|
||||
OK - a\{2}
|
||||
OK - a\{2}
|
||||
OK - a\{2}
|
||||
OK - a\{0,}
|
||||
OK - a\{0,}
|
||||
OK - a\{2,}
|
||||
OK - a\{2,}
|
||||
OK - a\{,0}
|
||||
OK - a\{,5}
|
||||
OK - a\{,5}
|
||||
OK - a\{}
|
||||
OK - a\{}
|
||||
OK - a\{-0,0}
|
||||
OK - a\{-0,1}
|
||||
OK - a\{-3,6}
|
||||
OK - a\{-3,6}
|
||||
OK - a\{-3,6}
|
||||
OK - a\{-0}
|
||||
OK - a\{-2}
|
||||
OK - a\{-2}
|
||||
OK - a\{-0,}
|
||||
OK - a\{-0,}
|
||||
OK - a\{-2,}
|
||||
OK - a\{-2,}
|
||||
OK - a\{-,0}
|
||||
OK - a\{-,5}
|
||||
OK - a\{-,5}
|
||||
OK - a\{-}
|
||||
OK - a\{-}
|
||||
OK - \(abc\)*
|
||||
OK - \(ab\)\+
|
||||
OK - \(abaaaaa\)*cd
|
||||
OK - \(test1\)\? \(test2\)\?
|
||||
OK - \(test1\)\= \(test2\) \(test4443\)\=
|
||||
OK - \(\(sub1\) hello \(sub 2\)\)
|
||||
OK - \(\(\(yyxxzz\)\)\)
|
||||
OK - \v((ab)+|c+)+
|
||||
OK - \v((ab)|c*)+
|
||||
OK - \v(a(c*)+b)+
|
||||
OK - \v(a|b*)+
|
||||
OK - a\{-2,7}
|
||||
OK - a\{2,7}
|
||||
OK - \vx(.{-,8})yz(.*)
|
||||
OK - \vx(.*)yz(.*)
|
||||
OK - \v(a{1,2}){-2,3}
|
||||
OK - \v(a{-1,3})+
|
||||
OK - \d\+e\d\d
|
||||
OK - \v[a]
|
||||
OK - a[bcd]
|
||||
OK - a[b-d]
|
||||
OK - [a-d][e-f][x-x]d
|
||||
OK - \v[[:alpha:]]+
|
||||
OK - [[:alpha:]\+]
|
||||
OK - [^abc]\+
|
||||
OK - [^abc]
|
||||
OK - [^abc]\+
|
||||
OK - [^a-d]\+
|
||||
OK - [a-f]*
|
||||
OK - [a-f]*
|
||||
OK - [^a-f]\+
|
||||
OK - [a-c]\{-3,6}
|
||||
OK - [^[:alpha:]]\+
|
||||
OK - [-a]
|
||||
OK - [a-]
|
||||
OK - [-./[:alnum:]_~]\+
|
||||
OK - [\]\^\-\\]\+
|
||||
OK - [[.a.]]\+
|
||||
OK - abc[0-9]*ddd
|
||||
OK - abc[0-9]*ddd
|
||||
OK - \_[0-9]\+
|
||||
OK - [0-9\n]\+
|
||||
OK - [0-9]
|
||||
OK - [^0-9]
|
||||
OK - [0-9a-fA-F]*
|
||||
OK - [^0-9A-Fa-f]\+
|
||||
OK - [a-z_A-Z0-9]\+
|
||||
OK - [a-z]
|
||||
OK - [a-zA-Z]
|
||||
OK - [A-Z]
|
||||
OK - \C[^A-Z]\+
|
||||
OK - xx \ze test
|
||||
OK - abc\zeend
|
||||
OK - abc\zsdd
|
||||
OK - aa \zsax
|
||||
OK - abc \zsmatch\ze abc
|
||||
OK - \v(a \zsif .*){2}
|
||||
OK - abc\@=
|
||||
OK - abc\@=cd
|
||||
OK - abc\@=
|
||||
OK - abcd\@=e
|
||||
OK - abcd\@=e
|
||||
OK - \v(abc)@=..
|
||||
OK - \(.*John\)\@=.*Bob
|
||||
OK - \(John.*\)\@=.*Bob
|
||||
OK - .*John\&.*Bob
|
||||
OK - .*John\&.*Bob
|
||||
OK - \v(test1)@=.*yep
|
||||
OK - [[:alpha:]]\{-2,6}
|
||||
OK -
|
||||
OK - \v(())
|
||||
OK - \v%(ab(xyz)c)
|
||||
OK - \v(test|)empty
|
||||
OK - \v(a|aa)(a|aa)
|
||||
OK - \%d32
|
||||
OK - \%o40
|
||||
OK - \%x20
|
||||
OK - \%u0020
|
||||
OK - \%U00000020
|
||||
192.168.0.1
|
||||
|
||||
@@ -380,20 +380,24 @@ def e(s, g=globals(), l=locals()):
|
||||
try:
|
||||
exec(s, g, l)
|
||||
except:
|
||||
vim.command('throw ' + repr(sys.exc_type.__name__))
|
||||
vim.command('return ' + repr(sys.exc_type.__name__))
|
||||
|
||||
def ev(s, g=globals(), l=locals()):
|
||||
try:
|
||||
return eval(s, g, l)
|
||||
except:
|
||||
vim.command('throw ' + repr(sys.exc_type.__name__))
|
||||
vim.command('let exc=' + repr(sys.exc_type.__name__))
|
||||
return 0
|
||||
EOF
|
||||
:function E(s)
|
||||
: python e(vim.eval('a:s'))
|
||||
:endfunction
|
||||
:function Ev(s)
|
||||
: return pyeval('ev(vim.eval("a:s"))')
|
||||
: let r=pyeval('ev(vim.eval("a:s"))')
|
||||
: if exists('exc')
|
||||
: throw exc
|
||||
: endif
|
||||
: return r
|
||||
:endfunction
|
||||
:py gopts1=vim.options
|
||||
:py wopts1=vim.windows[2].options
|
||||
@@ -437,27 +441,24 @@ EOF
|
||||
: catch
|
||||
: put =' p/'.v.'! '.v:exception
|
||||
: endtry
|
||||
: try
|
||||
: call E(v.'["'.oname.'"]=invval')
|
||||
: catch
|
||||
: put =' inv: '.string(invval).'! '.v:exception
|
||||
: endtry
|
||||
: let r=E(v.'['''.oname.''']=invval')
|
||||
: if r isnot 0
|
||||
: put =' inv: '.string(invval).'! '.r
|
||||
: endif
|
||||
: for vv in (v is# 'gopts1' ? [v] : [v, v[:-2].'2', v[:-2].'3'])
|
||||
: let val=substitute(vv, '^.opts', 'oval', '')
|
||||
: try
|
||||
: call E(vv.'["'.oname.'"]='.val)
|
||||
: catch
|
||||
: put =' '.vv.'! '.v:exception
|
||||
: endtry
|
||||
: let r=E(vv.'['''.oname.''']='.val)
|
||||
: if r isnot 0
|
||||
: put =' '.vv.'! '.r
|
||||
: endif
|
||||
: endfor
|
||||
: endfor
|
||||
: call RecVars(oname)
|
||||
: for v in ['wopts3', 'bopts3']
|
||||
: try
|
||||
: call E('del '.v.'["'.oname.'"]')
|
||||
: catch
|
||||
: put =' del '.v.'! '.v:exception
|
||||
: endtry
|
||||
: let r=E('del '.v.'["'.oname.'"]')
|
||||
: if r isnot 0
|
||||
: put =' del '.v.'! '.r
|
||||
: endif
|
||||
: endfor
|
||||
: call RecVars(oname)
|
||||
:endfor
|
||||
@@ -631,10 +632,45 @@ cb.append('Current buffer: ' + repr(vim.current.buffer))
|
||||
cb.append('Current line: ' + repr(vim.current.line))
|
||||
for b in vim.buffers:
|
||||
if b is not cb:
|
||||
vim.command('bwipeout! ' + b.number)
|
||||
vim.command('bwipeout! ' + str(b.number))
|
||||
EOF
|
||||
:tabonly!
|
||||
:only!
|
||||
:"
|
||||
:" Test types
|
||||
py << EOF
|
||||
for expr, attr in (
|
||||
('vim.vars', 'Dictionary'),
|
||||
('vim.options', 'Options'),
|
||||
('vim.bindeval("{}")', 'Dictionary'),
|
||||
('vim.bindeval("[]")', 'List'),
|
||||
('vim.bindeval("function(\'tr\')")', 'Function'),
|
||||
('vim.current.buffer', 'Buffer'),
|
||||
('vim.current.range', 'Range'),
|
||||
('vim.current.window', 'Window'),
|
||||
('vim.current.tabpage', 'TabPage'),
|
||||
):
|
||||
cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr)))
|
||||
EOF
|
||||
:"
|
||||
:" Test exceptions
|
||||
:fun Exe(e)
|
||||
: execute a:e
|
||||
:endfun
|
||||
py << EOF
|
||||
def ee(expr, g=globals(), l=locals()):
|
||||
try:
|
||||
exec(expr, g, l)
|
||||
except:
|
||||
cb.append(repr(sys.exc_info()[:2]))
|
||||
Exe = vim.bindeval('function("Exe")')
|
||||
ee('vim.command("throw \'abc\'")')
|
||||
ee('Exe("throw \'def\'")')
|
||||
ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")')
|
||||
ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")')
|
||||
ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")')
|
||||
ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")')
|
||||
EOF
|
||||
:endfun
|
||||
:"
|
||||
:call Test()
|
||||
|
||||
@@ -333,7 +333,7 @@ Number of tabs: 4
|
||||
Current tab pages:
|
||||
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
|
||||
Windows:
|
||||
<window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (954, 0)
|
||||
<window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (990, 0)
|
||||
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
|
||||
Windows:
|
||||
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
|
||||
@@ -359,3 +359,18 @@ Current tab page: <tabpage 2>
|
||||
Current window: <window 0>
|
||||
Current buffer: <buffer test86.in>
|
||||
Current line: 'Type error at assigning None to vim.current.buffer'
|
||||
vim.vars:Dictionary:True
|
||||
vim.options:Options:True
|
||||
vim.bindeval("{}"):Dictionary:True
|
||||
vim.bindeval("[]"):List:True
|
||||
vim.bindeval("function('tr')"):Function:True
|
||||
vim.current.buffer:Buffer:True
|
||||
vim.current.range:Range:True
|
||||
vim.current.window:Window:True
|
||||
vim.current.tabpage:TabPage:True
|
||||
(<class 'vim.error'>, error('abc',))
|
||||
(<class 'vim.error'>, error('def',))
|
||||
(<class 'vim.error'>, error('ghi',))
|
||||
(<class 'vim.error'>, error('Vim(echoerr):jkl',))
|
||||
(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',))
|
||||
(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',))
|
||||
|
||||
@@ -367,20 +367,24 @@ def e(s, g=globals(), l=locals()):
|
||||
try:
|
||||
exec(s, g, l)
|
||||
except Exception as e:
|
||||
vim.command('throw ' + repr(e.__class__.__name__))
|
||||
vim.command('return ' + repr(e.__class__.__name__))
|
||||
|
||||
def ev(s, g=globals(), l=locals()):
|
||||
try:
|
||||
return eval(s, g, l)
|
||||
except Exception as e:
|
||||
vim.command('throw ' + repr(e.__class__.__name__))
|
||||
vim.command('let exc=' + repr(e.__class__.__name__))
|
||||
return 0
|
||||
EOF
|
||||
:function E(s)
|
||||
: python3 e(vim.eval('a:s'))
|
||||
:endfunction
|
||||
:function Ev(s)
|
||||
: return py3eval('ev(vim.eval("a:s"))')
|
||||
: let r=py3eval('ev(vim.eval("a:s"))')
|
||||
: if exists('exc')
|
||||
: throw exc
|
||||
: endif
|
||||
: return r
|
||||
:endfunction
|
||||
:py3 gopts1=vim.options
|
||||
:py3 wopts1=vim.windows[2].options
|
||||
@@ -424,27 +428,24 @@ EOF
|
||||
: catch
|
||||
: put =' p/'.v.'! '.v:exception
|
||||
: endtry
|
||||
: try
|
||||
: call E(v.'["'.oname.'"]=invval')
|
||||
: catch
|
||||
: put =' inv: '.string(invval).'! '.v:exception
|
||||
: endtry
|
||||
: let r=E(v.'['''.oname.''']=invval')
|
||||
: if r isnot 0
|
||||
: put =' inv: '.string(invval).'! '.r
|
||||
: endif
|
||||
: for vv in (v is# 'gopts1' ? [v] : [v, v[:-2].'2', v[:-2].'3'])
|
||||
: let val=substitute(vv, '^.opts', 'oval', '')
|
||||
: try
|
||||
: call E(vv.'["'.oname.'"]='.val)
|
||||
: catch
|
||||
: put =' '.vv.'! '.v:exception
|
||||
: endtry
|
||||
: let r=E(vv.'['''.oname.''']='.val)
|
||||
: if r isnot 0
|
||||
: put =' '.vv.'! '.r
|
||||
: endif
|
||||
: endfor
|
||||
: endfor
|
||||
: call RecVars(oname)
|
||||
: for v in ['wopts3', 'bopts3']
|
||||
: try
|
||||
: call E('del '.v.'["'.oname.'"]')
|
||||
: catch
|
||||
: put =' del '.v.'! '.v:exception
|
||||
: endtry
|
||||
: let r=E('del '.v.'["'.oname.'"]')
|
||||
: if r isnot 0
|
||||
: put =' del '.v.'! '.r
|
||||
: endif
|
||||
: endfor
|
||||
: call RecVars(oname)
|
||||
:endfor
|
||||
@@ -622,6 +623,41 @@ for b in vim.buffers:
|
||||
EOF
|
||||
:tabonly!
|
||||
:only!
|
||||
:"
|
||||
:" Test types
|
||||
py3 << EOF
|
||||
for expr, attr in (
|
||||
('vim.vars', 'Dictionary'),
|
||||
('vim.options', 'Options'),
|
||||
('vim.bindeval("{}")', 'Dictionary'),
|
||||
('vim.bindeval("[]")', 'List'),
|
||||
('vim.bindeval("function(\'tr\')")', 'Function'),
|
||||
('vim.current.buffer', 'Buffer'),
|
||||
('vim.current.range', 'Range'),
|
||||
('vim.current.window', 'Window'),
|
||||
('vim.current.tabpage', 'TabPage'),
|
||||
):
|
||||
cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr)))
|
||||
EOF
|
||||
:"
|
||||
:" Test exceptions
|
||||
:fun Exe(e)
|
||||
: execute a:e
|
||||
:endfun
|
||||
py3 << EOF
|
||||
def ee(expr, g=globals(), l=locals()):
|
||||
try:
|
||||
exec(expr, g, l)
|
||||
except Exception as e:
|
||||
cb.append(repr((e.__class__, e)))
|
||||
Exe = vim.bindeval('function("Exe")')
|
||||
ee('vim.command("throw \'abc\'")')
|
||||
ee('Exe("throw \'def\'")')
|
||||
ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")')
|
||||
ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")')
|
||||
ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")')
|
||||
ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")')
|
||||
EOF
|
||||
:endfun
|
||||
:"
|
||||
:call Test()
|
||||
|
||||
@@ -59,10 +59,10 @@ ll:[1]
|
||||
['c', 1]
|
||||
['d', ['e']]
|
||||
0.0
|
||||
"\0": Vim(let):E861:
|
||||
{"\0": 1}: Vim(let):E861:
|
||||
"\0": Vim(let):E859:
|
||||
{"\0": 1}: Vim(let):E859:
|
||||
undefined_name: Vim(let):Trace
|
||||
vim: Vim(let):E861:
|
||||
vim: Vim(let):E859:
|
||||
[1]
|
||||
[1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1]
|
||||
Abc
|
||||
@@ -322,7 +322,7 @@ Number of tabs: 4
|
||||
Current tab pages:
|
||||
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
|
||||
Windows:
|
||||
<window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (930, 0)
|
||||
<window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (966, 0)
|
||||
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
|
||||
Windows:
|
||||
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
|
||||
@@ -348,3 +348,18 @@ Current tab page: <tabpage 2>
|
||||
Current window: <window 0>
|
||||
Current buffer: <buffer test87.in>
|
||||
Current line: 'Type error at assigning None to vim.current.buffer'
|
||||
vim.vars:Dictionary:True
|
||||
vim.options:Options:True
|
||||
vim.bindeval("{}"):Dictionary:True
|
||||
vim.bindeval("[]"):List:True
|
||||
vim.bindeval("function('tr')"):Function:True
|
||||
vim.current.buffer:Buffer:True
|
||||
vim.current.range:Range:True
|
||||
vim.current.window:Window:True
|
||||
vim.current.tabpage:TabPage:True
|
||||
(<class 'vim.error'>, error('abc',))
|
||||
(<class 'vim.error'>, error('def',))
|
||||
(<class 'vim.error'>, error('ghi',))
|
||||
(<class 'vim.error'>, error('Vim(echoerr):jkl',))
|
||||
(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',))
|
||||
(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',))
|
||||
|
||||
76
src/testdir/test95.in
Normal file
76
src/testdir/test95.in
Normal file
@@ -0,0 +1,76 @@
|
||||
Test for regexp patterns with multi-byte support, using utf-8.
|
||||
See test64 for the non-multi-byte tests.
|
||||
|
||||
A pattern that gives the expected result produces OK, so that we know it was
|
||||
actually tried.
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:so mbyte.vim
|
||||
:set nocp encoding=utf-8 viminfo+=nviminfo
|
||||
:" tl is a List of Lists with:
|
||||
:" regexp pattern
|
||||
:" text to test the pattern on
|
||||
:" expected match (optional)
|
||||
:" expected submatch 1 (optional)
|
||||
:" expected submatch 2 (optional)
|
||||
:" etc.
|
||||
:" When there is no match use only the first two items.
|
||||
:let tl = []
|
||||
|
||||
:"""" Multi-byte character tests. These will fail unless vim is compiled
|
||||
:"""" with Multibyte (FEAT_MBYTE) or BIG/HUGE features.
|
||||
:call add(tl, ['[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna'])
|
||||
:call add(tl, ['[[=a=]]\+', 'ddaãâbcd', 'aãâ']) " equivalence classes
|
||||
:call add(tl, ['[^ม ]\+', 'มม oijasoifjos ifjoisj f osij j มมมมม abcd', 'oijasoifjos'])
|
||||
:call add(tl, [' [^ ]\+', 'start มabcdม ', ' มabcdม'])
|
||||
:call add(tl, ['[ม[:alpha:][=a=]]\+', '879 aiaãมâมaiuvna ', 'aiaãมâมaiuvna'])
|
||||
|
||||
:" this is not a normal "i" but 0xec
|
||||
:call add(tl, ['\p\+', 'ìa', 'ìa'])
|
||||
|
||||
:"""" Test recognition of some character classes
|
||||
:call add(tl, ['\i\+', '&*§xx ', 'xx'])
|
||||
:call add(tl, ['\%#=1\i\+', '&*§xx ', 'xx'])
|
||||
:call add(tl, ['\f\+', '&*fname ', 'fname'])
|
||||
:call add(tl, ['\%#=1\i\+', '&*fname ', 'fname'])
|
||||
|
||||
:"""" Combining different tests and features
|
||||
:call add(tl, ['[^[=a=]]\+', 'ddaãâbcd', 'dd'])
|
||||
|
||||
:"""" Run the tests
|
||||
|
||||
:"
|
||||
:for t in tl
|
||||
: let l = matchlist(t[1], t[0])
|
||||
:" check the match itself
|
||||
: if len(l) == 0 && len(t) > 2
|
||||
: $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", did not match, expected: \"' . t[2] . '\"'
|
||||
: elseif len(l) > 0 && len(t) == 2
|
||||
: $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", match: \"' . l[0] . '\", expected no match'
|
||||
: elseif len(t) > 2 && l[0] != t[2]
|
||||
: $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", match: \"' . l[0] . '\", expected: \"' . t[2] . '\"'
|
||||
: else
|
||||
: $put ='OK - ' . t[0]
|
||||
: endif
|
||||
: if len(l) > 0
|
||||
:" check all the nine submatches
|
||||
: for i in range(1, 9)
|
||||
: if len(t) <= i + 2
|
||||
: let e = ''
|
||||
: else
|
||||
: let e = t[i + 2]
|
||||
: endif
|
||||
: if l[i] != e
|
||||
: $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"'
|
||||
: endif
|
||||
: endfor
|
||||
: unlet i
|
||||
: endif
|
||||
:endfor
|
||||
:unlet t tl e l
|
||||
|
||||
:/\%#=1^Results/,$wq! test.out
|
||||
ENDTEST
|
||||
|
||||
Results of test95:
|
||||
12
src/testdir/test95.ok
Normal file
12
src/testdir/test95.ok
Normal file
@@ -0,0 +1,12 @@
|
||||
Results of test95:
|
||||
OK - [[:alpha:][=a=]]\+
|
||||
OK - [[=a=]]\+
|
||||
OK - [^ม ]\+
|
||||
OK - [^ ]\+
|
||||
OK - [ม[:alpha:][=a=]]\+
|
||||
OK - \p\+
|
||||
OK - \i\+
|
||||
OK - \%#=1\i\+
|
||||
OK - \f\+
|
||||
OK - \%#=1\i\+
|
||||
OK - [^[=a=]]\+
|
||||
@@ -728,6 +728,74 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1002,
|
||||
/**/
|
||||
1001,
|
||||
/**/
|
||||
1000,
|
||||
/**/
|
||||
999,
|
||||
/**/
|
||||
998,
|
||||
/**/
|
||||
997,
|
||||
/**/
|
||||
996,
|
||||
/**/
|
||||
995,
|
||||
/**/
|
||||
994,
|
||||
/**/
|
||||
993,
|
||||
/**/
|
||||
992,
|
||||
/**/
|
||||
991,
|
||||
/**/
|
||||
990,
|
||||
/**/
|
||||
989,
|
||||
/**/
|
||||
988,
|
||||
/**/
|
||||
987,
|
||||
/**/
|
||||
986,
|
||||
/**/
|
||||
985,
|
||||
/**/
|
||||
984,
|
||||
/**/
|
||||
983,
|
||||
/**/
|
||||
982,
|
||||
/**/
|
||||
981,
|
||||
/**/
|
||||
980,
|
||||
/**/
|
||||
979,
|
||||
/**/
|
||||
978,
|
||||
/**/
|
||||
977,
|
||||
/**/
|
||||
976,
|
||||
/**/
|
||||
975,
|
||||
/**/
|
||||
974,
|
||||
/**/
|
||||
973,
|
||||
/**/
|
||||
972,
|
||||
/**/
|
||||
971,
|
||||
/**/
|
||||
970,
|
||||
/**/
|
||||
969,
|
||||
/**/
|
||||
968,
|
||||
/**/
|
||||
|
||||
@@ -4058,7 +4058,8 @@ win_find_nr(winnr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(FEAT_WINDOWS) && defined(FEAT_PYTHON)) || defined(PROTO)
|
||||
#if (defined(FEAT_WINDOWS) && (defined(FEAT_PYTHON) || defined(FEAT_PYTHON3))) \
|
||||
|| defined(PROTO)
|
||||
/*
|
||||
* Find the tabpage for window "win".
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user