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:
stefan 2007-06-15 08:16:32 +00:00
parent bbfb723a98
commit 15fe42916b
15 changed files with 8991 additions and 8669 deletions

View File

@ -0,0 +1 @@
c:\tools\vim\vim71\gvim.exe -c "DirDiff %1 %2"

View File

@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,183 +1,189 @@
" 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
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
" netrwSettings.vim is provided *as is* and comes with no " netrwSettings.vim is provided *as is* and comes with no
" warranty of any kind, either expressed or implied. By using " warranty of any kind, either expressed or implied. By using
" this plugin, you agree that in no event will the copyright " this plugin, you agree that in no event will the copyright
" holder be liable for any damages resulting from the use " holder be liable for any damages resulting from the use
" of this software. " of this software.
" "
" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1 " Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
" synagogues, preaching the gospel of the kingdom, and healing " synagogues, preaching the gospel of the kingdom, and healing
" every disease and every sickness among the people. " every disease and every sickness among the people.
" Load Once: {{{1 " Load Once: {{{1
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
fun! netrwSettings#NetrwSettings() fun! netrwSettings#NetrwSettings()
" this call is here largely just to insure that netrw has been loaded " this call is here largely just to insure that netrw has been loaded
call netrw#NetSavePosn() call netrw#NetSavePosn()
if !exists("g:loaded_netrw") if !exists("g:loaded_netrw")
echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
return return
endif endif
above wincmd s above wincmd s
enew enew
setlocal noswapfile bh=wipe setlocal noswapfile bh=wipe
set ft=vim set ft=vim
file Netrw\ Settings file Netrw\ Settings
" these variables have the following default effects when they don't " these variables have the following default effects when they don't
" exist (ie. have not been set by the user in his/her .vimrc) " exist (ie. have not been set by the user in his/her .vimrc)
if !exists("g:netrw_liststyle") if !exists("g:netrw_liststyle")
let g:netrw_liststyle= 0 let g:netrw_liststyle= 0
let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa" let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
endif endif
if !exists("g:netrw_silent") if !exists("g:netrw_silent")
let g:netrw_silent= 0 let g:netrw_silent= 0
endif endif
if !exists("g:netrw_use_nt_rcp") if !exists("g:netrw_use_nt_rcp")
let g:netrw_use_nt_rcp= 0 let g:netrw_use_nt_rcp= 0
endif endif
if !exists("g:netrw_ftp") if !exists("g:netrw_ftp")
let g:netrw_ftp= 0 let g:netrw_ftp= 0
endif endif
if !exists("g:netrw_ignorenetrc") if !exists("g:netrw_ignorenetrc")
let g:netrw_ignorenetrc= 0 let g:netrw_ignorenetrc= 0
endif endif
put ='+ ---------------------------------------------' put ='+ ---------------------------------------------'
put ='+ NetrwSettings: by Charles E. Campbell, Jr.' put ='+ NetrwSettings: by Charles E. Campbell, Jr.'
put ='+ Press <F1> with cursor atop any line for help' put ='+ Press <F1> with cursor atop any line for help'
put ='+ ---------------------------------------------' put ='+ ---------------------------------------------'
let s:netrw_settings_stop= line(".") let s:netrw_settings_stop= line(".")
put ='' put =''
put ='+ Netrw Protocol Commands' put ='+ Netrw Protocol Commands'
put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd
put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd
put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd
put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd
put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd
put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd
put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd
put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
let s:netrw_protocol_stop= line(".") let s:netrw_protocol_stop= line(".")
put = '' put = ''
put ='+Netrw Transfer Control' put ='+Netrw Transfer Control'
put = 'let g:netrw_cygwin = '.g:netrw_cygwin put = 'let g:netrw_cygwin = '.g:netrw_cygwin
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
let shqline= line("$") put = 'let g:netrw_sshport = '.g:netrw_sshport
put = 'let g:netrw_shq...' let shqline= line("$")
put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp put = 'let g:netrw_shq...'
put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
let s:netrw_xfer_stop= line(".") put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
let s:netrw_xfer_stop= line(".")
put = '' put =''
put ='+ Netrw Browser Control' put ='+ Netrw Messages'
put = 'let g:netrw_alto = '.g:netrw_alto put ='let g:netrw_use_errorwindow = '.g:netrw_use_errorwindow
put = 'let g:netrw_altv = '.g:netrw_altv
put = 'let g:netrw_browse_split = '.g:netrw_browse_split put = ''
if exists("g:netrw_browsex_viewer") put ='+ Netrw Browser Control'
put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer put = 'let g:netrw_alto = '.g:netrw_alto
else put = 'let g:netrw_altv = '.g:netrw_altv
put = 'let g:netrw_browsex_viewer = (not defined)' put = 'let g:netrw_browse_split = '.g:netrw_browse_split
endif if exists("g:netrw_browsex_viewer")
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse else
put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject put = 'let g:netrw_browsex_viewer = (not defined)'
put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd endif
put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
put = 'let g:netrw_hide = '.g:netrw_hide put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
put = 'let g:netrw_keepdir = '.g:netrw_keepdir put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
put = 'let g:netrw_list_hide = '.g:netrw_list_hide put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir put = 'let g:netrw_hide = '.g:netrw_hide
put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir put = 'let g:netrw_keepdir = '.g:netrw_keepdir
put = 'let g:netrw_liststyle = '.g:netrw_liststyle put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen put = 'let g:netrw_list_hide = '.g:netrw_list_hide
put = 'let g:netrw_menu = '.g:netrw_menu put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir
put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir
put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd put = 'let g:netrw_liststyle = '.g:netrw_liststyle
put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd put = 'let g:netrw_menu = '.g:netrw_menu
put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
put = 'let g:netrw_silent = '.g:netrw_silent put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
put = 'let g:netrw_sort_by = '.g:netrw_sort_by put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject put = 'let g:netrw_silent = '.g:netrw_silent
put = 'let g:netrw_timefmt = '.g:netrw_timefmt put = 'let g:netrw_sort_by = '.g:netrw_sort_by
put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
put = 'let g:netrw_winsize = '.g:netrw_winsize put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
put ='' put = 'let g:netrw_scpport = '.g:netrw_scpport
put ='+ For help, place cursor on line and press ?' put = 'let g:netrw_sshport = '.g:netrw_sshport
put = 'let g:netrw_timefmt = '.g:netrw_timefmt
1d put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf
silent %s/^+/"/e put = 'let g:netrw_winsize = '.g:netrw_winsize
res 99
silent %s/= \([^0-9].*\)$/= '\1'/e put =''
silent %s/= $/= ''/e put ='+ For help, place cursor on line and press <F1>'
1
1d
" Put in shq setting. silent %s/^+/"/e
" (deferred so as to avoid the quote manipulation just preceding) res 99
if g:netrw_shq == "'" silent %s/= \([^0-9].*\)$/= '\1'/e
call setline(shqline,'let g:netrw_shq = "'.g:netrw_shq.'"') silent %s/= $/= ''/e
else 1
call setline(shqline,"let g:netrw_shq = '".g:netrw_shq."'")
endif " Put in shq setting.
" (deferred so as to avoid the quote manipulation just preceding)
set nomod if g:netrw_shq == "'"
call setline(shqline,'let g:netrw_shq = "'.g:netrw_shq.'"')
nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr> else
nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr> call setline(shqline,"let g:netrw_shq = '".g:netrw_shq."'")
let tmpfile= tempname() endif
exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
endfun set nomod
" --------------------------------------------------------------------- nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr>
" NetrwSettingHelp: {{{2 nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr>
fun! NetrwSettingHelp() let tmpfile= tempname()
" call Dfunc("NetrwSettingHelp()") exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
let curline = getline(".") endfun
if curline =~ '='
let varhelp = substitute(curline,'^\s*let ','','e') " ---------------------------------------------------------------------
let varhelp = substitute(varhelp,'\s*=.*$','','e') " NetrwSettingHelp: {{{2
" call Decho("trying help ".varhelp) fun! NetrwSettingHelp()
try " call Dfunc("NetrwSettingHelp()")
exe "he ".varhelp let curline = getline(".")
catch /^Vim\%((\a\+)\)\=:E149/ if curline =~ '='
echo "***sorry*** no help available for <".varhelp.">" let varhelp = substitute(curline,'^\s*let ','','e')
endtry let varhelp = substitute(varhelp,'\s*=.*$','','e')
elseif line(".") < s:netrw_settings_stop " call Decho("trying help ".varhelp)
he netrw-settings try
elseif line(".") < s:netrw_protocol_stop exe "he ".varhelp
he netrw-externapp catch /^Vim\%((\a\+)\)\=:E149/
elseif line(".") < s:netrw_xfer_stop echo "***sorry*** no help available for <".varhelp.">"
he netrw-variables endtry
else elseif line(".") < s:netrw_settings_stop
he netrw-browse-var he netrw-settings
endif elseif line(".") < s:netrw_protocol_stop
" call Dret("NetrwSettingHelp") he netrw-externapp
endfun elseif line(".") < s:netrw_xfer_stop
he netrw-variables
" --------------------------------------------------------------------- else
" Modelines: {{{1 he netrw-browse-var
" vim:ts=8 fdm=marker endif
" call Dret("NetrwSettingHelp")
endfun
" ---------------------------------------------------------------------
" Modelines: {{{1
" vim:ts=8 fdm=marker

View File

@ -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")

View File

@ -1,406 +1,408 @@
*pi_getscript.txt* For Vim version 7.0. Last change: 2006 Nov 1 *pi_getscript.txt* For Vim version 7.0. Last change: 2006 Nov 1
> >
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr. GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr.
< <
Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz> Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
(remove NOSPAM from the email address) (remove NOSPAM from the email address)
*GetLatestVimScripts-copyright* *GetLatestVimScripts-copyright*
Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *glvs-copyright* Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *glvs-copyright*
The VIM LICENSE applies to getscript.vim and The VIM LICENSE applies to getscript.vim and
pi_getscript.txt (see |copyright|) except use pi_getscript.txt (see |copyright|) except use
"getscript" instead of "Vim". No warranty, express or implied. "getscript" instead of "Vim". No warranty, express or implied.
Use At-Your-Own-Risk. Use At-Your-Own-Risk.
Getscript is a plugin that simplifies retrieval of the latest versions of the Getscript is a plugin that simplifies retrieval of the latest versions of the
scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will
then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
get the latest versions of scripts listed therein from http://vim.sf.net/. get the latest versions of scripts listed therein from http://vim.sf.net/.
============================================================================== ==============================================================================
1. Contents *glvs-contents* *glvs* *getscript* 1. Contents *glvs-contents* *glvs* *getscript*
*GetLatestVimScripts* *GetLatestVimScripts*
1. Contents........................................: |glvs-contents| 1. Contents........................................: |glvs-contents|
2. GetLatestVimScripts -- Getting Started..........: |glvs-install| 2. GetLatestVimScripts -- Getting Started..........: |glvs-install|
3. GetLatestVimScripts Usage.......................: |glvs-usage| 3. GetLatestVimScripts Usage.......................: |glvs-usage|
4. GetLatestVimScripts Data File...................: |glvs-data| 4. GetLatestVimScripts Data File...................: |glvs-data|
5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins| 5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins|
6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall| 6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall|
7. GetLatestViMScripts Options.....................: |glvs-options| 7. GetLatestViMScripts Options.....................: |glvs-options|
8. GetLatestVimScripts Algorithm...................: |glvs-alg| 8. GetLatestVimScripts Algorithm...................: |glvs-alg|
9. GetLatestVimScripts History.....................: |glvs-hist| 9. GetLatestVimScripts History.....................: |glvs-hist|
============================================================================== ==============================================================================
2. GetLatestVimScripts -- Getting Started *getscript-start* 2. GetLatestVimScripts -- Getting Started *getscript-start*
*getlatestvimscripts-install* *getlatestvimscripts-install*
VERSION FROM VIM DISTRIBUTION *glvs-dist-install* VERSION FROM VIM DISTRIBUTION *glvs-dist-install*
Vim 7.0 does not include the GetLatestVimScripts.dist file which Vim 7.0 does not include the GetLatestVimScripts.dist file which
serves as an example and a template. So, you'll need to create serves as an example and a template. So, you'll need to create
your own! See |GetLatestVimScripts_dat|. your own! See |GetLatestVimScripts_dat|.
VERSION FROM VIM SF NET *glvs-install* VERSION FROM VIM SF NET *glvs-install*
NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist
file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for
the first time. the first time.
The GetLatestVimScripts.dist file serves as an example and a template for your The GetLatestVimScripts.dist file serves as an example and a template for your
own personal list. Feel free to remove all the scripts mentioned within it; own personal list. Feel free to remove all the scripts mentioned within it;
the "important" part of it is the first two lines. the "important" part of it is the first two lines.
Your computer needs to have wget for GetLatestVimScripts to do its work. Your computer needs to have wget for GetLatestVimScripts to do its work.
1. if compressed: gunzip getscript.vba.gz 1. if compressed: gunzip getscript.vba.gz
2. Unix: 2. Unix:
vim getscript.vba vim getscript.vba
:so % :so %
:q :q
cd ~/.vim/GetLatest cd ~/.vim/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(edit GetLatestVimScripts.dat to install your own personal (edit GetLatestVimScripts.dat to install your own personal
list of desired plugins -- see |GetLatestVimScripts_dat|) list of desired plugins -- see |GetLatestVimScripts_dat|)
3. Windows: 3. Windows:
vim getscript.vba vim getscript.vba
:so % :so %
:q :q
cd **path-to-vimfiles**/GetLatest cd **path-to-vimfiles**/GetLatest
mv GetLatestVimScripts.dist GetLatestVimScripts.dat mv GetLatestVimScripts.dist GetLatestVimScripts.dat
(edit GetLatestVimScripts.dat to install your own personal (edit GetLatestVimScripts.dat to install your own personal
list of desired plugins -- see |GetLatestVimScripts_dat|) list of desired plugins -- see |GetLatestVimScripts_dat|)
============================================================================== ==============================================================================
3. GetLatestVimScripts Usage *glvs-usage* *:GLVS* 3. GetLatestVimScripts Usage *glvs-usage* *:GLVS*
Unless its been defined elsewhere, > Unless its been defined elsewhere, >
:GLVS :GLVS
will invoke GetLatestVimScripts(). If some other plugin has defined that will invoke GetLatestVimScripts(). If some other plugin has defined that
command, then you may type command, then you may type
> >
:GetLatestVimScripts :GetLatestVimScripts
< <
The script will attempt to update and, if permitted, will automatically The script will attempt to update and, if permitted, will automatically
install scripts from http://vim.sourceforge.net/. To do so it will peruse a install scripts from http://vim.sourceforge.net/. To do so it will peruse a
file, file,
> >
.vim/GetLatest/GetLatestVimScripts.dat (unix) .vim/GetLatest/GetLatestVimScripts.dat (unix)
< <
or > or >
..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows) ..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin (see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
directory (see |glvs-plugins|). directory (see |glvs-plugins|).
Scripts which have been downloaded will appear in the Scripts which have been downloaded will appear in the
~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows) ~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows)
subdirectory. GetLatestVimScripts will attempt to automatically subdirectory. GetLatestVimScripts will attempt to automatically
install them if you have the following line in your <.vimrc>: > install them if you have the following line in your <.vimrc>: >
let g:GetLatestVimScripts_allowautoinstall=1 let g:GetLatestVimScripts_allowautoinstall=1
The <GetLatestVimScripts.dat> file will be automatically be updated to The <GetLatestVimScripts.dat> file will be automatically be updated to
reflect the latest version of script(s) so downloaded. reflect the latest version of script(s) so downloaded.
(also see |glvs-options|) (also see |glvs-options|)
============================================================================== ==============================================================================
4. GetLatestVimScripts Data File *getscript-data* *glvs-data* 4. GetLatestVimScripts Data File *getscript-data* *glvs-data*
*:GetLatestVimScripts_dat* *:GetLatestVimScripts_dat*
The data file <GetLatestVimScripts.dat> must have for its first two lines The data file <GetLatestVimScripts.dat> must have for its first two lines
the following text: the following text:
> >
ScriptID SourceID Filename ScriptID SourceID Filename
-------------------------- --------------------------
< <
Following those two lines are three columns; the first two are numeric Following those two lines are three columns; the first two are numeric
followed by a text column. The GetLatest/GetLatestVimScripts.dist file followed by a text column. The GetLatest/GetLatestVimScripts.dist file
contains an example of such a data file. Anything following a #... is contains an example of such a data file. Anything following a #... is
ignored, so you may embed comments in the file. ignored, so you may embed comments in the file.
The first number on each line gives the script's ScriptID. When you're about The first number on each line gives the script's ScriptID. When you're about
to use a web browser to look at scripts on http://vim.sf.net/, just before you to use a web browser to look at scripts on http://vim.sf.net/, just before you
click on the script's link, you'll see a line resembling click on the script's link, you'll see a line resembling
http://vim.sourceforge.net/scripts/script.php?script_id=40 http://vim.sourceforge.net/scripts/script.php?script_id=40
The "40" happens to be a ScriptID that GetLatestVimScripts needs to The "40" happens to be a ScriptID that GetLatestVimScripts needs to
download the associated page. download the associated page.
The second number on each line gives the script's SourceID. The SourceID The second number on each line gives the script's SourceID. The SourceID
records the count of uploaded scripts as determined by vim.sf.net; hence it records the count of uploaded scripts as determined by vim.sf.net; hence it
serves to indicate "when" a script was uploaded. Setting the SourceID to 1 serves to indicate "when" a script was uploaded. Setting the SourceID to 1
insures that GetLatestVimScripts will assume that the script it has is insures that GetLatestVimScripts will assume that the script it has is
out-of-date. out-of-date.
The SourceID is extracted by GetLatestVimScripts from the script's page on The SourceID is extracted by GetLatestVimScripts from the script's page on
vim.sf.net; whenever its greater than the one stored in the vim.sf.net; whenever its greater than the one stored in the
GetLatestVimScripts.dat file, the script will be downloaded GetLatestVimScripts.dat file, the script will be downloaded
(see |GetLatestVimScripts_dat|). (see |GetLatestVimScripts_dat|).
If your script's author has included a special comment line in his/her plugin, If your script's author has included a special comment line in his/her plugin,
the plugin itself will be used by GetLatestVimScripts to build your the plugin itself will be used by GetLatestVimScripts to build your
<GetLatestVimScripts.dat> file, including any dependencies on other scripts it <GetLatestVimScripts.dat> file, including any dependencies on other scripts it
may have. As an example, consider: > may have. As an example, consider: >
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim " GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
This comment line tells getscript.vim to check vimscript #884 and that the This comment line tells getscript.vim to check vimscript #884 and that the
script is automatically installable. Getscript will also use this line to script is automatically installable. Getscript will also use this line to
help build the GetLatestVimScripts.dat file, by including a line such as: > help build the GetLatestVimScripts.dat file, by including a line such as: >
884 1 AutoAlign.vim 884 1 AutoAlign.vim
< <
in it an AutoAlign.vim line isn't already in GetLatestVimScripts.dat file. in it an AutoAlign.vim line isn't already in GetLatestVimScripts.dat file.
See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a
comprehensive ability to keep your plugins up-to-date! comprehensive ability to keep your plugins up-to-date!
*GetLatestVimScripts_dat* *GetLatestVimScripts_dat*
As an example of a <GetLatestVimScripts.dat> file: As an example of a <GetLatestVimScripts.dat> file:
> >
ScriptID SourceID Filename ScriptID SourceID Filename
-------------------------- --------------------------
294 1 Align.vim 294 1 Align.vim
120 2 decho.vim 120 2 decho.vim
40 3 DrawIt.tar.gz 40 3 DrawIt.tar.gz
451 4 EasyAccents.vim 451 4 EasyAccents.vim
195 5 engspchk.vim 195 5 engspchk.vim
642 6 GetLatestVimScripts.vim 642 6 GetLatestVimScripts.vim
489 7 Manpageview.vim 489 7 Manpageview.vim
< <
Note: the first two lines are required, but essentially act as comments. Note: the first two lines are required, but essentially act as comments.
============================================================================== ==============================================================================
5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins* 5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins*
If a plugin author includes the following comment anywhere in their plugin, If a plugin author includes the following comment anywhere in their plugin,
GetLatestVimScripts will find it and use it to automatically build the user's GetLatestVimScripts will find it and use it to automatically build the user's
GetLatestVimScripts.dat files: GetLatestVimScripts.dat files:
> >
src_id src_id
v v
" GetLatestVimScripts: ### ### yourscriptname " GetLatestVimScripts: ### ### yourscriptname
^ ^
scriptid scriptid
< <
As an author, you should include such a line in to refer to your own script As an author, you should include such a line in to refer to your own script
plus any additional lines describing any plugin dependencies it may have. plus any additional lines describing any plugin dependencies it may have.
Same format, of course! Same format, of course!
If your command is auto-installable (see |glvs-autoinstall|), and most scripts If your command is auto-installable (see |glvs-autoinstall|), and most scripts
are, then you may include :AutoInstall: at the start of "yourscriptname". are, then you may include :AutoInstall: at the start of "yourscriptname".
GetLatestVimScripts commands for those scripts are then appended, if not GetLatestVimScripts commands for those scripts are then appended, if not
already present, to the user's GetLatest/GetLatestVimScripts.dat file. Its a already present, to the user's GetLatest/GetLatestVimScripts.dat file. Its a
relatively painless way to automate the acquisition of any scripts your relatively painless way to automate the acquisition of any scripts your
plugins depend upon. plugins depend upon.
Now, as an author, you probably don't want GetLatestVimScripts to download Now, as an author, you probably don't want GetLatestVimScripts to download
your own scripts for you yourself, thereby overwriting your not-yet-released your own scripts for you yourself, thereby overwriting your not-yet-released
hard work. GetLatestVimScripts provides a solution for this: put hard work. GetLatestVimScripts provides a solution for this: put
> >
0 0 yourscriptname 0 0 yourscriptname
< <
into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip
examining the "yourscriptname" scripts for those GetLatestVimScripts comment examining the "yourscriptname" scripts for those GetLatestVimScripts comment
lines. As a result, those lines won't be inadvertently installed into your lines. As a result, those lines won't be inadvertently installed into your
<GetLatestVimScripts.dat> file and subsequently used to download your own <GetLatestVimScripts.dat> file and subsequently used to download your own
scripts. This is especially important to do if you've included the scripts. This is especially important to do if you've included the
:AutoInstall: option. :AutoInstall: option.
Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
as you've used in your GetLatestVimScripts comment! as you've used in your GetLatestVimScripts comment!
============================================================================== ==============================================================================
6. GetLatestVimScripts AutoInstall *getscript-autoinstall* 6. GetLatestVimScripts AutoInstall *getscript-autoinstall*
*glvs-autoinstall* *glvs-autoinstall*
GetLatestVimScripts now supports "AutoInstall". Not all scripts are GetLatestVimScripts now supports "AutoInstall". Not all scripts are
supportive of auto-install, as they may have special things you need to do to supportive of auto-install, as they may have special things you need to do to
install them (please refer to the script's "install" directions). On the install them (please refer to the script's "install" directions). On the
other hand, most scripts will be auto-installable. other hand, most scripts will be auto-installable.
To let GetLatestVimScripts do an autoinstall, the data file's comment field To let GetLatestVimScripts do an autoinstall, the data file's comment field
should begin with (surrounding blanks are ignored): > should begin with (surrounding blanks are ignored): >
:AutoInstall: :AutoInstall:
< <
Both colons are needed, and it should begin the comment (yourscriptname) Both colons are needed, and it should begin the comment (yourscriptname)
field. field.
One may prevent any autoinstalling by putting the following line in your One may prevent any autoinstalling by putting the following line in your
<.vimrc>: > <.vimrc>: >
let g:GetLatestVimScripts_allowautoinstall= 0 let g:GetLatestVimScripts_allowautoinstall= 0
< <
With :AutoInstall: enabled, as it is by default, files which end with With :AutoInstall: enabled, as it is by default, files which end with
---.tar.bz2 : decompressed & untarred in .vim/ directory ---.tar.bz2 : decompressed & untarred in .vim/ directory
---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it ---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
---.vim.bz2 : decompressed & moved into .vim/plugin directory ---.vim.bz2 : decompressed & moved into .vim/plugin directory
---.tar.gz : decompressed & untarred in .vim/ directory ---.tar.gz : decompressed & untarred in .vim/ directory
---.vba.gz : decompressed in .vim/ directory, then vimball handles it ---.vba.gz : decompressed in .vim/ directory, then vimball handles it
---.vim.gz : decompressed & moved into .vim/plugin directory ---.vim.gz : decompressed & moved into .vim/plugin directory
---.vba : unzipped in .vim/ directory ---.vba : unzipped in .vim/ directory
---.vim : moved to .vim/plugin directory ---.vim : moved to .vim/plugin directory
---.zip : unzipped in .vim/ directory ---.zip : unzipped in .vim/ directory
and which merely need to have their components placed by the untar/gunzip or and which merely need to have their components placed by the untar/gunzip or
move-to-plugin-directory process should be auto-installable. Vimballs, of move-to-plugin-directory process should be auto-installable. Vimballs, of
course, should always be auto-installable. course, should always be auto-installable.
When is a script not auto-installable? Let me give an example: When is a script not auto-installable? Let me give an example:
.vim/after/syntax/blockhl.vim .vim/after/syntax/blockhl.vim
The <blockhl.vim> script provides block highlighting for C/C++ programs; it is The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
available at: available at:
http://vim.sourceforge.net/scripts/script.php?script_id=104 http://vim.sourceforge.net/scripts/script.php?script_id=104
Currently, vim's after/syntax only supports by-filetype scripts (in Currently, vim's after/syntax only supports by-filetype scripts (in
blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would
possibly overwrite the current user's after/syntax/c.vim file. possibly overwrite the current user's after/syntax/c.vim file.
In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
allow a after/syntax/c/ directory: allow a after/syntax/c/ directory:
http://vim.sourceforge.net/scripts/script.php?script_id=1023 http://vim.sourceforge.net/scripts/script.php?script_id=1023
The script allows multiple syntax files to exist separately in the The script allows multiple syntax files to exist separately in the
after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an
appropriate tarball for auto-install because of the potential for the appropriate tarball for auto-install because of the potential for the
after/syntax/c.vim contained in it to overwrite a user's c.vim. after/syntax/c.vim contained in it to overwrite a user's c.vim.
============================================================================== ==============================================================================
7. GetLatestVimScripts Options *glvs-options* 7. GetLatestVimScripts Options *glvs-options*
> >
g:GetLatestVimScripts_wget g:GetLatestVimScripts_wget
< default= "wget" < default= "wget"
This variable holds the name of the command for obtaining This variable holds the name of the command for obtaining
scripts. scripts.
> >
g:GetLatestVimScripts_options g:GetLatestVimScripts_options
< default= "-q -O" < default= "-q -O"
This variable holds the options to be used with the This variable holds the options to be used with the
g:GetLatestVimScripts_wget command. g:GetLatestVimScripts_wget command.
> >
g:getLatestVimScripts_allowautoinstall g:getLatestVimScripts_allowautoinstall
< default= 1 < default= 1
This variable indicates whether GetLatestVimScripts is allowed This variable indicates whether GetLatestVimScripts is allowed
to attempt to automatically install scripts. Note that it to attempt to automatically install scripts. Note that it
doesn't understand vimballs (yet). Furthermore, the plugin doesn't understand vimballs (yet). Furthermore, the plugin
author has to have explicitly indicated that his/her plugin author has to have explicitly indicated that his/her plugin
is automatically installable. is automatically installable.
============================================================================== ==============================================================================
8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg* 8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
The Vim sourceforge page dynamically creates a page by keying off of the The Vim sourceforge page dynamically creates a page by keying off of the
so-called script-id. Within the webpage of so-called script-id. Within the webpage of
http://vim.sourceforge.net/scripts/script.php?script_id=40 http://vim.sourceforge.net/scripts/script.php?script_id=40
is a line specifying the latest source-id (src_id). The source identifier is a line specifying the latest source-id (src_id). The source identifier
numbers are always increasing, hence if the src_id is greater than the one numbers are always increasing, hence if the src_id is greater than the one
recorded for the script in GetLatestVimScripts then its time to download a recorded for the script in GetLatestVimScripts then its time to download a
newer copy of that script. newer copy of that script.
GetLatestVimScripts will then download the script and update its internal GetLatestVimScripts will then download the script and update its internal
database of script ids, source ids, and scriptnames. database of script ids, source ids, and scriptnames.
The AutoInstall process will: The AutoInstall process will:
Move the file from GetLatest/ to the following directory Move the file from GetLatest/ to the following directory
Unix : $HOME/.vim Unix : $HOME/.vim
Windows: $HOME\vimfiles Windows: $HOME\vimfiles
if the downloaded file ends with ".bz2" if the downloaded file ends with ".bz2"
bunzip2 it bunzip2 it
else if the downloaded file ends with ".gz" else if the downloaded file ends with ".gz"
gunzip it gunzip it
if the resulting file ends with ".zip" if the resulting file ends with ".zip"
unzip it unzip it
else if the resulting file ends with ".tar" else if the resulting file ends with ".tar"
tar -oxvf it tar -oxvf it
else if the resulting file ends with ".vim" else if the resulting file ends with ".vim"
move it to the plugin subdirectory move it to the plugin subdirectory
============================================================================== ==============================================================================
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1 9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
v23 Nov 03, 2006 : * ignores comments (#...) v24 Apr 16, 2007 : * removed save&restore of the fo option during script
* handles vimballs loading
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not v23 Nov 03, 2006 : * ignores comments (#...)
available * handles vimballs
v21 May 01, 2006 : * now takes advantage of autoloading. v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use; available
unzip needs the -o flag to overwrite. v21 May 01, 2006 : * now takes advantage of autoloading.
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
script! Fixed. unzip needs the -o flag to overwrite.
v18 Mar 21, 2005 : * bugfix to automatic database construction v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
* bugfix - nowrapscan caused an error script! Fixed.
(tnx to David Green for the fix) v18 Mar 21, 2005 : * bugfix to automatic database construction
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in * bugfix - nowrapscan caused an error
:AutoInstall:s, even though its o/s is windows (tnx to David Green for the fix)
Apr 01, 2005 * when downloading errors occurred, GLVS was Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
terminating early. It now just goes on to trying :AutoInstall:s, even though its o/s is windows
the next script (after trying three times to Apr 01, 2005 * when downloading errors occurred, GLVS was
download a script description page) terminating early. It now just goes on to trying
Apr 20, 2005 * bugfix - when a failure to download occurred, the next script (after trying three times to
GetLatestVimScripts would stop early and claim that download a script description page)
everything was current. Fixed. Apr 20, 2005 * bugfix - when a failure to download occurred,
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which GetLatestVimScripts would stop early and claim that
defaults to 1, can be used to prevent all everything was current. Fixed.
:AutoInstall: v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent defaults to 1, can be used to prevent all
* fixed bug with :AutoInstall: use of helptags :AutoInstall:
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
always preventing downloads (just usually). Fixed. * fixed bug with :AutoInstall: use of helptags
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
s:dotvim. Fixed. always preventing downloads (just usually). Fixed.
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
is zero. Useful for script authors; that way their s:dotvim. Fixed.
own GetLatestVimScripts activity won't overwrite v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
their scripts. is zero. Useful for script authors; that way their
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that own GetLatestVimScripts activity won't overwrite
was intended only for testing. Removed, now works. their scripts.
* :AutoInstall: implemented v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin: was intended only for testing. Removed, now works.
* :GetLatestVimScripts command * :AutoInstall: implemented
* (runtimepath)/GetLatest/GetLatestVimScripts.dat v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
now holds scripts that need updating * :GetLatestVimScripts command
v10 Apr 19, 2004 : * moved history from script to doc * (runtimepath)/GetLatest/GetLatestVimScripts.dat
v9 Jan 23, 2004 : windows (win32/win16/win95) will use now holds scripts that need updating
double quotes ("") whereas other systems will use v10 Apr 19, 2004 : * moved history from script to doc
single quotes ('') around the urls in calls via wget v9 Jan 23, 2004 : windows (win32/win16/win95) will use
v8 Dec 01, 2003 : makes three tries at downloading double quotes ("") whereas other systems will use
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id=" single quotes ('') around the urls in calls via wget
not found in downloaded webpage v8 Dec 01, 2003 : makes three tries at downloading
Uses t_ti, t_te, and rs to make progress visible v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
v6 Aug 06, 2003 : final status messages now display summary of work not found in downloaded webpage
( "Downloaded someqty scripts" or Uses t_ti, t_te, and rs to make progress visible
"Everything was current") v6 Aug 06, 2003 : final status messages now display summary of work
Now GetLatestVimScripts is careful about downloading ( "Downloaded someqty scripts" or
GetLatestVimScripts.vim itself! "Everything was current")
(goes to <NEW_GetLatestVimScripts.vim>) Now GetLatestVimScripts is careful about downloading
v5 Aug 04, 2003 : missing an endif near bottom GetLatestVimScripts.vim itself!
v4 Jun 17, 2003 : redraw! just before each "considering" message (goes to <NEW_GetLatestVimScripts.vim>)
v3 May 27, 2003 : Protects downloaded files from errant shell v5 Aug 04, 2003 : missing an endif near bottom
expansions with single quotes: '...' v4 Jun 17, 2003 : redraw! just before each "considering" message
v2 May 14, 2003 : extracts name of item to be obtained from the v3 May 27, 2003 : Protects downloaded files from errant shell
script file. Uses it instead of comment field expansions with single quotes: '...'
for output filename; comment is used in the v2 May 14, 2003 : extracts name of item to be obtained from the
"considering..." line and is now just a comment! script file. Uses it instead of comment field
* Fixed a bug: a string-of-numbers is not the for output filename; comment is used in the
same as a number, so I added zero to them "considering..." line and is now just a comment!
and they became numbers. Fixes comparison. * Fixed a bug: a string-of-numbers is not the
same as a number, so I added zero to them
============================================================================== and they became numbers. Fixes comparison.
vim:tw=78:ts=8:ft=help:fdm=marker
==============================================================================
vim:tw=78:ts=8:ft=help:fdm=marker

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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*

View File

@ -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
View 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

View File

@ -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
@ -121,12 +126,13 @@ call TCommentDefineType('php', '// %s' )
call TCommentDefineType('php_inline', g:tcommentInlineC ) call TCommentDefineType('php_inline', g:tcommentInlineC )
call TCommentDefineType('php_block', g:tcommentBlockC ) call TCommentDefineType('php_block', g:tcommentBlockC )
call TCommentDefineType('php_2_block', g:tcommentBlockC2 ) call TCommentDefineType('php_2_block', g:tcommentBlockC2 )
call TCommentDefineType('po', '# %s' ) 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

View File

@ -26,8 +26,8 @@ com! -ra -complete=dir -na=+ -bang MkVimball call vimball#MkVimball(<line1>,<l
com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>) 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