endif
endfun "}}}2
-fun! <SID>Prep_Signs() "{{{2
- call <SID>Prep_Sign("dot")
- call <SID>Prep_Sign("dash")
- call <SID>Prep_Sign("quote")
- call <SID>Prep_Sign("caret")
- call <SID>Prep_Sign("less")
- call <SID>Prep_Sign("greater")
- call <SID>Prep_Sign("left")
- call <SID>Prep_Sign("right")
- call <SID>Prep_Sign("squareleft")
- call <SID>Prep_Sign("squareright")
- call <SID>Prep_Sign("braceleft")
- call <SID>Prep_Sign("braceright")
- call <SID>Prep_Sign("a")
- call <SID>Prep_Sign("b")
- call <SID>Prep_Sign("c")
- call <SID>Prep_Sign("d")
- call <SID>Prep_Sign("e")
- call <SID>Prep_Sign("f")
- call <SID>Prep_Sign("A")
- call <SID>Prep_Sign("B")
- call <SID>Prep_Sign("C")
- call <SID>Prep_Sign("D")
- call <SID>Prep_Sign("E")
- call <SID>Prep_Sign("F")
-endfun! "}}}2
-
fun! <SID>Place_Sign(number, line, old, name) "{{{2
if a:line == a:old
return a:old
return
endif
- call <SID>Prep_Signs()
-
- let b:signdot = <SID>Place_Sign(0, line("'."), b:signdot, "MarkDot")
- let b:signdash = <SID>Place_Sign(1, line("''"), b:signdash, "MarkDash")
- let b:signquote = <SID>Place_Sign(2, line("'\""), b:signquote, "MarkQuote")
- let b:signcaret = <SID>Place_Sign(3, line("'^"), b:signcaret, "MarkCaret")
- let b:signless = <SID>Place_Sign(4, line("'<"), b:signless, "MarkLess")
- let b:signgreater = <SID>Place_Sign(5, line("'>"), b:signgreater, "MarkGreater")
- let b:signleft = <SID>Place_Sign(6, line("'("), b:signleft, "MarkLeft")
- let b:signright = <SID>Place_Sign(7, line("')"), b:signright, "MarkRight")
- let b:signsquareleft = <SID>Place_Sign(8, line("'["), b:signsquareleft, "MarkSquareLeft")
- let b:signsquareright = <SID>Place_Sign(9, line("']"), b:signsquareright, "MarkSquareRight")
- let b:signbraceleft = <SID>Place_Sign(10, line("'{"), b:signbraceleft, "MarkBraceLeft")
- let b:signbraceright = <SID>Place_Sign(11, line("'}"), b:signbraceright, "MarkBraceRight")
-
- let b:signa = <SID>Place_Sign(12, line("'a"), b:signa, "Marka")
- let b:signb = <SID>Place_Sign(13, line("'b"), b:signb, "Markb")
- let b:signc = <SID>Place_Sign(15, line("'c"), b:signc, "Markc")
- let b:signd = <SID>Place_Sign(16, line("'d"), b:signd, "Markd")
- let b:signe = <SID>Place_Sign(17, line("'e"), b:signe, "Marke")
- let b:signf = <SID>Place_Sign(18, line("'f"), b:signf, "Markf")
- let b:signA = <SID>Place_Sign(19, line("'A"), b:signA, "MarkA")
- let b:signB = <SID>Place_Sign(20, line("'B"), b:signB, "MarkB")
- let b:signC = <SID>Place_Sign(21, line("'C"), b:signC, "MarkC")
- let b:signD = <SID>Place_Sign(22, line("'D"), b:signD, "MarkD")
- let b:signE = <SID>Place_Sign(23, line("'E"), b:signE, "MarkE")
- let b:signF = <SID>Place_Sign(24, line("'F"), b:signF, "MarkF")
+ let l:signs = g:iainsigns
+ let l:sign = ""
+ let l:i = 0
+ while strlen(l:signs)
+ let l:sign = matchstr(l:signs, '^[A-Za-z]\+\(:.\)*[.=-][^ ]\+')
+
+ let l:name = substitute(l:sign, '[:.=-].*', "", "")
+ let l:var = tolower(l:name)
+ let l:sign = substitute(l:sign, '^[A-Za-z]\+', "", "")
+ let l:ascii = matchstr(l:sign, '^:.')
+ let l:mark = substitute(l:sign, '^\(:.\)*[.-=]', "", "")
+ if strlen(l:ascii)
+ let l:ascii = substitute(l:ascii, '^:', "", "")
+ else
+ let l:ascii = l:mark
+ endif
+ let l:ascii = substitute(l:ascii, '"', '\\"', "")
+
+ call <SID>Prep_Sign(l:var)
+ exe "let " . l:var . " = <SID>Place_Sign(" . l:i . ", line(\"'" . l:ascii . "\"), b:sign" . l:var . ", \"Mark" . l:name . "\")"
+ let l:i = l:i + 1
+
+ let l:signs = substitute(l:signs, '^[^ ]\+ *', "", "")
+ endwhile
endfun "}}}2
" Toggle signs.
call Iain_Vars()
let g:marksigns = ! g:marksigns
- if g:marksigns
- " Signs to highlight marks.
- " Syntax won't work properly in Vim 6.
+ " Retrofit arrays on to Vim 6.
+ if ! exists("g:iainsigns")
+ " Signs are defined in g:iainsigns. The syntax is as follows:
+ "
+ " Sign ::= Name (':' Mark)* Type Symbol
+ " Type ::= '=' | '-' | '.'
+ "
+ " Signs with Type '=' will be highlighted with the MarkSign group.
+ " Signs with Type '-' will be highlighted with the MarkLine group.
+ " Signs with Type '.' will be highlighted with the MarkDot group.
+ " Define the Mark where Symbol is not also the mark name, eg "']".
if <SID>Has_Unicode()
- sign define MarkDash text=’ texthl=MarkSign
- sign define MarkDot text=• texthl=MarkDot
- sign define MarkQuote text=” texthl=MarkSign
- sign define MarkCaret text=ʌ texthl=MarkDot
+ let g:iainsigns = "Dash:'=’ Dot:..• Quote:\"=” Caret:^.ʌ"
else
- sign define MarkDash text=' texthl=MarkSign
- sign define MarkDot text=* texthl=MarkDot
- sign define MarkQuote text=" texthl=MarkSign
- sign define MarkCaret text=^ texthl=MarkDot
+ let g:iainsigns = "Dash=' Dot:..* Quote=\" Caret.^"
endif
- sign define MarkLess text=< texthl=MarkSign
- sign define MarkGreater text=> texthl=MarkSign
- sign define MarkLeft text=( texthl=MarkSign
- sign define MarkRight text=) texthl=MarkSign
- sign define MarkSquareLeft text=[ texthl=MarkSign
- sign define MarkSquareRight text=] texthl=MarkSign
- sign define MarkBraceLeft text={ texthl=MarkSign
- sign define MarkBraceRight text=} texthl=MarkSign
- sign define Marka text=a texthl=MarkSign linehl=MarkLine
- sign define Markb text=b texthl=MarkSign linehl=MarkLine
- sign define Markc text=c texthl=MarkSign linehl=MarkLine
- sign define Markd text=d texthl=MarkSign linehl=MarkLine
- sign define Marke text=e texthl=MarkSign linehl=MarkLine
- sign define Markf text=f texthl=MarkSign linehl=MarkLine
- sign define MarkA text=A texthl=MarkSign linehl=MarkLine
- sign define MarkB text=B texthl=MarkSign linehl=MarkLine
- sign define MarkC text=C texthl=MarkSign linehl=MarkLine
- sign define MarkD text=D texthl=MarkSign linehl=MarkLine
- sign define MarkE text=E texthl=MarkSign linehl=MarkLine
- sign define MarkF text=F texthl=MarkSign linehl=MarkLine
+ let g:iainsigns = g:iainsigns . " Less=< Greater=> Left=( Right=) SquareLeft=[ SquareRight=] BraceLeft={ BraceRight=} a-a b-b c-c d-d e-e f-f A-A B-B C-C D-D E-E F-F"
+ endif
+
+ if g:marksigns
+ " Signs to highlight marks.
+ " Syntax won't work properly in Vim 6.
+ let l:signs = g:iainsigns
+ let l:sign = ""
+ while strlen(l:signs)
+ let l:sign = matchstr(l:signs, '^[A-Za-z]\+\(:.\)*[.=-][^ ]\+')
+
+ let l:sign = substitute(l:sign, ':.', "", "")
+ let l:sign = substitute(l:sign, '=', " texthl=MarkSign text=", "")
+ let l:sign = substitute(l:sign, '\.', " texthl=MarkDot text=", "")
+ let l:sign = substitute(l:sign, '-', " texthl=MarkLine text=", "")
+
+ exe "sign define Mark" . l:sign
+
+ let l:signs = substitute(l:signs, '^[^ ]\+ *', "", "")
+ endwhile
if a:resize
call Resize_Columns("+", 2)
endif
call <SID>Highlight_Signs()
else
- exe "sign unplace " . (g:firstsign + 0)
- exe "sign unplace " . (g:firstsign + 1)
- exe "sign unplace " . (g:firstsign + 2)
- exe "sign unplace " . (g:firstsign + 3)
- exe "sign unplace " . (g:firstsign + 4)
- exe "sign unplace " . (g:firstsign + 5)
- exe "sign unplace " . (g:firstsign + 6)
- exe "sign unplace " . (g:firstsign + 7)
- exe "sign unplace " . (g:firstsign + 8)
- exe "sign unplace " . (g:firstsign + 9)
- exe "sign unplace " . (g:firstsign + 10)
- exe "sign unplace " . (g:firstsign + 11)
- exe "sign unplace " . (g:firstsign + 12)
- exe "sign unplace " . (g:firstsign + 13)
- exe "sign unplace " . (g:firstsign + 14)
- exe "sign unplace " . (g:firstsign + 15)
- exe "sign unplace " . (g:firstsign + 16)
- exe "sign unplace " . (g:firstsign + 17)
- exe "sign unplace " . (g:firstsign + 18)
- exe "sign unplace " . (g:firstsign + 19)
- exe "sign unplace " . (g:firstsign + 20)
- exe "sign unplace " . (g:firstsign + 21)
- exe "sign unplace " . (g:firstsign + 22)
- exe "sign unplace " . (g:firstsign + 23)
- exe "sign unplace " . (g:firstsign + 24)
-
- sign undefine MarkDash
- sign undefine MarkDot
- sign undefine MarkQuote
- sign undefine MarkCaret
- sign undefine MarkLess
- sign undefine MarkGreater
- sign undefine MarkLeft
- sign undefine MarkRight
- sign undefine MarkSquareLeft
- sign undefine MarkSquareRight
- sign undefine MarkBraceLeft
- sign undefine MarkBraceRight
- sign undefine Marka
- sign undefine Markb
- sign undefine Markc
- sign undefine Markd
- sign undefine Marke
- sign undefine Markf
- sign undefine MarkA
- sign undefine MarkB
- sign undefine MarkC
- sign undefine MarkD
- sign undefine MarkE
- sign undefine MarkF
-
- call <SID>Prep_Signs()
+ let l:i = 0
+ while l:i < 25
+ exe "sign unplace " . (g:firstsign + l:i)
+ let l:i = l:i + 1
+ endwhile
+
+ let l:signs = g:iainsigns
+ let l:sign = ""
+ while strlen(l:signs)
+ let l:sign = matchstr(l:signs, '^[A-Za-z]\+')
+
+ exe "sign undefine Mark" . l:sign
+ call <SID>Prep_Sign(tolower(l:sign))
+ let l:signs = substitute(l:signs, '^[^ ]\+ *', "", "")
+ endwhile
+
if a:resize
call Resize_Columns("-", 2)
endif