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
|
||||
--------------------------
|
||||
642 6945 GetLatestVimScripts.vim
|
||||
1075 6895 netrw.vim
|
||||
1502 6578 vimball.vim
|
||||
642 7080 GetLatestVimScripts.vim
|
||||
1075 7079 netrw.vim
|
||||
1502 7078 vimball.vim
|
||||
1008 3118 srec.vim (ftplugin)
|
||||
1009 3119 srec.vim (syntax file)
|
||||
475 2535 latex-suite (install in vimfiles.latex)
|
||||
@ -12,10 +12,12 @@ ScriptID SourceID Filename
|
||||
51 171 cscope_macros.vim
|
||||
102 5306 DirDiff.vim
|
||||
1189 6533 matrix.vim
|
||||
1173 5475 tcomment
|
||||
1173 7046 tcomment
|
||||
948 2878 Scons Compiler plugin
|
||||
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
|
||||
1397 6887 xml.vim
|
||||
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
@ -1,183 +1,189 @@
|
||||
" netrwSettings.vim: makes netrw settings simpler
|
||||
" Date: Jan 05, 2007
|
||||
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
||||
" Version: 9b ASTRO-ONLY
|
||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" netrwSettings.vim is provided *as is* and comes with no
|
||||
" warranty of any kind, either expressed or implied. By using
|
||||
" this plugin, you agree that in no event will the copyright
|
||||
" holder be liable for any damages resulting from the use
|
||||
" of this software.
|
||||
"
|
||||
" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
|
||||
" synagogues, preaching the gospel of the kingdom, and healing
|
||||
" every disease and every sickness among the people.
|
||||
" Load Once: {{{1
|
||||
if exists("g:loaded_netrwSettings") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwSettings = "v9b"
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" NetrwSettings: {{{1
|
||||
fun! netrwSettings#NetrwSettings()
|
||||
" this call is here largely just to insure that netrw has been loaded
|
||||
call netrw#NetSavePosn()
|
||||
if !exists("g:loaded_netrw")
|
||||
echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
above wincmd s
|
||||
enew
|
||||
setlocal noswapfile bh=wipe
|
||||
set ft=vim
|
||||
file Netrw\ Settings
|
||||
|
||||
" these variables have the following default effects when they don't
|
||||
" exist (ie. have not been set by the user in his/her .vimrc)
|
||||
if !exists("g:netrw_liststyle")
|
||||
let g:netrw_liststyle= 0
|
||||
let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
|
||||
endif
|
||||
if !exists("g:netrw_silent")
|
||||
let g:netrw_silent= 0
|
||||
endif
|
||||
if !exists("g:netrw_use_nt_rcp")
|
||||
let g:netrw_use_nt_rcp= 0
|
||||
endif
|
||||
if !exists("g:netrw_ftp")
|
||||
let g:netrw_ftp= 0
|
||||
endif
|
||||
if !exists("g:netrw_ignorenetrc")
|
||||
let g:netrw_ignorenetrc= 0
|
||||
endif
|
||||
|
||||
put ='+ ---------------------------------------------'
|
||||
put ='+ NetrwSettings: by Charles E. Campbell, Jr.'
|
||||
put ='+ Press <F1> with cursor atop any line for help'
|
||||
put ='+ ---------------------------------------------'
|
||||
let s:netrw_settings_stop= line(".")
|
||||
|
||||
put =''
|
||||
put ='+ Netrw Protocol Commands'
|
||||
put = 'let g:netrw_dav_cmd = '.g:netrw_dav_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_http_cmd = '.g:netrw_http_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_scp_cmd = '.g:netrw_scp_cmd
|
||||
put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
|
||||
put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
|
||||
let s:netrw_protocol_stop= line(".")
|
||||
put = ''
|
||||
|
||||
put ='+Netrw Transfer Control'
|
||||
put = 'let g:netrw_cygwin = '.g:netrw_cygwin
|
||||
put = 'let g:netrw_ftp = '.g:netrw_ftp
|
||||
put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
|
||||
put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
|
||||
let shqline= line("$")
|
||||
put = 'let g:netrw_shq...'
|
||||
put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
|
||||
put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
|
||||
let s:netrw_xfer_stop= line(".")
|
||||
|
||||
put = ''
|
||||
put ='+ Netrw Browser Control'
|
||||
put = 'let g:netrw_alto = '.g:netrw_alto
|
||||
put = 'let g:netrw_altv = '.g:netrw_altv
|
||||
put = 'let g:netrw_browse_split = '.g:netrw_browse_split
|
||||
if exists("g:netrw_browsex_viewer")
|
||||
put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
|
||||
else
|
||||
put = 'let g:netrw_browsex_viewer = (not defined)'
|
||||
endif
|
||||
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
|
||||
put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
|
||||
put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
|
||||
put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
|
||||
put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
|
||||
put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
|
||||
put = 'let g:netrw_hide = '.g:netrw_hide
|
||||
put = 'let g:netrw_keepdir = '.g:netrw_keepdir
|
||||
put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
|
||||
put = 'let g:netrw_list_hide = '.g:netrw_list_hide
|
||||
put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir
|
||||
put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir
|
||||
put = 'let g:netrw_liststyle = '.g:netrw_liststyle
|
||||
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
|
||||
put = 'let g:netrw_menu = '.g:netrw_menu
|
||||
put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
|
||||
put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
|
||||
put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
|
||||
put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
|
||||
put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
|
||||
put = 'let g:netrw_silent = '.g:netrw_silent
|
||||
put = 'let g:netrw_sort_by = '.g:netrw_sort_by
|
||||
put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
|
||||
put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
|
||||
put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
|
||||
put = 'let g:netrw_timefmt = '.g:netrw_timefmt
|
||||
put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf
|
||||
put = 'let g:netrw_winsize = '.g:netrw_winsize
|
||||
|
||||
put =''
|
||||
put ='+ For help, place cursor on line and press ?'
|
||||
|
||||
1d
|
||||
silent %s/^+/"/e
|
||||
res 99
|
||||
silent %s/= \([^0-9].*\)$/= '\1'/e
|
||||
silent %s/= $/= ''/e
|
||||
1
|
||||
|
||||
" Put in shq setting.
|
||||
" (deferred so as to avoid the quote manipulation just preceding)
|
||||
if g:netrw_shq == "'"
|
||||
call setline(shqline,'let g:netrw_shq = "'.g:netrw_shq.'"')
|
||||
else
|
||||
call setline(shqline,"let g:netrw_shq = '".g:netrw_shq."'")
|
||||
endif
|
||||
|
||||
set nomod
|
||||
|
||||
nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr>
|
||||
nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr>
|
||||
let tmpfile= tempname()
|
||||
exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" NetrwSettingHelp: {{{2
|
||||
fun! NetrwSettingHelp()
|
||||
" call Dfunc("NetrwSettingHelp()")
|
||||
let curline = getline(".")
|
||||
if curline =~ '='
|
||||
let varhelp = substitute(curline,'^\s*let ','','e')
|
||||
let varhelp = substitute(varhelp,'\s*=.*$','','e')
|
||||
" call Decho("trying help ".varhelp)
|
||||
try
|
||||
exe "he ".varhelp
|
||||
catch /^Vim\%((\a\+)\)\=:E149/
|
||||
echo "***sorry*** no help available for <".varhelp.">"
|
||||
endtry
|
||||
elseif line(".") < s:netrw_settings_stop
|
||||
he netrw-settings
|
||||
elseif line(".") < s:netrw_protocol_stop
|
||||
he netrw-externapp
|
||||
elseif line(".") < s:netrw_xfer_stop
|
||||
he netrw-variables
|
||||
else
|
||||
he netrw-browse-var
|
||||
endif
|
||||
" call Dret("NetrwSettingHelp")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Modelines: {{{1
|
||||
" vim:ts=8 fdm=marker
|
||||
" netrwSettings.vim: makes netrw settings simpler
|
||||
" Date: Mar 26, 2007
|
||||
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
||||
" Version: 9
|
||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" netrwSettings.vim is provided *as is* and comes with no
|
||||
" warranty of any kind, either expressed or implied. By using
|
||||
" this plugin, you agree that in no event will the copyright
|
||||
" holder be liable for any damages resulting from the use
|
||||
" of this software.
|
||||
"
|
||||
" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
|
||||
" synagogues, preaching the gospel of the kingdom, and healing
|
||||
" every disease and every sickness among the people.
|
||||
" Load Once: {{{1
|
||||
if exists("g:loaded_netrwSettings") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_netrwSettings = "v9"
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" NetrwSettings: {{{1
|
||||
fun! netrwSettings#NetrwSettings()
|
||||
" this call is here largely just to insure that netrw has been loaded
|
||||
call netrw#NetSavePosn()
|
||||
if !exists("g:loaded_netrw")
|
||||
echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
|
||||
return
|
||||
endif
|
||||
|
||||
above wincmd s
|
||||
enew
|
||||
setlocal noswapfile bh=wipe
|
||||
set ft=vim
|
||||
file Netrw\ Settings
|
||||
|
||||
" these variables have the following default effects when they don't
|
||||
" exist (ie. have not been set by the user in his/her .vimrc)
|
||||
if !exists("g:netrw_liststyle")
|
||||
let g:netrw_liststyle= 0
|
||||
let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
|
||||
endif
|
||||
if !exists("g:netrw_silent")
|
||||
let g:netrw_silent= 0
|
||||
endif
|
||||
if !exists("g:netrw_use_nt_rcp")
|
||||
let g:netrw_use_nt_rcp= 0
|
||||
endif
|
||||
if !exists("g:netrw_ftp")
|
||||
let g:netrw_ftp= 0
|
||||
endif
|
||||
if !exists("g:netrw_ignorenetrc")
|
||||
let g:netrw_ignorenetrc= 0
|
||||
endif
|
||||
|
||||
put ='+ ---------------------------------------------'
|
||||
put ='+ NetrwSettings: by Charles E. Campbell, Jr.'
|
||||
put ='+ Press <F1> with cursor atop any line for help'
|
||||
put ='+ ---------------------------------------------'
|
||||
let s:netrw_settings_stop= line(".")
|
||||
|
||||
put =''
|
||||
put ='+ Netrw Protocol Commands'
|
||||
put = 'let g:netrw_dav_cmd = '.g:netrw_dav_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_http_cmd = '.g:netrw_http_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_scp_cmd = '.g:netrw_scp_cmd
|
||||
put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
|
||||
put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
|
||||
let s:netrw_protocol_stop= line(".")
|
||||
put = ''
|
||||
|
||||
put ='+Netrw Transfer Control'
|
||||
put = 'let g:netrw_cygwin = '.g:netrw_cygwin
|
||||
put = 'let g:netrw_ftp = '.g:netrw_ftp
|
||||
put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
|
||||
put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
|
||||
put = 'let g:netrw_sshport = '.g:netrw_sshport
|
||||
let shqline= line("$")
|
||||
put = 'let g:netrw_shq...'
|
||||
put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
|
||||
put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
|
||||
let s:netrw_xfer_stop= line(".")
|
||||
put =''
|
||||
put ='+ Netrw Messages'
|
||||
put ='let g:netrw_use_errorwindow = '.g:netrw_use_errorwindow
|
||||
|
||||
put = ''
|
||||
put ='+ Netrw Browser Control'
|
||||
put = 'let g:netrw_alto = '.g:netrw_alto
|
||||
put = 'let g:netrw_altv = '.g:netrw_altv
|
||||
put = 'let g:netrw_browse_split = '.g:netrw_browse_split
|
||||
if exists("g:netrw_browsex_viewer")
|
||||
put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer
|
||||
else
|
||||
put = 'let g:netrw_browsex_viewer = (not defined)'
|
||||
endif
|
||||
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
|
||||
put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
|
||||
put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
|
||||
put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
|
||||
put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd
|
||||
put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd
|
||||
put = 'let g:netrw_hide = '.g:netrw_hide
|
||||
put = 'let g:netrw_keepdir = '.g:netrw_keepdir
|
||||
put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
|
||||
put = 'let g:netrw_list_hide = '.g:netrw_list_hide
|
||||
put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir
|
||||
put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir
|
||||
put = 'let g:netrw_liststyle = '.g:netrw_liststyle
|
||||
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
|
||||
put = 'let g:netrw_menu = '.g:netrw_menu
|
||||
put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
|
||||
put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
|
||||
put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
|
||||
put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
|
||||
put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
|
||||
put = 'let g:netrw_silent = '.g:netrw_silent
|
||||
put = 'let g:netrw_sort_by = '.g:netrw_sort_by
|
||||
put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
|
||||
put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
|
||||
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_use_noswf = '.g:netrw_use_noswf
|
||||
put = 'let g:netrw_winsize = '.g:netrw_winsize
|
||||
|
||||
put =''
|
||||
put ='+ For help, place cursor on line and press <F1>'
|
||||
|
||||
1d
|
||||
silent %s/^+/"/e
|
||||
res 99
|
||||
silent %s/= \([^0-9].*\)$/= '\1'/e
|
||||
silent %s/= $/= ''/e
|
||||
1
|
||||
|
||||
" Put in shq setting.
|
||||
" (deferred so as to avoid the quote manipulation just preceding)
|
||||
if g:netrw_shq == "'"
|
||||
call setline(shqline,'let g:netrw_shq = "'.g:netrw_shq.'"')
|
||||
else
|
||||
call setline(shqline,"let g:netrw_shq = '".g:netrw_shq."'")
|
||||
endif
|
||||
|
||||
set nomod
|
||||
|
||||
nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr>
|
||||
nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr>
|
||||
let tmpfile= tempname()
|
||||
exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" NetrwSettingHelp: {{{2
|
||||
fun! NetrwSettingHelp()
|
||||
" call Dfunc("NetrwSettingHelp()")
|
||||
let curline = getline(".")
|
||||
if curline =~ '='
|
||||
let varhelp = substitute(curline,'^\s*let ','','e')
|
||||
let varhelp = substitute(varhelp,'\s*=.*$','','e')
|
||||
" call Decho("trying help ".varhelp)
|
||||
try
|
||||
exe "he ".varhelp
|
||||
catch /^Vim\%((\a\+)\)\=:E149/
|
||||
echo "***sorry*** no help available for <".varhelp.">"
|
||||
endtry
|
||||
elseif line(".") < s:netrw_settings_stop
|
||||
he netrw-settings
|
||||
elseif line(".") < s:netrw_protocol_stop
|
||||
he netrw-externapp
|
||||
elseif line(".") < s:netrw_xfer_stop
|
||||
he netrw-variables
|
||||
else
|
||||
he netrw-browse-var
|
||||
endif
|
||||
" call Dret("NetrwSettingHelp")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Modelines: {{{1
|
||||
" vim:ts=8 fdm=marker
|
||||
|
@ -1,7 +1,7 @@
|
||||
" vimball.vim : construct a file containing both paths and files
|
||||
" Author: Charles E. Campbell, Jr.
|
||||
" Date: Jan 03, 2007
|
||||
" Version: 21
|
||||
" Date: May 07, 2007
|
||||
" Version: 22
|
||||
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
|
||||
" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr.
|
||||
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
||||
@ -15,7 +15,7 @@ if &cp || exists("g:loaded_vimball") || v:version < 700
|
||||
finish
|
||||
endif
|
||||
let s:keepcpo = &cpo
|
||||
let g:loaded_vimball = "v21"
|
||||
let g:loaded_vimball = "v22"
|
||||
set cpo&vim
|
||||
|
||||
" =====================================================================
|
||||
@ -583,13 +583,14 @@ fun! s:SaveSettings()
|
||||
let s:fenkeep = &fen
|
||||
let s:hidkeep = &hidden
|
||||
let s:ickeep = &ic
|
||||
let s:lzkeep = &lz
|
||||
let s:pmkeep = &pm
|
||||
let s:repkeep = &report
|
||||
let s:vekeep = &ve
|
||||
let s:lzkeep = &lz
|
||||
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
|
||||
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
|
||||
" call Dret("SaveSettings")
|
||||
endfun
|
||||
@ -606,6 +607,7 @@ fun! s:RestoreSettings()
|
||||
let &hidden = s:hidkeep
|
||||
let &ic = s:ickeep
|
||||
let &lz = s:lzkeep
|
||||
let &pm = s:pmkeep
|
||||
let &report = s:repkeep
|
||||
let &ve = s:vekeep
|
||||
let &ei = s:eikeep
|
||||
@ -615,9 +617,9 @@ fun! s:RestoreSettings()
|
||||
call setpos("'a",s:makeep)
|
||||
endif
|
||||
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
|
||||
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
|
||||
set bt=nofile noma
|
||||
" call Dret("RestoreSettings")
|
||||
|
@ -1,406 +1,408 @@
|
||||
*pi_getscript.txt* For Vim version 7.0. Last change: 2006 Nov 1
|
||||
>
|
||||
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr.
|
||||
<
|
||||
Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
|
||||
(remove NOSPAM from the email address)
|
||||
*GetLatestVimScripts-copyright*
|
||||
Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *glvs-copyright*
|
||||
The VIM LICENSE applies to getscript.vim and
|
||||
pi_getscript.txt (see |copyright|) except use
|
||||
"getscript" instead of "Vim". No warranty, express or implied.
|
||||
Use At-Your-Own-Risk.
|
||||
|
||||
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
|
||||
then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
|
||||
get the latest versions of scripts listed therein from http://vim.sf.net/.
|
||||
|
||||
==============================================================================
|
||||
1. Contents *glvs-contents* *glvs* *getscript*
|
||||
*GetLatestVimScripts*
|
||||
|
||||
1. Contents........................................: |glvs-contents|
|
||||
2. GetLatestVimScripts -- Getting Started..........: |glvs-install|
|
||||
3. GetLatestVimScripts Usage.......................: |glvs-usage|
|
||||
4. GetLatestVimScripts Data File...................: |glvs-data|
|
||||
5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins|
|
||||
6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall|
|
||||
7. GetLatestViMScripts Options.....................: |glvs-options|
|
||||
8. GetLatestVimScripts Algorithm...................: |glvs-alg|
|
||||
9. GetLatestVimScripts History.....................: |glvs-hist|
|
||||
|
||||
|
||||
==============================================================================
|
||||
2. GetLatestVimScripts -- Getting Started *getscript-start*
|
||||
*getlatestvimscripts-install*
|
||||
|
||||
VERSION FROM VIM DISTRIBUTION *glvs-dist-install*
|
||||
|
||||
Vim 7.0 does not include the GetLatestVimScripts.dist file which
|
||||
serves as an example and a template. So, you'll need to create
|
||||
your own! See |GetLatestVimScripts_dat|.
|
||||
|
||||
VERSION FROM VIM SF NET *glvs-install*
|
||||
|
||||
NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist
|
||||
file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for
|
||||
the first time.
|
||||
|
||||
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;
|
||||
the "important" part of it is the first two lines.
|
||||
|
||||
Your computer needs to have wget for GetLatestVimScripts to do its work.
|
||||
|
||||
1. if compressed: gunzip getscript.vba.gz
|
||||
2. Unix:
|
||||
vim getscript.vba
|
||||
:so %
|
||||
:q
|
||||
cd ~/.vim/GetLatest
|
||||
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
|
||||
(edit GetLatestVimScripts.dat to install your own personal
|
||||
list of desired plugins -- see |GetLatestVimScripts_dat|)
|
||||
|
||||
3. Windows:
|
||||
vim getscript.vba
|
||||
:so %
|
||||
:q
|
||||
cd **path-to-vimfiles**/GetLatest
|
||||
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
|
||||
(edit GetLatestVimScripts.dat to install your own personal
|
||||
list of desired plugins -- see |GetLatestVimScripts_dat|)
|
||||
|
||||
|
||||
==============================================================================
|
||||
3. GetLatestVimScripts Usage *glvs-usage* *:GLVS*
|
||||
|
||||
Unless its been defined elsewhere, >
|
||||
:GLVS
|
||||
will invoke GetLatestVimScripts(). If some other plugin has defined that
|
||||
command, then you may type
|
||||
>
|
||||
:GetLatestVimScripts
|
||||
<
|
||||
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
|
||||
file,
|
||||
>
|
||||
.vim/GetLatest/GetLatestVimScripts.dat (unix)
|
||||
<
|
||||
or >
|
||||
..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
|
||||
(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
|
||||
directory (see |glvs-plugins|).
|
||||
|
||||
Scripts which have been downloaded will appear in the
|
||||
~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows)
|
||||
subdirectory. GetLatestVimScripts will attempt to automatically
|
||||
install them if you have the following line in your <.vimrc>: >
|
||||
|
||||
let g:GetLatestVimScripts_allowautoinstall=1
|
||||
|
||||
The <GetLatestVimScripts.dat> file will be automatically be updated to
|
||||
reflect the latest version of script(s) so downloaded.
|
||||
(also see |glvs-options|)
|
||||
|
||||
|
||||
==============================================================================
|
||||
4. GetLatestVimScripts Data File *getscript-data* *glvs-data*
|
||||
*:GetLatestVimScripts_dat*
|
||||
The data file <GetLatestVimScripts.dat> must have for its first two lines
|
||||
the following text:
|
||||
>
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
<
|
||||
Following those two lines are three columns; the first two are numeric
|
||||
followed by a text column. The GetLatest/GetLatestVimScripts.dist file
|
||||
contains an example of such a data file. Anything following a #... is
|
||||
ignored, so you may embed comments in the file.
|
||||
|
||||
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
|
||||
click on the script's link, you'll see a line resembling
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=40
|
||||
|
||||
The "40" happens to be a ScriptID that GetLatestVimScripts needs to
|
||||
download the associated page.
|
||||
|
||||
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
|
||||
serves to indicate "when" a script was uploaded. Setting the SourceID to 1
|
||||
insures that GetLatestVimScripts will assume that the script it has is
|
||||
out-of-date.
|
||||
|
||||
The SourceID is extracted by GetLatestVimScripts from the script's page on
|
||||
vim.sf.net; whenever its greater than the one stored in the
|
||||
GetLatestVimScripts.dat file, the script will be downloaded
|
||||
(see |GetLatestVimScripts_dat|).
|
||||
|
||||
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
|
||||
<GetLatestVimScripts.dat> file, including any dependencies on other scripts it
|
||||
may have. As an example, consider: >
|
||||
|
||||
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
|
||||
|
||||
This comment line tells getscript.vim to check vimscript #884 and that the
|
||||
script is automatically installable. Getscript will also use this line to
|
||||
help build the GetLatestVimScripts.dat file, by including a line such as: >
|
||||
|
||||
884 1 AutoAlign.vim
|
||||
<
|
||||
in it an AutoAlign.vim line isn't already in GetLatestVimScripts.dat file.
|
||||
See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a
|
||||
comprehensive ability to keep your plugins up-to-date!
|
||||
|
||||
*GetLatestVimScripts_dat*
|
||||
As an example of a <GetLatestVimScripts.dat> file:
|
||||
>
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
294 1 Align.vim
|
||||
120 2 decho.vim
|
||||
40 3 DrawIt.tar.gz
|
||||
451 4 EasyAccents.vim
|
||||
195 5 engspchk.vim
|
||||
642 6 GetLatestVimScripts.vim
|
||||
489 7 Manpageview.vim
|
||||
<
|
||||
Note: the first two lines are required, but essentially act as comments.
|
||||
|
||||
|
||||
==============================================================================
|
||||
5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins*
|
||||
|
||||
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.dat files:
|
||||
>
|
||||
src_id
|
||||
v
|
||||
" GetLatestVimScripts: ### ### yourscriptname
|
||||
^
|
||||
scriptid
|
||||
<
|
||||
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.
|
||||
Same format, of course!
|
||||
|
||||
If your command is auto-installable (see |glvs-autoinstall|), and most scripts
|
||||
are, then you may include :AutoInstall: at the start of "yourscriptname".
|
||||
|
||||
GetLatestVimScripts commands for those scripts are then appended, if not
|
||||
already present, to the user's GetLatest/GetLatestVimScripts.dat file. Its a
|
||||
relatively painless way to automate the acquisition of any scripts your
|
||||
plugins depend upon.
|
||||
|
||||
Now, as an author, you probably don't want GetLatestVimScripts to download
|
||||
your own scripts for you yourself, thereby overwriting your not-yet-released
|
||||
hard work. GetLatestVimScripts provides a solution for this: put
|
||||
>
|
||||
0 0 yourscriptname
|
||||
<
|
||||
into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip
|
||||
examining the "yourscriptname" scripts for those GetLatestVimScripts comment
|
||||
lines. As a result, those lines won't be inadvertently installed into your
|
||||
<GetLatestVimScripts.dat> file and subsequently used to download your own
|
||||
scripts. This is especially important to do if you've included the
|
||||
:AutoInstall: option.
|
||||
|
||||
Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
|
||||
as you've used in your GetLatestVimScripts comment!
|
||||
|
||||
|
||||
==============================================================================
|
||||
6. GetLatestVimScripts AutoInstall *getscript-autoinstall*
|
||||
*glvs-autoinstall*
|
||||
|
||||
GetLatestVimScripts now supports "AutoInstall". Not all scripts are
|
||||
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
|
||||
other hand, most scripts will be auto-installable.
|
||||
|
||||
To let GetLatestVimScripts do an autoinstall, the data file's comment field
|
||||
should begin with (surrounding blanks are ignored): >
|
||||
|
||||
:AutoInstall:
|
||||
<
|
||||
Both colons are needed, and it should begin the comment (yourscriptname)
|
||||
field.
|
||||
|
||||
One may prevent any autoinstalling by putting the following line in your
|
||||
<.vimrc>: >
|
||||
|
||||
let g:GetLatestVimScripts_allowautoinstall= 0
|
||||
<
|
||||
With :AutoInstall: enabled, as it is by default, files which end with
|
||||
|
||||
---.tar.bz2 : decompressed & untarred in .vim/ directory
|
||||
---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
|
||||
---.vim.bz2 : decompressed & moved into .vim/plugin directory
|
||||
---.tar.gz : decompressed & untarred in .vim/ directory
|
||||
---.vba.gz : decompressed in .vim/ directory, then vimball handles it
|
||||
---.vim.gz : decompressed & moved into .vim/plugin directory
|
||||
---.vba : unzipped in .vim/ directory
|
||||
---.vim : moved to .vim/plugin directory
|
||||
---.zip : unzipped in .vim/ directory
|
||||
|
||||
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
|
||||
course, should always be auto-installable.
|
||||
|
||||
When is a script not auto-installable? Let me give an example:
|
||||
|
||||
.vim/after/syntax/blockhl.vim
|
||||
|
||||
The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
|
||||
available at:
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=104
|
||||
|
||||
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
|
||||
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
|
||||
allow a after/syntax/c/ directory:
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=1023
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
|
||||
==============================================================================
|
||||
7. GetLatestVimScripts Options *glvs-options*
|
||||
>
|
||||
g:GetLatestVimScripts_wget
|
||||
< default= "wget"
|
||||
This variable holds the name of the command for obtaining
|
||||
scripts.
|
||||
>
|
||||
g:GetLatestVimScripts_options
|
||||
< default= "-q -O"
|
||||
This variable holds the options to be used with the
|
||||
g:GetLatestVimScripts_wget command.
|
||||
>
|
||||
g:getLatestVimScripts_allowautoinstall
|
||||
< default= 1
|
||||
This variable indicates whether GetLatestVimScripts is allowed
|
||||
to attempt to automatically install scripts. Note that it
|
||||
doesn't understand vimballs (yet). Furthermore, the plugin
|
||||
author has to have explicitly indicated that his/her plugin
|
||||
is automatically installable.
|
||||
|
||||
|
||||
==============================================================================
|
||||
8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
|
||||
|
||||
The Vim sourceforge page dynamically creates a page by keying off of the
|
||||
so-called script-id. Within the webpage of
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=40
|
||||
|
||||
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
|
||||
recorded for the script in GetLatestVimScripts then its time to download a
|
||||
newer copy of that script.
|
||||
|
||||
GetLatestVimScripts will then download the script and update its internal
|
||||
database of script ids, source ids, and scriptnames.
|
||||
|
||||
The AutoInstall process will:
|
||||
|
||||
Move the file from GetLatest/ to the following directory
|
||||
Unix : $HOME/.vim
|
||||
Windows: $HOME\vimfiles
|
||||
if the downloaded file ends with ".bz2"
|
||||
bunzip2 it
|
||||
else if the downloaded file ends with ".gz"
|
||||
gunzip it
|
||||
if the resulting file ends with ".zip"
|
||||
unzip it
|
||||
else if the resulting file ends with ".tar"
|
||||
tar -oxvf it
|
||||
else if the resulting file ends with ".vim"
|
||||
move it to the plugin subdirectory
|
||||
|
||||
|
||||
==============================================================================
|
||||
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
|
||||
|
||||
v23 Nov 03, 2006 : * ignores comments (#...)
|
||||
* handles vimballs
|
||||
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
|
||||
available
|
||||
v21 May 01, 2006 : * now takes advantage of autoloading.
|
||||
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
|
||||
unzip needs the -o flag to overwrite.
|
||||
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
|
||||
script! Fixed.
|
||||
v18 Mar 21, 2005 : * bugfix to automatic database construction
|
||||
* bugfix - nowrapscan caused an error
|
||||
(tnx to David Green for the fix)
|
||||
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
|
||||
:AutoInstall:s, even though its o/s is windows
|
||||
Apr 01, 2005 * when downloading errors occurred, GLVS was
|
||||
terminating early. It now just goes on to trying
|
||||
the next script (after trying three times to
|
||||
download a script description page)
|
||||
Apr 20, 2005 * bugfix - when a failure to download occurred,
|
||||
GetLatestVimScripts would stop early and claim that
|
||||
everything was current. Fixed.
|
||||
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
|
||||
defaults to 1, can be used to prevent all
|
||||
:AutoInstall:
|
||||
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
|
||||
* fixed bug with :AutoInstall: use of helptags
|
||||
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
|
||||
always preventing downloads (just usually). Fixed.
|
||||
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
|
||||
s:dotvim. Fixed.
|
||||
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
|
||||
is zero. Useful for script authors; that way their
|
||||
own GetLatestVimScripts activity won't overwrite
|
||||
their scripts.
|
||||
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
|
||||
was intended only for testing. Removed, now works.
|
||||
* :AutoInstall: implemented
|
||||
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
|
||||
* :GetLatestVimScripts command
|
||||
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
|
||||
now holds scripts that need updating
|
||||
v10 Apr 19, 2004 : * moved history from script to doc
|
||||
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
|
||||
double quotes ("") whereas other systems will use
|
||||
single quotes ('') around the urls in calls via wget
|
||||
v8 Dec 01, 2003 : makes three tries at downloading
|
||||
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
|
||||
not found in downloaded webpage
|
||||
Uses t_ti, t_te, and rs to make progress visible
|
||||
v6 Aug 06, 2003 : final status messages now display summary of work
|
||||
( "Downloaded someqty scripts" or
|
||||
"Everything was current")
|
||||
Now GetLatestVimScripts is careful about downloading
|
||||
GetLatestVimScripts.vim itself!
|
||||
(goes to <NEW_GetLatestVimScripts.vim>)
|
||||
v5 Aug 04, 2003 : missing an endif near bottom
|
||||
v4 Jun 17, 2003 : redraw! just before each "considering" message
|
||||
v3 May 27, 2003 : Protects downloaded files from errant shell
|
||||
expansions with single quotes: '...'
|
||||
v2 May 14, 2003 : extracts name of item to be obtained from the
|
||||
script file. Uses it instead of comment field
|
||||
for output filename; comment is used in the
|
||||
"considering..." line and is now just a comment!
|
||||
* 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
|
||||
*pi_getscript.txt* For Vim version 7.0. Last change: 2006 Nov 1
|
||||
>
|
||||
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr.
|
||||
<
|
||||
Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
|
||||
(remove NOSPAM from the email address)
|
||||
*GetLatestVimScripts-copyright*
|
||||
Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *glvs-copyright*
|
||||
The VIM LICENSE applies to getscript.vim and
|
||||
pi_getscript.txt (see |copyright|) except use
|
||||
"getscript" instead of "Vim". No warranty, express or implied.
|
||||
Use At-Your-Own-Risk.
|
||||
|
||||
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
|
||||
then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
|
||||
get the latest versions of scripts listed therein from http://vim.sf.net/.
|
||||
|
||||
==============================================================================
|
||||
1. Contents *glvs-contents* *glvs* *getscript*
|
||||
*GetLatestVimScripts*
|
||||
|
||||
1. Contents........................................: |glvs-contents|
|
||||
2. GetLatestVimScripts -- Getting Started..........: |glvs-install|
|
||||
3. GetLatestVimScripts Usage.......................: |glvs-usage|
|
||||
4. GetLatestVimScripts Data File...................: |glvs-data|
|
||||
5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins|
|
||||
6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall|
|
||||
7. GetLatestViMScripts Options.....................: |glvs-options|
|
||||
8. GetLatestVimScripts Algorithm...................: |glvs-alg|
|
||||
9. GetLatestVimScripts History.....................: |glvs-hist|
|
||||
|
||||
|
||||
==============================================================================
|
||||
2. GetLatestVimScripts -- Getting Started *getscript-start*
|
||||
*getlatestvimscripts-install*
|
||||
|
||||
VERSION FROM VIM DISTRIBUTION *glvs-dist-install*
|
||||
|
||||
Vim 7.0 does not include the GetLatestVimScripts.dist file which
|
||||
serves as an example and a template. So, you'll need to create
|
||||
your own! See |GetLatestVimScripts_dat|.
|
||||
|
||||
VERSION FROM VIM SF NET *glvs-install*
|
||||
|
||||
NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist
|
||||
file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for
|
||||
the first time.
|
||||
|
||||
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;
|
||||
the "important" part of it is the first two lines.
|
||||
|
||||
Your computer needs to have wget for GetLatestVimScripts to do its work.
|
||||
|
||||
1. if compressed: gunzip getscript.vba.gz
|
||||
2. Unix:
|
||||
vim getscript.vba
|
||||
:so %
|
||||
:q
|
||||
cd ~/.vim/GetLatest
|
||||
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
|
||||
(edit GetLatestVimScripts.dat to install your own personal
|
||||
list of desired plugins -- see |GetLatestVimScripts_dat|)
|
||||
|
||||
3. Windows:
|
||||
vim getscript.vba
|
||||
:so %
|
||||
:q
|
||||
cd **path-to-vimfiles**/GetLatest
|
||||
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
|
||||
(edit GetLatestVimScripts.dat to install your own personal
|
||||
list of desired plugins -- see |GetLatestVimScripts_dat|)
|
||||
|
||||
|
||||
==============================================================================
|
||||
3. GetLatestVimScripts Usage *glvs-usage* *:GLVS*
|
||||
|
||||
Unless its been defined elsewhere, >
|
||||
:GLVS
|
||||
will invoke GetLatestVimScripts(). If some other plugin has defined that
|
||||
command, then you may type
|
||||
>
|
||||
:GetLatestVimScripts
|
||||
<
|
||||
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
|
||||
file,
|
||||
>
|
||||
.vim/GetLatest/GetLatestVimScripts.dat (unix)
|
||||
<
|
||||
or >
|
||||
..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
|
||||
(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
|
||||
directory (see |glvs-plugins|).
|
||||
|
||||
Scripts which have been downloaded will appear in the
|
||||
~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows)
|
||||
subdirectory. GetLatestVimScripts will attempt to automatically
|
||||
install them if you have the following line in your <.vimrc>: >
|
||||
|
||||
let g:GetLatestVimScripts_allowautoinstall=1
|
||||
|
||||
The <GetLatestVimScripts.dat> file will be automatically be updated to
|
||||
reflect the latest version of script(s) so downloaded.
|
||||
(also see |glvs-options|)
|
||||
|
||||
|
||||
==============================================================================
|
||||
4. GetLatestVimScripts Data File *getscript-data* *glvs-data*
|
||||
*:GetLatestVimScripts_dat*
|
||||
The data file <GetLatestVimScripts.dat> must have for its first two lines
|
||||
the following text:
|
||||
>
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
<
|
||||
Following those two lines are three columns; the first two are numeric
|
||||
followed by a text column. The GetLatest/GetLatestVimScripts.dist file
|
||||
contains an example of such a data file. Anything following a #... is
|
||||
ignored, so you may embed comments in the file.
|
||||
|
||||
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
|
||||
click on the script's link, you'll see a line resembling
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=40
|
||||
|
||||
The "40" happens to be a ScriptID that GetLatestVimScripts needs to
|
||||
download the associated page.
|
||||
|
||||
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
|
||||
serves to indicate "when" a script was uploaded. Setting the SourceID to 1
|
||||
insures that GetLatestVimScripts will assume that the script it has is
|
||||
out-of-date.
|
||||
|
||||
The SourceID is extracted by GetLatestVimScripts from the script's page on
|
||||
vim.sf.net; whenever its greater than the one stored in the
|
||||
GetLatestVimScripts.dat file, the script will be downloaded
|
||||
(see |GetLatestVimScripts_dat|).
|
||||
|
||||
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
|
||||
<GetLatestVimScripts.dat> file, including any dependencies on other scripts it
|
||||
may have. As an example, consider: >
|
||||
|
||||
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
|
||||
|
||||
This comment line tells getscript.vim to check vimscript #884 and that the
|
||||
script is automatically installable. Getscript will also use this line to
|
||||
help build the GetLatestVimScripts.dat file, by including a line such as: >
|
||||
|
||||
884 1 AutoAlign.vim
|
||||
<
|
||||
in it an AutoAlign.vim line isn't already in GetLatestVimScripts.dat file.
|
||||
See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a
|
||||
comprehensive ability to keep your plugins up-to-date!
|
||||
|
||||
*GetLatestVimScripts_dat*
|
||||
As an example of a <GetLatestVimScripts.dat> file:
|
||||
>
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
294 1 Align.vim
|
||||
120 2 decho.vim
|
||||
40 3 DrawIt.tar.gz
|
||||
451 4 EasyAccents.vim
|
||||
195 5 engspchk.vim
|
||||
642 6 GetLatestVimScripts.vim
|
||||
489 7 Manpageview.vim
|
||||
<
|
||||
Note: the first two lines are required, but essentially act as comments.
|
||||
|
||||
|
||||
==============================================================================
|
||||
5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins*
|
||||
|
||||
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.dat files:
|
||||
>
|
||||
src_id
|
||||
v
|
||||
" GetLatestVimScripts: ### ### yourscriptname
|
||||
^
|
||||
scriptid
|
||||
<
|
||||
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.
|
||||
Same format, of course!
|
||||
|
||||
If your command is auto-installable (see |glvs-autoinstall|), and most scripts
|
||||
are, then you may include :AutoInstall: at the start of "yourscriptname".
|
||||
|
||||
GetLatestVimScripts commands for those scripts are then appended, if not
|
||||
already present, to the user's GetLatest/GetLatestVimScripts.dat file. Its a
|
||||
relatively painless way to automate the acquisition of any scripts your
|
||||
plugins depend upon.
|
||||
|
||||
Now, as an author, you probably don't want GetLatestVimScripts to download
|
||||
your own scripts for you yourself, thereby overwriting your not-yet-released
|
||||
hard work. GetLatestVimScripts provides a solution for this: put
|
||||
>
|
||||
0 0 yourscriptname
|
||||
<
|
||||
into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip
|
||||
examining the "yourscriptname" scripts for those GetLatestVimScripts comment
|
||||
lines. As a result, those lines won't be inadvertently installed into your
|
||||
<GetLatestVimScripts.dat> file and subsequently used to download your own
|
||||
scripts. This is especially important to do if you've included the
|
||||
:AutoInstall: option.
|
||||
|
||||
Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
|
||||
as you've used in your GetLatestVimScripts comment!
|
||||
|
||||
|
||||
==============================================================================
|
||||
6. GetLatestVimScripts AutoInstall *getscript-autoinstall*
|
||||
*glvs-autoinstall*
|
||||
|
||||
GetLatestVimScripts now supports "AutoInstall". Not all scripts are
|
||||
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
|
||||
other hand, most scripts will be auto-installable.
|
||||
|
||||
To let GetLatestVimScripts do an autoinstall, the data file's comment field
|
||||
should begin with (surrounding blanks are ignored): >
|
||||
|
||||
:AutoInstall:
|
||||
<
|
||||
Both colons are needed, and it should begin the comment (yourscriptname)
|
||||
field.
|
||||
|
||||
One may prevent any autoinstalling by putting the following line in your
|
||||
<.vimrc>: >
|
||||
|
||||
let g:GetLatestVimScripts_allowautoinstall= 0
|
||||
<
|
||||
With :AutoInstall: enabled, as it is by default, files which end with
|
||||
|
||||
---.tar.bz2 : decompressed & untarred in .vim/ directory
|
||||
---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
|
||||
---.vim.bz2 : decompressed & moved into .vim/plugin directory
|
||||
---.tar.gz : decompressed & untarred in .vim/ directory
|
||||
---.vba.gz : decompressed in .vim/ directory, then vimball handles it
|
||||
---.vim.gz : decompressed & moved into .vim/plugin directory
|
||||
---.vba : unzipped in .vim/ directory
|
||||
---.vim : moved to .vim/plugin directory
|
||||
---.zip : unzipped in .vim/ directory
|
||||
|
||||
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
|
||||
course, should always be auto-installable.
|
||||
|
||||
When is a script not auto-installable? Let me give an example:
|
||||
|
||||
.vim/after/syntax/blockhl.vim
|
||||
|
||||
The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
|
||||
available at:
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=104
|
||||
|
||||
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
|
||||
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
|
||||
allow a after/syntax/c/ directory:
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=1023
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
|
||||
==============================================================================
|
||||
7. GetLatestVimScripts Options *glvs-options*
|
||||
>
|
||||
g:GetLatestVimScripts_wget
|
||||
< default= "wget"
|
||||
This variable holds the name of the command for obtaining
|
||||
scripts.
|
||||
>
|
||||
g:GetLatestVimScripts_options
|
||||
< default= "-q -O"
|
||||
This variable holds the options to be used with the
|
||||
g:GetLatestVimScripts_wget command.
|
||||
>
|
||||
g:getLatestVimScripts_allowautoinstall
|
||||
< default= 1
|
||||
This variable indicates whether GetLatestVimScripts is allowed
|
||||
to attempt to automatically install scripts. Note that it
|
||||
doesn't understand vimballs (yet). Furthermore, the plugin
|
||||
author has to have explicitly indicated that his/her plugin
|
||||
is automatically installable.
|
||||
|
||||
|
||||
==============================================================================
|
||||
8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
|
||||
|
||||
The Vim sourceforge page dynamically creates a page by keying off of the
|
||||
so-called script-id. Within the webpage of
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=40
|
||||
|
||||
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
|
||||
recorded for the script in GetLatestVimScripts then its time to download a
|
||||
newer copy of that script.
|
||||
|
||||
GetLatestVimScripts will then download the script and update its internal
|
||||
database of script ids, source ids, and scriptnames.
|
||||
|
||||
The AutoInstall process will:
|
||||
|
||||
Move the file from GetLatest/ to the following directory
|
||||
Unix : $HOME/.vim
|
||||
Windows: $HOME\vimfiles
|
||||
if the downloaded file ends with ".bz2"
|
||||
bunzip2 it
|
||||
else if the downloaded file ends with ".gz"
|
||||
gunzip it
|
||||
if the resulting file ends with ".zip"
|
||||
unzip it
|
||||
else if the resulting file ends with ".tar"
|
||||
tar -oxvf it
|
||||
else if the resulting file ends with ".vim"
|
||||
move it to the plugin subdirectory
|
||||
|
||||
|
||||
==============================================================================
|
||||
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 (#...)
|
||||
* handles vimballs
|
||||
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
|
||||
available
|
||||
v21 May 01, 2006 : * now takes advantage of autoloading.
|
||||
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
|
||||
unzip needs the -o flag to overwrite.
|
||||
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
|
||||
script! Fixed.
|
||||
v18 Mar 21, 2005 : * bugfix to automatic database construction
|
||||
* bugfix - nowrapscan caused an error
|
||||
(tnx to David Green for the fix)
|
||||
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
|
||||
:AutoInstall:s, even though its o/s is windows
|
||||
Apr 01, 2005 * when downloading errors occurred, GLVS was
|
||||
terminating early. It now just goes on to trying
|
||||
the next script (after trying three times to
|
||||
download a script description page)
|
||||
Apr 20, 2005 * bugfix - when a failure to download occurred,
|
||||
GetLatestVimScripts would stop early and claim that
|
||||
everything was current. Fixed.
|
||||
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
|
||||
defaults to 1, can be used to prevent all
|
||||
:AutoInstall:
|
||||
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
|
||||
* fixed bug with :AutoInstall: use of helptags
|
||||
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
|
||||
always preventing downloads (just usually). Fixed.
|
||||
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
|
||||
s:dotvim. Fixed.
|
||||
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
|
||||
is zero. Useful for script authors; that way their
|
||||
own GetLatestVimScripts activity won't overwrite
|
||||
their scripts.
|
||||
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
|
||||
was intended only for testing. Removed, now works.
|
||||
* :AutoInstall: implemented
|
||||
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
|
||||
* :GetLatestVimScripts command
|
||||
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
|
||||
now holds scripts that need updating
|
||||
v10 Apr 19, 2004 : * moved history from script to doc
|
||||
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
|
||||
double quotes ("") whereas other systems will use
|
||||
single quotes ('') around the urls in calls via wget
|
||||
v8 Dec 01, 2003 : makes three tries at downloading
|
||||
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
|
||||
not found in downloaded webpage
|
||||
Uses t_ti, t_te, and rs to make progress visible
|
||||
v6 Aug 06, 2003 : final status messages now display summary of work
|
||||
( "Downloaded someqty scripts" or
|
||||
"Everything was current")
|
||||
Now GetLatestVimScripts is careful about downloading
|
||||
GetLatestVimScripts.vim itself!
|
||||
(goes to <NEW_GetLatestVimScripts.vim>)
|
||||
v5 Aug 04, 2003 : missing an endif near bottom
|
||||
v4 Jun 17, 2003 : redraw! just before each "considering" message
|
||||
v3 May 27, 2003 : Protects downloaded files from errant shell
|
||||
expansions with single quotes: '...'
|
||||
v2 May 14, 2003 : extracts name of item to be obtained from the
|
||||
script file. Uses it instead of comment field
|
||||
for output filename; comment is used in the
|
||||
"considering..." line and is now just a comment!
|
||||
* 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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
@ -90,6 +90,7 @@ Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright*
|
||||
==============================================================================
|
||||
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
|
||||
handling problem and it now changes \s to /s
|
||||
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
|
||||
|
||||
@ -27,6 +27,7 @@ lines, and it will remove comment markup for already commented text
|
||||
|
||||
*tComment-Key-Bindings*
|
||||
Key bindings~
|
||||
|
||||
<c-_><c-_> :: :TComment
|
||||
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
|
||||
<c-_>b :: :TCommentBlock
|
||||
@ -34,6 +35,31 @@ Key bindings~
|
||||
<c-_>s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
|
||||
<c-_>i :: :TCommentInline
|
||||
<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*
|
||||
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,
|
||||
tpl, viki, vim, websec, xml, xslt, yaml
|
||||
|
||||
|
||||
Credits~
|
||||
The way we check for embedded syntax was adapted from/inspired by Meikel
|
||||
Brandmeyer's EnhancedCommentify.vim (vimscript #23).
|
||||
The way we check for embedded syntax was originally adapted
|
||||
from/inspired by Meikel Brandmeyer's EnhancedCommentify.vim
|
||||
(vimscript #23) but has evolved since.
|
||||
|
||||
|
||||
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_rsync_cmd pi_netrw.txt /*g:netrw_rsync_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_shq pi_netrw.txt /*g:netrw_shq*
|
||||
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_ssh_browse_reject pi_netrw.txt /*g:netrw_ssh_browse_reject*
|
||||
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_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_nt_rcp pi_netrw.txt /*g:netrw_use_nt_rcp*
|
||||
g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp*
|
||||
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:visincr_datedivset visincr.txt /*g:visincr_datedivset*
|
||||
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
||||
|
@ -5,7 +5,7 @@
|
||||
" Installing: :help glvs-install
|
||||
" 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
|
||||
" 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)
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 27-Dez-2004.
|
||||
" @Last Change: 28-Feb-2006.
|
||||
" @Revision: 1.5.256
|
||||
" @Last Change: 2007-04-15.
|
||||
" @Revision: 1.6.285
|
||||
"
|
||||
" vimscript #1173
|
||||
|
||||
if &cp || exists('loaded_tcomment')
|
||||
finish
|
||||
endif
|
||||
let loaded_tcomment = 105
|
||||
let loaded_tcomment = 106
|
||||
|
||||
fun! <SID>DefVar(name, val)
|
||||
fun! s:DefVar(name, val)
|
||||
if !exists(a:name)
|
||||
" exec "let ". a:name ."='". a:val ."'"
|
||||
exec 'let '. a:name .'="'. escape(a:val, '"\') .'"'
|
||||
@ -20,17 +20,22 @@ fun! <SID>DefVar(name, val)
|
||||
endf
|
||||
|
||||
" 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
|
||||
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
|
||||
" assume that the buffers default comment style isn't php but html
|
||||
call <SID>DefVar('g:tcommentGuessFileType_dsl', 'xml')
|
||||
call <SID>DefVar('g:tcommentGuessFileType_php', 'html')
|
||||
call <SID>DefVar('g:tcommentGuessFileType_html', 1)
|
||||
call <SID>DefVar('g:tcommentGuessFileType_tskeleton', 1)
|
||||
call <SID>DefVar('g:tcommentGuessFileType_vim', 1)
|
||||
call s:DefVar('g:tcommentGuessFileType_dsl', 'xml')
|
||||
call s:DefVar('g:tcommentGuessFileType_php', 'html')
|
||||
call s:DefVar('g:tcommentGuessFileType_html', 1)
|
||||
call s:DefVar('g:tcommentGuessFileType_tskeleton', 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
|
||||
" 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
|
||||
" definition that does this left-handed bar thing
|
||||
call <SID>DefVar('g:tcommentBlockC', "/*%s */\n * ")
|
||||
call <SID>DefVar('g:tcommentBlockC2', "/**%s */\n * ")
|
||||
" call <SID>DefVar('g:tcommentBlockC', "/*%s */\n ")
|
||||
call <SID>DefVar('g:tcommentInlineC', "/* %s */")
|
||||
call s:DefVar('g:tcommentBlockC', "/*%s */\n * ")
|
||||
call s:DefVar('g:tcommentBlockC2', "/**%s */\n * ")
|
||||
" call s:DefVar('g:tcommentBlockC', "/*%s */\n ")
|
||||
call s:DefVar('g:tcommentInlineC', "/* %s */")
|
||||
|
||||
call <SID>DefVar('g:tcommentBlockXML', "<!--%s-->\n ")
|
||||
call <SID>DefVar('g:tcommentInlineXML', "<!-- %s -->")
|
||||
call s:DefVar('g:tcommentBlockXML', "<!--%s-->\n ")
|
||||
call s:DefVar('g:tcommentInlineXML', "<!-- %s -->")
|
||||
|
||||
" Currently this function just sets a variable
|
||||
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
|
||||
endf
|
||||
|
||||
@ -121,12 +126,13 @@ call TCommentDefineType('php', '// %s' )
|
||||
call TCommentDefineType('php_inline', g:tcommentInlineC )
|
||||
call TCommentDefineType('php_block', g:tcommentBlockC )
|
||||
call TCommentDefineType('php_2_block', g:tcommentBlockC2 )
|
||||
call TCommentDefineType('po', '# %s' )
|
||||
call TCommentDefineType('po', '# %s' )
|
||||
call TCommentDefineType('prolog', '%% %s' )
|
||||
call TCommentDefineType('readline', '# %s' )
|
||||
call TCommentDefineType('ruby', '# %s' )
|
||||
call TCommentDefineType('ruby_3', '### %s' )
|
||||
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('sbs', "' %s" )
|
||||
call TCommentDefineType('scheme', '; %s' )
|
||||
@ -142,6 +148,7 @@ call TCommentDefineType('tcl', '# %s' )
|
||||
call TCommentDefineType('tex', '%% %s' )
|
||||
call TCommentDefineType('tpl', '<!-- %s -->' )
|
||||
call TCommentDefineType('viki', '%% %s' )
|
||||
call TCommentDefineType('viki_3', '%%%%%% %s' )
|
||||
call TCommentDefineType('viki_inline', '{cmt: %s}' )
|
||||
call TCommentDefineType('vim', '" %s' )
|
||||
call TCommentDefineType('websec', '# %s' )
|
||||
@ -155,7 +162,7 @@ call TCommentDefineType('yaml', '# %s' )
|
||||
|
||||
let s:tcommentFileTypesDirty = 1
|
||||
|
||||
fun! <SID>DefaultValue(option)
|
||||
fun! s:DefaultValue(option)
|
||||
exec 'let '. a:option .' = &'. a:option
|
||||
exec 'set '. a:option .'&'
|
||||
exec 'let default = &'. a:option
|
||||
@ -163,8 +170,8 @@ fun! <SID>DefaultValue(option)
|
||||
return default
|
||||
endf
|
||||
|
||||
let s:defaultComments = <SID>DefaultValue('comments')
|
||||
let s:defaultCommentString = <SID>DefaultValue('commentstring')
|
||||
let s:defaultComments = s:DefaultValue('comments')
|
||||
let s:defaultCommentString = s:DefaultValue('commentstring')
|
||||
let s:nullCommentString = '%s'
|
||||
|
||||
" TComment(line1, line2, ?commentMode, ?commentAnyway, ?commentBegin, ?commentEnd)
|
||||
@ -175,8 +182,8 @@ let s:nullCommentString = '%s'
|
||||
" R ... right
|
||||
fun! TComment(beg, end, ...)
|
||||
" save the cursor position
|
||||
let co = col(".")
|
||||
let li = line(".")
|
||||
let co = col('.')
|
||||
let li = line('.')
|
||||
let commentMode = a:0 >= 1 ? a:1 : 'G'
|
||||
let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0
|
||||
if commentMode ==# 'IG'
|
||||
@ -199,29 +206,29 @@ fun! TComment(beg, end, ...)
|
||||
endif
|
||||
" get the correct commentstring
|
||||
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 != ''
|
||||
let cms = cms . <SID>EncodeCommentPart(a:4)
|
||||
let cms = cms . s:EncodeCommentPart(a:4)
|
||||
endif
|
||||
else
|
||||
exec <SID>GetCommentString(a:beg, a:end, commentMode)
|
||||
exec s:GetCommentString(a:beg, a:end, commentMode)
|
||||
endif
|
||||
let cms0 = <SID>BlockGetCommentString(cms)
|
||||
let cms0 = s:BlockGetCommentString(cms)
|
||||
let cms0 = escape(cms0, '\')
|
||||
" make whitespace optional; this conflicts with comments that require some
|
||||
" whitespace
|
||||
let cmtCheck = substitute(cms0, '\([ ]\)', '\1\\?', 'g')
|
||||
" turn commentstring into a search pattern
|
||||
let cmtCheck = <SID>SPrintF(cmtCheck, '\(\_.\{-}\)')
|
||||
let cmtCheck = s:SPrintF(cmtCheck, '\(\_.\{-}\)')
|
||||
" 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
|
||||
let mode = 0
|
||||
endif
|
||||
" go
|
||||
if commentMode ==# 'B'
|
||||
" 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
|
||||
" We want commented lines
|
||||
" final search pattern for uncommenting
|
||||
@ -229,27 +236,28 @@ fun! TComment(beg, end, ...)
|
||||
" final pattern for commenting
|
||||
let cmtReplace = escape(cms0, '"/')
|
||||
silent exec a:beg .','. a:end .'s/\V'.
|
||||
\ <SID>StartRx(cstart) . indentStr .'\zs\(\.\*\)'. <SID>EndRx(cend) .'/'.
|
||||
\ '\=<SID>ProcessedLine('. mode .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
|
||||
\ s:StartRx(cstart) . indentStr .'\zs\(\.\*\)'. s:EndRx(cend) .'/'.
|
||||
\ '\=s:ProcessedLine('. mode .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
|
||||
endif
|
||||
" reposition cursor
|
||||
silent exec 'norm! '. li .'G'. co .'|'
|
||||
" silent exec 'norm! '. li .'G'. co .'|'
|
||||
call cursor(li, co)
|
||||
endf
|
||||
|
||||
" :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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
fun! TCommentAs(beg, end, commentAnyway, filetype)
|
||||
@ -263,7 +271,7 @@ fun! TCommentAs(beg, end, commentAnyway, filetype)
|
||||
let commentMode = 'G'
|
||||
let ft = a:filetype
|
||||
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(pre, '%%', '%', 'g')
|
||||
let post = substitute(cms, '^.\{-}%s', '', '')
|
||||
@ -275,41 +283,35 @@ endf
|
||||
command! -bang -complete=custom,TCommentFileTypes -range -nargs=1 TCommentAs
|
||||
\ call TCommentAs(<line1>, <line2>, "<bang>", <f-args>)
|
||||
|
||||
if !hasmapto(":TComment<cr>")
|
||||
noremap <silent> <c-_><c-_> :TComment<cr>
|
||||
vnoremap <silent> <c-_><c-_> :TCommentMaybeInline<cr>
|
||||
inoremap <silent> <c-_><c-_> <c-o>:TComment<cr>
|
||||
noremap <silent> <Leader>__ :TComment<cr>
|
||||
vnoremap <silent> <Leader>__ :TCommentMaybeInline<cr>
|
||||
if (g:tcommentMapLeader1 != '')
|
||||
exec 'noremap <silent> '. g:tcommentMapLeader1 .'<c-_> :TComment<cr>'
|
||||
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'<c-_> :TCommentMaybeInline<cr>'
|
||||
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'<c-_> <c-o>:TComment<cr>'
|
||||
exec 'noremap <silent> '. g:tcommentMapLeader1 .'p vip:TComment<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
|
||||
if !hasmapto(":TComment ")
|
||||
noremap <c-_><space> :TComment
|
||||
inoremap <c-_><space> <c-o>:TComment
|
||||
noremap <Leader>_<space> :TComment<cr>
|
||||
endif
|
||||
if !hasmapto(":TCommentInline<cr>")
|
||||
vnoremap <silent> <c-_>i :TCommentInline<cr>
|
||||
vnoremap <silent> <Leader>_i :TCommentInline<cr>
|
||||
endif
|
||||
if !hasmapto(":TCommentRight<cr>")
|
||||
inoremap <silent> <c-_>r <c-o>:TCommentRight<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>_
|
||||
if (g:tcommentMapLeader2 != '')
|
||||
exec 'noremap <silent> '. g:tcommentMapLeader2 .'_ :TComment<cr>'
|
||||
exec 'vnoremap <silent> '. g:tcommentMapLeader2 .'_ :TCommentMaybeInline<cr>'
|
||||
exec 'noremap <silent> '. g:tcommentMapLeader2 .'p vip:TComment<cr>'
|
||||
exec 'noremap '. g:tcommentMapLeader2 .'<space> :TComment '
|
||||
exec 'vnoremap <silent> '. g:tcommentMapLeader2 .'i :TCommentInline<cr>'
|
||||
exec 'noremap <silent> '. g:tcommentMapLeader2 .'r :TCommentRight<cr>'
|
||||
exec 'vnoremap <silent> '. g:tcommentMapLeader2 .'r :TCommentRight<cr>'
|
||||
exec 'noremap '. g:tcommentMapLeader2 .'b :TCommentBlock<cr>'
|
||||
exec 'noremap '. g:tcommentMapLeader2 .'a :TCommentAs '
|
||||
exec 'noremap '. g:tcommentMapLeader2 .'s :TCommentAs <c-r>=&ft<cr>_'
|
||||
endif
|
||||
|
||||
|
||||
@ -345,16 +347,16 @@ fun! TCommentFileTypes(ArgLead, CmdLine, CursorPos)
|
||||
endif
|
||||
endf
|
||||
|
||||
fun! <SID>EncodeCommentPart(string)
|
||||
fun! s:EncodeCommentPart(string)
|
||||
return substitute(a:string, '%', '%%', 'g')
|
||||
endf
|
||||
|
||||
" <SID>GetCommentString(beg, end, commentMode, ?filetype="")
|
||||
" s:GetCommentString(beg, end, commentMode, ?filetype="")
|
||||
" => RecordCMS
|
||||
fun! <SID>GetCommentString(beg, end, commentMode, ...)
|
||||
fun! s:GetCommentString(beg, end, commentMode, ...)
|
||||
let ft = a:0 >= 1 ? a:1 : ''
|
||||
if ft != ''
|
||||
exec <SID>GetCustomCommentString(ft, a:commentMode)
|
||||
exec s:GetCustomCommentString(ft, a:commentMode)
|
||||
else
|
||||
let cms = ''
|
||||
let commentMode = a:commentMode
|
||||
@ -362,13 +364,13 @@ fun! <SID>GetCommentString(beg, end, commentMode, ...)
|
||||
if cms == ''
|
||||
if exists('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 != ''
|
||||
let cms = <SID>EncodeCommentPart(b:commentStart) .' %s'
|
||||
let cms = s:EncodeCommentPart(b:commentStart) .' %s'
|
||||
if exists('b:commentEnd') && b:commentEnd != ''
|
||||
let cms = cms .' '. <SID>EncodeCommentPart(b:commentEnd)
|
||||
let cms = cms .' '. s:EncodeCommentPart(b:commentEnd)
|
||||
endif
|
||||
return <SID>GetCustomCommentString(&filetype, a:commentMode, cms)
|
||||
return s:GetCustomCommentString(&filetype, a:commentMode, cms)
|
||||
elseif g:tcommentGuessFileType || (exists('g:tcommentGuessFileType_'. &filetype)
|
||||
\ && g:tcommentGuessFileType_{&filetype} =~ '[^0]')
|
||||
if g:tcommentGuessFileType_{&filetype} == 1
|
||||
@ -376,17 +378,17 @@ fun! <SID>GetCommentString(beg, end, commentMode, ...)
|
||||
else
|
||||
let altFiletype = g:tcommentGuessFileType_{&filetype}
|
||||
endif
|
||||
return <SID>GuessFileType(a:beg, a:end, a:commentMode, altFiletype)
|
||||
return s:GuessFileType(a:beg, a:end, a:commentMode, &filetype, altFiletype)
|
||||
else
|
||||
return <SID>GetCustomCommentString(&filetype, a:commentMode, <SID>GuessCurrentCommentString(a:commentMode))
|
||||
return s:GetCustomCommentString(&filetype, a:commentMode, s:GuessCurrentCommentString(a:commentMode))
|
||||
endif
|
||||
endif
|
||||
return <SID>RecordCMS(cms, commentMode)
|
||||
return s:RecordCMS(cms, commentMode)
|
||||
endf
|
||||
|
||||
" <SID>SPrintF(formatstring, ?values ...)
|
||||
" s:SPrintF(formatstring, ?values ...)
|
||||
" => string
|
||||
fun! <SID>SPrintF(string, ...)
|
||||
fun! s:SPrintF(string, ...)
|
||||
let n = 1
|
||||
let r = ''
|
||||
let s = a:string
|
||||
@ -419,7 +421,7 @@ fun! <SID>SPrintF(string, ...)
|
||||
endwh
|
||||
endf
|
||||
|
||||
fun! <SID>StartRx(pos)
|
||||
fun! s:StartRx(pos)
|
||||
if a:pos == 0
|
||||
return '\^'
|
||||
else
|
||||
@ -427,7 +429,7 @@ fun! <SID>StartRx(pos)
|
||||
endif
|
||||
endf
|
||||
|
||||
fun! <SID>EndRx(pos)
|
||||
fun! s:EndRx(pos)
|
||||
if a:pos == 0
|
||||
return '\$'
|
||||
else
|
||||
@ -435,26 +437,26 @@ fun! <SID>EndRx(pos)
|
||||
endif
|
||||
endf
|
||||
|
||||
fun! <SID>GetIndentString(line, start)
|
||||
fun! s:GetIndentString(line, start)
|
||||
let start = a:start > 0 ? a:start - 1 : 0
|
||||
return substitute(strpart(getline(a:line), start), '\V\^\s\*\zs\.\*\$', '', '')
|
||||
endf
|
||||
|
||||
fun! <SID>CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
||||
let mdrx = '\V'. <SID>StartRx(a:cstart) .'\s\*'. a:checkRx .'\s\*'. <SID>EndRx(0)
|
||||
fun! s:CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
||||
let mdrx = '\V'. s:StartRx(a:cstart) .'\s\*'. a:checkRx .'\s\*'. s:EndRx(0)
|
||||
let line = getline(a:beg)
|
||||
if a:cstart != 0 && a:cend != 0
|
||||
let line = strpart(line, 0, a:cend - 1)
|
||||
endif
|
||||
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 n = a:beg + 1
|
||||
while n <= a:end
|
||||
if getline(n) =~ '\S'
|
||||
let jl = indent(n)
|
||||
if jl < il
|
||||
let it = <SID>GetIndentString(n, a:cstart)
|
||||
let it = s:GetIndentString(n, a:cstart)
|
||||
let il = jl
|
||||
endif
|
||||
if a:commentMode ==# 'G'
|
||||
@ -477,7 +479,7 @@ fun! <SID>CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
||||
return 'let indentStr="'. it .'" | let mode='. mode
|
||||
endf
|
||||
|
||||
fun! <SID>ProcessedLine(mode, match, checkRx, replace)
|
||||
fun! s:ProcessedLine(mode, match, checkRx, replace)
|
||||
if !(a:match =~ '\S' || g:tcommentBlankLines)
|
||||
return a:match
|
||||
endif
|
||||
@ -486,18 +488,18 @@ fun! <SID>ProcessedLine(mode, match, checkRx, replace)
|
||||
let rv = substitute(a:match, a:checkRx, '\1\2', '')
|
||||
else
|
||||
" comment
|
||||
let rv = <SID>SPrintF(a:replace, a:match)
|
||||
let rv = s:SPrintF(a:replace, a:match)
|
||||
endif
|
||||
let rv = escape(rv, '\
')
|
||||
let rv = substitute(rv, '\n', '\\\n', 'g')
|
||||
return rv
|
||||
endf
|
||||
|
||||
fun! <SID>CommentBlock(beg, end, mode, checkRx, replace, indentStr)
|
||||
fun! s:CommentBlock(beg, end, mode, checkRx, replace, indentStr)
|
||||
let t = @t
|
||||
try
|
||||
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, '\')
|
||||
if a:mode
|
||||
" uncomment
|
||||
@ -509,7 +511,7 @@ fun! <SID>CommentBlock(beg, end, mode, checkRx, replace, indentStr)
|
||||
let @t = substitute(@t, '\n\s*$', '', '')
|
||||
else
|
||||
" comment
|
||||
let cs = <SID>BlockGetCommentString(a:replace)
|
||||
let cs = s:BlockGetCommentString(a:replace)
|
||||
let cs = a:indentStr . substitute(cs, '%s', '%s'. a:indentStr, '')
|
||||
if 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 = ms . substitute(@t, '\n'. a:indentStr, '\n'. mx, 'g')
|
||||
endif
|
||||
let @t = <SID>SPrintF(cs, "\n". @t ."\n")
|
||||
let @t = s:SPrintF(cs, "\n". @t ."\n")
|
||||
endif
|
||||
silent norm! "tP
|
||||
finally
|
||||
@ -527,17 +529,17 @@ endf
|
||||
|
||||
" inspired by Meikel Brandmeyer's EnhancedCommentify.vim
|
||||
" 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
|
||||
fun! <SID>GuessFileType(beg, end, commentMode, ...)
|
||||
fun! s:GuessFileType(beg, end, commentMode, filetype, ...)
|
||||
if a:0 >= 1 && a:1 != ''
|
||||
exec <SID>GetCustomCommentString(a:1, a:commentMode)
|
||||
exec s:GetCustomCommentString(a:1, a:commentMode)
|
||||
if cms == ''
|
||||
let cms = <SID>GuessCurrentCommentString(a:commentMode)
|
||||
let cms = s:GuessCurrentCommentString(a:commentMode)
|
||||
endif
|
||||
else
|
||||
let commentMode = 'G'
|
||||
let cms = <SID>GuessCurrentCommentString(0)
|
||||
let cms = s:GuessCurrentCommentString(0)
|
||||
endif
|
||||
let n = a:beg
|
||||
while n <= a:end
|
||||
@ -547,7 +549,11 @@ fun! <SID>GuessFileType(beg, end, commentMode, ...)
|
||||
let syntaxName = synIDattr(synID(n, m, 1), 'name')
|
||||
if syntaxName =~ g:tcommentFileTypesRx
|
||||
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*$'
|
||||
let m = m + 1
|
||||
else
|
||||
@ -556,10 +562,10 @@ fun! <SID>GuessFileType(beg, end, commentMode, ...)
|
||||
endwh
|
||||
let n = n + 1
|
||||
endwh
|
||||
return <SID>RecordCMS(cms, commentMode)
|
||||
return s:RecordCMS(cms, commentMode)
|
||||
endf
|
||||
|
||||
fun! <SID>GuessCurrentCommentString(commentMode)
|
||||
fun! s:GuessCurrentCommentString(commentMode)
|
||||
let valid_cms = (stridx(&commentstring, '%s') != -1)
|
||||
if &commentstring != s:defaultCommentString && valid_cms
|
||||
" The &commentstring appears to have been set and to be valid
|
||||
@ -568,7 +574,7 @@ fun! <SID>GuessCurrentCommentString(commentMode)
|
||||
if &comments != s:defaultComments
|
||||
" the commentstring is the default one, so we assume that it wasn't
|
||||
" 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
|
||||
return cms
|
||||
endif
|
||||
@ -583,16 +589,16 @@ fun! <SID>GuessCurrentCommentString(commentMode)
|
||||
endif
|
||||
endf
|
||||
|
||||
fun! <SID>ConstructFromComments(commentMode)
|
||||
exec <SID>ExtractCommentsPart('')
|
||||
fun! s:ConstructFromComments(commentMode)
|
||||
exec s:ExtractCommentsPart('')
|
||||
if a:commentMode == 'G' && line != ''
|
||||
return line .' %s'
|
||||
endif
|
||||
exec <SID>ExtractCommentsPart('s')
|
||||
exec s:ExtractCommentsPart('s')
|
||||
if s != ''
|
||||
exec <SID>ExtractCommentsPart('e')
|
||||
exec s:ExtractCommentsPart('e')
|
||||
" if a:commentMode
|
||||
" exec <SID>ExtractCommentsPart("m")
|
||||
" exec s:ExtractCommentsPart("m")
|
||||
" if m != ""
|
||||
" let m = "\n". m
|
||||
" endif
|
||||
@ -608,7 +614,7 @@ fun! <SID>ConstructFromComments(commentMode)
|
||||
endif
|
||||
endf
|
||||
|
||||
fun! <SID>ExtractCommentsPart(key)
|
||||
fun! s:ExtractCommentsPart(key)
|
||||
" let key = a:key != "" ? a:key .'[^:]*' : ""
|
||||
let key = a:key . '[bnflrxO0-9-]*'
|
||||
let val = substitute(&comments, '^\(.\{-},\)\{-}'. key .':\([^,]\+\).*$', '\2', '')
|
||||
@ -621,9 +627,9 @@ fun! <SID>ExtractCommentsPart(key)
|
||||
return 'let '. var .'="'. escape(val, '"') .'"'
|
||||
endf
|
||||
|
||||
" <SID>GetCustomCommentString(ft, commentMode, ?default="")
|
||||
" s:GetCustomCommentString(ft, commentMode, ?default="")
|
||||
" => RecordCMS
|
||||
fun! <SID>GetCustomCommentString(ft, commentMode, ...)
|
||||
fun! s:GetCustomCommentString(ft, commentMode, ...)
|
||||
let commentMode = a:commentMode
|
||||
let customComment = exists('g:tcomment_'. a:ft)
|
||||
if commentMode ==# 'B' && exists('g:tcomment_'. a:ft .'_block')
|
||||
@ -640,18 +646,18 @@ fun! <SID>GetCustomCommentString(ft, commentMode, ...)
|
||||
let cms = ''
|
||||
let commentMode = 'G'
|
||||
endif
|
||||
return <SID>RecordCMS(cms, commentMode)
|
||||
return s:RecordCMS(cms, commentMode)
|
||||
endf
|
||||
|
||||
fun! <SID>RecordCMS(cms, commentMode)
|
||||
fun! s:RecordCMS(cms, commentMode)
|
||||
return 'let cms="'. escape(a:cms, '"') .'" | let commentMode="'. a:commentMode .'"'
|
||||
endf
|
||||
|
||||
fun! <SID>BlockGetCommentString(cms)
|
||||
fun! s:BlockGetCommentString(cms)
|
||||
return substitute(a:cms, '\n.*$', '', '')
|
||||
endf
|
||||
|
||||
fun! <SID>BlockGetMiddleString(cms)
|
||||
fun! s:BlockGetMiddleString(cms)
|
||||
let rv = substitute(a:cms, '^.\{-}\n\([^\n]*\)', '\1', '')
|
||||
return rv == a:cms ? '' : rv
|
||||
endf
|
||||
@ -708,3 +714,13 @@ defining a new filetype via TCommentDefineType()
|
||||
- Renamed TCommentVisualBlock to TCommentRight
|
||||
- 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
|
||||
|
||||
|
@ -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=0 VimballList call vimball#Vimball(0)
|
||||
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 set noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
|
||||
au BufEnter *.vba.gz,*.vba.bz2,*.vba.zip call vimball#Decompress(expand("<amatch>"))
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user