+ blockdiff.vim, vgrepsup.vim
git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@147 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
parent
2457040044
commit
522f5b30cc
@ -29,7 +29,7 @@ setlocal expandtab
|
|||||||
"set cindent
|
"set cindent
|
||||||
setlocal cinoptions=*200,)100,(s,w1
|
setlocal cinoptions=*200,)100,(s,w1
|
||||||
let &l:shiftwidth = tabwidth
|
let &l:shiftwidth = tabwidth
|
||||||
setlocal formatoptions=croq
|
setlocal formatoptions=wan2croql
|
||||||
setlocal formatexpr=KgsFormat()
|
setlocal formatexpr=KgsFormat()
|
||||||
|
|
||||||
" commenting
|
" commenting
|
||||||
|
@ -25,13 +25,20 @@ syn keyword damosFunction einstelleSprache oeffneOSp liesBezeichner oeffnePV
|
|||||||
syn keyword damosFunction liesAdressDatei anlegeDatenstand
|
syn keyword damosFunction liesAdressDatei anlegeDatenstand
|
||||||
syn keyword damosFunction liesKonservierung speichere schreibeHexDatei
|
syn keyword damosFunction liesKonservierung speichere schreibeHexDatei
|
||||||
syn keyword damosFunction schreibeASAP_AgIAsw
|
syn keyword damosFunction schreibeASAP_AgIAsw
|
||||||
syn keyword damosFunction kdoOTypCheck ausfuehreTrans pruefeAutoRam
|
syn keyword damosFunction kdoOTypCheck ausfuehre ausfuehreTrans pruefeAutoRam
|
||||||
syn keyword damosFunction pruefeFktKonsistenz schreibeFhlListAusFktKonsPruef
|
syn keyword damosFunction pruefeFktKonsistenz schreibeFhlListAusFktKonsPruef
|
||||||
syn keyword damosFunction oeffneQuellDatenstand fuelleAusTestwerte
|
syn keyword damosFunction oeffneQuellDatenstand fuelleAusTestwerte
|
||||||
syn keyword damosFunction definiereSGGrAuswahl anlegeAsw entferneAsw schneideAsw
|
syn keyword damosFunction definiereSGGrAuswahl anlegeAsw entferneAsw schneideAsw
|
||||||
syn keyword damosFunction schliesseAsw setzeUmfang schreibeDatenquelle
|
syn keyword damosFunction schliesseAsw setzeUmfang schreibeDatenquelle
|
||||||
syn keyword damosFunction schreibeFktIncludeAbh anlegeOSp importiereObjekte
|
syn keyword damosFunction schreibeFktIncludeAbh anlegeOSp importiereObjekte
|
||||||
syn keyword damosFunction schliesseOSp
|
syn keyword damosFunction anlegeProjekt anlegePV liesDefBase
|
||||||
|
syn keyword damosFunction schliesseOSp schliesseQuellDatenstand
|
||||||
|
syn keyword damosFunction anzeigeVarKod liefereName
|
||||||
|
syn keyword damosFunction pruefeAblKonsistenz pruefeBezeichnerListe
|
||||||
|
syn keyword damosFunction pruefeRefInfo pruefeSpeicherbereiche
|
||||||
|
syn keyword damosFunction pruefeMinPMaxP pruefeVarKod vater
|
||||||
|
syn keyword damosFunction schreibeFhlListAusBezKonsPruef schreibeFktIncludeAsw
|
||||||
|
|
||||||
syn keyword damosCommand exit Dam DAMOS quellDst
|
syn keyword damosCommand exit Dam DAMOS quellDst
|
||||||
|
|
||||||
syn match damosSeperator "[<>,:]"
|
syn match damosSeperator "[<>,:]"
|
||||||
|
@ -13,6 +13,7 @@ syntax keyword kgsDefinitions fkt_bezeichner kgs_bezeichner ram_bezeichner
|
|||||||
syntax keyword kgsDefinitions ram_groesse lok_ram_groesse kennwert kennlinie
|
syntax keyword kgsDefinitions ram_groesse lok_ram_groesse kennwert kennlinie
|
||||||
syntax keyword kgsDefinitions gruppenkennlinie gruppenkennfeld gruppenstuetzstellen
|
syntax keyword kgsDefinitions gruppenkennlinie gruppenkennfeld gruppenstuetzstellen
|
||||||
syntax keyword kgsDefinitions kennfeld kennwerteblock systemkonstante festkennlinie
|
syntax keyword kgsDefinitions kennfeld kennwerteblock systemkonstante festkennlinie
|
||||||
|
syntax keyword kgsDefinitions kenngroessen_gruppe ramgroessen_gruppe
|
||||||
syntax keyword kgsRefgroessen ref_ram_groesse ref_kenngroesse
|
syntax keyword kgsRefgroessen ref_ram_groesse ref_kenngroesse
|
||||||
syntax keyword kgsKomponents umrechnung codesyntax datentyp adressierschema
|
syntax keyword kgsKomponents umrechnung codesyntax datentyp adressierschema
|
||||||
syntax keyword kgsKomponents bitanzahl element_anzahl bitbasis_typ bitposition
|
syntax keyword kgsKomponents bitanzahl element_anzahl bitbasis_typ bitposition
|
||||||
|
@ -10,7 +10,7 @@ setlocal softtabstop=4
|
|||||||
setlocal formatoptions=croq
|
setlocal formatoptions=croq
|
||||||
|
|
||||||
" vimfiles sollen immer im unix-Format gespeichert werden
|
" vimfiles sollen immer im unix-Format gespeichert werden
|
||||||
if filewritable(expand('%'))
|
if &modifiable
|
||||||
setlocal fileformat=unix
|
setlocal fileformat=unix
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -14,6 +14,10 @@ if exists('nochangelog')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function s:ReportRev(Rev)
|
function s:ReportRev(Rev)
|
||||||
|
if a:Rev >= '145'
|
||||||
|
echo 'Neu seit Rev: 145'
|
||||||
|
echo 'BlockDiff: Markieren -> BlockDiff -> Markieren -> BlockDiff -> neuer Tab'
|
||||||
|
echo 'Gsub: global substitute'
|
||||||
if a:Rev >= '139'
|
if a:Rev >= '139'
|
||||||
echo 'Neu seit Rev: 129'
|
echo 'Neu seit Rev: 129'
|
||||||
echo 'Projekt laden über project.vim'
|
echo 'Projekt laden über project.vim'
|
||||||
|
@ -323,3 +323,67 @@ disk
|
|||||||
false
|
false
|
||||||
true
|
true
|
||||||
copy_FCMTabEntryType
|
copy_FCMTabEntryType
|
||||||
|
brief
|
||||||
|
author
|
||||||
|
date
|
||||||
|
Ramgrößen
|
||||||
|
lint
|
||||||
|
Ramwert
|
||||||
|
Adaptionswertes
|
||||||
|
restore
|
||||||
|
Adaptionswert
|
||||||
|
Adaptionsgrößen
|
||||||
|
Adaptionswerten
|
||||||
|
ref
|
||||||
|
ram
|
||||||
|
bezeichner
|
||||||
|
groesse
|
||||||
|
RaMNonVolatileRamU16
|
||||||
|
umrechnung
|
||||||
|
dez
|
||||||
|
Initialisierungswert
|
||||||
|
kennwert
|
||||||
|
KgMKwWU16
|
||||||
|
uint16
|
||||||
|
Doxygen
|
||||||
|
doku
|
||||||
|
page
|
||||||
|
Fahrsoftware
|
||||||
|
section
|
||||||
|
Adaptionsvorgänge
|
||||||
|
create
|
||||||
|
li
|
||||||
|
Ramgröße
|
||||||
|
code
|
||||||
|
wertp
|
||||||
|
endcode
|
||||||
|
include
|
||||||
|
b
|
||||||
|
Init
|
||||||
|
Objektspeicher
|
||||||
|
Desc
|
||||||
|
Preprozessor
|
||||||
|
Description
|
||||||
|
Hint
|
||||||
|
BMSX
|
||||||
|
Mainpage
|
||||||
|
Developersguide
|
||||||
|
Entwicklerdoku
|
||||||
|
mainpage
|
||||||
|
image
|
||||||
|
html
|
||||||
|
jpg
|
||||||
|
Developers
|
||||||
|
Guide
|
||||||
|
Library
|
||||||
|
BDL
|
||||||
|
Coding
|
||||||
|
Guidelines
|
||||||
|
Applikationsdaten
|
||||||
|
subsection
|
||||||
|
check
|
||||||
|
subsubsection
|
||||||
|
Applikationslabel
|
||||||
|
Codesyntaxen
|
||||||
|
shade
|
||||||
|
Headers
|
||||||
|
Binary file not shown.
@ -1,7 +1,6 @@
|
|||||||
ScriptID SourceID Filename
|
ScriptID SourceID Filename
|
||||||
--------------------------
|
--------------------------
|
||||||
642 7080 GetLatestVimScripts.vim
|
1075 7738 netrw.vim
|
||||||
1075 7079 netrw.vim
|
|
||||||
1502 7078 vimball.vim
|
1502 7078 vimball.vim
|
||||||
1008 3118 srec.vim (ftplugin)
|
1008 3118 srec.vim (ftplugin)
|
||||||
1009 3119 srec.vim (syntax file)
|
1009 3119 srec.vim (syntax file)
|
||||||
@ -12,12 +11,18 @@ ScriptID SourceID Filename
|
|||||||
51 171 cscope_macros.vim
|
51 171 cscope_macros.vim
|
||||||
102 5306 DirDiff.vim
|
102 5306 DirDiff.vim
|
||||||
1189 6533 matrix.vim
|
1189 6533 matrix.vim
|
||||||
1173 7046 tcomment
|
1173 7588 tcomment
|
||||||
948 2878 Scons Compiler plugin
|
948 2878 Scons Compiler plugin
|
||||||
1709 6421 Scons Syntax file
|
1709 6421 Scons Syntax file
|
||||||
1772 7248 DAMOS.zip DAMOS tools (von Stefan)
|
1772 7248 DAMOS.zip DAMOS tools (von Stefan)
|
||||||
987 6978 DoxygenToolkit.vim
|
987 6978 DoxygenToolkit.vim
|
||||||
1397 6887 xml.vim
|
1397 6887 xml.vim
|
||||||
1290 5190 LogiPat
|
1290 5190 LogiPat.vim
|
||||||
1881 7244 svndiff
|
1881 7505 svndiff
|
||||||
1462 5612 dtd2xml
|
1462 5612 dtd2xml
|
||||||
|
1046 4249 Lusty Explorer
|
||||||
|
2043 7805 VimPdb (debugging python)
|
||||||
|
1776 7810 Vimgrep Replace
|
||||||
|
2048 7815 BlockDiff
|
||||||
|
642 7080 getscript.vim
|
||||||
|
642 7080 :AutoInstall: GetLatestVimScripts.vim
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
" netrwSettings.vim: makes netrw settings simpler
|
" netrwSettings.vim: makes netrw settings simpler
|
||||||
" Date: Mar 26, 2007
|
" Date: Jun 04, 2007
|
||||||
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
|
||||||
" Version: 9
|
" Version: 11
|
||||||
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
|
||||||
" Permission is hereby granted to use and distribute this code,
|
" Permission is hereby granted to use and distribute this code,
|
||||||
" with or without modifications, provided that this copyright
|
" with or without modifications, provided that this copyright
|
||||||
@ -19,13 +19,13 @@
|
|||||||
if exists("g:loaded_netrwSettings") || &cp
|
if exists("g:loaded_netrwSettings") || &cp
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_netrwSettings = "v9"
|
let g:loaded_netrwSettings = "v11"
|
||||||
|
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" NetrwSettings: {{{1
|
" NetrwSettings: {{{1
|
||||||
fun! netrwSettings#NetrwSettings()
|
fun! netrwSettings#NetrwSettings()
|
||||||
" this call is here largely just to insure that netrw has been loaded
|
" this call is here largely just to insure that netrw has been loaded
|
||||||
call netrw#NetSavePosn()
|
call netrw#NetrwSavePosn()
|
||||||
if !exists("g:loaded_netrw")
|
if !exists("g:loaded_netrw")
|
||||||
echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
|
echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
|
||||||
return
|
return
|
||||||
@ -101,6 +101,11 @@ fun! netrwSettings#NetrwSettings()
|
|||||||
else
|
else
|
||||||
put = 'let g:netrw_browsex_viewer = (not defined)'
|
put = 'let g:netrw_browsex_viewer = (not defined)'
|
||||||
endif
|
endif
|
||||||
|
let cdescline= line("$")
|
||||||
|
put ='let g:netrw_cd_escape...'
|
||||||
|
put = 'let g:netrw_compress = '.g:netrw_compress
|
||||||
|
let decompressline= line("$")
|
||||||
|
put ='let g:netrw_decompress...'
|
||||||
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
|
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
|
||||||
put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse
|
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_browse_reject = '.g:netrw_ftp_browse_reject
|
||||||
@ -111,12 +116,15 @@ fun! netrwSettings#NetrwSettings()
|
|||||||
put = 'let g:netrw_keepdir = '.g:netrw_keepdir
|
put = 'let g:netrw_keepdir = '.g:netrw_keepdir
|
||||||
put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
|
put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
|
||||||
put = 'let g:netrw_list_hide = '.g:netrw_list_hide
|
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_liststyle = '.g:netrw_liststyle
|
||||||
|
put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
|
||||||
|
put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir
|
||||||
|
put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
|
||||||
|
put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir
|
||||||
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
|
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
|
||||||
put = 'let g:netrw_menu = '.g:netrw_menu
|
put = 'let g:netrw_menu = '.g:netrw_menu
|
||||||
put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
|
put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
|
||||||
|
put = 'let g:netrw_preview = '.g:netrw_preview
|
||||||
put = 'let g:netrw_rename_cmd = '.g:netrw_rename_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_rm_cmd = '.g:netrw_rm_cmd
|
||||||
put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
|
put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
|
||||||
@ -142,13 +150,15 @@ fun! netrwSettings#NetrwSettings()
|
|||||||
silent %s/= $/= ''/e
|
silent %s/= $/= ''/e
|
||||||
1
|
1
|
||||||
|
|
||||||
" Put in shq setting.
|
" Put in g:netrw_shq setting and g:netrw_cd_escape
|
||||||
" (deferred so as to avoid the quote manipulation just preceding)
|
" (deferred so as to avoid the quote manipulation just preceding)
|
||||||
if g:netrw_shq == "'"
|
if g:netrw_shq == "'"
|
||||||
call setline(shqline,'let g:netrw_shq = "'.g:netrw_shq.'"')
|
call setline(shqline,'let g:netrw_shq = "'.g:netrw_shq.'"')
|
||||||
else
|
else
|
||||||
call setline(shqline,"let g:netrw_shq = '".g:netrw_shq."'")
|
call setline(shqline,"let g:netrw_shq = '".g:netrw_shq."'")
|
||||||
endif
|
endif
|
||||||
|
call setline(cdescline,"let g:netrw_cd_escape = ".'"'.escape(g:netrw_cd_escape,'\"').'"')
|
||||||
|
call setline(decompressline,"let g:netrw_decompress = ".substitute(string(g:netrw_decompress),"^'\\(.*\\)'$",'\1',''))
|
||||||
|
|
||||||
set nomod
|
set nomod
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,37 +1,65 @@
|
|||||||
*tComment.txt* tComment -- An easily extensible & universal comment plugin
|
*tComment.txt* tComment -- An easily extensible & universal comment plugin
|
||||||
|
|
||||||
Author: Thomas Link, samul AT web.de
|
Author: Thomas Link, micathom AT gmail com?subject=vim
|
||||||
|
|
||||||
tComment provides easy to use, file type sensible comments for Vim. It
|
tComment provides easy to use, file-type sensible comments for Vim. It
|
||||||
can handle embedded syntax.
|
can handle embedded syntax.
|
||||||
|
|
||||||
|
|
||||||
*tComment-Installation*
|
*tComment-Installation*
|
||||||
Installation~
|
Installation~
|
||||||
Copy the file tComment.vim to your plugin directory (~/.vim/plugins/ or
|
Edit the vba file and type:
|
||||||
similar). See |standard-plugin| for further details.
|
|
||||||
|
|
||||||
*tComment-uninstall*
|
:so %
|
||||||
In case you have some bash or similar, you can feed the file
|
|
||||||
etc/tComment.lst to rm: >
|
See :help vimball for details. If you use vim 7.0, you may need to
|
||||||
|
update your vimball installation first.
|
||||||
|
|
||||||
cd $HOME/.vim/
|
|
||||||
rm -i `cat etc/tComment.lst`
|
|
||||||
|
|
||||||
*tComment-Usage*
|
*tComment-Usage*
|
||||||
Usage~
|
Usage~
|
||||||
The command TComment is bound to <c-_><c-_> by default. TComment works
|
TComment works like a toggle, i.e., it will comment out text that
|
||||||
like a toggle, i.e., it will comment out text that contains uncommented
|
contains uncommented lines, and it will remove comment markup for
|
||||||
lines, and it will remove comment markup for already commented text
|
already commented text (i.e. text that contains no uncommented lines).
|
||||||
(i.e. text that contains no uncommented lines).
|
|
||||||
|
If the file-type is properly defined, TComment will figure out which
|
||||||
|
comment string to use. Otherwise you use |TCommentDefineType()| to
|
||||||
|
override the default choice.
|
||||||
|
|
||||||
|
TComment can properly handle an embedded syntax, e.g., ruby/python/perl
|
||||||
|
regions in vim scripts, HTML or JavaScript in php code etc.
|
||||||
|
|
||||||
|
|
||||||
*tComment-Key-Bindings*
|
*tComment-Key-Bindings*
|
||||||
Key bindings~
|
Key bindings~
|
||||||
|
|
||||||
|
Most of the time the default toggle keys will do what you want (or to be
|
||||||
|
more precise: what I think it should to ;-).
|
||||||
|
|
||||||
|
*g:tcommentMapLeaderOp1*
|
||||||
|
*g:tcommentMapLeaderOp2*
|
||||||
|
As operator (the prefix can be customized via g:tcommentMapLeaderOp1
|
||||||
|
and g:tcommentMapLeaderOp2):
|
||||||
|
|
||||||
|
gc{motion} :: Toggle comments (for small comments within one line
|
||||||
|
the &filetype_inline style will be used, if
|
||||||
|
defined)
|
||||||
|
gcc :: Toggle comment for the current line
|
||||||
|
gC{motion} :: Comment region
|
||||||
|
gCc :: Comment the current line
|
||||||
|
|
||||||
|
*g:tcommentOpModeExtra*
|
||||||
|
By default the cursor stays put. If you want the cursor to the end of
|
||||||
|
the commented text, set g:tcommentOpModeExtra to '>' (but this may not
|
||||||
|
work properly with exclusive motions).
|
||||||
|
|
||||||
|
Primary key maps:
|
||||||
|
|
||||||
<c-_><c-_> :: :TComment
|
<c-_><c-_> :: :TComment
|
||||||
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
|
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
|
||||||
<c-_>b :: :TCommentBlock
|
<c-_>b :: :TCommentBlock
|
||||||
<c-_>a :: :TCommentAs <QUERY COMMENT TYPE>
|
<c-_>a :: :TCommentAs <QUERY COMMENT TYPE>
|
||||||
|
<c-_>n :: :TCommentAs &filetype <QUERY COUNT>
|
||||||
<c-_>s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
|
<c-_>s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
|
||||||
<c-_>i :: :TCommentInline
|
<c-_>i :: :TCommentInline
|
||||||
<c-_>r :: :TCommentRight
|
<c-_>r :: :TCommentRight
|
||||||
@ -46,6 +74,7 @@ A secondary set of key maps is defined for normal mode.
|
|||||||
<Leader>_r :: :TCommentRight
|
<Leader>_r :: :TCommentRight
|
||||||
<Leader>_b :: :TCommentBlock
|
<Leader>_b :: :TCommentBlock
|
||||||
<Leader>_a :: :TCommentAs <QUERY COMMENT TYPE>
|
<Leader>_a :: :TCommentAs <QUERY COMMENT TYPE>
|
||||||
|
<Leader>_n :: :TCommentAs &filetype <QUERY COUNT>
|
||||||
<Leader>_s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
|
<Leader>_s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
|
||||||
|
|
||||||
Keymaps are configurable via the following variables:
|
Keymaps are configurable via the following variables:
|
||||||
@ -96,7 +125,7 @@ Alternatively, you can type (? meaning "optional argument"):
|
|||||||
:?<range> TCommentRight!
|
:?<range> TCommentRight!
|
||||||
NOTE: This command comments out the text to the right of the cursor.
|
NOTE: This command comments out the text to the right of the cursor.
|
||||||
If a visual selection was made (be it block-wise or not), all lines
|
If a visual selection was made (be it block-wise or not), all lines
|
||||||
are commented out at from the current cursor positon downwards.
|
are commented out at from the current cursor position downwards.
|
||||||
|
|
||||||
The bang (!) variants always comment out the selected text and don't
|
The bang (!) variants always comment out the selected text and don't
|
||||||
work as toggles.
|
work as toggles.
|
||||||
@ -112,7 +141,7 @@ Alternatively, you can type (? meaning "optional argument"):
|
|||||||
'commentstring'.
|
'commentstring'.
|
||||||
|
|
||||||
If you want to define, e.g., a fancy block comment style for html
|
If you want to define, e.g., a fancy block comment style for html
|
||||||
you could do something like: >
|
you put something like this into ~/.vim/after/plugin/tComment.vim:>
|
||||||
|
|
||||||
call TCommentDefineType("html_fancy_block", "<!--%s -->\n -- ")
|
call TCommentDefineType("html_fancy_block", "<!--%s -->\n -- ")
|
||||||
|
|
||||||
@ -135,7 +164,7 @@ Goals~
|
|||||||
|
|
||||||
- Handle embedded syntax like php+html or html+javaScript+css; you
|
- Handle embedded syntax like php+html or html+javaScript+css; you
|
||||||
have to set g:tcommentGuessFileType_{&filetype} to 1 or to the
|
have to set g:tcommentGuessFileType_{&filetype} to 1 or to the
|
||||||
fallback file type in order to activate this feature for other file
|
fall-back file-type in order to activate this feature for other file
|
||||||
types than php or html
|
types than php or html
|
||||||
|
|
||||||
tComment deduces the correct file type from the syntax name, similar
|
tComment deduces the correct file type from the syntax name, similar
|
||||||
@ -149,7 +178,7 @@ Goals~
|
|||||||
buffer local &commentstring option (which can be set on a vim
|
buffer local &commentstring option (which can be set on a vim
|
||||||
|modeline|)
|
|modeline|)
|
||||||
|
|
||||||
- Use 'commentstring' or 'comments' as a fallback (i.e., if a filetype
|
- Use 'commentstring' or 'comments' as a fallback (i.e., if a file-type
|
||||||
is properly defined, TComment will automatically support it)
|
is properly defined, TComment will automatically support it)
|
||||||
|
|
||||||
- Same short-cut for commenting text and for removing comment markup
|
- Same short-cut for commenting text and for removing comment markup
|
||||||
@ -157,10 +186,10 @@ Goals~
|
|||||||
- The decision whether text should be commented or uncommented is made
|
- The decision whether text should be commented or uncommented is made
|
||||||
on the basis of the whole selection (not line by line); comments in
|
on the basis of the whole selection (not line by line); comments in
|
||||||
code that should be commented aren't uncommented as it is the case
|
code that should be commented aren't uncommented as it is the case
|
||||||
with some other plugins
|
with some other plug-ins
|
||||||
|
|
||||||
As of version 1.5, the following file types are explicitly defined
|
As of version 1.5, the following file types are explicitly defined
|
||||||
(other filetypes are most likely supported through the 'commentstring'
|
(other file-types are most likely supported through the 'commentstring'
|
||||||
or 'comments' variables):
|
or 'comments' variables):
|
||||||
|
|
||||||
ada, apache, autoit, catalog, cpp, css, c, cfg, conf, desktop,
|
ada, apache, autoit, catalog, cpp, css, c, cfg, conf, desktop,
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
:MkVimball pi_vimball.txt /*:MkVimball*
|
:MkVimball pi_vimball.txt /*:MkVimball*
|
||||||
:Nexplore pi_netrw.txt /*:Nexplore*
|
:Nexplore pi_netrw.txt /*:Nexplore*
|
||||||
:Pexplore pi_netrw.txt /*:Pexplore*
|
:Pexplore pi_netrw.txt /*:Pexplore*
|
||||||
|
:Rexplore pi_netrw.txt /*:Rexplore*
|
||||||
:RmVimball pi_vimball.txt /*:RmVimball*
|
:RmVimball pi_vimball.txt /*:RmVimball*
|
||||||
:Sexplore pi_netrw.txt /*:Sexplore*
|
:Sexplore pi_netrw.txt /*:Sexplore*
|
||||||
:TComment tComment.txt /*:TComment*
|
:TComment tComment.txt /*:TComment*
|
||||||
@ -1283,8 +1284,10 @@ g:netrw_alto pi_netrw.txt /*g:netrw_alto*
|
|||||||
g:netrw_altv pi_netrw.txt /*g:netrw_altv*
|
g:netrw_altv pi_netrw.txt /*g:netrw_altv*
|
||||||
g:netrw_browse_split pi_netrw.txt /*g:netrw_browse_split*
|
g:netrw_browse_split pi_netrw.txt /*g:netrw_browse_split*
|
||||||
g:netrw_browsex_viewer pi_netrw.txt /*g:netrw_browsex_viewer*
|
g:netrw_browsex_viewer pi_netrw.txt /*g:netrw_browsex_viewer*
|
||||||
|
g:netrw_compress pi_netrw.txt /*g:netrw_compress*
|
||||||
g:netrw_cygwin pi_netrw.txt /*g:netrw_cygwin*
|
g:netrw_cygwin pi_netrw.txt /*g:netrw_cygwin*
|
||||||
g:netrw_dav_cmd pi_netrw.txt /*g:netrw_dav_cmd*
|
g:netrw_dav_cmd pi_netrw.txt /*g:netrw_dav_cmd*
|
||||||
|
g:netrw_decompress pi_netrw.txt /*g:netrw_decompress*
|
||||||
g:netrw_extracmd pi_netrw.txt /*g:netrw_extracmd*
|
g:netrw_extracmd pi_netrw.txt /*g:netrw_extracmd*
|
||||||
g:netrw_fastbrowse pi_netrw.txt /*g:netrw_fastbrowse*
|
g:netrw_fastbrowse pi_netrw.txt /*g:netrw_fastbrowse*
|
||||||
g:netrw_fetch_cmd pi_netrw.txt /*g:netrw_fetch_cmd*
|
g:netrw_fetch_cmd pi_netrw.txt /*g:netrw_fetch_cmd*
|
||||||
@ -1304,11 +1307,15 @@ g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide*
|
|||||||
g:netrw_liststyle pi_netrw.txt /*g:netrw_liststyle*
|
g:netrw_liststyle pi_netrw.txt /*g:netrw_liststyle*
|
||||||
g:netrw_local_mkdir pi_netrw.txt /*g:netrw_local_mkdir*
|
g:netrw_local_mkdir pi_netrw.txt /*g:netrw_local_mkdir*
|
||||||
g:netrw_local_rmdir pi_netrw.txt /*g:netrw_local_rmdir*
|
g:netrw_local_rmdir pi_netrw.txt /*g:netrw_local_rmdir*
|
||||||
|
g:netrw_localcopycmd pi_netrw.txt /*g:netrw_localcopycmd*
|
||||||
|
g:netrw_localmovecmd pi_netrw.txt /*g:netrw_localmovecmd*
|
||||||
g:netrw_maxfilenamelen pi_netrw.txt /*g:netrw_maxfilenamelen*
|
g:netrw_maxfilenamelen pi_netrw.txt /*g:netrw_maxfilenamelen*
|
||||||
g:netrw_menu pi_netrw.txt /*g:netrw_menu*
|
g:netrw_menu pi_netrw.txt /*g:netrw_menu*
|
||||||
g:netrw_mkdir_cmd pi_netrw.txt /*g:netrw_mkdir_cmd*
|
g:netrw_mkdir_cmd pi_netrw.txt /*g:netrw_mkdir_cmd*
|
||||||
g:netrw_nogx pi_netrw.txt /*g:netrw_nogx*
|
g:netrw_nogx pi_netrw.txt /*g:netrw_nogx*
|
||||||
|
g:netrw_noretmap pi_netrw.txt /*g:netrw_noretmap*
|
||||||
g:netrw_passwd pi_netrw.txt /*g:netrw_passwd*
|
g:netrw_passwd pi_netrw.txt /*g:netrw_passwd*
|
||||||
|
g:netrw_preview pi_netrw.txt /*g:netrw_preview*
|
||||||
g:netrw_rcp_cmd pi_netrw.txt /*g:netrw_rcp_cmd*
|
g:netrw_rcp_cmd pi_netrw.txt /*g:netrw_rcp_cmd*
|
||||||
g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd*
|
g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd*
|
||||||
g:netrw_rmdir_cmd pi_netrw.txt /*g:netrw_rmdir_cmd*
|
g:netrw_rmdir_cmd pi_netrw.txt /*g:netrw_rmdir_cmd*
|
||||||
@ -1318,6 +1325,7 @@ g:netrw_scp_cmd pi_netrw.txt /*g:netrw_scp_cmd*
|
|||||||
g:netrw_scpport pi_netrw.txt /*g:netrw_scpport*
|
g:netrw_scpport pi_netrw.txt /*g:netrw_scpport*
|
||||||
g:netrw_sftp_cmd pi_netrw.txt /*g:netrw_sftp_cmd*
|
g:netrw_sftp_cmd pi_netrw.txt /*g:netrw_sftp_cmd*
|
||||||
g:netrw_shq pi_netrw.txt /*g:netrw_shq*
|
g:netrw_shq pi_netrw.txt /*g:netrw_shq*
|
||||||
|
g:netrw_silent pi_netrw.txt /*g:netrw_silent*
|
||||||
g:netrw_sort_by pi_netrw.txt /*g:netrw_sort_by*
|
g:netrw_sort_by pi_netrw.txt /*g:netrw_sort_by*
|
||||||
g:netrw_sort_direction pi_netrw.txt /*g:netrw_sort_direction*
|
g:netrw_sort_direction pi_netrw.txt /*g:netrw_sort_direction*
|
||||||
g:netrw_sort_sequence pi_netrw.txt /*g:netrw_sort_sequence*
|
g:netrw_sort_sequence pi_netrw.txt /*g:netrw_sort_sequence*
|
||||||
@ -1333,6 +1341,9 @@ g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp*
|
|||||||
g:netrw_winsize pi_netrw.txt /*g:netrw_winsize*
|
g:netrw_winsize pi_netrw.txt /*g:netrw_winsize*
|
||||||
g:tcommentMapLeader1 tComment.txt /*g:tcommentMapLeader1*
|
g:tcommentMapLeader1 tComment.txt /*g:tcommentMapLeader1*
|
||||||
g:tcommentMapLeader2 tComment.txt /*g:tcommentMapLeader2*
|
g:tcommentMapLeader2 tComment.txt /*g:tcommentMapLeader2*
|
||||||
|
g:tcommentMapLeaderOp1 tComment.txt /*g:tcommentMapLeaderOp1*
|
||||||
|
g:tcommentMapLeaderOp2 tComment.txt /*g:tcommentMapLeaderOp2*
|
||||||
|
g:tcommentOpModeExtra tComment.txt /*g:tcommentOpModeExtra*
|
||||||
g:vimball_home pi_vimball.txt /*g:vimball_home*
|
g:vimball_home pi_vimball.txt /*g:vimball_home*
|
||||||
g:visincr_datedivset visincr.txt /*g:visincr_datedivset*
|
g:visincr_datedivset visincr.txt /*g:visincr_datedivset*
|
||||||
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
||||||
@ -1384,10 +1395,15 @@ netrw-bookmarks pi_netrw.txt /*netrw-bookmarks*
|
|||||||
netrw-browse pi_netrw.txt /*netrw-browse*
|
netrw-browse pi_netrw.txt /*netrw-browse*
|
||||||
netrw-browse-cmds pi_netrw.txt /*netrw-browse-cmds*
|
netrw-browse-cmds pi_netrw.txt /*netrw-browse-cmds*
|
||||||
netrw-browse-intro pi_netrw.txt /*netrw-browse-intro*
|
netrw-browse-intro pi_netrw.txt /*netrw-browse-intro*
|
||||||
netrw-browse-var pi_netrw.txt /*netrw-browse-var*
|
netrw-browse-maps pi_netrw.txt /*netrw-browse-maps*
|
||||||
|
netrw-browser pi_netrw.txt /*netrw-browser*
|
||||||
|
netrw-browser-options pi_netrw.txt /*netrw-browser-options*
|
||||||
|
netrw-browser-var pi_netrw.txt /*netrw-browser-var*
|
||||||
|
netrw-browsing pi_netrw.txt /*netrw-browsing*
|
||||||
netrw-c pi_netrw.txt /*netrw-c*
|
netrw-c pi_netrw.txt /*netrw-c*
|
||||||
netrw-cadaver pi_netrw.txt /*netrw-cadaver*
|
netrw-cadaver pi_netrw.txt /*netrw-cadaver*
|
||||||
netrw-chgup pi_netrw.txt /*netrw-chgup*
|
netrw-chgup pi_netrw.txt /*netrw-chgup*
|
||||||
|
netrw-clean pi_netrw.txt /*netrw-clean*
|
||||||
netrw-contents pi_netrw.txt /*netrw-contents*
|
netrw-contents pi_netrw.txt /*netrw-contents*
|
||||||
netrw-cr pi_netrw.txt /*netrw-cr*
|
netrw-cr pi_netrw.txt /*netrw-cr*
|
||||||
netrw-credits pi_netrw.txt /*netrw-credits*
|
netrw-credits pi_netrw.txt /*netrw-credits*
|
||||||
@ -1425,10 +1441,21 @@ netrw-list pi_netrw.txt /*netrw-list*
|
|||||||
netrw-listbookmark pi_netrw.txt /*netrw-listbookmark*
|
netrw-listbookmark pi_netrw.txt /*netrw-listbookmark*
|
||||||
netrw-listhack pi_netrw.txt /*netrw-listhack*
|
netrw-listhack pi_netrw.txt /*netrw-listhack*
|
||||||
netrw-login pi_netrw.txt /*netrw-login*
|
netrw-login pi_netrw.txt /*netrw-login*
|
||||||
netrw-maps pi_netrw.txt /*netrw-maps*
|
netrw-mT pi_netrw.txt /*netrw-mT*
|
||||||
netrw-mb pi_netrw.txt /*netrw-mb*
|
netrw-mb pi_netrw.txt /*netrw-mb*
|
||||||
|
netrw-mc pi_netrw.txt /*netrw-mc*
|
||||||
|
netrw-md pi_netrw.txt /*netrw-md*
|
||||||
|
netrw-me pi_netrw.txt /*netrw-me*
|
||||||
|
netrw-mf pi_netrw.txt /*netrw-mf*
|
||||||
netrw-ml_get pi_netrw.txt /*netrw-ml_get*
|
netrw-ml_get pi_netrw.txt /*netrw-ml_get*
|
||||||
|
netrw-mm pi_netrw.txt /*netrw-mm*
|
||||||
netrw-move pi_netrw.txt /*netrw-move*
|
netrw-move pi_netrw.txt /*netrw-move*
|
||||||
|
netrw-mp pi_netrw.txt /*netrw-mp*
|
||||||
|
netrw-mr pi_netrw.txt /*netrw-mr*
|
||||||
|
netrw-mt pi_netrw.txt /*netrw-mt*
|
||||||
|
netrw-mu pi_netrw.txt /*netrw-mu*
|
||||||
|
netrw-mx pi_netrw.txt /*netrw-mx*
|
||||||
|
netrw-mz pi_netrw.txt /*netrw-mz*
|
||||||
netrw-netrc pi_netrw.txt /*netrw-netrc*
|
netrw-netrc pi_netrw.txt /*netrw-netrc*
|
||||||
netrw-nexplore pi_netrw.txt /*netrw-nexplore*
|
netrw-nexplore pi_netrw.txt /*netrw-nexplore*
|
||||||
netrw-nread pi_netrw.txt /*netrw-nread*
|
netrw-nread pi_netrw.txt /*netrw-nread*
|
||||||
@ -1437,6 +1464,8 @@ netrw-o pi_netrw.txt /*netrw-o*
|
|||||||
netrw-options pi_netrw.txt /*netrw-options*
|
netrw-options pi_netrw.txt /*netrw-options*
|
||||||
netrw-p pi_netrw.txt /*netrw-p*
|
netrw-p pi_netrw.txt /*netrw-p*
|
||||||
netrw-p1 pi_netrw.txt /*netrw-p1*
|
netrw-p1 pi_netrw.txt /*netrw-p1*
|
||||||
|
netrw-p10 pi_netrw.txt /*netrw-p10*
|
||||||
|
netrw-p11 pi_netrw.txt /*netrw-p11*
|
||||||
netrw-p2 pi_netrw.txt /*netrw-p2*
|
netrw-p2 pi_netrw.txt /*netrw-p2*
|
||||||
netrw-p3 pi_netrw.txt /*netrw-p3*
|
netrw-p3 pi_netrw.txt /*netrw-p3*
|
||||||
netrw-p4 pi_netrw.txt /*netrw-p4*
|
netrw-p4 pi_netrw.txt /*netrw-p4*
|
||||||
@ -1462,12 +1491,14 @@ netrw-read pi_netrw.txt /*netrw-read*
|
|||||||
netrw-ref pi_netrw.txt /*netrw-ref*
|
netrw-ref pi_netrw.txt /*netrw-ref*
|
||||||
netrw-rename pi_netrw.txt /*netrw-rename*
|
netrw-rename pi_netrw.txt /*netrw-rename*
|
||||||
netrw-reverse pi_netrw.txt /*netrw-reverse*
|
netrw-reverse pi_netrw.txt /*netrw-reverse*
|
||||||
|
netrw-rexplore pi_netrw.txt /*netrw-rexplore*
|
||||||
netrw-s pi_netrw.txt /*netrw-s*
|
netrw-s pi_netrw.txt /*netrw-s*
|
||||||
netrw-settings pi_netrw.txt /*netrw-settings*
|
netrw-settings pi_netrw.txt /*netrw-settings*
|
||||||
netrw-sexplore pi_netrw.txt /*netrw-sexplore*
|
netrw-sexplore pi_netrw.txt /*netrw-sexplore*
|
||||||
netrw-sort pi_netrw.txt /*netrw-sort*
|
netrw-sort pi_netrw.txt /*netrw-sort*
|
||||||
netrw-sortsequence pi_netrw.txt /*netrw-sortsequence*
|
netrw-sortsequence pi_netrw.txt /*netrw-sortsequence*
|
||||||
netrw-source pi_netrw.txt /*netrw-source*
|
netrw-source pi_netrw.txt /*netrw-source*
|
||||||
|
netrw-ssh-hack pi_netrw.txt /*netrw-ssh-hack*
|
||||||
netrw-starpat pi_netrw.txt /*netrw-starpat*
|
netrw-starpat pi_netrw.txt /*netrw-starpat*
|
||||||
netrw-starstar pi_netrw.txt /*netrw-starstar*
|
netrw-starstar pi_netrw.txt /*netrw-starstar*
|
||||||
netrw-starstarpat pi_netrw.txt /*netrw-starstarpat*
|
netrw-starstarpat pi_netrw.txt /*netrw-starstarpat*
|
||||||
@ -1505,7 +1536,6 @@ tComment-Installation tComment.txt /*tComment-Installation*
|
|||||||
tComment-Key-Bindings tComment.txt /*tComment-Key-Bindings*
|
tComment-Key-Bindings tComment.txt /*tComment-Key-Bindings*
|
||||||
tComment-Usage tComment.txt /*tComment-Usage*
|
tComment-Usage tComment.txt /*tComment-Usage*
|
||||||
tComment-commands tComment.txt /*tComment-commands*
|
tComment-commands tComment.txt /*tComment-commands*
|
||||||
tComment-uninstall tComment.txt /*tComment-uninstall*
|
|
||||||
tComment.txt tComment.txt /*tComment.txt*
|
tComment.txt tComment.txt /*tComment.txt*
|
||||||
vba pi_vimball.txt /*vba*
|
vba pi_vimball.txt /*vba*
|
||||||
vimball pi_vimball.txt /*vimball*
|
vimball pi_vimball.txt /*vimball*
|
||||||
|
86
vimfiles/plugin/blockdiff.vim
Normal file
86
vimfiles/plugin/blockdiff.vim
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
" Vim BlockDiff-Plugin
|
||||||
|
"
|
||||||
|
" Author: Timo Teifel
|
||||||
|
" Email: timo dot teifel at teifel dot net
|
||||||
|
" Version: 1.0
|
||||||
|
" Date: 22 Oct 2007
|
||||||
|
" Licence: GPL v2.0
|
||||||
|
"
|
||||||
|
" Usage:
|
||||||
|
" - Select first block
|
||||||
|
" - Depending on the configuration, select:
|
||||||
|
" - Menu BlockDiff-> This\ is\ Block\ 1
|
||||||
|
" - Popup-Menu -> This\ is\ Block\ 1
|
||||||
|
" - ,d1
|
||||||
|
" - select second block (may be in another file, but in the same
|
||||||
|
" Vim window)
|
||||||
|
" - Menu BlockDiff-> This\ is\ Block\ 2,\ start\ diff
|
||||||
|
" - Popup-Menu -> This\ is\ Block\ 2,\ start\ diff
|
||||||
|
" - ,d2
|
||||||
|
" - Script opens a new tab, splits it and shows the diff between
|
||||||
|
" the two blocks.
|
||||||
|
" - Close the tab when done
|
||||||
|
"
|
||||||
|
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" ---------- Configuration ----------------------------------------------------
|
||||||
|
" uncomment one or more of these blocks:
|
||||||
|
|
||||||
|
|
||||||
|
" Create menu entry:
|
||||||
|
vmenu BlockDiff.This\ is\ block\ 1 :call BlockDiff_GetBlock1()<CR>
|
||||||
|
vmenu BlockDiff.This\ is\ block\ 2,\ start\ diff :call BlockDiff_GetBlock2()<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" Create popup-menu-entry:
|
||||||
|
"vmenu PopUp.BlockDiff.This\ is\ block\ 1 :call BlockDiff_GetBlock1()<CR>
|
||||||
|
"vmenu PopUp.BlockDiff.This\ is\ block\ 2,\ start\ diff :call BlockDiff_GetBlock2()<CR>
|
||||||
|
|
||||||
|
" Shortcuts
|
||||||
|
"vmap ,d1 :call BlockDiff_GetBlock1()<CR>
|
||||||
|
"vmap ,d2 :call BlockDiff_GetBlock2()<CR>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" ---------- Code -------------------------------------------------------------
|
||||||
|
fun! BlockDiff_GetBlock1() range
|
||||||
|
let s:regd = @@
|
||||||
|
" copy selected block into unnamed register
|
||||||
|
exe a:firstline . "," . a:lastline . "y"
|
||||||
|
" save block for later use in variable
|
||||||
|
let s:block1 = @@
|
||||||
|
" restore unnamed register
|
||||||
|
let @@ = s:regd
|
||||||
|
endfun
|
||||||
|
|
||||||
|
fun! BlockDiff_GetBlock2() range
|
||||||
|
let s:regd = @@
|
||||||
|
exe a:firstline . "," . a:lastline . "y"
|
||||||
|
|
||||||
|
" Open new tab, paste second selected block
|
||||||
|
tabnew
|
||||||
|
normal p
|
||||||
|
" to prevent 'No write since last change' message:
|
||||||
|
se buftype=nowrite
|
||||||
|
diffthis
|
||||||
|
|
||||||
|
" vsplit left for first selected block
|
||||||
|
lefta vnew
|
||||||
|
" copy first block into unnamed register & paste
|
||||||
|
let @@ = s:block1
|
||||||
|
normal p
|
||||||
|
se buftype=nowrite
|
||||||
|
|
||||||
|
" start diff
|
||||||
|
diffthis
|
||||||
|
|
||||||
|
" restore unnamed register
|
||||||
|
let @@ = s:regd
|
||||||
|
endfun
|
||||||
|
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
|
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
|
||||||
" PLUGIN SECTION
|
" PLUGIN SECTION
|
||||||
" Date: Jan 05, 2007
|
" Date: Aug 09, 2007
|
||||||
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
|
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
|
||||||
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
|
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
|
||||||
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
|
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
|
||||||
@ -64,11 +64,10 @@ augroup Network
|
|||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Commands: :Nread, :Nwrite, :NetUserPass {{{2
|
" Commands: :Nread, :Nwrite, :NetUserPass {{{2
|
||||||
com! -count=1 -nargs=* Nread call netrw#NetSavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#NetRestorePosn()
|
com! -count=1 -nargs=* Nread call netrw#NetrwSavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#NetrwRestorePosn()
|
||||||
com! -range=% -nargs=* Nwrite call netrw#NetSavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#NetRestorePosn()
|
com! -range=% -nargs=* Nwrite call netrw#NetrwSavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#NetrwRestorePosn()
|
||||||
com! -nargs=* NetUserPass call NetUserPass(<f-args>)
|
com! -nargs=* NetUserPass call NetUserPass(<f-args>)
|
||||||
com! -nargs=+ Ncopy call netrw#NetObtain(<f-args>)
|
com! -nargs=* Nsource call netrw#NetrwSavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#NetrwRestorePosn()
|
||||||
com! -nargs=* Nsource call netrw#NetSavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#NetRestorePosn()
|
|
||||||
|
|
||||||
" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2
|
" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2
|
||||||
com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>)
|
com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>)
|
||||||
@ -80,7 +79,8 @@ com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,<q-args>)
|
|||||||
com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>)
|
com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>)
|
||||||
|
|
||||||
" Commands: NetrwSettings {{{2
|
" Commands: NetrwSettings {{{2
|
||||||
com! -nargs=0 NetrwSettings :call netrwSettings#NetrwSettings()
|
com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings()
|
||||||
|
com! -bang NetrwClean call netrw#NetrwClean(<bang>0)
|
||||||
|
|
||||||
" Maps:
|
" Maps:
|
||||||
if !exists("g:netrw_nogx") && maparg('g','n') == ""
|
if !exists("g:netrw_nogx") && maparg('g','n') == ""
|
||||||
|
@ -1,51 +1,59 @@
|
|||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" svndiff (C) 2007 Ico Doornekamp
|
" svndiff 2.0 (C) 2007 Ico Doornekamp
|
||||||
"
|
"
|
||||||
" Introduction
|
" Introduction
|
||||||
" ------------
|
" ------------
|
||||||
"
|
"
|
||||||
" NOTE: This plugin is linux-only!
|
" NOTE: This plugin is unix-only!
|
||||||
"
|
"
|
||||||
" An experimental vim 7.0 plugin for showing svn diff information in a file
|
" An small vim 7.0 plugin for showing svn diff information in a file while
|
||||||
" while editing. This plugin runs a diff between the current buffer and the
|
" editing. This plugin runs a diff between the current buffer and the original
|
||||||
" original subversion file, and applies highlighting to show where the buffer
|
" subversion file, and shows coloured tags indicating where the buffer differs
|
||||||
" differs. The original text is not shown, only colors are used to indicate
|
" from the original file from the subversion repository. The original text is
|
||||||
" where changes were made.
|
" not shown, only signs are used to indicate where changes were made.
|
||||||
"
|
"
|
||||||
" The following syntax highlight groups are used:
|
" The following symbols and syntax highlight groups are used for the tags:
|
||||||
"
|
"
|
||||||
" DiffAdd: Newly added lines. (default=blue)
|
" > DiffAdd: Newly added lines. (default=blue)
|
||||||
"
|
"
|
||||||
" DiffChange: Lines which are changed from the original. (default=cyan)
|
" ! DiffChange: Lines which are changed from the original. (default=cyan)
|
||||||
"
|
|
||||||
" DiffDel: Applied to the lines directly above and below a deleted
|
|
||||||
" block (default=magenta)
|
|
||||||
"
|
"
|
||||||
|
" < DiffDel: Applied to the lines directly above and below a deleted block
|
||||||
|
" (default=magenta)
|
||||||
" Usage
|
" Usage
|
||||||
" -----
|
" -----
|
||||||
"
|
"
|
||||||
" The plugin defines one function: Svndiff_show(). This function figures out
|
" The plugin defines one function: Svndiff(). This function figures out the
|
||||||
" the difference between the current file and it's subversion original, and
|
" difference between the current file and it's subversion original, and adds
|
||||||
" creates the syntax highlighting patterns. You'll need to call this function
|
" the tags at the places where the buffer differs from the original file from
|
||||||
" after making changes to update the highlighting.
|
" subversion. 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
|
" The function takes an optional argument specifying an additional action to
|
||||||
" perform:
|
" perform:
|
||||||
"
|
"
|
||||||
" "prev": jump to the previous different block
|
" "prev" : jump to the previous different block
|
||||||
" "next": jump to the next different block
|
" "next" : jump to the next different block
|
||||||
|
" "clear" : clean up all tags
|
||||||
"
|
"
|
||||||
" You might want to map some keys to run the Svndiff_show function. For example,
|
" You might want to map some keys to run the Svndiff function. For
|
||||||
" add to your .vimrc:
|
" example, add to your .vimrc:
|
||||||
"
|
"
|
||||||
" noremap <F3> :call Svndiff_show("prev")<CR>
|
" noremap <F3> :call Svndiff("prev")<CR>
|
||||||
" noremap <F4> :call Svndiff_show("next")<CR>
|
" noremap <F4> :call Svndiff("next")<CR>
|
||||||
|
" noremap <F5> :call Svndiff("clear")<CR>
|
||||||
"
|
"
|
||||||
" And optionally another keymap to cleanup the diff highlighting and revert to
|
" Colors
|
||||||
" the original syntax:
|
" ------
|
||||||
"
|
"
|
||||||
" noremap <F5> :syntax on<CR>
|
" Personally, I find the following colours more intuitive for diff colours:
|
||||||
|
" red=deleted, green=added, yellow=changed. If you want to use these colours,
|
||||||
|
" try adding the following lines to your .vimrc
|
||||||
"
|
"
|
||||||
|
" hi DiffAdd ctermfg=0 ctermbg=2 guibg='green'
|
||||||
|
" hi DiffDelete ctermfg=0 ctermbg=1 guibg='red'
|
||||||
|
" hi DiffChange ctermfg=0 ctermbg=3 guibg='yellow'
|
||||||
"
|
"
|
||||||
" Changelog
|
" Changelog
|
||||||
" ---------
|
" ---------
|
||||||
@ -56,10 +64,15 @@
|
|||||||
"
|
"
|
||||||
" 1.2 2007-06-14 Updated diff arguments from -u0 (obsolete) to -U0
|
" 1.2 2007-06-14 Updated diff arguments from -u0 (obsolete) to -U0
|
||||||
"
|
"
|
||||||
|
" 2.0 2007-08-16 Changed from syntax highlighting to using tags, thanks
|
||||||
|
" to Noah Spurrier for the idea. NOTE: the name of the
|
||||||
|
" function changed from Svndiff_show() to Svndiff(), so
|
||||||
|
" you might need to update your .vimrc mappings!
|
||||||
|
"
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
|
||||||
function! Svndiff_show(...)
|
function! Svndiff(...)
|
||||||
|
|
||||||
let cmd = exists("a:1") ? a:1 : ''
|
let cmd = exists("a:1") ? a:1 : ''
|
||||||
let fname = bufname("%")
|
let fname = bufname("%")
|
||||||
@ -75,19 +88,32 @@ function! Svndiff_show(...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
" Reset syntax highlighting
|
" Remove all signs. If the cmd is 'clear', return right away. NOTE: this
|
||||||
|
" command removes all signs from the file, also if they were not placed by
|
||||||
|
" the this plugin. If this bothers your, tell me and I'll fix it.
|
||||||
|
|
||||||
syntax off
|
sign unplace *
|
||||||
|
|
||||||
|
if cmd == 'clear'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
" Pipe the current buffer contents to a shell command calculating the diff
|
" Define sign characters and colors
|
||||||
" in a friendly parsable format
|
|
||||||
|
sign define svnadd text=> texthl=diffAdd
|
||||||
|
sign define svndelete text=< texthl=diffDelete
|
||||||
|
sign define svnchange text=! texthl=diffChange
|
||||||
|
|
||||||
|
|
||||||
|
" This is where the magic happens: pipe the current buffer contents to a
|
||||||
|
" shell command calculating the diff in a friendly parsable format.
|
||||||
|
|
||||||
let contents = join(getbufline("%", 1, "$"), "\n")
|
let contents = join(getbufline("%", 1, "$"), "\n")
|
||||||
let diff = system("diff -U0 <(svn cat " . fname . ") <(cat;echo)", contents)
|
let diff = system("diff -U0 <(svn cat " . fname . ") <(cat;echo)", contents)
|
||||||
|
|
||||||
|
|
||||||
" Parse the output of the diff command and hightlight changed, added and
|
" Parse the output of the diff command and put signs at changed, added and
|
||||||
" removed lines
|
" removed lines
|
||||||
|
|
||||||
for line in split(diff, '\n')
|
for line in split(diff, '\n')
|
||||||
@ -105,20 +131,25 @@ function! Svndiff_show(...)
|
|||||||
if old_count == 0
|
if old_count == 0
|
||||||
let from = new_from
|
let from = new_from
|
||||||
let to = new_from + new_count - 1
|
let to = new_from + new_count - 1
|
||||||
let group = 'DiffAdd'
|
let name = 'svnadd'
|
||||||
elseif new_count == 0
|
elseif new_count == 0
|
||||||
let from = new_from
|
let from = new_from
|
||||||
let to = new_from + 1
|
let to = new_from + 1
|
||||||
let group = 'DiffDelete'
|
let name = 'svndelete'
|
||||||
else
|
else
|
||||||
let from = new_from
|
let from = new_from
|
||||||
let to = new_from + new_count - 1
|
let to = new_from + new_count - 1
|
||||||
let group = 'DiffChange'
|
let name = 'svnchange'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Set the actual syntax highlight
|
|
||||||
|
|
||||||
exec 'syntax region ' . group . ' start=".*\%' . from . 'l" end=".*\%' . to . 'l"'
|
" Add signs to mark the changed lines
|
||||||
|
|
||||||
|
let line = from
|
||||||
|
while line <= to
|
||||||
|
exec 'sign place ' . from . ' line=' . line . ' name=' . name . ' file=' . fname
|
||||||
|
let line = line + 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
|
||||||
" Check if we need to jump to prev/next diff block
|
" Check if we need to jump to prev/next diff block
|
||||||
@ -141,6 +172,9 @@ function! Svndiff_show(...)
|
|||||||
|
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|
||||||
|
" Set the cursor to the new position, if requested
|
||||||
|
|
||||||
if jump_to > 0
|
if jump_to > 0
|
||||||
call setpos(".", [ 0, jump_to, 1, 0 ])
|
call setpos(".", [ 0, jump_to, 1, 0 ])
|
||||||
endif
|
endif
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
" tComment.vim -- An easily extensible & universal comment plugin
|
" tComment.vim -- An easily extensible & universal comment plugin
|
||||||
" @Author: Thomas Link (samul AT web.de)
|
" @Author: Thomas Link (micathom AT gmail com)
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||||
" @Created: 27-Dez-2004.
|
" @Created: 27-Dez-2004.
|
||||||
" @Last Change: 2007-04-15.
|
" @Last Change: 2007-08-30.
|
||||||
" @Revision: 1.6.285
|
" @Revision: 1.7.608
|
||||||
"
|
"
|
||||||
" vimscript #1173
|
" vimscript #1173
|
||||||
|
|
||||||
if &cp || exists('loaded_tcomment')
|
if &cp || exists('loaded_tcomment')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let loaded_tcomment = 106
|
let loaded_tcomment = 107
|
||||||
|
|
||||||
fun! s:DefVar(name, val)
|
function! s:DefVar(name, val)
|
||||||
if !exists(a:name)
|
if !exists(a:name)
|
||||||
" exec "let ". a:name ."='". a:val ."'"
|
" exec "let ". a:name ."='". a:val ."'"
|
||||||
exec 'let '. a:name .'="'. escape(a:val, '"\') .'"'
|
exec 'let '. a:name .'="'. escape(a:val, '"\') .'"'
|
||||||
@ -24,6 +24,10 @@ call s:DefVar('g:tcommentBlankLines', 1)
|
|||||||
|
|
||||||
call s:DefVar('g:tcommentMapLeader1', '<c-_>')
|
call s:DefVar('g:tcommentMapLeader1', '<c-_>')
|
||||||
call s:DefVar('g:tcommentMapLeader2', '<Leader>_')
|
call s:DefVar('g:tcommentMapLeader2', '<Leader>_')
|
||||||
|
" call s:DefVar('g:tcommentMapLeaderOp1', '<Leader>-')
|
||||||
|
call s:DefVar('g:tcommentMapLeaderOp1', 'gc')
|
||||||
|
call s:DefVar('g:tcommentMapLeaderOp2', 'gC')
|
||||||
|
call s:DefVar('g:tcommentOpModeExtra', '')
|
||||||
|
|
||||||
" Guess the file type based on syntax names always or for some fileformat only
|
" Guess the file type based on syntax names always or for some fileformat only
|
||||||
call s:DefVar('g:tcommentGuessFileType', 0)
|
call s:DefVar('g:tcommentGuessFileType', 0)
|
||||||
@ -37,6 +41,16 @@ call s:DefVar('g:tcommentGuessFileType_vim', 1)
|
|||||||
|
|
||||||
call s:DefVar('g:tcommentIgnoreTypes_php', 'sql')
|
call s:DefVar('g:tcommentIgnoreTypes_php', 'sql')
|
||||||
|
|
||||||
|
if !exists('g:tcommentSyntaxMap') "{{{2
|
||||||
|
let g:tcommentSyntaxMap = {
|
||||||
|
\ 'vimMzSchemeRegion': 'scheme',
|
||||||
|
\ 'vimPerlRegion': 'perl',
|
||||||
|
\ 'vimPythonRegion': 'python',
|
||||||
|
\ 'vimRubyRegion': 'ruby',
|
||||||
|
\ 'vimTclRegion': 'tcl',
|
||||||
|
\ }
|
||||||
|
endif
|
||||||
|
|
||||||
" If you don't define these variables, TComment will use &commentstring
|
" If you don't define these variables, TComment will use &commentstring
|
||||||
" instead. We override the default values here in order to have a blank after
|
" instead. We override the default values here in order to have a blank after
|
||||||
" the comment marker. Block comments work only if we explicitly define the
|
" the comment marker. Block comments work only if we explicitly define the
|
||||||
@ -56,12 +70,12 @@ call s:DefVar('g:tcommentBlockXML', "<!--%s-->\n ")
|
|||||||
call s:DefVar('g:tcommentInlineXML', "<!-- %s -->")
|
call s:DefVar('g:tcommentInlineXML', "<!-- %s -->")
|
||||||
|
|
||||||
" Currently this function just sets a variable
|
" Currently this function just sets a variable
|
||||||
fun! TCommentDefineType(name, commentstring)
|
function! TCommentDefineType(name, commentstring)
|
||||||
call s:DefVar('g:tcomment_'. a:name, a:commentstring)
|
call s:DefVar('g:tcomment_'. a:name, a:commentstring)
|
||||||
let s:tcommentFileTypesDirty = 1
|
let s:tcommentFileTypesDirty = 1
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! TCommentTypeExists(name)
|
function! TCommentTypeExists(name)
|
||||||
return exists('g:tcomment_'. a:name)
|
return exists('g:tcomment_'. a:name)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
@ -110,6 +124,7 @@ call TCommentDefineType('java_inline', g:tcommentInlineC )
|
|||||||
call TCommentDefineType('java_block', g:tcommentBlockC )
|
call TCommentDefineType('java_block', g:tcommentBlockC )
|
||||||
call TCommentDefineType('lisp', '; %s' )
|
call TCommentDefineType('lisp', '; %s' )
|
||||||
call TCommentDefineType('m4', 'dnl %s' )
|
call TCommentDefineType('m4', 'dnl %s' )
|
||||||
|
call TCommentDefineType('mail', '> %s' )
|
||||||
call TCommentDefineType('nroff', '.\\" %s' )
|
call TCommentDefineType('nroff', '.\\" %s' )
|
||||||
call TCommentDefineType('objc', '/* %s */' )
|
call TCommentDefineType('objc', '/* %s */' )
|
||||||
call TCommentDefineType('objc_inline', g:tcommentInlineC )
|
call TCommentDefineType('objc_inline', g:tcommentInlineC )
|
||||||
@ -144,6 +159,7 @@ call TCommentDefineType('sh', '# %s' )
|
|||||||
call TCommentDefineType('sql', '-- %s' )
|
call TCommentDefineType('sql', '-- %s' )
|
||||||
call TCommentDefineType('spec', '# %s' )
|
call TCommentDefineType('spec', '# %s' )
|
||||||
call TCommentDefineType('sps', '* %s.' )
|
call TCommentDefineType('sps', '* %s.' )
|
||||||
|
call TCommentDefineType('sps_block', '* %s.' )
|
||||||
call TCommentDefineType('tcl', '# %s' )
|
call TCommentDefineType('tcl', '# %s' )
|
||||||
call TCommentDefineType('tex', '%% %s' )
|
call TCommentDefineType('tex', '%% %s' )
|
||||||
call TCommentDefineType('tpl', '<!-- %s -->' )
|
call TCommentDefineType('tpl', '<!-- %s -->' )
|
||||||
@ -151,6 +167,7 @@ call TCommentDefineType('viki', '%% %s' )
|
|||||||
call TCommentDefineType('viki_3', '%%%%%% %s' )
|
call TCommentDefineType('viki_3', '%%%%%% %s' )
|
||||||
call TCommentDefineType('viki_inline', '{cmt: %s}' )
|
call TCommentDefineType('viki_inline', '{cmt: %s}' )
|
||||||
call TCommentDefineType('vim', '" %s' )
|
call TCommentDefineType('vim', '" %s' )
|
||||||
|
call TCommentDefineType('vim_3', '""" %s' )
|
||||||
call TCommentDefineType('websec', '# %s' )
|
call TCommentDefineType('websec', '# %s' )
|
||||||
call TCommentDefineType('xml', '<!-- %s -->' )
|
call TCommentDefineType('xml', '<!-- %s -->' )
|
||||||
call TCommentDefineType('xml_inline', g:tcommentInlineXML)
|
call TCommentDefineType('xml_inline', g:tcommentInlineXML)
|
||||||
@ -162,7 +179,7 @@ call TCommentDefineType('yaml', '# %s' )
|
|||||||
|
|
||||||
let s:tcommentFileTypesDirty = 1
|
let s:tcommentFileTypesDirty = 1
|
||||||
|
|
||||||
fun! s:DefaultValue(option)
|
function! s:DefaultValue(option)
|
||||||
exec 'let '. a:option .' = &'. a:option
|
exec 'let '. a:option .' = &'. a:option
|
||||||
exec 'set '. a:option .'&'
|
exec 'set '. a:option .'&'
|
||||||
exec 'let default = &'. a:option
|
exec 'let default = &'. a:option
|
||||||
@ -180,22 +197,23 @@ let s:nullCommentString = '%s'
|
|||||||
" B ... block
|
" B ... block
|
||||||
" I ... inline
|
" I ... inline
|
||||||
" R ... right
|
" R ... right
|
||||||
fun! TComment(beg, end, ...)
|
function! TComment(beg, end, ...)
|
||||||
" save the cursor position
|
" save the cursor position
|
||||||
let co = col('.')
|
let co = col('.')
|
||||||
let li = line('.')
|
let li = line('.')
|
||||||
|
let s:pos_end = getpos("'>")
|
||||||
let commentMode = a:0 >= 1 ? a:1 : 'G'
|
let commentMode = a:0 >= 1 ? a:1 : 'G'
|
||||||
let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0
|
let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0
|
||||||
if commentMode ==# 'IG'
|
if commentMode =~# 'i'
|
||||||
let commentMode = line("'<") == line("'>") ? 'I' : 'G'
|
let commentMode = substitute(commentMode, '\Ci', line("'<") == line("'>") ? 'I' : 'G', 'g')
|
||||||
endif
|
endif
|
||||||
if commentMode ==# 'R' || commentMode ==# 'I'
|
if commentMode =~# 'R' || commentMode =~# 'I'
|
||||||
let cstart = col("'<")
|
let cstart = col("'<")
|
||||||
if cstart == 0
|
if cstart == 0
|
||||||
let cstart = col('.')
|
let cstart = col('.')
|
||||||
endif
|
endif
|
||||||
if commentMode ==# 'R'
|
if commentMode =~# 'R'
|
||||||
let commentMode = 'G'
|
let commentMode = substitute(commentMode, '\CR', 'G', 'g')
|
||||||
let cend = 0
|
let cend = 0
|
||||||
else
|
else
|
||||||
let cend = col("'>")
|
let cend = col("'>")
|
||||||
@ -204,6 +222,7 @@ fun! TComment(beg, end, ...)
|
|||||||
let cstart = 0
|
let cstart = 0
|
||||||
let cend = 0
|
let cend = 0
|
||||||
endif
|
endif
|
||||||
|
" TLogVAR commentMode, cstart, cend
|
||||||
" get the correct commentstring
|
" get the correct commentstring
|
||||||
if a:0 >= 3 && a:3 != ''
|
if a:0 >= 3 && a:3 != ''
|
||||||
let cms = s:EncodeCommentPart(a:3) .'%s'
|
let cms = s:EncodeCommentPart(a:3) .'%s'
|
||||||
@ -211,7 +230,7 @@ fun! TComment(beg, end, ...)
|
|||||||
let cms = cms . s:EncodeCommentPart(a:4)
|
let cms = cms . s:EncodeCommentPart(a:4)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
exec s:GetCommentString(a:beg, a:end, commentMode)
|
let [cms, commentMode] = s:GetCommentString(a:beg, a:end, commentMode)
|
||||||
endif
|
endif
|
||||||
let cms0 = s:BlockGetCommentString(cms)
|
let cms0 = s:BlockGetCommentString(cms)
|
||||||
let cms0 = escape(cms0, '\')
|
let cms0 = escape(cms0, '\')
|
||||||
@ -221,14 +240,15 @@ fun! TComment(beg, end, ...)
|
|||||||
" turn commentstring into a search pattern
|
" turn commentstring into a search pattern
|
||||||
let cmtCheck = s:SPrintF(cmtCheck, '\(\_.\{-}\)')
|
let cmtCheck = s:SPrintF(cmtCheck, '\(\_.\{-}\)')
|
||||||
" set commentMode and indentStr
|
" set commentMode and indentStr
|
||||||
exec s:CommentDef(a:beg, a:end, cmtCheck, commentMode, cstart, cend)
|
let [indentStr, uncomment] = s:CommentDef(a:beg, a:end, cmtCheck, commentMode, cstart, cend)
|
||||||
|
" TLogVAR indentStr, uncomment
|
||||||
if commentAnyway
|
if commentAnyway
|
||||||
let mode = 0
|
let uncomment = 0
|
||||||
endif
|
endif
|
||||||
" go
|
" go
|
||||||
if commentMode ==# 'B'
|
if commentMode =~# 'B'
|
||||||
" We want a comment block
|
" We want a comment block
|
||||||
call s:CommentBlock(a:beg, a:end, mode, cmtCheck, cms, indentStr)
|
call s:CommentBlock(a:beg, a:end, uncomment, cmtCheck, cms, indentStr)
|
||||||
else
|
else
|
||||||
" We want commented lines
|
" We want commented lines
|
||||||
" final search pattern for uncommenting
|
" final search pattern for uncommenting
|
||||||
@ -237,11 +257,16 @@ fun! TComment(beg, end, ...)
|
|||||||
let cmtReplace = escape(cms0, '"/')
|
let cmtReplace = escape(cms0, '"/')
|
||||||
silent exec a:beg .','. a:end .'s/\V'.
|
silent exec a:beg .','. a:end .'s/\V'.
|
||||||
\ s:StartRx(cstart) . indentStr .'\zs\(\.\*\)'. s:EndRx(cend) .'/'.
|
\ s:StartRx(cstart) . indentStr .'\zs\(\.\*\)'. s:EndRx(cend) .'/'.
|
||||||
\ '\=s:ProcessedLine('. mode .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
|
\ '\=s:ProcessedLine('. uncomment .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
|
||||||
endif
|
endif
|
||||||
" reposition cursor
|
" reposition cursor
|
||||||
" silent exec 'norm! '. li .'G'. co .'|'
|
" TLogVAR commentMode
|
||||||
|
if commentMode =~ '>'
|
||||||
|
call setpos('.', s:pos_end)
|
||||||
|
else
|
||||||
|
" TLogVAR li, co
|
||||||
call cursor(li, co)
|
call cursor(li, co)
|
||||||
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" :line1,line2 TComment ?commentBegin ?commentEnd
|
" :line1,line2 TComment ?commentBegin ?commentEnd
|
||||||
@ -257,10 +282,68 @@ command! -bang -range -nargs=* TCommentBlock keepjumps call TComment(<line1>, <l
|
|||||||
command! -bang -range -nargs=* TCommentInline keepjumps call TComment(<line1>, <line2>, 'I', "<bang>", <f-args>)
|
command! -bang -range -nargs=* TCommentInline keepjumps call TComment(<line1>, <line2>, 'I', "<bang>", <f-args>)
|
||||||
|
|
||||||
" :line1,line2 TCommentMaybeInline ?commentBegin ?commentEnd
|
" :line1,line2 TCommentMaybeInline ?commentBegin ?commentEnd
|
||||||
command! -bang -range -nargs=* TCommentMaybeInline keepjumps call TComment(<line1>, <line2>, 'IG', "<bang>", <f-args>)
|
command! -bang -range -nargs=* TCommentMaybeInline keepjumps call TComment(<line1>, <line2>, 'i', "<bang>", <f-args>)
|
||||||
|
|
||||||
|
|
||||||
|
function! TCommentOperator(type, ...) "{{{3
|
||||||
|
let commentMode = a:0 >= 1 ? a:1 : ''
|
||||||
|
let bang = a:0 >= 2 ? a:2 : ''
|
||||||
|
let sel_save = &selection
|
||||||
|
let &selection = "inclusive"
|
||||||
|
let reg_save = @@
|
||||||
|
" let pos = getpos('.')
|
||||||
|
" TLogVAR a:type
|
||||||
|
try
|
||||||
|
if a:type == 'line'
|
||||||
|
silent exe "normal! '[V']"
|
||||||
|
let commentMode1 = 'G'
|
||||||
|
elseif a:type == 'block'
|
||||||
|
silent exe "normal! `[\<C-V>`]"
|
||||||
|
let commentMode1 = 'I'
|
||||||
|
else
|
||||||
|
silent exe "normal! `[v`]"
|
||||||
|
let commentMode1 = 'i'
|
||||||
|
endif
|
||||||
|
if empty(commentMode)
|
||||||
|
let commentMode = commentMode1
|
||||||
|
endif
|
||||||
|
let beg = line("'[")
|
||||||
|
let end = line("']")
|
||||||
|
norm!
|
||||||
|
let commentMode .= g:tcommentOpModeExtra
|
||||||
|
call TComment(beg, end, commentMode, bang)
|
||||||
|
finally
|
||||||
|
let &selection = sel_save
|
||||||
|
let @@ = reg_save
|
||||||
|
if g:tcommentOpModeExtra !~ '>'
|
||||||
|
" TLogVAR pos
|
||||||
|
" call setpos('.', pos)
|
||||||
|
call setpos('.', w:tcommentPos)
|
||||||
|
unlet! w:tcommentPos
|
||||||
|
endif
|
||||||
|
endtry
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
function! TCommentOperatorLine(type) "{{{3
|
||||||
|
call TCommentOperator(a:type, 'G')
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
function! TCommentOperatorAnyway(type) "{{{3
|
||||||
|
call TCommentOperator(a:type, '', '!')
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
|
function! TCommentOperatorLineAnyway(type) "{{{3
|
||||||
|
call TCommentOperator(a:type, 'G', '!')
|
||||||
|
endf
|
||||||
|
|
||||||
|
|
||||||
" comment text as if it were of a specific filetype
|
" comment text as if it were of a specific filetype
|
||||||
fun! TCommentAs(beg, end, commentAnyway, filetype)
|
function! TCommentAs(beg, end, commentAnyway, filetype, ...)
|
||||||
|
let ccount = a:0 >= 1 ? a:1 : 1
|
||||||
|
" TLogVAR ccount
|
||||||
if a:filetype =~ '_block$'
|
if a:filetype =~ '_block$'
|
||||||
let commentMode = 'B'
|
let commentMode = 'B'
|
||||||
let ft = substitute(a:filetype, '_block$', '', '')
|
let ft = substitute(a:filetype, '_block$', '', '')
|
||||||
@ -271,23 +354,36 @@ fun! TCommentAs(beg, end, commentAnyway, filetype)
|
|||||||
let commentMode = 'G'
|
let commentMode = 'G'
|
||||||
let ft = a:filetype
|
let ft = a:filetype
|
||||||
endif
|
endif
|
||||||
exec s:GetCommentString(a:beg, a:end, commentMode, ft)
|
let [cms, commentMode] = s:GetCommentString(a:beg, a:end, commentMode, ft)
|
||||||
let pre = substitute(cms, '%s.*$', '', '')
|
let pre = substitute(cms, '%s.*$', '', '')
|
||||||
let pre = substitute(pre, '%%', '%', 'g')
|
let pre = substitute(pre, '%%', '%', 'g')
|
||||||
let post = substitute(cms, '^.\{-}%s', '', '')
|
let post = substitute(cms, '^.\{-}%s', '', '')
|
||||||
let post = substitute(post, '%%', '%', 'g')
|
let post = substitute(post, '%%', '%', 'g')
|
||||||
call TComment(a:beg, a:end, commentMode, a:commentAnyway, pre, post)
|
if ccount > 1
|
||||||
|
let pre_l = matchlist(pre, '^\(\S\+\)\(.*\)$')
|
||||||
|
" TLogVAR pre_l
|
||||||
|
if !empty(get(pre_l, 1))
|
||||||
|
let pre = repeat(pre_l[1], ccount) . pre_l[2]
|
||||||
|
endif
|
||||||
|
let post_l = matchlist(post, '^\(\s*\)\(.\+\)$')
|
||||||
|
" TLogVAR post_l
|
||||||
|
if !empty(get(post_l, 2))
|
||||||
|
let post = post_l[1] . repeat(post_l[2], ccount)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
keepjumps call TComment(a:beg, a:end, commentMode, a:commentAnyway, pre, post)
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" :line1,line2 TCommentAs commenttype
|
" :line1,line2 TCommentAs commenttype
|
||||||
command! -bang -complete=custom,TCommentFileTypes -range -nargs=1 TCommentAs
|
command! -bang -complete=custom,TCommentFileTypes -range -nargs=+ TCommentAs
|
||||||
\ call TCommentAs(<line1>, <line2>, "<bang>", <f-args>)
|
\ call TCommentAs(<line1>, <line2>, "<bang>", <f-args>)
|
||||||
|
|
||||||
if (g:tcommentMapLeader1 != '')
|
if (g:tcommentMapLeader1 != '')
|
||||||
exec 'noremap <silent> '. g:tcommentMapLeader1 .'<c-_> :TComment<cr>'
|
exec 'noremap <silent> '. g:tcommentMapLeader1 .'<c-_> :TComment<cr>'
|
||||||
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'<c-_> :TCommentMaybeInline<cr>'
|
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'<c-_> :TCommentMaybeInline<cr>'
|
||||||
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'<c-_> <c-o>:TComment<cr>'
|
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'<c-_> <c-o>:TComment<cr>'
|
||||||
exec 'noremap <silent> '. g:tcommentMapLeader1 .'p vip:TComment<cr>'
|
exec 'noremap <silent> '. g:tcommentMapLeader1 .'p m`vip:TComment<cr>``'
|
||||||
|
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'p <c-o>:norm! m`vip<cr>:TComment<cr><c-o>``'
|
||||||
exec 'noremap '. g:tcommentMapLeader1 .'<space> :TComment '
|
exec 'noremap '. g:tcommentMapLeader1 .'<space> :TComment '
|
||||||
exec 'inoremap '. g:tcommentMapLeader1 .'<space> <c-o>:TComment '
|
exec 'inoremap '. g:tcommentMapLeader1 .'<space> <c-o>:TComment '
|
||||||
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'r <c-o>:TCommentRight<cr>'
|
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'r <c-o>:TCommentRight<cr>'
|
||||||
@ -298,6 +394,8 @@ if (g:tcommentMapLeader1 != '')
|
|||||||
exec 'inoremap '. g:tcommentMapLeader1 .'b <c-o>:TCommentBlock<cr>'
|
exec 'inoremap '. g:tcommentMapLeader1 .'b <c-o>:TCommentBlock<cr>'
|
||||||
exec 'noremap '. g:tcommentMapLeader1 .'a :TCommentAs '
|
exec 'noremap '. g:tcommentMapLeader1 .'a :TCommentAs '
|
||||||
exec 'inoremap '. g:tcommentMapLeader1 .'a <c-o>:TCommentAs '
|
exec 'inoremap '. g:tcommentMapLeader1 .'a <c-o>:TCommentAs '
|
||||||
|
exec 'noremap '. g:tcommentMapLeader1 .'n :TCommentAs <c-r>=&ft<cr> '
|
||||||
|
exec 'inoremap '. g:tcommentMapLeader1 .'n <c-o>:TCommentAs <c-r>=&ft<cr> '
|
||||||
exec 'noremap '. g:tcommentMapLeader1 .'s :TCommentAs <c-r>=&ft<cr>_'
|
exec 'noremap '. g:tcommentMapLeader1 .'s :TCommentAs <c-r>=&ft<cr>_'
|
||||||
exec 'inoremap '. g:tcommentMapLeader1 .'s <c-o>:TCommentAs <c-r>=&ft<cr>_'
|
exec 'inoremap '. g:tcommentMapLeader1 .'s <c-o>:TCommentAs <c-r>=&ft<cr>_'
|
||||||
endif
|
endif
|
||||||
@ -311,13 +409,22 @@ if (g:tcommentMapLeader2 != '')
|
|||||||
exec 'vnoremap <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 .'b :TCommentBlock<cr>'
|
||||||
exec 'noremap '. g:tcommentMapLeader2 .'a :TCommentAs '
|
exec 'noremap '. g:tcommentMapLeader2 .'a :TCommentAs '
|
||||||
|
exec 'noremap '. g:tcommentMapLeader2 .'n :TCommentAs <c-r>=&ft<cr> '
|
||||||
exec 'noremap '. g:tcommentMapLeader2 .'s :TCommentAs <c-r>=&ft<cr>_'
|
exec 'noremap '. g:tcommentMapLeader2 .'s :TCommentAs <c-r>=&ft<cr>_'
|
||||||
endif
|
endif
|
||||||
|
if (g:tcommentMapLeaderOp1 != '')
|
||||||
|
exec 'noremap <silent> '. g:tcommentMapLeaderOp1 .' :let w:tcommentPos = getpos(".") \| set opfunc=TCommentOperator<cr>g@'
|
||||||
|
exec 'noremap <silent> '. g:tcommentMapLeaderOp1 .'c :let w:tcommentPos = getpos(".") \| set opfunc=TCommentOperatorLine<cr>g@$'
|
||||||
|
endif
|
||||||
|
if (g:tcommentMapLeaderOp2 != '')
|
||||||
|
exec 'noremap <silent> '. g:tcommentMapLeaderOp2 .' :let w:tcommentPos = getpos(".") \| set opfunc=TCommentOperatorAnyway<cr>g@'
|
||||||
|
exec 'noremap <silent> '. g:tcommentMapLeaderOp2 .'c :let w:tcommentPos = getpos(".") \| set opfunc=TCommentOperatorLineAnyway<cr>g@$'
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
" ----------------------------------------------------------------
|
" ----------------------------------------------------------------
|
||||||
" collect all variables matching ^tcomment_
|
" collect all variables matching ^tcomment_
|
||||||
fun! TCommentCollectFileTypes()
|
function! TCommentCollectFileTypes()
|
||||||
if s:tcommentFileTypesDirty
|
if s:tcommentFileTypesDirty
|
||||||
let t = @t
|
let t = @t
|
||||||
try
|
try
|
||||||
@ -338,7 +445,7 @@ endf
|
|||||||
call TCommentCollectFileTypes()
|
call TCommentCollectFileTypes()
|
||||||
|
|
||||||
" return a list of filetypes for which a tcomment_{&ft} is defined
|
" return a list of filetypes for which a tcomment_{&ft} is defined
|
||||||
fun! TCommentFileTypes(ArgLead, CmdLine, CursorPos)
|
function! TCommentFileTypes(ArgLead, CmdLine, CursorPos)
|
||||||
call TCommentCollectFileTypes()
|
call TCommentCollectFileTypes()
|
||||||
if a:ArgLead == ''
|
if a:ArgLead == ''
|
||||||
return &filetype ."\n". g:tcommentFileTypes
|
return &filetype ."\n". g:tcommentFileTypes
|
||||||
@ -347,16 +454,15 @@ fun! TCommentFileTypes(ArgLead, CmdLine, CursorPos)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:EncodeCommentPart(string)
|
function! s:EncodeCommentPart(string)
|
||||||
return substitute(a:string, '%', '%%', 'g')
|
return substitute(a:string, '%', '%%', 'g')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" s:GetCommentString(beg, end, commentMode, ?filetype="")
|
" s:GetCommentString(beg, end, commentMode, ?filetype="")
|
||||||
" => RecordCMS
|
function! s:GetCommentString(beg, end, commentMode, ...)
|
||||||
fun! s:GetCommentString(beg, end, commentMode, ...)
|
|
||||||
let ft = a:0 >= 1 ? a:1 : ''
|
let ft = a:0 >= 1 ? a:1 : ''
|
||||||
if ft != ''
|
if ft != ''
|
||||||
exec s:GetCustomCommentString(ft, a:commentMode)
|
let [cms, commentMode] = s:GetCustomCommentString(ft, a:commentMode)
|
||||||
else
|
else
|
||||||
let cms = ''
|
let cms = ''
|
||||||
let commentMode = a:commentMode
|
let commentMode = a:commentMode
|
||||||
@ -383,12 +489,12 @@ fun! s:GetCommentString(beg, end, commentMode, ...)
|
|||||||
return s:GetCustomCommentString(&filetype, a:commentMode, s:GuessCurrentCommentString(a:commentMode))
|
return s:GetCustomCommentString(&filetype, a:commentMode, s:GuessCurrentCommentString(a:commentMode))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return s:RecordCMS(cms, commentMode)
|
return [cms, commentMode]
|
||||||
endf
|
endf
|
||||||
|
|
||||||
" s:SPrintF(formatstring, ?values ...)
|
" s:SPrintF(formatstring, ?values ...)
|
||||||
" => string
|
" => string
|
||||||
fun! s:SPrintF(string, ...)
|
function! s:SPrintF(string, ...)
|
||||||
let n = 1
|
let n = 1
|
||||||
let r = ''
|
let r = ''
|
||||||
let s = a:string
|
let s = a:string
|
||||||
@ -421,7 +527,7 @@ fun! s:SPrintF(string, ...)
|
|||||||
endwh
|
endwh
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:StartRx(pos)
|
function! s:StartRx(pos)
|
||||||
if a:pos == 0
|
if a:pos == 0
|
||||||
return '\^'
|
return '\^'
|
||||||
else
|
else
|
||||||
@ -429,7 +535,7 @@ fun! s:StartRx(pos)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:EndRx(pos)
|
function! s:EndRx(pos)
|
||||||
if a:pos == 0
|
if a:pos == 0
|
||||||
return '\$'
|
return '\$'
|
||||||
else
|
else
|
||||||
@ -437,18 +543,18 @@ fun! s:EndRx(pos)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:GetIndentString(line, start)
|
function! s:GetIndentString(line, start)
|
||||||
let start = a:start > 0 ? a:start - 1 : 0
|
let start = a:start > 0 ? a:start - 1 : 0
|
||||||
return substitute(strpart(getline(a:line), start), '\V\^\s\*\zs\.\*\$', '', '')
|
return substitute(strpart(getline(a:line), start), '\V\^\s\*\zs\.\*\$', '', '')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
function! s:CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
||||||
let mdrx = '\V'. s:StartRx(a:cstart) .'\s\*'. a:checkRx .'\s\*'. s:EndRx(0)
|
let mdrx = '\V'. s:StartRx(a:cstart) .'\s\*'. a:checkRx .'\s\*'. s:EndRx(0)
|
||||||
let line = getline(a:beg)
|
let line = getline(a:beg)
|
||||||
if a:cstart != 0 && a:cend != 0
|
if a:cstart != 0 && a:cend != 0
|
||||||
let line = strpart(line, 0, a:cend - 1)
|
let line = strpart(line, 0, a:cend - 1)
|
||||||
endif
|
endif
|
||||||
let mode = (line =~ mdrx)
|
let uncomment = (line =~ mdrx)
|
||||||
let it = s:GetIndentString(a:beg, a:cstart)
|
let it = s:GetIndentString(a:beg, a:cstart)
|
||||||
let il = indent(a:beg)
|
let il = indent(a:beg)
|
||||||
let n = a:beg + 1
|
let n = a:beg + 1
|
||||||
@ -459,50 +565,52 @@ fun! s:CommentDef(beg, end, checkRx, commentMode, cstart, cend)
|
|||||||
let it = s:GetIndentString(n, a:cstart)
|
let it = s:GetIndentString(n, a:cstart)
|
||||||
let il = jl
|
let il = jl
|
||||||
endif
|
endif
|
||||||
if a:commentMode ==# 'G'
|
if a:commentMode =~# 'G'
|
||||||
if !(getline(n) =~ mdrx)
|
if !(getline(n) =~ mdrx)
|
||||||
let mode = 0
|
let uncomment = 0
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let n = n + 1
|
let n = n + 1
|
||||||
endwh
|
endwh
|
||||||
if a:commentMode ==# 'B'
|
if a:commentMode =~# 'B'
|
||||||
let t = @t
|
let t = @t
|
||||||
try
|
try
|
||||||
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"ty'
|
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"ty'
|
||||||
let mode = (@t =~ mdrx)
|
let uncomment = (@t =~ mdrx)
|
||||||
finally
|
finally
|
||||||
let @t = t
|
let @t = t
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
return 'let indentStr="'. it .'" | let mode='. mode
|
return [it, uncomment]
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:ProcessedLine(mode, match, checkRx, replace)
|
function! s:ProcessedLine(uncomment, match, checkRx, replace)
|
||||||
if !(a:match =~ '\S' || g:tcommentBlankLines)
|
if !(a:match =~ '\S' || g:tcommentBlankLines)
|
||||||
return a:match
|
return a:match
|
||||||
endif
|
endif
|
||||||
if a:mode
|
let ml = len(a:match)
|
||||||
" uncomment
|
if a:uncomment
|
||||||
let rv = substitute(a:match, a:checkRx, '\1\2', '')
|
let rv = substitute(a:match, a:checkRx, '\1\2', '')
|
||||||
else
|
else
|
||||||
" comment
|
|
||||||
let rv = s:SPrintF(a:replace, a:match)
|
let rv = s:SPrintF(a:replace, a:match)
|
||||||
endif
|
endif
|
||||||
|
" let md = len(rv) - ml
|
||||||
|
let s:pos_end = getpos('.')
|
||||||
|
let s:pos_end[2] += len(rv)
|
||||||
|
" TLogVAR pe, md, a:match
|
||||||
let rv = escape(rv, '\
')
|
let rv = escape(rv, '\
')
|
||||||
let rv = substitute(rv, '\n', '\\\n', 'g')
|
let rv = substitute(rv, '\n', '\\\n', 'g')
|
||||||
return rv
|
return rv
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:CommentBlock(beg, end, mode, checkRx, replace, indentStr)
|
function! s:CommentBlock(beg, end, uncomment, checkRx, replace, indentStr)
|
||||||
let t = @t
|
let t = @t
|
||||||
try
|
try
|
||||||
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td'
|
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td'
|
||||||
let ms = s:BlockGetMiddleString(a:replace)
|
let ms = s:BlockGetMiddleString(a:replace)
|
||||||
let mx = escape(ms, '\')
|
let mx = escape(ms, '\')
|
||||||
if a:mode
|
if a:uncomment
|
||||||
" uncomment
|
|
||||||
let @t = substitute(@t, '\V\^\s\*'. a:checkRx .'\$', '\1', '')
|
let @t = substitute(@t, '\V\^\s\*'. a:checkRx .'\$', '\1', '')
|
||||||
if ms != ''
|
if ms != ''
|
||||||
let @t = substitute(@t, '\V\n'. a:indentStr . mx, '\n'. a:indentStr, 'g')
|
let @t = substitute(@t, '\V\n'. a:indentStr . mx, '\n'. a:indentStr, 'g')
|
||||||
@ -510,7 +618,6 @@ fun! s:CommentBlock(beg, end, mode, checkRx, replace, indentStr)
|
|||||||
let @t = substitute(@t, '^\n', '', '')
|
let @t = substitute(@t, '^\n', '', '')
|
||||||
let @t = substitute(@t, '\n\s*$', '', '')
|
let @t = substitute(@t, '\n\s*$', '', '')
|
||||||
else
|
else
|
||||||
" comment
|
|
||||||
let cs = s:BlockGetCommentString(a:replace)
|
let cs = s:BlockGetCommentString(a:replace)
|
||||||
let cs = a:indentStr . substitute(cs, '%s', '%s'. a:indentStr, '')
|
let cs = a:indentStr . substitute(cs, '%s', '%s'. a:indentStr, '')
|
||||||
if ms != ''
|
if ms != ''
|
||||||
@ -530,15 +637,14 @@ endf
|
|||||||
" inspired by Meikel Brandmeyer's EnhancedCommentify.vim
|
" inspired by Meikel Brandmeyer's EnhancedCommentify.vim
|
||||||
" this requires that a syntax names are prefixed by the filetype name
|
" this requires that a syntax names are prefixed by the filetype name
|
||||||
" s:GuessFileType(beg, end, commentMode, filetype, ?fallbackFiletype)
|
" s:GuessFileType(beg, end, commentMode, filetype, ?fallbackFiletype)
|
||||||
" => RecordCMS
|
function! s:GuessFileType(beg, end, commentMode, filetype, ...)
|
||||||
fun! s:GuessFileType(beg, end, commentMode, filetype, ...)
|
|
||||||
if a:0 >= 1 && a:1 != ''
|
if a:0 >= 1 && a:1 != ''
|
||||||
exec s:GetCustomCommentString(a:1, a:commentMode)
|
let [cms, commentMode] = s:GetCustomCommentString(a:1, a:commentMode)
|
||||||
if cms == ''
|
if cms == ''
|
||||||
let cms = s:GuessCurrentCommentString(a:commentMode)
|
let cms = s:GuessCurrentCommentString(a:commentMode)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let commentMode = 'G'
|
let commentMode = s:CommentMode(a:commentMode, 'G')
|
||||||
let cms = s:GuessCurrentCommentString(0)
|
let cms = s:GuessCurrentCommentString(0)
|
||||||
endif
|
endif
|
||||||
let n = a:beg
|
let n = a:beg
|
||||||
@ -547,7 +653,10 @@ fun! s:GuessFileType(beg, end, commentMode, filetype, ...)
|
|||||||
let le = col('$')
|
let le = col('$')
|
||||||
while m < le
|
while m < le
|
||||||
let syntaxName = synIDattr(synID(n, m, 1), 'name')
|
let syntaxName = synIDattr(synID(n, m, 1), 'name')
|
||||||
if syntaxName =~ g:tcommentFileTypesRx
|
let ftypeMap = get(g:tcommentSyntaxMap, syntaxName)
|
||||||
|
if !empty(ftypeMap)
|
||||||
|
return s:GetCustomCommentString(ftypeMap, a:commentMode, cms)
|
||||||
|
elseif syntaxName =~ g:tcommentFileTypesRx
|
||||||
let ft = substitute(syntaxName, g:tcommentFileTypesRx, '\1', '')
|
let ft = substitute(syntaxName, g:tcommentFileTypesRx, '\1', '')
|
||||||
if exists('g:tcommentIgnoreTypes_'. a:filetype) && g:tcommentIgnoreTypes_{a:filetype} =~ '\<'.ft.'\>'
|
if exists('g:tcommentIgnoreTypes_'. a:filetype) && g:tcommentIgnoreTypes_{a:filetype} =~ '\<'.ft.'\>'
|
||||||
let m = m + 1
|
let m = m + 1
|
||||||
@ -562,10 +671,14 @@ fun! s:GuessFileType(beg, end, commentMode, filetype, ...)
|
|||||||
endwh
|
endwh
|
||||||
let n = n + 1
|
let n = n + 1
|
||||||
endwh
|
endwh
|
||||||
return s:RecordCMS(cms, commentMode)
|
return [cms, commentMode]
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:GuessCurrentCommentString(commentMode)
|
function! s:CommentMode(commentMode, newmode) "{{{3
|
||||||
|
return substitute(a:commentMode, '\w\+', a:newmode, 'g')
|
||||||
|
endf
|
||||||
|
|
||||||
|
function! s:GuessCurrentCommentString(commentMode)
|
||||||
let valid_cms = (stridx(&commentstring, '%s') != -1)
|
let valid_cms = (stridx(&commentstring, '%s') != -1)
|
||||||
if &commentstring != s:defaultCommentString && valid_cms
|
if &commentstring != s:defaultCommentString && valid_cms
|
||||||
" The &commentstring appears to have been set and to be valid
|
" The &commentstring appears to have been set and to be valid
|
||||||
@ -589,9 +702,9 @@ fun! s:GuessCurrentCommentString(commentMode)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:ConstructFromComments(commentMode)
|
function! s:ConstructFromComments(commentMode)
|
||||||
exec s:ExtractCommentsPart('')
|
exec s:ExtractCommentsPart('')
|
||||||
if a:commentMode == 'G' && line != ''
|
if a:commentMode =~# 'G' && line != ''
|
||||||
return line .' %s'
|
return line .' %s'
|
||||||
endif
|
endif
|
||||||
exec s:ExtractCommentsPart('s')
|
exec s:ExtractCommentsPart('s')
|
||||||
@ -614,7 +727,7 @@ fun! s:ConstructFromComments(commentMode)
|
|||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:ExtractCommentsPart(key)
|
function! s:ExtractCommentsPart(key)
|
||||||
" let key = a:key != "" ? a:key .'[^:]*' : ""
|
" let key = a:key != "" ? a:key .'[^:]*' : ""
|
||||||
let key = a:key . '[bnflrxO0-9-]*'
|
let key = a:key . '[bnflrxO0-9-]*'
|
||||||
let val = substitute(&comments, '^\(.\{-},\)\{-}'. key .':\([^,]\+\).*$', '\2', '')
|
let val = substitute(&comments, '^\(.\{-},\)\{-}'. key .':\([^,]\+\).*$', '\2', '')
|
||||||
@ -628,36 +741,31 @@ fun! s:ExtractCommentsPart(key)
|
|||||||
endf
|
endf
|
||||||
|
|
||||||
" s:GetCustomCommentString(ft, commentMode, ?default="")
|
" s:GetCustomCommentString(ft, commentMode, ?default="")
|
||||||
" => RecordCMS
|
function! s:GetCustomCommentString(ft, commentMode, ...)
|
||||||
fun! s:GetCustomCommentString(ft, commentMode, ...)
|
|
||||||
let commentMode = a:commentMode
|
let commentMode = a:commentMode
|
||||||
let customComment = exists('g:tcomment_'. a:ft)
|
let customComment = exists('g:tcomment_'. a:ft)
|
||||||
if commentMode ==# 'B' && exists('g:tcomment_'. a:ft .'_block')
|
if commentMode =~# 'B' && exists('g:tcomment_'. a:ft .'_block')
|
||||||
let cms = g:tcomment_{a:ft}_block
|
let cms = g:tcomment_{a:ft}_block
|
||||||
elseif commentMode ==# 'I' && exists('g:tcomment_'. a:ft .'_inline')
|
elseif commentMode =~? 'I' && exists('g:tcomment_'. a:ft .'_inline')
|
||||||
let cms = g:tcomment_{a:ft}_inline
|
let cms = g:tcomment_{a:ft}_inline
|
||||||
elseif customComment
|
elseif customComment
|
||||||
let cms = g:tcomment_{a:ft}
|
let cms = g:tcomment_{a:ft}
|
||||||
let commentMode = 'G'
|
let commentMode = s:CommentMode(commentMode, 'G')
|
||||||
elseif a:0 >= 1
|
elseif a:0 >= 1
|
||||||
let cms = a:1
|
let cms = a:1
|
||||||
let commentMode = 'G'
|
let commentMode = s:CommentMode(commentMode, 'G')
|
||||||
else
|
else
|
||||||
let cms = ''
|
let cms = ''
|
||||||
let commentMode = 'G'
|
let commentMode = s:CommentMode(commentMode, 'G')
|
||||||
endif
|
endif
|
||||||
return s:RecordCMS(cms, commentMode)
|
return [cms, commentMode]
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:RecordCMS(cms, commentMode)
|
function! s:BlockGetCommentString(cms)
|
||||||
return 'let cms="'. escape(a:cms, '"') .'" | let commentMode="'. a:commentMode .'"'
|
|
||||||
endf
|
|
||||||
|
|
||||||
fun! s:BlockGetCommentString(cms)
|
|
||||||
return substitute(a:cms, '\n.*$', '', '')
|
return substitute(a:cms, '\n.*$', '', '')
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fun! s:BlockGetMiddleString(cms)
|
function! s:BlockGetMiddleString(cms)
|
||||||
let rv = substitute(a:cms, '^.\{-}\n\([^\n]*\)', '\1', '')
|
let rv = substitute(a:cms, '^.\{-}\n\([^\n]*\)', '\1', '')
|
||||||
return rv == a:cms ? '' : rv
|
return rv == a:cms ? '' : rv
|
||||||
endf
|
endf
|
||||||
@ -724,3 +832,18 @@ code you have to use TCommentAs
|
|||||||
- Made key maps configurable via g:tcommentMapLeader1 and
|
- Made key maps configurable via g:tcommentMapLeader1 and
|
||||||
g:tcommentMapLeader2
|
g:tcommentMapLeader2
|
||||||
|
|
||||||
|
1.7
|
||||||
|
- gc{motion} (see g:tcommentMapLeaderOp1) functions as a comment toggle
|
||||||
|
operator (i.e., something like gcl... works, mostly); gC{motion} (see
|
||||||
|
g:tcommentMapLeaderOp2) will unconditionally comment the text.
|
||||||
|
- TCommentAs takes an optional second argument (the comment level)
|
||||||
|
- New "n" map: TCommentAs &filetype [COUNT]
|
||||||
|
- Defined mail comments/citations
|
||||||
|
- g:tcommentSyntaxMap: Map syntax names to filetypes for buffers with
|
||||||
|
mixed syntax groups that don't match the filetypeEmbeddedsyntax scheme (e.g.
|
||||||
|
'vimRubyRegion', which should be commented as ruby syntax, not as vim
|
||||||
|
syntax)
|
||||||
|
- FIX: Comments in vim*Region
|
||||||
|
- TComment: The use of the type argument has slightly changed (IG -> i,
|
||||||
|
new: >)
|
||||||
|
|
||||||
|
76
vimfiles/plugin/vgrepsup.vim
Normal file
76
vimfiles/plugin/vgrepsup.vim
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
" Author: Michael Geddes ( vimmer at frog.wheelycreek.net )
|
||||||
|
"
|
||||||
|
" Created for zimnyx on IRC
|
||||||
|
" Version:0.2
|
||||||
|
"
|
||||||
|
" Do a global search replace on a directory.
|
||||||
|
"
|
||||||
|
"
|
||||||
|
" Copyright: Copyright me. Feel free to use, share, modify & distribute the
|
||||||
|
" script but acknowledge me please.
|
||||||
|
"
|
||||||
|
" vim: ts=2 sw=2 et
|
||||||
|
fun! GlobSearchReplace( fileglob, sub, rep, flag)
|
||||||
|
let v:errmsg=''
|
||||||
|
exe 'vimgrep /'.escape(a:sub,'/').'/ '.a:fileglob
|
||||||
|
if v:errmsg != '' | return 0 | endif
|
||||||
|
let countup=0
|
||||||
|
let more=1
|
||||||
|
while 1
|
||||||
|
silent exe 's/'.escape(a:sub, '/').'/'.escape(a:rep,'/').'/'.a:flag
|
||||||
|
let countup+=1
|
||||||
|
try
|
||||||
|
silent cnext
|
||||||
|
catch
|
||||||
|
if v:exception !~ 'E553:' | echoerr v:exception | endif
|
||||||
|
break
|
||||||
|
endtry
|
||||||
|
endwhile
|
||||||
|
return countup
|
||||||
|
endfun
|
||||||
|
fun! s:CallGlobReplace(str)
|
||||||
|
if strlen(a:str) == 0
|
||||||
|
echoerr 'Usage: /sub/rep/flags files'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let firstch= a:str[0]
|
||||||
|
let argidx=0
|
||||||
|
let arg0=''
|
||||||
|
let arg1=''
|
||||||
|
let argflags=''
|
||||||
|
let argfileglob=''
|
||||||
|
let idx=1
|
||||||
|
let str=a:str
|
||||||
|
while idx < strlen(str)
|
||||||
|
let ch=str[idx]
|
||||||
|
if ch=='\' && idx+1 < strlen(str) && str[idx+1] == firstch
|
||||||
|
let str=str[0:idx].str[idx+1:]
|
||||||
|
elseif ch==firstch
|
||||||
|
let arg{argidx}=str[1:idx-1]
|
||||||
|
let argidx+=1
|
||||||
|
let str=str[idx : ]
|
||||||
|
let idx=0
|
||||||
|
if argidx==2
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let idx+=1
|
||||||
|
endwhile
|
||||||
|
if argidx == 2
|
||||||
|
echo ' argidx=2'
|
||||||
|
let idx+=1
|
||||||
|
while idx < strlen(str)
|
||||||
|
if str[idx]=~'\s'
|
||||||
|
let idx+=1
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let argflags=argflags.str[idx]
|
||||||
|
let idx+=1
|
||||||
|
endwhile
|
||||||
|
let argfileglob=str[idx : ]
|
||||||
|
endif
|
||||||
|
call GlobSearchReplace( argfileglob, arg0, arg1, argflags)
|
||||||
|
endfun
|
||||||
|
|
||||||
|
com! -nargs=1 Gsub :call s:CallGlobReplace(<q-args>)
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
" Language : Netrw Remote-Directory Listing Syntax
|
" Language : Netrw Remote-Directory Listing Syntax
|
||||||
" Maintainer : Charles E. Campbell, Jr.
|
" Maintainer : Charles E. Campbell, Jr.
|
||||||
" Last change: Nov 27, 2006
|
" Last change: Aug 08, 2007
|
||||||
" Version : 9
|
" Version : 10
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
|
|
||||||
" Syntax Clearing: {{{1
|
" Syntax Clearing: {{{1
|
||||||
@ -13,7 +13,7 @@ endif
|
|||||||
|
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" Directory List Syntax Highlighting: {{{1
|
" Directory List Syntax Highlighting: {{{1
|
||||||
syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion
|
syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion,netrwCopyTgt
|
||||||
|
|
||||||
syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify
|
syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify
|
||||||
syn match netrwDir "\.\{1,2}/" contains=netrwClassify
|
syn match netrwDir "\.\{1,2}/" contains=netrwClassify
|
||||||
@ -36,6 +36,7 @@ syn match netrwHidePat "[^,]\+" contained skipwhite nextgroup=netrwHideSep
|
|||||||
syn match netrwHideSep "," contained transparent skipwhite nextgroup=netrwHidePat
|
syn match netrwHideSep "," contained transparent skipwhite nextgroup=netrwHidePat
|
||||||
syn match netrwSortBy "Sorted by" contained transparent skipwhite nextgroup=netrwList
|
syn match netrwSortBy "Sorted by" contained transparent skipwhite nextgroup=netrwList
|
||||||
syn match netrwSortSeq "Sort sequence:" contained transparent skipwhite nextgroup=netrwList
|
syn match netrwSortSeq "Sort sequence:" contained transparent skipwhite nextgroup=netrwList
|
||||||
|
syn match netrwCopyTgt "Copy/Move Tgt:" contained transparent skipwhite nextgroup=netrwList
|
||||||
syn match netrwList ".*$" contained contains=netrwComma
|
syn match netrwList ".*$" contained contains=netrwComma
|
||||||
syn match netrwComma "," contained
|
syn match netrwComma "," contained
|
||||||
syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd keepend contained
|
syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd keepend contained
|
||||||
@ -63,6 +64,7 @@ if !exists("did_drchip_dbg_syntax")
|
|||||||
hi link netrwTimeSep netrwDateSep
|
hi link netrwTimeSep netrwDateSep
|
||||||
hi link netrwComma netrwComment
|
hi link netrwComma netrwComment
|
||||||
hi link netrwHide netrwComment
|
hi link netrwHide netrwComment
|
||||||
|
hi link netrwMarkFile Identifier
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Current Syntax: {{{1
|
" Current Syntax: {{{1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user