Updated some vimscripts
git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@143 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
parent
bbfb723a98
commit
15fe42916b
1
vimfiles.stefan/tools/DirDiff.bat
Normal file
1
vimfiles.stefan/tools/DirDiff.bat
Normal file
@ -0,0 +1 @@
|
|||||||
|
c:\tools\vim\vim71\gvim.exe -c "DirDiff %1 %2"
|
@ -1,8 +1,8 @@
|
|||||||
ScriptID SourceID Filename
|
ScriptID SourceID Filename
|
||||||
--------------------------
|
--------------------------
|
||||||
642 6945 GetLatestVimScripts.vim
|
642 7080 GetLatestVimScripts.vim
|
||||||
1075 6895 netrw.vim
|
1075 7079 netrw.vim
|
||||||
1502 6578 vimball.vim
|
1502 7078 vimball.vim
|
||||||
1008 3118 srec.vim (ftplugin)
|
1008 3118 srec.vim (ftplugin)
|
||||||
1009 3119 srec.vim (syntax file)
|
1009 3119 srec.vim (syntax file)
|
||||||
475 2535 latex-suite (install in vimfiles.latex)
|
475 2535 latex-suite (install in vimfiles.latex)
|
||||||
@ -12,10 +12,12 @@ ScriptID SourceID Filename
|
|||||||
51 171 cscope_macros.vim
|
51 171 cscope_macros.vim
|
||||||
102 5306 DirDiff.vim
|
102 5306 DirDiff.vim
|
||||||
1189 6533 matrix.vim
|
1189 6533 matrix.vim
|
||||||
1173 5475 tcomment
|
1173 7046 tcomment
|
||||||
948 2878 Scons Compiler plugin
|
948 2878 Scons Compiler plugin
|
||||||
1709 6421 Scons Syntax file
|
1709 6421 Scons Syntax file
|
||||||
1772 6973 DAMOS.zip DAMOS tools (von Stefan)
|
1772 7248 DAMOS.zip DAMOS tools (von Stefan)
|
||||||
987 6978 DoxygenToolkit.vim
|
987 6978 DoxygenToolkit.vim
|
||||||
1397 6887 xml.vim
|
1397 6887 xml.vim
|
||||||
1290 5190 LogiPat
|
1290 5190 LogiPat
|
||||||
|
1881 7244 svndiff
|
||||||
|
1462 5612 dtd2xml
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" getscript.vim
|
" getscript.vim
|
||||||
" Author: Charles E. Campbell, Jr.
|
" Author: Charles E. Campbell, Jr.
|
||||||
" Date: Nov 27, 2006
|
" Date: May 05, 2007
|
||||||
" Version: 23
|
" Version: 25
|
||||||
" Installing: :help glvs-install
|
" Installing: :help glvs-install
|
||||||
" Usage: :help glvs
|
" Usage: :help glvs
|
||||||
"
|
"
|
||||||
@ -15,14 +15,14 @@ if &cp
|
|||||||
echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
|
echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let s:keepfo = &fo
|
|
||||||
let s:keepcpo = &cpo
|
let s:keepcpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
"DechoTabOn
|
||||||
|
|
||||||
if exists("g:loaded_getscript")
|
if exists("g:loaded_getscript")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_getscript= "v23"
|
let g:loaded_getscript= "v25"
|
||||||
|
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" Global Variables: {{{1
|
" Global Variables: {{{1
|
||||||
@ -278,19 +278,25 @@ fun! s:GetOneScript(...)
|
|||||||
" call Decho("attempting to do autoinstall: getcwd<".getcwd()."> filereadable(".fname.")=".filereadable(fname))
|
" call Decho("attempting to do autoinstall: getcwd<".getcwd()."> filereadable(".fname.")=".filereadable(fname))
|
||||||
if filereadable(fname)
|
if filereadable(fname)
|
||||||
" call Decho("move <".fname."> to ".s:autoinstall)
|
" call Decho("move <".fname."> to ".s:autoinstall)
|
||||||
" call Decho("DISABLED for testing")
|
|
||||||
exe "silent !".g:GetLatestVimScripts_mv." ".fname." ".s:autoinstall
|
exe "silent !".g:GetLatestVimScripts_mv." ".fname." ".s:autoinstall
|
||||||
let curdir= escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #")
|
let curdir= escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #")
|
||||||
|
" call Decho("exe cd ".s:autoinstall)
|
||||||
exe "cd ".s:autoinstall
|
exe "cd ".s:autoinstall
|
||||||
|
|
||||||
|
" decompress
|
||||||
if fname =~ '\.bz2$'
|
if fname =~ '\.bz2$'
|
||||||
" call Decho("attempt to bunzip2 ".fname)
|
" call Decho("attempt to bunzip2 ".fname)
|
||||||
exe "silent !bunzip2 ".fname
|
exe "silent !bunzip2 ".fname
|
||||||
let fname= substitute(fname,'\.bz2$','','')
|
let fname= substitute(fname,'\.bz2$','','')
|
||||||
|
" call Decho("new fname<".fname."> after bunzip2")
|
||||||
elseif fname =~ '\.gz$'
|
elseif fname =~ '\.gz$'
|
||||||
" call Decho("attempt to gunzip ".fname)
|
" call Decho("attempt to gunzip ".fname)
|
||||||
exe "silent !gunzip ".fname
|
exe "silent !gunzip ".fname
|
||||||
let fname= substitute(fname,'\.gz$','','')
|
let fname= substitute(fname,'\.gz$','','')
|
||||||
|
" call Decho("new fname<".fname."> after gunzip")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" distribute archive(.zip, .tar, .vba) contents
|
||||||
if fname =~ '\.zip$'
|
if fname =~ '\.zip$'
|
||||||
" call Decho("attempt to unzip ".fname)
|
" call Decho("attempt to unzip ".fname)
|
||||||
exe "silent !unzip -o ".fname
|
exe "silent !unzip -o ".fname
|
||||||
@ -304,10 +310,13 @@ fun! s:GetOneScript(...)
|
|||||||
so %
|
so %
|
||||||
q
|
q
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if fname =~ '.vim$'
|
if fname =~ '.vim$'
|
||||||
" call Decho("attempt to simply move ".fname." to plugin")
|
" call Decho("attempt to simply move ".fname." to plugin")
|
||||||
exe "silent !".g:GetLatestVimScripts_mv." ".fname." plugin"
|
exe "silent !".g:GetLatestVimScripts_mv." ".fname." plugin"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" helptags step
|
||||||
let docdir= substitute(&rtp,',.*','','e')."/doc"
|
let docdir= substitute(&rtp,',.*','','e')."/doc"
|
||||||
" call Decho("helptags docdir<".docdir.">")
|
" call Decho("helptags docdir<".docdir.">")
|
||||||
exe "helptags ".docdir
|
exe "helptags ".docdir
|
||||||
@ -318,7 +327,7 @@ fun! s:GetOneScript(...)
|
|||||||
" update the data in the <GetLatestVimScripts.dat> file
|
" update the data in the <GetLatestVimScripts.dat> file
|
||||||
let modline=scriptid." ".latestsrcid." ".fname.cmmnt
|
let modline=scriptid." ".latestsrcid." ".fname.cmmnt
|
||||||
call setline(line("."),modline)
|
call setline(line("."),modline)
|
||||||
" call Decho("modline<".modline."> (updated GetLatestVimScripts.dat file)")
|
" call Decho("update data in ".expand("%")."#".line(".").": modline<".modline.">")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" restore options
|
" restore options
|
||||||
@ -355,6 +364,7 @@ fun! getscript#GetLatestVimScripts()
|
|||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" Sanity checks: readability and writability
|
" Sanity checks: readability and writability
|
||||||
if datadir == ""
|
if datadir == ""
|
||||||
echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install'
|
echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install'
|
||||||
@ -399,27 +409,44 @@ fun! getscript#GetLatestVimScripts()
|
|||||||
" call Decho(" ")
|
" call Decho(" ")
|
||||||
" call Decho("searching plugins for GetLatestVimScripts dependencies")
|
" call Decho("searching plugins for GetLatestVimScripts dependencies")
|
||||||
let lastline = line("$")
|
let lastline = line("$")
|
||||||
let plugins = globpath(&rtp,"plugin/*.vim")
|
" call Decho("lastline#".lastline)
|
||||||
|
let plugins = split(globpath(&rtp,"plugin/*.vim"))
|
||||||
let foundscript = 0
|
let foundscript = 0
|
||||||
|
let firstdir= ""
|
||||||
|
|
||||||
" call Decho("plugins<".plugins."> lastline#".lastline)
|
for plugin in plugins
|
||||||
while plugins != ""
|
|
||||||
let plugin = substitute(plugins,'\n.*$','','e')
|
" don't process plugins in system directories
|
||||||
let plugins= (plugins =~ '\n')? substitute(plugins,'^.\{-}\n\(.*\)$','\1','e') : ""
|
if firstdir == ""
|
||||||
|
let firstdir= substitute(plugin,'[/\\][^/\\]\+$','','')
|
||||||
|
" call Decho("firstdir<".firstdir.">")
|
||||||
|
else
|
||||||
|
let curdir= substitute(plugin,'[/\\][^/\\]\+$','','')
|
||||||
|
" call Decho("curdir<".curdir.">")
|
||||||
|
if curdir != firstdir
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" read plugin in
|
||||||
$
|
$
|
||||||
|
" call Decho(" ")
|
||||||
" call Decho(".dependency checking<".plugin."> line$=".line("$"))
|
" call Decho(".dependency checking<".plugin."> line$=".line("$"))
|
||||||
exe "silent r ".plugin
|
exe "silent r ".plugin
|
||||||
|
|
||||||
while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0
|
while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0
|
||||||
let newscript= substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e')
|
let newscript= substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e')
|
||||||
let llp1 = lastline+1
|
let llp1 = lastline+1
|
||||||
|
" call Decho("..newscript<".newscript.">")
|
||||||
|
|
||||||
|
" don't process ""GetLatestVimScripts lines
|
||||||
if newscript !~ '^"'
|
if newscript !~ '^"'
|
||||||
" found a "GetLatestVimScripts: # #" line in the script; check if its already in the datafile
|
" found a "GetLatestVimScripts: # #" line in the script; check if its already in the datafile
|
||||||
let curline = line(".")
|
let curline = line(".")
|
||||||
let noai_script = substitute(newscript,'\s*:AutoInstall:\s*','','e')
|
let noai_script = substitute(newscript,'\s*:AutoInstall:\s*','','e')
|
||||||
exe llp1
|
exe llp1
|
||||||
let srchline = search('\<'.noai_script.'\>','bW')
|
let srchline = search('\<'.noai_script.'\>','bW')
|
||||||
" call Decho("..newscript<".newscript."> noai_script<".noai_script."> srch=".srchline." lastline=".lastline)
|
" call Decho("..noai_script<".noai_script."> srch=".srchline."curline#".line(".")." lastline#".lastline)
|
||||||
|
|
||||||
if srchline == 0
|
if srchline == 0
|
||||||
" found a new script to permanently include in the datafile
|
" found a new script to permanently include in the datafile
|
||||||
@ -439,23 +466,27 @@ fun! getscript#GetLatestVimScripts()
|
|||||||
let curline = curline + 1
|
let curline = curline + 1
|
||||||
exe curline
|
exe curline
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
let llp1= lastline + 1
|
let llp1= lastline + 1
|
||||||
" call Decho(".deleting lines: ".llp1.",$d")
|
" call Decho(".deleting lines: ".llp1.",$d")
|
||||||
exe "silent! ".llp1.",$d"
|
exe "silent! ".llp1.",$d"
|
||||||
endwhile
|
endfor
|
||||||
|
" call Decho("--- end dependency checking loop --- foundscript=".foundscript)
|
||||||
|
" call Decho(" ")
|
||||||
|
|
||||||
if foundscript == 0
|
if foundscript == 0
|
||||||
set nomod
|
set nomod
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat
|
" Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat
|
||||||
|
" call Decho("begin: checking out-of-date scripts using datafile<".datafile.">")
|
||||||
set lz
|
set lz
|
||||||
" call Decho(" --- end of dependency checking loop --- ")
|
|
||||||
" call Decho("call GetOneScript on lines at end of datafile<".datafile.">")
|
|
||||||
1
|
1
|
||||||
/^-----/,$g/^\s*\d/call <SID>GetOneScript()
|
" /^-----/,$g/^\s*\d/call Decho(getline("."))
|
||||||
|
1
|
||||||
|
/^-----/,$g/^\s*\d/call s:GetOneScript()
|
||||||
|
" call Decho("--- end out-of-date checking --- ")
|
||||||
|
|
||||||
" Final report (an echomsg)
|
" Final report (an echomsg)
|
||||||
try
|
try
|
||||||
@ -495,7 +526,6 @@ endfun
|
|||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
|
|
||||||
" Restore Options: {{{1
|
" Restore Options: {{{1
|
||||||
let &fo = s:keepfo
|
|
||||||
let &cpo= s:keepcpo
|
let &cpo= s:keepcpo
|
||||||
|
|
||||||
" vim: ts=8 sts=2 fdm=marker nowrap
|
" vim: ts=8 sts=2 fdm=marker nowrap
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" netrw.vim: Handles file transfer and remote directory listing across
|
" netrw.vim: Handles file transfer and remote directory listing across
|
||||||
" AUTOLOAD SECTION
|
" AUTOLOAD SECTION
|
||||||
" Date: Mar 21, 2007
|
" Date: May 05, 2007
|
||||||
" Version: 108
|
" Version: 109
|
||||||
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
|
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
|
||||||
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
|
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
|
||||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
||||||
@ -30,7 +30,7 @@ if !exists("s:NOTE")
|
|||||||
let s:WARNING = 1
|
let s:WARNING = 1
|
||||||
let s:ERROR = 2
|
let s:ERROR = 2
|
||||||
endif
|
endif
|
||||||
let g:loaded_netrw = "v108"
|
let g:loaded_netrw = "v109"
|
||||||
if v:version < 700
|
if v:version < 700
|
||||||
call netrw#ErrorMsg(s:WARNING,"you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw",1)
|
call netrw#ErrorMsg(s:WARNING,"you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw",1)
|
||||||
finish
|
finish
|
||||||
@ -224,6 +224,12 @@ endif
|
|||||||
if !exists("g:netrw_mkdir_cmd")
|
if !exists("g:netrw_mkdir_cmd")
|
||||||
let g:netrw_mkdir_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir"
|
let g:netrw_mkdir_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir"
|
||||||
endif
|
endif
|
||||||
|
if !exists("g:netrw_scpport")
|
||||||
|
let g:netrw_scpport= "-P"
|
||||||
|
endif
|
||||||
|
if !exists("g:netrw_sshport")
|
||||||
|
let g:netrw_sshport= "-p"
|
||||||
|
endif
|
||||||
if !exists("g:netrw_rename_cmd")
|
if !exists("g:netrw_rename_cmd")
|
||||||
let g:netrw_rename_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mv"
|
let g:netrw_rename_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mv"
|
||||||
endif
|
endif
|
||||||
@ -287,6 +293,9 @@ endif
|
|||||||
if !exists("g:NetrwTopLvlMenu")
|
if !exists("g:NetrwTopLvlMenu")
|
||||||
let g:NetrwTopLvlMenu= "Netrw."
|
let g:NetrwTopLvlMenu= "Netrw."
|
||||||
endif
|
endif
|
||||||
|
if !exists("g:netrw_use_errorwindow")
|
||||||
|
let g:netrw_use_errorwindow= 1
|
||||||
|
endif
|
||||||
if !exists("g:netrw_win95ftp")
|
if !exists("g:netrw_win95ftp")
|
||||||
let g:netrw_win95ftp= 1
|
let g:netrw_win95ftp= 1
|
||||||
endif
|
endif
|
||||||
@ -373,8 +382,9 @@ endfun
|
|||||||
|
|
||||||
" ===============================
|
" ===============================
|
||||||
" NetOptionSave: save options and set to "standard" form {{{2
|
" NetOptionSave: save options and set to "standard" form {{{2
|
||||||
|
"DechoTabOn
|
||||||
fun! s:NetOptionSave()
|
fun! s:NetOptionSave()
|
||||||
" call Dfunc("s:NetOptionSave()")
|
" call Dfunc("s:NetOptionSave() win#".winnr()." buf#".bufnr("."))
|
||||||
if !exists("w:netrw_optionsave")
|
if !exists("w:netrw_optionsave")
|
||||||
let w:netrw_optionsave= 1
|
let w:netrw_optionsave= 1
|
||||||
else
|
else
|
||||||
@ -413,12 +423,13 @@ fun! s:NetOptionSave()
|
|||||||
silent! let w:netrw_regslash= @/
|
silent! let w:netrw_regslash= @/
|
||||||
|
|
||||||
" call Dret("s:NetOptionSave")
|
" call Dret("s:NetOptionSave")
|
||||||
|
" call Dret("s:NetOptionSave : win#".winnr()." buf#".bufnr("."))
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
" NetOptionRestore: restore options {{{2
|
" NetOptionRestore: restore options {{{2
|
||||||
fun! s:NetOptionRestore()
|
fun! s:NetOptionRestore()
|
||||||
" call Dfunc("s:NetOptionRestore()")
|
" call Dfunc("s:NetOptionRestore() win#".winnr()." buf#".bufnr("."))
|
||||||
if !exists("w:netrw_optionsave")
|
if !exists("w:netrw_optionsave")
|
||||||
" call Dret("s:NetOptionRestore : w:netrw_optionsave doesn't exist")
|
" call Dret("s:NetOptionRestore : w:netrw_optionsave doesn't exist")
|
||||||
return
|
return
|
||||||
@ -463,7 +474,7 @@ fun! s:NetOptionRestore()
|
|||||||
if exists("w:netrw_regstar") |silent! let @*= w:netrw_regstar |unlet w:netrw_regstar |endif
|
if exists("w:netrw_regstar") |silent! let @*= w:netrw_regstar |unlet w:netrw_regstar |endif
|
||||||
if exists("w:netrw_regslash")|silent! let @/= w:netrw_regslash|unlet w:netrw_regslash|endif
|
if exists("w:netrw_regslash")|silent! let @/= w:netrw_regslash|unlet w:netrw_regslash|endif
|
||||||
|
|
||||||
" call Dret("s:NetOptionRestore : restored user options")
|
" call Dret("s:NetOptionRestore : win#".winnr()." buf#".bufnr("."))
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
@ -727,7 +738,7 @@ fun! netrw#NetRead(mode,...)
|
|||||||
elseif b:netrw_method == 4 " read with scp
|
elseif b:netrw_method == 4 " read with scp
|
||||||
" call Decho("read via scp (method #4)")
|
" call Decho("read via scp (method #4)")
|
||||||
if exists("g:netrw_port") && g:netrw_port != ""
|
if exists("g:netrw_port") && g:netrw_port != ""
|
||||||
let useport= " -P ".g:netrw_port
|
let useport= " ".g:netrw_scpport." ".g:netrw_port
|
||||||
else
|
else
|
||||||
let useport= ""
|
let useport= ""
|
||||||
endif
|
endif
|
||||||
@ -1088,7 +1099,7 @@ fun! netrw#NetWrite(...) range
|
|||||||
" call Decho("write via scp (method #4)")
|
" call Decho("write via scp (method #4)")
|
||||||
let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
|
let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
|
||||||
if exists("g:netrw_port") && g:netrw_port != ""
|
if exists("g:netrw_port") && g:netrw_port != ""
|
||||||
let useport= " -P ".g:netrw_port
|
let useport= " ".g:netrw_scpport." ".g:netrw_port
|
||||||
else
|
else
|
||||||
let useport= ""
|
let useport= ""
|
||||||
endif
|
endif
|
||||||
@ -1661,7 +1672,7 @@ endfun
|
|||||||
" with the requested remote hostname first.
|
" with the requested remote hostname first.
|
||||||
fun! s:NetBrowse(islocal,dirname)
|
fun! s:NetBrowse(islocal,dirname)
|
||||||
if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif
|
if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif
|
||||||
" call Dfunc("NetBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%"))
|
" call Dfunc("NetBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%").">")
|
||||||
" call Dredir("ls!")
|
" call Dredir("ls!")
|
||||||
|
|
||||||
if exists("s:netrw_skipbrowse")
|
if exists("s:netrw_skipbrowse")
|
||||||
@ -1756,7 +1767,7 @@ fun! s:NetBrowse(islocal,dirname)
|
|||||||
|
|
||||||
" handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3
|
" handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3
|
||||||
if !g:netrw_keepdir
|
if !g:netrw_keepdir
|
||||||
" call Decho("handle keepdir:")
|
" call Decho("handle keepdir: (g:netrw_keepdir=".g:netrw_keepdir.")")
|
||||||
" call Decho('exe cd '.escape(b:netrw_curdir,s:netrw_cd_escape))
|
" call Decho('exe cd '.escape(b:netrw_curdir,s:netrw_cd_escape))
|
||||||
try
|
try
|
||||||
exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape)
|
exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape)
|
||||||
@ -1839,17 +1850,18 @@ fun! s:NetGetBuffer(islocal,dirname)
|
|||||||
|
|
||||||
else
|
else
|
||||||
" find buffer number of buffer named precisely the same as dirname {{{3
|
" find buffer number of buffer named precisely the same as dirname {{{3
|
||||||
|
" call Dredir("ls!")
|
||||||
let dirname= a:dirname
|
let dirname= a:dirname
|
||||||
" call Decho("find buffer<".dirname.">'s number ")
|
" call Decho("find buffer<".dirname.">'s number ")
|
||||||
let bufnum= bufnr(escape(dirname,'\'))
|
let bufnum= bufnr(escape(dirname,'\'))
|
||||||
" call Decho("findbuf: bufnum=bufnr('".escape(dirname,'\')."')=".bufnum." (initial)")
|
" call Decho("findbuf1: bufnum=bufnr('".escape(dirname,'\')."')=".bufnum." (initial)")
|
||||||
let ibuf= 1
|
let ibuf= 1
|
||||||
if bufnum > 0 && bufname(bufnum) != dirname
|
if bufnum > 0 && bufname(bufnum) != dirname
|
||||||
let buflast = bufnr("$")
|
let buflast = bufnr("$")
|
||||||
" call Decho("findbuf: buflast=".buflast)
|
" call Decho("findbuf2: buflast=".buflast)
|
||||||
while ibuf <= buflast
|
while ibuf <= buflast
|
||||||
let bname= bufname(ibuf)
|
let bname= bufname(ibuf)
|
||||||
" call Decho("findbuf: ibuf=".ibuf. " bufname<".bufname(ibuf)."> dirname<".dirname.">")
|
" call Decho("findbuf3: dirname<".dirname."> bufname(".ibuf.")<".bname.">")
|
||||||
if bname != '' && bname !~ '/' && dirname =~ '/'.bname.'$' | break | endif
|
if bname != '' && bname !~ '/' && dirname =~ '/'.bname.'$' | break | endif
|
||||||
if bname =~ '^'.dirname.'\=$' | break | endif
|
if bname =~ '^'.dirname.'\=$' | break | endif
|
||||||
let ibuf= ibuf + 1
|
let ibuf= ibuf + 1
|
||||||
@ -1859,7 +1871,7 @@ fun! s:NetGetBuffer(islocal,dirname)
|
|||||||
else
|
else
|
||||||
let bufnum= ibuf
|
let bufnum= ibuf
|
||||||
endif
|
endif
|
||||||
" call Decho("findbuf: bufnum=".bufnum." (final)")
|
" call Decho("findbuf4: bufnum=".bufnum)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -1871,11 +1883,16 @@ fun! s:NetGetBuffer(islocal,dirname)
|
|||||||
call s:NetrwSafeOptions()
|
call s:NetrwSafeOptions()
|
||||||
" name the buffer
|
" name the buffer
|
||||||
if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
|
if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
|
||||||
|
" call Decho('silent! keepalt file NetrwTreeListing')
|
||||||
silent! keepalt file NetrwTreeListing
|
silent! keepalt file NetrwTreeListing
|
||||||
else
|
else
|
||||||
exe 'silent! keepalt file '.escape(dirname,s:netrw_cd_escape)
|
" call Decho('exe silent! keepalt file '.escape(dirname,s:netrw_cd_escape))
|
||||||
|
" let v:errmsg= "" " Decho
|
||||||
|
let escdirname= escape(dirname,s:netrw_cd_escape)
|
||||||
|
exe 'silent! keepalt file '.escdirname
|
||||||
|
" call Decho("errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">")
|
||||||
endif
|
endif
|
||||||
" call Decho("named enew buffer<".expand("%").">")
|
" call Decho("named enew buffer#".bufnr("%")."<".bufname("%").">")
|
||||||
|
|
||||||
else " Re-use the buffer
|
else " Re-use the buffer
|
||||||
|
|
||||||
@ -1947,7 +1964,7 @@ endfun
|
|||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" s:PerformListing: {{{2
|
" s:PerformListing: {{{2
|
||||||
fun! s:PerformListing(islocal)
|
fun! s:PerformListing(islocal)
|
||||||
" call Dfunc("s:PerformListing(islocal=".a:islocal.")")
|
" call Dfunc("s:PerformListing(islocal=".a:islocal.") buf(%)=".bufnr("%")."<".bufname("%").">")
|
||||||
|
|
||||||
" if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho
|
" if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho
|
||||||
" call Decho("(netrw) Processing your browsing request...")
|
" call Decho("(netrw) Processing your browsing request...")
|
||||||
@ -1956,7 +1973,7 @@ fun! s:PerformListing(islocal)
|
|||||||
" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'))
|
" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'))
|
||||||
if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
|
if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
|
||||||
" force a refresh for tree listings
|
" force a refresh for tree listings
|
||||||
" call Decho("clear buffer<".expand("%")."> with :%d")
|
" call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d")
|
||||||
setlocal ma noro
|
setlocal ma noro
|
||||||
keepjumps %d
|
keepjumps %d
|
||||||
endif
|
endif
|
||||||
@ -3248,7 +3265,7 @@ endfun
|
|||||||
" NetTreeDir: determine tree directory given current cursor position {{{2
|
" NetTreeDir: determine tree directory given current cursor position {{{2
|
||||||
" (full path directory with trailing slash returned)
|
" (full path directory with trailing slash returned)
|
||||||
fun! s:NetTreeDir()
|
fun! s:NetTreeDir()
|
||||||
" call Dfunc("NetTreeDir() curline#".line(".")."<".getline(".")."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%"))
|
" call Dfunc("NetTreeDir() curline#".line(".")."<".getline(".")."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">")
|
||||||
|
|
||||||
let treedir= b:netrw_curdir
|
let treedir= b:netrw_curdir
|
||||||
" call Decho("set initial treedir<".treedir.">")
|
" call Decho("set initial treedir<".treedir.">")
|
||||||
@ -3848,7 +3865,7 @@ fun! netrw#NetObtain(vismode,...) range
|
|||||||
let path = substitute(curdir,'scp://[^/]\+/','','e')
|
let path = substitute(curdir,'scp://[^/]\+/','','e')
|
||||||
" call Decho("path<".path.">")
|
" call Decho("path<".path.">")
|
||||||
if exists("g:netrw_port") && g:netrw_port != ""
|
if exists("g:netrw_port") && g:netrw_port != ""
|
||||||
let useport= " -P ".g:netrw_port
|
let useport= " ".g:netrw_scpport." ".g:netrw_port
|
||||||
else
|
else
|
||||||
let useport= ""
|
let useport= ""
|
||||||
endif
|
endif
|
||||||
@ -4056,7 +4073,7 @@ endfun
|
|||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" LocalListing: does the job of "ls" for local directories {{{2
|
" LocalListing: does the job of "ls" for local directories {{{2
|
||||||
fun! s:LocalListing()
|
fun! s:LocalListing()
|
||||||
" call Dfunc("LocalListing() &ma=".&ma." &mod=".&mod." &ro=".&ro)
|
" call Dfunc("LocalListing() &ma=".&ma." &mod=".&mod." &ro=".&ro." buf(%)=".buf("%"))
|
||||||
" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist") |endif
|
" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist") |endif
|
||||||
" if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist")|endif
|
" if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist")|endif
|
||||||
|
|
||||||
@ -4438,9 +4455,10 @@ endfun
|
|||||||
" dosplit==1: the window will be split before running the local
|
" dosplit==1: the window will be split before running the local
|
||||||
" browser
|
" browser
|
||||||
fun! netrw#Explore(indx,dosplit,style,...)
|
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)
|
" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." a:0=".a:0)
|
||||||
if !exists("b:netrw_curdir")
|
if !exists("b:netrw_curdir")
|
||||||
let b:netrw_curdir= getcwd()
|
let b:netrw_curdir= getcwd()
|
||||||
|
" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)")
|
||||||
endif
|
endif
|
||||||
let curfile= b:netrw_curdir
|
let curfile= b:netrw_curdir
|
||||||
" call Decho("curfile<".curfile.">")
|
" call Decho("curfile<".curfile.">")
|
||||||
@ -4489,6 +4507,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
|
|||||||
endif
|
endif
|
||||||
norm! 0
|
norm! 0
|
||||||
|
|
||||||
|
if a:0 > 0
|
||||||
" call Decho("a:1<".a:1.">")
|
" call Decho("a:1<".a:1.">")
|
||||||
if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin))
|
if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin))
|
||||||
let dirname= substitute(a:1,'\~',expand("$HOME"),'')
|
let dirname= substitute(a:1,'\~',expand("$HOME"),'')
|
||||||
@ -4499,10 +4518,13 @@ fun! netrw#Explore(indx,dosplit,style,...)
|
|||||||
let dirname= dirname."/"
|
let dirname= dirname."/"
|
||||||
endif
|
endif
|
||||||
" call Decho("using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")")
|
" call Decho("using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")")
|
||||||
|
elseif a:1 =~ '\$'
|
||||||
|
let dirname= expand(a:1)
|
||||||
else
|
else
|
||||||
let dirname= a:1
|
let dirname= a:1
|
||||||
" call Decho("using dirname<".dirname.">")
|
" call Decho("using dirname<".dirname.">")
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if dirname =~ '^\*/'
|
if dirname =~ '^\*/'
|
||||||
" Explore */pattern
|
" Explore */pattern
|
||||||
@ -4919,33 +4941,61 @@ endfun
|
|||||||
" 2=error = s:ERROR
|
" 2=error = s:ERROR
|
||||||
" Mar 19, 2007 : max errnum currently is 49
|
" Mar 19, 2007 : max errnum currently is 49
|
||||||
fun! netrw#ErrorMsg(level,msg,errnum)
|
fun! netrw#ErrorMsg(level,msg,errnum)
|
||||||
" call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a: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 == 1
|
||||||
|
let level= "**warning** (netrw) "
|
||||||
|
elseif a:level == 2
|
||||||
|
let level= "**error** (netrw) "
|
||||||
|
else
|
||||||
|
let level= "**note** (netrw) "
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:netrw_use_errorwindow
|
||||||
|
" (default) netrw creates a one-line window to show error/warning
|
||||||
|
" messages (reliably displayed)
|
||||||
|
|
||||||
" record current window number for NetRestorePosn()'s benefit
|
" record current window number for NetRestorePosn()'s benefit
|
||||||
let s:winBeforeErr= winnr()
|
let s:winBeforeErr= winnr()
|
||||||
|
|
||||||
" getting messages out reliably is just plain difficult!
|
" getting messages out reliably is just plain difficult!
|
||||||
" This attempt splits the current window, creating a one line window.
|
" This attempt splits the current window, creating a one line window.
|
||||||
let errbufnum= bufnr("NetrwMessage")
|
if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0
|
||||||
|
exe bufwinnr("NetrwMessage")."wincmd w"
|
||||||
|
set ma noro
|
||||||
|
call setline(line("$")+1,level.a:msg)
|
||||||
|
$
|
||||||
|
else
|
||||||
bo 1split
|
bo 1split
|
||||||
enew
|
enew
|
||||||
setlocal bt=nofile
|
setlocal bt=nofile
|
||||||
file NetrwMessage
|
file NetrwMessage
|
||||||
|
call setline(line("$"),level.a:msg)
|
||||||
put ='***netrw*** '.a:msg
|
endif
|
||||||
if &fo !~ '[ta]'
|
if &fo !~ '[ta]'
|
||||||
syn clear
|
syn clear
|
||||||
syn match netrwMesg "^\*\*\*netrw\*\*\*"
|
syn match netrwMesgNote "^\*\*note\*\*"
|
||||||
if a:level == s:WARNING
|
syn match netrwMesgWarning "^\*\*warning\*\*"
|
||||||
hi link netrwMesg WarningMsg
|
syn match netrwMesgError "^\*\*error\*\*"
|
||||||
elseif a:level == s:ERROR
|
hi link netrwMesgWarning WarningMsg
|
||||||
hi link netrwMesg Error
|
hi link netrwMesgError Error
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
1d
|
|
||||||
setlocal noma ro bh=wipe
|
setlocal noma ro bh=wipe
|
||||||
|
|
||||||
|
else
|
||||||
|
" (optional) netrw will show messages using echomsg. Even if the
|
||||||
|
" message doesn't appear, at least it'll be recallable via :messages
|
||||||
|
redraw!
|
||||||
|
if a:level == s:WARNING
|
||||||
|
echohl WarningMsg
|
||||||
|
elseif a:level == s:ERROR
|
||||||
|
echohl Error
|
||||||
|
endif
|
||||||
|
echomsg level.a:msg
|
||||||
|
" call Decho("echomsg ***netrw*** ".a:msg)
|
||||||
|
echohl None
|
||||||
|
endif
|
||||||
|
|
||||||
" call Dret("netrw#ErrorMsg")
|
" call Dret("netrw#ErrorMsg")
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
@ -5045,9 +5095,9 @@ fun! s:MakeSshCmd(sshcmd)
|
|||||||
" call Dfunc("s:MakeSshCmd(sshcmd<".a:sshcmd.">)")
|
" call Dfunc("s:MakeSshCmd(sshcmd<".a:sshcmd.">)")
|
||||||
let sshcmd = substitute(a:sshcmd,'\<HOSTNAME\>',s:user.s:machine,'')
|
let sshcmd = substitute(a:sshcmd,'\<HOSTNAME\>',s:user.s:machine,'')
|
||||||
if exists("g:netrw_port") && g:netrw_port != ""
|
if exists("g:netrw_port") && g:netrw_port != ""
|
||||||
let sshcmd= substitute(sshcmd,"USEPORT",'-P '.g:netrw_port,'')
|
let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.g:netrw_port,'')
|
||||||
elseif exists("s:port") && s:port != ""
|
elseif exists("s:port") && s:port != ""
|
||||||
let sshcmd= substitute(sshcmd,"USEPORT",'-P '.s:port,'')
|
let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.s:port,'')
|
||||||
else
|
else
|
||||||
let sshcmd= substitute(sshcmd,"USEPORT ",'','')
|
let sshcmd= substitute(sshcmd,"USEPORT ",'','')
|
||||||
endif
|
endif
|
||||||
@ -5058,7 +5108,7 @@ endfun
|
|||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2
|
" s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2
|
||||||
fun! s:NetrwEnew(curdir)
|
fun! s:NetrwEnew(curdir)
|
||||||
" call Dfunc("s:NetrwEnew(curdir<".a:curdir.">) expand(%)<".expand("%").">")
|
" call Dfunc("s:NetrwEnew(curdir<".a:curdir.">) buf#".bufnr("%")."<".bufname("%").">")
|
||||||
|
|
||||||
" grab a function-local copy of buffer variables
|
" grab a function-local copy of buffer variables
|
||||||
if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif
|
if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif
|
||||||
@ -5113,7 +5163,7 @@ fun! s:NetrwEnew(curdir)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" call Dret("s:NetrwEnew : buf#".bufnr("%"))
|
" call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%").">")
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" netrwSettings.vim: makes netrw settings simpler
|
" netrwSettings.vim: makes netrw settings simpler
|
||||||
" Date: Jan 05, 2007
|
" Date: Mar 26, 2007
|
||||||
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
||||||
" Version: 9b ASTRO-ONLY
|
" Version: 9
|
||||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
||||||
" Permission is hereby granted to use and distribute this code,
|
" Permission is hereby granted to use and distribute this code,
|
||||||
" with or without modifications, provided that this copyright
|
" with or without modifications, provided that this copyright
|
||||||
@ -19,7 +19,7 @@
|
|||||||
if exists("g:loaded_netrwSettings") || &cp
|
if exists("g:loaded_netrwSettings") || &cp
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_netrwSettings = "v9b"
|
let g:loaded_netrwSettings = "v9"
|
||||||
|
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" NetrwSettings: {{{1
|
" NetrwSettings: {{{1
|
||||||
@ -81,11 +81,15 @@ fun! netrwSettings#NetrwSettings()
|
|||||||
put = 'let g:netrw_ftp = '.g:netrw_ftp
|
put = 'let g:netrw_ftp = '.g:netrw_ftp
|
||||||
put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
|
put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
|
||||||
put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
|
put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
|
||||||
|
put = 'let g:netrw_sshport = '.g:netrw_sshport
|
||||||
let shqline= line("$")
|
let shqline= line("$")
|
||||||
put = 'let g:netrw_shq...'
|
put = 'let g:netrw_shq...'
|
||||||
put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
|
put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
|
||||||
put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
|
put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
|
||||||
let s:netrw_xfer_stop= line(".")
|
let s:netrw_xfer_stop= line(".")
|
||||||
|
put =''
|
||||||
|
put ='+ Netrw Messages'
|
||||||
|
put ='let g:netrw_use_errorwindow = '.g:netrw_use_errorwindow
|
||||||
|
|
||||||
put = ''
|
put = ''
|
||||||
put ='+ Netrw Browser Control'
|
put ='+ Netrw Browser Control'
|
||||||
@ -122,12 +126,14 @@ fun! netrwSettings#NetrwSettings()
|
|||||||
put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
|
put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
|
||||||
put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
|
put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
|
||||||
put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
|
put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
|
||||||
|
put = 'let g:netrw_scpport = '.g:netrw_scpport
|
||||||
|
put = 'let g:netrw_sshport = '.g:netrw_sshport
|
||||||
put = 'let g:netrw_timefmt = '.g:netrw_timefmt
|
put = 'let g:netrw_timefmt = '.g:netrw_timefmt
|
||||||
put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf
|
put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf
|
||||||
put = 'let g:netrw_winsize = '.g:netrw_winsize
|
put = 'let g:netrw_winsize = '.g:netrw_winsize
|
||||||
|
|
||||||
put =''
|
put =''
|
||||||
put ='+ For help, place cursor on line and press ?'
|
put ='+ For help, place cursor on line and press <F1>'
|
||||||
|
|
||||||
1d
|
1d
|
||||||
silent %s/^+/"/e
|
silent %s/^+/"/e
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" vimball.vim : construct a file containing both paths and files
|
" vimball.vim : construct a file containing both paths and files
|
||||||
" Author: Charles E. Campbell, Jr.
|
" Author: Charles E. Campbell, Jr.
|
||||||
" Date: Jan 03, 2007
|
" Date: May 07, 2007
|
||||||
" Version: 21
|
" Version: 22
|
||||||
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
|
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
|
||||||
" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr.
|
" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr.
|
||||||
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
||||||
@ -15,7 +15,7 @@ if &cp || exists("g:loaded_vimball") || v:version < 700
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let s:keepcpo = &cpo
|
let s:keepcpo = &cpo
|
||||||
let g:loaded_vimball = "v21"
|
let g:loaded_vimball = "v22"
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
" =====================================================================
|
" =====================================================================
|
||||||
@ -583,13 +583,14 @@ fun! s:SaveSettings()
|
|||||||
let s:fenkeep = &fen
|
let s:fenkeep = &fen
|
||||||
let s:hidkeep = &hidden
|
let s:hidkeep = &hidden
|
||||||
let s:ickeep = &ic
|
let s:ickeep = &ic
|
||||||
|
let s:lzkeep = &lz
|
||||||
|
let s:pmkeep = &pm
|
||||||
let s:repkeep = &report
|
let s:repkeep = &report
|
||||||
let s:vekeep = &ve
|
let s:vekeep = &ve
|
||||||
let s:lzkeep = &lz
|
|
||||||
if exists("&acd")
|
if exists("&acd")
|
||||||
set ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz
|
set ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm=
|
||||||
else
|
else
|
||||||
set ei=all ve=all nofen noic report=999 nohid bt= ma lz
|
set ei=all ve=all nofen noic report=999 nohid bt= ma lz pm=
|
||||||
endif
|
endif
|
||||||
" call Dret("SaveSettings")
|
" call Dret("SaveSettings")
|
||||||
endfun
|
endfun
|
||||||
@ -606,6 +607,7 @@ fun! s:RestoreSettings()
|
|||||||
let &hidden = s:hidkeep
|
let &hidden = s:hidkeep
|
||||||
let &ic = s:ickeep
|
let &ic = s:ickeep
|
||||||
let &lz = s:lzkeep
|
let &lz = s:lzkeep
|
||||||
|
let &pm = s:pmkeep
|
||||||
let &report = s:repkeep
|
let &report = s:repkeep
|
||||||
let &ve = s:vekeep
|
let &ve = s:vekeep
|
||||||
let &ei = s:eikeep
|
let &ei = s:eikeep
|
||||||
@ -615,9 +617,9 @@ fun! s:RestoreSettings()
|
|||||||
call setpos("'a",s:makeep)
|
call setpos("'a",s:makeep)
|
||||||
endif
|
endif
|
||||||
if exists("&acd")
|
if exists("&acd")
|
||||||
unlet s:regakeep s:acdkeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep
|
unlet s:regakeep s:acdkeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep
|
||||||
else
|
else
|
||||||
unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep
|
unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep
|
||||||
endif
|
endif
|
||||||
set bt=nofile noma
|
set bt=nofile noma
|
||||||
" call Dret("RestoreSettings")
|
" call Dret("RestoreSettings")
|
||||||
|
@ -335,6 +335,8 @@ The AutoInstall process will:
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
|
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
|
||||||
|
|
||||||
|
v24 Apr 16, 2007 : * removed save&restore of the fo option during script
|
||||||
|
loading
|
||||||
v23 Nov 03, 2006 : * ignores comments (#...)
|
v23 Nov 03, 2006 : * ignores comments (#...)
|
||||||
* handles vimballs
|
* handles vimballs
|
||||||
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
|
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*pi_netrw.txt* For Vim version 7.0. Last change: 2007 Mar 21
|
*pi_netrw.txt* For Vim version 7.1a. Last change: 2007 May 05
|
||||||
|
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
NETRW REFERENCE MANUAL by Charles E. Campbell, Jr.
|
NETRW REFERENCE MANUAL by Charles E. Campbell, Jr.
|
||||||
@ -195,10 +195,16 @@ DIRECTORY LISTING *netrw-dirlist*
|
|||||||
|
|
||||||
*netrw-login* *netrw-password*
|
*netrw-login* *netrw-password*
|
||||||
CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass*
|
CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass*
|
||||||
|
|
||||||
Attempts to use ftp will prompt you for a user-id and a password.
|
Attempts to use ftp will prompt you for a user-id and a password.
|
||||||
These will be saved in g:netrw_uid and g:netrw_passwd Subsequent uses
|
These will be saved in global variables g:netrw_uid and
|
||||||
of ftp will re-use those. If you need to use a different user id
|
g:netrw_passwd; subsequent uses of ftp will re-use those two items to
|
||||||
and/or password, you'll want to call NetUserPass() first.
|
simplify the further use of ftp. However, if you need to use a
|
||||||
|
different user id and/or password, you'll want to call NetUserPass()
|
||||||
|
first. To work around the need to enter passwords, check if your ftp
|
||||||
|
supports a <.netrc> file in your home directory. Also see
|
||||||
|
|netrw-passwd| (and if you're using ssh/scp hoping to figure out how
|
||||||
|
to not need to use passwords, look at |netrw-listhack|).
|
||||||
|
|
||||||
:NetUserPass [uid [password]] -- prompts as needed
|
:NetUserPass [uid [password]] -- prompts as needed
|
||||||
:call NetUserPass() -- prompts for uid and password
|
:call NetUserPass() -- prompts for uid and password
|
||||||
@ -207,7 +213,7 @@ DIRECTORY LISTING *netrw-dirlist*
|
|||||||
|
|
||||||
VARIABLES *netrw-variables*
|
VARIABLES *netrw-variables*
|
||||||
|
|
||||||
(see also: |netrw-browse-var||netrw-protocol||netrw-settings||netrw-var|)
|
(also see: |netrw-browse-var| |netrw-protocol| |netrw-settings| |netrw-var|)
|
||||||
|
|
||||||
*b:netrw_lastfile* last file Network-read/written retained on a per-buffer
|
*b:netrw_lastfile* last file Network-read/written retained on a per-buffer
|
||||||
basis (supports plain :Nw )
|
basis (supports plain :Nw )
|
||||||
@ -249,6 +255,16 @@ VARIABLES *netrw-variables*
|
|||||||
Controls the quoting character used during scp and ftp
|
Controls the quoting character used during scp and ftp
|
||||||
commands.
|
commands.
|
||||||
|
|
||||||
|
*g:netrw_scpport* = "-P" : option to use to set port for scp
|
||||||
|
*g:netrw_sshport* = "-p" : option to use to set port for ssh
|
||||||
|
|
||||||
|
*g:netrw_use_errorwindow* =1 : messages from netrw will use a separate one
|
||||||
|
line window. This window provides reliable
|
||||||
|
delivery of messages. (default)
|
||||||
|
=0 : messages from netrw will use echoerr ;
|
||||||
|
messages don't always seem to show up this
|
||||||
|
way, but one doesn't have to quit the window.
|
||||||
|
|
||||||
*g:netrw_win95ftp* =1 if using Win95, will remove four trailing blank
|
*g:netrw_win95ftp* =1 if using Win95, will remove four trailing blank
|
||||||
lines that o/s's ftp "provides" on transfers
|
lines that o/s's ftp "provides" on transfers
|
||||||
=0 force normal ftp behavior (no trailing line removal)
|
=0 force normal ftp behavior (no trailing line removal)
|
||||||
@ -518,7 +534,8 @@ below, a {netfile} is an url to a remote file.
|
|||||||
The <netrw.vim> script provides several variables which act as options to
|
The <netrw.vim> script provides several variables which act as options to
|
||||||
ffect <netrw.vim>'s behavior. These variables typically may be set in the
|
ffect <netrw.vim>'s behavior. These variables typically may be set in the
|
||||||
user's <.vimrc> file:
|
user's <.vimrc> file:
|
||||||
(see also: |netrw-settings||netrw-browse-var||netrw-protocol||netrw-settings|) >
|
(also see:
|
||||||
|
|netrw-settings| |netrw-browse-var| |netrw-protocol| |netrw-settings|) >
|
||||||
|
|
||||||
-------------
|
-------------
|
||||||
Netrw Options
|
Netrw Options
|
||||||
@ -1462,8 +1479,8 @@ Especially with the remote directory browser, constantly entering the password
|
|||||||
is tedious.
|
is tedious.
|
||||||
|
|
||||||
For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength
|
For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength
|
||||||
tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3), gives a tip
|
tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3) gives a tip
|
||||||
for setting up no-password ssh and scp, plus discusses associated security
|
for setting up no-password ssh and scp and discusses associated security
|
||||||
issues. It used to be available at http://hacks.oreilly.com/pub/h/66 ,
|
issues. It used to be available at http://hacks.oreilly.com/pub/h/66 ,
|
||||||
but apparently that address is now being redirected to some "hackzine".
|
but apparently that address is now being redirected to some "hackzine".
|
||||||
I'll attempt a summary:
|
I'll attempt a summary:
|
||||||
@ -1495,7 +1512,7 @@ settings. You may change any of their values; when you save the file, the
|
|||||||
settings therein will be used. One may also press "?" on any of the lines for
|
settings therein will be used. One may also press "?" on any of the lines for
|
||||||
help on what each of the variables do.
|
help on what each of the variables do.
|
||||||
|
|
||||||
(see also: |netrw-browse-var||netrw-protocol||netrw-var||netrw-variables|)
|
(also see: |netrw-browse-var| |netrw-protocol| |netrw-var| |netrw-variables|)
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
@ -1728,6 +1745,16 @@ which is loaded automatically at startup (assuming :set nocp).
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
12. History *netrw-history* {{{1
|
12. History *netrw-history* {{{1
|
||||||
|
|
||||||
|
v109: Mar 26, 2007 * if a directory name includes a "$" character,
|
||||||
|
Explore() will use expand() in an attempt to
|
||||||
|
decipher the name.
|
||||||
|
May 07, 2007 * g:netrw_use_errorwindow now allows one to
|
||||||
|
have error messages go to a reliable window
|
||||||
|
or to use a less reliable but recallable
|
||||||
|
echoerr method
|
||||||
|
May 07, 2007 * g:netrw_scpport and g:netrw_sshport support
|
||||||
|
use of -P and -p, respectively, to set port
|
||||||
|
for scp/ssh.
|
||||||
v108: Jan 03, 2007 * included preview map (|netrw-p|), supporting
|
v108: Jan 03, 2007 * included preview map (|netrw-p|), supporting
|
||||||
remote browsing
|
remote browsing
|
||||||
* netrw can now source remote files
|
* netrw can now source remote files
|
||||||
@ -1738,7 +1765,7 @@ which is loaded automatically at startup (assuming :set nocp).
|
|||||||
(list, remove/delete, rename)
|
(list, remove/delete, rename)
|
||||||
Jan 31, 2007 * Luis Florit reported that @* was an invalid
|
Jan 31, 2007 * Luis Florit reported that @* was an invalid
|
||||||
register. The @* register is now only saved and
|
register. The @* register is now only saved and
|
||||||
restored if |guioptions| contains "a".
|
restored if |'guioptions'| contains "a".
|
||||||
Feb 02, 2007 * Fixed a bug that cropped up when writing files
|
Feb 02, 2007 * Fixed a bug that cropped up when writing files
|
||||||
via scp using cygwin
|
via scp using cygwin
|
||||||
Feb 08, 2007 * tree listing mode managed to stop working again;
|
Feb 08, 2007 * tree listing mode managed to stop working again;
|
||||||
@ -1856,7 +1883,7 @@ which is loaded automatically at startup (assuming :set nocp).
|
|||||||
now bypassed only when it is
|
now bypassed only when it is
|
||||||
v95: * bugfix - Hiding mode worked correctly (don't show any file
|
v95: * bugfix - Hiding mode worked correctly (don't show any file
|
||||||
matching any of the g:netrw_hide patterns), but
|
matching any of the g:netrw_hide patterns), but
|
||||||
but showing mode was showing only those files that didn't
|
showing mode was showing only those files that didn't
|
||||||
match any of the g:netrw_hide patterns. Instead, it now
|
match any of the g:netrw_hide patterns. Instead, it now
|
||||||
shows all files that match any of the g:netrw_hide patterns
|
shows all files that match any of the g:netrw_hide patterns
|
||||||
(the difference between a logical and and logical or).
|
(the difference between a logical and and logical or).
|
||||||
@ -1891,7 +1918,7 @@ which is loaded automatically at startup (assuming :set nocp).
|
|||||||
v81: * FocusGained also used to refresh/wipe local browser directory
|
v81: * FocusGained also used to refresh/wipe local browser directory
|
||||||
buffers
|
buffers
|
||||||
* (bugfix) netrw was leaving [Scratch] buffers behind when the
|
* (bugfix) netrw was leaving [Scratch] buffers behind when the
|
||||||
the user had the "hidden" option set. The 'hidden' option is
|
user had the "hidden" option set. The 'hidden' option is
|
||||||
now bypassed.
|
now bypassed.
|
||||||
v80: * ShellCmdPost event used in conjunction with g:netrw_fastbrowse
|
v80: * ShellCmdPost event used in conjunction with g:netrw_fastbrowse
|
||||||
to refresh/wipe local browser directory buffers.
|
to refresh/wipe local browser directory buffers.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*pi_vimball.txt* For Vim version 7.0. Last change: 2007 Jan 03
|
*pi_vimball.txt* For Vim version 7.1a. Last change: 2007 May 07
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
Vimball Archiver
|
Vimball Archiver
|
||||||
@ -90,6 +90,7 @@ Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright*
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
3. Vimball History *vimball-history* {{{1
|
3. Vimball History *vimball-history* {{{1
|
||||||
|
|
||||||
|
22 : Mar 21, 2007 * uses setlocal instead of set during BufEnter
|
||||||
21 : Nov 27, 2006 * (tnx to Bill McCarthy) vimball had a header
|
21 : Nov 27, 2006 * (tnx to Bill McCarthy) vimball had a header
|
||||||
handling problem and it now changes \s to /s
|
handling problem and it now changes \s to /s
|
||||||
20 : Nov 20, 2006 * substitute() calls have all had the 'e' flag
|
20 : Nov 20, 2006 * substitute() calls have all had the 'e' flag
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
*tComment.txt* tComment -- One comment plugin to rule them all
|
*tComment.txt* tComment -- An easily extensible & universal comment plugin
|
||||||
|
|
||||||
Author: Thomas Link, samul AT web.de
|
Author: Thomas Link, samul AT web.de
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ lines, and it will remove comment markup for already commented text
|
|||||||
|
|
||||||
*tComment-Key-Bindings*
|
*tComment-Key-Bindings*
|
||||||
Key bindings~
|
Key bindings~
|
||||||
|
|
||||||
<c-_><c-_> :: :TComment
|
<c-_><c-_> :: :TComment
|
||||||
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
|
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
|
||||||
<c-_>b :: :TCommentBlock
|
<c-_>b :: :TCommentBlock
|
||||||
@ -34,6 +35,31 @@ Key bindings~
|
|||||||
<c-_>s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
|
<c-_>s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
|
||||||
<c-_>i :: :TCommentInline
|
<c-_>i :: :TCommentInline
|
||||||
<c-_>r :: :TCommentRight
|
<c-_>r :: :TCommentRight
|
||||||
|
<c-_>p :: Comment the current inner paragraph
|
||||||
|
|
||||||
|
A secondary set of key maps is defined for normal mode.
|
||||||
|
|
||||||
|
<Leader>__ :: :TComment
|
||||||
|
<Leader>_p :: Comment the current inner paragraph
|
||||||
|
<Leader>_<space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
|
||||||
|
<Leader>_i :: :TCommentInline
|
||||||
|
<Leader>_r :: :TCommentRight
|
||||||
|
<Leader>_b :: :TCommentBlock
|
||||||
|
<Leader>_a :: :TCommentAs <QUERY COMMENT TYPE>
|
||||||
|
<Leader>_s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
|
||||||
|
|
||||||
|
Keymaps are configurable via the following variables:
|
||||||
|
|
||||||
|
*g:tcommentMapLeader1*
|
||||||
|
g:tcommentMapLeader1 string (default: <c-_>)
|
||||||
|
Prefix for the keymaps. Set to '' to disable keymaps with this
|
||||||
|
prefix.
|
||||||
|
*g:tcommentMapLeader2*
|
||||||
|
g:tcommentMapLeader2 string (default: <Leader>_)
|
||||||
|
Secondary prefix. (The reason for why there are two prefixes is
|
||||||
|
that <c-_> appears preferable with gvim but can be difficult to
|
||||||
|
type on the terminal. The secondary prefix isn't used for insert
|
||||||
|
mode maps. Set to '' to disable keymaps with this prefix.
|
||||||
|
|
||||||
*tComment-commands*
|
*tComment-commands*
|
||||||
Alternatively, you can type (? meaning "optional argument"):
|
Alternatively, you can type (? meaning "optional argument"):
|
||||||
@ -143,9 +169,11 @@ or 'comments' variables):
|
|||||||
php, prolog, ruby, r, scheme, sgml, sh, sql, spec, sps, tcl, tex,
|
php, prolog, ruby, r, scheme, sgml, sh, sql, spec, sps, tcl, tex,
|
||||||
tpl, viki, vim, websec, xml, xslt, yaml
|
tpl, viki, vim, websec, xml, xslt, yaml
|
||||||
|
|
||||||
|
|
||||||
Credits~
|
Credits~
|
||||||
The way we check for embedded syntax was adapted from/inspired by Meikel
|
The way we check for embedded syntax was originally adapted
|
||||||
Brandmeyer's EnhancedCommentify.vim (vimscript #23).
|
from/inspired by Meikel Brandmeyer's EnhancedCommentify.vim
|
||||||
|
(vimscript #23) but has evolved since.
|
||||||
|
|
||||||
|
|
||||||
vim: tw=72
|
vim: tw=72
|
||||||
|
@ -1315,6 +1315,7 @@ g:netrw_rmdir_cmd pi_netrw.txt /*g:netrw_rmdir_cmd*
|
|||||||
g:netrw_rmf_cmd pi_netrw.txt /*g:netrw_rmf_cmd*
|
g:netrw_rmf_cmd pi_netrw.txt /*g:netrw_rmf_cmd*
|
||||||
g:netrw_rsync_cmd pi_netrw.txt /*g:netrw_rsync_cmd*
|
g:netrw_rsync_cmd pi_netrw.txt /*g:netrw_rsync_cmd*
|
||||||
g:netrw_scp_cmd pi_netrw.txt /*g:netrw_scp_cmd*
|
g:netrw_scp_cmd pi_netrw.txt /*g:netrw_scp_cmd*
|
||||||
|
g:netrw_scpport pi_netrw.txt /*g:netrw_scpport*
|
||||||
g:netrw_sftp_cmd pi_netrw.txt /*g:netrw_sftp_cmd*
|
g:netrw_sftp_cmd pi_netrw.txt /*g:netrw_sftp_cmd*
|
||||||
g:netrw_shq pi_netrw.txt /*g:netrw_shq*
|
g:netrw_shq pi_netrw.txt /*g:netrw_shq*
|
||||||
g:netrw_sort_by pi_netrw.txt /*g:netrw_sort_by*
|
g:netrw_sort_by pi_netrw.txt /*g:netrw_sort_by*
|
||||||
@ -1322,12 +1323,16 @@ g:netrw_sort_direction pi_netrw.txt /*g:netrw_sort_direction*
|
|||||||
g:netrw_sort_sequence pi_netrw.txt /*g:netrw_sort_sequence*
|
g:netrw_sort_sequence pi_netrw.txt /*g:netrw_sort_sequence*
|
||||||
g:netrw_ssh_browse_reject pi_netrw.txt /*g:netrw_ssh_browse_reject*
|
g:netrw_ssh_browse_reject pi_netrw.txt /*g:netrw_ssh_browse_reject*
|
||||||
g:netrw_ssh_cmd pi_netrw.txt /*g:netrw_ssh_cmd*
|
g:netrw_ssh_cmd pi_netrw.txt /*g:netrw_ssh_cmd*
|
||||||
|
g:netrw_sshport pi_netrw.txt /*g:netrw_sshport*
|
||||||
g:netrw_timefmt pi_netrw.txt /*g:netrw_timefmt*
|
g:netrw_timefmt pi_netrw.txt /*g:netrw_timefmt*
|
||||||
g:netrw_uid pi_netrw.txt /*g:netrw_uid*
|
g:netrw_uid pi_netrw.txt /*g:netrw_uid*
|
||||||
|
g:netrw_use_errorwindow pi_netrw.txt /*g:netrw_use_errorwindow*
|
||||||
g:netrw_use_noswf pi_netrw.txt /*g:netrw_use_noswf*
|
g:netrw_use_noswf pi_netrw.txt /*g:netrw_use_noswf*
|
||||||
g:netrw_use_nt_rcp pi_netrw.txt /*g:netrw_use_nt_rcp*
|
g:netrw_use_nt_rcp pi_netrw.txt /*g:netrw_use_nt_rcp*
|
||||||
g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp*
|
g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp*
|
||||||
g:netrw_winsize pi_netrw.txt /*g:netrw_winsize*
|
g:netrw_winsize pi_netrw.txt /*g:netrw_winsize*
|
||||||
|
g:tcommentMapLeader1 tComment.txt /*g:tcommentMapLeader1*
|
||||||
|
g:tcommentMapLeader2 tComment.txt /*g:tcommentMapLeader2*
|
||||||
g:vimball_home pi_vimball.txt /*g:vimball_home*
|
g:vimball_home pi_vimball.txt /*g:vimball_home*
|
||||||
g:visincr_datedivset visincr.txt /*g:visincr_datedivset*
|
g:visincr_datedivset visincr.txt /*g:visincr_datedivset*
|
||||||
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
" Installing: :help glvs-install
|
" Installing: :help glvs-install
|
||||||
" Usage: :help glvs
|
" Usage: :help glvs
|
||||||
"
|
"
|
||||||
" GetLatestVimScripts: 642 1 :AutoInstall: GetLatestVimScripts.vim
|
" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
|
||||||
"
|
"
|
||||||
" (Rom 15:11 WEB) Again, "Praise the Lord, all you Gentiles! Let
|
" (Rom 15:11 WEB) Again, "Praise the Lord, all you Gentiles! Let
|
||||||
" all the peoples praise Him."
|
" all the peoples praise Him."
|
||||||
|
152
vimfiles/plugin/svndiff.vim
Normal file
152
vimfiles/plugin/svndiff.vim
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" svndiff (C) 2007 Ico Doornekamp
|
||||||
|
"
|
||||||
|
" Introduction
|
||||||
|
" ------------
|
||||||
|
"
|
||||||
|
" NOTE: This plugin is linux-only!
|
||||||
|
"
|
||||||
|
" An experimental vim 7.0 plugin for showing svn diff information in a file
|
||||||
|
" while editing. This plugin runs a diff between the current buffer and the
|
||||||
|
" original subversion file, and applies highlighting to show where the buffer
|
||||||
|
" differs. The original text is not shown, only colors are used to indicate
|
||||||
|
" where changes were made.
|
||||||
|
"
|
||||||
|
" The following syntax highlight groups are used:
|
||||||
|
"
|
||||||
|
" DiffAdd: Newly added lines. (default=blue)
|
||||||
|
"
|
||||||
|
" DiffChange: Lines which are changed from the original. (default=cyan)
|
||||||
|
"
|
||||||
|
" DiffDel: Applied to the lines directly above and below a deleted
|
||||||
|
" block (default=magenta)
|
||||||
|
"
|
||||||
|
" Usage
|
||||||
|
" -----
|
||||||
|
"
|
||||||
|
" The plugin defines one function: Svndiff_show(). This function figures out
|
||||||
|
" the difference between the current file and it's subversion original, and
|
||||||
|
" creates the syntax highlighting patterns. You'll need to call this function
|
||||||
|
" after making changes to update the highlighting.
|
||||||
|
"
|
||||||
|
" The function takes an optional argument specifying an additional action to
|
||||||
|
" perform:
|
||||||
|
"
|
||||||
|
" "prev": jump to the previous different block
|
||||||
|
" "next": jump to the next different block
|
||||||
|
"
|
||||||
|
" You might want to map some keys to run the Svndiff_show function. For example,
|
||||||
|
" add to your .vimrc:
|
||||||
|
"
|
||||||
|
" noremap <F3> :call Svndiff_show("prev")<CR>
|
||||||
|
" noremap <F4> :call Svndiff_show("next")<CR>
|
||||||
|
"
|
||||||
|
" And optionally another keymap to cleanup the diff highlighting and revert to
|
||||||
|
" the original syntax:
|
||||||
|
"
|
||||||
|
" noremap <F5> :syntax on<CR>
|
||||||
|
"
|
||||||
|
"
|
||||||
|
" Changelog
|
||||||
|
" ---------
|
||||||
|
"
|
||||||
|
" 1.0 2007-04-02 Initial version
|
||||||
|
"
|
||||||
|
" 1.1 2007-04-02 Added goto prev/next diffblock commands
|
||||||
|
"
|
||||||
|
" 1.2 2007-06-14 Updated diff arguments from -u0 (obsolete) to -U0
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
|
||||||
|
function! Svndiff_show(...)
|
||||||
|
|
||||||
|
let cmd = exists("a:1") ? a:1 : ''
|
||||||
|
let fname = bufname("%")
|
||||||
|
let jump_to = 0
|
||||||
|
|
||||||
|
|
||||||
|
" Check if this file is managed by subversion, exit otherwise
|
||||||
|
|
||||||
|
let info = system("svn info " . fname)
|
||||||
|
if match(info, "Path") == -1
|
||||||
|
echom "Svndiff: Warning, file " . fname . " is not managed by subversion, or error running svn."
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
" Reset syntax highlighting
|
||||||
|
|
||||||
|
syntax off
|
||||||
|
|
||||||
|
|
||||||
|
" Pipe the current buffer contents to a shell command calculating the diff
|
||||||
|
" in a friendly parsable format
|
||||||
|
|
||||||
|
let contents = join(getbufline("%", 1, "$"), "\n")
|
||||||
|
let diff = system("diff -U0 <(svn cat " . fname . ") <(cat;echo)", contents)
|
||||||
|
|
||||||
|
|
||||||
|
" Parse the output of the diff command and hightlight changed, added and
|
||||||
|
" removed lines
|
||||||
|
|
||||||
|
for line in split(diff, '\n')
|
||||||
|
|
||||||
|
let part = matchlist(line, '@@ -\([0-9]*\),*\([0-9]*\) +\([0-9]*\),*\([0-9]*\) @@')
|
||||||
|
|
||||||
|
if ! empty(part)
|
||||||
|
let old_from = part[1]
|
||||||
|
let old_count = part[2] == '' ? 1 : part[2]
|
||||||
|
let new_from = part[3]
|
||||||
|
let new_count = part[4] == '' ? 1 : part[4]
|
||||||
|
|
||||||
|
" Figure out if text was added, removed or changed.
|
||||||
|
|
||||||
|
if old_count == 0
|
||||||
|
let from = new_from
|
||||||
|
let to = new_from + new_count - 1
|
||||||
|
let group = 'DiffAdd'
|
||||||
|
elseif new_count == 0
|
||||||
|
let from = new_from
|
||||||
|
let to = new_from + 1
|
||||||
|
let group = 'DiffDelete'
|
||||||
|
else
|
||||||
|
let from = new_from
|
||||||
|
let to = new_from + new_count - 1
|
||||||
|
let group = 'DiffChange'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Set the actual syntax highlight
|
||||||
|
|
||||||
|
exec 'syntax region ' . group . ' start=".*\%' . from . 'l" end=".*\%' . to . 'l"'
|
||||||
|
|
||||||
|
|
||||||
|
" Check if we need to jump to prev/next diff block
|
||||||
|
|
||||||
|
if cmd == 'prev'
|
||||||
|
if from < line(".")
|
||||||
|
let jump_to = from
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if cmd == 'next'
|
||||||
|
if from > line(".")
|
||||||
|
if jump_to == 0
|
||||||
|
let jump_to = from
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if jump_to > 0
|
||||||
|
call setpos(".", [ 0, jump_to, 1, 0 ])
|
||||||
|
endif
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" vi: ts=2 sw=2
|
||||||
|
|
@ -1,18 +1,18 @@
|
|||||||
" tComment.vim
|
" tComment.vim -- An easily extensible & universal comment plugin
|
||||||
" @Author: Thomas Link (samul AT web.de)
|
" @Author: Thomas Link (samul AT web.de)
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 27-Dez-2004.
|
" @Created: 27-Dez-2004.
|
||||||
" @Last Change: 28-Feb-2006.
|
" @Last Change: 2007-04-15.
|
||||||
" @Revision: 1.5.256
|
" @Revision: 1.6.285
|
||||||
"
|
"
|
||||||
" vimscript #1173
|
" vimscript #1173
|
||||||
|
|
||||||
if &cp || exists('loaded_tcomment')
|
if &cp || exists('loaded_tcomment')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let loaded_tcomment = 105
|
let loaded_tcomment = 106
|
||||||
|
|
||||||
fun! <SID>DefVar(name, val)
|
fun! s:DefVar(name, val)
|
||||||
if !exists(a:name)
|
if !exists(a:name)
|
||||||
" exec "let ". a:name ."='". a:val ."'"
|
" exec "let ". a:name ."='". a:val ."'"
|
||||||
exec 'let '. a:name .'="'. escape(a:val, '"\') .'"'
|
exec 'let '. a:name .'="'. escape(a:val, '"\') .'"'
|
||||||
@ -20,17 +20,22 @@ fun! <SID>DefVar(name, val)
|
|||||||
endf
|
endf
|
||||||
|
|
||||||
" If true, comment blank lines too
|
" If true, comment blank lines too
|
||||||
call <SID>DefVar('g:tcommentBlankLines', 1)
|
call s:DefVar('g:tcommentBlankLines', 1)
|
||||||
|
|
||||||
|
call s:DefVar('g:tcommentMapLeader1', '<c-_>')
|
||||||
|
call s:DefVar('g:tcommentMapLeader2', '<Leader>_')
|
||||||
|
|
||||||
" Guess the file type based on syntax names always or for some fileformat only
|
" Guess the file type based on syntax names always or for some fileformat only
|
||||||
call <SID>DefVar('g:tcommentGuessFileType', 0)
|
call s:DefVar('g:tcommentGuessFileType', 0)
|
||||||
" In php documents, the php part is usually marked as phpRegion. We thus
|
" In php documents, the php part is usually marked as phpRegion. We thus
|
||||||
" assume that the buffers default comment style isn't php but html
|
" assume that the buffers default comment style isn't php but html
|
||||||
call <SID>DefVar('g:tcommentGuessFileType_dsl', 'xml')
|
call s:DefVar('g:tcommentGuessFileType_dsl', 'xml')
|
||||||
call <SID>DefVar('g:tcommentGuessFileType_php', 'html')
|
call s:DefVar('g:tcommentGuessFileType_php', 'html')
|
||||||
call <SID>DefVar('g:tcommentGuessFileType_html', 1)
|
call s:DefVar('g:tcommentGuessFileType_html', 1)
|
||||||
call <SID>DefVar('g:tcommentGuessFileType_tskeleton', 1)
|
call s:DefVar('g:tcommentGuessFileType_tskeleton', 1)
|
||||||
call <SID>DefVar('g:tcommentGuessFileType_vim', 1)
|
call s:DefVar('g:tcommentGuessFileType_vim', 1)
|
||||||
|
|
||||||
|
call s:DefVar('g:tcommentIgnoreTypes_php', 'sql')
|
||||||
|
|
||||||
" If you don't define these variables, TComment will use &commentstring
|
" If you don't define these variables, TComment will use &commentstring
|
||||||
" instead. We override the default values here in order to have a blank after
|
" instead. We override the default values here in order to have a blank after
|
||||||
@ -42,17 +47,17 @@ call <SID>DefVar('g:tcommentGuessFileType_vim', 1)
|
|||||||
|
|
||||||
" I personally find this style rather irritating but here is an alternative
|
" I personally find this style rather irritating but here is an alternative
|
||||||
" definition that does this left-handed bar thing
|
" definition that does this left-handed bar thing
|
||||||
call <SID>DefVar('g:tcommentBlockC', "/*%s */\n * ")
|
call s:DefVar('g:tcommentBlockC', "/*%s */\n * ")
|
||||||
call <SID>DefVar('g:tcommentBlockC2', "/**%s */\n * ")
|
call s:DefVar('g:tcommentBlockC2', "/**%s */\n * ")
|
||||||
" call <SID>DefVar('g:tcommentBlockC', "/*%s */\n ")
|
" call s:DefVar('g:tcommentBlockC', "/*%s */\n ")
|
||||||
call <SID>DefVar('g:tcommentInlineC', "/* %s */")
|
call s:DefVar('g:tcommentInlineC', "/* %s */")
|
||||||
|
|
||||||
call <SID>DefVar('g:tcommentBlockXML', "<!--%s-->\n ")
|
call s:DefVar('g:tcommentBlockXML', "<!--%s-->\n ")
|
||||||
call <SID>DefVar('g:tcommentInlineXML', "<!-- %s -->")
|
call s:DefVar('g:tcommentInlineXML', "<!-- %s -->")
|
||||||
|
|
||||||
" Currently this function just sets a variable
|
" Currently this function just sets a variable
|
||||||
fun! TCommentDefineType(name, commentstring)
|
fun! TCommentDefineType(name, commentstring)
|
||||||
call <SID>DefVar('g:tcomment_'. a:name, a:commentstring)
|
call s:DefVar('g:tcomment_'. a:name, a:commentstring)
|
||||||
let s:tcommentFileTypesDirty = 1
|
let s:tcommentFileTypesDirty = 1
|
||||||
endf
|
endf
|
||||||
|
|
||||||
@ -125,8 +130,9 @@ call TCommentDefineType('po', '# %s' )
|
|||||||
call TCommentDefineType('prolog', '%% %s' )
|
call TCommentDefineType('prolog', '%% %s' )
|
||||||
call TCommentDefineType('readline', '# %s' )
|
call TCommentDefineType('readline', '# %s' )
|
||||||
call TCommentDefineType('ruby', '# %s' )
|
call TCommentDefineType('ruby', '# %s' )
|
||||||
|
call TCommentDefineType('ruby_3', '### %s' )
|
||||||
call TCommentDefineType('ruby_block', '=begin rdoc%s=end')
|
call TCommentDefineType('ruby_block', '=begin rdoc%s=end')
|
||||||
call TCommentDefineType('ruby_nordoc_block', '=begin%s=end' )
|
call TCommentDefineType('ruby_nodoc_block', '=begin%s=end' )
|
||||||
call TCommentDefineType('r', '# %s' )
|
call TCommentDefineType('r', '# %s' )
|
||||||
call TCommentDefineType('sbs', "' %s" )
|
call TCommentDefineType('sbs', "' %s" )
|
||||||
call TCommentDefineType('scheme', '; %s' )
|
call TCommentDefineType('scheme', '; %s' )
|
||||||
@ -142,6 +148,7 @@ call TCommentDefineType('tcl', '# %s' )
|
|||||||
call TCommentDefineType('tex', '%% %s' )
|
call TCommentDefineType('tex', '%% %s' )
|
||||||
call TCommentDefineType('tpl', '<!-- %s -->' )
|
call TCommentDefineType('tpl', '<!-- %s -->' )
|
||||||
call TCommentDefineType('viki', '%% %s' )
|
call TCommentDefineType('viki', '%% %s' )
|
||||||
|
call TCommentDefineType('viki_3', '%%%%%% %s' )
|
||||||
call TCommentDefineType('viki_inline', '{cmt: %s}' )
|
call TCommentDefineType('viki_inline', '{cmt: %s}' )
|
||||||
call TCommentDefineType('vim', '" %s' )
|
call TCommentDefineType('vim', '" %s' )
|
||||||
call TCommentDefineType('websec', '# %s' )
|
call TCommentDefineType('websec', '# %s' )
|
||||||
@ -155,7 +162,7 @@ call TCommentDefineType('yaml', '# %s' )
|
|||||||
|
|
||||||
let s:tcommentFileTypesDirty = 1
|
let s:tcommentFileTypesDirty = 1
|
||||||
|
|
||||||
fun! <SID>DefaultValue(option)
|
fun! s:DefaultValue(option)
|
||||||
exec 'let '. a:option .' = &'. a:option
|
exec 'let '. a:option .' = &'. a:option
|
||||||
exec 'set '. a:option .'&'
|
exec 'set '. a:option .'&'
|
||||||
exec 'let default = &'. a:option
|
exec 'let default = &'. a:option
|
||||||
@ -163,8 +170,8 @@ fun! <SID>DefaultValue(option)
|
|||||||
return default
|
return default
|
||||||
endf
|
endf
|
||||||
|
|
||||||
let s:defaultComments = <SID>DefaultValue('comments')
|
let s:defaultComments = s:DefaultValue('comments')
|
||||||
let s:defaultCommentString = <SID>DefaultValue('commentstring')
|
let s:defaultCommentString = s:DefaultValue('commentstring')
|
||||||
let s:nullCommentString = '%s'
|
let s:nullCommentString = '%s'
|
||||||
|
|
||||||
" TComment(line1, line2, ?commentMode, ?commentAnyway, ?commentBegin, ?commentEnd)
|
" TComment(line1, line2, ?commentMode, ?commentAnyway, ?commentBegin, ?commentEnd)
|
||||||
@ -175,8 +182,8 @@ let s:nullCommentString = '%s'
|
|||||||
" R ... right
|
" R ... right
|
||||||
fun! TComment(beg, end, ...)
|
fun! TComment(beg, end, ...)
|
||||||
" save the cursor position
|
" save the cursor position
|
||||||
let co = col(".")
|
let co = col('.')
|
||||||
let li = line(".")
|
let li = line('.')
|
||||||
let commentMode = a:0 >= 1 ? a:1 : 'G'
|
let commentMode = a:0 >= 1 ? a:1 : 'G'
|
||||||
let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0
|
let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0
|
||||||
if commentMode ==# 'IG'
|
if commentMode ==# 'IG'
|
||||||
@ -199,29 +206,29 @@ fun! TComment(beg, end, ...)
|
|||||||
endif
|
endif
|
||||||
" get the correct commentstring
|
" get the correct commentstring
|
||||||
if a:0 >= 3 && a:3 != ''
|
if a:0 >= 3 && a:3 != ''
|
||||||
let cms = <SID>EncodeCommentPart(a:3) .'%s'
|
let cms = s:EncodeCommentPart(a:3) .'%s'
|
||||||
if a:0 >= 4 && a:4 != ''
|
if a:0 >= 4 && a:4 != ''
|
||||||
let cms = cms . <SID>EncodeCommentPart(a:4)
|
let cms = cms . s:EncodeCommentPart(a:4)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
exec <SID>GetCommentString(a:beg, a:end, commentMode)
|
exec s:GetCommentString(a:beg, a:end, commentMode)
|
||||||
endif
|
endif
|
||||||
let cms0 = <SID>BlockGetCommentString(cms)
|
let cms0 = s:BlockGetCommentString(cms)
|
||||||
let cms0 = escape(cms0, '\')
|
let cms0 = escape(cms0, '\')
|
||||||
" make whitespace optional; this conflicts with comments that require some
|
" make whitespace optional; this conflicts with comments that require some
|
||||||
" whitespace
|
" whitespace
|
||||||
let cmtCheck = substitute(cms0, '\([ ]\)', '\1\\?', 'g')
|
let cmtCheck = substitute(cms0, '\([ ]\)', '\1\\?', 'g')
|
||||||
" turn commentstring into a search pattern
|
" turn commentstring into a search pattern
|
||||||
let cmtCheck = <SID>SPrintF(cmtCheck, '\(\_.\{-}\)')
|
let cmtCheck = s:SPrintF(cmtCheck, '\(\_.\{-}\)')
|
||||||
" set commentMode and indentStr
|
" set commentMode and indentStr
|
||||||
exec <SID>CommentDef(a:beg, a:end, cmtCheck, commentMode, cstart, cend)
|
exec s:CommentDef(a:beg, a:end, cmtCheck, commentMode, cstart, cend)
|
||||||
if commentAnyway
|
if commentAnyway
|
||||||
let mode = 0
|
let mode = 0
|
||||||
endif
|
endif
|
||||||
" go
|
" go
|
||||||
if commentMode ==# 'B'
|
if commentMode ==# 'B'
|
||||||
" We want a comment block
|
" We want a comment block
|
||||||
call <SID>CommentBlock(a:beg, a:end, mode, cmtCheck, cms, indentStr)
|
call s:CommentBlock(a:beg, a:end, mode, cmtCheck, cms, indentStr)
|
||||||
else
|
else
|
||||||
" We want commented lines
|
" We want commented lines
|
||||||
" final search pattern for uncommenting
|
" final search pattern for uncommenting
|
||||||
@ -229,27 +236,28 @@ fun! TComment(beg, end, ...)
|
|||||||
" final pattern for commenting
|
" final pattern for commenting
|
||||||
let cmtReplace = escape(cms0, '"/')
|
let cmtReplace = escape(cms0, '"/')
|
||||||
silent exec a:beg .','. a:end .'s/\V'.
|
silent exec a:beg .','. a:end .'s/\V'.
|
||||||
\ <SID>StartRx(cstart) . indentStr .'\zs\(\.\*\)'. <SID>EndRx(cend) .'/'.
|
\ s:StartRx(cstart) . indentStr .'\zs\(\.\*\)'. s:EndRx(cend) .'/'.
|
||||||
\ '\=<SID>ProcessedLine('. mode .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
|
\ '\=s:ProcessedLine('. mode .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
|
||||||
endif
|
endif
|
||||||
" reposition cursor
|
" reposition cursor
|
||||||
silent exec 'norm! '. li .'G'. co .'|'
|
" silent exec 'norm! '. li .'G'. co .'|'
|
||||||
|
call cursor(li, co)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" :line1,line2 TComment ?commentBegin ?commentEnd
|
" :line1,line2 TComment ?commentBegin ?commentEnd
|
||||||
command! -bang -range -nargs=* TComment call TComment(<line1>, <line2>, 'G', "<bang>", <f-args>)
|
command! -bang -range -nargs=* TComment keepjumps call TComment(<line1>, <line2>, 'G', "<bang>", <f-args>)
|
||||||
|
|
||||||
" :line1,line2 TCommentRight ?commentBegin ?commentEnd
|
" :line1,line2 TCommentRight ?commentBegin ?commentEnd
|
||||||
command! -bang -range -nargs=* TCommentRight call TComment(<line1>, <line2>, 'R', "<bang>", <f-args>)
|
command! -bang -range -nargs=* TCommentRight keepjumps call TComment(<line1>, <line2>, 'R', "<bang>", <f-args>)
|
||||||
|
|
||||||
" :line1,line2 TCommentBlock ?commentBegin ?commentEnd
|
" :line1,line2 TCommentBlock ?commentBegin ?commentEnd
|
||||||
command! -bang -range -nargs=* TCommentBlock call TComment(<line1>, <line2>, 'B', "<bang>", <f-args>)
|
command! -bang -range -nargs=* TCommentBlock keepjumps call TComment(<line1>, <line2>, 'B', "<bang>", <f-args>)
|
||||||
|
|
||||||
" :line1,line2 TCommentInline ?commentBegin ?commentEnd
|
" :line1,line2 TCommentInline ?commentBegin ?commentEnd
|
||||||
command! -bang -range -nargs=* TCommentInline call TComment(<line1>, <line2>, 'I', "<bang>", <f-args>)
|
command! -bang -range -nargs=* TCommentInline keepjumps call TComment(<line1>, <line2>, 'I', "<bang>", <f-args>)
|
||||||
|
|
||||||
" :line1,line2 TCommentMaybeInline ?commentBegin ?commentEnd
|
" :line1,line2 TCommentMaybeInline ?commentBegin ?commentEnd
|
||||||
command! -bang -range -nargs=* TCommentMaybeInline call TComment(<line1>, <line2>, 'IG', "<bang>", <f-args>)
|
command! -bang -range -nargs=* TCommentMaybeInline keepjumps call TComment(<line1>, <line2>, 'IG', "<bang>", <f-args>)
|
||||||
|
|
||||||
" comment text as if it were of a specific filetype
|
" comment text as if it were of a specific filetype
|
||||||
fun! TCommentAs(beg, end, commentAnyway, filetype)
|
fun! TCommentAs(beg, end, commentAnyway, filetype)
|
||||||
@ -263,7 +271,7 @@ fun! TCommentAs(beg, end, commentAnyway, filetype)
|
|||||||
let commentMode = 'G'
|
let commentMode = 'G'
|
||||||
let ft = a:filetype
|
let ft = a:filetype
|
||||||
endif
|
endif
|
||||||
exec <SID>GetCommentString(a:beg, a:end, commentMode, ft)
|
exec s:GetCommentString(a:beg, a:end, commentMode, ft)
|
||||||
let pre = substitute(cms, '%s.*$', '', '')
|
let pre = substitute(cms, '%s.*$', '', '')
|
||||||
let pre = substitute(pre, '%%', '%', 'g')
|
let pre = substitute(pre, '%%', '%', 'g')
|
||||||
let post = substitute(cms, '^.\{-}%s', '', '')
|
let post = substitute(cms, '^.\{-}%s', '', '')
|
||||||
@ -275,41 +283,35 @@ endf
|
|||||||
command! -bang -complete=custom,TCommentFileTypes -range -nargs=1 TCommentAs
|
command! -bang -complete=custom,TCommentFileTypes -range -nargs=1 TCommentAs
|
||||||
\ call TCommentAs(<line1>, <line2>, "<bang>", <f-args>)
|
\ call TCommentAs(<line1>, <line2>, "<bang>", <f-args>)
|
||||||
|
|
||||||
if !hasmapto(":TComment<cr>")
|
if (g:tcommentMapLeader1 != '')
|
||||||
noremap <silent> <c-_><c-_> :TComment<cr>
|
exec 'noremap <silent> '. g:tcommentMapLeader1 .'<c-_> :TComment<cr>'
|
||||||
vnoremap <silent> <c-_><c-_> :TCommentMaybeInline<cr>
|
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'<c-_> :TCommentMaybeInline<cr>'
|
||||||
inoremap <silent> <c-_><c-_> <c-o>:TComment<cr>
|
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'<c-_> <c-o>:TComment<cr>'
|
||||||
noremap <silent> <Leader>__ :TComment<cr>
|
exec 'noremap <silent> '. g:tcommentMapLeader1 .'p vip:TComment<cr>'
|
||||||
vnoremap <silent> <Leader>__ :TCommentMaybeInline<cr>
|
exec 'noremap '. g:tcommentMapLeader1 .'<space> :TComment '
|
||||||
|
exec 'inoremap '. g:tcommentMapLeader1 .'<space> <c-o>:TComment '
|
||||||
|
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'r <c-o>:TCommentRight<cr>'
|
||||||
|
exec 'noremap <silent> '. g:tcommentMapLeader1 .'r :TCommentRight<cr>'
|
||||||
|
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'i :TCommentInline<cr>'
|
||||||
|
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'r :TCommentRight<cr>'
|
||||||
|
exec 'noremap '. g:tcommentMapLeader1 .'b :TCommentBlock<cr>'
|
||||||
|
exec 'inoremap '. g:tcommentMapLeader1 .'b <c-o>:TCommentBlock<cr>'
|
||||||
|
exec 'noremap '. g:tcommentMapLeader1 .'a :TCommentAs '
|
||||||
|
exec 'inoremap '. g:tcommentMapLeader1 .'a <c-o>:TCommentAs '
|
||||||
|
exec 'noremap '. g:tcommentMapLeader1 .'s :TCommentAs <c-r>=&ft<cr>_'
|
||||||
|
exec 'inoremap '. g:tcommentMapLeader1 .'s <c-o>:TCommentAs <c-r>=&ft<cr>_'
|
||||||
endif
|
endif
|
||||||
if !hasmapto(":TComment ")
|
if (g:tcommentMapLeader2 != '')
|
||||||
noremap <c-_><space> :TComment
|
exec 'noremap <silent> '. g:tcommentMapLeader2 .'_ :TComment<cr>'
|
||||||
inoremap <c-_><space> <c-o>:TComment
|
exec 'vnoremap <silent> '. g:tcommentMapLeader2 .'_ :TCommentMaybeInline<cr>'
|
||||||
noremap <Leader>_<space> :TComment<cr>
|
exec 'noremap <silent> '. g:tcommentMapLeader2 .'p vip:TComment<cr>'
|
||||||
endif
|
exec 'noremap '. g:tcommentMapLeader2 .'<space> :TComment '
|
||||||
if !hasmapto(":TCommentInline<cr>")
|
exec 'vnoremap <silent> '. g:tcommentMapLeader2 .'i :TCommentInline<cr>'
|
||||||
vnoremap <silent> <c-_>i :TCommentInline<cr>
|
exec 'noremap <silent> '. g:tcommentMapLeader2 .'r :TCommentRight<cr>'
|
||||||
vnoremap <silent> <Leader>_i :TCommentInline<cr>
|
exec 'vnoremap <silent> '. g:tcommentMapLeader2 .'r :TCommentRight<cr>'
|
||||||
endif
|
exec 'noremap '. g:tcommentMapLeader2 .'b :TCommentBlock<cr>'
|
||||||
if !hasmapto(":TCommentRight<cr>")
|
exec 'noremap '. g:tcommentMapLeader2 .'a :TCommentAs '
|
||||||
inoremap <silent> <c-_>r <c-o>:TCommentRight<cr>
|
exec 'noremap '. g:tcommentMapLeader2 .'s :TCommentAs <c-r>=&ft<cr>_'
|
||||||
noremap <silent> <c-_>r :TCommentRight<cr>
|
|
||||||
noremap <silent> <Leader>_r :TCommentRight<cr>
|
|
||||||
vnoremap <silent> <c-_>r :TCommentRight<cr>
|
|
||||||
vnoremap <silent> <Leader>_r :TCommentRight<cr>
|
|
||||||
endif
|
|
||||||
if !hasmapto(":TCommentBlock<cr>")
|
|
||||||
noremap <c-_>b :TCommentBlock<cr>
|
|
||||||
noremap <Leader>_b :TCommentBlock<cr>
|
|
||||||
inoremap <c-_>b <c-o>:TCommentBlock<cr>
|
|
||||||
endif
|
|
||||||
if !hasmapto(":TCommentAs")
|
|
||||||
noremap <c-_>a :TCommentAs
|
|
||||||
noremap <Leader>_a :TCommentAs
|
|
||||||
inoremap <c-_>a <c-o>:TCommentAs
|
|
||||||
noremap <c-_>s :TCommentAs <c-r>=&ft<cr>_
|
|
||||||
noremap <Leader>_s :TCommentAs <c-r>=&ft<cr>_
|
|
||||||
inoremap <c-_>s <c-o>:TCommentAs <c-r>=&ft<cr>_
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -345,16 +347,16 @@ fun! TCommentFileTypes(ArgLead, CmdLine, CursorPos)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>EncodeCommentPart(string)
|
fun! s:EncodeCommentPart(string)
|
||||||
return substitute(a:string, '%', '%%', 'g')
|
return substitute(a:string, '%', '%%', 'g')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" <SID>GetCommentString(beg, end, commentMode, ?filetype="")
|
" s:GetCommentString(beg, end, commentMode, ?filetype="")
|
||||||
" => RecordCMS
|
" => RecordCMS
|
||||||
fun! <SID>GetCommentString(beg, end, commentMode, ...)
|
fun! s:GetCommentString(beg, end, commentMode, ...)
|
||||||
let ft = a:0 >= 1 ? a:1 : ''
|
let ft = a:0 >= 1 ? a:1 : ''
|
||||||
if ft != ''
|
if ft != ''
|
||||||
exec <SID>GetCustomCommentString(ft, a:commentMode)
|
exec s:GetCustomCommentString(ft, a:commentMode)
|
||||||
else
|
else
|
||||||
let cms = ''
|
let cms = ''
|
||||||
let commentMode = a:commentMode
|
let commentMode = a:commentMode
|
||||||
@ -362,13 +364,13 @@ fun! <SID>GetCommentString(beg, end, commentMode, ...)
|
|||||||
if cms == ''
|
if cms == ''
|
||||||
if exists('b:commentstring')
|
if exists('b:commentstring')
|
||||||
let cms = b:commentstring
|
let cms = b:commentstring
|
||||||
return <SID>GetCustomCommentString(&filetype, a:commentMode, cms)
|
return s:GetCustomCommentString(&filetype, a:commentMode, cms)
|
||||||
elseif exists('b:commentStart') && b:commentStart != ''
|
elseif exists('b:commentStart') && b:commentStart != ''
|
||||||
let cms = <SID>EncodeCommentPart(b:commentStart) .' %s'
|
let cms = s:EncodeCommentPart(b:commentStart) .' %s'
|
||||||
if exists('b:commentEnd') && b:commentEnd != ''
|
if exists('b:commentEnd') && b:commentEnd != ''
|
||||||
let cms = cms .' '. <SID>EncodeCommentPart(b:commentEnd)
|
let cms = cms .' '. s:EncodeCommentPart(b:commentEnd)
|
||||||
endif
|
endif
|
||||||
return <SID>GetCustomCommentString(&filetype, a:commentMode, cms)
|
return s:GetCustomCommentString(&filetype, a:commentMode, cms)
|
||||||
elseif g:tcommentGuessFileType || (exists('g:tcommentGuessFileType_'. &filetype)
|
elseif g:tcommentGuessFileType || (exists('g:tcommentGuessFileType_'. &filetype)
|
||||||
\ && g:tcommentGuessFileType_{&filetype} =~ '[^0]')
|
\ && g:tcommentGuessFileType_{&filetype} =~ '[^0]')
|
||||||
if g:tcommentGuessFileType_{&filetype} == 1
|
if g:tcommentGuessFileType_{&filetype} == 1
|
||||||
@ -376,17 +378,17 @@ fun! <SID>GetCommentString(beg, end, commentMode, ...)
|
|||||||
else
|
else
|
||||||
let altFiletype = g:tcommentGuessFileType_{&filetype}
|
let altFiletype = g:tcommentGuessFileType_{&filetype}
|
||||||
endif
|
endif
|
||||||
return <SID>GuessFileType(a:beg, a:end, a:commentMode, altFiletype)
|
return s:GuessFileType(a:beg, a:end, a:commentMode, &filetype, altFiletype)
|
||||||
else
|
else
|
||||||
return <SID>GetCustomCommentString(&filetype, a:commentMode, <SID>GuessCurrentCommentString(a:commentMode))
|
return s:GetCustomCommentString(&filetype, a:commentMode, s:GuessCurrentCommentString(a:commentMode))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return <SID>RecordCMS(cms, commentMode)
|
return s:RecordCMS(cms, commentMode)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" <SID>SPrintF(formatstring, ?values ...)
|
" s:SPrintF(formatstring, ?values ...)
|
||||||
" => string
|
" => string
|
||||||
fun! <SID>SPrintF(string, ...)
|
fun! s:SPrintF(string, ...)
|
||||||
let n = 1
|
let n = 1
|
||||||
let r = ''
|
let r = ''
|
||||||
let s = a:string
|
let s = a:string
|
||||||
@ -419,7 +421,7 @@ fun! <SID>SPrintF(string, ...)
|
|||||||
endwh
|
endwh
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>StartRx(pos)
|
fun! s:StartRx(pos)
|
||||||
if a:pos == 0
|
if a:pos == 0
|
||||||
return '\^'
|
return '\^'
|
||||||
else
|
else
|
||||||
@ -427,7 +429,7 @@ fun! <SID>StartRx(pos)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>EndRx(pos)
|
fun! s:EndRx(pos)
|
||||||
if a:pos == 0
|
if a:pos == 0
|
||||||
return '\$'
|
return '\$'
|
||||||
else
|
else
|
||||||
@ -435,26 +437,26 @@ fun! <SID>EndRx(pos)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>GetIndentString(line, start)
|
fun! s:GetIndentString(line, start)
|
||||||
let start = a:start > 0 ? a:start - 1 : 0
|
let start = a:start > 0 ? a:start - 1 : 0
|
||||||
return substitute(strpart(getline(a:line), start), '\V\^\s\*\zs\.\*\$', '', '')
|
return substitute(strpart(getline(a:line), start), '\V\^\s\*\zs\.\*\$', '', '')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
fun! s:CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
||||||
let mdrx = '\V'. <SID>StartRx(a:cstart) .'\s\*'. a:checkRx .'\s\*'. <SID>EndRx(0)
|
let mdrx = '\V'. s:StartRx(a:cstart) .'\s\*'. a:checkRx .'\s\*'. s:EndRx(0)
|
||||||
let line = getline(a:beg)
|
let line = getline(a:beg)
|
||||||
if a:cstart != 0 && a:cend != 0
|
if a:cstart != 0 && a:cend != 0
|
||||||
let line = strpart(line, 0, a:cend - 1)
|
let line = strpart(line, 0, a:cend - 1)
|
||||||
endif
|
endif
|
||||||
let mode = (line =~ mdrx)
|
let mode = (line =~ mdrx)
|
||||||
let it = <SID>GetIndentString(a:beg, a:cstart)
|
let it = s:GetIndentString(a:beg, a:cstart)
|
||||||
let il = indent(a:beg)
|
let il = indent(a:beg)
|
||||||
let n = a:beg + 1
|
let n = a:beg + 1
|
||||||
while n <= a:end
|
while n <= a:end
|
||||||
if getline(n) =~ '\S'
|
if getline(n) =~ '\S'
|
||||||
let jl = indent(n)
|
let jl = indent(n)
|
||||||
if jl < il
|
if jl < il
|
||||||
let it = <SID>GetIndentString(n, a:cstart)
|
let it = s:GetIndentString(n, a:cstart)
|
||||||
let il = jl
|
let il = jl
|
||||||
endif
|
endif
|
||||||
if a:commentMode ==# 'G'
|
if a:commentMode ==# 'G'
|
||||||
@ -477,7 +479,7 @@ fun! <SID>CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
|||||||
return 'let indentStr="'. it .'" | let mode='. mode
|
return 'let indentStr="'. it .'" | let mode='. mode
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>ProcessedLine(mode, match, checkRx, replace)
|
fun! s:ProcessedLine(mode, match, checkRx, replace)
|
||||||
if !(a:match =~ '\S' || g:tcommentBlankLines)
|
if !(a:match =~ '\S' || g:tcommentBlankLines)
|
||||||
return a:match
|
return a:match
|
||||||
endif
|
endif
|
||||||
@ -486,18 +488,18 @@ fun! <SID>ProcessedLine(mode, match, checkRx, replace)
|
|||||||
let rv = substitute(a:match, a:checkRx, '\1\2', '')
|
let rv = substitute(a:match, a:checkRx, '\1\2', '')
|
||||||
else
|
else
|
||||||
" comment
|
" comment
|
||||||
let rv = <SID>SPrintF(a:replace, a:match)
|
let rv = s:SPrintF(a:replace, a:match)
|
||||||
endif
|
endif
|
||||||
let rv = escape(rv, '\
')
|
let rv = escape(rv, '\
')
|
||||||
let rv = substitute(rv, '\n', '\\\n', 'g')
|
let rv = substitute(rv, '\n', '\\\n', 'g')
|
||||||
return rv
|
return rv
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>CommentBlock(beg, end, mode, checkRx, replace, indentStr)
|
fun! s:CommentBlock(beg, end, mode, checkRx, replace, indentStr)
|
||||||
let t = @t
|
let t = @t
|
||||||
try
|
try
|
||||||
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td'
|
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td'
|
||||||
let ms = <SID>BlockGetMiddleString(a:replace)
|
let ms = s:BlockGetMiddleString(a:replace)
|
||||||
let mx = escape(ms, '\')
|
let mx = escape(ms, '\')
|
||||||
if a:mode
|
if a:mode
|
||||||
" uncomment
|
" uncomment
|
||||||
@ -509,7 +511,7 @@ fun! <SID>CommentBlock(beg, end, mode, checkRx, replace, indentStr)
|
|||||||
let @t = substitute(@t, '\n\s*$', '', '')
|
let @t = substitute(@t, '\n\s*$', '', '')
|
||||||
else
|
else
|
||||||
" comment
|
" comment
|
||||||
let cs = <SID>BlockGetCommentString(a:replace)
|
let cs = s:BlockGetCommentString(a:replace)
|
||||||
let cs = a:indentStr . substitute(cs, '%s', '%s'. a:indentStr, '')
|
let cs = a:indentStr . substitute(cs, '%s', '%s'. a:indentStr, '')
|
||||||
if ms != ''
|
if ms != ''
|
||||||
let ms = a:indentStr . ms
|
let ms = a:indentStr . ms
|
||||||
@ -517,7 +519,7 @@ fun! <SID>CommentBlock(beg, end, mode, checkRx, replace, indentStr)
|
|||||||
let @t = substitute(@t, '^'. a:indentStr, '', 'g')
|
let @t = substitute(@t, '^'. a:indentStr, '', 'g')
|
||||||
let @t = ms . substitute(@t, '\n'. a:indentStr, '\n'. mx, 'g')
|
let @t = ms . substitute(@t, '\n'. a:indentStr, '\n'. mx, 'g')
|
||||||
endif
|
endif
|
||||||
let @t = <SID>SPrintF(cs, "\n". @t ."\n")
|
let @t = s:SPrintF(cs, "\n". @t ."\n")
|
||||||
endif
|
endif
|
||||||
silent norm! "tP
|
silent norm! "tP
|
||||||
finally
|
finally
|
||||||
@ -527,17 +529,17 @@ endf
|
|||||||
|
|
||||||
" inspired by Meikel Brandmeyer's EnhancedCommentify.vim
|
" inspired by Meikel Brandmeyer's EnhancedCommentify.vim
|
||||||
" this requires that a syntax names are prefixed by the filetype name
|
" this requires that a syntax names are prefixed by the filetype name
|
||||||
" <SID>GuessFileType(beg, end, commentMode, ?fallbackFiletype)
|
" s:GuessFileType(beg, end, commentMode, filetype, ?fallbackFiletype)
|
||||||
" => RecordCMS
|
" => RecordCMS
|
||||||
fun! <SID>GuessFileType(beg, end, commentMode, ...)
|
fun! s:GuessFileType(beg, end, commentMode, filetype, ...)
|
||||||
if a:0 >= 1 && a:1 != ''
|
if a:0 >= 1 && a:1 != ''
|
||||||
exec <SID>GetCustomCommentString(a:1, a:commentMode)
|
exec s:GetCustomCommentString(a:1, a:commentMode)
|
||||||
if cms == ''
|
if cms == ''
|
||||||
let cms = <SID>GuessCurrentCommentString(a:commentMode)
|
let cms = s:GuessCurrentCommentString(a:commentMode)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let commentMode = 'G'
|
let commentMode = 'G'
|
||||||
let cms = <SID>GuessCurrentCommentString(0)
|
let cms = s:GuessCurrentCommentString(0)
|
||||||
endif
|
endif
|
||||||
let n = a:beg
|
let n = a:beg
|
||||||
while n <= a:end
|
while n <= a:end
|
||||||
@ -547,7 +549,11 @@ fun! <SID>GuessFileType(beg, end, commentMode, ...)
|
|||||||
let syntaxName = synIDattr(synID(n, m, 1), 'name')
|
let syntaxName = synIDattr(synID(n, m, 1), 'name')
|
||||||
if syntaxName =~ g:tcommentFileTypesRx
|
if syntaxName =~ g:tcommentFileTypesRx
|
||||||
let ft = substitute(syntaxName, g:tcommentFileTypesRx, '\1', '')
|
let ft = substitute(syntaxName, g:tcommentFileTypesRx, '\1', '')
|
||||||
return <SID>GetCustomCommentString(ft, a:commentMode, cms)
|
if exists('g:tcommentIgnoreTypes_'. a:filetype) && g:tcommentIgnoreTypes_{a:filetype} =~ '\<'.ft.'\>'
|
||||||
|
let m = m + 1
|
||||||
|
else
|
||||||
|
return s:GetCustomCommentString(ft, a:commentMode, cms)
|
||||||
|
endif
|
||||||
elseif syntaxName == '' || syntaxName == 'None' || syntaxName =~ '^\u\+$' || syntaxName =~ '^\u\U*$'
|
elseif syntaxName == '' || syntaxName == 'None' || syntaxName =~ '^\u\+$' || syntaxName =~ '^\u\U*$'
|
||||||
let m = m + 1
|
let m = m + 1
|
||||||
else
|
else
|
||||||
@ -556,10 +562,10 @@ fun! <SID>GuessFileType(beg, end, commentMode, ...)
|
|||||||
endwh
|
endwh
|
||||||
let n = n + 1
|
let n = n + 1
|
||||||
endwh
|
endwh
|
||||||
return <SID>RecordCMS(cms, commentMode)
|
return s:RecordCMS(cms, commentMode)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>GuessCurrentCommentString(commentMode)
|
fun! s:GuessCurrentCommentString(commentMode)
|
||||||
let valid_cms = (stridx(&commentstring, '%s') != -1)
|
let valid_cms = (stridx(&commentstring, '%s') != -1)
|
||||||
if &commentstring != s:defaultCommentString && valid_cms
|
if &commentstring != s:defaultCommentString && valid_cms
|
||||||
" The &commentstring appears to have been set and to be valid
|
" The &commentstring appears to have been set and to be valid
|
||||||
@ -568,7 +574,7 @@ fun! <SID>GuessCurrentCommentString(commentMode)
|
|||||||
if &comments != s:defaultComments
|
if &comments != s:defaultComments
|
||||||
" the commentstring is the default one, so we assume that it wasn't
|
" the commentstring is the default one, so we assume that it wasn't
|
||||||
" explicitly set; we then try to reconstruct &cms from &comments
|
" explicitly set; we then try to reconstruct &cms from &comments
|
||||||
let cms = <SID>ConstructFromComments(a:commentMode)
|
let cms = s:ConstructFromComments(a:commentMode)
|
||||||
if cms != s:nullCommentString
|
if cms != s:nullCommentString
|
||||||
return cms
|
return cms
|
||||||
endif
|
endif
|
||||||
@ -583,16 +589,16 @@ fun! <SID>GuessCurrentCommentString(commentMode)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>ConstructFromComments(commentMode)
|
fun! s:ConstructFromComments(commentMode)
|
||||||
exec <SID>ExtractCommentsPart('')
|
exec s:ExtractCommentsPart('')
|
||||||
if a:commentMode == 'G' && line != ''
|
if a:commentMode == 'G' && line != ''
|
||||||
return line .' %s'
|
return line .' %s'
|
||||||
endif
|
endif
|
||||||
exec <SID>ExtractCommentsPart('s')
|
exec s:ExtractCommentsPart('s')
|
||||||
if s != ''
|
if s != ''
|
||||||
exec <SID>ExtractCommentsPart('e')
|
exec s:ExtractCommentsPart('e')
|
||||||
" if a:commentMode
|
" if a:commentMode
|
||||||
" exec <SID>ExtractCommentsPart("m")
|
" exec s:ExtractCommentsPart("m")
|
||||||
" if m != ""
|
" if m != ""
|
||||||
" let m = "\n". m
|
" let m = "\n". m
|
||||||
" endif
|
" endif
|
||||||
@ -608,7 +614,7 @@ fun! <SID>ConstructFromComments(commentMode)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>ExtractCommentsPart(key)
|
fun! s:ExtractCommentsPart(key)
|
||||||
" let key = a:key != "" ? a:key .'[^:]*' : ""
|
" let key = a:key != "" ? a:key .'[^:]*' : ""
|
||||||
let key = a:key . '[bnflrxO0-9-]*'
|
let key = a:key . '[bnflrxO0-9-]*'
|
||||||
let val = substitute(&comments, '^\(.\{-},\)\{-}'. key .':\([^,]\+\).*$', '\2', '')
|
let val = substitute(&comments, '^\(.\{-},\)\{-}'. key .':\([^,]\+\).*$', '\2', '')
|
||||||
@ -621,9 +627,9 @@ fun! <SID>ExtractCommentsPart(key)
|
|||||||
return 'let '. var .'="'. escape(val, '"') .'"'
|
return 'let '. var .'="'. escape(val, '"') .'"'
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" <SID>GetCustomCommentString(ft, commentMode, ?default="")
|
" s:GetCustomCommentString(ft, commentMode, ?default="")
|
||||||
" => RecordCMS
|
" => RecordCMS
|
||||||
fun! <SID>GetCustomCommentString(ft, commentMode, ...)
|
fun! s:GetCustomCommentString(ft, commentMode, ...)
|
||||||
let commentMode = a:commentMode
|
let commentMode = a:commentMode
|
||||||
let customComment = exists('g:tcomment_'. a:ft)
|
let customComment = exists('g:tcomment_'. a:ft)
|
||||||
if commentMode ==# 'B' && exists('g:tcomment_'. a:ft .'_block')
|
if commentMode ==# 'B' && exists('g:tcomment_'. a:ft .'_block')
|
||||||
@ -640,18 +646,18 @@ fun! <SID>GetCustomCommentString(ft, commentMode, ...)
|
|||||||
let cms = ''
|
let cms = ''
|
||||||
let commentMode = 'G'
|
let commentMode = 'G'
|
||||||
endif
|
endif
|
||||||
return <SID>RecordCMS(cms, commentMode)
|
return s:RecordCMS(cms, commentMode)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>RecordCMS(cms, commentMode)
|
fun! s:RecordCMS(cms, commentMode)
|
||||||
return 'let cms="'. escape(a:cms, '"') .'" | let commentMode="'. a:commentMode .'"'
|
return 'let cms="'. escape(a:cms, '"') .'" | let commentMode="'. a:commentMode .'"'
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>BlockGetCommentString(cms)
|
fun! s:BlockGetCommentString(cms)
|
||||||
return substitute(a:cms, '\n.*$', '', '')
|
return substitute(a:cms, '\n.*$', '', '')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! <SID>BlockGetMiddleString(cms)
|
fun! s:BlockGetMiddleString(cms)
|
||||||
let rv = substitute(a:cms, '^.\{-}\n\([^\n]*\)', '\1', '')
|
let rv = substitute(a:cms, '^.\{-}\n\([^\n]*\)', '\1', '')
|
||||||
return rv == a:cms ? '' : rv
|
return rv == a:cms ? '' : rv
|
||||||
endf
|
endf
|
||||||
@ -708,3 +714,13 @@ defining a new filetype via TCommentDefineType()
|
|||||||
- Renamed TCommentVisualBlock to TCommentRight
|
- Renamed TCommentVisualBlock to TCommentRight
|
||||||
- FIX: Forgot 'x' in ExtractCommentsPart() (thanks to Fredrik Acosta)
|
- FIX: Forgot 'x' in ExtractCommentsPart() (thanks to Fredrik Acosta)
|
||||||
|
|
||||||
|
1.6
|
||||||
|
- Ignore sql when guessing the comment string in php files; tComment
|
||||||
|
sometimes chooses the wrong comment string because the use of sql syntax
|
||||||
|
is used too loosely in php files; if you want to comment embedded sql
|
||||||
|
code you have to use TCommentAs
|
||||||
|
- Use keepjumps in commands.
|
||||||
|
- Map <c-_>p & <L>_p to vip:TComment<cr>
|
||||||
|
- Made key maps configurable via g:tcommentMapLeader1 and
|
||||||
|
g:tcommentMapLeader2
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>)
|
|||||||
com! -na=0 VimballList call vimball#Vimball(0)
|
com! -na=0 VimballList call vimball#Vimball(0)
|
||||||
com! -na=* -complete=dir RmVimball call vimball#RmVimball(<f-args>)
|
com! -na=* -complete=dir RmVimball call vimball#RmVimball(<f-args>)
|
||||||
au BufEnter *.vba.gz,*.vba.bz2,*.vba.zip call vimball#Decompress(expand("<amatch>"))
|
au BufEnter *.vba.gz,*.vba.bz2,*.vba.zip call vimball#Decompress(expand("<amatch>"))
|
||||||
au BufEnter *.vba set noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
|
au BufEnter *.vba setlocal noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
|
||||||
|
|
||||||
" =====================================================================
|
" =====================================================================
|
||||||
" Restoration And Modelines: {{{1
|
" Restoration And Modelines: {{{1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user