commit 28d94f21ed6140fe11d97c1417e0c90d8f27b5b8 Author: qx13468 <qx13468@eb2d0018-73a3-4aeb-bfe9-1def61c9ec69> Date: Thu Apr 12 15:34:18 2007 +0000 trunk eingeführt git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@133 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69 diff --git a/vimfiles.damos/doc/damos.txt b/vimfiles.damos/doc/damos.txt new file mode 100644 index 0000000..ab38854 --- /dev/null +++ b/vimfiles.damos/doc/damos.txt @@ -0,0 +1,31 @@ +*damos.txt* Funktinen fuer das Arbeiten mit DAMOS-Dateien + +DAMOS-Tools *damos* *kgs* *osp* +============================================================================== + + *:PatchA2L* +:PatchA2L A2L-File patchen + +Mit diesem Befehl wird ein 'make patch_a2l' durchgef�hrt. N�here Informationen +sind in der HTML-Dokumentation zu lesen. + +Wenn man sich im kgs-File auf einer Umrechnungsformel befindet k�nnen folgende +Befehle ausgef�hrt werden: + + *:GetOspPhysValue* +:GetOspPhysValue{Integer-Wert} Ausgabe des physikalische Werts mit Einheit. + + *:GetOspIntValue* +:GetOspIntValue{Phys-Wert} Ausgabe des Integer Werts in dez und hex. + + *:GetOspTestValues* +:GetOspTestValues Ausgabe eines Sets von Testwerten. + +Wenn man sich im kgs-File auf einem Kennwert-Namen befindet kann folgender +Befehl ausgef�hrt werden: + + *:GetKgsTestWertp* +:GetKgsTestWertp Ausgabe des Testwert als physikalischer Wert ausgegeben. + +============================================================================== +vim:tw=78:ts=8:ft=help:norl: diff --git a/vimfiles.damos/doc/tags b/vimfiles.damos/doc/tags new file mode 100644 index 0000000..68f3bf1 --- /dev/null +++ b/vimfiles.damos/doc/tags @@ -0,0 +1,9 @@ +:GetKgsTestWertp damos.txt /*:GetKgsTestWertp* +:GetOspIntValue damos.txt /*:GetOspIntValue* +:GetOspPhysValue damos.txt /*:GetOspPhysValue* +:GetOspTestValues damos.txt /*:GetOspTestValues* +:PatchA2L damos.txt /*:PatchA2L* +damos damos.txt /*damos* +damos.txt damos.txt /*damos.txt* +kgs damos.txt /*kgs* +osp damos.txt /*osp* diff --git a/vimfiles.damos/ftdetect/damos.vim b/vimfiles.damos/ftdetect/damos.vim new file mode 100644 index 0000000..614b1a5 --- /dev/null +++ b/vimfiles.damos/ftdetect/damos.vim @@ -0,0 +1,2 @@ +autocmd BufRead,BufNewFile *.dcm set filetype=damos +autocmd BufRead,BufNewFile *.dcl set filetype=damos diff --git a/vimfiles.damos/ftdetect/kgs.vim b/vimfiles.damos/ftdetect/kgs.vim new file mode 100644 index 0000000..8fcecf1 --- /dev/null +++ b/vimfiles.damos/ftdetect/kgs.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.kgs set filetype=kgs diff --git a/vimfiles.damos/ftdetect/konserve.vim b/vimfiles.damos/ftdetect/konserve.vim new file mode 100644 index 0000000..84205cd --- /dev/null +++ b/vimfiles.damos/ftdetect/konserve.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.kon set filetype=konserve diff --git a/vimfiles.damos/ftplugin/damos.vim b/vimfiles.damos/ftplugin/damos.vim new file mode 100644 index 0000000..86f6e9e --- /dev/null +++ b/vimfiles.damos/ftplugin/damos.vim @@ -0,0 +1,27 @@ +" Vim filetype plugin +" Language: damos command file +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" URL: +" Credits: + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" ---- +" TABS +" ---- +" use spaces for tabs +setlocal expandtab + +" autoindent +" indent mode - one of autoindent, smartindent or cindent +setlocal autoindent + +" commenting +" ---------- +let b:commentstring = "// " + +" Grep options +let b:GrepFiles = '*.dcm' diff --git a/vimfiles.damos/ftplugin/kgs.vim b/vimfiles.damos/ftplugin/kgs.vim new file mode 100644 index 0000000..519ce2f --- /dev/null +++ b/vimfiles.damos/ftplugin/kgs.vim @@ -0,0 +1,416 @@ +" Vim filetype plugin +" Language: damos Kenngroessen Beschreibungs Datei +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" URL: +" Credits: + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" ---- +" TABS +" ---- +" tab width +let tabwidth = 4 +let &l:tabstop = tabwidth +" spaces for tabs +"let &softtabstop = tabwidth +" smart indent tabs (use spaces for indent else tabs) +"set smarttab +" use spaces for tabs +setlocal expandtab + +" autoindent +" indent mode - one of autoindent, smartindent or cindent +" set autoindent +" set smartindent +"set cindent +setlocal cinoptions=*200,)100,(s,w1 +let &l:shiftwidth = tabwidth +setlocal formatoptions=croq +setlocal formatexpr=KgsFormat() + +" commenting +" ---------- +let b:commentstring = "\/\/" + +" Grep options +let b:GrepFiles = '*.kgs' + +" formatting +" ---------- +let s:levelSgFunktion = 0 * &sw +let s:levelBlock = 1 * &sw +let s:levelKeyword = 2 * &sw +let s:lenKeyword = 27 +let s:lenBlockNameId = (s:levelKeyword - s:levelBlock) + s:lenKeyword + +if exists("*KgsFormat") + finish +endif + +" function for gq command +" ----------------------- +function KgsFormat() + if mode() !~ '[iR]' + " not in insert mode + let lstart = v:lnum + let lend = lstart + v:count - 1 + while v:lnum <= lend + let level = GetKgsIndent() + let line = getline(v:lnum) + if level == s:levelSgFunktion + " nix tun + elseif level == s:levelBlock + " Definition eines Blocks + let list = matchlist(line, '^\s*\(\w\+\)\s\+\(\w\+;\?\)\s*\(.*\)\?\s*') + let NameId = printf('%s %s', list[1], list[2]) + let line = printf('%-' . s:lenBlockNameId . 's %s', NameId, list[3]) + elseif level == s:levelKeyword + " Parameter eines Blocks + let list = matchlist(line, '^\s*\(\w\+\)\s\+\(.\{-}\)\s\{-}\(;\)\?\(.*\)\?') + let line = printf('%-' . s:lenKeyword . 's %s%s%s', list[1], list[2], list[3], list[4]) + else + endif + " delete leading spaces + let line = substitute(line, '^\s*\(.*\)', '\1', '') + " indent + let line = printf('%' . level . 's%s', '', line) + " delete trailing spaces + let line = substitute(line, '\(.\{-}\)\s*$', '\1', '') + call setline(v:lnum, line) + let v:lnum = v:lnum + 1 + endwhile + endif +endfunction + +" ------------ +" KGS Reformat +" ------------ + +function ReformatKGS() + let cursorLine = line('.') + let cursorCol = col('.') + "do gq over all + execute 'normal ggVGgq' + call cursor(cursorLine, cursorCol) +endfunction + +" --------------------------------------------------------- +" Physikalischen Wert zu Testwert eines Kennwerts ermitteln +" Cursor muss sich im .kgs-File auf dem Kennwert befinden +" --------------------------------------------------------- +function s:GetOspLine(umrechnungsformel) + execute 'tag ' a:umrechnungsformel + let OspLine = getline('.') + execute 'pop' + return OspLine +endfunction + +function s:GetOspPoly(Nr, OspLine) + if match(a:OspLine, 'Poly') >= 0 + let valRegEx = '[^:;]\+' + let pxPos = matchend(a:OspLine, 'P' . a:Nr . '=') + if pxPos >=0 + let pxVal = matchstr(a:OspLine, valRegEx, pxPos) + else + let pxVal = '0.0' + endif + else + echo 'kein Polynom' + let pxVal = '0.0' + endif + return pxVal +endfunction + +function s:GetOspMas(OspLine) + let masRegEx = '[^:;"]\+' + let masPos = matchend(a:OspLine, 'Mas="') + if masPos >=0 + let mas = matchstr(a:OspLine, masRegEx, masPos) + else + let mas = '-' + endif + return mas +endfunction + +function s:GetOspPolyPhysValue(int, p1, p2, p3, p4, p5) + " P2 - (int - P5) * P4 + " phys = -------------------- + " (int - P5) * P3 - P1 + " +" echo 'P1: ' a:p1 ' P2:' a:p2 ' P3:' a:p3 ' P4:' a:p4 ' P5:' a:p5 + let polynom = '(' . a:p2 . ' - ((' . a:int . ' - ' . a:p5 . ') * ' + \ . a:p4 . ')) / (((' . a:int . ' - ' . a:p5 . ') * ' + \ . a:p3 . ') - ' . a:p1 . ')' +" echo polynom + let phys = Eval(polynom) + return phys +endfunction + +function s:GetOspPolyIntValue(phys, p1, p2, p3, p4, p5) + " P1 * phys + P2 + " int = -------------- + P5 + " P3 * phys + P4 + " +" echo 'P1: ' a:p1 ' P2:' a:p2 ' P3:' a:p3 ' P4:' a:p4 ' P5:' a:p5 + let polynom = '((((' . a:p1 . ' * ' . a:phys . ') + ' . a:p2 . ') / ((' + \ . a:p3 . ' * ' . a:phys . ') + ' . a:p4 . ')) + ' . a:p5 . ')' +" echo polynom + let float = Eval(polynom) + let int = ToInt(float) + return int +endfunction + +command -nargs=1 GetOspPhysValue call s:GetOspPhysValue('<args>') +function s:GetOspPhysValue(int) + execute 'normal yiw' + let umrechnung = @0 + echo 'umrechnung:' umrechnung + let OspLine = s:GetOspLine(umrechnung) + if match(OspLine, 'Poly') >= 0 + let p1Val = s:GetOspPoly('1', OspLine) + let p2Val = s:GetOspPoly('2', OspLine) + let p3Val = s:GetOspPoly('3', OspLine) + let p4Val = s:GetOspPoly('4', OspLine) + let p5Val = s:GetOspPoly('5', OspLine) + let mas = s:GetOspMas(OspLine) + " Poynom + echo 'umrechnung:' umrechnung + echo 'P1:' p1Val 'P2:' p2Val 'P3:' p3Val 'P4:' p4Val 'P5:' p5Val + let phys = s:GetOspPolyPhysValue(a:int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo 'Int:' a:int 'Phys:' phys mas + else + echo 'kein Polynom' + return + endif +endfunction + +command -nargs=1 GetOspIntValue call s:GetOspIntValue('<args>') +function s:GetOspIntValue(phys) + execute 'normal yiw' + let umrechnung = @0 + echo 'umrechnung:' umrechnung + let OspLine = s:GetOspLine(umrechnung) + if match(OspLine, 'Poly') >= 0 + let p1Val = s:GetOspPoly('1', OspLine) + let p2Val = s:GetOspPoly('2', OspLine) + let p3Val = s:GetOspPoly('3', OspLine) + let p4Val = s:GetOspPoly('4', OspLine) + let p5Val = s:GetOspPoly('5', OspLine) + let mas = s:GetOspMas(OspLine) + " Poynom + echo 'umrechnung:' umrechnung + echo 'P1:' p1Val 'P2:' p2Val 'P3:' p3Val 'P4:' p4Val 'P5:' p5Val + let int = s:GetOspPolyIntValue(a:phys, p1Val, p2Val, p3Val, p4Val, p5Val) + let hex = ToHex(int, 0) + echo 'Phys:' a:phys mas 'Int:' int 'Hex:' hex + else + echo 'kein Polynom' + return + endif +endfunction + +command GetOspTestValues call s:GetOspTestValues() +function s:GetOspTestValues() + execute 'normal yiw' + let umrechnung = @0 + echo 'umrechnung:' umrechnung + let OspLine = s:GetOspLine(umrechnung) + if match(OspLine, 'Poly') >= 0 + let p1Val = s:GetOspPoly('1', OspLine) + let p2Val = s:GetOspPoly('2', OspLine) + let p3Val = s:GetOspPoly('3', OspLine) + let p4Val = s:GetOspPoly('4', OspLine) + let p5Val = s:GetOspPoly('5', OspLine) + let mas = s:GetOspMas(OspLine) + " Poynom + echo 'umrechnung:' umrechnung + echo 'P1:' p1Val 'P2:' p2Val 'P3:' p3Val 'P4:' p4Val 'P5:' p5Val + let int = '0' + let hex = ToHex(int, 8) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '1' + let hex = ToHex(int, 8) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '127' + let hex = ToHex(int, 8) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '-128' + let hex = ToHex(int, 8) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '255' + let hex = ToHex(int, 8) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '32767' + let hex = ToHex(int, 16) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '-32768' + let hex = ToHex(int, 16) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '65535' + let hex = ToHex(int, 16) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '2147483647L' + let hex = ToHex(int, 32) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '-2147483648L' + let hex = ToHex(int, 32) + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + let int = '4294967295L' + let hex = '0xffffffff' + let phys = s:GetOspPolyPhysValue(int, p1Val, p2Val, p3Val, p4Val, p5Val) + echo s:formatValues(int, hex, phys, mas) + else + echo 'kein Polynom' + return + endif +endfunction + +function s:formatValues(int, hex, phys, mas) + return printf('Int: %12s Hex: %12s Phys: %s %s',a:int, a:hex, a:phys, a:mas) +endfunction + +command GetKgsTestWertp call s:GetKgsTestWertp() +function s:GetKgsTestWertp() + " position markieren + execute 'normal mx' + " kennwert namen speichern + execute 'normal yiw' + let kennwert = @0 + echo 'kennwert:' kennwert + " Position von { und } merken + call search('{') + let startLineNr = line('.') + execute 'normal %' + let endLineNr = line('.') + execute 'normal %' + " umrechnungs-Formel hohlen + call cursor(startLineNr, 0) + call search('umrechnung', 'W') + execute 'normal wyiw' + let umrechnung = @0 + echo 'umrechnung:' umrechnung + let OspLine = s:GetOspLine(umrechnung) + call cursor(startLineNr, 0) + if match(OspLine, 'Poly') >= 0 + let p1Val = s:GetOspPoly('1', OspLine) + let p2Val = s:GetOspPoly('2', OspLine) + let p3Val = s:GetOspPoly('3', OspLine) + let p4Val = s:GetOspPoly('4', OspLine) + let p5Val = s:GetOspPoly('5', OspLine) + " test_wert lesen + call cursor(startLineNr, 0) + call search('test_wert', 'W') + while search('\x\+\s*}\?\s*[,;]', 'W') > 0 + if line('.') <= endLineNr + execute 'normal yiw' + let test_wert = @0 + " Poynom + echo 'P1:' p1Val 'P2:' p2Val 'P3:' p3Val 'P4:' p4Val 'P5:' p5Val + let phys = s:GetOspPolyPhysValue( + \test_wert, p1Val, p2Val, p3Val, p4Val, p5Val) + echo 'test_wert:' test_wert 'umrechnung:' umrechnung 'Phys:' phys + endif + endwhile + else + echo 'kein Polynom' + return + endif + execute 'normal `x' +endfunction + +" ------------------------------------------------------------ +" Zum �berpr�fen von Testwerten +" Im Fenster 1 muss sich konserve_2.kon befinden +" Im Fenster 3 muss sich konserve_4.kon befinden +" Im Fenster 2 wird das .kgs-File ge�ffnet, das den Kennwert definiert +" Im Fenster 4 wird das .c-File zum .kgs-File ge�ffnet +" ------------------------------------------------------------ +command -nargs=1 DamosCheckValues call s:DamosCheckValues('<args>') +function s:DamosCheckValues(kennwert) + " find kennwert in kgs-file + 2wincmd w + execute 'tselect ' . a:kennwert + execute 'normal 0jzok' + call search(a:kennwert) + execute 'normal gm' + let @/ = a:kennwert . '\>' + " get c-file-name and find kennwert + let cFile = expand('%:p:r') . '.c' + 4wincmd w + execute 'edit ' . cFile + execute 'normal zR!' + execute 'normal n' + 1wincmd w + execute 'normal n' + 3wincmd w + execute 'normal n' + 2wincmd w +endfunction + +" -------------------------------------------------- +" Sucht den Wert eines Kennwerts aus einer Konserve, +" die als erster Parameter �bergeben wird +" -------------------------------------------------- +function s:DamosGetKonserveVal(konserve, kennwert) + let kwPos = match(a:konserve, a:kennwert) +" echo 'kwPos: ' . kwPos + if kwPos >= 0 + let wertLine = matchstr(a:konserve, 'WERT\s\p\+', kwPos) + echo 'wertLine:' wertLine + let wert = substitute(wertLine, 'WERT\s\+\([0-9.,]\+\)' , '\1', '') + else + echo a:kennwert 'not found in' a:konserve + let wert = '-' + endif + return wert +endfunction + +command -nargs=+ DamosCheckKonserven call s:DamosCheckKonserven(<f-args>) +function s:DamosCheckKonserven(kennwert, newValue) + let output = DamosCheckKonserve('konserve_2.kon', a:kennwert, a:newValue) + echo output + let output = DamosCheckKonserve('konserve_4.kon', a:kennwert, a:newValue) + echo output +endfunction + +" ------------------------------------------------------- +" �berpr�ft, ab welcher Version der Konserve ein Kennwert +" einen bestimmten Wert hat +" ------------------------------------------------------- +function s:DamosCheckKonserve(konserve, kennwert, newValue) + " Get object from Continuus + silent let k2_obj = CCM_get_object(a:konserve) + silent let k2_root = CCM_get_hist_root(k2_obj) + let k2_obj = k2_root + while k2_obj != '' + let k2_content = CCM_view_object(k2_obj) + let wert = s:DamosGetKonserveVal(k2_content, a:kennwert) + if wert != '-' + echo a:kennwert . ': ' . wert . '\n' + let equal = Eval(wert . ' == ' . a:newValue) + if equal == 0 + let output = a:kennwert . ': not equal in: ' . k2_obj + silent let owner = CCM_get_owner(k2_obj) + let output = output . ' owner: ' . owner + return output + endif + endif + silent let k2_obj = CCM_get_successor(k2_obj) + endwhile + return 'nix' +endfunction + diff --git a/vimfiles.damos/ftplugin/konserve.vim b/vimfiles.damos/ftplugin/konserve.vim new file mode 100644 index 0000000..c395019 --- /dev/null +++ b/vimfiles.damos/ftplugin/konserve.vim @@ -0,0 +1,27 @@ +" Vim filetype plugin +" Language: damos Konserve +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" URL: +" Credits: + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" ---- +" TABS +" ---- +" use spaces for tabs +setlocal expandtab + +" autoindent +" indent mode - one of autoindent, smartindent or cindent +setlocal autoindent + +" commenting +" ---------- +let b:commentstring = "* " + +" Grep options +let b:GrepFiles = '*.kon' diff --git a/vimfiles.damos/indent/kgs.vim b/vimfiles.damos/indent/kgs.vim new file mode 100644 index 0000000..81cdc18 --- /dev/null +++ b/vimfiles.damos/indent/kgs.vim @@ -0,0 +1,91 @@ +" Vim indent file +" Language: damos Kenngroessen Beschreibungs Datei +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" URL: +" Credits: + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetKgsIndent() +setlocal nolisp +setlocal nosmartindent +setlocal autoindent +setlocal indentkeys+=} + +" Only define the function once +if exists("*GetKgsIndent") + finish +endif + +function GetKgsIndent() + + " Do not change indentation of commented lines. + if exists("b:commentstring") + if getline(v:lnum) =~ '^' . b:commentstring . '.*' + return 0 + endif + endif + + " Don't indent preprocessor directives + if getline(v:lnum) =~ '^\s*#' + return 0 + endif + + " Find a non-blank line above the current line, that's not a comment and not a preprocessor directive + let lnum = prevnonblank(v:lnum - 1) + while 1 + if getline(lnum) =~ '^#' + " search + elseif exists("b:commentstring") + if getline(lnum) =~ '^' . b:commentstring + " search + else + " found + break + endif + else + " found + break + endif + " search next + let lnum = prevnonblank(lnum - 1) + endwhile + + " At the start of the file use zero indent. + if lnum == 0 | return 0 + endif + + let ind = indent(lnum) + let line = getline(lnum) " last line + let cline = getline(v:lnum) " current line + + " Add a 'shiftwidth' after beginning of environments. + " Don't add it for /begin ... /end + if line =~ '{' && line !~ '}' + let ind = ind + &sw + endif + + " Subtract a 'shiftwidth' when an environment ends + if cline =~ '^\s*}' + let ind = ind - &sw + endif + if line !~ '{' && line =~ '}' && line !~ '^\s*}' + let ind = ind - &sw + endif + + " Add a space after beginning of a comment-block + if line =~ '\/\*' && line !~ '\*\/' + let ind = ind + 1 + endif + + " Subtract a space after end of a comment-block + if line !~ '\/\*' && line =~ '\*\/' + let ind = ind - 1 + endif + + return ind +endfunction + diff --git a/vimfiles.damos/syntax/damos.vim b/vimfiles.damos/syntax/damos.vim new file mode 100644 index 0000000..4e8c1a6 --- /dev/null +++ b/vimfiles.damos/syntax/damos.vim @@ -0,0 +1,86 @@ +" Vim syntax file +" Language: damos command file +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" URL: +" Credits: Based on the java.vim syntax file by Claudio Fleiner +" Last change: 2004 Okt 04 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" we define it here so that included files can test for it +if !exists("main_syntax") + let main_syntax='damos' +endif + +" ignore case +"syn case ignore + +" commands +syn keyword damosFunction begrenzeFehlerausgabe unterdrueckeBeaFort +syn keyword damosFunction einstelleSprache oeffneOSp liesBezeichner oeffnePV +syn keyword damosFunction liesAdressDatei anlegeDatenstand +syn keyword damosFunction liesKonservierung speichere schreibeHexDatei +syn keyword damosFunction schreibeASAP_AgIAsw +syn keyword damosFunction kdoOTypCheck ausfuehreTrans pruefeAutoRam +syn keyword damosFunction pruefeFktKonsistenz schreibeFhlListAusFktKonsPruef +syn keyword damosFunction oeffneQuellDatenstand fuelleAusTestwerte +syn keyword damosFunction definiereSGGrAuswahl anlegeAsw entferneAsw schneideAsw +syn keyword damosFunction schliesseAsw setzeUmfang schreibeDatenquelle +syn keyword damosFunction schreibeFktIncludeAbh anlegeOSp importiereObjekte +syn keyword damosFunction schliesseOSp +syn keyword damosCommand exit Dam DAMOS quellDst + +syn match damosSeperator "[<>,:]" + +syn match damosParameter "'p\d\+'" +syn keyword damosParameter Motorola Intel Lesen S I W E y j n V1_3 +syn keyword damosParameter deutsch OSp Dst DAT EXIT PrV maxSstAnz dfpm_fkt alle_fkt +syn keyword damosParameter switch_dfpm_fkt fktGelesen dfpm_index switch_dfpm_index + +" Comments +syn keyword damosTodo contained TODO FIXME XXX +" string inside comments +syn region damosCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=damosSpecial,damosCommentStar,damosSpecialChar +syn match damosCommentCharacter contained "'\\[^']\{1,6\}'" contains=damosSpecialChar +syn match damosCommentCharacter contained "'\\''" contains=damosSpecialChar +syn match damosCommentCharacter contained "'[^\\]'" +syn match damosLineComment "//.*" contains=damosCommentCharacter,damosTodo +hi link damosLineComment damosComment +hi link damosCommentString damosString + +" Strings and constants +syn region damosString start=+"+ end=+"+ contains=ucSpecialChar,ucSpecialError + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_damos_syntax_inits") + if version < 508 + let did_damos_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink damosComment Comment + HiLink damosString String + HiLink damosBranch Statement + HiLink damosSeperator String + HiLink damosFunction Function + HiLink damosCommand Statement + HiLink damosParameter Label + + delcommand HiLink +endif + +let b:current_syntax = "damos" + +if main_syntax == 'damos' + unlet main_syntax +endif + +" vim: ts=8 diff --git a/vimfiles.damos/syntax/kgs.vim b/vimfiles.damos/syntax/kgs.vim new file mode 100644 index 0000000..42c6396 --- /dev/null +++ b/vimfiles.damos/syntax/kgs.vim @@ -0,0 +1,36 @@ +" Vim syntax file +" Language: damos Kenngroessen Beschreibungs Datei +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" URL: +" Credits: + +" load c-syntax +execute('source ' . $VIMRUNTIME . '/syntax/c.vim') + +"syntax keyword kgsFunctions sg_funktion contained +syntax keyword kgsFunctions sg_funktion variante revision +syntax keyword kgsDefinitions fkt_bezeichner kgs_bezeichner ram_bezeichner +syntax keyword kgsDefinitions ram_groesse lok_ram_groesse kennwert kennlinie +syntax keyword kgsDefinitions gruppenkennlinie gruppenkennfeld gruppenstuetzstellen +syntax keyword kgsDefinitions kennfeld kennwerteblock systemkonstante +syntax keyword kgsRefgroessen ref_ram_groesse ref_kenngroesse +syntax keyword kgsKomponents umrechnung codesyntax datentyp adressierschema +syntax keyword kgsKomponents bitanzahl element_anzahl bitbasis_typ bitposition +syntax keyword kgsKomponents bitbasis_name init_wert init_wertp minp_w maxp_w +syntax keyword kgsKomponents ablageschema umrechnung anzahl min_w max_w +syntax keyword kgsKomponents test_wert test_wertp test_wert_text nicht_im_eprom +syntax keyword kgsKomponents eingangsgroesse_x eingangsgroesse_y ergebnisgroesse +syntax keyword kgsKomponents anzahl_stuetzstellen_x anzahl_stuetzstellen_y +syntax keyword kgsKomponents test_stuetzstellen_x test_stuetzstellen_y +syntax keyword kgsKomponents anzahl_test_stuetzstellen_x anzahl_test_stuetzstellen_y +syntax keyword kgsKomponents gruppenstuetzstellen_x gruppenstuetzstellen_y +syntax keyword kgsKomponents minp_x minp_y maxp_x maxp_y +syntax keyword kgsKomponents test_stuetzstellenp_x test_stuetzstellenp_y +syntax keyword kgsKomponents nicht_applizierbar +syntax keyword kgsKomponents deutsch + + +highlight def link kgsFunctions Function +highlight def link kgsDefinitions Function +highlight def link kgsRefgroessen Function +highlight def link kgsKomponents Type diff --git a/vimfiles.damos/tools/ctags.conf b/vimfiles.damos/tools/ctags.conf new file mode 100644 index 0000000..2900224 --- /dev/null +++ b/vimfiles.damos/tools/ctags.conf @@ -0,0 +1,48 @@ +--langdef=damos +--langmap=damos:.kgs +--regex-damos=/^[ \t]*systemkonstante[ \t]*([a-zA-Z0-9_]+)/\1/k,systemkonstante/ +--regex-damos=/^[ \t]*ram_groesse[ \t]*([a-zA-Z0-9_]+)/\1/r,ram_groesse/ +--regex-damos=/^[ \t]*ram_groesse[ \t]*([a-zA-Z0-9_]+)/GET_\1/r,ram_groesse/ +--regex-damos=/^[ \t]*ram_groesse[ \t]*([a-zA-Z0-9_]+)/SET_\1/r,ram_groesse/ +--regex-damos=/^[ \t]*ram_groesse[ \t]*([a-zA-Z0-9_]+)/CLR_\1/r,ram_groesse/ +--regex-damos=/^[ \t]*ram_groesse[ \t]*([a-zA-Z0-9_]+)/PUT_\1/r,ram_groesse/ +--regex-damos=/^[ \t]*lok_ram_groesse[ \t]*([a-zA-Z0-9_]+)/\1/s,lok_ram_groesse/ +--regex-damos=/^[ \t]*lok_ram_groesse[ \t]*([a-zA-Z0-9_]+)/GET_\1/s,lok_ram_groesse/ +--regex-damos=/^[ \t]*lok_ram_groesse[ \t]*([a-zA-Z0-9_]+)/SET_\1/s,lok_ram_groesse/ +--regex-damos=/^[ \t]*lok_ram_groesse[ \t]*([a-zA-Z0-9_]+)/CLR_\1/s,lok_ram_groesse/ +--regex-damos=/^[ \t]*lok_ram_groesse[ \t]*([a-zA-Z0-9_]+)/PUT_\1/s,lok_ram_groesse/ +--regex-damos=/^[ \t]*kennwert[ \t]*([a-zA-Z0-9_]+)/\1/w,kennwert/ +--regex-damos=/^[ \t]*kennwert[ \t]*([a-zA-Z0-9_]+)/KW\1/w,kennwert/ +--regex-damos=/^[ \t]*kennwert[ \t]*([a-zA-Z0-9_]+)/KW_\1/w,kennwert/ +--regex-damos=/^[ \t]*kennwerteblock[ \t]*([a-zA-Z0-9_]+)/\1/w,kennwert/ +--regex-damos=/^[ \t]*kennwerteblock[ \t]*([a-zA-Z0-9_]+)/KWB\1/w,kennwert/ +--regex-damos=/^[ \t]*kennwerteblock[ \t]*([a-zA-Z0-9_]+)/KWB_\1/w,kennwert/ +--regex-damos=/^[ \t]*kennlinie[ \t]*([a-zA-Z0-9_]+)/\1/l,kennlinie/ +--regex-damos=/^[ \t]*kennlinie[ \t]*([a-zA-Z0-9_]+)/KL\1/l,kennlinie/ +--regex-damos=/^[ \t]*kennlinie[ \t]*([a-zA-Z0-9_]+)/KL_\1/l,kennlinie/ +--regex-damos=/^[ \t]*kennlinie[ \t]*([a-zA-Z0-9_]+)/F_\1/l,kennlinie/ +--regex-damos=/^[ \t]*festkennlinie[ \t]*([a-zA-Z0-9_]+)/\1/l,kennlinie/ +--regex-damos=/^[ \t]*festkennlinie[ \t]*([a-zA-Z0-9_]+)/FKL_\1/l,kennlinie/ +--regex-damos=/^[ \t]*festkennlinie[ \t]*([a-zA-Z0-9_]+)/KL_\1/l,kennlinie/ +--regex-damos=/^[ \t]*gruppenkennlinie[ \t]*([a-zA-Z0-9_]+)/\1/l,kennlinie/ +--regex-damos=/^[ \t]*gruppenkennlinie[ \t]*([a-zA-Z0-9_]+)/GKL\1/l,kennlinie/ +--regex-damos=/^[ \t]*gruppenkennlinie[ \t]*([a-zA-Z0-9_]+)/GKL_\1/l,kennlinie/ +--regex-damos=/^[ \t]*gruppenkennlinie[ \t]*([a-zA-Z0-9_]+)/F_\1/l,kennlinie/ +--regex-damos=/^[ \t]*kennfeld[ \t]*([a-zA-Z0-9_]+)/\1/f,kennfeld/ +--regex-damos=/^[ \t]*kennfeld[ \t]*([a-zA-Z0-9_]+)/KF\1/f,kennfeld/ +--regex-damos=/^[ \t]*kennfeld[ \t]*([a-zA-Z0-9_]+)/KF_\1/f,kennfeld/ +--regex-damos=/^[ \t]*kennfeld[ \t]*([a-zA-Z0-9_]+)/F_\1/f,kennfeld/ +--regex-damos=/^[ \t]*festkennfeld[ \t]*([a-zA-Z0-9_]+)/FKF_\1/f,kennfeld/ +--regex-damos=/^[ \t]*gruppenkennfeld[ \t]*([a-zA-Z0-9_]+)/\1/f,kennfeld/ +--regex-damos=/^[ \t]*gruppenkennfeld[ \t]*([a-zA-Z0-9_]+)/GKF\1/f,kennfeld/ +--regex-damos=/^[ \t]*gruppenkennfeld[ \t]*([a-zA-Z0-9_]+)/GKF_\1/f,kennfeld/ +--regex-damos=/^[ \t]*gruppenkennfeld[ \t]*([a-zA-Z0-9_]+)/F_\1/f,kennfeld/ +--regex-damos=/^[ \t]*gruppenstuetzstellen[ \t]*([a-zA-Z0-9_]+)/\1/g,kennfeld/ +--langdef=osp +--langmap=osp:.osp +--regex-osp=/^:OId=[0-9a-fA-F]+:Typ=Umr:Name=([a-zA-Z0-9_]+).*/\1/u,umrechnung/ +--regex-osp=/^:OId=[0-9a-fA-F]+:Typ=CSy:Name=([a-zA-Z0-9_]+).*/\1/c,codesyntax/ +--regex-osp=/^:OId=[0-9a-fA-F]+:Typ=Abl:Name=([a-zA-Z0-9_]+).*/\1/a,ablageschema/ +--regex-osp=/^:OId=[0-9a-fA-F]+:Typ=AdS:Name=([a-zA-Z0-9_]+).*/\1/d,adressierschema/ +--langmap=c:.c.h.d.dat.inv.mkinc -h .h.d.dat.inv.mkinc --c-types=+p + diff --git a/vimfiles.latex/compiler/tex.vim b/vimfiles.latex/compiler/tex.vim new file mode 100644 index 0000000..993ecfe --- /dev/null +++ b/vimfiles.latex/compiler/tex.vim @@ -0,0 +1,293 @@ +" File: tex.vim +" Type: compiler plugin for LaTeX +" Original Author: Artem Chuprina <ran@ran.pp.ru> +" Customization: Srinath Avadhanula <srinath@fastmail.fm> +" CVS: $Id: tex.vim 997 2006-03-20 09:45:45Z srinathava $ +" Description: {{{ +" This file sets the 'makeprg' and 'errorformat' options for the LaTeX +" compiler. It is customizable to optionally ignore certain warnings and +" provides the ability to set a dynamic 'ignore-warning' level. +" +" By default it is set up in a 'non-verbose', 'ignore-common-warnings' mode, +" which means that irrelevant lines from the compilers output will be +" ignored and also some very common warnings are ignored. +" +" Depending on the 'ignore-level', the following kinds of messages are +" ignored. An ignore level of 3 for instance means that messages 1-3 will be +" ignored. By default, the ignore level is set to 4. +" +" 1. LaTeX Warning: Specifier 'h' changed to 't'. +" This errors occurs when TeX is not able to correctly place a floating +" object at a specified location, because of which it defaulted to the +" top of the page. +" 2. LaTeX Warning: Underfull box ... +" 3. LaTeX Warning: Overfull box ... +" both these warnings (very common) are due to \hbox settings not being +" satisfied nicely. +" 4. LaTeX Warning: You have requested ..., +" This warning occurs in slitex when using the xypic package. +" 5. Missing number error: +" Usually, when the name of an included eps file is spelled incorrectly, +" then the \bb-error message is accompanied by a bunch of "missing +" number, treated as zero" error messages. This level ignores these +" warnings. +" NOTE: number 5 is actually a latex error, not a warning! +" +" Use +" TCLevel <level> +" where level is a number to set the ignore level dynamically. +" +" When TCLevel is called with the unquoted string strict +" TClevel strict +" then the 'efm' switches to a 'verbose', 'no-lines-ignored' mode which is +" useful when you want to make final checks of your document and want to be +" careful not to let things slip by. +" +" TIP: MikTeX has a bug where it sometimes erroneously splits a line number +" into multiple lines. i.e, if the warning is on line 1234. the compiler +" output is: +" LaTeX Warning: ... on input line 123 +" 4. +" In this case, vim will wrongly interpret the line-number as 123 instead +" of 1234. If you have cygwin, a simple remedy around this is to first +" copy the file vimlatex (provided) into your $PATH, make sure its +" executable and then set the variable g:tex_flavor to vimlatex in your +" ~/.vimrc (i.e putting let "g:tex_flavor = 'vimlatex'" in your .vimrc). +" This problem occurs rarely enough that its not a botheration for most +" people. +" +" TODO: +" 1. menu items for dynamically selecting a ignore warning level. +" }}} + +" avoid reinclusion for the same buffer. keep it buffer local so it can be +" externally reset in case of emergency re-sourcing. +if exists('b:doneTexCompiler') && !exists('b:forceRedoTexCompiler') + finish +endif +let b:doneTexCompiler = 1 + +" ============================================================================== +" Customization of 'efm': {{{ +" This section contains the customization variables which the user can set. +" g:Tex_IgnoredWarnings: This variable contains a � seperated list of +" patterns which will be ignored in the TeX compiler's output. Use this +" carefully, otherwise you might end up losing valuable information. +if !exists('g:Tex_IgnoredWarnings') + let g:Tex_IgnoredWarnings = + \'Underfull'."\n". + \'Overfull'."\n". + \'specifier changed to'."\n". + \'You have requested'."\n". + \'Missing number, treated as zero.'."\n". + \'There were undefined references'."\n". + \'Citation %.%# undefined' +endif +" This is the number of warnings in the g:Tex_IgnoredWarnings string which +" will be ignored. +if !exists('g:Tex_IgnoreLevel') + let g:Tex_IgnoreLevel = 7 +endif +" There will be lots of stuff in a typical compiler output which will +" completely fall through the 'efm' parsing. This options sets whether or not +" you will be shown those lines. +if !exists('g:Tex_IgnoreUnmatched') + let g:Tex_IgnoreUnmatched = 1 +endif +" With all this customization, there is a slight risk that you might be +" ignoring valid warnings or errors. Therefore before getting the final copy +" of your work, you might want to reset the 'efm' with this variable set to 1. +" With that value, all the lines from the compiler are shown irrespective of +" whether they match the error or warning patterns. +" NOTE: An easier way of resetting the 'efm' to show everything is to do +" TCLevel strict +if !exists('g:Tex_ShowallLines') + let g:Tex_ShowallLines = 0 +endif + +" }}} +" ============================================================================== +" Customization of 'makeprg': {{{ + +" There are several alternate ways in which 'makeprg' is set up. +" +" Case 1 +" ------ +" The first is when this file is a part of latex-suite. In this case, a +" variable called g:Tex_DefaultTargetFormat exists, which gives the default +" format .tex files should be compiled into. In this case, we use the TTarget +" command provided by latex-suite. +" +" Case 2 +" ------ +" The user is using this file without latex-suite AND he wants to directly +" specify the complete 'makeprg'. Then he should set the g:Tex_CompileRule_dvi +" variable. This is a string which should be directly be able to be cast into +" &makeprg. An example of one such string is: +" +" g:Tex_CompileRule_dvi = 'pdflatex \\nonstopmode \\input\{$*\}' +" +" NOTE: You will need to escape back-slashes, {'s etc yourself if you are +" using this file independently of latex-suite. +" TODO: Should we also have a check for backslash escaping here based on +" platform? +" +" Case 3 +" ------ +" The use is using this file without latex-suite and he doesnt want any +" customization. In this case, this file makes some intelligent guesses based +" on the platform. If he doesn't want to specify the complete 'makeprg' but +" only the name of the compiler program (for example 'pdflatex' or 'latex'), +" then he sets b:tex_flavor or g:tex_flavor. + +if exists('g:Tex_DefaultTargetFormat') + exec 'TTarget '.g:Tex_DefaultTargetFormat +elseif exists('g:Tex_CompileRule_dvi') + let &l:makeprg = g:Tex_CompileRule_dvi +else + " If buffer-local variable 'tex_flavor' exists, it defines TeX flavor, + " otherwize the same for global variable with same name, else it will be LaTeX + if exists("b:tex_flavor") + let current_compiler = b:tex_flavor + elseif exists("g:tex_flavor") + let current_compiler = g:tex_flavor + else + let current_compiler = "latex" + end + if has('win32') + let escChars = '' + else + let escChars = '{}\' + endif + " Furthermore, if 'win32' is detected, then we want to set the arguments up so + " that miktex can handle it. + if has('win32') + let options = '--src-specials' + else + let options = '' + endif + let &l:makeprg = current_compiler . ' ' . options . + \ escape(' \nonstopmode \input{$*}', escChars) +endif + +" }}} +" ============================================================================== +" Functions for setting up a customized 'efm' {{{ + +" IgnoreWarnings: parses g:Tex_IgnoredWarnings for message customization {{{ +" Description: +function! <SID>IgnoreWarnings() + let i = 1 + while s:Strntok(g:Tex_IgnoredWarnings, "\n", i) != '' && + \ i <= g:Tex_IgnoreLevel + let warningPat = s:Strntok(g:Tex_IgnoredWarnings, "\n", i) + let warningPat = escape(substitute(warningPat, '[\,]', '%\\\\&', 'g'), ' ') + exe 'setlocal efm+=%-G%.%#'.warningPat.'%.%#' + let i = i + 1 + endwhile +endfunction + +" }}} +" SetLatexEfm: sets the 'efm' for the latex compiler {{{ +" Description: +function! <SID>SetLatexEfm() + + let pm = ( g:Tex_ShowallLines == 1 ? '+' : '-' ) + + set efm= + + if !g:Tex_ShowallLines + call s:IgnoreWarnings() + endif + + setlocal efm+=%E!\ LaTeX\ %trror:\ %m + setlocal efm+=%E!\ %m + + setlocal efm+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%# + setlocal efm+=%+W%.%#\ at\ lines\ %l--%*\\d + setlocal efm+=%+WLaTeX\ %.%#Warning:\ %m + + exec 'setlocal efm+=%'.pm.'Cl.%l\ %m' + exec 'setlocal efm+=%'.pm.'Cl.%l\ ' + exec 'setlocal efm+=%'.pm.'C\ \ %m' + exec 'setlocal efm+=%'.pm.'C%.%#-%.%#' + exec 'setlocal efm+=%'.pm.'C%.%#[]%.%#' + exec 'setlocal efm+=%'.pm.'C[]%.%#' + exec 'setlocal efm+=%'.pm.'C%.%#%[{}\\]%.%#' + exec 'setlocal efm+=%'.pm.'C<%.%#>%m' + exec 'setlocal efm+=%'.pm.'C\ \ %m' + exec 'setlocal efm+=%'.pm.'GSee\ the\ LaTeX%m' + exec 'setlocal efm+=%'.pm.'GType\ \ H\ <return>%m' + exec 'setlocal efm+=%'.pm.'G\ ...%.%#' + exec 'setlocal efm+=%'.pm.'G%.%#\ (C)\ %.%#' + exec 'setlocal efm+=%'.pm.'G(see\ the\ transcript%.%#)' + exec 'setlocal efm+=%'.pm.'G\\s%#' + exec 'setlocal efm+=%'.pm.'O(%*[^()])%r' + exec 'setlocal efm+=%'.pm.'P(%f%r' + exec 'setlocal efm+=%'.pm.'P\ %\\=(%f%r' + exec 'setlocal efm+=%'.pm.'P%*[^()](%f%r' + exec 'setlocal efm+=%'.pm.'P(%f%*[^()]' + exec 'setlocal efm+=%'.pm.'P[%\\d%[^()]%#(%f%r' + if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines + setlocal efm+=%-P%*[^()] + endif + exec 'setlocal efm+=%'.pm.'Q)%r' + exec 'setlocal efm+=%'.pm.'Q%*[^()])%r' + exec 'setlocal efm+=%'.pm.'Q[%\\d%*[^()])%r' + if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines + setlocal efm+=%-Q%*[^()] + endif + if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines + setlocal efm+=%-G%.%# + endif + +endfunction + +" }}} +" Strntok: extract the n^th token from a list {{{ +" example: Strntok('1,23,3', ',', 2) = 23 +fun! <SID>Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun + +" }}} +" SetTexCompilerLevel: sets the "level" for the latex compiler {{{ +function! <SID>SetTexCompilerLevel(...) + if a:0 > 0 + let level = a:1 + else + call Tex_ResetIncrementNumber(0) + echo substitute(g:Tex_IgnoredWarnings, + \ '^\|\n\zs\S', '\=Tex_IncrementNumber(1)." ".submatch(0)', 'g') + let level = input("\nChoose an ignore level: ") + if level == '' + return + endif + endif + if level == 'strict' + let g:Tex_ShowallLines = 1 + elseif level =~ '^\d\+$' + let g:Tex_ShowallLines = 0 + let g:Tex_IgnoreLevel = level + else + echoerr "SetTexCompilerLevel: Unkwown option [".level."]" + end + call s:SetLatexEfm() +endfunction + +com! -nargs=? TCLevel :call <SID>SetTexCompilerLevel(<f-args>) +" }}} + +" }}} +" ============================================================================== + +call s:SetLatexEfm() + +if !exists('*Tex_Debug') + function! Tex_Debug(...) + endfunction +endif + +call Tex_Debug("compiler/tex.vim: sourcing this file", "comp") + +" vim: fdm=marker:commentstring=\ \"\ %s diff --git a/vimfiles.latex/doc/imaps.txt b/vimfiles.latex/doc/imaps.txt new file mode 100644 index 0000000..087b3db --- /dev/null +++ b/vimfiles.latex/doc/imaps.txt @@ -0,0 +1,116 @@ + IMAP -- A fluid replacement for :imap + *imaps.txt* + Srinath Avadhanula <srinath AT fastmail DOT fm> + + + + Abstract + ======== +This plugin provides a function IMAP() which emulates vims |:imap| function. The +motivation for providing this plugin is that |:imap| suffers from problems +which get increasingly annoying with a large number of mappings. + +Consider an example. If you do > + imap lhs something + + +then a mapping is set up. However, there will be the following problems: +1. The 'ttimeout' option will generally limit how easily you can type the lhs. + if you type the left hand side too slowly, then the mapping will not be + activated. + +2. If you mistype one of the letters of the lhs, then the mapping is deactivated + as soon as you backspace to correct the mistake. + +3. The characters in lhs are shown on top of each other. This is fairly + distracting. This becomes a real annoyance when a lot of characters initiate + mappings. + +This script provides a function IMAP() which does not suffer from these +problems. + + + + *imaps.txt-toc* +|im_1| Using IMAP + +================================================================================ +Viewing this file + +This file can be viewed with all the sections and subsections folded to ease +navigation. By default, vim does not fold help documents. To create the folds, +press za now. The folds are created via a foldexpr which can be seen in the +last section of this file. + +See |usr_28.txt| for an introduction to folding and |fold-commands| for key +sequences and commands to work with folds. + +================================================================================ +Using IMAP *im_1* *imaps-usage* + + + +Each call to IMAP is made using the syntax: > + call IMAP (lhs, rhs, ft [, phs, phe]) + + +This is equivalent to having <lhs> map to <rhs> for all files of type <ft>. + +Some characters in the <rhs> have special meaning which help in cursor placement +as described in |imaps-placeholders|. The optional arguments define these +special characters. + +Example One: > + call IMAP ("bit`", "\\begin{itemize}\<cr>\\item <++>\<cr>\\end{itemize}<++>", "tex") + + +This effectively sets up the map for "bit`" whenever you edit a latex file. When +you type in this sequence of letters, the following text is inserted: > + \begin{itemize} + \item * + \end{itemize}<++> + +where * shows the cursor position. The cursor position after inserting the text +is decided by the position of the first "place-holder". Place holders are +special characters which decide cursor placement and movement. In the example +above, the place holder characters are <+ and +>. After you have typed in the +item, press <C-j> and you will be taken to the next set of <++>'s. Therefore by +placing the <++> characters appropriately, you can minimize the use of movement +keys. + +Set g:Imap_UsePlaceHolders to 0 to disable placeholders altogether. + +Set g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd to something else if you +want different place holder characters. Also, b:Imap_PlaceHolderStart and +b:Imap_PlaceHolderEnd override the values of g:Imap_PlaceHolderStart and +g:Imap_PlaceHolderEnd respectively. This is useful for setting buffer specific +place holders. + +Example Two: You can use the <C-r> command to insert dynamic elements such as +dates. > + call IMAP ('date`', "\<c-r>=strftime('%b %d %Y')\<cr>", '') + + + +With this mapping, typing date` will insert the present date into the file. + +================================================================================ +About this file + +This file was created automatically from its XML variant using db2vim. db2vim is +a python script which understands a very limited subset of the Docbook XML 4.2 +DTD and outputs a plain text file in vim help format. + +db2vim can be obtained via anonymous CVS from sourceforge.net. Use + +cvs -d:pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex co db2vim + +Or you can visit the web-interface to sourceforge CVS at: +http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/db2vim/ + +The following modelines should nicely fold up this help manual. + +vim:ft=help:fdm=expr:nowrap +vim:foldexpr=getline(v\:lnum-1)=~'-\\{80}'?'>2'\:getline(v\:lnum-1)=~'=\\{80}'?'>1'\:getline(v\:lnum)=~'=\\{80}'?'0'\:getline(v\:lnum)=~'-\\{80}'?'1'\:'=' +vim:foldtext=substitute(v\:folddashes.substitute(getline(v\:foldstart),'\\s*\\*.*',"",""),'^--','--\ \ \ \ ','') +================================================================================ diff --git a/vimfiles.latex/doc/latex-suite-quickstart.txt b/vimfiles.latex/doc/latex-suite-quickstart.txt new file mode 100644 index 0000000..8c18b72 --- /dev/null +++ b/vimfiles.latex/doc/latex-suite-quickstart.txt @@ -0,0 +1,448 @@ + A (very) quick introduction to Latex-Suite + *latex-suite-quickstart.txt* + Srinath Avadhanula <srinath AT fastmail DOT fm> + + + + Abstract + ======== +Latex-Suite is a comprehensive set of scripts to aid in editing, compiling and +viewing LaTeX documents. A thorough explanation of the full capabilities of +Latex-Suite is described in the user manual. This guide on the other hand, +provides a quick 30-45 minute running start to some of the more commonly used +functionalities of Latex-Suite. + + *latex-suite-quickstart.txt-toc* +|lq_1| Using this tutorial +|lq_2| Inserting a template +|lq_3| Inserting a package +|lq_4| Inserting an Environment +|lq_5| A few keyboard shortcuts +|lq_6| Folding in Latex-Suite +|lq_7| Inserting a Reference +|lq_8| Compiling a document + |lq_8_1| Debugging LaTeX source files +|lq_9| Viewing DVI files + |lq_9_1| Performing forward searches + |lq_9_2| Performing inverse searches +|lq_10| Conclusions + +================================================================================ +Viewing this file + +This file can be viewed with all the sections and subsections folded to ease +navigation. By default, vim does not fold help documents. To create the folds, +press za now. The folds are created via a foldexpr which can be seen in the +last section of this file. + +See |usr_28.txt| for an introduction to folding and |fold-commands| for key +sequences and commands to work with folds. + +================================================================================ +Using this tutorial *lq_1* *lq_a_bc* + *lsq-using-tutorial* + + + +This tutorial assumes that you have vim version 6.1+ installed on your machine. +To check, open vim and type > + :ver +You will see the version in the first line of the output. Get the latest vim +version from http://vim.sf.net |lq_u_1|. + +Assuming you have Vim 6.1+ already up and running, follow the instructions here +|lq_u_2| to set up Latex-Suite. Remember to make sure your 'grepprg' setting of +Vim works. + +Good, now you are all set to start the tutorial. Since this tutorial aims to +explain the newbie-friendly version of Latex-Suite, it needs some GUI +functionality. Therefore, at least for this tutorial, open the gui version of +vim. (On MS windows, this is the default). Open up this help file in either the +same gvim session in a split window or in a different session and follow the +(friendly) instructions. + +================================================================================ +Inserting a template *lq_2* *lq_a_bd* + *lsq-inserting-template* + + + +Start up gvim and begin editing a new file. > + e newfile.tex +If the installation went well, you should see a new set of menus appear. Goto +Tex-Suite > Templates. You will see a number of templates to choose from. For +now, choose to insert a template for an article. You should get the following in +the main vim window (after possibly a hit-enter prompt). > + + 1 % File: sample.tex + 2 % Created: Sun Jun 22 04:00 PM 2003 P + 3 % Last Change: Sun Jun 22 04:00 PM 2003 P + 4 % + 5 \documentclass[a4paper]{article} + 6 \begin{document} + 7 + 8 \end{document} + 9 + 10 ~ + 11 ~ + 12 ~ + 13 ~ + -- INSERT -- 7,1 All + + + +The cursor is left on line 7 (just after the \begin{document} line) from where +you can start typing straight away. Trying to lessen movement is a recurring +theme in Latex-Suite. + +================================================================================ +Inserting a package *lq_3* *lq_a_be* + *lsq-lsq-inserting-package* + + + +Assume that we are writing a mathematical paper and we want to use the popular +amsmath package. We will use some functionality which Latex-Suite provides +specifically for including LaTeX packages, providing options etc. Navigate to +before the \begin{document} line (The portion of the document before the +\begin{document} is called the _preamble_ in LaTeX). On an empty line in the +preamble, type the single word amsmath and then press <F5> in normal mode. The +line will change to > + \usepackage[]{amsmath}<++> +with the cursor positioned conviniently between the []'s. For now, do not worry +about the trailing <++> at the end of this line. Assume we want to provide the +sumlimits options to amsmath. You can either type in this option manually, or +choose from a menu of package options which Latex-Suite automatically creates +when you insert a package using <F5>. With the cursor still placed between the +[], goto TeX-Suite > Packages > amsmath Options. Choose the sumlimits option. +The package line should get converted to: > + \usepackage[sumlimits,]{amsmath}<++> + + +with the cursor before ]. Press <C-j> in insert mode. You will see the cursor +jump to the end of the package line and the trailing <++> will dissapear. What +just happened?! You had your first taste of _Placeholders_. Read more about them +(later) here |lq_u_3|. In short, pressing <C-j> in insert mode takes you to the +next <++> in the text. + +================================================================================ +Inserting an Environment *lq_4* *lq_a_bf* + *lsq-insert-environment* + + + +Now let us type in a simple formula in LaTeX. Move back to the body of the +document (The portion of the document between \begin{document} and +\end{document} is called the body). Type in a few simple sentences and then on +an empty line, type the single word eqnarray. Escape to normal mode and press +<F5>. (Remember: <F5> is very useful!) This time, the line will change to: > + \begin{eqnarray} + \label{}<++> + \end{eqnarray}<++> +<with the cursor between the {}. Enter a label. We will use eqn:euler. After +typing in eqn:euler, press <C-j>. This will take you outside the curly-braces. +Another time you used a Placeholder! + +================================================================================ +A few keyboard shortcuts *lq_5* *lq_a_bg* + *lsq-keyboard-shortcuts* + + + +Now to type in the famous Euler formula. Our aim is to type > + e^{j\pi} + 1 &=& 0 +Instead of typing this blindly, let us use a few shortcuts to reduce movement. +Start out by typing e^. Now instead of typing {, type another ^. You will see +the e^^ change instantly to e^{}<++> with the cursor between {}'s. (The ^^ +changed to ^{}<++>.) Continue with the following sequence of letters: j`p. This +will change instantly to j\pi. (The `p changed to \pi.) Having typed in all we +need to type between the {}'s, press <C-j>. You will pop back out of the +curly-braces. Continue typing the rest of the formula. You can use == as a +shortcut for &=&. Latex-Suite provides a large number of such shortcuts which +should making typing much more fun and fast if you get acquainted with them. A +list is provided here |lq_u_4|. Definitely spend some time getting a feel for +them. Most of them are pretty intuitive like `/ for \frac{}{}, `8 for \infty +etc. + +In order to understand the next section better, it will be helpful to have one +more \label. Lets use the handy <F5> key to insert another equation. This time +something simple like the following will do: > + \begin{eqnarray} + \label{eqn:simple} + 1 + 1 = 2 + \end{eqnarray} + + +================================================================================ +Folding in Latex-Suite *lq_6* *lq_a_bh* *lsq-folding* + + + +Okay, we have typed enough. At this stage, hopefully, your file is looking +something like this: > + + 1 % File: sample.tex + 2 % Created: Sun Jun 22 04:00 PM 2003 P + 3 % Last Change: Mon Dec 15 07:00 PM 2003 + 4 % + 5 \documentclass[a4paper]{article} + 6 + 7 \usepackage[sumlimits,]{amsmath} + 8 + 9 \begin{document} + 10 \begin{eqnarray} + 11 \label{eqn:euler} + 12 e^{j\pi} + 1 &=& 0 + 13 \end{eqnarray} + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + 17 \begin{eqnarray} + 18 \label{eqn:simple} + 19 1 + 1 &=& 2 + 20 \end{eqnarray} + 21 This is my contribution to mathematics. + 22 \end{document} + +In normal mode, press \rf. This will fold up the entire file and you should see +the file looking as below: > + + 1 % File: sample.tex + 2 % Created: Sun Jun 22 04:00 PM 2003 P + 3 % Last Change: Mon Dec 15 07:00 PM 2003 + 4 % + 5 +-- 4 lines: Preamble: \documentclass[a4paper]{article} ----- + 9 \begin{document} + 10 +-- 4 lines: eqnarray (eqn:euler) \label{eqn:euler} ----------- + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + 10 +-- 4 lines: eqnarray (eqn:simple) \label{eqn:simple} --------- + 21 This is my contribution to mathematics. + 22 \end{document} + +What has happened is that Latex-Suite folded away blocks of LaTeX code into +folded regions. You can open and close folds by using the command za in normal +mode. + +================================================================================ +Inserting a Reference *lq_7* *lq_a_bi* + *lsq-inserting-reference* + + + +A necessary part of LaTeX editing is referencing equations, figures, +bibliographic entries etc. This is done with the \ref and the \cite commands. +Latex-Suite provides an easy way to do this. Somewhere in the body of the +document, type in the following sentence > + This is a reference to (\ref{}). +With the cursor between the {} press <F9> in insert mode. Your vim session will +sprout two new windows and it should look like below: > + + 9 \begin{document} + 10 +-- 4 lines: eqnarray (eqn:euler) : \label{eqn:euler}----------------------- + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + 17 +-- 4 lines: eqnarray (eqn:simple) : \label{eqn:simple}--------------------- + 21 This is my contribution to mathematics. + 22 This is a reference to (\ref{}<++>)<++> + 23 \end{document} + ~ + ~ + ~ + test.tex [+] 22,29 Bot + test.tex|11| \label{eqn:euler} + test.tex|18| \label{eqn:simple} + ~ + ~ + ~ + [Error List] 1,1 All + 7 \usepackage[sumlimits,]{amsmath} + 8 + 9 \begin{document} + 10 \begin{eqnarray} + 11 \label{eqn:euler} + 12 e^{j\pi} + 1 &=& 0 + 13 \end{eqnarray} + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + test.tex [Preview][+] 11,2-5 46% + + + +The cursor will relocate to the middle window which shows all \labels found in +all the .tex file in the current directory. You can scroll up and down in the +middle window till you reach the reference you want to insert. Notice how when +you scroll in the middle window, the bottom "Preview" window scrolls +automatically to show you the location of the current selection. This helps you +identify the reference with greater ease because often times, \labels are not +descriptive enough or there might be too many of them. To insert the reference, +just position the cursor on the relevant line in the middle window and press +<enter>. The line which you were editing will change to: > + This is a reference to (\ref{eqn:euler}) +<and the bottom windows close automatically. + +The <F9> key also works for inserting \cite commands to reference bibliographich +entries, inserting file names for the \inputgraphics command and just plain +searching for words. Click here |lq_u_5| for more information. + +================================================================================ +Compiling a document *lq_8* *lq_a_bj* + *lsq-compiling* + +|lq_8_1| Debugging LaTeX source files + + +Great! We have just created a small latex file. The next step is to make the +latex compiler create a .dvi file from it. Compiling via latex-suite is simple. +Goto normal mode and press \ll (replace \ with whatever mapleader setting you +have). This will call the latex compiler. If all goes well, then the focus +should return to the vim window. + +Nothing happend? Ouch! You might need to do some additional settings as +described here. |lq_u_6| + + +-------------------------------------------------------------------------------- +Debugging LaTeX source files *lq_8_1* *lq_a_bk* + *lsq-debugging* + +To illustrate the debugging procedure, let's create a few mistakes in the file. +Insert the following ``mistakes'' in the file: > + This is a $\mistake$. + And this is $\another$ +Now press \ll again. This time you will notice that after compilation finishes, +the cursor automatically lands on $\mistake$. In addition, 2 new windows will +appear as shown here: + +The middle window is an _Error List_ window showing you the errors which the +latex compiler found. Th bottom window is a _Log Preview_ window, which shows +you the context of the error made by displaying the relevant portion of the .log +file created during the latex compilation procedure. Jump to the _Error List_ +window and try scrolling around in it using either the j, k keys or the arrow +keys. You will notice that the _Log Preview_ window scrolls automatically to +retain the context of the error you are currently located on. If you press +<enter> on any line, you will see the cursor jump to the location of the error. +Latex-Suite tries to guess the column location as best as it can so you can +continue typing straight away. +Having got a taste for compiling, proceed by deleting the erroneous lines and +re-compiling. + +The Latex-Suite compiler is capable of much more including selectively filtering +out common errors which you might want to ignore for the moment, compiling parts +of a document, setting levels of verbosity in the compiler output etc. See here +|lq_u_7| for more. + +================================================================================ +Viewing DVI files *lq_9* *lq_a_bl* + *lsq-viewing-dvi* + +|lq_9_1| Performing forward searches +|lq_9_2| Performing inverse searches + + +Now that you have compiled your first latex source, its time to view it. Again, +this should be pretty simple. Press \lv in normal mode. Depending on your +platform, a DVI viewer program should open up and display the dvi file generated +in compilation step previously. + +Nothing happend? Ouch! You might need to do some additional settings as +described here. |lq_u_8| + + +-------------------------------------------------------------------------------- +Performing forward searches *lq_9_1* *lq_a_bm* + *lsq-quick-forward-searching* + +If you are using a modern DVI viewer, then it is possible to do what is called +forward and inverse searching. However, you will need to customize the standard +Latex-Suite distribution in order to utilize this functionality. Type in the +following on the command line: > + :let g:Tex_CompileRule_dvi = 'latex -src-specials -interaction=nonstopmode $*' + :TCTarget dvi + + +Now recompile the latex file by pressing \ll. This time, instead of pressing \lv +to view the file, press \ls from within the tex file. If the DVI viewer supports +forward searching (most of them do), then the viewer will actually display the +portion of the DVI file corresponding to the location where you were editing the +tex file. + +NOTE: The reason Latex-Suite does not have this setting by default is that on + some systems this causes unpredictable results in the DVI output. If you + find the DVI output satisfactory, then you can insert the first of the 2 + lines above into your $VIM/ftplugin/tex.vim file. $VIM is ~/vimfiles for + windows and ~/.vim for *nix machines. + + + +-------------------------------------------------------------------------------- +Performing inverse searches *lq_9_2* *lq_a_bn* + *lsq-quick-inverse-searching* + +Most DVI viewers also support inverse searching, whereby you can make the DVI +viewer ask vim to display the tex source corresponding to the DVI file being +shown. This is extremeley helpful while proofreading large documents. + +Simply double-click anywhere in the viewer window. If the viewer supports it, +then it will attempt to open an editor window at the location corresponding to +where you double-clicked. On *nix platforms, Latex-Suite attempts to start the +viewer program in such a way that it already knows to use vim to open the tex +source. Thus you should see a vim window open up showing the tex file. However, +if there is an error, or some other program is used, you will need to tell the +viewer program to use gvim as the editor. On windows platforms, if you use the +commonly available yap viewer (available as part of the miktex distribution), +then this option can be set from View > Options > Inverse Search. In the Command +line: window, write > + "C:\Program Files\vim\vim61\gvim" -c ":RemoteOpen +%l %f" +(Customize the path according to where you have installed gvim). If you double +click in the view pane now, you will see gvim start up and take you to the +relevant portion of the tex file. + +================================================================================ +Conclusions *lq_10* *lq_a_bo* + *lsq-conclusions* + + + +Thats all folks! By now, you should know enough of the basic functions of +latex-suite. Ofcourse, latex-suite is capable of much, much more such as +compiling files multiple times to resolve changed labels, compiling +dependencies, handling user packages and more. To get a feel for that, you will +need to take a look at the Latex-Suite user manual. |lq_u_9| + +================================================================================ +URLs used in this file + +*lq_u_1* : http://vim.sf.net +*lq_u_2* : http://vim-latex.sourceforge.net/index.php?subject=download&title=Download +*lq_u_3* : http://vim-latex.sourceforge.net/documentation/latex-suite/latex-macros.html +*lq_u_4* : http://vim-latex.sourceforge.net/documentation/latex-suite/auc-tex-mappings.html +*lq_u_5* : http://vim-latex.sourceforge.net/documentation/latex-suite/latex-completion.html +*lq_u_6* : http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-2 +*lq_u_7* : http://vim-latex.sourceforge.net/documentation/latex-suite/latex-compiling.html +*lq_u_8* : http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-3 +*lq_u_9* : http://vim-latex.sourceforge.net/index.php?subject=manual&title=Manual#user-manual + +================================================================================ +About this file + +This file was created automatically from its XML variant using db2vim. db2vim is +a python script which understands a very limited subset of the Docbook XML 4.2 +DTD and outputs a plain text file in vim help format. + +db2vim can be obtained via anonymous CVS from sourceforge.net. Use + +cvs -d:pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex co db2vim + +Or you can visit the web-interface to sourceforge CVS at: +http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/db2vim/ + +The following modelines should nicely fold up this help manual. + +vim:ft=help:fdm=expr:nowrap +vim:foldexpr=getline(v\:lnum-1)=~'-\\{80}'?'>2'\:getline(v\:lnum-1)=~'=\\{80}'?'>1'\:getline(v\:lnum)=~'=\\{80}'?'0'\:getline(v\:lnum)=~'-\\{80}'?'1'\:'=' +vim:foldtext=substitute(v\:folddashes.substitute(getline(v\:foldstart),'\\s*\\*.*',"",""),'^--','\ \ \ \ \ \ ','') +================================================================================ diff --git a/vimfiles.latex/doc/latex-suite.txt b/vimfiles.latex/doc/latex-suite.txt new file mode 100644 index 0000000..a44cd9b --- /dev/null +++ b/vimfiles.latex/doc/latex-suite.txt @@ -0,0 +1,3418 @@ + Latex-Suite Reference + *latex-suite.txt* + Srinath Avadhanula <srinath AT fastmail DOT fm> + Mikolaj Machowski <mikmach AT wp DOT pl> + + + + Abstract + ======== +Latex-Suite attempts to provide a comprehensive set of tools to view, edit and +compile LaTeX documents in Vim. Together, they provide tools starting from +macros to speed up editing LaTeX documents to functions for forward searching +.dvi documents. Latex-Suite has been possible because of the contributions of +many people. Please see latex-suite-credits [|ls_a_dU|] for a list of people who +have helped. + +Latex-Suite is released under the Vim charityware license. For license and +conditions of use look at |copyright|. Replace all occurrences of ``Vim'' with +``Latex-Suite''. The current copyright holders of Latex-Suite are Srinath +Avadhanula and Mikolaj Machowski. + +Homepage: http://vim-latex.sourceforge.net |ls_u_1| + + + + *latex-suite.txt-toc* +|ls_1| Installation and recommended Settings +|ls_2| Inserting Templates +|ls_3| Latex-Suite Macros + |ls_3_1| Environment Mappings + |ls_3_2| Command Mappings + |ls_3_3| Font Mappings + |ls_3_4| Section Mappings + |ls_3_5| Greek Letter Mappings + |ls_3_6| Auc-Tex Key Bindings + |ls_3_7| Diacritics + |ls_3_8| BibTeX Shortcuts + |ls_3_9| Smart Key Mappings + |ls_3_10| Alt Key Macros + |ls_3_11| Custom Macros + |ls_3_12| Making your own Macros via IMAP() +|ls_4| Package Handling + |ls_4_1| Inserting package commands + |ls_4_2| Actions taken for supported packages + |ls_4_3| Automatic Package detection + |ls_4_4| Writing supporting for a package +|ls_5| Latex Completion + |ls_5_1| Latex-Suite completion example + |ls_5_2| Latex-Suite \ref completion + |ls_5_3| Latex-Suite \cite completion + |ls_5_4| Latex-Suite filename completion + |ls_5_5| Custom command completion +|ls_6| LaTeX Compiling + |ls_6_1| Setting Compilation rules + |ls_6_2| Handling dependencies in compilation + |ls_6_3| Compiling multiple times + |ls_6_4| Customizing the compiler output + |ls_6_5| Compiling parts of a file +|ls_7| Latex Viewing and Searching + |ls_7_1| Setting Viewing rules + |ls_7_2| Forward Searching DVI documents + |ls_7_3| Inverse Searching +|ls_8| Latex Folding + |ls_8_1| Default Folding Scheme in Latex-Suite + |ls_8_2| Customizing what to fold + |ls_8_3| Editing the folding.vim file directly +|ls_9| Multiple file LaTeX projects + |ls_9_1| Latex-Suite project settings + |ls_9_2| Specifying which file to compile +|ls_10| Latex-Suite Commands and Maps + |ls_10_1| Latex-Suite Maps + |ls_10_2| Latex Suite Commands +|ls_11| Customizing Latex-Suite + |ls_11_1| General Settings + |ls_11_2| Place-Holder Customization + |ls_11_3| Macro Customization + |ls_11_4| Smart Key Customization + |ls_11_5| Latex Completion Customization + |ls_11_6| Compiler Customization + |ls_11_7| Viewer Customization + |ls_11_8| Menu Customization + |ls_11_9| Folding Customization + |ls_11_10| Package Handling Customization +|ls_12| Credits + +================================================================================ +Viewing this file + +This file can be viewed with all the sections and subsections folded to ease +navigation. By default, vim does not fold help documents. To create the folds, +press za now. The folds are created via a foldexpr which can be seen in the +last section of this file. + +See |usr_28.txt| for an introduction to folding and |fold-commands| for key +sequences and commands to work with folds. + +================================================================================ +Installation and recommended Settings *ls_1* *ls_a_bc* + *recommended-settings* + + + +If you are reading this, it most probably means that you have already installed +Latex-Suite and the help files. If this is not the case, follow the detailed +instructions on Latex-Suite's download page |ls_u_2|. + +Make sure that you create a few necessary settings in your ~/.vimrc. > + + " REQUIRED. This makes vim invoke Latex-Suite when you open a tex file. + filetype plugin on + + " IMPORTANT: win32 users will need to have 'shellslash' set so that latex + " can be called correctly. + set shellslash + + " IMPORTANT: grep will sometimes skip displaying the file name if you + " search in a singe file. This will confuse Latex-Suite. Set your grep + " program to always generate a file-name. + set grepprg=grep\ -nH\ $* + + " OPTIONAL: This enables automatic indentation as you type. + filetype indent on + + + +In addition, the following settings could go in your ~/.vim/ftplugin/tex.vim +file: > + " this is mostly a matter of taste. but LaTeX looks good with just a bit + " of indentation. + set sw=2 + " TIP: if you write your \label's as \label{fig:something}, then if you + " type in \ref{fig: and press <C-n> you will automatically cycle through + " all the figure labels. Very useful! + set iskeyword+=: + + + +================================================================================ +Inserting Templates *ls_2* *ls_a_bd* + *latex-suite-templates* + + + +This functionality is available via the TeX-Suite > Templates menu. This module +provides a way to insert custom templates at the beginning of the current file. + +When Latex-Suite first starts up, it scans the +$VIM/ftplugin/latex-suite/templates/ directory and creates menu items based on +the files found there. When you select a template from this menu, the file will +be read in above the first line of the current file. + +A template file can utilize placeholders for initializing the cursor position +when the template is read in and subsequent movement. In addition, template +files can contain dynamic elements such as the time of creation of a file etc, +by using vim expressions. + +You can place your own templates in the $VIM/ftplugin/latex-suite/templates/ +directory in order for them to be available via the menu. Unless Latex-Suite +releases a template with the same name, these files should not get over-written +when you install a new release over an existing one. + +NOTE: Templates are also accessible for non-gui users with the command + |:TTemplate|. The argument should be name of the corresponding template + file. If the command is called without arguments (preferred usage), then a + list of available templates is displayed and the user is asked to choose + one of them. + + + +================================================================================ +Latex-Suite Macros *ls_3* *ls_a_be* + *latex-macros* + +|ls_3_1| Environment Mappings +|ls_3_2| Command Mappings +|ls_3_3| Font Mappings +|ls_3_4| Section Mappings +|ls_3_5| Greek Letter Mappings +|ls_3_6| Auc-Tex Key Bindings +|ls_3_7| Diacritics +|ls_3_8| BibTeX Shortcuts +|ls_3_9| Smart Key Mappings +|ls_3_10| Alt Key Macros +|ls_3_11| Custom Macros +|ls_3_12| Making your own Macros via IMAP() + + +Latex-Suite ships with a very comprehensive set of insert mode and |visual-mode| +mappings and menu items to typeset most of the LaTeX elements. + +NOTE: These mappings are are not standard mappings in the sense that only the + last character is mapped. See plugin/imaps.vim for further documentation. + For example, in the case of the mapping EFI provided by Latex-Suite you + can press the characters 'E', 'F' and 'I' as slowly as you wish (unlike + the normal imap command where timeout issues are involved). The characters + are visible as you type them (unlike normal imaps) and you can use the + movement or backspace key to correct yourself unlike normal mappings. + + + *place-holder* *ls_a_dV* + *place-holders* *ls_a_eD* +NOTE: Place Holders + ------------- + Almost all macros provided in Latex-Suite implement Stephen Riem's + bracketing system and Gergely Kontra's JumpFunc() for handling + place-holders. This consists of using "place-holders" to mark off + locations where the next relevant editing has to be done. As an example, + when you type EFI in |insert-mode|, you will get the following: > + \begin{figure}[h] + \centerline{\psfig{figure=<+eps file+>}} + \caption{<+caption text+>} + \label{fig:<+label+>} + \end{figure}<++> +< The text <+eps file+> will be selected and you will be left in + |select-mode| so that you can continue typing straight away. After having + typed in the file name, you can press <Ctrl-J> (while still in + insert-mode). This will take you directly to the next "place-holder". i.e, + <+caption text+> will be visually selected with Vim in select mode again + for typing in the caption. This saves on a lot of key presses. + + + *overriding-macros* *ls_a_eE* +NOTE: Over-riding Latex-Suite Macros + ------------------------------ + If you wish to change these macros from their default values, for example, + if you wish to change `w to expand to \omega instead of its default + expansion to \wedge, you should use the IMAP function as described in the + Using IMAP() [|ls_a_bG|] section. + + An important thing to note is that if you wish to over-ride macros created + by Latex-Suite rather than merely create new macros, you should place the + IMAP() calls in a script which gets sourced after the files in + Latex-Suite. A good place typically is as a file-type plugin file in the + ~/.vim/after/ftplugin/ directory. (Use ~/vimfiles if you are using + WINDOWS). For example to over-ride `w to \omega instead of \wedge, place + the following line in (say) ~/.vim/after/ftplugin/tex_macros.vim: > + call IMAP('`w', '\omega', 'tex') +< + + NOTE: It is important to use a file-name which will get sourced on a + FileType event. Therefore you must use a file-name which conforms to + the standards as described in |ftplugin-name|. + + + + *pausing-imaps* *ls_a_eF* +NOTE: Pausing Macro expansion + ----------------------- + If you wish to temporarily suspend the imaps functionality, then you can + set the Imap_FreezeImap to 1. If you set g:Imap_FreezeImap to 1, then it + will be a system-wide setting. Setting b:Imap_FreezeImap will affect only + the current buffer. + + +The following sections describe the various editing macros provided by +Latex-Suite. + + +-------------------------------------------------------------------------------- +Environment Mappings *ls_3_1* *ls_a_bf* + *environment-mappings* + +Latex-Suite provides a rich set of mappings to insert, enclose and modify LaTeX +environments, i.e, \begin{...} ... \end{...} pairs. + +Inserting Environments *ls_3_1_1* *ls_a_bg* + *inserting-environments* + +Latex-Suite provides the following ways to insert environments + + + +Method 1: Pressing <F5> *ls_3_1_1_1* *ls_a_bh* + *inserting-env-f5* + +If you press <F5> in the insert or normal mode while on an empty line, +Latex-Suite prompts you with a list of environments you might want to insert. +You can either choose one from the list or type in a new environment name. If +you press <F5> on a line which already has a word, then that word is used +instead of prompting. + +See Tex_Env_name [|ls_a_cZ|] for a description of how Latex-Suite uses the word +to form the expansion and how to modify Latex-Suite's behavior. + +The list of environments which Latex-Suite prompts you with (when <F5> is +pressed on an empty line) is formed from the Tex_PromptedEnvironments +[|ls_a_di|] setting. + +In addition to this setting, Latex-Suite also lists environments found in custom +packages as described in the section Package actions. [|ls_a_bL|] + + +Method 2: Using <S-F1>-<S-F4> *ls_3_1_1_2* *ls_a_bi* + *inserting-env-shift-f1* + +The shifted function keys, <S-F1> to <S-F4> can be mapped to insert very +commonly used environments. The environments mapped to each key can be +customized via the g:Tex_HotKeyMappings [|ls_a_dj|] setting. + + +Method 3: Using three letter sequences *ls_3_1_1_3* *ls_a_bj* + *inserting-env-threeletter* + +Environments can also be inserted by pressing a 3 capital letter sequence +starting with an E. The sequence of 3 letters generally tries to follow the +following rules: + + +1. All environment mappings begin with E + +2. If the environment can be broken up into 2 distinct words, such as flushright + (flush + right), then the next 2 letters are the first letters of the 2 + words. Example: > + flushleft (_f_lush + _l_eft) ---> EFL + flushright (_f_lush + _r_ight) ---> EFR + eqnarray (_e_qn + _a_rray) ---> EEA +< If on the other hand, the environment name cannot be broken up into 2 + distinct words, then the next 2 letters are the first 2 letters of the name + of the environment. Example: > + equation (_eq_uation) ---> EEQ +< +Unfortunately there are some environments that cannot be split in two words and +first two letters in name are identical. In this case shortcut is created from +E, first and last letter. Example: > + quote (_q_uot_e_) ---> EQE + quotation (_q_uotatio_n_) ---> EQN +Of course, not every last one of the environments can follow this rule because +of ambiguities. In case of doubt, pull down the Tex-Environments menu. The menu +item should give the hint for the map. + + +Enclosing in Environments *ls_3_1_2* *ls_a_bk* + *enclosing-environments* + +Latex-Suite provides visual-mode mappings which enclose visually selected +portions of text in environments. There are two ways provided to do this. + + + +Method 1: Pressing <F5> *ls_3_1_2_1* *ls_a_bl* + *enclosing-env-f5* + +You can also select a portion of text visually and press <F5> while still in +visual mode. This will prompt you with a list of environments. (This list can be +customized via the g:Tex_PromptedEnvironments [|ls_a_di|] setting). You can +either choose from this list or type in a new environment name. Once the +selection is done, Latex-Suite encloses the visually selected portion in the +chosen environment. + + +Method 2: Using three letter mappings *ls_3_1_2_2* *ls_a_bm* + *enclosing-env-threeletter* + +You can also select text visually and press a sequence of three characters +beginning with , (the single comma character) and the selected text will be +enclosed in the chosen environment. The three letter sequence follows directly +from the three letter sequence used to insert environments as described here +[|ls_a_bj|]. The following example describes the rule used: + +If ECE inserts a \begin{center}...\end{center} environment, then to enclose a +block of selected text in \begin{center}...\end{center}, simply select the text +and press ,ce. The rule simply says that the leading E is converted to , and the +next 2 letters are small case. +Some of the visual mode mappings are sensitive to whether you choose line-wise +or character-wise. For example, if you choose a word and press ,ce, then you get +\centerline{word}, whereas if you press ,ce on a line-wise selection, you get: > + \begin{center} + line + \end{center} + + + +Changing Environments *ls_3_1_3* *ls_a_bn* + *changing-environments* + +Pressing <S-F5> in normal mode detects which environment the cursor is presently +located in and prompts you to replace it with a new one. The innermost +environment is detected. For example, in the following source: > + \begin{eqnarray} + \begin{array}{ccc} + 2 & 3 & 4 + \end{array} + \end{eqnarray} +if you are located in the middle "2 & 3 & 4" line, then pressing <S-F5> will +prompt you to change the array environment, not the eqnarray environment. In +addition, Latex-Suite will also try to change lines within the environment to be +consistent with the new environment. For example, if the original environment +was an eqnarray environment with a \label command, then changing it to an +eqnarray* environment will delete the \label. + +Pressing <F5> in normal mode has the same effect as pressing <F5> in +insert-mode, namely you will be prompted to choose an environment to insert. + +-------------------------------------------------------------------------------- +Command Mappings *ls_3_2* *ls_a_bo* + *latex-command-maps* + +Latex-Suite provides a rich set of mappings to insert, enclose and modify LaTeX +commands. + +Inserting LaTeX commands *ls_3_2_1* *ls_a_bp* + *inserting-commands* + + *ls-imap-f7* *ls_a_dW* + *ls-imap-s-f7* *ls_a_dX* +Pressing <F7> in insert or normal mode while the cursor is touching a word will +insert a command formed from the word touching the cursor. + +For certain common commands, Latex-Suite will expand them to include additional +arguments as needed. For example, frac becomes \frac{<++>}{<++>}<++>. Otherwise, +it will simply change the word under the cursor as follows > + word --> \word{<++>}<++> +You can define custom expansions of commands using the Tex_Com_{name} setting as +described in here [|ls_a_da|]. + +If <F7> is pressed when the cursor is on white-space, then Latex-Suite will +prompt you to choose a command and insert that instead.The list of commands is +constructed from the g:Tex_PromptedCommands [|ls_a_dk|] setting and also from +commands which Latex-Suite finds while scanning custom packages which +Latex-Suite finds. See the Package actions [|ls_a_bL|] section for details on +which files are scanned etc. + + +Enclosing in a command *ls_3_2_2* *ls_a_bq* + *enclosing-commands* + +You can select a portion of text visually and press <F7> while still in visual +mode. This will prompt you with a list of commands. (This list can be customized +via the g:Tex_PromptedCommands [|ls_a_dk|] setting). You can either choose from +this list or type in a new command name. Once the selection is done, Latex-Suite +encloses the visually selected portion in the chosen command. + + +Changing commands *ls_3_2_3* *ls_a_br* + *changing-commands* + + *ls-vmap-f7* *ls_a_dY* +In both insert and normal mode <S-F7> will find out if you are presently within +an environment and then prompt you with a list of commands to change it to. + +-------------------------------------------------------------------------------- +Font Mappings *ls_3_3* *ls_a_bs* *font-maps* + +These mappings insert font descriptions such as: \textsf{<++>}<++> with the +cursor left in place of the first placeholder [|ls_a_eD|] (the <++> characters). + +Mnemonic: +1. first letter is always F (F for font) + +2. next 2 letters are the 2 letters describing the font. + +Example: Typing FEM in insert-mode expands to \emph{<++>}<++>. + +Just like environment mappings, you can visually select an area and press `sf to +have it enclosed in: \textsf{word} or > + {\sffamily + line + } +depending on character-wise or line-wise selection. + +-------------------------------------------------------------------------------- +Section Mappings *ls_3_4* *ls_a_bt* + *section-mappings* + +These maps insert LaTeX sections such as: > + \section{<++>}<++> +etc. Just as in the case of environments and fonts, can be enclosed with a +visual selection. The enclosing is not sensitive to character or line-wise +selection. + +Mnemonic: (make your own!) > + SPA for part + SCH for chapter + SSE for section + SSS for subsection + SS2 for subsubsection + SPG for paragraph + SSP for subparagraph + + +Example: SSE in insert mode inserts > + \section{<++>}<++> +If you select a word or line and press ,se, then you get > + \section{section name} +The menu item in Tex-Environments.Sections have a sub-menu called 'Advanced'. +Choosing an item from this sub-menu asks a couple of questions (whether you want +to include the section in the table of contents, whether there is a shorter name +for the table of contents) and then creates a more intelligent template. + +-------------------------------------------------------------------------------- +Greek Letter Mappings *ls_3_5* *ls_a_bu* + *greek-letter-mappings* + +Lower case + +`a through `z expand to \alpha through \zeta.Upper case: + + > + `D = \Delta + `F = \Phi + `G = \Gamma + `Q = \Theta + `L = \Lambda + `X = \Xi + `Y = \Psi + `S = \Sigma + `U = \Upsilon + `W = \Omega +NOTE: LaTeX does not support upper case for all greek alphabets. + + +Just like other Latex-Suite mappings, these mappings are not created using the +standard imap command. Thus you can type slowly, correct using <BS> etc. + +-------------------------------------------------------------------------------- +Auc-Tex Key Bindings *ls_3_6* *ls_a_bv* + *auc-tex-mappings* + +These are simple 2 key expansions for some very commonly used LaTeX elements: + + > + `^ Expands To \Hat{<++>}<++> + `_ expands to \bar{<++>}<++> + `6 expands to \partial + `8 expands to \infty + `/ expands to \frac{<++>}{<++>}<++> + `% expands to \frac{<++>}{<++>}<++> + `@ expands to \circ + `0 expands to ^\circ + `= expands to \equiv + `\ expands to \setminus + `. expands to \cdot + `* expands to \times + `& expands to \wedge + `- expands to \bigcap + `+ expands to \bigcup + `( expands to \subset + `) expands to \supset + `< expands to \le + `> expands to \ge + `, expands to \nonumber + `~ expands to \tilde{<++>}<++> + `; expands to \dot{<++>}<++> + `: expands to \ddot{<++>}<++> + `2 expands to \sqrt{<++>}<++> + `| expands to \Big| + `I expands to \int_{<++>}^{<++>}<++> +(again, notice the convenient place-holders) + +In addition the visual mode macros are provided: + + > + `( encloses selection in \left( and \right) + `[ encloses selection in \left[ and \right] + `{ encloses selection in \left\{ and \right\} + `$ encloses selection in $$ or \[ \] depending on characterwise or + linewise selection + + +-------------------------------------------------------------------------------- +Diacritics *ls_3_7* *ls_a_bw* + *diacritic-mappings* + +These mappings speed up typing European languages which contain diacritic +characters such as a-umlaut etc. > + +<l> expands to \v{<l>} + =<l> expands to \'{<l>} +where <l> is an alphabet. + + > + +} expands to \"{a} + +: expands to \^{o} +Latex-Suite also ships with smart backspacing [|ls_a_dZ|] functionality which +provides another convenience while editing languages with diacritics. + +NOTE: Diacritics are disabled by default in Latex-Suite because they can + sometimes be a little too intrusive. Moreover, most European users can + nowadays use font encodings which display diacritic characters directly + instead of having to rely on Latex-Suite's method of displaying + diacritics. + + Set the g:Tex_Diacritics [|ls_a_df|] variable to enable diacritics. + + + +-------------------------------------------------------------------------------- +BibTeX Shortcuts *ls_3_8* *ls_a_bx* + *bibtex-bindings* + +Latex-Suite provides an easy way of entering bibliographic entries. Four +insert-mode mappings: BBB, BBL, BBH and BBX are provided, all of which +essentially act in the same manner. When you type any of these in insert-mode, +you will get a prompt asking you to choose a entry type for the bibliographic +entry. + +When you choose an entry type, a bibliographic entry template will be inserted. +For example, if you choose the option 'book' via the map BBB, then the following +template will be inserted: > + @BOOK{<+key+>, + author = {<++>}, + editor = {<++>}, + title = {<++>}, + publisher = {<++>}, + year = {<++>}, + otherinfo = {<++>} + }<++> + + +<+key+> will be highlighted in select-mode and you can type in the bib-key. +After that you can use <Ctrl-J> to navigate to successive locations in the +template and enter new values. + +BBB inserts a template with only the fields mandatorily required for a given +entry type. BBL inserts a template with commonly used extra options. BBH inserts +a template with more options which are not as commonly used. BBX inserts a +template with all the fields which the entry type supports. + +NOTE: Mnemonic + -------- + B for Bibliographic entry, L for Large entry, H for Huge entry, and X + stands for all eXtras. + + + + +Customizing Bib-TeX fields *ls_3_8_1* *ls_a_by* + *adding-bib-options* + +If you wish the BBB command to insert a few additional fields in addition to the +fields it creates, then you will need to define global variables of the form > + g:Bib_{type}_options +in you $VIM/ftplugin/bib.vim file, where {type} is a string like 'article', +'book' etc. This variable should contain one of the letters defined in the +following table + +Character Field Type~ +w address +a author +b booktitle +c chapter +d edition +e editor +h howpublished +i institution +k isbn +j journal +m month +z note +n number +o organization +p pages +q publisher +r school +s series +t title +u type +v volume +y year + +For example, by default, choosing 'article' via BBB inserts the following +template by default > + @ARTICLE{<+key+>, + author = {<++>}, + title = {<++>}, + journal = {<++>}, + year = {<++>}, + otherinfo = {<++>} + }<++> +However, if g:Bib_article_options is defined as 'mnp', then 'article' will +insert the following template > + @ARTICLE{<+key+>, + author = {<++>}, + title = {<++>}, + journal = {<++>}, + year = {<++>}, + month = {<++>}, + number = {<++>}, + pages = {<++>}, + otherinfo = {<++>} + }<++> + + +If you have some other fields you wish to associate with an article which are +not listed above, then you will have to use the Bib_{type}_extrafields option. +This is a newline separated string of complete field names which will be +included in the template. For example, if you define > + let g:Bib_article_extrafields = "crossref\nabstract" +then the article template will include the lines > + crossref = {<++>}, + abstract = {<++>}, + + +NOTE: You will need to define Bib_* settings in your + $VIMRUNTIME/ftplugin/bib.vim file. + + + +-------------------------------------------------------------------------------- +Smart Key Mappings *ls_3_9* *ls_a_bz* + *smart-keys* + +Latex-Suite ships with the following smart keys: + +Smart Backspace +--------------- + *smart-backspace* *ls_a_dZ* +Pressing <BS> in insert mode checks to see whether we are just after something +like \'{a} and if so, deletes all of it. i.e, diacritics are treated as single +characters for backspacing. + +Smart Quotes +------------ +Pressing " (English double quote) will insert `` or '' by making an intelligent +guess about whether we intended to open or close a quote. + +Smart Space +----------- +Latex-Suite maps the <space> key in such a way that $ characters are not broken +across lines. It does this by first setting tw=0 so that Vim will not +automatically break lines and then maps the <space> key to insert newlines +keeping $$'s on the same line. + +Smart Dots +---------- +Pressing ... (3 dots) results in \ldots outside math mode and \cdots in math +mode. + +-------------------------------------------------------------------------------- +Alt Key Macros *ls_3_10* *ls_a_bA* + *altkey-mappings* + +Latex-Suite utilizes a set of macros originally created by Carl Mueller in +auctex.vim to make inserting all the \left ... \right stuff very easy and to +also make some use of the heavily under-utilized <Alt> key. + +NOTE: By default, typing Alt-<key> in Vim takes focus to the menu bar if a menu + with the hotkey <key> exists. If in your case, there are conflicts due to + this behavior, you will need to set > + set winaltkeys=no +< in your $VIM/ftplugin/tex.vim in order to use these maps. + + +NOTE: Customizing the maps + -------------------- + If for some reason, you wish to not map the <Alt> keys, (some European + users need to use the <Alt> key to enter diacritics), you can change these + maps to other keys as described in the section Customizing Alt-key maps + [|ls_a_cx|]. + + + + +<Alt-L> *ls_3_10_1* *ls_a_bB* *Alt-L* + +This is a polymorphic insert-mode mapping which expands to one of the following +depending on the character just before the cursor location. + +Character before cursor Expansion~ +( \left( <++> \right) +[ \left[ <++> \right] +| \left| <++> \right| +{ \left\{ <++> \right\} +< \langle <++> \rangle +q \lefteqn{<++>}<++> + +If the character before the cursor is none of the above, then it will simply +insert a \label{<++>}<++>. + + +<Alt-B> *ls_3_10_2* *ls_a_bC* *Alt-B* + +This insert-mode mapping encloses the previous character in \mathbf{}. + + +<Alt-C> *ls_3_10_3* *ls_a_bD* *Alt-C* + +In insert mode, this key is polymorphic as follows: + + +1. If the previous character is a letter or number, then capitalize it and + enclose it in \mathcal{}. + +2. otherwise insert \cite{}. +In visual mode, it will simply enclose the selection in \mathcal{} + + +<Alt-I> *ls_3_10_4* *ls_a_bE* *Alt-I* + +This mapping inserts an \item command at the current cursor location depending +on which environment the cursor is enclosed in. The style of the \item command +is dependent on the enclosing environment. By default, <Alt-I> has styles +defined forthe following environments: + +Environment Style~ +itemize \item +enumerate \item +theindex \item +thebibliography \item[<+biblabel+>]{<+bibkey+>} <++> +description \item[<+label+>] <++> + +<Alt-I> is intelligent enough to account for nested environments. For example, > + \begin{itemize} + \item first item + \item second item + \begin{description} + \item[label1] first desc + \item[label2] second + % <Alt-I> will insert "\item[<+label+>] <++>" if + % used here + \end{description} + \item third item + % <Alt-I> will insert "\item " when if used here. + \end{itemize} + % <Alt-I> will insert nothing ("") if used here +< + +The style used by <Alt-I> can be customized using the +g:Tex_ItemStyle_environment [|ls_a_dl|] variable. + +-------------------------------------------------------------------------------- +Custom Macros *ls_3_11* *ls_a_bF* + *custom-macros-menu* + +This functionality available via the TeX-Suite.Macros menu, provides a way of +inserting customized macros into the current file via the menu. + +When Latex-Suite starts up, it scans the $VIM/ftplugin/latex-suite/macros/ +directory and creates a menu from the files found there. Each file is considered +as a single macro. You can place your own macros in this directory, using +placeholders [|ls_a_eD|] if wanted. + +When you choose a macro from the menu, the corresponding file is read into the +current buffer after the current cursor position. In non-gui mode, you can use +the |TMacro| command instead of choosing from the menu. This command takes the +macro file name as an argument. When called without arguments (preferred usage), +then a list of available macro files is displayed and the user is prompted to +choose one of them). + +There are some other tools provided in this menu, namely: + + +{New} Creates a new (unnamed) buffer in the latex-suite/macros/ directory. + Use the command :TexMacroNew in non-gui mode. +{Edit} Opens up the corresponding macro file for editing. Use |:TexMacroEdit| + in non-gui mode. When you try to edit {macro} not from local directory + Latex-Suite will copy it to your local directory with suffix "-local". + If local copy already exists Latex-Suite prompt for overwriting it. +{Delete} Deletes the corresponding macro. Use the prefixed numbers for fast + navigation of menus. Use |:TexMacroDelete| in non-gui mode. When you + choose to delete {macro} which is not in your local directory + Latex-Suite will refuse to delete it. +{Redraw} Rescans the macros/ directories and refreshes the macros list. + +-------------------------------------------------------------------------------- +Making your own Macros via IMAP() *ls_3_12* *ls_a_bG* + *ls-new-macros* + +If you find the need to create your own macros, then you can use the IMAP() +function provided with Latex-Suite. See [|ls_a_bH|] for a short explanation of +why you might prefer IMAP() over Vim's standard :imap command. An example best +explains the usage: > + :call IMAP('NOM', '\nomenclature{<++>}<++>', 'tex') +This will create a Latex-Suite-style mapping, where if you type NOM in insert +mode, you will get \nomenclature{<++>}<++> with the cursor left in place of the +first <++> characters. See [|ls_a_bI|] for a detailed explanation of the IMAP() +command. + +For maps which are triggered for a given filetype, the IMAP() command above +should be put in the filetype plugin script for that file. For example, for +tex-specific mappings, the IMAP() calls should go in $VIM/ftplugin/tex.vim. For +globally visible maps, you will need to use the following in either your +~/.vimrc or a file in your $VIM/plugin directory. > + augroup MyIMAPs + au! + au VimEnter * call IMAP('Foo', 'foo', '') + augroup END + + + + +Why use IMAP() *ls_3_12_1* *ls_a_bH* + *why-IMAP* + +Using IMAP instead of Vim's built-in :imap command has a couple of advantages: +1. The 'ttimeout' option will generally limit how easily you can type the left + hand side for a normal :imap. if you type the left hand side too slowly, then + the mapping will not be activated. + +2. If you mistype one of the letters of the lhs, then the mapping is deactivated + as soon as you backspace to correct the mistake. + +3. The characters in lhs are shown on top of each other. This is fairly + distracting. This becomes a real annoyance when a lot of characters initiate + mappings. + + +IMAP() syntax *ls_3_12_2* *ls_a_bI* + *ls-imaps-syntax* + +Formally, the syntax which is used for the IMAP function is: > + call IMAP (lhs, rhs, ft [, phs, phe]) + + +Argument Explanation~ +lhs This is the "left-hand-side" of the mapping. When you use IMAP, only + the last character of this word is actually mapped, although the + effect is that the whole word is mapped. + + If you have two mappings which end in a common lhs, then the mapping + with the longer lhs is used. For example, if you do > + call IMAP('BarFoo', 'something', 'tex') + call IMAP('Foo', 'something else', 'tex') +< Then typing BarFoo inserts "something", whereas Foo by itself inserts + "something else". + + Also, the nature of IMAP() makes creating certain combination of + mappings impossible. For example if you have > + call IMAP('foo', 'something', 'tex') + call IMAP('foobar', 'something else', 'tex') +< Then you will never be able to trigger "foobar" because typing "foo" + will immediately insert "something". This is the "cost" which you + incur over the normal :imap command for the convenience of no + 'timeout' problems, the ability to correct lhs etc. + + +rhs The "right-hand-side" of the mapping. This is the expansion you will + get when you type lhs. + + This string can also contain special characters such as <enter> etc. + To do this, you will need to specify the second argument in + double-quotes as follows: > + :call IMAP('EFE', "\\begin{figure}\<CR><++>\\end{figure}<++>", 'tex') +< With this, typing EFE is equivalent to typing in the right-hand side + with all the special characters in insert-mode. This has the advantage + that if you have filetype indentation set up, then the right hand side + will also be indented just as if you had typed it in normally. + + *IMAP_PutTextWithMovement* *ls_a_ea* + You can also set up a Latex-Suite style mapping which calls a custom + function as follows: > + :call IMAP('FOO', "\<C-r>=MyFoonction()\<CR>", 'tex') +< where MyFoonction is a custom function you have written. If + MyFoonction also has to return a string containing <++> characters, + then you will need to use the function IMAP_PutTextWithMovement(). An + example best explains the usage: + + > + call IMAP('FOO', "\<C-r>=AskVimFunc()\<CR>", 'vim') + " Askvimfunc: Asks For Function Name And Sets Up Template + " Description: + function! AskVimFunc() + let name = input('Name of the function : ') + if name == '' + let name = "<+Function Name+>" + end + let islocal = input('Is this function scriptlocal ? [y]/n : ', 'y') + if islocal == 'y' + let sidstr = '<SID>' + else + let sidstr = '' + endif + return IMAP_PutTextWithMovement( + \ "\" ".name.": <+short description+> \<cr>" . + \ "Description: <+long description+>\<cr>" . + \ "\<C-u>function! ".name."(<+arguments+>)<++>\<cr>" . + \ "<+function body+>\<cr>" . + \ "endfunction \" " + \ ) + endfunction +< + + +ft The file type for which this mapping is active. When this string is + left empty, the mapping applies for all file-types. A filetype + specific mapping will always take precedence. + + +phs, phe If you prefer to write the rhs with characters other than <+ and +> to + denote place-holders, you can use the last 2 arguments to specify + which characters in the rhs specify place-holders. By default, these + are <+ and +> respectively. + + Note that the phs and phe arguments do not control what characters + will be displayed for the placeholders when the mapping is actually + triggered. What characters are used to display place-holders when you + trigger an IMAP are controlled by the Imap_PlaceHolderStart + [|ls_a_cV|] and Imap_PlaceHolderEnd [|ls_a_er|] settings. + + + +================================================================================ +Package Handling *ls_4* *ls_a_bJ* + *latex-packages* + +|ls_4_1| Inserting package commands +|ls_4_2| Actions taken for supported packages +|ls_4_3| Automatic Package detection +|ls_4_4| Writing supporting for a package + + +Latex-Suite has a lot of functionality written to ease working with packages. +Packages here refers to files which you include into the LaTeX document using +the \usepackage command. + + +-------------------------------------------------------------------------------- +Inserting package commands *ls_4_1* *ls_a_bK* + *inserting-packages* + +When you first invoke Latex-Suite, it scans the +$VIM/ftplugin/latex-suite/packages directory for package script files and +creates a menu from all the files found there. This menu is created under +TeX-Suite > Packages > Supported. This menu contains a list of packages +"supported" by Latex-Suite. When you choose one of the packages from this menu +(for example the amsmath package), then a line of the form > + \usepackage[<++>]{amsmath}<++> +will be inserted into the current file. + +The \usepackage line can also be inserted in an easy manner in the current file +by pressing <F5> while in the preamble of the current document. This will set up +a prompt from the supported packages and ask you to choose from one of them. If +you do not find the package you want to insert in the list, you can type in a +package-name and it will use that. Pressing <F5> in the preamble on a line +containing a single word will construct a \usepackage line from that word. + +You can also use the TPackage [|ls_a_cD|] to insert the \usepackage line. + +Once you have inserted a \usepackage line, for supported packages, you can use +the Options and Commands menus described in the next section [|ls_a_bL|]. + +-------------------------------------------------------------------------------- +Actions taken for supported packages *ls_4_2* *ls_a_bL* + *package-actions* + +Latex-Suite takes the following actions for packages detected when a file is +loaded, or a new \usepackage line is inserted using one of the methods described +in the previous section [|ls_a_bK|]. + +If you are using the GUI and you have g:Tex_Menus [|ls_a_dI|] set to 1, +Latex-Suite will create the following sub-menus +TeX-Suite > Packages > <package> Options + +TeX-Suite > Packages > <package> Commands + +where <package> is the package you just inserted (or was detected). You can use +these menus to insert commands, environments and options which Latex-Suite +recognizes as belonging to this package. + +NOTE: While inserting an option, you need to position yourself in the + appropriate place in the document, most commonly inside the square braces + in the \usepackage[]{packname} command. Latex-Suite will not navigate to + that location. + + +In addition to creating these sub-menus, Latex-Suite will also scan the +$VIM/ftplugin/latex-suite/dictionaries directory and if a dictionary file +corresponding to the package file is found, then it will add the file to the +'dict' setting in Vim so you can use the <C-X><C-K> command to complete words +from that file. + +For example, the SIUnits package has a custom dictionary. + + *latex-package-scanning* *ls_a_eb* +If a package detected at startup is found by Latex-Suite in the current +directory or in a location specified by the g:Tex_TEXINPUTS [|ls_a_dT|] +variable, Latex-Suite will scan the package for \newenvironment and newcommand +lines and also append any commands and environments found to the list of +commands and environments which you are prompted with when you press <F5> +[|ls_a_bh|] or <F7> [|ls_a_dW|] in insert mode. +In addition, the TeX-Suite > Packages menu also contains the following submenus + +Update +------ +This command is to be invoked with the cursor placed on the package name. If the +corresponding package is found, then a sub-menu with the supported commands and +options is created. + +Update All +---------- +This function reads the preamble of the document for \usepackage lines and if +Latex-Suite supports the detected packages, then sub-menus containing the +package options and commands are created. + + +-------------------------------------------------------------------------------- +Automatic Package detection *ls_4_3* *ls_a_bM* + *automatic-package-detection* + +Whenever Latex-Suite begins editing a new LaTeX file, it scans it for +\usepackage{name} lines, and if a supported package is found, then it will +create sub-menus and add to the 'dict' setting as described above. + +If a master-file [|ls_a_ct|] has been specified, then it will scan that file +instead of the current file. See the section Custom Packages [|ls_a_bN|] to see +which files Latex-Suite will scan in more detail. + +For all the packages detected in this manner, Latex-Suite will take certain +actions as described in the section package support. [|ls_a_bL|]. + + + +Custom Packages *ls_4_3_1* *ls_a_bN* + *custom-packages* + +Often times, the preamble can become too long, and some people prefer to put +most of their personalization in a custom package and include that using a +\usepackage line. Latex-Suite tries to search such customs package for other +\usepackage lines, so that supported packages included in this indirect manner +can also be used to create sub-menus, extend the 'dict' setting etc. The most +obvious place to place such custom packages is in the same directory as the +edited file. In addition, LaTeX also supports placing custom packages in places +pointed to by the $TEXINPUTS environment variable. + +If you use the $TEXINPUTS variable in LaTeX, and you wish Latex-Suite to search +these custom packages for \usepackage lines, then you need to initialize the +g:Tex_TEXINPUTS [|ls_a_dT|] variable. + +The g:Tex_TEXINPUTS variable needs to be set in the same format which Vim uses +for the 'path' setting. This format is explained in detail if you do > + :help file-searching +from within Vim. + +Therefore the value of g:Tex_TEXINPUTS will most probably be different from +$TEXINPUTS which your native LaTeX distribution uses. + +Example: > + let g:Tex_TEXINPUTS = '~/texmf/mypackages/**,./**' +The ** indicates that all directories below the directory ~/texmf/mypackages and +./ are to be scanned for custom packages. + +NOTE: The present directory '.' is always searched. You need not include that in + g:Tex_TEXINPUTS. + + + +-------------------------------------------------------------------------------- +Writing supporting for a package *ls_4_4* *ls_a_bO* + *supporting-packages* + +Supporting a package is easy and consists of writing a vim script with the same +name as the package and placing it in the $VIM/ftplugin/latex-suite/packages +directory. A package script should define two variables as described in the next +two sections. In addition to these two variables, you can also define any +functions, environment definitions etc. in this file. + + + +g:Tex_package_option_<package> *ls_4_4_1* *ls_a_bP* + +This setting is a string containing a comma separated list of options supported +by this package. + +Example: > + g:Tex_package_option_mypack = 'opt1,opt2=,sbr:group1,opt3,opt4' +The = suffix means that the option takes a value. Use sbr:group name to separate +options into sub-menus. All successive options will be clubbed into the group1 +sub-menu till the next sbr: option is encountered. + + +g:Tex_package_<package> *ls_4_4_2* *ls_a_bQ* + + > + + g:TeX_package_<package> = "pre:Command,pre:Command1" + More detailed example is in latex-suite/packages/exmpl file (slightly + outdated). + Here is short summary of prefixes which can be used in package files: + (x - place with cursor, <++> - |placeholder|) + + {env:command} Environment: creates simple environment template + \begin{command} + x + \end{command}<++> + {eno:command} Environment with option: + \begin[x]{command} + <++> + \end{command}<++> + {ens:command[<<option>>]...} Environment special: + \begin[<<option>>]...{command} + <++> + \end{command}<++> + {bra:command} Brackets: + \command{x}<++> + {brd:command} Brackets double: + \command{x}{<++>}<++> + {brs:command[<<option>>]...} Brackets special (as environment special: + \command[<+x+>]{<++>}{<++>}<++> + {nor:command} Normal: + \command<Space + {noo:command} Normal with option: + \command[x]<++> + {nob:command} Normal with option and brackets: + \command[x]{<++>}<++> + {pla:command} Plain: + command<Space + {spe:command} Special: + command <-literal insertion of command + {sep:command} creates separator. Good for aesthetics and usability :) + {sbr:command} Breaks menu into submenus. <command> will be title of submenu. + Can be used also in package variable. + + Command can be also given without prefix:. The result is + \command + + + +================================================================================ +Latex Completion *ls_5* *ls_a_bR* + *latex-completion* + +|ls_5_1| Latex-Suite completion example +|ls_5_2| Latex-Suite \ref completion +|ls_5_3| Latex-Suite \cite completion +|ls_5_4| Latex-Suite filename completion +|ls_5_5| Custom command completion + + +Latex-Suite provides an easy way to insert references to labels and +bibliographic entries and also provide filename arguments to commands such as +\includegraphics. Although the completion capabilities are very diverse, +Latex-Suite only uses a single key (<F9> by default) to do all of it. Pressing +the <F9> key does different things based on where you are located. Latex-Suite +tries to guess what you might be trying to complete at the location where you +pressed <F9>. For example, pressing <F9> when you are within a \ref command will +try to list the \label's in the present directory. Pressing it when you are in a +\cite command will list bibliography keys. Latex-Suite also recognizes commands +which need a file name argument and will put up an explorer window for you to +choose a filename. + + *ls-set-grepprg* *ls_a_eG* +NOTE: Before you start with Latex-Suite's completion function... + ---------------------------------------------------------- + All of Latex-Suite's completion capabilities depend on a external program + being available on your system which can search through a number of files + for a reg-exp pattern. On *nix systems, the pre-installed grep utility is + more than adequate. Most windows systems come with a utility findstr, but + that has proven to be very inadequate (for one, it does not have an option + to force the file name to be displayed when searching through a single + file). Your best bet is to install cygwin |ls_u_3|, but if you think + that's overkill, you can search for |ls_u_4| a windows implementation of + GNU grep. (Latex-Suite testing on windows has been done with cygwin's port + of GNU grep). + + Once you have a grep program installed, you need to set the 'grepprg' + option for vim. Make sure you use a setting which forces the program to + display file names even when you are searching through a single file. For + GNU grep, the syntax is > + set grepprg=grep\ -nH\ $* +< + + + +-------------------------------------------------------------------------------- +Latex-Suite completion example *ls_5_1* *ls_a_bS* + *ls-completion-usage* + +Consider the situation where you are editing a file with two equations labelled +eqn:euler and eqn:einstein. Now you want to insert a reference to one of these +equations. To do this, you type the \ref{eqn:} command and with the cursor +placed after eqn:, press <F9>. This will bring up two new windows beneath the +main window you were working in as shown in the figure below. > + + 8 These are a couple of equations: + 9 +-- 4 lines: eqnarray (eqn:euler) : e^{j\pi} + 1 &=& 0--------------- + 13 +-- 4 lines: equation (eqn:einstein) : E = m c^2--------------------- + 17 + 18 These are a couple of figures: + 19 +-- 7 lines: figure (fig:monkeys) : Monkeys can Type------------------- + 26 +-- 7 lines: figure (fig:shakespeare) : Shakespeare could not type----- + 33 + 34 This is a reference to \ref{eqn:}<++> + 35 + 36 + 37 \end{document} + 38 + ~ + ~ + ~ + newfile.tex 34,32 Bot + newfile.tex|11| \label{eqn:euler} + newfile.tex|15| \label{eqn:einstein} + ~ + [Error List] 1,1 All + 7 + 8 These are a couple of equations: + 9 \begin{eqnarray} + 10 e^{j\pi} + 1 &=& 0 + 11 \label{eqn:euler} + 12 \end{eqnarray} + 13 \begin{equation} + 14 E = m c^2 + 15 \label{eqn:einstein} + 16 \end{equation} + newfile.tex [Preview] 11,3 21% + + + +The first window (shown as [ErrorList] above) is a |cwindow| containing a list +of possible matches for the reference. The cursor will be located in the first +line of this window. The bottom window is a preview-window showing the context +of the \label. Moving around in the [ErrorList] window automatically scrolls the +preview window so as to always keep showing the context of the \label being +viewed in the [ErrorList] window. You can also press J and K in the [ErrorList] +window to scroll the preview window up and down. + +To insert one of the labels, simply position the cursor in the correct line in +the [ErrorList] window and press <enter>. This will immediately close the two +newly opened windows, get back to the correct location in the original file +being edited and insert the label into the \ref command. + +If you notice carefully in the example above, the [ErrorList] window only showed +the matches for the equations and did not list any of the figure labels. This is +because we pressed <F9> after \ref{eqn: instead of simply after \ref{. This +caused Latex-Suite to search only for those labels which started with the string +eqn:. If you had pressed <F9> after a \ref{, you would have been shown matches +from _all_ labels, not just those starting with eqn:. + +Thus prefixing all your labels with eqn:, fig:, tab: etc. depending on what you +are labelling will lead to an easier time completing references. + +-------------------------------------------------------------------------------- +Latex-Suite \ref completion *ls_5_2* *ls_a_bT* + *ls-completion-ref* + +Pressing <F9> when you are within a partially completed \ref command will split +open a window (named __OUTLINE__) which contains a nicely formatted list of all +the \labels found in the present project. The \labels are heirarchically +arranged according to which \section, \subsection etc of the overall document +structure they are present in. For example, when you first press <F9> after +typing \ref{, you should see something like: > + + +-- 54 lines: 2. Kinematics-------------------------------- + +-- 98 lines: 3. Aerodynamics of the MFI thorax------------ + +-- 40 lines: 4. Jump Resonance in Fourbar Mechanisms------ + +-- 28 lines: 5. Design and Fabrication Issues------------- + +Each chapter is |fold|ed away so that you can quickly jump to the correct +section/subsection in which the relevant equation is defined. This makes +inserting references significantly faster for large projects with hundreds of +equations. You can then open some of the folds to see for example: > + + +-- 54 lines: 2. Kinematics-------------------------------- + 3. Aerodynamics of the MFI thorax + 3.1. Aerodynamic modeling of the MFI wing forces + 3.1.1. Geometric Specification + eqn:wingnormal-pos + \nhat = T_z(\theta_2) T_y(\theta_y)T_x(\theta_x)\nhat_0, + eqn:T-1 + T_1(\theta_2) &=& T_z(\theta_2) + +The <Tab> key is mapped in this window to toggle folds so that you can quickly +open/close folds in order to navigate the heirarchy faster. Once you are +positioned on a label, press <Enter>. This closes the __OUTLINE__ window, +returns to the window in which you pressed <F9> and inserts the reference at the +current cursor position. + +NOTE: Filtering labels by prefix + -------------------------- + You can press <F9> after typing part of the \label. In this case, + Latex-Suite only presents \labels which begin with the already filled + characters. You can use this to choose between equations, figures, tables + etc. if you consistently label equations to begin with eqn:, figures to + begin with fig: etc. For example, with this scheme, pressing <F9> after + typing \ref{eqn: will only list equations. + + +NOTE: Latex-Suite works the same way if you press <F9> after any command which + contains the letters ref. Thus you can complete \eqref in exactly the same + manner. + + +NOTE: Requirements + ------------ + This method of preseting the \labels depends on Vim being compiled with + python support. To check if you have this, see the output of the :ver + command. If you see something like +python, you are all set. Failing this, + you will need to have python somewhere in your $PATH. + + + +-------------------------------------------------------------------------------- +Latex-Suite \cite completion *ls_5_3* *ls_a_bU* + *latex-completion-cite* + +Latex-Suite provides an easy way to insert references to bibliographic entries. +Pressing <F9> when the cursor is placed inside a partially completed \cite +command will split open a new window (named __OUTLINE__) which contains a +formatted and syntax highlighted list of all bibtex entries found. For example, +pressing <F9> after typing \ref{ should present you with a window which looks +something like this: > + + Article [dickinson:science:99] + "Wing rotation and aerodynamic basis of insect flight" + M. H. Dickinson and F-O. Lehman and S. P. Sane + In Science, 1999 + + Article [ellington:84:part1] + "The Aerodynamics of Hovering Insect Flight. I. The Quasi-Steady Analysis" + Ellington, C P + In Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences, 1984 + + Article [ellington:84:part2] + "The Aerodynamics of Hovering Insect Flight. II. Morphological Parameters" + Ellington, C P + In Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences, 1984 + + + +You can easily jump from one entry to another using the 'n' and 'p' keys (to go +to the next / previous entry respectively). + +You can also filter out a subset of the bibtex entries by pressing 'f' while in +this window. Doing this presents the following prompt: > + + Field acronyms: (`:let g:Tex_EchoBibFields = 0` to avoid this message) + [t] title [a] author [b] booktitle + [j] journal [y] year [p] bibtype + (you can also enter the complete field name) + Enter filter criterion [field<space>value]: + +At the prompt, type > + a ellington +Notice that the letter a is an acronym for author according to the prompt above. +Therefore this filter only shows those bibtex entries whose author field +contains the text ellington. You can keep narrowing your selection by repeatedly +filtering the results. If you would like to remove all the filters and see all +entries again, press 'a', which removes all the filters. + +You can also sort the bibtex entries based on a field. To do this, press 's'. +This will present you with a prompt like in the case of the filter and you are +asked to choose a field. In this case, you would type in a single character. +This sorts the entries according to that field. + +NOTE: <F9> will also work in a similar way after any command which contains the + word cite in it. For example, pressing <F9> will also work with \citenum + etc. + + +The following logic is applied to find out which bibliographic entries are +included in the completion. + + +1. Firstly, if the present file has a master-file [|ls_a_ct|] defined for it, + then Latex-Suite will perform the following steps on that file instead of on + the current file. + +2. First, the file is scanned for a \bibliography command. To explain better, + assume that a command > + \bibliography{file1,file2} +< is found in the present file. For each bibliography file, say file1, + Latex-Suite first tries to see if a .bib file, file1.bib can be found. If so, + it will scan it for bib-keys of the form @BOOK{ etc., and add these searches + to the completion list. If a .bib file cannot be found, then it will try to + see if file1.bbl can be found. If so, Latex-Suite will search it for bib-keys + of the form \bibitem and add these to the completion list. + + You can set the location where Latex-Suite will search for .bib and .bbl + files using the |Tex_BIBINPUTS| [|ls_a_dr|] variable. + +3. If a \bibliography command is not found, then Latex-Suite tries to scan the + present file for a \begin{thebibliography} environment. If found, Latex-Suite + searches the present file for bib-keys of the form \bibitem. + +4. Finally, it will try to see if this file includes other files via the \input + command. For each such file found, Latex-Suite will repeat the previous two + steps stopping at the first file which has either a \bibliography command or + a thebibliography environment. + + +Caching the \cite completion results *ls_5_3_1* *ls_a_bV* + *cite-search-caching* + + *TClearCiteHist* *ls_a_ec* +Often times, the editing cycle proceeds by first laying out a comprehensive +bibliography and then completing all the \cite commands in one session. In such +situations, it is inefficient to scan the whole list of bibliography files for +bib-keys each time. Latex-Suite provides a way to cache the results of the cite +completion search using the Tex_RememberCiteSearch [|ls_a_du|] variable. If set, +Latex-Suite will perform the search only the first time <F9> is used. Next time +on, it will reuse the search results. If you wish to redo the search results, +issue the command > + TClearCiteHist +This will redo the completion list next time you use <F9>. + +-------------------------------------------------------------------------------- +Latex-Suite filename completion *ls_5_4* *ls_a_bW* + *ls-filename-completion* + +When you press <F9> at a location where Latex-Suite guesses a filename needs to +be typed, then a new explorer window will open up with the list of files. You +can use this window to change directories etc. Pressing <enter> on a filename in +the explorer window will automatically close the explorer window, return to the +location where you pressed <F9> from and insert the filename into that position. + +Latex-Suite also tries to guess what kinds of files you might not want to insert +and hides those accordingly. For example, if you press <F9> when you are located +at \includegraphics{, then Latex-Suite knows that you will not want to insert +.tex files. Therefore, the explorer window will automatically hide these files. + +As of now, Latex-Suite recognizes the following commands for filename +completion. Along with the commands, this table also lists the files which +Latex-Suite will not show for completing each command. + +command hide pattern~ +\bibliography '^\.,\.[^b]..$' +\include \includeonly '^\.,\.[^t]..$' +\includegraphics \psfig '^\.,\.tex$,\.bib$,\.bbl$,\.zip$,\.gz$' +\input '' + +-------------------------------------------------------------------------------- +Custom command completion *ls_5_5* *ls_a_bX* + *ls-completion-custom* + +Latex-Suite also recognizes certain commonly used LaTeX commands for the <F9> +key. At the moment, the \bibliographystyle, \addtocontents and the +\addcontentsline commands are recognized, although more will be added in the +future. When you press the <F9> after such a command, Latex-Suite will prompt +you with a list of arguments which make sense for the command. + +This functionality is available for commands for which a global variable of the +form g:Tex_completion_{<command>} is defined where <command> is the command +name. This variable is a comma separated list of values which this command +takes. For example, the argument to the \bibliographystyle command is commonly +one of abbr,alpha,plain,unsrt. Therefore, Latex-Suite defines > + let g:Tex_completion_bibliographystyle = 'abbr,alpha,plain,unsrt' +You can define your own completion variables in a similar manner for commands +which you might use. + +================================================================================ +LaTeX Compiling *ls_6* *ls_a_bY* + *latex-compiling* + +|ls_6_1| Setting Compilation rules +|ls_6_2| Handling dependencies in compilation +|ls_6_3| Compiling multiple times +|ls_6_4| Customizing the compiler output +|ls_6_5| Compiling parts of a file + + +This functionality, available via the TeX-Suite menu, provides various tools to +compile and debug LaTeX files from within Vim. + +If you are using commonly used LaTeX tools, then you should be all set as soon +as you download and install Latex-Suite. In order to compile a LaTeX file, +simply press \ll while editing the file. This runs latex on the current file and +displays the errors in a |quickfix-window| below the file being edited. You can +then scroll through the errors and press <enter> to be taken to the location of +the corresponding error. Along with the errors being listed in the quickfix +window, the corresponding log file is also opened in |preview| mode beneath the +quickfix window. It is scrolled automatically to keep in sync with the error +being viewed in the quickfix window. You will be automatically taken to the +location of the first error/warning unless you set the g:Tex_GotoError +[|ls_a_dD|] variable to 0. + +Latex-Suite also supports compiling LaTeX into formats other than DVI. By +default, Latex-Suite supports PDF and PS formats. In order to choose a format +other than DVI, use the TTarget command or the TeX-Suite > Target Format menu +item. This will ask you to type in the name of the target format you want to +compile to. If a rule has been defined for the format (as described in the next +section [|ls_a_bZ|]), then Latex-Suite will switch to that format. + +Trying to choose a format for which no rule has been defined will result in +Latex-Suite displaying a warning message without taking any action. + +If you are using a multiple file project and need to compile a master file while +editing other files, then Latex-Suite provides a way to specify the file to be +compiled as described in latex-master-file [|ls_a_ct|]. + + +-------------------------------------------------------------------------------- +Setting Compilation rules *ls_6_1* *ls_a_bZ* + *compiler-rules* + +In order to compile LaTeX files into various formats, Latex-Suite needs to know +which external programs to call and in which way they need to be called. This +information is provided to Latex-Suite via a number of "rules". For each format +you want to compile to, you need to specify a rule. A rule is specified by +defining a variable of the form: > + g:Tex_CompileRule_<format> +where <format> is a string like "pdf", "dvi" etc. + +Example: By default, Latex-Suite uses the following rule for compiling LaTeX +documents into DVI. > + g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*' + + +Default values are also provided for ps and pdf formats. You might want to +change these rules in texrc according to your local tex environment. + +NOTE: For win32 users user MikTeX, sometimes the latex compiler's output has a + bug where a single number is split across different lines. In this case, + put the included vim-latex file distributed with Latex-Suite. + + + +-------------------------------------------------------------------------------- +Handling dependencies in compilation *ls_6_2* *ls_a_ca* + *compiler-dependency* + +Latex-Suite also handles compiling dependencies automatically via certain rules +which specify the "dependency chain" for each target format. For example, if in +your case, you use > + .tex -> .dvi -> .ps -> .pdf +to generate pdf files from dvi files, then you will need to specify the +following setting in your Latex-Suite configuration (see customizing Latex-Suite +[|ls_a_cP|] for where these settings should go): > + + let g:Tex_FormatDependency_pdf = 'dvi,ps,pdf' + +This is a comma separated string of formats specifying the order in which the +formats to be compiled into should be chosen. With this setting, if you set the +target format to pdf, then the next time you compile via the \ll shortcut, +Latex-Suite will first generate a dvi file, then use that to generate the ps +file and finally create the pdf file from that. + +NOTE: If any of the intermediate formats is listed in the + g:Tex_MultipleCompileFormats setting as described in the section Compiling + multiple times [|ls_a_cb|], then Latex-Suite might make multiple calls to + the compiler to generate the output file of that format. + + +Along with the g:Tex_FormatDependency_{format} setting, you should ofcourse +specify the rule for compiling to each of the formats as described in the +previous section [|ls_a_bZ|]. For example, with the setting above, you could +use: > + + let g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*' + let g:Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi' + let g:Tex_CompileRule_pdf = 'ps2pdf $*.ps' + + +NOTE: By default, Latex-Suite does not specify any compiler dependencies. Each + target format for which a rule has been derived will be compiled + independently. + + + +-------------------------------------------------------------------------------- +Compiling multiple times *ls_6_3* *ls_a_cb* + *compiling-multiple* + +Most LaTeX compilers need to be re-run several times in several commonly +occurring situations in order to get a final camera ready copy. For example, +when \label's change, when new \cite commands are added etc. If the target +format you are compiling to requires multiple compilations, then you will need +to include the format in the g:Tex_MultipleCompileFormats setting. This is a +comma separated string of formats which need multiple compilations to be +generated correctly. + +By default, this setting contains just the dvi format. If you use the pdflatex +compiler to generate pdf files, then you might want to also include pdf into the +above setting. + +For every format included in the g:Tex_MultipleCompileFormats setting described +above, Latex-Suite will use the following logic to generate the file. Note that +although the following description uses latex to refer to the compiler, it could +be some other compiler such as pdflatex for generating pdf output. + +1. If there was a .idx file, then remember its contents. + +2. Run latex. + +3. If the .idx file changed due to the latex compiler, then run makeindex to + redo the .ind file and then remember to rerun latex. + +4. If the .aux file generated by the latex compiler contains a \bibdata line, + then it means that we are using a .bib file. Therefore, run bibtex. + + NOTE: This means that we will always run bibtex whenever we use the + \bibliography command whether or not we actually need to. At this time, + Latex-Suite does not parse the .aux file before and after the latex + compiler to see if we are required to rerun bibtex. + +5. If the .bbl file changes because of this, then remember to rerun latex again. + +6. Also, we check to see if the LaTeX compiler gives certain standard warnings + which notify that we need to compile once again. In this case also, remember + to rerun LaTeX. + +7. If we found we had to rerun latex, then we repeat the steps above but not + running makeindex or bibtex again. + +The LaTeX file is compiled atmost 5 times using this logic. These steps will +ensure that on most platforms/environments, you will get a clean output with all +the cross-references, citations etc correctly labelled and ordered. + +-------------------------------------------------------------------------------- +Customizing the compiler output *ls_6_4* *ls_a_cc* + *compiler-output-customization* + +Most LaTeX compilers produce a very large amount of output during compilation, +most of which is not relevant to debugging type-setting errors. The compiler +plugin provided with Latex-Suite (which is an enhanced version of the standard +compiler plugin maintained by Artem Chuprina), provides a way to filter the +compiler output so that the actual errors/warnings can be presented much more +concisely. + +The compiler plugin is set up by default to function in a "non-verbose", +"ignore-common-warnings" mode, which means that irrelevant lines from the +compiler output will be ignored and some very common warnings are also ignored. +Latex-Suite does this via the global variable g:Tex_IgnoredWarnings [|ls_a_dA|]. +This is a list of patterns, which can be used to filter out (or ignore) some or +the warnings and errors reported by the compiler. See the link above for its +default value. + +Latex-Suite uses the g:Tex_IgnoreLevel [|ls_a_dB|] setting to set a default +ignore level. For example, for the default value of 4, Latex-Suite ignores +warnings and errors matching the first 4 patterns in g:Tex_IgnoredWarnings. + +In addition to setting a default value of the ignore level, Latex-Suite provides +the ability to set the level dynamically, using the TCLevel command. For +example, if you issue the command: > + TCLevel 3 +from within Vim, then the next time you compile the document, Latex-Suite will +ignore warnings and errors which match the first three patterns in +g:Tex_IgnoredWarnings. + +When TCLevel is called with the unquoted string strict as follows: > + TClevel strict +then Latex-Suite switches to a "verbose", "no-lines-ignored" mode which is +useful when you want to make final checks of your document and want to be +careful not to let things slip by. + +See the explanation of the settings g:Tex_IgnoredWarnings [|ls_a_dA|] and +g:Tex_IgnoreLevel [|ls_a_dB|] to find out how to customize the filtering done by +Latex-Suite + +-------------------------------------------------------------------------------- +Compiling parts of a file *ls_6_5* *ls_a_cd* + *part-compiling* + +Latex-Suite also provides a way to compile a fragment of a document. This can be +very useful while debugging a complex equation or one chapter in a book, etc. + +To do this, visually select a portion of the text and press \ll while in visual +mode. The visually selected portion will be saved to a temporary file with the +preamble from the current document prepended. Latex-Suite will then switch focus +to this temporary file and compile it. Continue to debug this file as required +and then replace the portion of the original file with this one. + +Pressing \lv while viewing the temporary file will view the output file +generated from the temporary file, not the original file + +Two commands |TPartComp| and |TPartView| are provided to be able to get this +functionality via the command line. + +From release 1.6 onwards of Latex-Suite, the temporary file created for part +compilation will reside in the same directory as the file from which the +fragment is being created. This ensures that any relative path-names defined in +the fragment will still work. Latex-Suite will attempt to clean the temporary +file(s) created when Vim exits. + +================================================================================ +Latex Viewing and Searching *ls_7* *ls_a_ce* + *latex-viewing* + +|ls_7_1| Setting Viewing rules +|ls_7_2| Forward Searching DVI documents +|ls_7_3| Inverse Searching + + + +-------------------------------------------------------------------------------- +Setting Viewing rules *ls_7_1* *ls_a_cf* + *latex-viewing-rules* + +In order to view the output files created by compiling the source files, you +need to specify which external program Latex-Suite should call. You can specify +the external program using one of two settings Tex_ViewRule_format [|ls_a_dF|] +or Tex_ViewRuleComplete_format [|ls_a_dG|]. By default, Latex-Suite has default +settings for viewing various common output formats via the Tex_ViewRule_format +settings, so that if you are using commonly used programs, you should be all set +to view compiled files from within Vim by simply pressing \lv. + +NOTE: The viewing function also takes the *.latexmain [|ls_a_ct|] file into + account to decide which file to show. + + +If pressing \lv does not work, then it most probably has to do with incorrect +settings of the g:Tex_ViewRule_<format> [|ls_a_dF|] where <format> is the format +you are attempting to view. See the link above for how to set this according to +your system. + +In addition to viewing the files, Latex-Suite also supports forward and inverse +searching for certain common tools for viewing DVI documents. At the moment, +there is built-in support for YAP on windows (which ships with MikTeX), and the +popular xdvi on *nix platforms. See the next few sections for details on forward +and inverse searching. + +-------------------------------------------------------------------------------- +Forward Searching DVI documents *ls_7_2* *ls_a_cg* + *forward-searching* + +Forward searching refers to making a DVI viewer display a given document at a +given location from within Vim. At present, this functionality is supported for +YAP on windows and xdvi on *nix machines. Pressing \ls from within Vim should +make the DVI viewer display the portion of the document where your cursor is +placed. + + *enabling-searching* *ls_a_ed* +NOTE: Enabling Forward and Inverse Searching + -------------------------------------- + Most DVI viewers need "source-special" information in order to do forward + (and inverse) searching. This information is embedded in the dvi file if + the LaTeX source is compiled with the --src-specials option. By default, + Latex-Suite does not supply this argument to the compiler. See the section + on to find out how this option can be set. + + + +-------------------------------------------------------------------------------- +Inverse Searching *ls_7_3* *ls_a_ch* + *inverse-searching* + +Inverse searching refers to the DVI viewer telling Vim to display the LaTeX +source file at a given location when you double-click in the DVI viewer window. + +You will need to enable searching [|ls_a_ed|] in order to use this +functionality. + +You will also need to specify certain settings to the DVI viewer conveying the +syntax which it needs to use to tell Vim how to display the source file. In YAP, +you can set this option in View > Options > Inverse Search. The Command Line +field needs to be set as follows: > + "C:\Program Files\vim\vim61\gvim" -c ":RemoteOpen +%l %f" +The command :RemoteOpen is supplied when you install Latex-Suite. + +On *nix machines, Latex-Suite attempts to call the DVI viewer in such a way that +it already knows how to communicate with Vim. If this does not seem to be +working, you can use the RemoteOpen command described above. + +================================================================================ +Latex Folding *ls_8* *ls_a_ci* + *latex-folding* + +|ls_8_1| Default Folding Scheme in Latex-Suite +|ls_8_2| Customizing what to fold +|ls_8_3| Editing the folding.vim file directly + + +Latex-Suite ships with the plugin SyntaxFolds.vim which is a plugin for creating +"fake" syntax folds on the fly. The fold method is actually manual but the +folding is based on LaTeX syntax. This offers a speed increase over regular +syntax folding. Ofcourse it has the disadvantage that the folds are not dynamic, +i.e newly created syntax items are not automatically folded up. (This is a +compromise between speed and convenience). + +When you open up a LaTeX file, all the portions will be automatically folded up. +However, no new folds will be created until you press <F6> or \rf. (rf stands +for "refresh folds"). + +The fold-text is set to the first line of the folded text unless the fold is a +table, figure etc. (an environment). In this case, if a \caption and/or a label +is found in the folded region, then those are used to make a more meaningful +fold-text, otherwise the second line of the environment is displayed along with +the name of the environment. In other words, the following > + \begin{figure}[h] + \centerline{\psfig{figure=slidercrank.eps,height=6cm}} + \caption{The Slider Crank Mechanism.} + \label{fig:slidercrank} + \end{figure} + % a LaTeX comment. + \begin{eqnarray} + \sin(\pi) = 0 + \end{eqnarray} + + +will be shown as: > + +--- 5 lines: figure (fig:slidercrank) : The Slider Crank Mechanism. ----- + % a LaTeX comment. + +--- 3 lines: eqnarray () : \sin(\pi) = 0 -------------------------------- + + + +-------------------------------------------------------------------------------- +Default Folding Scheme in Latex-Suite *ls_8_1* *ls_a_cj* + *default-folding* + +By default Latex-Suite creates folds in the following manner: + + > + \chapter + \section + %%fakesection + \subsection + \subsubsection + \item + \equation + \eqnarray + \figure + \table + \footnote +The indentation shows the "nestedness" of the folding scheme. See the next +section [|ls_a_ck|] to see how you can change this scheme. + +-------------------------------------------------------------------------------- +Customizing what to fold *ls_8_2* *ls_a_ck* + *customizing-what-to-fold* + +From version 1.6 onwards, the folding in Latex-Suite can be controlled to a +large extent via a number of global variables. + + + +Tex_FoldedSections *ls_8_2_1* *ls_a_cl* + *Tex_FoldedSections* + +This entry defines which sections will be folded. This setting is a comma +separated list of section names. The default value is: > + part,chapter,section,%%fakesection, + subsection,subsubsection,paragraph +Each of the entries in the list will fold up a section of the corresponding +name. The %%fakesection section is provided as a means for the user to group +lines into "fake" sections. A %%fakesection is assumed to start on a line which +begins with the string %%fakesection and continue till the start of the next +\section, \subsection or any other section. + +See also advanced fold settings [|ls_a_cp|]. + + +Tex_FoldedEnvironments *ls_8_2_2* *ls_a_cm* + *Tex_FoldedEnvironments* + +This entry defines which environments will be folded. It is a comma separated +string of words each of which defines a single environment. The default setting +is > + verbatim,comment,eq,gather, + align,figure,table,thebibliography, + keywords,abstract,titlepage +The words need not be standard Latex environments. You can add any word you +like. Also, each word will fold up all environments whose name begins with that +word. For example, in the setting above, the word "eq" folds up the +\begin{equation}, \begin{eqnarray}, \begin{eqnarray*} environments. To avoid +this, you can replace the word "eq" with "eq}". + +See also advanced fold settings [|ls_a_cp|]. + + +Tex_FoldedCommands *ls_8_2_3* *ls_a_cn* + *Tex_FoldedCommands* + +This entry defines which commands will be folded. It is a comma separated string +of words each of which defines a single command. The default setting is empty, +i.e no commands are folded. The words need not be standard Latex commands. You +can use whatever words you like. Each word will fold all commands whose name +begins with that word as in the case of the Tex_FoldedEnvironments [|ls_a_cm|] +variable. + +NOTE: It is very difficult to fold commands reliably because it is very + difficult to create a regexp which will match a line containing unmatched + parentheses (or curly brackets), but will not match a line containing + matched parentheses. + + Just to make things safer, only lines which start a command but do not + contain additional curly braces after the command has started are folded. + In other words, if you wanted to fold the the command "mycommand", then + the lines > + \mycommand{This is a line + and some more text on the next line + } +< will be folded, but the lines > + \mycommand{This is a \textbf{line} + and some more text + } +< will not be folded. This is a bug which is very difficult to fix. + + +See also advanced fold settings [|ls_a_cp|]. + + +Tex_FoldedMisc *ls_8_2_4* *ls_a_co* + *Tex_FoldedMisc* + +This entry defines fold syntax for certain items which do not naturally fit into +the section, environment of command lists. It is a comma separated list of +words. The default value is: > + item,preamble,<<< +NOTE: Unlike the other Tex_FoldedXXXX variables, the words in this setting are + limited to take values from the following list: + + Value Meaning~ + comments Folds up contiguous blocks of comments + item Folds up the \items within list environments + preamble Folds up the preamble of a document. (The part between the + \documentclass command and the \begin{document} environment) + <<< Folds defined manually by the user using the <<< and >>> strings + as fold-markers. + + Any other words in the Tex_FoldedMisc setting are silently ignored. + + + +See also advanced fold settings [|ls_a_cp|]. + + +Advanced Fold setting details *ls_8_2_5* *ls_a_cp* + *fold-setting-advanced* + +The order of the words in the Tex_FoldedXXXX variables is _important_. The order +defines the order in which the folds are nested. For example, the value +"subsection,section" for the Tex_FoldedSections variable will not fold any +subsections at all. This is because the folds are created in the _reverse_ order +in which they occur in the Tex_FoldedSections setting and also, once a fold is +created, the interior of the fold is not examined for creating additional folds. +In the above case, this means that a \section is folded first and then its +interior is not examined further. The correct value should have been +"section,subsection" + + *fold-setting-adding* *ls_a_ee* +Each of the fold setting variables Tex_FoldedSections, Tex_FoldedEnvironments +etc., as explained previously is a comma separated string of variables. However, +to make it easier to _add_ to the default settings without having to repeat the +whole default setting again, Latex-Suite uses the following logic in forming the +complete setting string from the Tex_FoldedXXXX variables. If the variable +starts with a comma, then Tex_FoldedXXXX is added to the end of the default +string rather than replacing it. Similarly, if it ends with a comma, then it +will be prepended to the beginning of the default setting rather than replacing +it. + +For example, if Tex_FoldedEnvironments is set to the string "myenv", then only +an environment of the form \begin{myenv} will be folded. However, if the +Tex_FoldedEnvironments setting is ",myenv", then the \begin{myenv} environment +will be folded after all other environments in the default setting have been +folded. On the other hand if Tex_FoldedEnvironments is of the form "myenv,", the +\begin{myenv} environment will be folded before the rest of the environments in +the default setting. + +-------------------------------------------------------------------------------- +Editing the folding.vim file directly *ls_8_3* *ls_a_cq* + *editing-folding* + +If you are using version 1.5 of Latex-Suite or older, you will need to directly +edit the $VIM/ftplugin/latex-suite/folding.vim file if you wish to modify the +folding scheme. You will need to modify the function MakeTexFolds() defined in +that file to modify the fold syntax. MakeTexFolds makes a number of calls to +AddSyntaxFoldItem. Each such call defines a new "fold item". The order in which +these calls are made defines how the folds are nested. For example, if you +desire an figure environment to be nested within a section, then you should +define the fold for the figure first. The syntax of AddSyntaxFoldItem is as +follows: > + AddSyntaxFoldItem(startpat, endpat, startoff, endoff [, startskip, endskip]) +If the last two arguments are omitted, then they are assumed to default to the +empty strings ''. The explanation for each argument is as follows: + +Argument Explanation~ +startpat a line matching this pattern defines the beginning of a fold. +endpat a line matching this pattern defines the end of a fold. +startoff this is the offset from the starting line at which folding will + actually start +endoff like startoff, but gives the offset of the actual fold end from the + line satisfying endpat. startoff and endoff are necessary when the + folding region does not have a specific end pattern corresponding to + a start pattern. for example in LaTeX, \section{Section Name} defines + the beginning of a section, but there is no command which + specifically ends a section. Thus a \section is assumed to end 1 line + _before_ another section starts. +startskip A Pattern Which Defines The Beginning Of A "Skipped" Region. + + For example, suppose we define a \itemize fold as follows: > + = '^\s*\\item', + = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + = 0, + = -1 +< + + This defines a fold which starts with a line beginning with an \item + and ending one line before a line beginning with an \item or + \end{enumerate} etc. + + Then, as long as \item's are not nested things are fine. However, + once items begin to nest, the fold started by one \item can end + because of an \item in an \itemize environment within this \item. + i.e, the following can happen: > + \begin{itemize} + \item Some text <------- fold will start here + This item will contain a nested item + \begin{itemize} <----- fold will end here because next line contains \item... + \item Hello + \end{itemize} <----- ... instead of here. + \item Next item of the parent itemize + \end{itemize} +< + + Therefore, in order to completely define a folding item which allows + nesting, we need to also define a "skip" pattern. startskip and end + skip do that. Leave '' when there is no nesting. +endskip the pattern which defines the end of the "skip" pattern for nested + folds. + +NOTE: Example 1 + --------- + A syntax fold region for the latex section is defined with the following + arguments to AddSyntaxFoldItem: > + startpat = "\\section{" + endpat = "\\section{" + startoff = 0 + endoff = -1 + startskip = '' + endskip = '' +< Note that the start and end patterns are thus the same and endoff has a + negative value to capture the effect of a section ending one line before + the next starts. + + +NOTE: Example 2 + --------- + A syntax fold region for the \itemize environment is: > + startpat = '^\s*\\item', + endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + startoff = 0, + endoff = -1, + startskip = '^\s*\\begin{\(enumerate\|itemize\|description\)}', + endskip = '^\s*\\end{\(enumerate\|itemize\|description\)}' +< Note the use of startskip and endskip to allow nesting. + + + +================================================================================ +Multiple file LaTeX projects *ls_9* *ls_a_cr* + *latex-project* + +|ls_9_1| Latex-Suite project settings +|ls_9_2| Specifying which file to compile + + + *latex-project-example* *ls_a_ef* +Many LaTeX projects contain multiple source files which are \included from a +master file. A typical example of this situation is a directory layout such as +the following + + > + thesis/ + main.tex + abstract.tex + intro/ + intro.tex + figures/ + fig1.eps + fig2.eps + chapter1/ + chap1.tex + figures/ + fig1.eps + conclusion/ + conclusion.tex + figures/ + + +In the above case, main.tex will typically look like + + > + % file: main.tex + \documentclass{report} + \begin{document} + + \input{abstract.tex} + \input{intro/intro.tex} + \input{chapter1/chap1.tex} + \input{conclusion/conclusion.tex} + + \end{document} + + + *latex-master-file-specification* *ls_a_eg* +In such situations, you will need to convey to Latex-Suite that main.tex is the +main file which \inputs the other files. This is done by creating a file called +main.tex.latexmain in the same directory in which main.tex resides. This file is +called the _master file_ in this manual. See Tex_MainFileExpression [|ls_a_eh|] +for an alternative way of specifying the master file. + +NOTE: Here main.tex.latexmain is (obviously) a different file from main.tex + itself. main.tex need not be renamed. This ofcourse restricts each + directory to have a single master file. + + +Each time Latex-Suite opens a new LaTeX file, it will try to see if it is part +of a multiple file project by searching upwards (to the root of the file-system) +from the current file's directory to see if it finds a file of the form +*.latexmain. If such a file is found, then it is considered that the current +file is part of a larger project. The name of the LaTeX master file is inferred +directly from the first part of the *.latexmain file as described in the example +above. + + +-------------------------------------------------------------------------------- +Latex-Suite project settings *ls_9_1* *ls_a_cs* + *latex-project-settings* + +If a master file [|ls_a_ct|] is found, then Latex-Suite :sources the file. Thus +this file needs to contain valid Vim commands. This file is typically used to +store project specific settings. + +Some typical per-project settings which are best put in the master file are +Tex_ProjectSourceFiles [|ls_a_dt|] + +-------------------------------------------------------------------------------- +Specifying which file to compile *ls_9_2* *ls_a_ct* + *latex-master-file* + +In the example described previously [|ls_a_ef|], if you are editing +intro/intro.tex and press \ll, then you still want Latex-Suite to compile +main.tex, because intro/intro.tex is merely a fragment which is \input'ed into +main.tex. If the master file is already specified using the *.latexmain +convention described previously [|ls_a_ef|], then Latex-Suite will automatically +compile the master file when you are editing any of its \input'ed fragments. +Thus pressing \ll while editing intro/intro.tex will compile main.tex. + + *Tex_MainFileExpression* *ls_a_eh* +If you wish to use some different logic to specify the main file name, you can +specify a custom expression via the Tex_MainFileExpression variable. This is a +string containing a valid vim expression. In addition, you can use a variable +modifier which is in the format used for |filename-modifiers|, for example, +':p:h'. You should utilize this variable to modify the filename of the main +file. > + let g:Tex_MainFileExpression = 'MainFile(modifier)' + function! MainFile(fmod) + if glob('*.latexmain') != '' + return fnamemodify(glob('*.latexmain'), a:fmod) + else + return '' + endif + endif + + +================================================================================ +Latex-Suite Commands and Maps *ls_10* *ls_a_cu* + *latex-suite-commands-maps* + +|ls_10_1| Latex-Suite Maps +|ls_10_2| Latex Suite Commands + + +This section describes the maps and commands used in Latex-Suite. It also +describes a way to change the map sequences according to your preference. + + +-------------------------------------------------------------------------------- +Latex-Suite Maps *ls_10_1* *ls_a_cv* + *latex-suite-maps* + + *remapping-latex-suite-keys* *ls_a_ei* +Most of the mappings used in Latex-Suite can be mapped to a different key +combination to suit your particular needs. An example best explains the +procedure for doing this. Suppose you want to remap the <C-j> key which +Latex-Suite (actually imaps.vim) uses to jump to the next placeholder. To do +this, you first need to find out which <Plug> mapping <C-j> is derived from. You +will need to look at the relevant section of this manual to do this. For +example, the section IMAP mappings [|ls_a_cw|] has the information that the +<C-j> key is derived from <Plug>IMAP_JumpForward. Therefore to remap the <C-j> +key to say <C-space>, you will need to put a statement like the following in +your ~/.vimrc. > + imap <C-space> <Plug>IMAP_JumpForward + + +NOTE: To change the IMAP mappings which affect jumping between placeholders, the + map statement above has to be placed in your ~/.vimrc. For other mappings + you can place the map statement in your $VIM/ftplugin/tex.vim file. The + reason for this is that the <C-j> maps are created in plugin/imaps.vim, + which is sourced as soon as Vim starts before sourcing any ftplugin files. + + + + +IMAP mappings *ls_10_1_1* *ls_a_cw* + *customize-imap-maps* + +These mappings are utilized for jumping between placeholders as described here +[|ls_a_eD|]. See the parent section [|ls_a_cv|] to find out how to use this +information to change the default maps. + + *Plug_IMAP_JumpForward* *ls_a_ej* + *Plug_IMAP_JumpBack* *ls_a_ek* + *Plug_IMAP_DeleteAndJumpForward* *ls_a_el* + *Plug_IMAP_DeleteAndJumBack* *ls_a_em* +Plug map Default Key~ +<Plug>IMAP_JumpForward <C-j> +<Plug>IMAP_JumpBack (none) +<Plug>IMAP_DeleteAndJumpForward (none) +<Plug>IMAP_DeleteAndJumpBack (none) + +<Plug>IMAP_JumpForward takes you to the location of the next place-holder +[|ls_a_eD|]. + +<Plug>IMAP_JumpBack takes you to the previous place-holder [|ls_a_eD|]. + +<Plug>IMAP_DeleteAndJumpForward deletes the presently selected place-holder and +jumps to the next place-holder irrespective of whether the present placeholder +is empty or not and ignoring the value of place-holder settings like +g:Imap_DeleteEmptyPlaceHolders [|ls_a_cW|] and g:Imap_StickyPlaceHolders +[|ls_a_cX|] + +<Plug>IMAP_DeleteAndJumpBack deletes the presently selected place-holder and +jumps to the previous place-holder irrespective of whether the present +placeholder is empty or not and ignoring the value of place-holder settings like +g:Imap_DeleteEmptyPlaceHolders [|ls_a_cW|] and g:Imap_StickyPlaceHolders +[|ls_a_cX|] + + +Alt-Key mappings *ls_10_1_2* *ls_a_cx* + *customize-alt-key-maps* + +These mappings are are described in the section Alt key macros [|ls_a_bA|]. See +the parent section [|ls_a_ei|] to see how to use the following information to +remap keys. + + *Plug_Tex_MathBF* *ls_a_en* + *Plug_Tex_MathCal* *ls_a_eo* + *Plug_Tex_LeftRight* *ls_a_ep* + *Plug_Tex_InsertItem* *ls_a_eq* +Plug Mapping Default Key~ +<Plug>Tex_MathBF <Alt-B> +<Plug>Tex_MathCal <Alt-C> +<Plug>Tex_LeftRight <Alt-L> +<Plug>Tex_InsertItem <Alt-I> + +-------------------------------------------------------------------------------- +Latex Suite Commands *ls_10_2* *ls_a_cy* + *latex-suite-commands* + + + +:TMacro [{macro}] *ls_10_2_1* *ls_a_cz* *TMacro* + +When used without any arguments lists all available macros defined in runtime +ftplugin/latex-suite/macros/ directories and prompts you to choose one of them. +With one argument |:read| this macro under cursor position. With more than one +argument it will not work :) In Vim >= 6.2 works completion of names of macros +(see 'wildmenu', 'wildmode' for more about command-line completion). + + +:TMacroEdit [{macro}] *ls_10_2_2* *ls_a_cA* + *TMacroEdit* + +Splits window for editing {macro}. When used without any arguments lists all +available macros defined in runtime ftplugin/latex-suite/macros/ directories and +prompt you to choose one of them. When you try to edit {macro} not from local +directory Latex-Suite will copy it to your local directory with suffix "-local". +If local copy already exists Latex-Suite prompt for overwriting it. In Vim >= +6.2 works completion of names of macros (see 'wildmenu', 'wildmode' for more +about command-line completion). + + +:TMacroNew *ls_10_2_3* *ls_a_cB* + *TMacroNew* + +Splits window to write new macro. Directory in new buffer is locally changed to +Latex-Suite/macros/. + + +:TMacroDelete [{macro}] *ls_10_2_4* *ls_a_cC* + *TMacroDelete* + +Delets {macro} from your local ftplugin/latex-suite/macros/ directory. When used +without any arguments lists all available macros defined in Latex-Suite/macros/ +directory and prompt you to choose one of them. When you choose to delete +{macro} which is not in your local directory Latex-Suite will refuse to delete +it. In Vim >= 6.2 works completion of names of macros (see 'wildmenu', +'wildmode' for more about command-line completion) + + +:TPackage [{package, ...}] *ls_10_2_5* *ls_a_cD* + *TPackage* + +When used without any arguments lists name of the packages for which support is +available. If you are using Vim GUI and have Tex_Menus set to 1, then it will +list all files found in the $VIM/ftplugin/latex-suite/packages directory. +Otherwise, Latex-Suite will list files found in the +$VIM/ftplugin/latex-suite/dictionaries directory. Choosing a file from the list +will insert a > + \usepackage[<++>]{<packname>} +line into the buffer at the current cursor location. For Vim 6.2 and above, you +can use command-line completion to choose a package file. You can also call +TPackage with one or more package names separated with spaces in which case, +Latex-Suite will insert \usepackage lines for each of them in turn. + +After inserting the \usepackage line(s), Latex-Suite will support it (them) in +various ways as described in the section Actions taken for supported packages +[|ls_a_bL|]. + + +:TPackageUpdate *ls_10_2_6* *ls_a_cE* + *TPackageUpdate* + +This command `reads' name of package under cursor and turns on possible support. + + +:TPackageUpdateAll *ls_10_2_7* *ls_a_cF* + *TPackageUpdateAll* + +After issuing this command latexSuite scans the file in looking for not declared +packages, removing not needed entries from Packages menu and turning off not +necessary packages' dictionaries. + + +:TTemplate [{template}] *ls_10_2_8* *ls_a_cG* + *TTemplate* + +When used without any arguments lists all available templates from +latex-suite/templates/ directory and prompts to choose one of them. With one +argument :0|read| {template} file. With more than one argument it will not work +:) In Vim >= 6.2 works completion of names of macros (see 'wildmenu', 'wildmode' +for more about command-line completion) + + +:TSection [{argument}] *ls_10_2_9* *ls_a_cH* + *TSection* + +Used without any arguments inserts last section type (|latex-sectioning|). +Accepts arguments: n> inserts section name in <n> logical level. Levels are: +0 part +1 chapter +2 section +3 subsection +4 subsubsection +5 paragraph +6 subparagraph + + ++<n> inserts section name <n> logical levels above the last used comand +-<n> inserts section name <n> logical levels below the last used comand ++ inserts section name one logical level below the last used command (equal + to +1). +++ inserts section name two logical levels below the last used command (equal + to +2). +- inserts section name one logical level over the last used command (equal + to -1). +-- inserts section name two logical levels over the last used command (equal + to -2). + + + +Command accepts also latexSuite mappings (|latex-macros|) without preceding S +and in lowercase: > + :TSection pa +will result in \part{}. It is possible to use full names of sections: :TSection +part + + +:TSectionAdvanced *ls_10_2_10* *ls_a_cI* + *TSectionAdvanced* + +Accepts the same arguments as |TSection| but leads to a couple of questions +(whether you want to include the section in the table of contents, whether there +is a shorter name for the table of contents) and then creates a more intelligent +template. + + +:TLook *ls_10_2_11* *ls_a_cJ* *TLook* + +Accepts one argument. Will look through .tex files in directory of edited file +for argument. It can be regexp. You don't have to enclose argument in "". <cr> +takes you to location. Other keys work as described in |latex-viewer|. Note: +TLook uses :grep command and is using 'grepprg'. Its regular expressions can be +different from those of Vim. + + +:TLookBib *ls_10_2_12* *ls_a_cK* + *TLookBib* + +Accepts one argument. Will look through .bib files in directory of edited file +for argument. It can be regexp. You don't have to enclose argument in "". <cr> +takes you to location. Other keys work as described in |latex-viewer|. + +NOTE: TLookBib uses :grep command and is using 'grepprg'. Its regular + expressions can be different from those of Vim. + + + + +:TLookAll *ls_10_2_13* *ls_a_cL* + *TLookAll* + +Accepts one argument. Will look through all files in directory of edited file +for argument. It can be regexp. You don't have to enclose argument in "". <cr> +takes you to location. Other keys work as described in |latex-viewer|. Note: +TLook uses :grep command and is using 'grepprg'. Its regular expressions can be +different from those of Vim. + + +:TPartComp *ls_10_2_14* *ls_a_cM* + *TPartComp* + +No argument allowed but accepts range in all formats. Define fragment of +interest with :'a,'b, :/a/,/b/, :'<,'> or :20,30. All other rules of compilation +apply. + + +:TPartView *ls_10_2_15* *ls_a_cN* + *TPartView* + +Show last compiled fragment. All rules of viewing apply but |latex-searching|. + + +:Tshortcuts [{arg}] *ls_10_2_16* *ls_a_cO* + *Tshortcuts* + +Show shortcuts in terminal (not using menu). Without {arg} you will see simple +menu prompting for one of them. Possible arguments: +g General shortcuts +e Environment shortcuts +f Font shortcuts +s Section shortcuts +m Math shortcuts +a All shortcuts + +================================================================================ +Customizing Latex-Suite *ls_11* *ls_a_cP* + *customizing-latex-suite* + +|ls_11_1| General Settings +|ls_11_2| Place-Holder Customization +|ls_11_3| Macro Customization +|ls_11_4| Smart Key Customization +|ls_11_5| Latex Completion Customization +|ls_11_6| Compiler Customization +|ls_11_7| Viewer Customization +|ls_11_8| Menu Customization +|ls_11_9| Folding Customization +|ls_11_10| Package Handling Customization + + +Customizing Latex-Suite is done by defining certain global variables in +$VIM/ftplugin/tex.vim, where $VIM corresponds to ~/.vim for *nix machines and +~/vimfiles for windows machines. This file is not part of the Latex-Suite +distribution. You will need to create this file yourself (or modify it if it +exists) if you need to change any default settings. Since this file is not +included as part of the Latex-Suite distribution, it will not be over-written in +subsequent updates. + +The default settings in Latex-Suite are defined in +$VIM/ftplugin/latex-suite/texrc. Please take a look at this file if you find +this documentation incomplete or confusing. That file is also well documented. + +This chapter describes the various settings which effect Latex-Suite and their +default values. The settings are broken up into sections according to the +behavior which they influence. + + +-------------------------------------------------------------------------------- +General Settings *ls_11_1* *ls_a_cQ* + *ls-general-purpose-settings* + + + +Tex_Debug *ls_11_1_1* *ls_a_cR* + *Tex_Debug* + +Type boolean +Default Value 0 + +If set to 1, then Latex-Suite will create certain global debug statements which +can be printed by doing > + :call Tex_PrintDebug() + + + +Tex_UsePython *ls_11_1_2* *ls_a_cS* + *Tex_UsePython* + +Type boolean +Default Value 1 + +If Latex-Suite detects that your vim is python enabled (using has('python')), +then it tries to use python in certain places to speed things up. If this +misbehaves, you can set this to zero, in which case, Latex-Suite will use +vimscript to accomplish the same. + +-------------------------------------------------------------------------------- +Place-Holder Customization *ls_11_2* *ls_a_cT* + *customizing-place-holders* + +Latex-Suite uses place-holders [|ls_a_eD|] to minimize using the movement keys +while typing. The following settings affect how place-holders are used. + +NOTE: These setting need to be set in your ~/.vimrc, not $VIM/ftplugin/tex.vim + because these settings affect the behavior of imaps.vim, which is a global + plugin, not a file-type plugin. + + + + +g:Imap_UsePlaceHolders *ls_11_2_1* *ls_a_cU* + *Imap_UsePlaceHolders* + + +Type Boolean +Default Value 1 + +Setting this to zero completely disables using place-holders. + + +g:Imap_PlaceHolderStart & g:Imap_PlaceHolderEnd *ls_11_2_2* *ls_a_cV* + *Imap_PlaceHolderStart* + + *Imap_PlaceHolderEnd* *ls_a_er* +Setting Type Value~ +Imap_PlaceHolderStart String '<+' +Imap_PlaceHolderEnd String '+>' + +These settings affect the strings displayed at the beginning and end of the +place-holder string. Set these strings to a value different than a commonly +occurring sequence of characters. + +NOTE: TIP + --- + If you use the latin1 encoding and do not type in french, then you can set + these strings to the \xab and \xbb characters (the french quotation + marks). + + + + +g:Imap_DeleteEmptyPlaceHolders *ls_11_2_3* *ls_a_cW* + *Imap_DeleteEmptyPlaceHolders* + + +Type Boolean +Default Value 1 + +When set to one, non-descriptive or empty place-holders are deleted on pressing +<Ctrl-J>. + + +g:Imap_StickyPlaceHolders *ls_11_2_4* *ls_a_cX* + *Imap_StickyPlaceHolders* + + +Type Boolean +Default Value 1 + +When set to 1, in visual mode, <Ctrl-J> takes you to the next placeholder +without deleting the current placeholder. + +-------------------------------------------------------------------------------- +Macro Customization *ls_11_3* *ls_a_cY* + *customizing-macros* + + + +Tex_Env_name *ls_11_3_1* *ls_a_cZ* + *Tex_Env_name* + +If you wish to wish to expand certain environments differently from the way +Latex-Suite does it, you can define custom expansions using global variables of +the form Tex_Env_{name} where name corresponds to the environment. + +For example, if you press <F5> after typing theorem, Latex-Suite will by default +expand it to > + \begin{theorem} + \label{<++>}<++> + \end{theorem}<++> +However, if you wish change this to > + \begin{theorem} + <++> + \end{theorem}<++> +then define the following variable > + let g:Tex_Env_theorem = "\\begin{theorem}\<CR><++>\<CR>\\end{theorem}" +< + +If the expansion uses special keys such as carriage return etc, then use +double-quotes and use the "\<key>" notation for special keys. Backslashes have +to be doubled. + +You could even use strings returned by functions as the expansion by using the +IMAP_PutTextWithMovement() [|ls_a_ea|] function. + +If the name of the environment contains special characters (for example, the +eqnarray* environment), then use the following form: > + let g:Tex_Env_{'eqnarray*'} = + \ "\\begin{eqnarray*}\<CR><++> &=& <++>\<CR>\\end{eqnarray*}<++>" +This will make pressing <F5> after eqnarray* expand to > + \begin{eqnarray*} + <++> &=& <++> + \end{eqnarray*}<++> + + + +Tex_Com_name *ls_11_3_2* *ls_a_da* + *Tex_Com_name* + +If you wish to define new expansions for fast command insertion as described +here [|ls_a_bo|], or redefine expansions from the default values in Latex-Suite, +you will need to define variables of the form g:Tex_Com_{name} where name is a +command name. For example, with the setting > + let g:Tex_Com_frac = "\\frac{<++>}{<++>}<++>" +pressing <F7> after typing frac will change it to \frac{<++>}{<++>}<++> + +See Tex_Env_name [|ls_a_cZ|] for additional details on how to create this +setting in various special circumstances. + + +Enabling / disabling macros *ls_11_3_3* *ls_a_db* + *macro-enabling* + +The following variables disable various parts of the macro functionality of +Latex-Suite. See the links to the relevant sections to see what functionality +setting each of the variables to zero will take away. + + *Tex_EnvironmentMaps* *ls_a_es* + *Tex_EnvironmentMenus* *ls_a_et* + *Tex_FontMaps* *ls_a_eu* + *Tex_FontMenus* *ls_a_ev* + *Tex_SectionMaps* *ls_a_ew* + *Tex_SectionMenus* *ls_a_ex* +Setting Link to relevant section Default Value~ +g:Tex_EnvironmentMaps Environment Mappings [|ls_a_bf|] 1 +g:Tex_EnvironmentMenus 1 +g:Tex_FontMaps Font Mappings [|ls_a_bs|] 1 +g:Tex_FontMenus 1 +g:Tex_SectionMaps Section Mappings [|ls_a_bt|] 1 +g:Tex_SectionMenus 1 + + +g:Tex_UseMenuWizard *ls_11_3_4* *ls_a_dc* + *Tex_UseMenuWizard* + + +Type Boolean +Default Value 0 + +If this variable is set to 1, then when an environment is chosen from the menu +then for selected environments, Latex-Suite asks a series of questions on the +command line and inserts a template with the corresponding fields already filled +in. Setting this to zero will insert a template with place-holders [|ls_a_eD|] +marking off the places where fields need to be filled. + + +g:Imap_FreezeImap *ls_11_3_5* *ls_a_dd* + *Imap_FreezeImap* + +Type boolean +Default Value 0 + +This option when set to 1, temporarily freezes Latex-Suite's macro expansion. It +might be useful when you are using some other keymap which is causing excessive +macro expansion. Use a buffer-local variable of the same name if you wish to +affect just the present buffer. + + +g:Tex_CatchVisMapErrors *ls_11_3_6* *ls_a_de* + *Tex_CatchVisMapErrors* + + +Type Boolean +Default Value 1 + +With so many visual maps, its helpful to have a way of catching typing errors +made in visual mode. What this does is to prompt you to correct your visual mode +mapping if you start out with and then type some illegal keys. It basically maps +just the g:Tex_Leader character to a function. + + +g:Tex_Diacritics *ls_11_3_7* *ls_a_df* + *Tex_Diacritics* + + +Type Boolean +Default Value 0 + +Whether or not you want to use diacritics [|ls_a_bw|]. + + +g:Tex_Leader *ls_11_3_8* *ls_a_dg* + *Tex_Leader* + + +Type String +Default Value '`' + +The mappings in Latex-Suite are by default prefixed with the back-tick +character. For example, `/ inserts \frac{<++>}{<++>}<++> etc. You can change the +prefix with the following setting. ',', '/', '`' are preferred values. '' or '\' +will lead to a _lot_ of trouble. + +g:Tex_Leader is also used for visual mode mappings for fonts. + + +g:Tex_Leader2 *ls_11_3_9* *ls_a_dh* + *Tex_Leader2* + + +Type String +Default Value ',' + +In order to avoid clashes between the large number of visual mode macros +provided, the visual mode macros for environments [|ls_a_bm|] and sections start +with a character different from g:Tex_Leader. + + +g:Tex_PromptedEnvironments *ls_11_3_10* *ls_a_di* + *Tex_PromptedEnvironments* + + +Type String +Default Value 'eqnarray*,eqnarray,equation,equation*,\[,$$,align,align*' + +This string represents a comma separated list of fields corresponding to +environments. Pressing <F5> in insert-mode in the body of the document asks you +to choose from one of these environments to insert. + +Leaving this string empty will leave the <F5> key unmapped + + +g:Tex_HotKeyMappings *ls_11_3_11* *ls_a_dj* + *Tex_HotKeyMappings* + + +Type String +Default Value 'eqnarray*,eqnarray,bmatrix' + +This string represents a comma separated list of environments which are mapped +to <Shift-F-1> through <Shift-F-4>. For example, pressing <Shift-F-2> with this +setting inserts the eqnarray environment. + +Leaving this string empty will leave <Shift-F-1> through <Shift-F-4> unmapped. + +NOTE: Only the first four fields of this list are used. The rest are silently + ignored. + + + + +g:Tex_PromptedCommands *ls_11_3_12* *ls_a_dk* + *Tex_PromptedCommands* + + +Type String +Default Value 'footnote,cite,pageref,label' + +This string represents a comma separated list of LaTeX commands which +Latex-Suite uses for the <F7> and <S-F7> maps as described here [|ls_a_bo|]. + +Leaving this string empty will leave the <F7> key unmapped. + + +Tex_ItemStyle_environment *ls_11_3_13* *ls_a_dl* + *Tex_ItemStyle_environment* + +This setting affects the style which Latex-Suite uses to insert an \item when +<Alt-I> is pressed as described here [|ls_a_bE|]. By default Latex-Suite defines +styles for the following environments: + +Environment Style~ +itemize \item +enumerate \item +theindex \item +thebibliography \item[<+biblabel+>]{<+bibkey+>} <++> +description \item[<+label+>] <++> + +Each style is defined by a variable of the form g:Tex_ItemStyle_{envname} where +envname is the name of the environment for which the style is defined. For +example, by default > + g:Tex_ItemStyle_description = '\item[<+label+>] <++>' +Redefining the style for a particular environment or defining a style for an +entirely new environment is simply a matter of setting the value of a variable +of the corresponding name. + +-------------------------------------------------------------------------------- +Smart Key Customization *ls_11_4* *ls_a_dm* + *customizing-smart-keys* + +These settings affect the smart key functionality as described here [|ls_a_bz|]. + + + +g:Tex_SmartKeyBS *ls_11_4_1* *ls_a_dn* + *Tex_SmartKeyBS* + + +Type Boolean +Default Value 1 + +Whether or not <Backspace> deletes diacritics. + + +g:Tex_SmartKeyQuote *ls_11_4_2* *ls_a_do* + *Tex_SmartKeyQuote* + + +Type Boolean +Default Value 1 + +Whether or not the smart quotes [|ls_a_bz|] functionality is available. + +If enabled, the quote characters can be customized by setting the following +variables: + +Setting Value~ +g:Tex_SmartQuoteOpen "``" +g:Tex_SmartQuoteClose "''" + +Non-English users will want to change these settings to their locale. These +global variables will be ignored if there are buffer-local variables (with the +same name), which may be set in the language specific package files, such as +$VIM/ftplugin/latex-suite/packages/german. + +-------------------------------------------------------------------------------- +Latex Completion Customization *ls_11_5* *ls_a_dp* + *customizing-latex-completion* + +The following settings affect the completion [|ls_a_bR|] functionality in +Latex-Suite. + + + +Window size settings *ls_11_5_1* *ls_a_dq* + *completion-window-preferences* + +These three settings affect the aesthetics of the completion functionality. + + *Tex_ViewerCwindowHeight* *ls_a_ey* + *Tex_ViewerPreviewHeight* *ls_a_ez* + *Tex_ExplorerHeight* *ls_a_eA* + *Tex_ImageDir* *ls_a_eB* +Setting Explanation Default Value~ +g:Tex_ViewerCwindowHeight The height of the cwindow which 5 + displays the list of \labels + etc. +g:Tex_ViewerPreviewHeight The height of the preview window 10 + which shows the context of a + \label etc. +g:Tex_ExplorerHeight The height of the explorer 10 + window which lists the files + from which to choose an image + file. +g:Tex_ImageDir The directory to scan for images '' + + +g:Tex_BIBINPUTS *ls_11_5_2* *ls_a_dr* + *Tex_BIBINPUTS* + + +Type string +Default Value '' + +This string describes the directories which are scanned while trying to search +for .bib and .bbl files. See the cite completion section [|ls_a_bU|] for more +details. + +This string should be set in the syntax accepted by Vim's native 'path' setting. +Do not include the present directory '.'. While searching for bibliography +files, the present directory will be prepended to this variable. + + +Tex_UseSimpleLabelSearch *ls_11_5_3* *ls_a_ds* + *Tex_UseSimpleLabelSearch* + +When set to 1, Latex-Suite searches for \labels in all .tex files in the +directory containing the file being edited when <F9> is pressed. See \ref +completion [|ls_a_bT|] for details. + + +g:Tex_ProjectSourceFiles *ls_11_5_4* *ls_a_dt* + *Tex_ProjectSourceFiles* + + +Type String +Default Value '' + +This setting is meant to be initialized on a per-project basis using the +Latex-Suite master file [|ls_a_ct|] as described in Latex-Suite Project +[|ls_a_cr|] section. It is a list of source files which are used in the project. +If defined, then instead of using the logic described in +Tex_UseSimpleLabelSearch [|ls_a_ds|] to search for files in which to search for +\labels, we simply search for \labels in this list. This significantly reduces +the time it takes to generate the list of possible completions for large +projects. + +The list is specified as a whitespace separated list of filenames relative to +the location of the main file. + + +g:Tex_RememberCiteSearch *ls_11_5_5* *ls_a_du* + *Tex_RememberCiteSearch* + + +Type Boolean +Default Value 0 + +When this variable is non-zero, then Latex-Suite will try to remember results +from the \cite completion as described in this section [|ls_a_bV|]. + +-------------------------------------------------------------------------------- +Compiler Customization *ls_11_6* *ls_a_dv* + *customizing-compiling* + +The following settings affect Latex-Suite's compilation functionality + + + +g:Tex_DefaultTargetFormat *ls_11_6_1* *ls_a_dw* + *Tex_DefaultTargetFormat* + + +Type String +Default Value dvi for windows/*nix and pdf for mac + +Use this setting to choose the default target format. For example, setting this +to pdf makes Latex-Suite compile a pdf file when you press \ll and fire up the +pdf viewer on pressing \lv. Make sure that a rules for compiling and viewing +have been defined for this target format as described here [|ls_a_dx|] and here +[|ls_a_dF|]. + + +g:Tex_CompileRule_<format> *ls_11_6_2* *ls_a_dx* + *Tex_CompileRule_format* + +Here <format> refers to the target format for which this rule is defined. +Latex-Suite supports compiling into dvi, ps and pdf by default. All these rules +are strings defined by default as follows: + + +g:Tex_CompileRule_dvi 'latex -interaction=nonstopmode $*' +g:Tex_CompileRule_ps 'ps2pdf $*' +g:Tex_CompileRule_pdf 'pdflatex -interaction=nonstopmode $*' + +If you desire forward and inverse searching via Latex-Suite, you will need to +change g:Tex_CompileRule_dvi to include -src-specials. However, this has been +known to cause problems with the output file. Therefore, use this with care. + + +g:Tex_FormatDependency_<format> *ls_11_6_3* *ls_a_dy* + +Type string +Default Value '' + +By default, there are no format dependencies defined. Each definition is of the +form above where <format> is a string such as 'dvi' etc. + +The value of each string is a comma separated string such as 'dvi,ps'. See the +Compiler dependency [|ls_a_ca|] section to see how to use/specify this setting + + +g:Tex_MultipleCompileFormats *ls_11_6_4* *ls_a_dz* + *Tex_MultipleCompileFormats* + +Type string +Default Value 'dvi' + +This is a comma separated string of formats for which the compiler needs to be +called multiple times in order to get cross-references, citations etc right. See +the Compiling multiple times [|ls_a_cb|] section for details. + + +g:Tex_IgnoredWarnings *ls_11_6_5* *ls_a_dA* + *Tex_IgnoredWarnings* + + +Type String +Default Value a new-line separated list of patterns as described below + +The default value of this setting is > + \"Underfull\n". + \"Overfull\n". + \"specifier changed to\n". + \"You have requested\n". + \"Missing number, treated as zero.\n". + \"There were undefined references\n" + \"Citation %.%# undefined" +This setting defines a set of patterns which will be filtered out when +displaying the output from the latex compiler. This is to aid in filtering out +very common warnings/errors. + +NOTE: Remember to check the value of g:Tex_IgnoreLevel [|ls_a_dB|] when you + change this setting. For example, if you append a new pattern which you + would like to ignore by default, increase the value of g:Tex_IgnoreLevel. + + + + +g:Tex_IgnoreLevel *ls_11_6_6* *ls_a_dB* + *Tex_IgnoreLevel* + + +Type Integer +Default Value 7 + +This setting defines a "filter level" or an "ignore level". A value of 7 for +instance means that any warning/error matching with any of the first 7 fields of +g:Tex_IgnoredWarnings [|ls_a_dA|] will be ignored. Setting this value to zero +will mean that no error/warning is ignored. However, even with a value of zero, +Latex-Suite will filter out most of the text which a LaTeX compiler typically +produces. Use > + TCLevel strict +from within Vim in order to see all the lines from the compiler's output. + + +Tex_UseMakefile *ls_11_6_7* *ls_a_dC* + *Tex_UseMakefile* + +Type boolean +Default Value 1 + +When set to 1, then if a makefile or Makefile is present in the current +directory, then Latex-Suite sets the makeprg option to just "make <target>", +where <target> is the target format chosen using the TCTarget or TTarget +commands. + +When set to 0, then Latex-Suite will set the makeprg setting to whatever is +defined by the g:Tex_CompileRule_target [|ls_a_dx|] setting. + + +g:Tex_GotoError *ls_11_6_8* *ls_a_dD* + *Tex_GotoError* + + +Type boolean +Default Value 1 + +If set to 1, then pressing \ll will take you to the location of the first +warning/error, otherwise you will remain in the original location but the +errors/warnings will be listed in the preview window. + +-------------------------------------------------------------------------------- +Viewer Customization *ls_11_7* *ls_a_dE* + *customizing-viewing* + +The following settings affect how Latex-Suite will display compiled files. + + + +g:Tex_ViewRule_<format> *ls_11_7_1* *ls_a_dF* + *Tex_ViewRule_format* + +Here <format> refers to a format such as dvi, ps, etc. This variable defines the +program which will be called to display a file of that format. + +By default, Latex-Suite defines viewer programs for viewing DVI, PS and PDF +formats as follows: + + Windows Unix~ +g:Tex_ViewRule_dvi 'yap -1' 'xdvi' +g:Tex_ViewRule_ps 'gsview32' 'ghostview' +g:Tex_ViewRule_pdf 'AcroRd32' 'xpdf' + +For Macintosh systems, these strings are left empty by default. This lets the +system pick the program for each format. If you define these variables for Mac, +the system choice will be over-ridden. + +Latex-Suite appends file.format to the above settings while calling the external +programs. For example, with > + let g:Tex_ViewRule_dvi = 'yap -1' +yap is called as > + !start yap -1 file.dvi +from within Vim. (The initial start is used on Windows platforms is to make yap +start as a separate process.) If you find the way Latex-Suite constructs the +command line too restrictive, you can use the Tex_ViewRuleComplete_format +[|ls_a_dG|] setting for more complete control on how the command line is +constructed while calling the external program for viewing. + +NOTE: For windows, you will need to set the $PATH variable to include the paths + to yap, AcroRd32, gsview32 and any other programs. See your system + documentation for how to do this. + + +NOTE: Default Viewing Format + ---------------------- + To change the default format for viewing files, set the + g:Tex_DefaultTargetFormat [|ls_a_dw|] variable. + + + + +Tex_ViewRuleComplete_<format> *ls_11_7_2* *ls_a_dG* + *Tex_ViewRuleComplete_format* + +Here <format> refers to the extension of a output format such as dvi, html etc. + +Tex_ViewRuleComplete_format takes precedence over Tex_ViewRule_format if both +are specified. By default, Latex-Suite does not define values for +Tex_ViewRuleComplete_format for any format. Unlike in the case of +Tex_ViewRule_format, Latex-Suite does not modify Tex_ViewRuleComplete_format at +all in constructing the command line. The only modification is to substitute +'$*' everywhere in the string with the name of the file being viewed (without +the extension). + +NOTE: IMPORTANT + --------- + Make sure you make the process go into the background otherwise vim will + wait for the viewer to terminate before letting you edit the file again. + + To make a process go into the background on a *nix platform, use a + trailing & in the setting. On Windows, use start at the beginning of the + setting. Example: Suppose you have a latex->html converter which converts + a file say foo.tex to a file foo/index.html. Then you would use: > + " On *nix platform + let g:Tex_ViewRuleComplete_html = 'MozillaFirebird $*/index.html &' + " On windows platform + let g:Tex_ViewRuleComplete_html = 'start MozillaFirebird $*/index.html' +< + + + +-------------------------------------------------------------------------------- +Menu Customization *ls_11_8* *ls_a_dH* + *customizing-menus* + +In addition to using the variables defined in this section to affect the +menu-layout permanently (i.e, the layout Latex-Suite will start with), you can +also use the TeX-Suite > Configure Menu menu to dynamically configure the menu +layout after Latex-Suite has started. + + + +g:Tex_Menus *ls_11_8_1* *ls_a_dI* + *Tex_Menus* + + +Type Boolean +Default Value 1 + +If set to 0, Latex-Suite will suppress showing all menus. Useful if you mostly +work in terminals. + + +g:Tex_MainMenuLocation *ls_11_8_2* *ls_a_dJ* + *Tex_MainMenuLocation* + + +Type number +Default Value 80 + +This setting decides the location of the first top-level Latex-Suite menu. You +can for example shift all the menus created by Latex-Suite to the very end by +setting this value to a large number like 990. + + +g:Tex_MathMenus *ls_11_8_3* *ls_a_dK* + *Tex_MathMenus* + + +Type Boolean +Default Value 1 + +The Tex-Math menu consists of hundreds of mathematical symbols used in LaTeX. +This menu comprises about 75% of the menus. + + +g:Tex_NestElementMenus *ls_11_8_4* *ls_a_dL* + *Tex_NestElementMenus* + + +Type Boolean +Default Value 1 + +This setting controls the "compactness" of the menus. If set to 1, then the +Font, Counter and Dimensioning menus are collected together in a single menu +called Tex-Elements, otherwise, they will each get a separate menu. + + +g:Tex_PackagesMenu *ls_11_8_5* *ls_a_dM* + *Tex_PackagesMenu* + + +Type Boolean +Default Value 1 + +Setting this to zero will stop Latex-Suite from automatically creating the +TeX-Suite > Packages > Supported menu at startup. You can still create the menu +after startup by going to TeX-Suite > Configure Menu. + + +g:Tex_NestPackagesMenu *ls_11_8_6* *ls_a_dN* + *Tex_NestPackagesMenu* + + +Type String +Default Value 'TeX-' + +This string is the prefix added to all the menus created by Latex-Suite. If you +define this variable with a dot ('.') as the last character, then all the menus +created by Latex-Suite will be nested under a single master menu. For example, +set this to '&LaTeX-Suite.' to nest all menus under a menu called &LaTeX-Suite. + + +g:Tex_UseUtfMenus *ls_11_8_7* *ls_a_dO* + *Tex_UseUtfMenus* + + +Type Boolean +Default Value 0 + +This setting controls whether Latex-Suite uses utf-8 symbols to display some of +the mathematical symbols in the TeX-Math menu. It is necessary for your +system/GUI to support utf-8. Setting this to 1 has the side-effect of setting +the 'encoding' option of Vim to 'utf-8'. + +-------------------------------------------------------------------------------- +Folding Customization *ls_11_9* *ls_a_dP* + *customizing-folding* + +The following settings control the folding [|ls_a_ci|] functionality of +Latex-Suite. + + + +g:Tex_Folding *ls_11_9_1* *ls_a_dQ* + *Tex_Folding* + + +Type Boolean +Default Value 1 + +Setting this to zero completely disables Latex-Suite's folding functionality. +However, the TexFoldTextFunction() is still available in case you want to use +another folding scheme but still want to continue using the fold text function. + + +g:Tex_AutoFolding *ls_11_9_2* *ls_a_dR* + *Tex_AutoFolding* + + +Type Boolean +Default Value 1 + +This setting controls whether Latex-Suite automatically creates manual folds for +a file when it is opened. You can still use the \rf mapping to refresh/create +folds even when this variable is set to zero. + +-------------------------------------------------------------------------------- +Package Handling Customization *ls_11_10* *ls_a_dS* + *customizing-packages* + +These settings affect the custom packages [|ls_a_bN|] functionality in +Latex-Suite + + + +g:Tex_TEXINPUTS *ls_11_10_1* *ls_a_dT* + *Tex_TEXINPUTS* + + +Type string +Default Value '' + +This setting describes the directories scanned by Latex-Suite while searching +for custom user packages as described in the custom packages [|ls_a_bN|] +section. Do not include the present directory in this setting. The present +directory is always scanned for custom packages. + +This string should be set in the syntax accepted by Vim's native 'path' setting. + +================================================================================ +Credits *ls_12* *ls_a_dU* + *latex-suite-credits* + + + +And finally, the credits: + + +Artur R. Czechowski maintains the BSD package of Latex-Suite. Lots of valuable + feedback. +Lubomir Host provided the diacritics and also helped in development. +Alexander Wagner valuable suggestions during development. +Luc Hermitte his variation of Stephen Riehm's bracketing system is used + in Latex-Suite. +Gergely Kontra the clever little JumpFunc() in imaps.vim is due to him. + The implementation of the templates also borrows from + mu-template.vim by him. +Dimitri Antoniou author of ltags and also provided the nice tip about + forward / reverse search on DVI documents. +Stephen Riehm the extremely helpful bracketing system is from him. +Alan Schmitt provided macros/folding elements. Continued feedback, + bug-reports/fixes. +Hari Krishna Dara for ExecMap(), the clever little function which makes + typing visual mode mappings so much easier and error-free. +Alan G Isac for the comprehensive BibT() function for entering bibtex + entries. +Gontran Baerts for libList.vim +Peter Heslin useful discussion and also a lot of bug fixes. the + %%fakesection in folding.vim. +Zhang Lin-bo lots of very useful additions to folding. The code for + customizing the folding scheme is due to him. + +A large number of functions in Latex-Suite come from various other people. Some +of those people might have been missed here. Each function should however have +the author's name/e-mail above it. Thats the more authoritative place to check +out who has done what. + + *latex-suite-maintainer* *ls_a_eC* +The current maintainer(s) of Latex-Suite is(are) + + +Srinath Avadhanula <srinath@fastmail.fm> + +Mikolaj Machowski <mikmach@wp.pl> + +Benji Fisher <benji@member.AMS.org> + +================================================================================ +URLs used in this file + +*ls_u_1* : http://vim-latex.sourceforge.net +*ls_u_2* : http://vim-latex.sourceforge.net/index.php?subject=download +*ls_u_3* : http://www.cygwin.com +*ls_u_4* : http://www.google.com/search?q=windows%20gnu%20grep + +================================================================================ +About this file + +This file was created automatically from its XML variant using db2vim. db2vim is +a python script which understands a very limited subset of the Docbook XML 4.2 +DTD and outputs a plain text file in vim help format. + +db2vim can be obtained via anonymous CVS from sourceforge.net. Use + +cvs -d:pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex co db2vim + +Or you can visit the web-interface to sourceforge CVS at: +http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/db2vim/ + +The following modelines should nicely fold up this help manual. + +vim:ft=help:fdm=expr:nowrap +vim:foldexpr=getline(v\:lnum-1)=~'-\\{80}'?'>2'\:getline(v\:lnum-1)=~'=\\{80}'?'>1'\:getline(v\:lnum)=~'=\\{80}'?'0'\:getline(v\:lnum)=~'-\\{80}'?'1'\:'=' +vim:foldtext=substitute(v\:folddashes.substitute(getline(v\:foldstart),'\\s*\\*.*',"",""),'^--','\ \ \ \ \ \ ','') +================================================================================ diff --git a/vimfiles.latex/doc/latexhelp.txt b/vimfiles.latex/doc/latexhelp.txt new file mode 100644 index 0000000..2782424 --- /dev/null +++ b/vimfiles.latex/doc/latexhelp.txt @@ -0,0 +1,2430 @@ +*latexhelp.txt* For Vim version 6.0. Last change: 2001 Dec 20 + + + LATEX HELP 1.6 + translated (with minor changes) for vim + by Mikolaj Machowski + +This file documents LaTeX2e, a document preparation system. LaTeX2e is a +macro package for TeX. + + This is edition 1.6 of the LaTeX2e documentation, and is for the Texinfo +that is distributed as part of Version 19 of GNU Emacs. It uses version +2.134 or later of the texinfo.tex input file. + + This is translated from LATEX.HLP v1.0a in the VMS Help Library. The +pre-translation version was written by George D. Greenwade of Sam Houston +State University. + + The LaTeX 2.09 version was written by Stephen Gilmore <stg@dcs.ed.ac.uk>. + + The LaTeX2e version was adapted from this by Torsten Martinsen +<bullestock@dk-online.dk>. + + Version for vim of this manual was written by Mikolaj Machowski +<mikmach@wp.pl> + + Copyright 1988,1994 Free Software Foundation, Inc. Copyright 1994-1996 +Torsten Martinsen. Copyright for `translation' for vim Mikolaj Machowski 2001. + + Permission is granted to make and distribute verbatim copies of this manual +provided the copyright notice and this permission notice are preserved on +all copies. + + Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + + Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that the sections entitled "Distribution" and "General Public +License" may be included in a translation approved by the author instead of +in the original English. + +============================================================================== +*LaTeX* *latex* + +The LaTeX command typesets a file of text using the TeX program and the LaTeX +Macro package for TeX. To be more specific, it processes an input file +containing the text of a document with interspersed commands that describe how +the text should be formatted. + +1. Commands |latex-commands| +2. Counters |latex-counters| +3. Cross References |latex-references| +4. Definitions |latex-definitions| +5. Document Classes |latex-classes| +6. Layout |latex-layout| +7. Environments |latex-environments| +8. Footnotes |latex-footnotes| +9. Lengths |latex-lengths| +10. Letters |latex-letters| +11. Line & Page Breaking |latex-breaking| +12. Making Paragraphs |latex-paragraphs| +13. Margin Notes |latex-margin-notes| +14. Math Formulae |latex-math| +15. Modes |latex-modes| +16. Page Styles |latex-page-styles| +17. Sectioning |latex-sectioning| +18. Spaces & Boxes |latex-spaces-boxes| +19. Special Characters |latex-special-char| +20. Splitting the Input |latex-inputting| +21. Starting & Ending |latex-start-end| +22. Table of Contents |latex-toc| +23. Terminal Input/Output |latex-terminal| +24. Typefaces |latex-typefaces| +25. Parameters |latex-parameters| + +============================================================================== +1. Commands *latex-commands* + +A LaTeX command begins with the command name, which consists of a \ followed +by either + (a) a string of letters or + (b) a single non-letter. + +Arguments contained in square brackets, [], are optional while arguments +contained in braces, {}, are required. + +NOTE: LaTeX is case sensitive. Enter all commands in lower case unless +explicitly directed to do otherwise. + +============================================================================== +2. Counters *latex-counters* + +|\addtocounter| Add a quantity to a counter +|\alph| Print value of a counter using letters +|\arabic| Print value of a counter using numerals +|\fnsymbol| Print value of a counter using symbols +|\newcounter| Define a new counter +|\refstepcounter| Add to counter, resetting subsidiary counters +|\roman| Print value of a counter using roman numerals +|\setcounter| Set the value of a counter +|\stepcounter| Add to counter, resetting subsidiary counters +|\usecounter| Use a specified counter in a list environment +|\value| Use the value of a counter in an expression + +Everything LaTeX numbers for you has a counter associated with it. The name of +the counter is the same as the name of the environment or command that +produces the number, except with no |\\|. (|lc-enumi| - |lc-enumiv| are used +for the nested |\enumerate| environment.) Below is a list of the counters +used in LaTeX's standard document classes to control numbering. + + |part| |paragraph| |figure| |enumi| |itemi| + |chapter| |subparagraph| |table| |enumii| |itemii| + |section| |page| |footnote| |enumiii| |itemiii| + |subsection| |equation| |mpfootnote| |enumiv| |itemiv| + |subsubsection| + + +\addtocounter{counter}{value} *\addtocounter* + Increments the {counter} by the amount specified by the + {value} argument. The {value} argument can be negative. + +\alph{counter} *\alph* *\Alph* +\Alph{counter} + This command causes the value of the counter to be printed in + alphabetic characters. |\alph| command uses lower case + alphabetic alphabetic characters, i.e., a, b, c... while the + |\Alph| command uses upper case alphabetic characters, i.e., + A, B, C.... + +\arabic{counter} *\arabic* + Causes the value of the {counter} to be printed in Arabic + numbers, i.e., 3. + +\fnsymbol{counter} *\fnsymbol* + Causes the value of the {counter} to be printed in a specific + sequence of nine symbols that can be used for numbering + footnotes. + Note: counter must have a value between 1 and 9 inclusive. + +\newcounter{foo}[counter] *\newcounter* + Defines a new counter named {foo}. The counter is initialized + to zero. The optional argument [counter] causes the counter + {foo} to be reset whenever the counter named in the optional + argument is incremented. + +\refstepcounter{counter} *\refstepcounter* + Command works like |\stepcounter|, except it also defines the + current |\ref| value to be the result of \thecounter. + +\roman{counter} *\roman* *\Roman* +\Roman{counter} + Causes the value of the {counter} to be printed in Roman + numerals. The |\roman| command uses lower case Roman numerals, + i.e., i, ii, iii..., while the |\Roman| command uses upper case + Roman numerals, i.e., I, II, III.... + +\stepcounter{counter} *\stepcounter* + Adds one to the {counter} and resets all subsidiary counters. + +\setcounter{counter}{value} *\setcounter* + Sets the value of the {counter} to that specified by the + {value} argument. + +\usecounter{counter} *\usecounter* + Command is used in the second argument of the |list| + environment to allow the {counter} specified to be used to + number the list items. + +\value{counter} *\value* + Produces the value of the {counter} named in the mandatory + argument. It can be used where LaTeX expects an integer or + number, such as the second argument of a |\setcounter| or + |\addtocounter| command, or in: > + \hspace{\value{foo}\parindent} +< It is useful for doing arithmetic with counters. + +============================================================================== +3. Cross References *latex-references* + +One reason for numbering things like figures and equations is to refer the +reader to them, as in "See Figure 3 for more details." + +|\label| Assign a symbolic name to a piece of text +|\pageref| Refer to a page number +|\ref| Refer to a section, figure or similar + + +\label{key} *\label* + Command appearing in ordinary text assigns to the {key} the + number of the current sectional unit; one appearing inside a + numbered environment assigns that number to the {key}. + + A {key} can consist of any sequence of letters, digits, or + punctuation characters. Upper and lowercase letters are + different. + + To avoid accidentally creating two labels with the same name, + it is common to use labels consisting of a prefix and a suffix + separated by a colon. The prefixes conventionally used are + * 'cha' for chapters + * 'sec' for lower-level sectioning commands + * 'fig' for figures + * 'tab' for tables + * 'eq' for equations + Thus, a label for a figure would look like: > + \label{fig:bandersnatch} + +\pageref{key} *\pageref* + Command produces the page number of the place in the text + where the corresponding |\label| command appears. ie. where + \label{key} appears. + +\ref{key} *\ref* + Command produces the number of the sectional unit, equation + number, ... of the corresponding |\label| command. + +============================================================================== +4. Definitions *latex-definitions* + +|\newcommand| Define a new command +|\newenvironment| Define a new environment +|\newtheorem| Define a new theorem-like environment +|\newfont| Define a new font name + + +\newcommand{cmd}[args]{definition} *\newcommand* *\renewcommand* +\newcommand{cmd}[args][default]{definition} +\renewcommand{cmd}[args]{definition} +\renewcommand{cmd}[args][default]{definition} + +These commands define (or redefine) a command. + +{cmd} A command name beginning with a |\\|. For |\newcommand| it must + not be already defined and must not begin with |\end|; for + |\renewcommand| it must already be defined. + +{args} An integer from 1 to 9 denoting the number of arguments of the + command being defined. The default is for the command to have + no arguments. + +{default} If this optional parameter is present, it means that the + command's first argument is optional. The default value of the + optional argument is default. + +{definition} The text to be substituted for every occurrence of {cmd}; a + parameter of the form #n in {cmd} is replaced by the text of + the nth argument when this substitution takes place. + + *\newenvironment* *\renewenvironment* +\newenvironment{nam}[args]{begdef}{enddef} +\newenvironment{nam}[args][default]{begdef}{enddef} +\renewenvironment{nam}[args]{begdef}{enddef} + +These commands define or redefine an environment. + +{nam} The name of the environment. For |\newenvironment| there must + be no currently defined environment by that name, and the + command \nam must be undefined. For |\renewenvironment| the + environment must already be defined. + +{args} An integer from 1 to 9 denoting the number of arguments of + the newly-defined environment. The default is no arguments. + +{default} If this is specified, the first argument is optional, and + default gives the default value for that argument. + +{begdef} The text substituted for every occurrence of \begin{nam}; a + parameter of the form #n in {cmd} is replaced by the text of + the nth argument when this substitution takes place. + +{enddef} The text substituted for every occurrence of \end{nam}. It + may not contain any argument parameters. + + +\newtheorem{envname}{caption}[within] *\newtheorem* +\newtheorem{envname}[numberedlike]{caption} + +This command defines a theorem-like environment. + +{envname} The name of the environment to be defined. A string of + letters. It must not be the name of an existing environment or + counter. + +{caption} The text printed at the beginning of the environment, right + before the number. This may simply say "Theorem", for example. + +{within} The name of an already defined counter, usually of a sectional + unit. Provides a means of resetting the new theorem counter + within the sectional unit. + +{numberedlike} The name of an already defined theorem-like environment. + +The |\newtheorem| command may have at most one optional argument. + + +\newfont{cmd}{fontname} *\newfont* + Defines the command name {cmd}, which must not be currently + defined, to be a declaration that selects the font named + {fontname} to be the current font. + +============================================================================== +5. Document Classes *latex-classes* + + +\documentclass[options]{class} *\documentclass* + +Valid LaTeX document classes include: + *article *article-class* + *report *report-class* + *letter *letter-class* + *book *book-class* + *slides *slides-class* + +All the standard classes (except slides) accept the following options for +selecting the typeface size (10 pt is default): + +10pt, 11pt, 12pt + +All classes accept these options for selecting the paper size (default is +letter): + +a4paper, a5paper, b5paper, letterpaper, legalpaper, executivepaper + +Miscellaneous options: + +landscape *landscape* + Selects landscape format. Default is portrait. + +titlepage, notitlepage *notitlepage* + Selects if there should be a separate title page. + +leqno *leqno* *rqno* + Equation number on left side of equations. Default is + right side. + +fleqn *fleqn* + Displayed formulas flush left. Default is centred. + +openbib *openbib* + Use "open" bibliography format. + +draft, final *draft* *final* + Mark/do not mark overfull boxes with a rule. Default is + final. + +These options are not available with the slides class: + +oneside, twoside *oneside* *twoside* + Selects one- or twosided layout. Default is oneside, + except for the book class. + +openright, openany *openright* *openany* + Determines if a chapter should start on a right-hand page. + Default is openright for book. + +onecolumn, twocolumn *onecolumn* *twocolumn* + One or two columns. Defaults to one column. + +The slides class offers the option clock for printing the time at the bottom +of each |\note|. + +If you specify more than one option, they must be separated by a comma. + +\usepackage[options]{pkg} *\usepackage* + Additional packages are loaded by this. If you + specify more than one package, they must be separated by a + comma. + +Any options given in the |\documentclass| command that are unknown by the +selected document class are passed on to the packages loaded with |\usepackage|. + +============================================================================== +6. Layout *latex-layout* + +Miscellaneous commands for controlling the general layout of the page. + +|\flushbottom| Make all text pages the same height. +|\onecolumn| Use one-column layout. +|\raggedbottom| Allow text pages of differing height. +|\twocolumn| Use two-column layout. + +\flushbottom *\flushbottom* + Makes all text pages the same height, adding extra vertical + space when necessary to fill out the page. This is the + standard if twocolumn mode is selected. + +\onecolumn *\onecolumn* + Starts a new page and produces single-column output. + +\raggedbottom *\raggedbottom* + Makes all pages the height of the text on that page. No extra + vertical space is added. + +\twocolumn[text] *\twocolumn* + Starts a new page and produces two-column output. If the + optional [text] argument is present, it is typeset in + one-column mode. + +============================================================================== +7. Environments *latex-environments* + + *\begin* *\end* +LaTeX provides a number of different paragraph-making environments. Each +environment begins and ends in the same manner: > + + \begin{environment-name} + . + . + . + \end{environment-name} +< +a. |array| Math arrays +b. |center| Centred lines +c. |description| Labelled lists +d. |enumerate| Numbered lists +e. |eqnarray| Sequences of aligned equations +f. |equation| Displayed equation +g. |figure| Floating figures +h. |flushleft| Flushed left lines +i. |flushright| Flushed right lines +j. |itemize| Bulleted lists +k. |letter| Letters +l. |list| Generic list environment +m. |minipage| Miniature page +n. |picture| Picture with text, arrows, lines and circles +o. |quotation| Indented environment with paragraph indentation +p. |quote-l| Indented environment with no paragraph indentation +q. |tabbing| Align text arbitrarily +r. |table| Floating tables +s. |tabular| Align text in columns +t. |thebibliography| Bibliography or reference list +u. |theorem| Theorems, lemmas, etc +v. |titlepage| For hand crafted title pages +x. |verbatim| Simulating typed input +y. |verse| For poetry and other things + +============================================================================== + a. array *array* +> + \begin{array}{col1col2...coln} + column 1 entry & column 2 entry ... & column n entry \\ + . + . + . + \end{array} + +Math arrays are produced with the |array| environment. It has a single mandatory +argument describing the number of columns and the alignment within them. Each +column, coln, is specified by a single letter that tells how items in that row +should be formatted. + * c -- for centred + * l -- for flush left + * r -- for flush right +Column entries must be separated by an |&|. Column entries may include other +LaTeX commands. Each row of the array must be terminated with the string |\\|. + +Note that the |array| environment can only be used in |math-mode|, so normally +it is used inside an |equation| environment. + +============================================================================== +b. center *center* +> + \begin{center} + Text on line 1 \\ + Text on line 2 \\ + . + . + . + \end{center} + +The |\center| environment allows you to create a paragraph consisting of lines +that are centred within the left and right margins on the current page. Each +line must be terminated with the string |\\|. + +\centering *\centering* + This declaration corresponds to the |center| environment. This + declaration can be used inside an environment such as + |quote-l| or in a |\parbox|. The text of a |figure| or |table| + can be centred on the page by putting a |\centering| command + at the beginning of the |figure| or |table| environment. + Unlike the |center| environment, the |\centering| command does + not start a new paragraph; it simply changes how LaTeX formats + paragraph units. To affect a paragraph unit's format, the + scope of the declaration must contain the blank line or |\end| + command (of an environment like |quote-l|) that ends the + paragraph unit. + +============================================================================== +c. description *description* +> + \begin{description} + \item [label] First item + \item [label] Second item + . + . + . + \end{description} + +The |description| environment is used to make labelled lists. The label is +bold face and flushed right. + +============================================================================== +d. enumerate *enumerate* +> + \begin{enumerate} + \item First item + \item Second item + . + . + . + \end{enumerate} + +The |enumerate| environment produces a numbered list. Enumerations can be +nested within one another, up to four levels deep. They can also be nested +within other paragraph-making environments. + +\item Each item of an enumerated list begins with an |\item| + command. There must be at least one |\item| command + within the environment. + +The |enumerate| environment uses the |\enumi| through |\enumiv| counters (see +section |latex-counters|). The type of numbering can be changed by redefining +\theenumi etc. + +============================================================================== +e. eqnarray *eqnarray* +> + \begin{eqnarray} + math formula 1 \\ + math formula 2 \\ + . + . + . + \end{eqnarray} + +The |eqnarray| environment is used to display a sequence of equations or +inequalities. It is very much like a three-column |array| environment, with +consecutive rows separated by |\\| and consecutive items within a row separated +by an |&|. + +\nonumber *\nonumber* + An equation number is placed on every line unless that + line has a |\nonumber| command. + +\lefteqn *\lefteqn* + The command |\lefteqn| is used for splitting long + formulas across lines. It typesets its argument in + display style flush left in a box of zero width. + +============================================================================== +f. equation *equation* +> + \begin{equation} + math formula + \end{equation} + +The |equation| environment centres your equation on the page and places the +equation number in the right margin. + +============================================================================== +g. figure *figure* +> + \begin{figure}[placement] + body of the figure + \caption{figure title} + \end{figure} + +Figures are objects that are not part of the normal text, and are usually +"floated" to a convenient place, like the top of a page. Figures will not be +split between two pages. + +The optional argument [placement] determines where LaTeX will try to place +your figure. There are four places where LaTeX can possibly put a float: + +h (Here) at the position in the text where the figure + environment appears. +t (Top) at the top of a text page. +b (Bottom) at the bottom of a text page. +p (Page of floats) on a separate float page, which is a page containing + no text, only floats. + +The standard |report-class| and |article-class| use the default placement +[tbp]. + +The body of the |figure| is made up of whatever text, LaTeX commands, etc. you +wish. + +The \caption command allows you to title your figure. + +============================================================================== +h. flushleft *flushleft* +> + \begin{flushleft} + Text on line 1 \\ + Text on line 2 \\ + . + . + . + \end{flushleft} + +The |flushleft| environment allows you to create a paragraph consisting of +lines that are flushed left, to the left-hand margin. Each line must be +terminated with the string |\\|. + +\raggedright *\raggedright* + This declaration corresponds to the |flushleft| environment. + This declaration can be used inside an environment such as + |quote-l| or in a |\parbox|. Unlike the |flushleft| + environment, the |\raggedright| command does not start a new + paragraph; it simply changes how LaTeX formats paragraph + units. To affect a paragraph unit's format, the scope of the + declaration must contain the blank line or |\end| command (of + an environment like |quote-l|) that ends the paragraph unit. + +============================================================================== +i. flushright *flushright* +> + \begin{flushright} + Text on line 1 \\ + Text on line 2 \\ + . + . + . + \end{flushright} + +The |flushright| environment allows you to create a paragraph consisting of +lines that are flushed right, to the right-hand margin. Each line must be +terminated with the string |\\|. + +\raggedleft *\raggedleft* + This declaration corresponds to the |flushright| environment. + This declaration can be used inside an environment such as + |quote-l| or in a |\parbox|. Unlike the |flushright| + environment, the |\raggedleft| command does not start a new + paragraph; it simply changes how LaTeX formats paragraph + units. To affect a paragraph unit's format, the scope of the + declaration must contain the blank line or |\end| command (of + an environment like |quote-l|) that ends the paragraph unit. + +============================================================================== +j. itemize *itemize* +> + \begin{itemize} + \item First item + \item Second item + . + . + . + \end{itemize} + +The |itemize| environment produces a "bulleted" list. Itemizations can be +nested within one another, up to four levels deep. They can also be nested +within other paragraph-making environments. + +\item *\item* + Each item of an itemized list begins with an |\item| command. + There must be at least one |\item| command within the + environment. + +The itemize environment uses the |\itemi| through |\itemiv| counters (see +section |latex-counters|). The type of numbering can be changed by redefining +\theitemi etc. + +============================================================================== +k. letter *\letter* + +This environment is used for creating letters. See section |latex-letters|. + +============================================================================== +l. list *list* + +The |list| environment is a generic environment which is used for defining many +of the more specific environments. It is seldom used in documents, but often +in macros. +> + \begin{list}{label}{spacing} + \item First item + \item Second item + . + . + . + \end{list} + +'label' The {label} argument specifies how items should be labelled. + This argument is a piece of text that is inserted in a box to + form the {label}. This argument can and usually does contain + other LaTeX commands. + +'spacing' The {spacing} argument contains commands to change the spacing + parameters for the |list|. This argument will most often be + null, i.e., {}. This will select all default spacing which + should suffice for most cases. + +============================================================================== +m. minipage *minipage* +> + \begin{minipage}[position]{width} + text + \end{minipage} + +The |minipage| environment is similar to a |\parbox| command. It takes the +same optional [position] argument and mandatory {width} argument. You may use +other paragraph-making environments inside a |minipage|. Footnotes in a +minipage environment are handled in a way that is particularly useful for +putting footnotes in figures or tables. A |\footnote| or |\footnotetext| +command puts the footnote at the bottom of the minipage instead of at the +bottom of the page, and it uses the |\mpfootnote| counter instead of the +ordinary footnote counter. See sections |latex-counters| and +|latex-footnotes|. + +NOTE: Don't put one |minipage| inside another if you are using footnotes; they +may wind up at the bottom of the wrong minipage. + +============================================================================== +n. picture *picture* +> + size position + \begin{picture}(width,height)(x offset,y offset) + . + . + picture commands + . + . + \end{picture} + +The |picture| environment allows you to create just about any kind of picture +you want containing text, lines, arrows and circles. You tell LaTeX where to +put things in the picture by specifying their coordinates. A coordinate is a +number that may have a decimal point and a minus sign -- a number like 5, 2.3 +or -3.1416. A coordinate specifies a length in multiples of the unit length +|\unitlength|, so if |\unitlength| has been set to 1cm, then the coordinate +2.54 specifies a length of 2.54 centimetres. You can change the value of +|\unitlength| anywhere you want, using the |\setlength| command, but strange +things will happen if you try changing it inside the |picture| environment. + +A position is a pair of coordinates, such as (2.4,-5), specifying the point +with x-coordinate 2.4 and y-coordinate -5. Coordinates are specified in the +usual way with respect to an origin, which is normally at the lower-left +corner of the |picture|. +Note that when a position appears as an argument, it is not enclosed in +braces; the parentheses serve to delimit the argument. + +The |picture| environment has one mandatory argument, which is a position. It +specifies the size of the picture. The environment produces a rectangular box +with width and height determined by this argument's x- and y-coordinates. + +The |picture| environment also has an optional position argument, following +the size argument, that can change the origin. (Unlike ordinary optional +arguments, this argument is not contained in square brackets.) The optional +argument gives the coordinates of the point at the lower-left corner of the +picture (thereby determining the origin). For example, if |\unitlength| has +been set to 1mm, the command: > + \begin{picture}(100,200)(10,20) +> +produces a picture of width 100 millimetres and height 200 millimetres, whose +lower-left corner is the point (10,20) and whose upper-right corner is +therefore the point (110,220). When you first draw a picture, you will omit +the optional argument, leaving the origin at the lower-left corner. If you +then want to modify your picture by shifting everything, you just add the +appropriate optional argument. + +The environment's mandatory argument determines the nominal size of the +picture. This need bear no relation to how large the picture really is; LaTeX +will happily allow you to put things outside the picture, or even off the +page. The picture's nominal size is used by LaTeX in determining how much room +to leave for it. + +Everything that appears in a picture is drawn by the |\put| command. The +command: > + \put (11.3,-.3){...} + +puts the object specified by ... in the picture, with its +reference point at coordinates (11.3,-.3). The reference points for various +objects will be described below. + +The |\put| creates an LR box (|lrbox|). You can put anything in the text +argument of the |\put| that you'd put into the argument of an |\mbox| and +related commands. When you do this, the reference point will be the lower left +corner of the box. + +Picture commands: +|\circle| Draw a circle +|\dashbox| Draw a dashed box +|\frame| Draw a frame around an object +|\framebox(picture)| Draw a box with a frame around it +|\line| Draw a straight line +|\linethickness| Set the line thickness +|\makebox(picture)| Draw a box of the specified size +|\multiput| Draw multiple instances of an object +|\oval| Draw an ellipse +|\put| Place an object at a specified place +|\shortstack| Make a pile of objects +|\vector| Draw a line with an arrow + +\circle[*]{diameter} *\circle* + Command produces a circle with a {diameter} as close to the + specified one as possible. If the *-form of the command is + used, LaTeX draws a solid circle. + Note: only circles up to 40 pt can be drawn. + + +\dashbox{dashlength}(width,height){...} *\dashbox* + Draws a box with a dashed line. The |\dashbox| has an extra + argument which specifies the width of each dash. A dashed box + looks best when the width and height are multiples of the + {dashlength}. + +\frame{...} *\frame* + Puts a rectangular frame around the object specified in the + argument. The reference point is the bottom left corner of the + frame. No extra space is put between the frame and the object. + +\framebox(width,height)[position]{...} *\picture-framebox* + The |\framebox| command is exactly the same as the + |picture-makebox| command, except that it puts a frame around + the outside of the box that it creates. The |\framebox| + command produces a rule of thickness |\fboxrule|, and leaves a + space |\fboxsep| between the rule and the contents of the box. + +\line(x slope,y slope){length} *\line* + Draws a line of the specified length and slope. + Note: LaTeX can only draw lines with slope = x/y, where x and + y have integer values from -6 through 6. + +\linethickness{dimension} *\linethickness* + Declares the thickness of horizontal and vertical lines in a + |picture| environment to be dimension, which must be a + positive length. It does not affect the thickness of slanted + lines (|\line|) and circles (|circle|), or the quarter circles + drawn by |\oval| to form the corners of an oval. + +\makebox(width,height)[position]{...} *picture-makebox* + The makebox command for the |picture| environment is similar + to the normal |\makebox| command except that you must specify + a width and height in multiples of |\unitlength|. + The optional argument, [position], specifies the quadrant that + your text appears in. You may select up to two of the + following: + t - Moves the item to the top of the rectangle + b - Moves the item to the bottom + l - Moves the item to the left + r - Moves the item to the right + + *\multiput* +\multiput(x coord,y coord)(delta x,delta y){no of copies}{object} + This command can be used when you are putting the same + object in a regular pattern across a picture. + +\oval(width,height)[portion] *\oval* + Produces a rectangle with rounded corners. The optional + argument, [portion], allows you to select part of the oval. + t - top portion + b - bottom portion + r - right portion + l - left portion + Note: the "corners" of the oval are made with quarter circles + with a maximum radius of 20 pt, so large "ovals" will look + more like boxes with rounded corners. + +\put(x coord,y coord){ ... } *\put* + Places the item specified by the mandatory argument at the + given coordinates. + +\shortstack[position]{... \\ ... \\ ...} *\shortstack* + The |\shortstack| command produces a stack of objects. + The valid positions are: + r - right of the stack + l - left of the stack + c - centre of the stack (default) + +\vector(x slope,y slope){length} *\vector* + Draws a line with an arrow of the specified length and slope. + The x and y values must lie between -4 and +4, inclusive. + +============================================================================== +o. quotation *quotation* + > + \begin{quotation} + text + \end{quotation} + +The margins of the |quotation| environment are indented on the left and the +right. The text is justified at both margins and there is paragraph +indentation. Leaving a blank line between text produces a new paragraph. + +============================================================================== +p. quote *quote-l* +> + \begin{quote} + text + \end{quote} + +The margins of the |quote-l| environment are indented on the left and the right. +The text is justified at both margins. Leaving a blank line between text +produces a new paragraph. + +============================================================================== +q. tabbing *tabbing* +> + \begin{tabbing} + text \= more text \= still more text \= last text \\ + second row \> \> more \\ + . + . + . + \end{tabbing} + +The |tabbing| environment provides a way to align text in columns. It works by +setting tab stops and tabbing to them much the way you do with an ordinary +typewriter. + +It is best suited for cases where the width of each column is constant and +known in advance. + +This environment can be broken across pages, unlike the |tabular| environment. +The following commands can be used inside a tabbing environment: + + *tab=* +\= Sets a tab stop at the current position. + + *tab>* +\> Advances to the next tab stop. + + *tab<* +\< This command allows you to put something to the left of the + local margin without changing the margin. Can only be used at + the start of the line. + + *tab+* +\+ Moves the left margin of the next and all the following + commands one tab stop to the right. + + *tab-* +\- Moves the left margin of the next and all the following + commands one tab stop to the left. + + *tab'* +\' Moves everything that you have typed so far in the current + column, i.e. everything from the most recent \> (|tab>|), \< + (|tab<|), \' (|tab'|), |\\|, or |\kill| command, to the right + of the previous column, flush against the current column's tab + stop. + + *tab`* +\` Allows you to put text flush right against any tab stop, + including tab stop 0. However, it can't move text to the right + of the last column because there's no tab stop there. The \` + (|tab`|) command moves all the text that follows it, up to the + |\\| or \end{tabbing} command that ends the line, to the right + margin of the tabbing environment. There must be no \> + (|tab>|) or \' (|tab'|) command between the \` (|tab`|) and + the command that ends the line. + + *\kill* +\kill Sets tab stops without producing text. Works just like |\\| + except that it throws away the current line instead of + producing output for it. The effect of any \= (|tab=|), \+ + (|tab+|) or \- (|tab-|) commands in that line remain in + effect. + + *\pushtabs* +\pushtabs Saves all current tab stop positions. Useful for temporarily + changing tab stop positions in the middle of a tabbing + environment. Also restores the tab stop positions saved by the + last |\pushtabs|. + + *taba* +\a In a tabbing environment, the commands \= (|tab=|), \' + (|tab'|) and \` (|tab`|) do not produce accents as normal. + Instead, the commands \a=, \a' and \a` are used. + +This example typesets a Pascal function in a traditional format: +> + \begin{tabbing} + function \= fact(n : integer) : integer;\\ + \> begin \= \+ \\ + \> if \= n $>$ 1 then \+ \\ + fact := n * fact(n-1) \- \\ + else \+ \\ + fact := 1; \-\- \\ + end;\\ + \end{tabbing} + +============================================================================== +r. table *\table* +> + \begin{table}[placement] + body of the table + \caption{table title} + \end{table} + +Tables are objects that are not part of the normal text, and are usually +"floated" to a convenient place, like the top of a page. Tables will not be +split between two pages. + +The optional argument [placement] determines where LaTeX will try to place +your table. There are four places where LaTeX can possibly put a float: + + h (Here) at the position in the text where the table + environment appears. + t (Top) at the top of a text page. + b (Bottom) at the bottom of a text page. + p (Page of floats) on a separate float page, which is a page + containing no text, only floats. + +The standard |report-class| and |article-class| use the default placement [tbp]. + +The body of the table is made up of whatever text, LaTeX commands, etc., you +wish. + +The \caption command allows you to title your table. + +============================================================================== +s. tabular *tabular* +> + \begin{tabular}[pos]{cols} + column 1 entry & column 2 entry ... & column n entry \\ + . + . + . + \end{tabular} + +or +> + \begin{tabular*}{width}[pos]{cols} + column 1 entry & column 2 entry ... & column n entry \\ + . + . + . + \end{tabular*} + +These environments produce a box consisting of a sequence of rows of items, +aligned vertically in columns. The mandatory and optional arguments consist +of: + +{width} Specifies the width of the tabular* environment. There must be + rubber space between columns that can stretch to fill out the + specified width. + +[pos] Specifies the vertical position; default is alignment on the + centre of the environment. + t - align on top row + b - align on bottom row + +{cols} Specifies the column formatting. It consists of a sequence of + the following specifiers, corresponding to the sequence of + columns and intercolumn material. + l - A column of left-aligned items. + + r - A column of right-aligned items. + + c - A column of centred items. + + | - A vertical line the full height and depth of the + environment. + + @{text} - This inserts text in every row. An @-expression + suppresses the intercolumn space normally inserted + between columns; any desired space between the + inserted text and the adjacent items must be included + in text. An \extracolsep{wd} command in an + @-expression causes an extra space of width {wd} to + appear to the left of all subsequent columns, until + countermanded by another |\extracolsep| command. Unlike + ordinary intercolumn space, this extra space is not + suppressed by an @-expression. An |\extracolsep| + command can be used only in an @-expression in the + cols argument. + + p{wd} - Produces a column with each item typeset in a |\parbox| + of width {wd}, as if it were the argument of a + \parbox[t]{wd} command. However, a |\\| may not appear + in the item, except in the following situations: + 1. inside an environment like |minipage|, |array|, or + |tabular|. + 2. inside an explicit |\parbox|. + 3. in the scope of a |\centering|, |\raggedright|, or + |\raggedleft| declaration. The latter declarations must + appear inside braces or an environment when used in a + p-column element. + + {num}{cols} - Equivalent to num copies of cols, where num is any positive + integer and cols is any list of column-specifiers, + which may contain another -expression. + +These commands can be used inside a tabular environment: + +|\cline| Draw a horizontal line spanning some columns. +|\hline| Draw a * horizontal line spanning all columns. +|\multicolumn| Make an item spanning * several columns. +|\vline| Draw a vertical line. + + +\cline{i-j} *\cline* + The |\cline| command draws horizontal lines across the columns + specified, beginning in column i and ending in column j, + which are identified in the mandatory argument. + +\hline *\hline* + The |\hline| command will draw a horizontal line the width of + the table. It's most commonly used to draw a line at the top, + bottom, and between the rows of the table. + +\multicolumn{cols}{pos}{text} *\multicolumn* + The |\multicolumn| is used to make an entry that spans several + columns. The first mandatory argument, {cols}, specifies the + number of columns to span. The second mandatory argument, + {pos}, specifies the formatting of the entry: + c - centered + l - flushleft + r - flushright. + The third mandatory argument, {text}, specifies what text is + to make up the entry. + +\vline *\vline* + The |\vline| command will draw a vertical line extending the + full height and depth of its row. An |\hfill| command can be + used to move the line to the edge of the column. It can also + be used in an @-expression. + +============================================================================== +t. thebibliography *\thebibliography* +> + \begin{thebibliography}{widestlabel} + \bibitem[label]{cite_key} + . + . + . + \end{thebibliography} + +The |\thebibliography| environment produces a bibliography or reference list. + +In the |article-class|, this reference list is labelled "References"; in the +|report-class|, it is labelled "Bibliography". + +{widestlabel} Text that, when printed, is approximately as wide as the + widest item label produces by the |\bibitem| commands. + +|\bibitem| Specify a bibliography item. +|\cite| Refer to a bibliography item. +|\nocite| Include an item in the bibliography. +|BibTeX| Automatic generation of bibliographies. + +\bibitem *\bibitem* +\bibitem[label]{citekey} + The |\bibitem| command generates an entry labelled by [label]. + If the [label] argument is missing, a number is generated as + the label, using the |\enumi| counter. The {citekey} is any + sequence of letters, numbers, and punctuation symbols not + containing a comma. This command writes an entry on the `.aux' + file containing {citekey} and the item's label. When this + `.aux' file is read by the \begin{document} command, the + item's label is associated with {citekey}, causing the + reference to {citekey} by a |\cite| command to produce the + associated label. + +\cite *\cite* +\cite[text]{keylist} + The {keylist} argument is a list of citation keys. This + command generates an in-text citation to the references + associated with the keys in {keylist} by entries on the `.aux' + file read by the \begin{document} command. + The optional text argument will appear after the + citation, i.e.: > + \cite[p.2]{knuth} +< might produce `[Knuth, p. 2]'. + +\nocite *\nocite* +\nocite{keylist} + The |\nocite| command produces no text, but writes + {keylist}, which is a list of one or more citation + keys, on the `.aux' file. + +BibTeX *BibTeX* *bibtex* + *\bibliographystyle* +If you use the BibTeX program by Oren Patashnik (highly recommended if you +need a bibliography of more than a couple of titles) to maintain your +bibliography, you don't use the |thebibliography| environment. Instead, you +include the lines: +> + \bibliographystyle{style} + \bibliography{bibfile} + +where {style} refers to a file style.bst, which defines how your citations +will look. The standard styles distributed with BibTeX are: + +{alpha} Sorted alphabetically. Labels are formed from name of author and year + of publication. +{plain} Sorted alphabetically. Labels are numeric. +{unsrt} Like plain, but entries are in order of citation. +{abbrv} Like plain, but more compact labels. + +In addition, numerous other BibTeX style files exist tailored to the demands +of various publications. + + *\bibliography* +The argument to |\bibliography| refers to the file bibfile.bib, which should +contain your database in BibTeX format. Only the entries referred to via +|\cite| and |\nocite| will be listed in the bibliography. + +============================================================================== +u. theorem *theorem* +> + \begin{theorem} + theorem text + \end{theorem} + +The |theorem| environment produces "Theorem x" in boldface followed by your +theorem text. + +============================================================================== +v. titlepage *titlepage* +> + \begin{titlepage} + text + \end{titlepage} + +The |titlepage| environment creates a title page, i.e. a page with no printed +page number or heading. It also causes the following page to be numbered page +one. Formatting the title page is left to you. The |\today| command comes in +handy for title pages. + +Note that you can use the |\maketitle| to produce a standard title page. + +============================================================================== +x. verbatim *verbatim* +> + \begin{verbatim} + text + \end{verbatim} + +The |verbatim| environment is a paragraph-making environment that gets LaTeX +to print exactly what you type in. It turns LaTeX into a typewriter with +carriage returns and blanks having the same effect that they would on a +typewriter. + +\verb *\verb* +\verb char literal_text char +\verb*char literal_text char + Typesets literal_text exactly as typed, including + special characters and spaces, using a typewriter |\tt| + type style. There may be no space between |\verb| or + |\verb|* and char (space is shown here only for + clarity). The *-form differs only in that spaces are + printed as `\verb*| |\'. + +============================================================================== +y. verse *verse* +> + \begin{verse} + text + \end{verse} + +The |verse| environment is designed for poetry, though you may find other uses +for it. + +The margins are indented on the left and the right. Separate the lines of each +stanza with |\\|, and use one or more blank lines to separate the stanzas. + +============================================================================== +8. Footnotes *latex-footnotes* + +Footnotes can be produced in one of two ways. They can be produced with one +command, the |\footnote| command. They can also be produced with two commands, +the |\footnotemark| and the |\footnotetext| commands. See the specific command for +information on why you would use one over the other. + +|\footnote| Insert a footnote +|\footnotemark| Insert footnote mark only +|\footnotetext| Insert footnote text only + +\footnote[number]{text} *\footnote* + Command places the numbered footnote text at the bottom of the + current page. The optional argument, number, is used to change + the default footnote number. This command can only be used in + outer paragraph mode; i.e., you cannot use it in sectioning + commands like |\chapter|, in |\figure|, |\table| or in a + |\tabular| environment. + +\footnotemark *\footnotemark* + Command puts the footnote number in the text. This command can + be used in inner paragraph mode. The text of the footnote is + supplied by the |\footnotetext| command. + This command can be used to produce several consecutive + footnote markers referring to the same footnote by using +> + \footnotemark[\value{footnote}] +< + after the first |\footnote| command. + +\footnotetext[number]{text} *\footnotetext* + Command produces the text to be placed at the bottom of the + page. This command can come anywhere after the |\footnotemark| + command. The |\footnotetext| command must appear in outer + paragraph mode. The optional argument, number, is used to + change the default footnote number. + +============================================================================== +9. Lengths *latex-lengths* + +A length is a measure of distance. Many LaTeX commands take a length as an +argument. + +|\newlength| Define a new length. +|\setlength| Set the value of a length. +|\addtolength| Add a quantity to a length. +|\settodepth| Set a length to the depth of something. +|\settoheight| Set a length to the height of something. +|\settowidth| Set a length to the width of something. +|pre-lengths| Lengths that are, like, predefined. + +\newlength{\gnat} *\newlength* + The |\newlength| command defines the mandatory argument, \gnat, + as a length command with a value of 0in. An error occurs if a + \gnat command already exists. + +\setlength{\gnat}{length} *\setlength* + The |\setlength| command is used to set the value of a \gnat + command. The {length} argument can be expressed in any terms + of length LaTeX understands, i.e., inches (in), millimetres + (mm), points (pt), etc. + +\addtolength{\gnat}{length} *\addtolength* + The |\addtolength| command increments a \gnat by the amount + specified in the {length} argument. It can be a negative + amount. + +\settodepth{\gnat}{text} *\settodepth* + The |\settodepth| command sets the value of a \gnat command + equal to the depth of the {text} argument. + +\settoheight{\gnat}{text} *\settoheight* + The |\settoheight| command sets the value of a \gnat command + equal to the height of the {text} argument. + +\settowidth{\gnat}{text} *\settowidth* + The |\settowidth| command sets the value of a \gnat command + equal to the width of the {text} argument. + +Predefined lengths *pre-lengths* + +\width *\width* +\height *\height* +\depth *\depth* +\totalheight *\totalheight* + These length parameters can be used in the arguments of the + box-making commands See section Spaces & Boxes. They specify + the natural width etc. of the text in the box. + \totalheight equals \height + \depth. + To make a box with the text stretched to double the natural + size, e.g., say: > + \makebox[2\width]{Get a stretcher} + +============================================================================== +10. Letters *latex-letters* + +You can use LaTeX to typeset letters, both personal and business. The letter +document class is designed to make a number of letters at once, although you +can make just one if you so desire. + +Your `.tex' source file has the same minimum commands as the other document +classes, i.e., you must have the following commands as a minimum: > + \documentclass{letter} + \begin{document} + ... + letters + ... + \end{document} + +Each letter is a letter environment, whose argument is the name and address of +the recipient. For example, you might have: > + \begin{letter} + {Mr. Joe Smith\\ + 2345 Princess St. \\ + Edinburgh, EH1 1AA} + ... + \end{letter} + +The letter itself begins with the |\opening| command. The text of the letter +follows. It is typed as ordinary LaTeX input. Commands that make no sense in +a letter, like |\chapter|, do not work. The letter closes with a |\closing| +command. + +After the closing, you can have additional material. The |\cc| command produces +the usual "cc: ...". There's also a similar |\encl| command for a list of +enclosures. With both these commands, use|\\| to separate the items. + +These commands are used with the letter class: +|\address| Your return address. +|\cc| Cc list. closing Saying goodbye. +|\encl| List of enclosed material. +|\location| Your organisation's address. +|\makelabels| Making address labels. +|\name| Your name, for the return address. +|\opening| Saying hello. +|\ps| Adding a postscript. +|\signature| Your signature. +|\startbreaks| Allow page breaks. +|\stopbreaks| Disallow page breaks. +|\telephone| Your phone number. + +\address{Return address} *\address* + The return address, as it should appear on the letter and the + envelope. Separate lines of the address should be separated + by |\\| commands. If you do not make an |\address| declaration, + then the letter will be formatted for copying onto your + organisation's standard letterhead. (See section Overview of + LaTeX and Local Guide, for details on your local + implementation). If you give an |\address| declaration, then + the letter will be formatted as a personal letter. + +\cc{Kate Schechter\\Rob McKenna} *\cc* + Generate a list of other persons the letter was sent to. Each + name is printed on a separate line. + +\closing{text} *\closing* + The letter closes with a |\closing| command, i.e., > + \closing{Best Regards,} \encl{CV\\Certificates} +< Generate a list of enclosed material. + +\location{address} *\location* + This modifies your organisation's standard address. This only + appears if the firstpage pagestyle is selected. + +\makelabels{number} *\makelabels* + If you issue this command in the preamble, LaTeX will create a + sheet of address labels. This sheet will be output before the + letters. + +\name{June Davenport} *\name* + Your name, used for printing on the envelope together with the + return address. + +\opening{text} *\opening* + The letter begins with the |\opening| command. The mandatory + argument, text, is whatever text you wish to start your + letter, i.e., > + \opening{Dear Joe,} + +\ps *\ps* + Use this command before a postscript. + +\signature{Harvey Swick} *\signature* + Your name, as it should appear at the end of the letter + underneath the space for your signature. Items that should go + on separate lines should be separated by |\\| commands. + +\startbreaks *\startbreaks* + Used after a |\stopbreaks| command to allow page breaks again. + +\stopbreaks *\stopbreaks* + Inhibit page breaks until a |\startbreaks| command occurs. + +\telephone{number} *\telephone* + This is your telephone number. This only appears if the + firstpage pagestyle is selected. + +============================================================================== +11. Line & Page Breaking *latex-breaking* + +The first thing LaTeX does when processing ordinary text is to translate your +input file into a string of glyphs and spaces. To produce a printed document, +this string must be broken into lines, and these lines must be broken into +pages. In some environments, you do the line breaking yourself with the |\\| +command, but LaTeX usually does it for you. + +|\\| Start a new line +|hyph-| Insert explicit hyphenation +|\cleardoublepage| Start a new right-hand page +|\clearpage| Start a new page +|\enlargethispage| Enlarge the current page a bit +|\fussy| Be fussy about line breaking +|\hyphenation| Tell LaTeX how to hyphenate a word +|\linebreak| Break the line +|\newline| Break the line prematurely +|\newpage| Start a new page +|\nolinebreak| Don't break the current line +|\nopagebreak| Don't make a page break here +|\pagebreak| Please make a page break here +|\sloppy| Be sloppy about line breaking + +\\[*][extraspace] *\\* *\\\\* + The |\\| command tells LaTeX to start a new line. It has an + optional argument, [extraspace], that specifies how much extra + vertical space is to be inserted before the next line. This + can be a negative amount. + The \\* command is the same as the ordinary |\\| command + except that it tells LaTeX not to start a new page after the + line. + +\- *hyph-* + The \- command tells LaTeX that it may hyphenate the word at + that point. LaTeX is very good at hyphenating, and it will + usually find all correct hyphenation points. The \- command is + used for the exceptional cases. + Note: when you insert \- commands in a word, the word will + only be hyphenated at those points and not at any of the + hyphenation points that LaTeX might otherwise have chosen. + +\cleardoublepage *\cleardoublepage* + The |\cleardoublepage| command ends the current page and causes + all figures and tables that have so far appeared in the input + to be printed. In a two-sided printing style (|twoside|), it + also makes the next page a right-hand (odd-numbered) page, + producing a blank page if necessary. + +\clearpage *\clearpage* + The |\clearpage| command ends the current page and causes all + figures and tables that have so far appeared in the input to + be printed. + +\enlargethispage{size} *\enlargethispage* +\enlargethispage*{size} + Enlarge the textheight for the current page by the + specified amount; e.g.: > + + \enlargethispage{\baselineskip} +< + will allow one additional line. The starred form + tries to squeeze the material together on the page as + much as possible. This is normally used together with + an explicit |\pagebreak|. + +\fussy *\fussy* + This declaration (which is the default) makes TeX more fussy + about line breaking. This can avoids too much space between + words, but may produce overfull boxes. This command cancels + the effect of a previous |\sloppy| command. + +\hyphenation{words} *\hyphenation* + The |\hyphenation| command declares allowed hyphenation points, + where words is a list of words, separated by spaces, in which + each hyphenation point is indicated by a - character. + +\linebreak[number] *\linebreak* + The |\linebreak| command tells LaTeX to break the current line + at the point of the command. With the optional argument, + number, you can convert the |\linebreak| command from a demand + to a request. The [number] must be a number from 0 to 4. The + higher the number, the more insistent the request is. The + |\linebreak| command causes LaTeX to stretch the line so it + extends to the right margin. + +\newline *\newline* + The |\newline| command breaks the line right where it is. It + can only be used in paragraph mode. + +\newpage *\newpage* + The |\newpage| command ends the current page. + +\nolinebreak[number] *\nolinebreak* + The |\nolinebreak| command prevents LaTeX from breaking the + current line at the point of the command. With the optional + argument, [number], you can convert the |\nolinebreak| command + from a demand to a request. The [number] must be a number from 0 + to 4. The higher the number, the more insistent the request + is. + +\nopagebreak[number] *\nopagebreak* + The |\nopagebreak| command prevents LaTeX from breaking the + current page at the point of the command. With the optional + argument, [number], you can convert the |\nopagebreak| command + from a demand to a request. The [number] must be a number from + 0 to 4. The higher the number, the more insistent the request + is. + +\pagebreak[number] *\pagebreak* + The |\pagebreak| command tells LaTeX to break the current page + at the point of the command. With the optional argument, + [number], you can convert the |\pagebreak| command from a + demand to a request. The [number] must be a number from 0 to + 4. The higher the number, the more insistent the request is. + +\sloppy *\sloppy* + This declaration makes TeX less fussy about line breaking. + This can prevent overfull boxes, but may leave too much space + between words. + Lasts until a |\fussy| command is issued. + +============================================================================== +12. Making Paragraphs *latex-paragraphs* + +A paragraph is ended by one or more completely blank lines -- lines not +containing even a |\%|. A blank line should not appear where a new paragraph +cannot be started, such as in math mode or in the argument of a sectioning +command. + +|\indent| Indent this paragraph. +|\noindent| Do not indent this paragraph. +|\par| Another way of writing a blank line. + +\indent *\indent* + This produces a horizontal space whose width equals the width + of the paragraph indentation. It is used to add paragraph + indentation where it would otherwise be suppressed. + +\noindent *\noindent* + When used at the beginning of the paragraph, it suppresses the + paragraph indentation. It has no effect when used in the + middle of a paragraph. + +\par *\par* + Equivalent to a blank line; often used to make command or + environment definitions easier to read. + +============================================================================== +13. Margin Notes *latex-margin-notes* + +\marginpar[left]{right} *\marginpar* + This command creates a note in the margin. The first line will + be at the same height as the line in the text where the + |\marginpar| occurs. + + When you only specify the mandatory argument {right}, the text + will be placed: + * in the right margin for one-sided layout + * in the outside margin for two-sided layout (|twoside|) + * in the nearest margin for two-column layout (|twocolumn|) + +\reversemarginpar *\reversemarginpar* + By issuing the command |\reversemarginpar|, you can force the + marginal notes to go into the opposite (inside) margin. + +When you specify both arguments, left is used for the left margin, and right +is used for the right margin. + +The first word will normally not be hyphenated; you can enable hyphenation by +prefixing the first word with a \hspace{0pt} command (|hspace|). + +============================================================================== +14. Math Formulae *latex-math* + *displaymath* +There are three environments (|latex-environments|) that put LaTeX in math +mode: +|math| For Formulae that appear right in the text. +|displaymath| For Formulae that appear on their own line. +|equation| The same as the displaymath environment except that it adds an + equation number in the right margin. + +The |math| environment can be used in both paragraph and LR mode, but the +|displaymath| and |equation| environments can be used only in paragraph mode. The +|math| and |displaymath| environments are used so often that they have the +following short forms: + \(...\) instead of \begin{math}...\end{math} + \[...\] instead of \begin{displaymath}...\end{displaymath} + +In fact, the math environment is so common that it has an even shorter form: + $ ... $ instead of \(...\) + +|sub-sup| Also known as exponent or index. +|math-symbols| Various mathematical squiggles. +|math-spacing| Thick, medium, thin and negative spaces. +|math-misc| Stuff that doesn't fit anywhere else. + +========== +Subscripts & Superscripts *sub-sup* + *subscripts* *superscripts* + +To get an expression exp to appear as a subscript, you just type _{exp}. To +get exp to appear as a superscript, you type ^{exp}. LaTeX handles +superscripted superscripts and all of that stuff in the natural way. It even +does the right thing when something has both a subscript and a superscript. + +========== +Math Symbols *math-symbols* + +LaTeX provides almost any mathematical symbol you're likely to need. The +commands for generating them can be used only in math mode. For example, if +you include > + $\pi$ +in your source, you will get the symbol in your output. + +========== +Spacing in Math Mode *math-spacing* + +In a math environment, LaTeX ignores the spaces you type and puts in the +spacing that it thinks is best. LaTeX formats mathematics the way it's done in +mathematics texts. If you want different spacing, LaTeX provides the following +four commands for use in math mode: + \; - a thick space *math;* + \: - a medium space *math:* + \, - a thin space *math,* + \! - a negative thin space *matn!* + +========== +Math Miscellany *math-misc* + +\cdots *\cdots* + Produces a horizontal ellipsis where the dots are raised to + the centre of the line. +\ddots *\ddots* + Produces a diagonal ellipsis. +\frac{num}{den} *\frac* + Produces the fraction num divided by den. +\ldots *\ldots* + Produces an ellipsis. This command works in any mode, not just + math mode. +\overbrace{text} *\overbrace* + Generates a brace over text. +\overline{text} *\overline* + Causes the argument text to be overlined. +\sqrt[root]{arg} *\sqrt* + Produces the square root of its argument. The optional + argument, [root], determines what root to produce, i.e., the + cube root of x+y would be typed as: > + $\sqrt[3]{x+y}$. +\underbrace{text} *\underbrace* + Generates text with a brace underneath. +\underline{text} *\underline* + Causes the argument text to be underlined. This command can + also be used in paragraph and LR mode. +\vdots *\vdots* + Produces a vertical ellipsis. + +============================================================================== +15. Modes *latex-modes* + +When LaTeX is processing your input text, it is always in one of three modes: + Paragraph mode *paragraph-mode* + Math mode *math-mode* + Left-to-right mode, called LR mode for short. *lr-mode* + +LaTeX changes mode only when it goes up or down a staircase to a different +level, though not all level changes produce mode changes. Mode changes occur +only when entering or leaving an environment, or when LaTeX is processing the +argument of certain text-producing commands. + +|paragraph-mode| is the most common; it's the one LaTeX is in when processing +ordinary text. In that mode, LaTeX breaks your text into lines and breaks the +lines into pages. LaTeX is in |math-mode| when it's generating a mathematical +formula. In |lr-mode|, as in |paragraph-mode|, LaTeX considers the output that +it produces to be a string of words with spaces between them. However, unlike +|paragraph-mode|, LaTeX keeps going from left to right; it never starts a new +line in |lr-mode|. Even if you put a hundred words into an |\mbox|, LaTeX would +keep typesetting them from left to right inside a single box, and then +complain because the resulting box was too wide to fit on the line. + +LaTeX is in |lr-mode| when it starts making a box with an |\mbox| command. You +can get it to enter a different mode inside the box - for example, you can +make it enter |math-mode| to put a formula in the box. There are also several +text-producing commands and environments for making a box that put LaTeX in +|paragraph-mode|. The box make by one of these commands or environments will be +called a |\parbox|. When LaTeX is in |paragraph-mode| while making a box, it is +said to be in "inner paragraph mode". Its normal |paragraph-mode|, which it +starts out in, is called "outer paragraph mode". + +============================================================================== +16. Page Styles *latex-page-styles* + +The |\documentclass| command determines the size and position of the page's head +and foot. The page style determines what goes in them. + +|\maketitle| Generate a title page. +|\pagenumbering| Set the style used for page numbers. +|\pagestyle| Change the headings/footings style. +|\thispagestyle| Change the headings/footings style for this page. + +\maketitle *\maketitle* + The |\maketitle| command generates a title on a separate title + page - except in the |\article| class, where the title normally + goes at the top of the first page. Information used to + produce the title is obtained from the following declarations: + + |\author| Who wrote this stuff? + |\date| The date the document was created. + |\thanks| A special form of footnote. + |\title| How to set the document title. + + \author{names} *\author* *\and* + The |\author| command declares the author(s), where + names is a list of authors separated by \and commands. + Use |\\| to separate lines within a single author's + entry -- for example, to give the author's institution + or address. + + \date{text} *\date* + The |\date| command declares text to be the document's + date. With no |\date| command, the current date is + used. + + \thanks{text} *\thanks* + The |\thanks| command produces a |\footnote| to the + title. + + \title{text} *\title* + The |\title| command declares text to be the title. Use + |\\| to tell LaTeX where to start a new line in a long + title. + +\pagenumbering{numstyle} *\pagenumbering* + Specifies the style of page numbers. Possible values of + 'numstyle' are: + arabic - Arabic numerals *arabic* + roman - Lowercase Roman numerals *roman* + Roman - Uppercase Roman numerals *Roman* + alph - Lowercase letters *alph* + Alph - Uppercase letters *Alph* + +\pagestyle{option} *\pagestyle* + *plain* *empty* *headings* + The |\pagestyle| command changes the style from the current + page on throughout the remainder of your document. + The valid options are: + plain - Just a plain page number. + empty - Produces empty heads and feet no page numbers. + headings - Puts running headings on each page. The document + style specifies what goes in the headings. + myheadings - You specify what is to go in the heading with the + |\markboth| or the |\markright| commands. + + |\markboth| Set left and right headings. + |\markright| Set right heading only. + + \markboth{left head}{right head} *\markboth* + The |\markboth| command is used in conjunction with the + page style myheadings for setting both the left and + the right heading. + Note that a "left-hand heading" is generated by the + last |\markboth| command before the end of the page, + while a "right-hand heading" is generated by the first + |\markboth| or |\markright| that comes on the page if + there is one, otherwise by the last one before the + page. + + + \markright{right head} *\markright* + The |\markright| command is used in conjunction with + the page style |\myheadings| for setting the right + heading, leaving the left heading unchanged. + Note that a "left-hand heading" is generated by the + last |\markboth| command before the end of the page, + while a "right-hand heading" is generated by the first + |\markboth| or |\markright| that comes on the page if + there is one, otherwise by the last one before the + page. + +\thispagestyle{option} *\thispagestyle* + The |\thispagestyle| command works in the same manner as the + |\pagestyle| command except that it changes the style for the + current page only. + +============================================================================== +17. Sectioning *latex-sectioning* + +Sectioning commands provide the means to structure your text into units. +|\part| +|\chapter| (report and book class only) +|\section| +|\subsection| +|\subsubsection| +|\paragraph| +|\subparagraph| + +All sectioning commands take the same general form, i.e., + + *\part* + *\chapter* (report and book class only) + *\section* *\subsection* *\subsubsection* + *\paragraph* *\subparagraph* +\chapter[optional]{title} + In addition to providing the heading in the text, the + mandatory argument of the sectioning command can appear in two + other places: + 1. The table of contents + 2. The running head at the top of the page. You may not want + the same thing to appear in these other two places as + appears in the text heading. To handle this situation, the + sectioning commands have an optional argument that provides + the text for these other two purposes. + +All sectioning commands have *\-forms that print a title, but do not include a +number and do not make an entry in the table of contents. + +\appendix *\appendix* + The |\appendix| command changes the way sectional units are + numbered. The |\appendix| command generates no text and does + not affect the numbering of parts. The normal use of this + command is something like: > + \chapter{The First Chapter} + ... + \appendix \chapter{The First Appendix} + + +============================================================================== +18. Spaces & Boxes *latex-spaces-boxes* + +All the predefined length parameters See section Predefined lengths can be +used in the arguments of the box-making commands. + + Horizontal space: + +|\dotfill| Stretchable horizontal dots. +|\hfill| Stretchable horizontal space. +|\hrulefill| Stretchable horizontal rule. +|\hspace| Fixed horizontal space. + + Vertical space: + +|\addvspace| Fixed vertical space. +|\bigskip| Fixed vertical space. +|\medskip| Fixed vertical space. +|\smallskip| Fixed vertical space. +|\vfill| Stretchable vertical space. +|\vspace| Fixed vertical space. + + Boxes: + +|\fbox| Framebox. +|\framebox| Framebox, adjustable position. +|\lrbox| An environment like |\sbox|. +|\makebox| Box, adjustable position. +|\mbox| Box. +|\newsavebox| Declare a name for saving a box. +|\parbox| Box with text in paragraph mode. +|\raisebox| Raise or lower text. +|\rule| Lines and squares. +|\savebox| Like |\makebox|, but save the text for later use. +|\sbox| Like |\mbox|, but save the text for later use. +|\usebox| Print saved text. + +Horizontal space: *latex-hor-space* + +LaTeX removes horizontal space that comes at the end of a line. If you don't +want LaTeX to remove this space, include the optional * argument. Then the +space is never removed. + +\dotfill *\dotfill* + The |\dotfill| command produces a "rubber length" that produces + dots instead of just spaces. + +\hfill *\hfill* + The |\hfill| fill command produces a "rubber length" which can + stretch or shrink horizontally. It will be filled with spaces. + +\hrulefill *\hrulefill* + The |\hrulefill| fill command produces a "rubber length" which + can stretch or shrink horizontally. It will be filled with a + horizontal rule. + +\hspace[*]{length} *\hspace* + The |\hspace| command adds horizontal space. The length of the + space can be expressed in any terms that LaTeX understands, + i.e., points, inches, etc. You can add negative as well as + positive space with an |\hspace| command. Adding negative space + is like backspacing. + + +Vertical space: *latex-ver-space* + +LaTeX removes vertical space that comes at the end of a page. If you don't +want LaTeX to remove this space, include the optional * argument. Then the +space is never removed. + +\addvspace{length} *\addvspace* + The |\addvspace| command normally adds a vertical space of + height length. However, if vertical space has already been + added to the same point in the output by a previous + |\addvspace| command, then this command will not add more space + than needed to make the natural length of the total vertical + space equal to length. + +\bigskip *\bigskip* + The |\bigskip| command is equivalent to \vspace{bigskipamount} + where bigskipamount is determined by the document class. + +\medskip *\medskip* + The |\medskip| command is equivalent to \vspace{medskipamount} + where medskipamount is determined by the document class. + +\smallskip *\smallskip* + The |\smallskip| command is equivalent to + \vspace{smallskipamount} where smallskipamount is determined + by the document class. + +\vfill *\vfill* + The |\vfill| fill command produces a rubber length which can + stretch or shrink vertically. + +\vspace[*]{length} *\vspace* + The |\vspace| command adds vertical space. The length of the + space can be expressed in any terms that LaTeX understands, + i.e., points, inches, etc. You can add negative as well as + positive space with an |\vspace| command. + + +Boxes: *latex-boxes* + +\fbox{text} *\fbox* + The |\fbox| command is exactly the same as the |\mbox| command, + except that it puts a frame around the outside of the box that + it creates. + +\framebox[width][position]{text} *\framebox* + The |\framebox| command is exactly the same as the |\makebox| + command, except that it puts a frame around the outside of the + box that it creates. + The |\framebox| command produces a rule of thickness + |\fboxrule|, and leaves a space |\fboxsep| between the rule and + the contents of the box. + +lrbox *\lrbox* +\begin{lrbox}{cmd} text \end{lrbox} + This is the environment form of |\sbox|. + The text inside the environment is saved in the box cmd, which + must have been declared with |\newsavebox|. + +\makebox[width][position]{text} *\makebox* + The |\makebox| command creates a box just wide enough to + contain the text specified. The width of the box is specified + by the optional [width] argument. The position of the text + within the box is determined by the optional [position] + argument. + c -- centred (default) + l -- flushleft + r -- flushright + s -- stretch from left to right margin. The text must + contain stretchable space for this to work. + See section |\picture-makebox|. + +\mbox{text} *\mbox* + The |\mbox| command creates a box just wide enough to hold the + text created by its argument. + Use this command to prevent text from being split across + lines. + +\newsavebox{cmd} *\newsavebox* + Declares {cmd}, which must be a command name that is not + already defined, to be a bin for saving boxes. + + +\parbox[position][height][innerpos]{width}{text} *\parbox* + A parbox is a box whose contents are created in + |\paragraph-mode|. The |\parbox| has two + + Mandatory arguments: +'width' specifies the width of the parbox +'text' the text that goes inside the parbox. + + Optional arguments: +'position' LaTeX will position a parbox so its centre lines up with the + centre of the text line. The optional position argument allows + you to line up either the top or bottom line in the parbox + (default is top). + +'height' If the height argument is not given, the box will have the + natural height of the text. + +'innerpos' The inner-pos argument controls the placement of the text + inside the box. If it is not specified, position is used. + t -- text is placed at the top of the box + c -- text is centred in the box + b -- text is placed at the bottom of the box + s -- stretch vertically. The text must contain + vertically stretchable space for this to work. + + A |\parbox| command is used for a parbox containing a small + piece of text, with nothing fancy inside. In particular, you + shouldn't use any of the paragraph-making environments inside + a |\parbox| argument. For larger pieces of text, including ones + containing a paragraph-making environment, you should use a + |\minipage| environment. + +\raisebox{distance}[extendabove][extendbelow]{text} *\raisebox* + The |\raisebox| command is used to raise or lower text. The + first mandatory argument specifies how high the text is to be + raised (or lowered if it is a negative amount). The text + itself is processed in LR mode. + Sometimes it's useful to make LaTeX think something has a + different size than it really does - or a different size than + LaTeX would normally think it has. The |\raisebox| command + lets you tell LaTeX how tall it is. + The first optional argument, extend-above, makes LaTeX think + that the text extends above the line by the amount specified. + The second optional argument, extend-below, makes LaTeX think + that the text extends below the line by the amount specified. + +\rule[raiseheight]{width}{thickness} *\rule* + The |\rule| command is used to produce horizontal lines. The + arguments are defined as follows: +'raiseheight' specifies how high to raise the rule (optional) +'width' specifies the length of the rule (mandatory) +'thickness' specifies the thickness of the rule (mandatory) + +\savebox{cmd}[width][pos]{text} *\savebox* + This command typeset text in a box just as for |\makebox|. + However, instead of printing the resulting box, it saves it in + bin cmd, which must have been declared with |\newsavebox|. + +\sbox{text} *\sbox* + This commands typeset text in a box just as for |\mbox|. + However, instead of printing the resulting box, it saves it in + bin cmd, which must have been declared with |\newsavebox|. + +\usebox{cmd} *\usebox* + Prints the box most recently saved in bin cmd by a |\savebox| + command. + +============================================================================== +19. Special Characters *latex-special* + +The following characters play a special role in LaTeX and are called "special +printing characters", or simply "special characters". > + # $ % & ~ _ ^ \ { } +Whenever you put one of these special characters into your file, you are doing +something special. If you simply want the character to be printed just as any +other letter, include a \ in front of the character. For example, \$ will +produce $ in your output. + +One exception to this rule is the \ itself because |\\| has its own special +meaning. A \ is produced by typing $\backslash$ in your file. + +Also, \~ means `place a tilde accent over the following letter', so you will +probably want to use |\verb| instead. + *\symbol* +In addition, you can access any character of a font once you know its number +by using the |\symbol| command. For example, the character used for displaying +spaces in the |\verb|* command has the code decimal 32, so it can be typed as +\symbol{32}. + +You can also specify octal numbers with ' or hexadecimal numbers with ", so +the previous example could also be written as \symbol{'40} or \symbol{"20}. + +============================================================================== +20. Splitting the Input *latex-inputting* + +A large document requires a lot of input. Rather than putting the whole input +in a single large file, it's more efficient to split it into several smaller +ones. Regardless of how many separate files you use, there is one that is the +root file; it is the one whose name you type when you run LaTeX. + +|\include| Conditionally include a file +|\includeonly| Determine which files are included +|\input| Unconditionally include a file + +\include{file} *\include* + The \include command is used in conjunction with the + |\includeonly| command for selective inclusion of + files. The file argument is the first name of a file, + denoting `file.tex' . If file is one the file names in + the file list of the |\includeonly| command or if there + is no |\includeonly| command, the \include command is + equivalent to: > + \clearpage \input{file} \clearpage +< + except that if the file `file.tex' does not exist, + then a warning message rather than an error is + produced. If the file is not in the file list, the + \include command is equivalent to |\clearpage|. + + The |\include| command may not appear in the preamble or in a + file read by another |\include| command. + +\includeonly{filelist} *\includeonly* + The |\includeonly| command controls which files will be read in + by an |\include| command. {filelist} should be a + comma-separated list of filenames. Each filename must match + exactly a filename specified in a |\include| command. This + command can only appear in the preamble. + +\input{file} *\input* + The |\input| command causes the indicated file to be read and + processed, exactly as if its contents had been inserted in the + current file at that point. The file name may be a complete + file name with extension or just a first name, in which case + the file `file.tex' is used. +============================================================================== +21. Starting & Ending *latex-start-end* + +Your input file must contain the following commands as a minimum: +\documentclass{class} |\documentclass| +\begin{document} |\begin| +... your text goes here ... +\end{document} |\end| + +where the class selected is one of the valid classes for LaTeX. +See |\classes|for details of the various document classes. + +You may include other LaTeX commands between the |\documentclass| and the +\begin{document} commands (i.e., in the `preamble'). +============================================================================== +22. Table of Contents *latex-toc* + + *\tableofcontents* +A table of contents is produced with the |\tableofcontents| command. You put +the command right where you want the table of contents to go; LaTeX does the +rest for you. It produces a heading, but it does not automatically start a new +page. If you want a new page after the table of contents, include a |\newpage| +command after the |\tableofcontents| command. + + *\listoffigures* *\listoftables* +There are similar commands |\listoffigures| and |\listoftables| for producing a +list of figures and a list of tables, respectively. Everything works exactly +the same as for the table of contents. + + *\nofiles* +NOTE: If you want any of these items to be generated, you cannot have the +\nofiles command in your document. + +|\addcontentsline| Add an entry to table of contents etc. +|\addtocontents| Add text directly to table of contents file etc. + +\addcontentsline{file}{secunit}{entry} *\addcontentsline* + The |\addcontentsline| command adds an entry to the specified + list or table where: +{file} is the extension of the file on which information is to be + written: + toc (table of contents), + lof (list of figures), + lot (list of tables). +{secunit} controls the formatting of the entry. It should be one of the + following, depending upon the value of the file argument: + toc -- the name of the sectional unit, such as part or + subsection. + lof -- figure + lot -- table +{entry} is the text of the entry. + +\addtocontents{file}{text} *\addtocontents* + The |\addtocontents| command adds text (or formatting commands) + directly to the file that generates the table of contents or + list of figures or tables. +{file} is the extension of the file on which information is to be written: + toc (table of contents), + lof (list of figures), + lot (list of tables). +{text} is the information to be written. + +============================================================================== +23. Terminal Input/Output *latex-terminal* + +|\typein| Read text from the terminal. +|\typeout| Write text to the terminal. + +\typein[cmd]{msg} *\typein* + Prints {msg} on the terminal and causes LaTeX to stop and wait + for you to type a line of input, ending with return. If the + [cmd] argument is missing, the typed input is processed as if + it had been included in the input file in place of the + |\typein| command. If the [cmd] argument is present, it must be + a command name. This command name is then defined or redefined + to be the typed input. + +\typeout{msg} *\typeout* + Prints {msg} on the terminal and in the `.log' file. Commands + in {msg} that are defined with |\newcommand| or |\renewcommand| + are replaced by their definitions before being printed. + + *\space* +LaTeX's usual rules for treating multiple spaces as a single space and +ignoring spaces after a command name apply to {msg}. A |\space| command in {msg} +causes a single space to be printed. A ^^J in {msg} prints a newline. + +============================================================================== +24. Typefaces *latex-typefaces* + +The typeface is specified by giving the "size" and "style". A typeface is also +called a "font". +|font-styles| Select roman, italics etc. +|font-size| Select point size. +|font-lowlevelcommands| Commands for wizards. + +Styles *font-styles* + +The following type style commands are supported by LaTeX. + +These commands are used like: > + \textit{italics text}. +The corresponding command in parenthesis is the "declaration form", which +takes no arguments. The scope of the declaration form lasts until the next +type style command or the end of the current group. + +The declaration forms are cumulative; i.e., you can say: > + \sffamily\bfseries +to get sans serif boldface. + +You can also use the environment form of the declaration forms; e.g.: > + \begin{ttfamily}...\end{ttfamily}. +< +\textrm (\rmfamily) *\textrm* *\rmfamily* + Roman + +\textit (\itshape) *\textit* *\itshape* *\emph* + Emphasis (toggles between |\textit| and |\textrm|). + +\textmd (\mdseries) *\textmd* *\mdseries* + Medium weight (default). The opposite of boldface. + +\textbf (\bfseries) *\textbf* *\bfseries* + Boldface. + +\textup (\upshape) *\textup* *\upshape* + Upright (default). The opposite of slanted. + +\textsl (\slshape) *\textsl* *\slshape* + Slanted. + +\textsf (\sffamily) *\textsf* *\sffamily* + Sans serif. + +\textsc (\scshape) *\textsc* *\scshape* + Small caps. + +\texttt (\ttfamily) *\texttt* *\ttfamily* + Typewriter. + +\textnormal (\normalfont) *\textnormal* *\normalfont* + Main document font. + +\mathrm *\mathrm* + Roman, for use in math mode. + +\mathbf *\mathbf* + Boldface, for use in math mode. + +\mathsf *\mathsf* + Sans serif, for use in math mode. + +\mathtt *\mathtt* + Typewriter, for use in math mode. + +\mathit *\mathit* + Italics, for use in math mode, e.g. variable names with + several letters. + +\mathnormal *\mathnormal* + For use in math mode, e.g. inside another type style + declaration. + +\mathcal *\mathcal* + `Calligraphic' letters, for use in math mode. + + *\mathversion* +In addition, the command \mathversion{bold} can be used for switching to bold +letters and symbols in formulas. \mathversion{normal} restores the default. + +========== +Sizes *font-size* + +The following standard type size commands are supported by LaTeX. + +The commands as listed here are "declaration forms". The scope of the +declaration form lasts until the next type style command or the end of the +current group. + +You can also use the environment form of these commands; e.g. > + \begin{tiny}...\end{tiny} + +\tiny *\tiny* +\scriptsize *\scriptsize* +\footnotesize *\footnotesize* +\small *\small* +\normalsize(default) *\normalsize* +\large *\large* +\Large *\Large* +\LARGE *\LARGE* +\huge *\huge* +\Huge *\Huge* + +========== +Low-level font commands *font-lowlevelcommands* + +These commands are primarily intended for writers of macros and packages. The +commands listed here are only a subset of the available ones. For full +details, you should consult Chapter 7 of The LaTeX Companion. + +\fontencoding{enc} *\fontencoding* + Select font encoding. Valid encodings include OT1 and T1. + +\fontfamily{family} *\fontfamily* + Select font family. Valid families include: + cmr for Computer Modern Roman + cmss for Computer Modern Sans Serif + cmtt for Computer Modern Typewriter + and numerous others. + +\fontseries{series} *\fontseries* + Select font series. Valid series include: + m Medium (normal) + b Bold + c Condensed + bc Bold condensed + bx Bold extended + and various other combinations. + +\fontshape{shape} *\fontshape* + Select font shape. Valid shapes are: + n Upright (normal) + it Italic + sl Slanted (oblique) + sc Small caps + ui Upright italics + ol Outline + The two last shapes are not available for most font families. + +\fontsize{size}{skip} *\fontsize* + Set font size. The first parameter is the font size to switch + to; the second is the \baselineskip to use. The unit of both + parameters defaults to pt. A rule of thumb is that the + baselineskip should be 1.2 times the font size. + +\selectfont *\selectfont* + The changes made by calling the four font commands described + above do not come into effect until |\selectfont| is called. + +\usefont{enc}{family}{series}{shape} *\usefont* + Equivalent to calling |\fontencoding|, |\fontfamily|, + |\fontseries| and |\fontshape| with the given parameters, + followed by |\selectfont|. + +============================================================================== +25. Parameters *latex-parameters* + +The input file specification indicates the file to be formatted; TeX uses +`.tex' as a default file extension. If you omit the input file entirely, TeX +accepts input from the terminal. You specify command options by supplying a +string as a parameter to the command; e.g. > + + latex "\scrollmode\input foo.tex" + +will process `foo.tex' without pausing after every error. + +Output files are always created in the current directory. When you fail to +specify an input file name, TeX bases the output names on the file +specification associated with the logical name TEX_OUTPUT, typically +texput.log. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/vimfiles.latex/doc/tags b/vimfiles.latex/doc/tags new file mode 100644 index 0000000..5841114 --- /dev/null +++ b/vimfiles.latex/doc/tags @@ -0,0 +1,905 @@ +Alph latexhelp.txt /*Alph* +Alt-B latex-suite.txt /*Alt-B* +Alt-C latex-suite.txt /*Alt-C* +Alt-I latex-suite.txt /*Alt-I* +Alt-L latex-suite.txt /*Alt-L* +BibTeX latexhelp.txt /*BibTeX* +IMAP_PutTextWithMovement latex-suite.txt /*IMAP_PutTextWithMovement* +Imap_DeleteEmptyPlaceHolders latex-suite.txt /*Imap_DeleteEmptyPlaceHolders* +Imap_FreezeImap latex-suite.txt /*Imap_FreezeImap* +Imap_PlaceHolderEnd latex-suite.txt /*Imap_PlaceHolderEnd* +Imap_PlaceHolderStart latex-suite.txt /*Imap_PlaceHolderStart* +Imap_StickyPlaceHolders latex-suite.txt /*Imap_StickyPlaceHolders* +Imap_UsePlaceHolders latex-suite.txt /*Imap_UsePlaceHolders* +LaTeX latexhelp.txt /*LaTeX* +Plug_IMAP_DeleteAndJumBack latex-suite.txt /*Plug_IMAP_DeleteAndJumBack* +Plug_IMAP_DeleteAndJumpForward latex-suite.txt /*Plug_IMAP_DeleteAndJumpForward* +Plug_IMAP_JumpBack latex-suite.txt /*Plug_IMAP_JumpBack* +Plug_IMAP_JumpForward latex-suite.txt /*Plug_IMAP_JumpForward* +Plug_Tex_InsertItem latex-suite.txt /*Plug_Tex_InsertItem* +Plug_Tex_LeftRight latex-suite.txt /*Plug_Tex_LeftRight* +Plug_Tex_MathBF latex-suite.txt /*Plug_Tex_MathBF* +Plug_Tex_MathCal latex-suite.txt /*Plug_Tex_MathCal* +Roman latexhelp.txt /*Roman* +TClearCiteHist latex-suite.txt /*TClearCiteHist* +TLook latex-suite.txt /*TLook* +TLookAll latex-suite.txt /*TLookAll* +TLookBib latex-suite.txt /*TLookBib* +TMacro latex-suite.txt /*TMacro* +TMacroDelete latex-suite.txt /*TMacroDelete* +TMacroEdit latex-suite.txt /*TMacroEdit* +TMacroNew latex-suite.txt /*TMacroNew* +TPackage latex-suite.txt /*TPackage* +TPackageUpdate latex-suite.txt /*TPackageUpdate* +TPackageUpdateAll latex-suite.txt /*TPackageUpdateAll* +TPartComp latex-suite.txt /*TPartComp* +TPartView latex-suite.txt /*TPartView* +TSection latex-suite.txt /*TSection* +TSectionAdvanced latex-suite.txt /*TSectionAdvanced* +TTemplate latex-suite.txt /*TTemplate* +Tex_AutoFolding latex-suite.txt /*Tex_AutoFolding* +Tex_BIBINPUTS latex-suite.txt /*Tex_BIBINPUTS* +Tex_CatchVisMapErrors latex-suite.txt /*Tex_CatchVisMapErrors* +Tex_Com_name latex-suite.txt /*Tex_Com_name* +Tex_CompileRule_format latex-suite.txt /*Tex_CompileRule_format* +Tex_Debug latex-suite.txt /*Tex_Debug* +Tex_DefaultTargetFormat latex-suite.txt /*Tex_DefaultTargetFormat* +Tex_Diacritics latex-suite.txt /*Tex_Diacritics* +Tex_Env_name latex-suite.txt /*Tex_Env_name* +Tex_EnvironmentMaps latex-suite.txt /*Tex_EnvironmentMaps* +Tex_EnvironmentMenus latex-suite.txt /*Tex_EnvironmentMenus* +Tex_ExplorerHeight latex-suite.txt /*Tex_ExplorerHeight* +Tex_FoldedCommands latex-suite.txt /*Tex_FoldedCommands* +Tex_FoldedEnvironments latex-suite.txt /*Tex_FoldedEnvironments* +Tex_FoldedMisc latex-suite.txt /*Tex_FoldedMisc* +Tex_FoldedSections latex-suite.txt /*Tex_FoldedSections* +Tex_Folding latex-suite.txt /*Tex_Folding* +Tex_FontMaps latex-suite.txt /*Tex_FontMaps* +Tex_FontMenus latex-suite.txt /*Tex_FontMenus* +Tex_GotoError latex-suite.txt /*Tex_GotoError* +Tex_HotKeyMappings latex-suite.txt /*Tex_HotKeyMappings* +Tex_IgnoreLevel latex-suite.txt /*Tex_IgnoreLevel* +Tex_IgnoredWarnings latex-suite.txt /*Tex_IgnoredWarnings* +Tex_ImageDir latex-suite.txt /*Tex_ImageDir* +Tex_ItemStyle_environment latex-suite.txt /*Tex_ItemStyle_environment* +Tex_Leader latex-suite.txt /*Tex_Leader* +Tex_Leader2 latex-suite.txt /*Tex_Leader2* +Tex_MainFileExpression latex-suite.txt /*Tex_MainFileExpression* +Tex_MainMenuLocation latex-suite.txt /*Tex_MainMenuLocation* +Tex_MathMenus latex-suite.txt /*Tex_MathMenus* +Tex_Menus latex-suite.txt /*Tex_Menus* +Tex_MultipleCompileFormats latex-suite.txt /*Tex_MultipleCompileFormats* +Tex_NestElementMenus latex-suite.txt /*Tex_NestElementMenus* +Tex_NestPackagesMenu latex-suite.txt /*Tex_NestPackagesMenu* +Tex_PackagesMenu latex-suite.txt /*Tex_PackagesMenu* +Tex_ProjectSourceFiles latex-suite.txt /*Tex_ProjectSourceFiles* +Tex_PromptedCommands latex-suite.txt /*Tex_PromptedCommands* +Tex_PromptedEnvironments latex-suite.txt /*Tex_PromptedEnvironments* +Tex_RememberCiteSearch latex-suite.txt /*Tex_RememberCiteSearch* +Tex_SectionMaps latex-suite.txt /*Tex_SectionMaps* +Tex_SectionMenus latex-suite.txt /*Tex_SectionMenus* +Tex_SmartKeyBS latex-suite.txt /*Tex_SmartKeyBS* +Tex_SmartKeyQuote latex-suite.txt /*Tex_SmartKeyQuote* +Tex_TEXINPUTS latex-suite.txt /*Tex_TEXINPUTS* +Tex_UseMakefile latex-suite.txt /*Tex_UseMakefile* +Tex_UseMenuWizard latex-suite.txt /*Tex_UseMenuWizard* +Tex_UsePython latex-suite.txt /*Tex_UsePython* +Tex_UseSimpleLabelSearch latex-suite.txt /*Tex_UseSimpleLabelSearch* +Tex_UseUtfMenus latex-suite.txt /*Tex_UseUtfMenus* +Tex_ViewRuleComplete_format latex-suite.txt /*Tex_ViewRuleComplete_format* +Tex_ViewRule_format latex-suite.txt /*Tex_ViewRule_format* +Tex_ViewerCwindowHeight latex-suite.txt /*Tex_ViewerCwindowHeight* +Tex_ViewerPreviewHeight latex-suite.txt /*Tex_ViewerPreviewHeight* +Tshortcuts latex-suite.txt /*Tshortcuts* +\Alph latexhelp.txt /*\\Alph* +\Huge latexhelp.txt /*\\Huge* +\LARGE latexhelp.txt /*\\LARGE* +\Large latexhelp.txt /*\\Large* +\Roman latexhelp.txt /*\\Roman* +\\ latexhelp.txt /*\\\\* +\\\\ latexhelp.txt /*\\\\\\\\* +\addcontentsline latexhelp.txt /*\\addcontentsline* +\address latexhelp.txt /*\\address* +\addtocontents latexhelp.txt /*\\addtocontents* +\addtocounter latexhelp.txt /*\\addtocounter* +\addtolength latexhelp.txt /*\\addtolength* +\addvspace latexhelp.txt /*\\addvspace* +\alph latexhelp.txt /*\\alph* +\and latexhelp.txt /*\\and* +\appendix latexhelp.txt /*\\appendix* +\arabic latexhelp.txt /*\\arabic* +\author latexhelp.txt /*\\author* +\begin latexhelp.txt /*\\begin* +\bfseries latexhelp.txt /*\\bfseries* +\bibitem latexhelp.txt /*\\bibitem* +\bibliography latexhelp.txt /*\\bibliography* +\bibliographystyle latexhelp.txt /*\\bibliographystyle* +\bigskip latexhelp.txt /*\\bigskip* +\cc latexhelp.txt /*\\cc* +\cdots latexhelp.txt /*\\cdots* +\centering latexhelp.txt /*\\centering* +\chapter latexhelp.txt /*\\chapter* +\circle latexhelp.txt /*\\circle* +\cite latexhelp.txt /*\\cite* +\cleardoublepage latexhelp.txt /*\\cleardoublepage* +\clearpage latexhelp.txt /*\\clearpage* +\cline latexhelp.txt /*\\cline* +\closing latexhelp.txt /*\\closing* +\dashbox latexhelp.txt /*\\dashbox* +\date latexhelp.txt /*\\date* +\ddots latexhelp.txt /*\\ddots* +\depth latexhelp.txt /*\\depth* +\documentclass latexhelp.txt /*\\documentclass* +\dotfill latexhelp.txt /*\\dotfill* +\emph latexhelp.txt /*\\emph* +\end latexhelp.txt /*\\end* +\enlargethispage latexhelp.txt /*\\enlargethispage* +\fbox latexhelp.txt /*\\fbox* +\flushbottom latexhelp.txt /*\\flushbottom* +\fnsymbol latexhelp.txt /*\\fnsymbol* +\fontencoding latexhelp.txt /*\\fontencoding* +\fontfamily latexhelp.txt /*\\fontfamily* +\fontseries latexhelp.txt /*\\fontseries* +\fontshape latexhelp.txt /*\\fontshape* +\fontsize latexhelp.txt /*\\fontsize* +\footnote latexhelp.txt /*\\footnote* +\footnotemark latexhelp.txt /*\\footnotemark* +\footnotesize latexhelp.txt /*\\footnotesize* +\footnotetext latexhelp.txt /*\\footnotetext* +\frac latexhelp.txt /*\\frac* +\frame latexhelp.txt /*\\frame* +\framebox latexhelp.txt /*\\framebox* +\fussy latexhelp.txt /*\\fussy* +\height latexhelp.txt /*\\height* +\hfill latexhelp.txt /*\\hfill* +\hline latexhelp.txt /*\\hline* +\hrulefill latexhelp.txt /*\\hrulefill* +\hspace latexhelp.txt /*\\hspace* +\huge latexhelp.txt /*\\huge* +\hyphenation latexhelp.txt /*\\hyphenation* +\include latexhelp.txt /*\\include* +\includeonly latexhelp.txt /*\\includeonly* +\indent latexhelp.txt /*\\indent* +\input latexhelp.txt /*\\input* +\item latexhelp.txt /*\\item* +\itshape latexhelp.txt /*\\itshape* +\kill latexhelp.txt /*\\kill* +\label latexhelp.txt /*\\label* +\large latexhelp.txt /*\\large* +\ldots latexhelp.txt /*\\ldots* +\lefteqn latexhelp.txt /*\\lefteqn* +\letter latexhelp.txt /*\\letter* +\line latexhelp.txt /*\\line* +\linebreak latexhelp.txt /*\\linebreak* +\linethickness latexhelp.txt /*\\linethickness* +\listoffigures latexhelp.txt /*\\listoffigures* +\listoftables latexhelp.txt /*\\listoftables* +\location latexhelp.txt /*\\location* +\lrbox latexhelp.txt /*\\lrbox* +\makebox latexhelp.txt /*\\makebox* +\makelabels latexhelp.txt /*\\makelabels* +\maketitle latexhelp.txt /*\\maketitle* +\marginpar latexhelp.txt /*\\marginpar* +\markboth latexhelp.txt /*\\markboth* +\markright latexhelp.txt /*\\markright* +\mathbf latexhelp.txt /*\\mathbf* +\mathcal latexhelp.txt /*\\mathcal* +\mathit latexhelp.txt /*\\mathit* +\mathnormal latexhelp.txt /*\\mathnormal* +\mathrm latexhelp.txt /*\\mathrm* +\mathsf latexhelp.txt /*\\mathsf* +\mathtt latexhelp.txt /*\\mathtt* +\mathversion latexhelp.txt /*\\mathversion* +\mbox latexhelp.txt /*\\mbox* +\mdseries latexhelp.txt /*\\mdseries* +\medskip latexhelp.txt /*\\medskip* +\multicolumn latexhelp.txt /*\\multicolumn* +\multiput latexhelp.txt /*\\multiput* +\name latexhelp.txt /*\\name* +\newcommand latexhelp.txt /*\\newcommand* +\newcounter latexhelp.txt /*\\newcounter* +\newenvironment latexhelp.txt /*\\newenvironment* +\newfont latexhelp.txt /*\\newfont* +\newlength latexhelp.txt /*\\newlength* +\newline latexhelp.txt /*\\newline* +\newpage latexhelp.txt /*\\newpage* +\newsavebox latexhelp.txt /*\\newsavebox* +\newtheorem latexhelp.txt /*\\newtheorem* +\nocite latexhelp.txt /*\\nocite* +\nofiles latexhelp.txt /*\\nofiles* +\noindent latexhelp.txt /*\\noindent* +\nolinebreak latexhelp.txt /*\\nolinebreak* +\nonumber latexhelp.txt /*\\nonumber* +\nopagebreak latexhelp.txt /*\\nopagebreak* +\normalfont latexhelp.txt /*\\normalfont* +\normalsize latexhelp.txt /*\\normalsize* +\onecolumn latexhelp.txt /*\\onecolumn* +\opening latexhelp.txt /*\\opening* +\oval latexhelp.txt /*\\oval* +\overbrace latexhelp.txt /*\\overbrace* +\overline latexhelp.txt /*\\overline* +\pagebreak latexhelp.txt /*\\pagebreak* +\pagenumbering latexhelp.txt /*\\pagenumbering* +\pageref latexhelp.txt /*\\pageref* +\pagestyle latexhelp.txt /*\\pagestyle* +\par latexhelp.txt /*\\par* +\paragraph latexhelp.txt /*\\paragraph* +\parbox latexhelp.txt /*\\parbox* +\part latexhelp.txt /*\\part* +\picture-framebox latexhelp.txt /*\\picture-framebox* +\ps latexhelp.txt /*\\ps* +\pushtabs latexhelp.txt /*\\pushtabs* +\put latexhelp.txt /*\\put* +\raggedbottom latexhelp.txt /*\\raggedbottom* +\raggedleft latexhelp.txt /*\\raggedleft* +\raggedright latexhelp.txt /*\\raggedright* +\raisebox latexhelp.txt /*\\raisebox* +\ref latexhelp.txt /*\\ref* +\refstepcounter latexhelp.txt /*\\refstepcounter* +\renewcommand latexhelp.txt /*\\renewcommand* +\renewenvironment latexhelp.txt /*\\renewenvironment* +\reversemarginpar latexhelp.txt /*\\reversemarginpar* +\rmfamily latexhelp.txt /*\\rmfamily* +\roman latexhelp.txt /*\\roman* +\rule latexhelp.txt /*\\rule* +\savebox latexhelp.txt /*\\savebox* +\sbox latexhelp.txt /*\\sbox* +\scriptsize latexhelp.txt /*\\scriptsize* +\scshape latexhelp.txt /*\\scshape* +\section latexhelp.txt /*\\section* +\selectfont latexhelp.txt /*\\selectfont* +\setcounter latexhelp.txt /*\\setcounter* +\setlength latexhelp.txt /*\\setlength* +\settodepth latexhelp.txt /*\\settodepth* +\settoheight latexhelp.txt /*\\settoheight* +\settowidth latexhelp.txt /*\\settowidth* +\sffamily latexhelp.txt /*\\sffamily* +\shortstack latexhelp.txt /*\\shortstack* +\signature latexhelp.txt /*\\signature* +\sloppy latexhelp.txt /*\\sloppy* +\slshape latexhelp.txt /*\\slshape* +\small latexhelp.txt /*\\small* +\smallskip latexhelp.txt /*\\smallskip* +\space latexhelp.txt /*\\space* +\sqrt latexhelp.txt /*\\sqrt* +\startbreaks latexhelp.txt /*\\startbreaks* +\stepcounter latexhelp.txt /*\\stepcounter* +\stopbreaks latexhelp.txt /*\\stopbreaks* +\subparagraph latexhelp.txt /*\\subparagraph* +\subsection latexhelp.txt /*\\subsection* +\subsubsection latexhelp.txt /*\\subsubsection* +\symbol latexhelp.txt /*\\symbol* +\table latexhelp.txt /*\\table* +\tableofcontents latexhelp.txt /*\\tableofcontents* +\telephone latexhelp.txt /*\\telephone* +\textbf latexhelp.txt /*\\textbf* +\textit latexhelp.txt /*\\textit* +\textmd latexhelp.txt /*\\textmd* +\textnormal latexhelp.txt /*\\textnormal* +\textrm latexhelp.txt /*\\textrm* +\textsc latexhelp.txt /*\\textsc* +\textsf latexhelp.txt /*\\textsf* +\textsl latexhelp.txt /*\\textsl* +\texttt latexhelp.txt /*\\texttt* +\textup latexhelp.txt /*\\textup* +\thanks latexhelp.txt /*\\thanks* +\thebibliography latexhelp.txt /*\\thebibliography* +\thispagestyle latexhelp.txt /*\\thispagestyle* +\tiny latexhelp.txt /*\\tiny* +\title latexhelp.txt /*\\title* +\totalheight latexhelp.txt /*\\totalheight* +\ttfamily latexhelp.txt /*\\ttfamily* +\twocolumn latexhelp.txt /*\\twocolumn* +\typein latexhelp.txt /*\\typein* +\typeout latexhelp.txt /*\\typeout* +\underbrace latexhelp.txt /*\\underbrace* +\underline latexhelp.txt /*\\underline* +\upshape latexhelp.txt /*\\upshape* +\usebox latexhelp.txt /*\\usebox* +\usecounter latexhelp.txt /*\\usecounter* +\usefont latexhelp.txt /*\\usefont* +\usepackage latexhelp.txt /*\\usepackage* +\value latexhelp.txt /*\\value* +\vdots latexhelp.txt /*\\vdots* +\vector latexhelp.txt /*\\vector* +\verb latexhelp.txt /*\\verb* +\vfill latexhelp.txt /*\\vfill* +\vline latexhelp.txt /*\\vline* +\vspace latexhelp.txt /*\\vspace* +\width latexhelp.txt /*\\width* +adding-bib-options latex-suite.txt /*adding-bib-options* +alph latexhelp.txt /*alph* +altkey-mappings latex-suite.txt /*altkey-mappings* +arabic latexhelp.txt /*arabic* +array latexhelp.txt /*array* +article-class latexhelp.txt /*article-class* +auc-tex-mappings latex-suite.txt /*auc-tex-mappings* +automatic-package-detection latex-suite.txt /*automatic-package-detection* +bibtex latexhelp.txt /*bibtex* +bibtex-bindings latex-suite.txt /*bibtex-bindings* +book-class latexhelp.txt /*book-class* +center latexhelp.txt /*center* +changing-commands latex-suite.txt /*changing-commands* +changing-environments latex-suite.txt /*changing-environments* +cite-search-caching latex-suite.txt /*cite-search-caching* +compiler-dependency latex-suite.txt /*compiler-dependency* +compiler-output-customization latex-suite.txt /*compiler-output-customization* +compiler-rules latex-suite.txt /*compiler-rules* +compiling-multiple latex-suite.txt /*compiling-multiple* +completion-window-preferences latex-suite.txt /*completion-window-preferences* +custom-macros-menu latex-suite.txt /*custom-macros-menu* +custom-packages latex-suite.txt /*custom-packages* +customize-alt-key-maps latex-suite.txt /*customize-alt-key-maps* +customize-imap-maps latex-suite.txt /*customize-imap-maps* +customizing-compiling latex-suite.txt /*customizing-compiling* +customizing-folding latex-suite.txt /*customizing-folding* +customizing-latex-completion latex-suite.txt /*customizing-latex-completion* +customizing-latex-suite latex-suite.txt /*customizing-latex-suite* +customizing-macros latex-suite.txt /*customizing-macros* +customizing-menus latex-suite.txt /*customizing-menus* +customizing-packages latex-suite.txt /*customizing-packages* +customizing-place-holders latex-suite.txt /*customizing-place-holders* +customizing-smart-keys latex-suite.txt /*customizing-smart-keys* +customizing-viewing latex-suite.txt /*customizing-viewing* +customizing-what-to-fold latex-suite.txt /*customizing-what-to-fold* +default-folding latex-suite.txt /*default-folding* +description latexhelp.txt /*description* +diacritic-mappings latex-suite.txt /*diacritic-mappings* +displaymath latexhelp.txt /*displaymath* +draft latexhelp.txt /*draft* +editing-folding latex-suite.txt /*editing-folding* +empty latexhelp.txt /*empty* +enabling-searching latex-suite.txt /*enabling-searching* +enclosing-commands latex-suite.txt /*enclosing-commands* +enclosing-env-f5 latex-suite.txt /*enclosing-env-f5* +enclosing-env-threeletter latex-suite.txt /*enclosing-env-threeletter* +enclosing-environments latex-suite.txt /*enclosing-environments* +enumerate latexhelp.txt /*enumerate* +environment-mappings latex-suite.txt /*environment-mappings* +eqnarray latexhelp.txt /*eqnarray* +equation latexhelp.txt /*equation* +figure latexhelp.txt /*figure* +final latexhelp.txt /*final* +fleqn latexhelp.txt /*fleqn* +flushleft latexhelp.txt /*flushleft* +flushright latexhelp.txt /*flushright* +fold-setting-adding latex-suite.txt /*fold-setting-adding* +fold-setting-advanced latex-suite.txt /*fold-setting-advanced* +font-lowlevelcommands latexhelp.txt /*font-lowlevelcommands* +font-maps latex-suite.txt /*font-maps* +font-size latexhelp.txt /*font-size* +font-styles latexhelp.txt /*font-styles* +forward-searching latex-suite.txt /*forward-searching* +greek-letter-mappings latex-suite.txt /*greek-letter-mappings* +headings latexhelp.txt /*headings* +hyph- latexhelp.txt /*hyph-* +im_1 imaps.txt /*im_1* +imaps-usage imaps.txt /*imaps-usage* +imaps.txt imaps.txt /*imaps.txt* +imaps.txt-toc imaps.txt /*imaps.txt-toc* +inserting-commands latex-suite.txt /*inserting-commands* +inserting-env-f5 latex-suite.txt /*inserting-env-f5* +inserting-env-shift-f1 latex-suite.txt /*inserting-env-shift-f1* +inserting-env-threeletter latex-suite.txt /*inserting-env-threeletter* +inserting-environments latex-suite.txt /*inserting-environments* +inserting-packages latex-suite.txt /*inserting-packages* +inverse-searching latex-suite.txt /*inverse-searching* +itemize latexhelp.txt /*itemize* +landscape latexhelp.txt /*landscape* +latex latexhelp.txt /*latex* +latex-boxes latexhelp.txt /*latex-boxes* +latex-breaking latexhelp.txt /*latex-breaking* +latex-classes latexhelp.txt /*latex-classes* +latex-command-maps latex-suite.txt /*latex-command-maps* +latex-commands latexhelp.txt /*latex-commands* +latex-compiling latex-suite.txt /*latex-compiling* +latex-completion latex-suite.txt /*latex-completion* +latex-completion-cite latex-suite.txt /*latex-completion-cite* +latex-counters latexhelp.txt /*latex-counters* +latex-definitions latexhelp.txt /*latex-definitions* +latex-environments latexhelp.txt /*latex-environments* +latex-folding latex-suite.txt /*latex-folding* +latex-footnotes latexhelp.txt /*latex-footnotes* +latex-hor-space latexhelp.txt /*latex-hor-space* +latex-inputting latexhelp.txt /*latex-inputting* +latex-layout latexhelp.txt /*latex-layout* +latex-lengths latexhelp.txt /*latex-lengths* +latex-letters latexhelp.txt /*latex-letters* +latex-macros latex-suite.txt /*latex-macros* +latex-margin-notes latexhelp.txt /*latex-margin-notes* +latex-master-file latex-suite.txt /*latex-master-file* +latex-master-file-specification latex-suite.txt /*latex-master-file-specification* +latex-math latexhelp.txt /*latex-math* +latex-modes latexhelp.txt /*latex-modes* +latex-package-scanning latex-suite.txt /*latex-package-scanning* +latex-packages latex-suite.txt /*latex-packages* +latex-page-styles latexhelp.txt /*latex-page-styles* +latex-paragraphs latexhelp.txt /*latex-paragraphs* +latex-parameters latexhelp.txt /*latex-parameters* +latex-project latex-suite.txt /*latex-project* +latex-project-example latex-suite.txt /*latex-project-example* +latex-project-settings latex-suite.txt /*latex-project-settings* +latex-references latexhelp.txt /*latex-references* +latex-sectioning latexhelp.txt /*latex-sectioning* +latex-spaces-boxes latexhelp.txt /*latex-spaces-boxes* +latex-special latexhelp.txt /*latex-special* +latex-start-end latexhelp.txt /*latex-start-end* +latex-suite-commands latex-suite.txt /*latex-suite-commands* +latex-suite-commands-maps latex-suite.txt /*latex-suite-commands-maps* +latex-suite-credits latex-suite.txt /*latex-suite-credits* +latex-suite-maintainer latex-suite.txt /*latex-suite-maintainer* +latex-suite-maps latex-suite.txt /*latex-suite-maps* +latex-suite-quickstart.txt latex-suite-quickstart.txt /*latex-suite-quickstart.txt* +latex-suite-quickstart.txt-toc latex-suite-quickstart.txt /*latex-suite-quickstart.txt-toc* +latex-suite-templates latex-suite.txt /*latex-suite-templates* +latex-suite.txt latex-suite.txt /*latex-suite.txt* +latex-suite.txt-toc latex-suite.txt /*latex-suite.txt-toc* +latex-terminal latexhelp.txt /*latex-terminal* +latex-toc latexhelp.txt /*latex-toc* +latex-typefaces latexhelp.txt /*latex-typefaces* +latex-ver-space latexhelp.txt /*latex-ver-space* +latex-viewing latex-suite.txt /*latex-viewing* +latex-viewing-rules latex-suite.txt /*latex-viewing-rules* +latexhelp.txt latexhelp.txt /*latexhelp.txt* +leqno latexhelp.txt /*leqno* +letter-class latexhelp.txt /*letter-class* +list latexhelp.txt /*list* +lq_1 latex-suite-quickstart.txt /*lq_1* +lq_10 latex-suite-quickstart.txt /*lq_10* +lq_2 latex-suite-quickstart.txt /*lq_2* +lq_3 latex-suite-quickstart.txt /*lq_3* +lq_4 latex-suite-quickstart.txt /*lq_4* +lq_5 latex-suite-quickstart.txt /*lq_5* +lq_6 latex-suite-quickstart.txt /*lq_6* +lq_7 latex-suite-quickstart.txt /*lq_7* +lq_8 latex-suite-quickstart.txt /*lq_8* +lq_8_1 latex-suite-quickstart.txt /*lq_8_1* +lq_9 latex-suite-quickstart.txt /*lq_9* +lq_9_1 latex-suite-quickstart.txt /*lq_9_1* +lq_9_2 latex-suite-quickstart.txt /*lq_9_2* +lq_a_bc latex-suite-quickstart.txt /*lq_a_bc* +lq_a_bd latex-suite-quickstart.txt /*lq_a_bd* +lq_a_be latex-suite-quickstart.txt /*lq_a_be* +lq_a_bf latex-suite-quickstart.txt /*lq_a_bf* +lq_a_bg latex-suite-quickstart.txt /*lq_a_bg* +lq_a_bh latex-suite-quickstart.txt /*lq_a_bh* +lq_a_bi latex-suite-quickstart.txt /*lq_a_bi* +lq_a_bj latex-suite-quickstart.txt /*lq_a_bj* +lq_a_bk latex-suite-quickstart.txt /*lq_a_bk* +lq_a_bl latex-suite-quickstart.txt /*lq_a_bl* +lq_a_bm latex-suite-quickstart.txt /*lq_a_bm* +lq_a_bn latex-suite-quickstart.txt /*lq_a_bn* +lq_a_bo latex-suite-quickstart.txt /*lq_a_bo* +lq_u_1 latex-suite-quickstart.txt /*lq_u_1* +lq_u_2 latex-suite-quickstart.txt /*lq_u_2* +lq_u_3 latex-suite-quickstart.txt /*lq_u_3* +lq_u_4 latex-suite-quickstart.txt /*lq_u_4* +lq_u_5 latex-suite-quickstart.txt /*lq_u_5* +lq_u_6 latex-suite-quickstart.txt /*lq_u_6* +lq_u_7 latex-suite-quickstart.txt /*lq_u_7* +lq_u_8 latex-suite-quickstart.txt /*lq_u_8* +lq_u_9 latex-suite-quickstart.txt /*lq_u_9* +lr-mode latexhelp.txt /*lr-mode* +ls-completion-custom latex-suite.txt /*ls-completion-custom* +ls-completion-ref latex-suite.txt /*ls-completion-ref* +ls-completion-usage latex-suite.txt /*ls-completion-usage* +ls-filename-completion latex-suite.txt /*ls-filename-completion* +ls-general-purpose-settings latex-suite.txt /*ls-general-purpose-settings* +ls-imap-f7 latex-suite.txt /*ls-imap-f7* +ls-imap-s-f7 latex-suite.txt /*ls-imap-s-f7* +ls-imaps-syntax latex-suite.txt /*ls-imaps-syntax* +ls-new-macros latex-suite.txt /*ls-new-macros* +ls-set-grepprg latex-suite.txt /*ls-set-grepprg* +ls-vmap-f7 latex-suite.txt /*ls-vmap-f7* +ls_1 latex-suite.txt /*ls_1* +ls_10 latex-suite.txt /*ls_10* +ls_10_1 latex-suite.txt /*ls_10_1* +ls_10_1_1 latex-suite.txt /*ls_10_1_1* +ls_10_1_2 latex-suite.txt /*ls_10_1_2* +ls_10_2 latex-suite.txt /*ls_10_2* +ls_10_2_1 latex-suite.txt /*ls_10_2_1* +ls_10_2_10 latex-suite.txt /*ls_10_2_10* +ls_10_2_11 latex-suite.txt /*ls_10_2_11* +ls_10_2_12 latex-suite.txt /*ls_10_2_12* +ls_10_2_13 latex-suite.txt /*ls_10_2_13* +ls_10_2_14 latex-suite.txt /*ls_10_2_14* +ls_10_2_15 latex-suite.txt /*ls_10_2_15* +ls_10_2_16 latex-suite.txt /*ls_10_2_16* +ls_10_2_2 latex-suite.txt /*ls_10_2_2* +ls_10_2_3 latex-suite.txt /*ls_10_2_3* +ls_10_2_4 latex-suite.txt /*ls_10_2_4* +ls_10_2_5 latex-suite.txt /*ls_10_2_5* +ls_10_2_6 latex-suite.txt /*ls_10_2_6* +ls_10_2_7 latex-suite.txt /*ls_10_2_7* +ls_10_2_8 latex-suite.txt /*ls_10_2_8* +ls_10_2_9 latex-suite.txt /*ls_10_2_9* +ls_11 latex-suite.txt /*ls_11* +ls_11_1 latex-suite.txt /*ls_11_1* +ls_11_10 latex-suite.txt /*ls_11_10* +ls_11_10_1 latex-suite.txt /*ls_11_10_1* +ls_11_1_1 latex-suite.txt /*ls_11_1_1* +ls_11_1_2 latex-suite.txt /*ls_11_1_2* +ls_11_2 latex-suite.txt /*ls_11_2* +ls_11_2_1 latex-suite.txt /*ls_11_2_1* +ls_11_2_2 latex-suite.txt /*ls_11_2_2* +ls_11_2_3 latex-suite.txt /*ls_11_2_3* +ls_11_2_4 latex-suite.txt /*ls_11_2_4* +ls_11_3 latex-suite.txt /*ls_11_3* +ls_11_3_1 latex-suite.txt /*ls_11_3_1* +ls_11_3_10 latex-suite.txt /*ls_11_3_10* +ls_11_3_11 latex-suite.txt /*ls_11_3_11* +ls_11_3_12 latex-suite.txt /*ls_11_3_12* +ls_11_3_13 latex-suite.txt /*ls_11_3_13* +ls_11_3_2 latex-suite.txt /*ls_11_3_2* +ls_11_3_3 latex-suite.txt /*ls_11_3_3* +ls_11_3_4 latex-suite.txt /*ls_11_3_4* +ls_11_3_5 latex-suite.txt /*ls_11_3_5* +ls_11_3_6 latex-suite.txt /*ls_11_3_6* +ls_11_3_7 latex-suite.txt /*ls_11_3_7* +ls_11_3_8 latex-suite.txt /*ls_11_3_8* +ls_11_3_9 latex-suite.txt /*ls_11_3_9* +ls_11_4 latex-suite.txt /*ls_11_4* +ls_11_4_1 latex-suite.txt /*ls_11_4_1* +ls_11_4_2 latex-suite.txt /*ls_11_4_2* +ls_11_5 latex-suite.txt /*ls_11_5* +ls_11_5_1 latex-suite.txt /*ls_11_5_1* +ls_11_5_2 latex-suite.txt /*ls_11_5_2* +ls_11_5_3 latex-suite.txt /*ls_11_5_3* +ls_11_5_4 latex-suite.txt /*ls_11_5_4* +ls_11_5_5 latex-suite.txt /*ls_11_5_5* +ls_11_6 latex-suite.txt /*ls_11_6* +ls_11_6_1 latex-suite.txt /*ls_11_6_1* +ls_11_6_2 latex-suite.txt /*ls_11_6_2* +ls_11_6_3 latex-suite.txt /*ls_11_6_3* +ls_11_6_4 latex-suite.txt /*ls_11_6_4* +ls_11_6_5 latex-suite.txt /*ls_11_6_5* +ls_11_6_6 latex-suite.txt /*ls_11_6_6* +ls_11_6_7 latex-suite.txt /*ls_11_6_7* +ls_11_6_8 latex-suite.txt /*ls_11_6_8* +ls_11_7 latex-suite.txt /*ls_11_7* +ls_11_7_1 latex-suite.txt /*ls_11_7_1* +ls_11_7_2 latex-suite.txt /*ls_11_7_2* +ls_11_8 latex-suite.txt /*ls_11_8* +ls_11_8_1 latex-suite.txt /*ls_11_8_1* +ls_11_8_2 latex-suite.txt /*ls_11_8_2* +ls_11_8_3 latex-suite.txt /*ls_11_8_3* +ls_11_8_4 latex-suite.txt /*ls_11_8_4* +ls_11_8_5 latex-suite.txt /*ls_11_8_5* +ls_11_8_6 latex-suite.txt /*ls_11_8_6* +ls_11_8_7 latex-suite.txt /*ls_11_8_7* +ls_11_9 latex-suite.txt /*ls_11_9* +ls_11_9_1 latex-suite.txt /*ls_11_9_1* +ls_11_9_2 latex-suite.txt /*ls_11_9_2* +ls_12 latex-suite.txt /*ls_12* +ls_2 latex-suite.txt /*ls_2* +ls_3 latex-suite.txt /*ls_3* +ls_3_1 latex-suite.txt /*ls_3_1* +ls_3_10 latex-suite.txt /*ls_3_10* +ls_3_10_1 latex-suite.txt /*ls_3_10_1* +ls_3_10_2 latex-suite.txt /*ls_3_10_2* +ls_3_10_3 latex-suite.txt /*ls_3_10_3* +ls_3_10_4 latex-suite.txt /*ls_3_10_4* +ls_3_11 latex-suite.txt /*ls_3_11* +ls_3_12 latex-suite.txt /*ls_3_12* +ls_3_12_1 latex-suite.txt /*ls_3_12_1* +ls_3_12_2 latex-suite.txt /*ls_3_12_2* +ls_3_1_1 latex-suite.txt /*ls_3_1_1* +ls_3_1_1_1 latex-suite.txt /*ls_3_1_1_1* +ls_3_1_1_2 latex-suite.txt /*ls_3_1_1_2* +ls_3_1_1_3 latex-suite.txt /*ls_3_1_1_3* +ls_3_1_2 latex-suite.txt /*ls_3_1_2* +ls_3_1_2_1 latex-suite.txt /*ls_3_1_2_1* +ls_3_1_2_2 latex-suite.txt /*ls_3_1_2_2* +ls_3_1_3 latex-suite.txt /*ls_3_1_3* +ls_3_2 latex-suite.txt /*ls_3_2* +ls_3_2_1 latex-suite.txt /*ls_3_2_1* +ls_3_2_2 latex-suite.txt /*ls_3_2_2* +ls_3_2_3 latex-suite.txt /*ls_3_2_3* +ls_3_3 latex-suite.txt /*ls_3_3* +ls_3_4 latex-suite.txt /*ls_3_4* +ls_3_5 latex-suite.txt /*ls_3_5* +ls_3_6 latex-suite.txt /*ls_3_6* +ls_3_7 latex-suite.txt /*ls_3_7* +ls_3_8 latex-suite.txt /*ls_3_8* +ls_3_8_1 latex-suite.txt /*ls_3_8_1* +ls_3_9 latex-suite.txt /*ls_3_9* +ls_4 latex-suite.txt /*ls_4* +ls_4_1 latex-suite.txt /*ls_4_1* +ls_4_2 latex-suite.txt /*ls_4_2* +ls_4_3 latex-suite.txt /*ls_4_3* +ls_4_3_1 latex-suite.txt /*ls_4_3_1* +ls_4_4 latex-suite.txt /*ls_4_4* +ls_4_4_1 latex-suite.txt /*ls_4_4_1* +ls_4_4_2 latex-suite.txt /*ls_4_4_2* +ls_5 latex-suite.txt /*ls_5* +ls_5_1 latex-suite.txt /*ls_5_1* +ls_5_2 latex-suite.txt /*ls_5_2* +ls_5_3 latex-suite.txt /*ls_5_3* +ls_5_3_1 latex-suite.txt /*ls_5_3_1* +ls_5_4 latex-suite.txt /*ls_5_4* +ls_5_5 latex-suite.txt /*ls_5_5* +ls_6 latex-suite.txt /*ls_6* +ls_6_1 latex-suite.txt /*ls_6_1* +ls_6_2 latex-suite.txt /*ls_6_2* +ls_6_3 latex-suite.txt /*ls_6_3* +ls_6_4 latex-suite.txt /*ls_6_4* +ls_6_5 latex-suite.txt /*ls_6_5* +ls_7 latex-suite.txt /*ls_7* +ls_7_1 latex-suite.txt /*ls_7_1* +ls_7_2 latex-suite.txt /*ls_7_2* +ls_7_3 latex-suite.txt /*ls_7_3* +ls_8 latex-suite.txt /*ls_8* +ls_8_1 latex-suite.txt /*ls_8_1* +ls_8_2 latex-suite.txt /*ls_8_2* +ls_8_2_1 latex-suite.txt /*ls_8_2_1* +ls_8_2_2 latex-suite.txt /*ls_8_2_2* +ls_8_2_3 latex-suite.txt /*ls_8_2_3* +ls_8_2_4 latex-suite.txt /*ls_8_2_4* +ls_8_2_5 latex-suite.txt /*ls_8_2_5* +ls_8_3 latex-suite.txt /*ls_8_3* +ls_9 latex-suite.txt /*ls_9* +ls_9_1 latex-suite.txt /*ls_9_1* +ls_9_2 latex-suite.txt /*ls_9_2* +ls_a_bA latex-suite.txt /*ls_a_bA* +ls_a_bB latex-suite.txt /*ls_a_bB* +ls_a_bC latex-suite.txt /*ls_a_bC* +ls_a_bD latex-suite.txt /*ls_a_bD* +ls_a_bE latex-suite.txt /*ls_a_bE* +ls_a_bF latex-suite.txt /*ls_a_bF* +ls_a_bG latex-suite.txt /*ls_a_bG* +ls_a_bH latex-suite.txt /*ls_a_bH* +ls_a_bI latex-suite.txt /*ls_a_bI* +ls_a_bJ latex-suite.txt /*ls_a_bJ* +ls_a_bK latex-suite.txt /*ls_a_bK* +ls_a_bL latex-suite.txt /*ls_a_bL* +ls_a_bM latex-suite.txt /*ls_a_bM* +ls_a_bN latex-suite.txt /*ls_a_bN* +ls_a_bO latex-suite.txt /*ls_a_bO* +ls_a_bP latex-suite.txt /*ls_a_bP* +ls_a_bQ latex-suite.txt /*ls_a_bQ* +ls_a_bR latex-suite.txt /*ls_a_bR* +ls_a_bS latex-suite.txt /*ls_a_bS* +ls_a_bT latex-suite.txt /*ls_a_bT* +ls_a_bU latex-suite.txt /*ls_a_bU* +ls_a_bV latex-suite.txt /*ls_a_bV* +ls_a_bW latex-suite.txt /*ls_a_bW* +ls_a_bX latex-suite.txt /*ls_a_bX* +ls_a_bY latex-suite.txt /*ls_a_bY* +ls_a_bZ latex-suite.txt /*ls_a_bZ* +ls_a_bc latex-suite.txt /*ls_a_bc* +ls_a_bd latex-suite.txt /*ls_a_bd* +ls_a_be latex-suite.txt /*ls_a_be* +ls_a_bf latex-suite.txt /*ls_a_bf* +ls_a_bg latex-suite.txt /*ls_a_bg* +ls_a_bh latex-suite.txt /*ls_a_bh* +ls_a_bi latex-suite.txt /*ls_a_bi* +ls_a_bj latex-suite.txt /*ls_a_bj* +ls_a_bk latex-suite.txt /*ls_a_bk* +ls_a_bl latex-suite.txt /*ls_a_bl* +ls_a_bm latex-suite.txt /*ls_a_bm* +ls_a_bn latex-suite.txt /*ls_a_bn* +ls_a_bo latex-suite.txt /*ls_a_bo* +ls_a_bp latex-suite.txt /*ls_a_bp* +ls_a_bq latex-suite.txt /*ls_a_bq* +ls_a_br latex-suite.txt /*ls_a_br* +ls_a_bs latex-suite.txt /*ls_a_bs* +ls_a_bt latex-suite.txt /*ls_a_bt* +ls_a_bu latex-suite.txt /*ls_a_bu* +ls_a_bv latex-suite.txt /*ls_a_bv* +ls_a_bw latex-suite.txt /*ls_a_bw* +ls_a_bx latex-suite.txt /*ls_a_bx* +ls_a_by latex-suite.txt /*ls_a_by* +ls_a_bz latex-suite.txt /*ls_a_bz* +ls_a_cA latex-suite.txt /*ls_a_cA* +ls_a_cB latex-suite.txt /*ls_a_cB* +ls_a_cC latex-suite.txt /*ls_a_cC* +ls_a_cD latex-suite.txt /*ls_a_cD* +ls_a_cE latex-suite.txt /*ls_a_cE* +ls_a_cF latex-suite.txt /*ls_a_cF* +ls_a_cG latex-suite.txt /*ls_a_cG* +ls_a_cH latex-suite.txt /*ls_a_cH* +ls_a_cI latex-suite.txt /*ls_a_cI* +ls_a_cJ latex-suite.txt /*ls_a_cJ* +ls_a_cK latex-suite.txt /*ls_a_cK* +ls_a_cL latex-suite.txt /*ls_a_cL* +ls_a_cM latex-suite.txt /*ls_a_cM* +ls_a_cN latex-suite.txt /*ls_a_cN* +ls_a_cO latex-suite.txt /*ls_a_cO* +ls_a_cP latex-suite.txt /*ls_a_cP* +ls_a_cQ latex-suite.txt /*ls_a_cQ* +ls_a_cR latex-suite.txt /*ls_a_cR* +ls_a_cS latex-suite.txt /*ls_a_cS* +ls_a_cT latex-suite.txt /*ls_a_cT* +ls_a_cU latex-suite.txt /*ls_a_cU* +ls_a_cV latex-suite.txt /*ls_a_cV* +ls_a_cW latex-suite.txt /*ls_a_cW* +ls_a_cX latex-suite.txt /*ls_a_cX* +ls_a_cY latex-suite.txt /*ls_a_cY* +ls_a_cZ latex-suite.txt /*ls_a_cZ* +ls_a_ca latex-suite.txt /*ls_a_ca* +ls_a_cb latex-suite.txt /*ls_a_cb* +ls_a_cc latex-suite.txt /*ls_a_cc* +ls_a_cd latex-suite.txt /*ls_a_cd* +ls_a_ce latex-suite.txt /*ls_a_ce* +ls_a_cf latex-suite.txt /*ls_a_cf* +ls_a_cg latex-suite.txt /*ls_a_cg* +ls_a_ch latex-suite.txt /*ls_a_ch* +ls_a_ci latex-suite.txt /*ls_a_ci* +ls_a_cj latex-suite.txt /*ls_a_cj* +ls_a_ck latex-suite.txt /*ls_a_ck* +ls_a_cl latex-suite.txt /*ls_a_cl* +ls_a_cm latex-suite.txt /*ls_a_cm* +ls_a_cn latex-suite.txt /*ls_a_cn* +ls_a_co latex-suite.txt /*ls_a_co* +ls_a_cp latex-suite.txt /*ls_a_cp* +ls_a_cq latex-suite.txt /*ls_a_cq* +ls_a_cr latex-suite.txt /*ls_a_cr* +ls_a_cs latex-suite.txt /*ls_a_cs* +ls_a_ct latex-suite.txt /*ls_a_ct* +ls_a_cu latex-suite.txt /*ls_a_cu* +ls_a_cv latex-suite.txt /*ls_a_cv* +ls_a_cw latex-suite.txt /*ls_a_cw* +ls_a_cx latex-suite.txt /*ls_a_cx* +ls_a_cy latex-suite.txt /*ls_a_cy* +ls_a_cz latex-suite.txt /*ls_a_cz* +ls_a_dA latex-suite.txt /*ls_a_dA* +ls_a_dB latex-suite.txt /*ls_a_dB* +ls_a_dC latex-suite.txt /*ls_a_dC* +ls_a_dD latex-suite.txt /*ls_a_dD* +ls_a_dE latex-suite.txt /*ls_a_dE* +ls_a_dF latex-suite.txt /*ls_a_dF* +ls_a_dG latex-suite.txt /*ls_a_dG* +ls_a_dH latex-suite.txt /*ls_a_dH* +ls_a_dI latex-suite.txt /*ls_a_dI* +ls_a_dJ latex-suite.txt /*ls_a_dJ* +ls_a_dK latex-suite.txt /*ls_a_dK* +ls_a_dL latex-suite.txt /*ls_a_dL* +ls_a_dM latex-suite.txt /*ls_a_dM* +ls_a_dN latex-suite.txt /*ls_a_dN* +ls_a_dO latex-suite.txt /*ls_a_dO* +ls_a_dP latex-suite.txt /*ls_a_dP* +ls_a_dQ latex-suite.txt /*ls_a_dQ* +ls_a_dR latex-suite.txt /*ls_a_dR* +ls_a_dS latex-suite.txt /*ls_a_dS* +ls_a_dT latex-suite.txt /*ls_a_dT* +ls_a_dU latex-suite.txt /*ls_a_dU* +ls_a_dV latex-suite.txt /*ls_a_dV* +ls_a_dW latex-suite.txt /*ls_a_dW* +ls_a_dX latex-suite.txt /*ls_a_dX* +ls_a_dY latex-suite.txt /*ls_a_dY* +ls_a_dZ latex-suite.txt /*ls_a_dZ* +ls_a_da latex-suite.txt /*ls_a_da* +ls_a_db latex-suite.txt /*ls_a_db* +ls_a_dc latex-suite.txt /*ls_a_dc* +ls_a_dd latex-suite.txt /*ls_a_dd* +ls_a_de latex-suite.txt /*ls_a_de* +ls_a_df latex-suite.txt /*ls_a_df* +ls_a_dg latex-suite.txt /*ls_a_dg* +ls_a_dh latex-suite.txt /*ls_a_dh* +ls_a_di latex-suite.txt /*ls_a_di* +ls_a_dj latex-suite.txt /*ls_a_dj* +ls_a_dk latex-suite.txt /*ls_a_dk* +ls_a_dl latex-suite.txt /*ls_a_dl* +ls_a_dm latex-suite.txt /*ls_a_dm* +ls_a_dn latex-suite.txt /*ls_a_dn* +ls_a_do latex-suite.txt /*ls_a_do* +ls_a_dp latex-suite.txt /*ls_a_dp* +ls_a_dq latex-suite.txt /*ls_a_dq* +ls_a_dr latex-suite.txt /*ls_a_dr* +ls_a_ds latex-suite.txt /*ls_a_ds* +ls_a_dt latex-suite.txt /*ls_a_dt* +ls_a_du latex-suite.txt /*ls_a_du* +ls_a_dv latex-suite.txt /*ls_a_dv* +ls_a_dw latex-suite.txt /*ls_a_dw* +ls_a_dx latex-suite.txt /*ls_a_dx* +ls_a_dy latex-suite.txt /*ls_a_dy* +ls_a_dz latex-suite.txt /*ls_a_dz* +ls_a_eA latex-suite.txt /*ls_a_eA* +ls_a_eB latex-suite.txt /*ls_a_eB* +ls_a_eC latex-suite.txt /*ls_a_eC* +ls_a_eD latex-suite.txt /*ls_a_eD* +ls_a_eE latex-suite.txt /*ls_a_eE* +ls_a_eF latex-suite.txt /*ls_a_eF* +ls_a_eG latex-suite.txt /*ls_a_eG* +ls_a_ea latex-suite.txt /*ls_a_ea* +ls_a_eb latex-suite.txt /*ls_a_eb* +ls_a_ec latex-suite.txt /*ls_a_ec* +ls_a_ed latex-suite.txt /*ls_a_ed* +ls_a_ee latex-suite.txt /*ls_a_ee* +ls_a_ef latex-suite.txt /*ls_a_ef* +ls_a_eg latex-suite.txt /*ls_a_eg* +ls_a_eh latex-suite.txt /*ls_a_eh* +ls_a_ei latex-suite.txt /*ls_a_ei* +ls_a_ej latex-suite.txt /*ls_a_ej* +ls_a_ek latex-suite.txt /*ls_a_ek* +ls_a_el latex-suite.txt /*ls_a_el* +ls_a_em latex-suite.txt /*ls_a_em* +ls_a_en latex-suite.txt /*ls_a_en* +ls_a_eo latex-suite.txt /*ls_a_eo* +ls_a_ep latex-suite.txt /*ls_a_ep* +ls_a_eq latex-suite.txt /*ls_a_eq* +ls_a_er latex-suite.txt /*ls_a_er* +ls_a_es latex-suite.txt /*ls_a_es* +ls_a_et latex-suite.txt /*ls_a_et* +ls_a_eu latex-suite.txt /*ls_a_eu* +ls_a_ev latex-suite.txt /*ls_a_ev* +ls_a_ew latex-suite.txt /*ls_a_ew* +ls_a_ex latex-suite.txt /*ls_a_ex* +ls_a_ey latex-suite.txt /*ls_a_ey* +ls_a_ez latex-suite.txt /*ls_a_ez* +ls_u_1 latex-suite.txt /*ls_u_1* +ls_u_2 latex-suite.txt /*ls_u_2* +ls_u_3 latex-suite.txt /*ls_u_3* +ls_u_4 latex-suite.txt /*ls_u_4* +lsq-compiling latex-suite-quickstart.txt /*lsq-compiling* +lsq-conclusions latex-suite-quickstart.txt /*lsq-conclusions* +lsq-debugging latex-suite-quickstart.txt /*lsq-debugging* +lsq-folding latex-suite-quickstart.txt /*lsq-folding* +lsq-insert-environment latex-suite-quickstart.txt /*lsq-insert-environment* +lsq-inserting-reference latex-suite-quickstart.txt /*lsq-inserting-reference* +lsq-inserting-template latex-suite-quickstart.txt /*lsq-inserting-template* +lsq-keyboard-shortcuts latex-suite-quickstart.txt /*lsq-keyboard-shortcuts* +lsq-lsq-inserting-package latex-suite-quickstart.txt /*lsq-lsq-inserting-package* +lsq-quick-forward-searching latex-suite-quickstart.txt /*lsq-quick-forward-searching* +lsq-quick-inverse-searching latex-suite-quickstart.txt /*lsq-quick-inverse-searching* +lsq-using-tutorial latex-suite-quickstart.txt /*lsq-using-tutorial* +lsq-viewing-dvi latex-suite-quickstart.txt /*lsq-viewing-dvi* +macro-enabling latex-suite.txt /*macro-enabling* +math, latexhelp.txt /*math,* +math-misc latexhelp.txt /*math-misc* +math-mode latexhelp.txt /*math-mode* +math-spacing latexhelp.txt /*math-spacing* +math-symbols latexhelp.txt /*math-symbols* +math: latexhelp.txt /*math:* +math; latexhelp.txt /*math;* +matn! latexhelp.txt /*matn!* +minipage latexhelp.txt /*minipage* +notitlepage latexhelp.txt /*notitlepage* +onecolumn latexhelp.txt /*onecolumn* +oneside latexhelp.txt /*oneside* +openany latexhelp.txt /*openany* +openbib latexhelp.txt /*openbib* +openright latexhelp.txt /*openright* +overriding-macros latex-suite.txt /*overriding-macros* +package-actions latex-suite.txt /*package-actions* +paragraph-mode latexhelp.txt /*paragraph-mode* +part-compiling latex-suite.txt /*part-compiling* +pausing-imaps latex-suite.txt /*pausing-imaps* +picture latexhelp.txt /*picture* +picture-makebox latexhelp.txt /*picture-makebox* +place-holder latex-suite.txt /*place-holder* +place-holders latex-suite.txt /*place-holders* +plain latexhelp.txt /*plain* +pre-lengths latexhelp.txt /*pre-lengths* +quotation latexhelp.txt /*quotation* +quote-l latexhelp.txt /*quote-l* +recommended-settings latex-suite.txt /*recommended-settings* +remapping-latex-suite-keys latex-suite.txt /*remapping-latex-suite-keys* +report-class latexhelp.txt /*report-class* +roman latexhelp.txt /*roman* +rqno latexhelp.txt /*rqno* +section-mappings latex-suite.txt /*section-mappings* +slides-class latexhelp.txt /*slides-class* +smart-backspace latex-suite.txt /*smart-backspace* +smart-keys latex-suite.txt /*smart-keys* +sub-sup latexhelp.txt /*sub-sup* +subscripts latexhelp.txt /*subscripts* +superscripts latexhelp.txt /*superscripts* +supporting-packages latex-suite.txt /*supporting-packages* +tab' latexhelp.txt /*tab'* +tab+ latexhelp.txt /*tab+* +tab- latexhelp.txt /*tab-* +tab< latexhelp.txt /*tab<* +tab= latexhelp.txt /*tab=* +tab> latexhelp.txt /*tab>* +tab` latexhelp.txt /*tab`* +taba latexhelp.txt /*taba* +tabbing latexhelp.txt /*tabbing* +tabular latexhelp.txt /*tabular* +theorem latexhelp.txt /*theorem* +titlepage latexhelp.txt /*titlepage* +twocolumn latexhelp.txt /*twocolumn* +twoside latexhelp.txt /*twoside* +verbatim latexhelp.txt /*verbatim* +verse latexhelp.txt /*verse* +why-IMAP latex-suite.txt /*why-IMAP* diff --git a/vimfiles.latex/ftplugin/bib_latexSuite.vim b/vimfiles.latex/ftplugin/bib_latexSuite.vim new file mode 100644 index 0000000..6b803af --- /dev/null +++ b/vimfiles.latex/ftplugin/bib_latexSuite.vim @@ -0,0 +1,16 @@ +" File: bib_latexSuite.vim +" Author: Srinath Avadhanula +" License: Vim Charityware License +" Description: +" This file sources the bibtex.vim file distributed as part of latex-suite. +" That file sets up 3 maps BBB, BAS, and BBA which are easy wasy to type in +" bibliographic entries. +" +" CVS: $Id: bib_latexSuite.vim 997 2006-03-20 09:45:45Z srinathava $ + +" source main.vim because we need a few functions from it. +runtime ftplugin/latex-suite/main.vim +" Disable smart-quotes because we need to enter real quotes in bib files. +runtime ftplugin/latex-suite/bibtex.vim + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap diff --git a/vimfiles.latex/ftplugin/latex-suite/bibtex.vim b/vimfiles.latex/ftplugin/latex-suite/bibtex.vim new file mode 100644 index 0000000..8037914 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/bibtex.vim @@ -0,0 +1,266 @@ +"============================================================================= +" File: bibtex.vim +" Function: BibT +" Author: Alan G Isaac <aisaac@american.edu> +" modified by Srinath Avadhanula for latex-suite. +" License: Vim Charityware license. +" CVS: $Id: bibtex.vim 997 2006-03-20 09:45:45Z srinathava $ +"============================================================================= + +" Fields: +" Define what field type each letter denotes {{{ +" +let s:w_standsfor = 'address' +let s:a_standsfor = 'author' +let s:b_standsfor = 'booktitle' +let s:c_standsfor = 'chapter' +let s:d_standsfor = 'edition' +let s:e_standsfor = 'editor' +let s:h_standsfor = 'howpublished' +let s:i_standsfor = 'institution' +let s:k_standsfor = 'isbn' +let s:j_standsfor = 'journal' +let s:m_standsfor = 'month' +let s:n_standsfor = 'number' +let s:o_standsfor = 'organization' +let s:p_standsfor = 'pages' +let s:q_standsfor = 'publisher' +let s:r_standsfor = 'school' +let s:s_standsfor = 'series' +let s:t_standsfor = 'title' +let s:u_standsfor = 'type' +let s:v_standsfor = 'volume' +let s:y_standsfor = 'year' +let s:z_standsfor = 'note' + +" }}} +" Define the fields required for the various entry types {{{ +" +" s:{type}_required defines the required fields +" s:{type}_optional1 defines common optional fields +" s:{type}_optional2 defines uncommmon optional fields +" s:{type}_retval defines the first line of the formatted bib entry. +" +let s:key='<+key+>' + +let s:{'article'}_required="atjy" +let s:{'article'}_optional1="vnpm" +let s:{'article'}_optional2="z" " z is note +let s:{'article'}_retval = '@ARTICLE{' . s:key . ','."\n" + +let s:{'book'}_required="aetqy" " requires author *or* editor +let s:{'book'}_optional1="wd" +let s:{'book'}_optional2="vnsmz" " w is address, d is edition +let s:{'book'}_extras="k" " isbn +let s:{'book'}_retval = '@BOOK{' . s:key . ','."\n" + +let s:{'booklet'}_required="t" +let s:{'booklet'}_optional1="ahy" +let s:{'booklet'}_optional2="wmz" " w is address +let s:{'booklet'}_retval = '@BOOKLET{' . s:key . ','."\n" + +let s:{'inbook'}_required="aetcpqy" +let s:{'inbook'}_optional1="w" " w is address +let s:{'inbook'}_optional2="vnsudmz" " d is edition +let s:{'inbook'}_extras="k" " isbn +let s:{'inbook'}_retval = '@INBOOK{' . s:key . ','."\n" + +let s:{'incollection'}_required="atbqy" " b is booktitle +let s:{'incollection'}_optional1="cpw" " w is address, c is chapter +let s:{'incollection'}_optional2="evnsudmz" " d is edition +let s:{'incollection'}_extras="k" " isbn +let s:{'incollection'}_retval = '@INCOLLECTION{' . s:key . ','."\n" + +let s:{'inproceedings'}_required="atby" " b is booktitle +let s:{'inproceedings'}_optional1="epwoq" " w is address, q is publisher +let s:{'inproceedings'}_optional2="vnsmz" +let s:{'inproceedings'}_extras="k" " isbn +let s:{'inproceedings'}_retval = '@INPROCEEDINGS{' . s:key . ','."\n" + +let s:{'conference'}_required="atby" " b is booktitle +let s:{'conference'}_optional1="epwoq" " w is address, q is publisher +let s:{'conference'}_optional2="vnsmz" +let s:{'conference'}_extras="k" " isbn +let s:{'conference'}_retval = '@CONFERENCE{' . s:key . ','."\n" + +let s:{'manual'}_required="t" +let s:{'manual'}_optional1="ow" +let s:{'manual'}_optional2="admyz" " w is address +let s:{'manual'}_retval = '@MANUAL{' . s:key . ','."\n" + +let s:{'msthesis'}_required="atry" " r is school +let s:{'msthesis'}_optional1="w" " w is address +let s:{'msthesis'}_optional2="umz" " u is type, w is address +let s:{'msthesis'}_retval = '@MASTERSTHESIS{' . s:key . ','."\n" + +let s:{'misc'}_required="" +let s:{'misc'}_optional1="ath" +let s:{'misc'}_optional2="myz" +let s:{'misc'}_retval = '@MISC{' . s:key . ','."\n" + +let s:{'phdthesis'}_required="atry" " r is school +let s:{'phdthesis'}_optional1="w" " w is address +let s:{'phdthesis'}_optional2="umz" " u is type +let s:{'phdthesis'}_retval = '@PHDTHESIS{' . s:key . ','."\n" + +let s:{'proceedings'}_required="ty" +let s:{'proceedings'}_optional1="ewo" " w is address +let s:{'proceedings'}_optional2="vnsmqz" " q is publisher +let s:{'proceedings'}_retval = '@PROCEEDINGS{' . s:key . ','."\n" + +let s:{'techreport'}_required="atiy" +let s:{'techreport'}_optional1="unw" " u is type, w is address +let s:{'techreport'}_optional2="mz" +let s:{'techreport'}_retval = '@TECHREPORT{' . s:key . ','."\n" + +let s:{'unpublished'}_required="atz" +let s:{'unpublished'}_optional1="y" +let s:{'unpublished'}_optional2="m" +let s:{'unpublished'}_retval = '@UNPUBLISHED{' . s:key . ','."\n" + +" }}} + +if exists('s:done') + finish +endif +let s:done = 1 + +call IMAP ('BBB', "\<C-r>=BibT('', '', 0)\<CR>", 'bib') +call IMAP ('BBL', "\<C-r>=BibT('', 'o', 0)\<CR>", 'bib') +call IMAP ('BBH', "\<C-r>=BibT('', 'O', 0)\<CR>", 'bib') +call IMAP ('BBX', "\<C-r>=BibT('', 'Ox', 0)\<CR>", 'bib') + +" BibT: function to generate a formatted bibtex entry {{{ +" three sample usages: +" :call BibT() will request type choice +" :call BibT("article") preferred, provides most common fields +" :call BibT("article","ox") more optional fields (o) and extras (x) +" +" Input Arguments: +" type: is one of the types listed above. (this should be a complete name, not +" the acronym). +" options: a string containing 0 or more of the letters 'oOx' +" where +" o: include a bib entry with first set of options +" O: include a bib entry with extended options +" x: incude bib entry with extra options +" prompt: whether the fields are asked to be filled on the command prompt or +" whether place-holders are used. when prompt == 1, then comman line +" questions are used. +" +" Returns: +" a string containing a formatted bib entry +function BibT(type, options, prompt) + if a:type != '' + let choosetype = a:type + else + let types = + \ 'article'."\n". + \ 'booklet'."\n". + \ 'book'."\n". + \ 'conference'."\n". + \ 'inbook'."\n". + \ 'incollection'."\n". + \ 'inproceedings'."\n". + \ 'manual'."\n". + \ 'msthesis'."\n". + \ 'misc'."\n". + \ 'phdthesis'."\n". + \ 'proceedings'."\n". + \ 'techreport'."\n". + \ 'unpublished' + let choosetype = Tex_ChooseFromPrompt( + \ "Choose the type of bibliographic entry: \n" . + \ Tex_CreatePrompt(types, 3, "\n") . + \ "\nEnter number or filename :", + \ types, "\n") + if choosetype == '' + let choosetype = 'article' + endif + if types !~ '^\|\n'.choosetype.'$\|\n' + echomsg 'Please choose only one of the given types' + return + endif + endif + if a:options != '' + let options = a:options + else + let options = "" + endif + + let fields = '' + let extras="" + let retval = "" + + " define fields + let fields = s:{choosetype}_required + if options =~ 'o' && exists('s:'.choosetype.'_optional1') + let fields = fields . s:{choosetype}_optional1 + endif + if options =~ "O" && exists('s:'.choosetype.'_optional2') + if options !~ 'o'&& exists('s:'.choosetype.'_optional1') + let fields = fields . s:{choosetype}_optional1 + endif + let fields = fields . s:{choosetype}_optional2 + endif + if options =~ "x" && exists('s:'.choosetype.'_extras') + let fields = fields . extras + endif + if exists('g:Bib_'.choosetype.'_options') + let fields = fields . g:Bib_{choosetype}_options + endif + + let retval = s:{choosetype}_retval + + let i = 0 + while i < strlen(fields) + let field = strpart(fields, i, 1) + + if exists('s:'.field.'_standsfor') + let field_name = s:{field}_standsfor + let retval = retval.field_name." = {<++>},\n" + endif + + let i = i + 1 + endwhile + + " If the user wants even more fine-tuning... + if Tex_GetVarValue('Bib_'.choosetype.'_extrafields') != '' + + let extrafields = Tex_GetVarValue('Bib_'.choosetype.'_extrafields') + + let i = 1 + while 1 + let field_name = Tex_Strntok(extrafields, "\n", i) + if field_name == '' + break + endif + + let retval = retval.field_name." = {<++>},\n" + + let i = i + 1 + endwhile + + endif + + let retval = retval.'otherinfo = {<++>}'."\n" + let retval = retval."}<++>"."\n" + + return IMAP_PutTextWithMovement(retval) +endfunction + +" }}} +function! s:Input(prompt, ask) " {{{ + if a:ask == 1 + let retval = input(a:prompt) + if retval == '' + return "<++>" + endif + else + return "<++>" + endif +endfunction + +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/bibtools.py b/vimfiles.latex/ftplugin/latex-suite/bibtools.py new file mode 100644 index 0000000..1fb7e44 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/bibtools.py @@ -0,0 +1,219 @@ +import re + +class Bibliography(dict): + def __init__(self, txt, macros={}): + """ + txt: + a string which represents the entire bibtex entry. A typical + entry is of the form: + + @ARTICLE{ellington:84:part3, + author = {Ellington, C P}, + title = {The Aerodynamics of Hovering Insect Flight. III. Kinematics}, + journal = {Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences}, + year = {1984}, + volume = {305}, + pages = {41-78}, + number = {1122}, + owner = {Srinath}, + pdf = {C:\srinath\research\papers\Ellington-3-Kinematics.pdf}, + timestamp = {2006.01.02}, + } + """ + + if macros: + for k, v in macros.iteritems(): + txt = txt.replace(k, '{'+v+'}') + + m = re.match(r'\s*@(\w+){((\S+),)?(.*)}\s*', txt, re.MULTILINE | re.DOTALL) + if not m: + return None + + self['bibtype'] = m.group(1).capitalize() + self['key'] = m.group(3) + self['body'] = m.group(4) + + body = self['body'] + self['bodytext'] = '' + while 1: + m = re.search(r'(\S+?)\s*=\s*(.)', body) + if not m: + break + + field = m.group(1) + + body = body[(m.start(2)+1):] + if m.group(2) == '{': + # search for the next closing brace. This is not simply a + # matter of searching for the next closing brace since + # braces can be nested. The following code basically goes + # to the next } which has not already been closed by a + # following {. + mniter = re.finditer(r'{|}', body) + + count = 1 + while 1: + try: + mn = mniter.next() + except StopIteration: + return None + + if mn.group(0) == '{': + count += 1 + else: + count -= 1 + + if count == 0: + value = body[:(mn.start(0))] + break + + elif m.group(2) == '"': + # search for the next unquoted double-quote. To be more + # precise, a double quote which is preceded by an even + # number of double quotes. + mn = re.search(r'(?!\\)(\\\\)*"', body) + if not mn: + return None + + value = body[:(mn.start(0))] + + else: + mn = re.match(r'\d+', body) + if not mn: + raise "Only completely numeral fields can be left unquoted" + + value = m.group(2) + mn.group(0) + + self[field] = re.sub(r'\s+', ' ', value) + body = body[(mn.start(0)+1):] + + self['bodytext'] += (' %s: %s\n' % (field, value)) + if self['bibtype'].lower() == 'string': + self['macro'] = {field: value} + + self['bodytext'] = self['bodytext'].rstrip() + + + def __getitem__(self, key): + try: + return dict.__getitem__(self, key) + except KeyError: + return '' + + def __str__(self): + if self['bibtype'].lower() == 'string': + return 'String: %(macro)s' % self + + elif self['bibtype'].lower() == 'article': + return ('Article [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(journal)s, %(year)s') % self + + elif self['bibtype'].lower() == 'conference': + return ('Conference [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(booktitle)s, %(year)s') % self + + elif self['bibtype'].lower() == 'mastersthesis': + return ('Masters [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(school)s, %(year)s') % self + + elif self['bibtype'].lower() == 'phdthesis': + return ('PhD [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(school)s, %(year)s') % self + + elif self['bibtype'].lower() == 'book': + return ('Book [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN %(publisher)s, %(year)s') % self + + else: + s = '%(bibtype)s [%(key)s]\n' % self + if self['title']: + s += 'TI "%(title)s"\n' % self + if self['author']: + s += 'AU %(author)s\n' % self + for k, v in self.iteritems(): + if k not in ['title', 'author', 'bibtype', 'key', 'id', 'file', 'body', 'bodytext']: + s += 'MI %s: %s\n' % (k, v) + + return s.rstrip() + + def satisfies(self, filters): + for field, regexp in filters: + if not re.search(regexp, self[field], re.I): + return False + + return True + +class BibFile: + + def __init__(self, filelist=''): + self.bibentries = [] + self.filters = [] + self.macros = {} + self.sortfields = [] + if filelist: + for f in filelist.splitlines(): + self.addfile(f) + + def addfile(self, file): + fields = open(file).read().split('@') + for f in fields: + if not (f and re.match('string', f, re.I)): + continue + + b = Bibliography('@' + f) + self.macros.update(b['macro']) + + for f in fields: + if not f or re.match('string', f, re.I): + continue + + b = Bibliography('@' + f, self.macros) + if b: + b['file'] = file + b['id'] = len(self.bibentries) + self.bibentries += [b] + + + def addfilter(self, filterspec): + self.filters += [filterspec.split()] + + def rmfilters(self): + self.filters = [] + + def __str__(self): + s = '' + for b in self.bibentries: + if b['key'] and b.satisfies(self.filters): + s += '%s\n\n' % b + return s + + def addsortfield(self, field): + self.sortfields += [field] + + def rmsortfields(self): + self.sortfields = [] + + def sort(self): + def cmpfun(b1, b2): + for f in self.sortfields: + c = cmp(b1[f], b2[f]) + if c: + return c + return 0 + self.bibentries.sort(cmp=cmpfun) + +if __name__ == "__main__": + import sys + + bf = BibFile(sys.argv[1]) + print bf diff --git a/vimfiles.latex/ftplugin/latex-suite/brackets.vim b/vimfiles.latex/ftplugin/latex-suite/brackets.vim new file mode 100644 index 0000000..0669ce4 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/brackets.vim @@ -0,0 +1,145 @@ +" ============================================================================== +" History: This was originally part of auctex.vim by Carl Mueller. +" Srinath Avadhanula incorporated it into latex-suite with +" significant modifications. +" Parts of this file may be copyrighted by others as noted. +" CVS: $Id: brackets.vim 997 2006-03-20 09:45:45Z srinathava $ +" Description: +" This ftplugin provides the following maps: +" . <M-b> encloses the previous character in \mathbf{} +" . <M-c> is polymorphic as follows: +" Insert mode: +" 1. If the previous character is a letter or number, then capitalize it and +" enclose it in \mathcal{} +" 2. otherwise insert \cite{} +" Visual Mode: +" 1. Enclose selection in \mathcal{} +" . <M-l> is also polymorphic as follows: +" If the character before typing <M-l> is one of '([{|<q', then do the +" following: +" 1. (<M-l> \left(\right +" similarly for [, | +" {<M-l> \left\{\right\} +" 2. <<M-l> \langle\rangle +" 3. q<M-l> \lefteqn{} +" otherwise insert \label{} +" . <M-i> inserts \item commands at the current cursor location depending on +" the surrounding environment. For example, inside itemize, it will +" insert a simple \item, but within a description, it will insert +" \item[<+label+>] etc. +" +" These functions make it extremeley easy to do all the \left \right stuff in +" latex. +" ============================================================================== + +" Avoid reinclusion. +if exists('b:did_brackets') + finish +endif +let b:did_brackets = 1 + +" define the funtions only once. +if exists('*Tex_MathBF') + finish +endif + +" Tex_MathBF: encloses te previous letter/number in \mathbf{} {{{ +" Description: +function! Tex_MathBF() + return "\<Left>\\mathbf{\<Right>}" +endfunction " }}} +" Tex_MathCal: enclose the previous letter/number in \mathcal {{{ +" Description: +" if the last character is not a letter/number, then insert \cite{} +function! Tex_MathCal() + let line = getline(line(".")) + let char = line[col(".")-2] + + if char =~ '[a-zA-Z0-9]' + return "\<BS>".'\mathcal{'.toupper(char).'}' + else + return IMAP_PutTextWithMovement('\cite{<++>}<++>') + endif +endfunction +" }}} +" Tex_LeftRight: maps <M-l> in insert mode. {{{ +" Description: +" This is a polymorphic function, which maps the behaviour of <M-l> in the +" following way: +" If the character before typing <M-l> is one of '([{|<q', then do the +" following: +" 1. (<M-l> \left(<++>\right<++> +" similarly for [, | +" {<M-l> \left\{<++>\right\}<++> +" 2. <<M-l> \langle<++>\rangle<++> +" 3. q<M-l> \lefteqn{<++>}<++> +" otherwise insert \label{<++>}<++> +function! Tex_LeftRight() + let line = getline(line(".")) + let char = line[col(".")-2] + let previous = line[col(".")-3] + + let matchedbrackets = '()[]{}||' + if char =~ '(\|\[\|{\||' + let add = '' + if char =~ '{' + let add = "\\" + endif + let rhs = matchstr(matchedbrackets, char.'\zs.\ze') + return "\<BS>".IMAP_PutTextWithMovement('\left'.add.char.'<++>\right'.add.rhs.'<++>') + elseif char == '<' + return "\<BS>".IMAP_PutTextWithMovement('langle<++>\rangle<++>') + elseif char == 'q' + return "\<BS>".IMAP_PutTextWithMovement('\lefteqn{<++>}<++>') + else + return IMAP_PutTextWithMovement('\label{<++>}<++>') + endif +endfunction " }}} +" Tex_PutLeftRight: maps <M-l> in normal mode {{{ +" Description: +" Put \left...\right in front of the matched brackets. +function! Tex_PutLeftRight() + let previous = getline(line("."))[col(".") - 2] + let char = getline(line("."))[col(".") - 1] + if previous == '\' + if char == '{' + exe "normal ileft\\\<Esc>l%iright\\\<Esc>l%" + elseif char == '}' + exe "normal iright\\\<Esc>l%ileft\\\<Esc>l%" + endif + elseif char =~ '\[\|(' + exe "normal i\\left\<Esc>l%i\\right\<Esc>l%" + elseif char =~ '\]\|)' + exe "normal i\\right\<Esc>l%i\\left\<Esc>l%" + endif +endfunction " }}} + +" Provide <plug>'d mapping for easy user customization. {{{ +inoremap <silent> <Plug>Tex_MathBF <C-r>=Tex_MathBF()<CR> +inoremap <silent> <Plug>Tex_MathCal <C-r>=Tex_MathCal()<CR> +inoremap <silent> <Plug>Tex_LeftRight <C-r>=Tex_LeftRight()<CR> +vnoremap <silent> <Plug>Tex_MathBF <C-C>`>a}<Esc>`<i\mathbf{<Esc> +vnoremap <silent> <Plug>Tex_MathCal <C-C>`>a}<Esc>`<i\mathcal{<Esc> +nnoremap <silent> <Plug>Tex_LeftRight :call Tex_PutLeftRight()<CR> + +" }}} +" Tex_SetBracketingMaps: create mappings for the current buffer {{{ +function! <SID>Tex_SetBracketingMaps() + + call Tex_MakeMap('<M-b>', '<Plug>Tex_MathBF', 'i', '<buffer> <silent>') + call Tex_MakeMap('<M-c>', '<Plug>Tex_MathCal', 'i', '<buffer> <silent>') + call Tex_MakeMap('<M-l>', '<Plug>Tex_LeftRight', 'i', '<buffer> <silent>') + call Tex_MakeMap('<M-b>', '<Plug>Tex_MathBF', 'v', '<buffer> <silent>') + call Tex_MakeMap('<M-c>', '<Plug>Tex_MathCal', 'v', '<buffer> <silent>') + call Tex_MakeMap('<M-l>', '<Plug>Tex_LeftRight', 'n', '<buffer> <silent>') + +endfunction +" }}} + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('brackets.vim: Catching LatexSuiteFileType event', 'brak') | + \ call <SID>Tex_SetBracketingMaps() +augroup END + +" vim:fdm=marker diff --git a/vimfiles.latex/ftplugin/latex-suite/compiler.vim b/vimfiles.latex/ftplugin/latex-suite/compiler.vim new file mode 100644 index 0000000..245f6cd --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/compiler.vim @@ -0,0 +1,820 @@ +"============================================================================= +" File: compiler.vim +" Author: Srinath Avadhanula +" Created: Tue Apr 23 05:00 PM 2002 PST +" +" Description: functions for compiling/viewing/searching latex documents +" CVS: $Id: compiler.vim 997 2006-03-20 09:45:45Z srinathava $ +"============================================================================= + +" Tex_SetTeXCompilerTarget: sets the 'target' for the next call to Tex_RunLaTeX() {{{ +function! Tex_SetTeXCompilerTarget(type, target) + call Tex_Debug("+Tex_SetTeXCompilerTarget: setting target to [".a:target."] for ".a:type."r", "comp") + + if a:target == '' + let target = Tex_GetVarValue('Tex_DefaultTargetFormat') + let target = input('Enter the target format for '.a:type.'r: ', target) + else + let target = a:target + endif + if target == '' + let target = 'dvi' + endif + + let targetRule = Tex_GetVarValue('Tex_'.a:type.'Rule_'.target) + + if targetRule != '' + if a:type == 'Compile' + let &l:makeprg = escape(targetRule, Tex_GetVarValue('Tex_EscapeChars')) + elseif a:type == 'View' + let s:viewer = targetRule + endif + let s:target = target + + elseif Tex_GetVarValue('Tex_'.a:type.'RuleComplete_'.target) != '' + let s:target = target + + else + let curd = getcwd() + exe 'cd '.expand('%:p:h') + if !Tex_GetVarValue('Tex_UseMakefile') || (glob('makefile*') == '' && glob('Makefile*') == '') + if has('gui_running') + call confirm( + \'No '.a:type.' rule defined for target '.target."\n". + \'Please specify a rule in $VIMRUNTIME/ftplugin/tex/texrc'."\n". + \' :help Tex_'.a:type.'Rule_format'."\n". + \'for more information', + \"&ok", 1, 'Warning') + else + call input( + \'No '.a:type.' rule defined for target '.target."\n". + \'Please specify a rule in $VIMRUNTIME/ftplugin/tex/texrc'."\n". + \' :help Tex_'.a:type.'Rule_format'."\n". + \'for more information' + \) + endif + else + echomsg 'Assuming target is for makefile' + let s:target = target + endif + exe 'cd '.curd + endif +endfunction + +function! SetTeXTarget(...) + if a:0 < 1 + let target = Tex_GetVarValue('Tex_DefaultTargetFormat') + let target = input('Enter the target format for compiler and viewer: ', target) + else + let target = a:1 + endif + if target == '' + let target = 'dvi' + endif + + call Tex_SetTeXCompilerTarget('Compile', target) + call Tex_SetTeXCompilerTarget('View', target) +endfunction + +com! -nargs=1 TCTarget :call Tex_SetTeXCompilerTarget('Compile', <f-args>) +com! -nargs=1 TVTarget :call Tex_SetTeXCompilerTarget('View', <f-args>) +com! -nargs=? TTarget :call SetTeXTarget(<f-args>) + +" }}} +" Tex_CompileLatex: compiles the present file. {{{ +" Description: +function! Tex_CompileLatex() + if &ft != 'tex' + echo "calling Tex_RunLaTeX from a non-tex file" + return + end + + " close any preview windows left open. + pclose! + + let curd = getcwd() + + " Find the main file corresponding to this file. Always cd to the + " directory containing the file to avoid problems with the directory + " containing spaces. + " Latex on linux seems to be unable to handle file names with spaces at + " all! Therefore for the moment, do not attempt to handle spaces in the + " file name. + if exists('b:fragmentFile') + let mainfname = expand('%:p:t') + call Tex_CD(expand('%:p:h')) + else + let mainfname = Tex_GetMainFileName(':p:t') + call Tex_CD(Tex_GetMainFileName(':p:h')) + end + + call Tex_Debug('Tex_CompileLatex: getting mainfname = ['.mainfname.'] from Tex_GetMainFileName', 'comp') + + " if a makefile exists and the user wants to use it, then use that + " irrespective of whether *.latexmain exists or not. mainfname is still + " extracted from *.latexmain (if possible) log file name depends on the + " main file which will be compiled. + if Tex_GetVarValue('Tex_UseMakefile') && (glob('makefile') != '' || glob('Makefile') != '') + let _makeprg = &l:makeprg + call Tex_Debug("Tex_CompileLatex: using the makefile in the current directory", "comp") + let &l:makeprg = 'make $*' + if exists('s:target') + call Tex_Debug('Tex_CompileLatex: execing [make! '.s:target.']', 'comp') + exec 'make! '.s:target + else + call Tex_Debug('Tex_CompileLatex: execing [make!]', 'comp') + exec 'make!' + endif + let &l:makeprg = _makeprg + else + " If &makeprg has something like "$*.ps", it means that it wants the + " file-name without the extension... Therefore remove it. + if &makeprg =~ '\$\*\.\w\+' + let mainfname = fnamemodify(mainfname, ':r') + endif + call Tex_Debug('Tex_CompileLatex: execing [make! '.mainfname.']', 'comp') + exec 'make! '.mainfname + endif + redraw! + + call Tex_CD(curd) +endfunction " }}} +" Tex_RunLaTeX: compilation function {{{ +" this function runs the latex command on the currently open file. often times +" the file being currently edited is only a fragment being \input'ed into some +" master tex file. in this case, make a file called mainfile.latexmain in the +" directory containig the file. in other words, if the current file is +" ~/thesis/chapter.tex +" so that doing "latex chapter.tex" doesnt make sense, then make a file called +" main.tex.latexmain +" in the ~/thesis directory. this will then run "latex main.tex" when +" Tex_RunLaTeX() is called. +function! Tex_RunLaTeX() + call Tex_Debug('+Tex_RunLaTeX, b:fragmentFile = '.exists('b:fragmentFile'), 'comp') + + let dir = expand("%:p:h").'/' + let curd = getcwd() + call Tex_CD(expand("%:p:h")) + + let initTarget = s:target + + " first get the dependency chain of this format. + call Tex_Debug("Tex_RunLaTeX: compiling to target [".s:target."]", "comp") + + if Tex_GetVarValue('Tex_FormatDependency_'.s:target) != '' + let dependency = Tex_GetVarValue('Tex_FormatDependency_'.s:target) + if dependency !~ ','.s:target.'$' + let dependency = dependency.','.s:target + endif + else + let dependency = s:target + endif + + call Tex_Debug('Tex_RunLaTeX: getting dependency chain = ['.dependency.']', 'comp') + + " now compile to the final target format via each dependency. + let i = 1 + while Tex_Strntok(dependency, ',', i) != '' + let s:target = Tex_Strntok(dependency, ',', i) + + call Tex_SetTeXCompilerTarget('Compile', s:target) + call Tex_Debug('Tex_RunLaTeX: setting target to '.s:target, 'comp') + + if Tex_GetVarValue('Tex_MultipleCompileFormats') =~ '\<'.s:target.'\>' + call Tex_Debug("Tex_RunLaTeX: compiling file multiple times via Tex_CompileMultipleTimes", "comp") + call Tex_CompileMultipleTimes() + else + call Tex_Debug("Tex_RunLaTeX: compiling file once via Tex_CompileLatex", "comp") + call Tex_CompileLatex() + endif + + let errlist = Tex_GetErrorList() + call Tex_Debug("Tex_RunLaTeX: errlist = [".errlist."]", "comp") + + " If there are any errors, then break from the rest of the steps + if errlist =~ '\v(error|warning)' + call Tex_Debug('Tex_RunLaTeX: There were errors in compiling, breaking chain...', 'comp') + break + endif + + let i = i + 1 + endwhile + + let s:target = initTarget + let s:origwinnum = winnr() + call Tex_SetupErrorWindow() + + call Tex_CD(curd) + call Tex_Debug("-Tex_RunLaTeX", "comp") +endfunction + +" }}} +" Tex_ViewLaTeX: opens viewer {{{ +" Description: opens the DVI viewer for the file being currently edited. +" Again, if the current file is a \input in a master file, see text above +" Tex_RunLaTeX() to see how to set this information. +function! Tex_ViewLaTeX() + if &ft != 'tex' + echo "calling Tex_ViewLaTeX from a non-tex file" + return + end + + let curd = getcwd() + + " If b:fragmentFile is set, it means this file was compiled as a fragment + " using Tex_PartCompile, which means that we want to ignore any + " *.latexmain or makefile's. + if !exists('b:fragmentFile') + " cd to the location of the file to avoid having to deal with spaces + " in the directory name. + let mainfname = Tex_GetMainFileName(':p:t:r') + call Tex_CD(Tex_GetMainFileName(':p:h')) + else + let mainfname = expand("%:p:t:r") + call Tex_CD(expand("%:p:h")) + endif + + if Tex_GetVarValue('Tex_ViewRuleComplete_'.s:target) != '' + + let execString = Tex_GetVarValue('Tex_ViewRuleComplete_'.s:target) + let execString = substitute(execString, '{v:servername}', v:servername, 'g') + + elseif has('win32') + " unfortunately, yap does not allow the specification of an external + " editor from the command line. that would have really helped ensure + " that this particular vim and yap are connected. + let execString = 'start '.s:viewer.' "$*.'.s:target.'"' + + elseif has('macunix') + if strlen(s:viewer) + let s:viewer = '-a '.s:viewer + endif + let execString = 'open '.s:viewer.' $*.'.s:target + + else + " taken from Dimitri Antoniou's tip on vim.sf.net (tip #225). + " slight change to actually use the current servername instead of + " hardcoding it as xdvi. + " Using an option for specifying the editor in the command line + " because that seems to not work on older bash'es. + if s:target == 'dvi' + + if Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && + \ v:servername != '' && + \ (s:viewer == "xdvi" || s:viewer == "xdvik") + + let execString = s:viewer.' -editor "gvim --servername '.v:servername. + \ ' --remote-silent +\%l \%f" $*.dvi &' + + elseif Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && + \ s:viewer == "kdvi" + + let execString = 'kdvi --unique $*.dvi &' + + else + + let execString = s:viewer.' $*.dvi &' + + endif + + else + + let execString = s:viewer.' $*.'.s:target.' &' + + endif + end + + let execString = substitute(execString, '\V$*', mainfname, 'g') + call Tex_Debug("Tex_ViewLaTeX: execString = ".execString, "comp") + + exec 'silent! !'.execString + + if !has('gui_running') + redraw! + endif + + call Tex_CD(curd) +endfunction + +" }}} +" Tex_ForwardSearchLaTeX: searches for current location in dvi file. {{{ +" Description: if the DVI viewr is compatible, then take the viewer to that +" position in the dvi file. see docs for Tex_RunLaTeX() to set a +" master file if this is an \input'ed file. +" Tip: With YAP on Windows, it is possible to do forward and inverse searches +" on DVI files. to do forward search, you'll have to compile the file +" with the --src-specials option. then set the following as the command +" line in the 'view/options/inverse search' dialog box: +" gvim --servername LATEX --remote-silent +%l "%f" +" For inverse search, if you are reading this, then just pressing \ls +" will work. +function! Tex_ForwardSearchLaTeX() + if &ft != 'tex' + echo "calling Tex_ViewLaTeX from a non-tex file" + return + end + + " only know how to do forward search for yap on windows and xdvik (and + " some newer versions of xdvi) on unices. Therefore forward searching will + " automatically open the DVI viewer irrespective of what the user chose as + " the default view format. + if Tex_GetVarValue('Tex_ViewRule_dvi') == '' + return + endif + let viewer = Tex_GetVarValue('Tex_ViewRule_dvi') + + let curd = getcwd() + + let mainfname = Tex_GetMainFileName(':t') + let mainfnameRoot = fnamemodify(Tex_GetMainFileName(), ':t:r') + " cd to the location of the file to avoid problems with directory name + " containing spaces. + call Tex_CD(Tex_GetMainFileName(':p:h')) + + " inverse search tips taken from Dimitri Antoniou's tip and Benji Fisher's + " tips on vim.sf.net (vim.sf.net tip #225) + if has('win32') + + let execString = 'silent! !start '. viewer.' -s '.line('.').expand('%').' '.mainfnameRoot + + else + if Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && + \ exists('v:servername') && + \ (viewer == "xdvi" || viewer == "xdvik") + + let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').expand("%"). + \ ' -editor "gvim --servername '.v:servername.' --remote-silent +\%l \%f" '. + \ mainfnameRoot.'.dvi &' + + elseif Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && viewer == "kdvi" + + let execString = 'silent! !kdvi --unique file:'.mainfnameRoot.'.dvi\#src:'.line('.').expand("%").' &' + + else + + let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').expand("%").' '.mainfnameRoot.'.dvi &' + + endif + end + + call Tex_Debug("Tex_ForwardSearchLaTeX: execString = ".execString, "comp") + execute execString + if !has('gui_running') + redraw! + endif + + call Tex_CD(curd) +endfunction + +" }}} + +" ============================================================================== +" Functions for compiling parts of a file. +" ============================================================================== +" Tex_PartCompile: compiles selected fragment {{{ +" Description: creates a temporary file from the selected fragment of text +" prepending the preamble and \end{document} and then asks Tex_RunLaTeX() to +" compile it. +function! Tex_PartCompile() range + call Tex_Debug('+Tex_PartCompile', 'comp') + " Save position + let pos = line('.').' | normal! '.virtcol('.').'|' + + " Get a temporary file in the same directory as the file from which + " fragment is being extracted. This is to enable the use of relative path + " names in the fragment. + let tmpfile = Tex_GetTempName(expand('%:p:h')) + + " Remember all the temp files and for each temp file created, remember + " where the temp file came from. + let s:Tex_NumTempFiles = (exists('s:Tex_NumTempFiles') ? s:Tex_NumTempFiles + 1 : 1) + let s:Tex_TempFiles = (exists('s:Tex_TempFiles') ? s:Tex_TempFiles : '') + \ . tmpfile."\n" + let s:Tex_TempFile_{s:Tex_NumTempFiles} = tmpfile + " TODO: For a function Tex_RestoreFragment which restores a temp file to + " its original location. + let s:Tex_TempFileOrig_{s:Tex_NumTempFiles} = expand('%:p') + let s:Tex_TempFileRange_{s:Tex_NumTempFiles} = a:firstline.','.a:lastline + + " Set up an autocmd to clean up the temp files when Vim exits. + if Tex_GetVarValue('Tex_RemoveTempFiles') + augroup RemoveTmpFiles + au! + au VimLeave * :call Tex_RemoveTempFiles() + augroup END + endif + + " If mainfile exists open it in tiny window and extract preamble there, + " otherwise do it from current file + let mainfile = Tex_GetMainFileName(":p") + exe 'bot 1 split '.escape(mainfile, ' ') + exe '1,/\s*\\begin{document}/w '.tmpfile + wincmd q + + exe a:firstline.','.a:lastline."w! >> ".tmpfile + + " edit the temporary file + exec 'drop '.tmpfile + + " append the \end{document} line. + $ put ='\end{document}' + w + + " set this as a fragment file. + let b:fragmentFile = 1 + + silent! call Tex_RunLaTeX() +endfunction " }}} +" Tex_RemoveTempFiles: cleans up temporary files created during part compilation {{{ +" Description: During part compilation, temporary files containing the +" visually selected text are created. These files need to be +" removed when Vim exits to avoid "file leakage". +function! Tex_RemoveTempFiles() + if !exists('s:Tex_NumTempFiles') || !Tex_GetVarValue('Tex_RemoveTempFiles') + return + endif + let i = 1 + while i <= s:Tex_NumTempFiles + let tmpfile = s:Tex_TempFile_{i} + " Remove the tmp file and all other associated files such as the + " .log files etc. + call Tex_DeleteFile(fnamemodify(tmpfile, ':p:r').'.*') + let i = i + 1 + endwhile +endfunction " }}} + +" ============================================================================== +" Compiling a file multiple times to resolve references/citations etc. +" ============================================================================== +" Tex_CompileMultipleTimes: The main function {{{ +" Description: compiles a file multiple times to get cross-references right. +function! Tex_CompileMultipleTimes() + " Just extract the root without any extension because we want to construct + " the log file names etc from it. + let curd = getcwd() + let mainFileName_root = Tex_GetMainFileName(':p:t:r') + call Tex_CD(Tex_GetMainFileName(':p:h')) + + " First ignore undefined references and the + " "rerun to get cross-references right" message from + " the compiler output. + let origlevel = Tex_GetVarValue('Tex_IgnoreLevel') + let origpats = Tex_GetVarValue('Tex_IgnoredWarnings') + + let g:Tex_IgnoredWarnings = g:Tex_IgnoredWarnings."\n" + \ . 'Reference %.%# undefined'."\n" + \ . 'Rerun to get cross-references right' + TCLevel 1000 + + let idxFileName = mainFileName_root.'.idx' + let auxFileName = mainFileName_root.'.aux' + + let runCount = 0 + let needToRerun = 1 + while needToRerun == 1 && runCount < 5 + " assume we need to run only once. + let needToRerun = 0 + + let idxlinesBefore = Tex_CatFile(idxFileName) + let auxlinesBefore = Tex_GetAuxFile(auxFileName) + + " first run latex. + echomsg "latex run number : ".(runCount+1) + call Tex_Debug("Tex_CompileMultipleTimes: latex run number : ".(runCount+1), "comp") + silent! call Tex_CompileLatex() + + " If there are errors in any latex compilation step, immediately + " return. For now, do not bother with warnings because those might go + " away after compiling again or after bibtex is run etc. + let errlist = Tex_GetErrorList() + call Tex_Debug("Tex_CompileMultipleTimes: errors = [".errlist."]", "comp") + + if errlist =~ 'error' + let g:Tex_IgnoredWarnings = origpats + exec 'TCLevel '.origlevel + + return + endif + + let idxlinesAfter = Tex_CatFile(idxFileName) + + " If .idx file changed, then run makeindex to generate the new .ind + " file and remember to rerun latex. + if runCount == 0 && glob(idxFileName) != '' && idxlinesBefore != idxlinesAfter + echomsg "Running makeindex..." + let temp_mp = &mp | let &mp = Tex_GetVarValue('Tex_MakeIndexFlavor') + exec 'silent! make '.mainFileName_root + let &mp = temp_mp + + let needToRerun = 1 + endif + + " The first time we see if we need to run bibtex and if the .bbl file + " changes, we will rerun latex. + if runCount == 0 && Tex_IsPresentInFile('\\bibdata', mainFileName_root.'.aux') + let bibFileName = mainFileName_root.'.bbl' + + let biblinesBefore = Tex_CatFile(bibFileName) + + echomsg "Running '".Tex_GetVarValue('Tex_BibtexFlavor')."' ..." + let temp_mp = &mp | let &mp = Tex_GetVarValue('Tex_BibtexFlavor') + exec 'silent! make '.mainFileName_root + let &mp = temp_mp + + let biblinesAfter = Tex_CatFile(bibFileName) + + " If the .bbl file changed after running bibtex, we need to + " latex again. + if biblinesAfter != biblinesBefore + echomsg 'Need to rerun because bibliography file changed...' + call Tex_Debug('Tex_CompileMultipleTimes: Need to rerun because bibliography file changed...', 'comp') + let needToRerun = 1 + endif + endif + + " check if latex asks us to rerun + let auxlinesAfter = Tex_GetAuxFile(auxFileName) + if auxlinesAfter != auxlinesBefore + echomsg "Need to rerun because the AUX file changed..." + call Tex_Debug("Tex_CompileMultipleTimes: Need to rerun to get cross-references right...", 'comp') + let needToRerun = 1 + endif + + let runCount = runCount + 1 + endwhile + + call Tex_Debug("Tex_CompileMultipleTimes: Ran latex ".runCount." time(s)", "comp") + echomsg "Ran latex ".runCount." time(s)" + + let g:Tex_IgnoredWarnings = origpats + exec 'TCLevel '.origlevel + " After all compiler calls are done, reparse the .log file for + " errors/warnings to handle the situation where the clist might have been + " emptied because of bibtex/makeindex being run as the last step. + exec 'silent! cfile '.mainFileName_root.'.log' + + call Tex_CD(curd) +endfunction " }}} +" Tex_GetAuxFile: get the contents of the AUX file {{{ +" Description: get the contents of the AUX file recursively including any +" @\input'ted AUX files. +function! Tex_GetAuxFile(auxFile) + if !filereadable(a:auxFile) + return '' + endif + + let auxContents = Tex_CatFile(a:auxFile) + let pattern = '@\input{\(.\{-}\)}' + + let auxContents = substitute(auxContents, pattern, '\=Tex_GetAuxFile(submatch(1))', 'g') + + return auxContents +endfunction " }}} + +" ============================================================================== +" Helper functions for +" . viewing the log file in preview mode. +" . syncing the display between the quickfix window and preview window +" . going to the correct line _and column_ number from from the quick fix +" window. +" ============================================================================== +" Tex_SetupErrorWindow: sets up the cwindow and preview of the .log file {{{ +" Description: +function! Tex_SetupErrorWindow() + let mainfname = Tex_GetMainFileName() + + let winnum = winnr() + + " close the quickfix window before trying to open it again, otherwise + " whether or not we end up in the quickfix window after the :cwindow + " command is not fixed. + cclose + cwindow + " create log file name from mainfname + let mfnlog = fnamemodify(mainfname, ":t:r").'.log' + call Tex_Debug('Tex_SetupErrorWindow: mfnlog = '.mfnlog, 'comp') + " if we moved to a different window, then it means we had some errors. + if winnum != winnr() + if Tex_GetVarValue('Tex_ShowErrorContext') + call Tex_UpdatePreviewWindow(mfnlog) + exe 'nnoremap <buffer> <silent> j j:call Tex_UpdatePreviewWindow("'.mfnlog.'")<CR>' + exe 'nnoremap <buffer> <silent> k k:call Tex_UpdatePreviewWindow("'.mfnlog.'")<CR>' + exe 'nnoremap <buffer> <silent> <up> <up>:call Tex_UpdatePreviewWindow("'.mfnlog.'")<CR>' + exe 'nnoremap <buffer> <silent> <down> <down>:call Tex_UpdatePreviewWindow("'.mfnlog.'")<CR>' + endif + exe 'nnoremap <buffer> <silent> <enter> :call Tex_GotoErrorLocation("'.mfnlog.'")<CR>' + + setlocal nowrap + + " resize the window to just fit in with the number of lines. + exec ( line('$') < 4 ? line('$') : 4 ).' wincmd _' + if Tex_GetVarValue('Tex_GotoError') == 1 + call Tex_GotoErrorLocation(mfnlog) + else + exec s:origwinnum.' wincmd w' + endif + endif + +endfunction " }}} +" Tex_PositionPreviewWindow: positions the preview window correctly. {{{ +" Description: +" The purpose of this function is to count the number of times an error +" occurs on the same line. or in other words, if the current line is +" something like |10 error|, then we want to count the number of +" lines in the quickfix window before this line which also contain lines +" like |10 error|. +" +function! Tex_PositionPreviewWindow(filename) + + if getline('.') !~ '|\d\+ \(error\|warning\)|' + if !search('|\d\+ \(error\|warning\)|') + call Tex_Debug("not finding error pattern anywhere in quickfix window :".bufname(bufnr('%')), + \ 'comp') + pclose! + return + endif + endif + + " extract the error pattern (something like 'file.tex|10 error|') on the + " current line. + let errpat = matchstr(getline('.'), '^\f*|\d\+ \(error\|warning\)|\ze') + let errfile = matchstr(getline('.'), '^\f*\ze|\d\+ \(error\|warning\)|') + " extract the line number from the error pattern. + let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(error\|warning\)|') + + " if we are on an error, then count the number of lines before this in the + " quickfix window with an error on the same line. + if errpat =~ 'error|$' + " our location in the quick fix window. + let errline = line('.') + + " goto the beginning of the quickfix window and begin counting the lines + " which show an error on the same line. + 0 + let numrep = 0 + while 1 + " if we are on the same kind of error line, then means we have another + " line containing the same error pattern. + if getline('.') =~ errpat + let numrep = numrep + 1 + normal! 0 + endif + " if we have reached the original location in the quick fix window, + " then break. + if line('.') == errline + break + else + " otherwise, search for the next line which contains the same + " error pattern again. goto the end of the current line so we + " dont count this line again. + normal! $ + call search(errpat, 'W') + endif + endwhile + else + let numrep = 1 + endif + + if getline('.') =~ '|\d\+ warning|' + let searchpat = escape(matchstr(getline('.'), '|\d\+ warning|\s*\zs.*'), '\ ') + else + let searchpat = 'l\.'.linenum + endif + + " We first need to be in the scope of the correct file in the .log file. + " This is important for example, when a.tex and b.tex both have errors on + " line 9 of the file and we want to go to the error of b.tex. Merely + " searching forward from the beginning of the log file for l.9 will always + " land us on the error in a.tex. + if errfile != '' + exec 'silent! bot pedit +/(\\(\\f\\|\\[\\|\]\\|\\s\\)*'.errfile.'/ '.a:filename + else + exec 'bot pedit +0 '.a:filename + endif + " Goto the preview window + " TODO: This is not robust enough. Check that a wincmd j actually takes + " us to the preview window. + wincmd j + " now search forward from this position in the preview window for the + " numrep^th error of the current line in the quickfix window. + while numrep > 0 + call search(searchpat, 'W') + let numrep = numrep - 1 + endwhile + normal! z. + +endfunction " }}} +" Tex_UpdatePreviewWindow: updates the view of the log file {{{ +" Description: +" This function should be called when focus is in a quickfix window. +" It opens the log file in a preview window and makes it display that +" part of the log file which corresponds to the error which the user is +" currently on in the quickfix window. Control returns to the quickfix +" window when the function returns. +" +function! Tex_UpdatePreviewWindow(filename) + call Tex_PositionPreviewWindow(a:filename) + + if &previewwindow + 6 wincmd _ + wincmd p + endif +endfunction " }}} +" Tex_GotoErrorLocation: goes to the correct location of error in the tex file {{{ +" Description: +" This function should be called when focus is in a quickfix window. This +" function will first open the preview window of the log file (if it is not +" already open), position the display of the preview to coincide with the +" current error under the cursor and then take the user to the file in +" which this error has occured. +" +" The position is both the correct line number and the column number. +function! Tex_GotoErrorLocation(filename) + + " first use vim's functionality to take us to the location of the error + " accurate to the line (not column). This lets us go to the correct file + " without applying any logic. + exec "normal! \<enter>" + " If the log file is not found, then going to the correct line number is + " all we can do. + if glob(a:filename) == '' + return + endif + + let winnum = winnr() + " then come back to the quickfix window + wincmd w + + " find out where in the file we had the error. + let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(warning\|error\)|') + call Tex_PositionPreviewWindow(a:filename) + + if getline('.') =~ 'l.\d\+' + + let brokenline = matchstr(getline('.'), 'l.'.linenum.' \zs.*\ze') + " If the line is of the form + " l.10 ...and then there was some error + " it means (most probably) that only part of the erroneous line is + " shown. In this case, finding the length of the broken line is not + " correct. Instead goto the beginning of the line and search forward + " for the part which is displayed and then go to its end. + if brokenline =~ '^\M...' + let partline = matchstr(brokenline, '^\M...\m\zs.*') + let normcmd = "0/\\V".escape(partline, "\\")."/e+1\<CR>" + else + let column = strlen(brokenline) + 1 + let normcmd = column.'|' + endif + + elseif getline('.') =~ 'LaTeX Warning: \(Citation\|Reference\) `.*' + + let ref = matchstr(getline('.'), "LaTeX Warning: \\(Citation\\|Reference\\) `\\zs[^']\\+\\ze'") + let normcmd = '0/'.ref."\<CR>" + + else + + let normcmd = '0' + + endif + + " go back to the window where we came from. + exec winnum.' wincmd w' + exec 'silent! '.linenum.' | normal! '.normcmd + + if !Tex_GetVarValue('Tex_ShowErrorContext') + pclose! + endif +endfunction " }}} +" Tex_SetCompilerMaps: sets maps for compiling/viewing/searching {{{ +" Description: +function! <SID>Tex_SetCompilerMaps() + if exists('b:Tex_doneCompilerMaps') + return + endif + let s:ml = exists('g:mapleader') ? g:mapleader : "\\" + + nnoremap <buffer> <Plug>Tex_Compile :call Tex_RunLaTeX()<cr> + vnoremap <buffer> <Plug>Tex_Compile :call Tex_PartCompile()<cr> + nnoremap <buffer> <Plug>Tex_View :call Tex_ViewLaTeX()<cr> + nnoremap <buffer> <Plug>Tex_ForwardSearch :call Tex_ForwardSearchLaTeX()<cr> + + call Tex_MakeMap(s:ml."ll", "<Plug>Tex_Compile", 'n', '<buffer>') + call Tex_MakeMap(s:ml."ll", "<Plug>Tex_Compile", 'v', '<buffer>') + call Tex_MakeMap(s:ml."lv", "<Plug>Tex_View", 'n', '<buffer>') + call Tex_MakeMap(s:ml."ls", "<Plug>Tex_ForwardSearch", 'n', '<buffer>') +endfunction +" }}} + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('compiler.vim: Catching LatexSuiteFileType event', 'comp') | + \ call <SID>Tex_SetCompilerMaps() +augroup END + +command! -nargs=0 -range=% TPartCompile :<line1>, <line2> silent! call Tex_PartCompile() +" Setting b:fragmentFile = 1 makes Tex_CompileLatex consider the present file +" the _main_ file irrespective of the presence of a .latexmain file. +command! -nargs=0 TCompileThis let b:fragmentFile = 1 +command! -nargs=0 TCompileMainFile let b:fragmentFile = 0 + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/custommacros.vim b/vimfiles.latex/ftplugin/latex-suite/custommacros.vim new file mode 100644 index 0000000..1b1c6bd --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/custommacros.vim @@ -0,0 +1,257 @@ +"============================================================================= +" File: custommacros.vim +" Author: Mikolaj Machowski +" Version: 1.0 +" Created: Tue Apr 23 05:00 PM 2002 PST +" CVS: $Id: custommacros.vim 997 2006-03-20 09:45:45Z srinathava $ +" +" Description: functions for processing custom macros in the +" latex-suite/macros directory +"============================================================================= + +let s:path = expand('<sfile>:p:h') + +" Set path to macros dir dependent on OS {{{ +if has("unix") || has("macunix") + let s:macrodirpath = $HOME."/.vim/ftplugin/latex-suite/macros/" +elseif has("win32") + if exists("$HOME") + let s:macrodirpath = $HOME."/vimfiles/ftplugin/latex-suite/macros/" + else + let s:macrodirpath = $VIM."/vimfiles/ftplugin/latex-suite/macros/" + endif +endif + +" }}} +" SetCustomMacrosMenu: sets up the menu for Macros {{{ +function! <SID>SetCustomMacrosMenu() + let flist = Tex_FindInRtp('', 'macros') + exe 'amenu '.g:Tex_MacrosMenuLocation.'&New :call <SID>NewMacro("FFFromMMMenu")<CR>' + exe 'amenu '.g:Tex_MacrosMenuLocation.'&Redraw :call RedrawMacro()<CR>' + + let i = 1 + while 1 + let fname = Tex_Strntok(flist, ',', i) + if fname == '' + break + endif + exe "amenu ".g:Tex_MacrosMenuLocation."&Delete.&".i.":<tab>".fname." :call <SID>DeleteMacro('".fname."')<CR>" + exe "amenu ".g:Tex_MacrosMenuLocation."&Edit.&".i.":<tab>".fname." :call <SID>EditMacro('".fname."')<CR>" + exe "imenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fname." <C-r>=<SID>ReadMacro('".fname."')<CR>" + exe "nmenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fname." i<C-r>=<SID>ReadMacro('".fname."')<CR>" + let i = i + 1 + endwhile +endfunction + +if g:Tex_Menus + call <SID>SetCustomMacrosMenu() +endif + +" }}} +" NewMacro: opens new file in macros directory {{{ +function! <SID>NewMacro(...) + " Allow for calling :TMacroNew without argument or from menu and prompt + " for name. + if a:0 > 0 + let newmacroname = a:1 + else + let newmacroname = input("Name of new macro: ") + if newmacroname == '' + return + endif + endif + + if newmacroname == "FFFromMMMenu" + " Check if NewMacro was called from menu and prompt for insert macro + " name + let newmacroname = input("Name of new macro: ") + if newmacroname == '' + return + endif + elseif Tex_FindInRtp(newmacroname, 'macros') != '' + " If macro with this name already exists, prompt for another name. + exe "echomsg 'Macro ".newmacroname." already exists. Try another name.'" + let newmacroname = input("Name of new macro: ") + if newmacroname == '' + return + endif + endif + exec 'split '.Tex_EscapeSpaces(s:macrodirpath.newmacroname) + setlocal filetype=tex +endfunction + +" }}} +" RedrawMacro: refreshes macro menu {{{ +function! RedrawMacro() + aunmenu TeX-Suite.Macros + call <SID>SetCustomMacrosMenu() +endfunction + +" }}} +" ChooseMacro: choose a macro file {{{ +" " Description: +function! s:ChooseMacro(ask) + let filelist = Tex_FindInRtp('', 'macros') + let filename = Tex_ChooseFromPrompt( + \ a:ask."\n" . + \ Tex_CreatePrompt(filelist, 2, ',') . + \ "\nEnter number or filename :", + \ filelist, ',') +endfunction + +" }}} +" DeleteMacro: deletes macro file {{{ +function! <SID>DeleteMacro(...) + if a:0 > 0 + let filename = a:1 + else + let filename = s:ChooseMacro('Choose a macro file for deletion :') + endif + + if !filereadable(s:macrodirpath.filename) + " When file is not in local directory decline to remove it. + call confirm('This file is not in your local directory: '.filename."\n". + \ 'It will not be deleted.' , '&OK', 1) + + else + let ch = confirm('Really delete '.filename.' ?', "&Yes\n&No", 2) + if ch == 1 + call delete(s:macrodirpath.filename) + endif + call RedrawMacro() + endif +endfunction + +" }}} +" EditMacro: edits macro file {{{ +function! <SID>EditMacro(...) + if a:0 > 0 + let filename = a:1 + else + let filename = s:ChooseMacro('Choose a macro file for insertion:') + endif + + if filereadable(s:macrodirpath.filename) + " If file exists in local directory open it. + exec 'split '.Tex_EscapeSpaces(s:macrodirpath.filename) + else + " But if file doesn't exist in local dir it probably is in user + " restricted area. Instead opening try to copy it to local dir. + " Pity VimL doesn't have mkdir() function :) + let ch = confirm("You are trying to edit file which is probably read-only.\n". + \ "It will be copied to your local LaTeX-Suite macros directory\n". + \ "and you will be operating on local copy with suffix -local.\n". + \ "It will succeed only if ftplugin/latex-suite/macros dir exists.\n". + \ "Do you agree?", "&Yes\n&No", 1) + if ch == 1 + " But there is possibility we already created local modification. + " Check it and offer opening this file. + if filereadable(s:macrodirpath.filename.'-local') + let ch = confirm('Local version of '.filename." already exists.\n". + \ 'Do you want to open it or overwrite with original version?', + \ "&Open\nOver&write\n&Cancel", 1) + if ch == 1 + exec 'split '.Tex_EscapeSpaces(s:macrodirpath.filename.'-local') + elseif ch == 2 + new + exe '0read '.Tex_FindInRtp(filename, 'macros') + " This is possible macro was edited before, wipe it out. + if bufexists(s:macrodirpath.filename.'-local') + exe 'bwipe '.s:macrodirpath.filename.'-local' + endif + exe 'write! '.s:macrodirpath.filename.'-local' + else + return + endif + else + " If file doesn't exist, open new file, read in system macro and + " save it in local macro dir with suffix -local + new + exe '0read '.Tex_FindInRtp(filename, 'macros') + exe 'write '.s:macrodirpath.filename.'-local' + endif + endif + + endif + setlocal filetype=tex +endfunction + +" }}} +" ReadMacro: reads in a macro from a macro file. {{{ +" allowing for placement via placeholders. +function! <SID>ReadMacro(...) + + if a:0 > 0 + let filename = a:1 + else + let filelist = Tex_FindInRtp('', 'macros') + let filename = + \ Tex_ChooseFromPrompt("Choose a macro file:\n" . + \ Tex_CreatePrompt(filelist, 2, ',') . + \ "\nEnter number or name of file :", + \ filelist, ',') + endif + + let fname = Tex_FindInRtp(filename, 'macros', ':p') + + let markerString = '<---- Latex Suite End Macro ---->' + let _a = @a + let position = line('.').' | normal! '.virtcol('.').'|' + silent! call append(line('.'), markerString) + silent! exec "read ".fname + silent! exec "normal! V/^".markerString."$/-1\<CR>\"ax" + " This is kind of tricky: At this stage, we are one line after the one we + " started from with the marker text on it. We need to + " 1. remove the marker and the line. + " 2. get focus to the previous line. + " 3. not remove anything from the previous line. + silent! exec "normal! $v0k$\"_x" + + call Tex_CleanSearchHistory() + + let @a = substitute(@a, '['."\n\r\t ".']*$', '', '') + let textWithMovement = IMAP_PutTextWithMovement(@a) + let @a = _a + + return textWithMovement + +endfunction + +" }}} +" commands for macros {{{ +com! -nargs=? TMacroNew :call <SID>NewMacro(<f-args>) + +" This macros had to have 2 versions: +if v:version >= 602 + com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacro + \ :let s:retVal = <SID>ReadMacro(<f-args>) <bar> normal! i<C-r>=s:retVal<CR> + com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacroEdit + \ :call <SID>EditMacro(<f-args>) + com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacroDelete + \ :call <SID>DeleteMacro(<f-args>) + + " Tex_CompleteMacroName: for completing names in TMacro... commands {{{ + " Description: get list of macro names with Tex_FindInRtp(), remove full path + " and return list of names separated with newlines. + " + function! Tex_CompleteMacroName(A,P,L) + " Get name of macros from all runtimepath directories + let macronames = Tex_FindInRtp('', 'macros') + " Separate names with \n not , + let macronames = substitute(macronames,',','\n','g') + return macronames + endfunction + + " }}} + +else + com! -nargs=? TMacro + \ :let s:retVal = <SID>ReadMacro(<f-args>) <bar> normal! i<C-r>=s:retVal<CR> + com! -nargs=? TMacroEdit :call <SID>EditMacro(<f-args>) + com! -nargs=? TMacroDelete :call <SID>DeleteMacro(<f-args>) + +endif + +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/diacritics.vim b/vimfiles.latex/ftplugin/latex-suite/diacritics.vim new file mode 100644 index 0000000..616d30a --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/diacritics.vim @@ -0,0 +1,124 @@ +"============================================================================= +" File: diacritics.vim +" Author: Lubomir Host +" Created: Tue Apr 23 07:00 PM 2002 PST +" +" Description: shortcuts for all diacritics. +"============================================================================= + +if !g:Tex_Diacritics + finish +endif + +" \'{a} {{{ +call IMAP ('=a', "\\\'{a}", 'tex') +call IMAP ('=b', "\\'{b}", 'tex') +call IMAP ('=c', "\\'{c}", 'tex') +call IMAP ('=d', "\\'{d}", 'tex') +call IMAP ('=e', "\\'{e}", 'tex') +call IMAP ('=f', "\\'{f}", 'tex') +call IMAP ('=g', "\\'{g}", 'tex') +call IMAP ('=h', "\\'{h}", 'tex') +call IMAP ('=i', "\\'{\i}", 'tex') +call IMAP ('=j', "\\'{j}", 'tex') +call IMAP ('=k', "\\'{k}", 'tex') +call IMAP ('=l', "\\'{l}", 'tex') +call IMAP ('=m', "\\'{m}", 'tex') +call IMAP ('=n', "\\'{n}", 'tex') +call IMAP ('=o', "\\'{o}", 'tex') +call IMAP ('=p', "\\'{p}", 'tex') +call IMAP ('=q', "\\'{q}", 'tex') +call IMAP ('=r', "\\'{r}", 'tex') +call IMAP ('=s', "\\'{s}", 'tex') +call IMAP ('=t', "\\'{t}", 'tex') +call IMAP ('=u', "\\'{u}", 'tex') +call IMAP ('=v', "\\'{v}", 'tex') +call IMAP ('=w', "\\'{w}", 'tex') +call IMAP ('=x', "\\'{x}", 'tex') +call IMAP ('=y', "\\'{y}", 'tex') +call IMAP ('=z', "\\'{z}", 'tex') +call IMAP ('=A', "\\'{A}", 'tex') +call IMAP ('=B', "\\'{B}", 'tex') +call IMAP ('=C', "\\'{C}", 'tex') +call IMAP ('=D', "\\'{D}", 'tex') +call IMAP ('=E', "\\'{E}", 'tex') +call IMAP ('=F', "\\'{F}", 'tex') +call IMAP ('=G', "\\'{G}", 'tex') +call IMAP ('=H', "\\'{H}", 'tex') +call IMAP ('=I', "\\'{\I}", 'tex') +call IMAP ('=J', "\\'{J}", 'tex') +call IMAP ('=K', "\\'{K}", 'tex') +call IMAP ('=L', "\\'{L}", 'tex') +call IMAP ('=M', "\\'{M}", 'tex') +call IMAP ('=N', "\\'{N}", 'tex') +call IMAP ('=O', "\\'{O}", 'tex') +call IMAP ('=P', "\\'{P}", 'tex') +call IMAP ('=Q', "\\'{Q}", 'tex') +call IMAP ('=R', "\\'{R}", 'tex') +call IMAP ('=S', "\\'{S}", 'tex') +call IMAP ('=T', "\\'{T}", 'tex') +call IMAP ('=U', "\\'{U}", 'tex') +call IMAP ('=V', "\\'{V}", 'tex') +call IMAP ('=W', "\\'{W}", 'tex') +call IMAP ('=X', "\\'{X}", 'tex') +call IMAP ('=Y', "\\'{Y}", 'tex') +call IMAP ('=Z', "\\'{Z}", 'tex') +" }}} +" \v{a} {{{ +call IMAP ('+a', "\\v{a}", 'tex') +call IMAP ('+b', "\\v{b}", 'tex') +call IMAP ('+c', "\\v{c}", 'tex') +call IMAP ('+d', "\\v{d}", 'tex') +call IMAP ('+e', "\\v{e}", 'tex') +call IMAP ('+f', "\\v{f}", 'tex') +call IMAP ('+g', "\\v{g}", 'tex') +call IMAP ('+h', "\\v{h}", 'tex') +call IMAP ('+i', "\\v{\i}", 'tex') +call IMAP ('+j', "\\v{j}", 'tex') +call IMAP ('+k', "\\v{k}", 'tex') +call IMAP ('+l', "\\q l", 'tex') +call IMAP ('+m', "\\v{m}", 'tex') +call IMAP ('+n', "\\v{n}", 'tex') +call IMAP ('+o', "\\v{o}", 'tex') +call IMAP ('+p', "\\v{p}", 'tex') +call IMAP ('+q', "\\v{q}", 'tex') +call IMAP ('+r', "\\v{r}", 'tex') +call IMAP ('+s', "\\v{s}", 'tex') +call IMAP ('+t', "\\q t", 'tex') +call IMAP ('+u', "\\v{u}", 'tex') +call IMAP ('+v', "\\v{v}", 'tex') +call IMAP ('+w', "\\v{w}", 'tex') +call IMAP ('+x', "\\v{x}", 'tex') +call IMAP ('+y', "\\v{y}", 'tex') +call IMAP ('+z', "\\v{z}", 'tex') +call IMAP ('+A', "\\v{A}", 'tex') +call IMAP ('+B', "\\v{B}", 'tex') +call IMAP ('+C', "\\v{C}", 'tex') +call IMAP ('+D', "\\v{D}", 'tex') +call IMAP ('+E', "\\v{E}", 'tex') +call IMAP ('+F', "\\v{F}", 'tex') +call IMAP ('+G', "\\v{G}", 'tex') +call IMAP ('+H', "\\v{H}", 'tex') +call IMAP ('+I', "\\v{\I}", 'tex') +call IMAP ('+J', "\\v{J}", 'tex') +call IMAP ('+K', "\\v{K}", 'tex') +call IMAP ('+L', "\\v{L}", 'tex') +call IMAP ('+M', "\\v{M}", 'tex') +call IMAP ('+N', "\\v{N}", 'tex') +call IMAP ('+O', "\\v{O}", 'tex') +call IMAP ('+P', "\\v{P}", 'tex') +call IMAP ('+Q', "\\v{Q}", 'tex') +call IMAP ('+R', "\\v{R}", 'tex') +call IMAP ('+S', "\\v{S}", 'tex') +call IMAP ('+T', "\\v{T}", 'tex') +call IMAP ('+U', "\\v{U}", 'tex') +call IMAP ('+V', "\\v{V}", 'tex') +call IMAP ('+W', "\\v{W}", 'tex') +call IMAP ('+X', "\\v{X}", 'tex') +call IMAP ('+Y', "\\v{Y}", 'tex') +call IMAP ('+Z', "\\v{Z}", 'tex') +" }}} +call IMAP ('+}', "\\\"{a}", 'tex') +call IMAP ('+:', "\\^{o}", 'tex') + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/dictionaries/SIunits b/vimfiles.latex/ftplugin/latex-suite/dictionaries/SIunits new file mode 100644 index 0000000..d4ac081 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/dictionaries/SIunits @@ -0,0 +1,289 @@ +addprefix +addunit +ampere +amperemetresecond +amperepermetre +amperepermetrenp +amperepersquaremetre +amperepersquaremetrenp +angstrom +arad +arcminute +arcsecond +are +atomicmass +atto +attod +barn +bbar +becquerel +becquerelbase +bel +candela +candelapersquaremetre +candelapersquaremetrenp +celsius +Celsius +celsiusbase +centi +centid +coulomb +coulombbase +coulombpercubicmetre +coulombpercubicmetrenp +coulombperkilogram +coulombperkilogramnp +coulombpermol +coulombpermolnp +coulombpersquaremetre +coulombpersquaremetrenp +cubed +cubic +cubicmetre +cubicmetreperkilogram +cubicmetrepersecond +curie +dday +deca +decad +deci +decid +degree +degreecelsius +deka +dekad +derbecquerel +dercelsius +dercoulomb +derfarad +dergray +derhenry +derhertz +derjoule +derkatal +derlumen +derlux +dernewton +derohm +derpascal +derradian +dersiemens +dersievert +dersteradian +dertesla +dervolt +derwatt +derweber +electronvolt +exa +exad +farad +faradbase +faradpermetre +faradpermetrenp +femto +femtod +fourth +gal +giga +gigad +gram +graybase +graypersecond +graypersecondnp +hectare +hecto +hectod +henry +henrybase +henrypermetre +henrypermetrenp +hertz +hertzbase +hour +joule +joulebase +joulepercubicmetre +joulepercubicmetrenp +jouleperkelvin +jouleperkelvinnp +jouleperkilogram +jouleperkilogramkelvin +jouleperkilogramkelvinnp +jouleperkilogramnp +joulepermole +joulepermolekelvin +joulepermolekelvinnp +joulepermolenp +joulepersquaremetre +joulepersquaremetrenp +joulepertesla +jouleperteslanp +katal +katalbase +katalpercubicmetre +katalpercubicmetrenp +kelvin +kilo +kilod +kilogram +kilogrammetrepersecond +kilogrammetrepersecondnp +kilogrammetrepersquaresecond +kilogrammetrepersquaresecondnp +kilogrampercubicmetre +kilogrampercubicmetrecoulomb +kilogrampercubicmetrecoulombnp +kilogrampercubicmetrenp +kilogramperkilomole +kilogramperkilomolenp +kilogrampermetre +kilogrampermetrenp +kilogrampersecond +kilogrampersecondcubicmetre +kilogrampersecondcubicmetrenp +kilogrampersecondnp +kilogrampersquaremetre +kilogrampersquaremetrenp +kilogrampersquaremetresecond +kilogrampersquaremetresecondnp +kilogramsquaremetre +kilogramsquaremetrenp +kilogramsquaremetrepersecond +kilogramsquaremetrepersecondnp +kilowatthour +liter +litre +lumen +lumenbase +lux +luxbase +mega +megad +meter +metre +metrepersecond +metrepersecondnp +metrepersquaresecond +metrepersquaresecondnp +micro +microd +milli +millid +minute +mole +molepercubicmetre +molepercubicmetrenp +nano +nanod +neper +newton +newtonbase +newtonmetre +newtonpercubicmetre +newtonpercubicmetrenp +newtonperkilogram +newtonperkilogramnp +newtonpermetre +newtonpermetrenp +newtonpersquaremetre +newtonpersquaremetrenp +NoAMS +no@qsk +ohm +ohmbase +ohmmetre +one +paminute +pascal +pascalbase +pascalsecond +pasecond +per +period@active +persquaremetresecond +persquaremetresecondnp +peta +petad +pico +picod +power +@qsk +quantityskip +rad +radian +radianbase +radianpersecond +radianpersecondnp +radianpersquaresecond +radianpersquaresecondnp +reciprocal +rem +roentgen +rp +rpcubed +rpcubic +rpcubicmetreperkilogram +rpcubicmetrepersecond +rperminute +rpersecond +rpfourth +rpsquare +rpsquared +rpsquaremetreperkilogram +second +siemens +siemensbase +sievert +sievertbase +square +squared +squaremetre +squaremetrepercubicmetre +squaremetrepercubicmetrenp +squaremetrepercubicsecond +squaremetrepercubicsecondnp +squaremetreperkilogram +squaremetrepernewtonsecond +squaremetrepernewtonsecondnp +squaremetrepersecond +squaremetrepersecondnp +squaremetrepersquaresecond +squaremetrepersquaresecondnp +steradian +steradianbase +tera +terad +tesla +teslabase +ton +tonne +unit +unitskip +usk +volt +voltbase +voltpermetre +voltpermetrenp +watt +wattbase +wattpercubicmetre +wattpercubicmetrenp +wattperkilogram +wattperkilogramnp +wattpermetrekelvin +wattpermetrekelvinnp +wattpersquaremetre +wattpersquaremetrenp +wattpersquaremetresteradian +wattpersquaremetresteradiannp +weber +weberbase +yocto +yoctod +yotta +yottad +zepto +zeptod +zetta +zettad diff --git a/vimfiles.latex/ftplugin/latex-suite/dictionaries/dictionary b/vimfiles.latex/ftplugin/latex-suite/dictionaries/dictionary new file mode 100644 index 0000000..458dc0b --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/dictionaries/dictionary @@ -0,0 +1,677 @@ +abbrv +abovedisplayshortskip +abovedisplayskip +abstract +abstract +abstractname +acute +addcontentsline +address +addtime +addtocontents +addtocounter +addtolength +addvspace +align +alph +Alph +alpha +amsmath +amsthm +and +appendix +appendixname +arabic +array +arraycolsep +arrayrulewidth +arraystretch +article +author +a4paper +a5paper +backmatter +bar +bar +baselineskip +baselinestretch +batchmode +begin +belowdisplayshortskip +belowdisplayskip +bezier +bf +bfseries +bibindent +bibitem +bibliography +bibliographystyle +bibname +big +Big +Bigg +bigg +Biggl +biggl +Biggm +biggm +Biggr +biggr +Bigl +bigl +bigm +Bigm +bigr +Bigr +bigskip +bigskipamount +binom +blg +boldmath +boldsymbol +book +botfigrule +bottmofraction +bottomnumber +boxedminipage +bp +breve +b5paper +calc +calc +caption +caption2 +capt-of +cases +cc +ccaption +ccname +cdotscenter +centering +cercle +cfrac +changebar +chapter +chapterbib +chaptername +check +cite +cleardoublepage +clearpage +cline +clock +closing +cm +COLON +columnsep +columnseprule +columnwidth +contentsline +contentsname +copyright +dag +dashbox +date +dbinom +dblfigure +dblfloatpage +dblfloatsep +dbltextfloatsep +dbltopfraction +dbltopnumber +dcolumn +dd +ddag +ddot +ddots +DeclareMathOperator +depth +description +dfrac +displaylimits +displaymath +displaystyle +document +documentclass +dot +dotfill +doublerulesep +downbracefill +draft +dropping +dywiz +em +emph +empty +encl +enclname +end +endfloat +enlargethispage +enskip +enspace +ensuremath +enumerate +enumi +enumii +enumiii +enumiv +eqnarray +equation +errorstopmode +eucal +eufrak +evensidemargin +everyship +ex +executivepaper +expdlist +extracolsep +extramark +fancybox +fancyhdr +fbox +fboxrule +fboxsep +figure +figurename +file +filecontents +final +flafter +fleqn +floatflt +floatpagefraction +floatsep +flushbottom +flushleft +flushright +fnpara +fnsymbol +fn2end +fontenc +footheight +footmisc +footnote +footnotemark +footnoterule +footnotesep +footnotesize +footnotetext +footnpag +footskip +frac +frame +framebox +frenchspacing +frontmatter +ftnright +fussy +gather +genfrac +geometry +glossary +glossaryentry +graphicx +graphpaper +grave +hat +hbox +headheihgt +headings +headsep +height +helvet +hfill +hhline +hline +hrulefill +hspace +huge +Huge +HUGE +hyperref +hyphenation +ifthen +in +include +includeonly +indent +indentfirst +index +indexentry +indexname +indexspace +input +inputenc +intertext +intextsep +invisible +it +item +itemindent +itemize +itemsep +itshape +jot +kill +label +labelenumi +labelenumii +labelenumiii +labelenumiv +labelitemi +labelitemii +labelitemiii +labelitemiv +labelsep +labelwidth +landscape +large +LARGE +Large +LaTeX +LaTeXe +latexsym +ldots +left +leftarrowfill +lefteqn +leftmargin +leftmargini +leftmarginii +leftmarginiii +leftmarginiv +leftmarginv +leftmarginvi +leftmark +legalpaper +leq +leqno +letter +letterpaper +letterspace +lhead +limits +line +linebreak +linethickness +linewidth +list +listfigurename +listfiles +listoffigures +listoftables +listparindent +location +longtable +lq +lrbox +lscape +mainmatter +makeatletter +makeatother +makebox +makeglossary +makeidx +makeindex +makelabel +maketitle +manyfoot +marginpar +marginparpush +marginparsep +marginparwidth +markboth +markleft +markright +math +mathbb +mathbf +mathbin +mathcal +mathclose +mathfrak +mathindent +mathit +mathnormal +mathop +mathopen +mathord +mathpunct +mathrel +mathrm +mathscr +mathsf +mathstrut +mathtt +mathversion +mbox +mdseries +medmuskip +medskip +medskipamount +minipage +minitoc +minus +mkern +mm +moreverbatim +mpfootnote +mu +multicol +multicolumn +multilanguage +multiput +multirow +myheadings +nabla +name +NeedsTeXFormat +newcommand +newcounter +newenvironment +newfont +newlength +newline +newpage +newsavebox +newtheorem +nocite +nofiles +noindent +nolimits +nolinebreak +nomathsymbols +nonfrenchspacing +nonumber +nopagebreak +normalfont +normalsize +not +notag +note +notitlepage +nu +numberline +numline +numprint +oddsidemargin +oldstyle +onecolumn +oneside +onlynotes +onlyslides +openany +openbib +opening +openright +operatorname +oval +overbrace +overlay +overleftarrow +overline +overrightarrow +page +pagebreak +pagenumbering +pageref +pagestyle +paperheight +paperwidth +par +paragraph +parbox +parbox +parindent +parsep +parskip +part +partial +partname +partopsep +pauza +pc +phi +pi +picture +plain +PLdateending +plmath +PLSlash +plus +pmb +pmod +polski +polski +poptabs +pounds +ppauza +prefixing +printindex +protect +providecommand +ps +pt +pushtabs +put +qbezier +qbeziermax +qquad +quad +quotation +quote +raggedbottom +raggedleft +raggedright +ragged2e +raisebox +ratio +real +ref +refname +refstepcounter +relsize +renewcommand +renewenvironment +report +reversemarginpar +rhead +right +rightarrowfill +rightmargin +rightmark +rm +rmfamily +roman +Roman +rotate +rotating +rq +rule +samepage +savebox +sb +sbox +sc +scriptscriptstyle +scriptsize +scriptstyle +scrollmode +scshape +secnumdepth +section +sectionmark +see +seename +selectfont +selectlanguage +setcounter +setlength +settime +settodepth +settoheight +settowidth +sf +sffamily +shadethm +shadow +shapepar +shortstack +showlabels +sidecap +signature +sin +sl +slide +slides +sloppy +sloppybar +slshape +small +smallskip +smallskipamount +soul +sp +space +sqrt +ss +SS +stackrel +startbreaks +stepcounter +stop +stopbreaks +stretch +strut +subfigure +subfigure +subitem +subparagraph +subsection +subsubitem +subsubsection +sum +supressfloats +symbol +symbol +tabbing +tabcolsep +table +tablename +tableofcontents +tabular +tabularx +tag +tan +tbinom +telephone +TeX +textbf +textbullet +textcircled +textcompwordmark +textemdash +textendash +textexclamdown +textfloatsep +textfraction +textheight +textit +textmd +textnormal +textperiodcenter +textquestiondown +textquotedblleft +textquotedblright +textquoteleft +textquoteright +textrm +textsc +textsf +textsl +textstyle +textsuperscript +texttt +textup +textvisiblespace +textwidth +tfrac +thanks +the +thebibliography +theindex +theorem +thepage +thesection +theta +thicklines +thickmuskip +thinlines +thispagestyle +tilde +time +times +tiny +title +titlepage +tocdepth +today +topfigrule +topfraction +topmargin +topmargin +topmargin +topsep +topskip +topskip +totalheight +totalnumber +trivlist +tt +ttfamily +twocolumn +twocolumn +twoside +typein +typein +typeout +typeout +ulem +ulem +unboldmath +underbrace +underline +unsort +unsrt +upbracefill +upshape +upshape +usebox +usebox +usecounter +usefont +usepackage +value +vbox +vdots +vec +vector +verb +verb +verbatim +verse +vfill +visible +vline +vmargin +voffset +vspace +widehat +widetilde +width +wrapfig +xleftarrow +xrightarrow +threeparttable diff --git a/vimfiles.latex/ftplugin/latex-suite/elementmacros.vim b/vimfiles.latex/ftplugin/latex-suite/elementmacros.vim new file mode 100644 index 0000000..8960a0f --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/elementmacros.vim @@ -0,0 +1,338 @@ +"============================================================================= +" File: elementmacros.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 06:00 PM 2002 PST +" +" Description: macros for dimensions/fonts/counters. +" and various common commands such ref/label/footnote. +"============================================================================= + +nmap <silent> <script> <plug> i +imap <silent> <script> <C-o><plug> <Nop> + +if exists('s:lastElementsLocation') && g:Tex_ElementsMenuLocation == s:lastElementsLocation + finish +endif + +if exists('s:lastElementsLocation') + exe 'aunmenu '.s:lastElementsLocation.'Font.' + exe 'aunmenu '.s:lastElementsLocation.'Dimension.' + exe 'aunmenu '.s:lastElementsLocation.'Counters.' + exe 'aunmenu '.s:lastElementsLocation.'Various.' +endif + +let s:lastElementsLocation = g:Tex_ElementsMenuLocation + +let s:fontMenuLoc = g:Tex_ElementsMenuLocation.'Font.' +let s:dimensionMenuLoc = g:Tex_ElementsMenuLocation.'Dimension.' +let s:counterMenuLoc = g:Tex_ElementsMenuLocation.'Counters.' +let s:variousMenuLoc = g:Tex_ElementsMenuLocation.'Various.' + +" ============================================================================== +" Set up the functions the first time. +" ============================================================================== +if !exists('s:definedFuncs') " {{{ + let s:definedFuncs = 1 + + " Tex_RemoveElementMenus: remove the elements menu {{{ + " + function! Tex_RemoveElementMenus() + exe 'silent! aunmenu '.s:lastElementsLocation.'Font.' + exe 'silent! aunmenu '.s:lastElementsLocation.'Dimension.' + exe 'silent! aunmenu '.s:lastElementsLocation.'Counters.' + exe 'silent! aunmenu '.s:lastElementsLocation.'Various.' + endfunction + + " }}} + " Tex_FontFamily: sets up font menus {{{ + " + function! <SID>Tex_FontFamily(font,fam) + let vislhs = matchstr(tolower(a:font), '^.\zs.*') + + " avoid redoing imaps and vmaps for every reconfiguration of menus. + if !exists('s:doneOnce') && g:Tex_FontMaps + exe "vnoremap <silent> ".g:Tex_Leader.vislhs. + \" \<C-\\>\<C-N>:call VEnclose('\\text".vislhs."{', '}', '{\\".vislhs.a:fam." ', '}')<CR>" + exe 'call IMAP ("'.a:font.'", "\\text'.vislhs.'{<++>}<++>", "tex")' + endif + + " menu entry. + if g:Tex_Menus && g:Tex_FontMenus + let location = s:fontMenuLoc.substitute(a:fam, '^.', '\u&', '').'.'.vislhs.a:fam.'<tab>'.a:font.'\ ('.g:Tex_Leader.vislhs.')' + exe "amenu ".location. + \" <plug><C-r>=IMAP_PutTextWithMovement('\\text".vislhs."{<++>}<++>')<CR>" + exe "vmenu ".location. + \" \<C-\\>\<C-N>:call VEnclose('\\text".vislhs."{', '}', '{\\".vislhs.a:fam." ', '}')<CR>" + endif + + endfunction + + " }}} + " Tex_FontDiacritics: sets up menus for diacritics. {{{ + " + function! <SID>Tex_FontDiacritics(name, rhs) + let location = s:fontMenuLoc.'&Diacritics.'.a:name.'<tab>' + exe 'amenu '.location. + \" <plug><C-r>=IMAP_PutTextWithMovement('\\".a:rhs."{<++>}<++>')<CR>" + exe 'vmenu '.location. + \" \<C-\\>\<C-n>:call VEnclose('\\".a:rhs."{', '}', '', '')<CR>" + endfunction " }}} + " Tex_FontSize: sets up size fonts {{{ + " + function! <SID>Tex_FontSize(name) + let location = s:fontMenuLoc.'&Size.'.a:name.'<tab>' + exe 'amenu '.location." <plug>\\".a:name + exe 'vunmenu '.location + endfunction " }}} + " Tex_Fontfont: sets up the 'font' part of font menus {{{ + " + function! <SID>Tex_Fontfont(desc, lhs) + let location = s:fontMenuLoc.'&font.'.a:desc.'<tab>' + exe "amenu ".location." <plug><C-r>=IMAP_PutTextWithMovement('".a:lhs."')<CR>" + exe "vunmenu ".location + endfunction " }}} + " Tex_DimMenus: set up dimension menus {{{ + function! <SID>Tex_DimMenus(submenu, rhs) + let location = s:dimensionMenuLoc.a:submenu.'.'.a:rhs.'<tab>' + exe "amenu ".location." <plug>\\".a:rhs + exe "vunmenu ".location + endfunction " }}} + " Tex_CounterMenus: set up counters menus {{{ + function! <SID>Tex_CounterMenus(submenu, rhs) + let location = s:counterMenuLoc.a:submenu.'.'.a:rhs.'<tab>' + exe "amenu ".location." <plug>\\".a:rhs + exe "vunmenu ".location + endfunction " }}} + " Tex_VariousMenus: set up various menus {{{ + function! <SID>Tex_VariousMenus(desc, lhs) + let location = s:variousMenuLoc.a:desc.'<tab>' + exe "amenu ".location." <plug><C-r>=IMAP_PutTextWithMovement('".a:lhs."')<CR>" + exe "vunmenu ".location + endfunction " }}} +endif +" }}} + +" ============================================================================== +" Fonts +" ============================================================================== +" series/family/shape {{{ +call <SID>Tex_FontFamily("FBF","series") +call <SID>Tex_FontFamily("FMD","series") + +call <SID>Tex_FontFamily("FTT","family") +call <SID>Tex_FontFamily("FSF","family") +call <SID>Tex_FontFamily("FRM","family") + +call <SID>Tex_FontFamily("FUP","shape") +call <SID>Tex_FontFamily("FSL","shape") +call <SID>Tex_FontFamily("FSC","shape") +call <SID>Tex_FontFamily("FIT","shape") + +" the \emph is special. +if g:Tex_FontMaps | exe "vnoremap <silent> ".g:Tex_Leader."em \<C-\\>\<C-N>:call VEnclose('\\emph{', '}', '{\\em', '\\/}')<CR>" | endif +if g:Tex_FontMaps | exe 'call IMAP ("FEM", "\\emph{<++>}<++>", "tex")' | endif + +" }}} +if g:Tex_Menus && g:Tex_FontMenus + " {{{ diacritics + call <SID>Tex_FontDiacritics('Acute', '"') + call <SID>Tex_FontDiacritics('Breve', 'u') + call <SID>Tex_FontDiacritics('Circle', 'r') + call <SID>Tex_FontDiacritics('Circumflex', '^') + call <SID>Tex_FontDiacritics('Umlaut', '"') + call <SID>Tex_FontDiacritics('HUmlaut', 'H') + call <SID>Tex_FontDiacritics('Dot\ over', '.') + call <SID>Tex_FontDiacritics('Grave', '`') + call <SID>Tex_FontDiacritics('Hacek', 'v') + call <SID>Tex_FontDiacritics('Makron', '=') + call <SID>Tex_FontDiacritics('Tilde', '~') + call <SID>Tex_FontDiacritics('Underline', 'b') + call <SID>Tex_FontDiacritics('Cedille', 'c') + call <SID>Tex_FontDiacritics('Dot\ under', ' ') + call <SID>Tex_FontDiacritics('Ligature', 't') + " }}} + " {{{ Si&ze. + call <SID>Tex_FontSize('tiny') + call <SID>Tex_FontSize('scriptsize') + call <SID>Tex_FontSize('footnotesize') + call <SID>Tex_FontSize('small') + call <SID>Tex_FontSize('normalsize') + call <SID>Tex_FontSize('large') + call <SID>Tex_FontSize('Large') + call <SID>Tex_FontSize('LARGE') + call <SID>Tex_FontSize('huge') + call <SID>Tex_FontSize('Huge') + " }}} + " {{{ &font. + call s:Tex_Fontfont('fontencoding{}', '\fontencoding{<++>}<++>') + call s:Tex_Fontfont('fontfamily{qtm}', '\fontfamily{<++>}<++>') + call s:Tex_Fontfont('fontseries{m\ b\ bx\ sb\ c}', '\fontseries{<++>}<++>') + call s:Tex_Fontfont('fontshape{n\ it\ sl\ sc\ ui}', '\fontshape{<++>}<++>') + call s:Tex_Fontfont('fontsize{}{}', '\fontsize{<++>}{<++>}<++>') + call s:Tex_Fontfont('selectfont', '\selectfont ') + " }}} +endif + +" ============================================================================== +" Dimensions +" ============================================================================== +if g:Tex_Menus + " {{{ Static1 + call <SID>Tex_DimMenus('Static1', 'arraycolsep') + call <SID>Tex_DimMenus('Static1', 'arrayrulewidth') + call <SID>Tex_DimMenus('Static1', 'bibindent') + call <SID>Tex_DimMenus('Static1', 'columnsep') + call <SID>Tex_DimMenus('Static1', 'columnseprule') + call <SID>Tex_DimMenus('Static1', 'columnwidth') + call <SID>Tex_DimMenus('Static1', 'doublerulesep') + call <SID>Tex_DimMenus('Static1', 'evensidemargin') + call <SID>Tex_DimMenus('Static1', 'fboxrule') + call <SID>Tex_DimMenus('Static1', 'fboxsep') + call <SID>Tex_DimMenus('Static1', 'footheight') + call <SID>Tex_DimMenus('Static1', 'footnotesep') + call <SID>Tex_DimMenus('Static1', 'footskip') + call <SID>Tex_DimMenus('Static1', 'headheight') + call <SID>Tex_DimMenus('Static1', 'headsep') + call <SID>Tex_DimMenus('Static1', 'itemindent') + call <SID>Tex_DimMenus('Static1', 'labelsep') + call <SID>Tex_DimMenus('Static1', 'labelwidth') + call <SID>Tex_DimMenus('Static1', 'leftmargin') + call <SID>Tex_DimMenus('Static1', 'leftmargini') + call <SID>Tex_DimMenus('Static1', 'leftmarginii') + call <SID>Tex_DimMenus('Static1', 'leftmarginiii') + call <SID>Tex_DimMenus('Static1', 'leftmarginiv') + call <SID>Tex_DimMenus('Static1', 'leftmarginv') + call <SID>Tex_DimMenus('Static1', 'leftmarginvi') + call <SID>Tex_DimMenus('Static1', 'linewidth') + call <SID>Tex_DimMenus('Static1', 'listparindent') + call <SID>Tex_DimMenus('Static1', 'marginparpush') + call <SID>Tex_DimMenus('Static1', 'marginparsep') + call <SID>Tex_DimMenus('Static1', 'marginparwidth') + call <SID>Tex_DimMenus('Static1', 'mathindent') + call <SID>Tex_DimMenus('Static1', 'oddsidemargin') + " }}} + " {{{ Static2 + call <SID>Tex_DimMenus('Static2', 'paperheight') + call <SID>Tex_DimMenus('Static2', 'paperwidth') + call <SID>Tex_DimMenus('Static2', 'parindent') + call <SID>Tex_DimMenus('Static2', 'rightmargin') + call <SID>Tex_DimMenus('Static2', 'tabbingsep') + call <SID>Tex_DimMenus('Static2', 'tabcolsep') + call <SID>Tex_DimMenus('Static2', 'textheight') + call <SID>Tex_DimMenus('Static2', 'textwidth') + call <SID>Tex_DimMenus('Static2', 'topmargin') + call <SID>Tex_DimMenus('Static2', 'unitlength') + " }}} + " {{{ Dynamic + call <SID>Tex_DimMenus('Dynamic', 'abovedisplayshortskip') + call <SID>Tex_DimMenus('Dynamic', 'abovedisplayskip') + call <SID>Tex_DimMenus('Dynamic', 'baselineskip') + call <SID>Tex_DimMenus('Dynamic', 'belowdisplayshortskip') + call <SID>Tex_DimMenus('Dynamic', 'belowdisplayskip') + call <SID>Tex_DimMenus('Dynamic', 'dblfloatsep') + call <SID>Tex_DimMenus('Dynamic', 'dbltextfloatsep') + call <SID>Tex_DimMenus('Dynamic', 'floatsep') + call <SID>Tex_DimMenus('Dynamic', 'intextsep') + call <SID>Tex_DimMenus('Dynamic', 'itemsep') + call <SID>Tex_DimMenus('Dynamic', 'parsep') + call <SID>Tex_DimMenus('Dynamic', 'parskip') + call <SID>Tex_DimMenus('Dynamic', 'partopsep') + call <SID>Tex_DimMenus('Dynamic', 'textfloatsep') + call <SID>Tex_DimMenus('Dynamic', 'topsep') + call <SID>Tex_DimMenus('Dynamic', 'topskip') + " }}} + " {{{ Change + call <SID>Tex_DimMenus('Change', 'setlength') + call <SID>Tex_DimMenus('Change', 'addtolength') + call <SID>Tex_DimMenus('Change', 'settoheight') + call <SID>Tex_DimMenus('Change', 'settowidth') + call <SID>Tex_DimMenus('Change', 'settolength') + " }}} +endif + +" ============================================================================== +" Counters +" ============================================================================== +if g:Tex_Menus + " Counters {{{ + call <SID>Tex_CounterMenus('Counters', 'bottomnumber') + call <SID>Tex_CounterMenus('Counters', 'chapter') + call <SID>Tex_CounterMenus('Counters', 'dbltopnumber') + call <SID>Tex_CounterMenus('Counters', 'enumi') + call <SID>Tex_CounterMenus('Counters', 'enumii') + call <SID>Tex_CounterMenus('Counters', 'enumiii') + call <SID>Tex_CounterMenus('Counters', 'enumiv') + call <SID>Tex_CounterMenus('Counters', 'equation') + call <SID>Tex_CounterMenus('Counters', 'figure') + call <SID>Tex_CounterMenus('Counters', 'footnote') + call <SID>Tex_CounterMenus('Counters', 'mpfootnote') + call <SID>Tex_CounterMenus('Counters', 'page') + call <SID>Tex_CounterMenus('Counters', 'paragraph') + call <SID>Tex_CounterMenus('Counters', 'part') + call <SID>Tex_CounterMenus('Counters', 'secnumdepth') + call <SID>Tex_CounterMenus('Counters', 'section') + call <SID>Tex_CounterMenus('Counters', 'subparagraph') + call <SID>Tex_CounterMenus('Counters', 'subsection') + call <SID>Tex_CounterMenus('Counters', 'subsubsection') + call <SID>Tex_CounterMenus('Counters', 'table') + call <SID>Tex_CounterMenus('Counters', 'tocdepth') + call <SID>Tex_CounterMenus('Counters', 'topnumber') + call <SID>Tex_CounterMenus('Counters', 'totalnumber') + " }}} + " theCounters {{{ + call <SID>Tex_CounterMenus('theCounters', 'thebottomnumber') + call <SID>Tex_CounterMenus('theCounters', 'thechapter') + call <SID>Tex_CounterMenus('theCounters', 'thedbltopnumber') + call <SID>Tex_CounterMenus('theCounters', 'theenumi') + call <SID>Tex_CounterMenus('theCounters', 'theenumii') + call <SID>Tex_CounterMenus('theCounters', 'theenumiii') + call <SID>Tex_CounterMenus('theCounters', 'theenumiv') + call <SID>Tex_CounterMenus('theCounters', 'theequation') + call <SID>Tex_CounterMenus('theCounters', 'thefigure') + call <SID>Tex_CounterMenus('theCounters', 'thefootnote') + call <SID>Tex_CounterMenus('theCounters', 'thempfootnote') + call <SID>Tex_CounterMenus('theCounters', 'thepage') + call <SID>Tex_CounterMenus('theCounters', 'theparagraph') + call <SID>Tex_CounterMenus('theCounters', 'thepart') + call <SID>Tex_CounterMenus('theCounters', 'thesecnumdepth') + call <SID>Tex_CounterMenus('theCounters', 'thesection') + call <SID>Tex_CounterMenus('theCounters', 'thesubparagraph') + call <SID>Tex_CounterMenus('theCounters', 'thesubsection') + call <SID>Tex_CounterMenus('theCounters', 'thesubsubsection') + call <SID>Tex_CounterMenus('theCounters', 'thetable') + call <SID>Tex_CounterMenus('theCounters', 'thetocdepth') + call <SID>Tex_CounterMenus('theCounters', 'thetopnumber') + call <SID>Tex_CounterMenus('theCounters', 'thetotalnumber') + " }}} + " Type {{{ + call <SID>Tex_CounterMenus('Type', 'alph') + call <SID>Tex_CounterMenus('Type', 'Alph') + call <SID>Tex_CounterMenus('Type', 'arabic') + call <SID>Tex_CounterMenus('Type', 'roman') + call <SID>Tex_CounterMenus('Type', 'Roman') + " }}} +endif + +" ============================================================================== +" Various +" ============================================================================== +if g:Tex_Menus + " Various {{{ + call <SID>Tex_VariousMenus('ref{}' , '\ref{<++>}<++>') + call <SID>Tex_VariousMenus('pageref{}' , '\pageref{<++>}<++>') + call <SID>Tex_VariousMenus('label{}' , '\label{<++>}<++>') + call <SID>Tex_VariousMenus('footnote{}' , '\footnote{<++>}<++>') + call <SID>Tex_VariousMenus('footnotemark{}', '\footnotemark{<++>}<++>') + call <SID>Tex_VariousMenus('footnotemark{}', '\footnotetext{<++>}<++>') + call <SID>Tex_VariousMenus('cite{}' , '\cite{<++>}<++>') + call <SID>Tex_VariousMenus('nocite{}' , '\nocite{<++>}<++>') + " }}} +endif + +if g:Tex_CatchVisMapErrors + exe "vnoremap ".g:Tex_Leader." :\<C-u>call ExecMap('".g:Tex_Leader."', 'v')\<CR>" +endif +" this is for avoiding reinclusion of imaps from next time on. +let s:doneOnce = 1 + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/envmacros.vim b/vimfiles.latex/ftplugin/latex-suite/envmacros.vim new file mode 100644 index 0000000..acf9eb2 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/envmacros.vim @@ -0,0 +1,1166 @@ +"============================================================================= +" File: envmacros.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 08:00 PM 2002 PST +" CVS Header: $Id: envmacros.vim 997 2006-03-20 09:45:45Z srinathava $ +" Description: mappings/menus for environments. +"============================================================================= + +if !g:Tex_EnvironmentMaps && !g:Tex_EnvironmentMenus + finish +endif + +exe 'so '.expand('<sfile>:p:h').'/wizardfuncs.vim' + +nmap <silent> <script> <plug> i +imap <silent> <script> <C-o><plug> <Nop> + +" Define environments for IMAP evaluation " {{{ +let s:figure = "\\begin{figure}[<+htpb+>]\<cr>\\begin{center}\<cr>\\psfig{figure=<+eps file+>}\<cr>\\end{center}\<cr>\\caption{<+caption text+>}\<cr>\\label{fig:<+label+>}\<cr>\\end{figure}<++>" +let s:figure_graphicx = "\\begin{figure}[<+htpb+>]\<cr>\\begin{center}\<cr>\\includegraphics{<+file+>}\<cr>\\end{center}\<cr>\\caption{<+caption text+>}\<cr>\\label{fig:<+label+>}\<cr>\\end{figure}<++>" +let s:minipage = "\\begin{minipage}[<+tb+>]{<+width+>}\<cr><++>\<cr>\\end{minipage}<++>" +let s:picture = "\\begin{picture}(<+width+>, <+height+>)(<+xoff+>,<+yoff+>)\<cr>\\put(<+xoff+>,<+yoff+>){\\framebox(<++>,<++>){<++>}}\<cr>\\end{picture}<++>" +let s:list = "\\begin{list}{<+label+>}{<+spacing+>}\<cr>\\item <++>\<cr>\\end{list}<++>" +let s:table = "\\begin{table}\<cr>\\centering\<cr>\\begin{tabular}{<+dimensions+>}\<cr><++>\<cr>\\end{tabular}\<cr>\\caption{<+Caption text+>}\<cr>\\label{tab:<+label+>}\<cr>\\end{table}<++>" +let s:array = "\\left<++>\<cr>\\begin{array}{<+dimension+>}\<cr><+elements+>\<cr>\\end{array}\<cr>\\right<++>" +let s:description ="\\begin{description}\<cr>\\item[<+label+>]<++>\<cr>\\end{description}<++>" +let s:document = "\\documentclass[<+options+>]{<+class+>}\<cr>\<cr>\\begin{document}\<cr><++>\<cr>\\end{document}" +let s:tabular = "\\begin{tabular}[<+hbtp+>]{<+format+>}\<cr><++>\<cr>\\end{tabular}" +let s:tabular_star = "\\begin{tabular*}[<+hbtp+>]{<+format+>}\<cr><++>\<cr>\\end{tabular*}" + +" }}} +" define environments with special behavior in line wise selection. {{{ +if !exists('s:vis_center_left') + let s:vis_center_left = '\centerline{' + let s:vis_center_right = '}' + + let s:vis_verbatim_left = '\verb\|' + let s:vis_verbatim_right = '\|' + + let s:vis_flushright_left = '{\raggedright ' + let s:vis_flushright_right = '}' + + let s:vis_fushleft_left = '{\raggedleft ' + let s:vis_fushleft_right = '}' + + let s:vis_lrbox_left = '\sbox{' + let s:vis_lrbox_right = '}' +endif +" }}} +" Tex_EnvMacros: sets up maps and menus for environments {{{ +" Description: +function! <SID>Tex_EnvMacros(lhs, submenu, name) + + let extra = '' + if a:submenu =~ 'Lists' + let extra = '\item ' + endif + + let vright = '' + let vleft = '' + if exists('s:vis_'.a:name.'_right') + let vright = s:vis_{a:name}_right + let vleft = s:vis_{a:name}_left + endif + let vrhs = "\<C-\\>\<C-N>:call VEnclose('".vleft."', '".vright."', '\\begin{".a:name."}', '\\end{".a:name."}')\<CR>" + let location = g:Tex_EnvMenuLocation.a:submenu.a:name.'<tab>' + + if a:lhs != '' + + let vlhs = g:Tex_Leader2.substitute(tolower(a:lhs), '^.', '', '') + let location = location.a:lhs.'\ ('.vlhs.')' + + if g:Tex_EnvironmentMaps && !exists('s:doneOnce') + call IMAP(a:lhs, "\<C-r>=Tex_PutEnvironment('".a:name."')\<CR>", 'tex') + exec 'vnoremap <silent> '.vlhs.' '.vrhs + endif + + endif + + if g:Tex_Menus && g:Tex_EnvironmentMenus && has("gui_running") + exe 'amenu '.location.' <plug><C-r>=Tex_DoEnvironment("'.a:name.'")<CR>' + exe 'vmenu '.location.' '.vrhs + endif + +endfunction + +" }}} +" Tex_SpecialMacros: macros with special right hand sides {{{ +" Description: +function! <SID>Tex_SpecialMacros(lhs, submenu, name, irhs, ...) + + let wiz = 1 + if a:0 > 0 && a:1 == 0 + let wiz = 0 + endif + + let location = g:Tex_EnvMenuLocation.a:submenu.a:name + + let vright = '' + let vleft = '' + if exists('s:vis_'.a:name.'_right') + let vright = s:vis_{a:name}_right + let vleft = s:vis_{a:name}_left + endif + let vrhs = "\<C-\\>\<C-N>:call VEnclose('".vleft."', '".vright."', '\\begin{".a:name."}', '\\end{".a:name."}')\<CR>" + + if a:lhs != '' + + let vlhs = g:Tex_Leader2.substitute(tolower(a:lhs), '^.', '', '') + let location = location.'<tab>'.a:lhs.'\ ('.vlhs.')' + + if g:Tex_EnvironmentMaps && !exists('s:doneOnce') + call IMAP(a:lhs, a:irhs, 'tex') + exec 'vnoremap '.vlhs.' '.vrhs + endif + + endif + + if g:Tex_Menus && g:Tex_EnvironmentMenus + if wiz + exe 'amenu '.location.' <plug><C-r>=Tex_DoEnvironment("'.a:name.'")<CR>' + else + exe 'amenu '.location." <plug><C-r>=IMAP_PutTextWithMovement('".a:irhs."')<CR>" + endif + exe 'vmenu '.location.' '.vrhs + endif + +endfunction " }}} +" Tex_SectionMacros: creates section maps and menus {{{ +" Description: +function! <SID>Tex_SectionMacros(lhs, name) + + let vlhs = g:Tex_Leader2.substitute(tolower(a:lhs), '^.', '', '') + let vrhs = "\<C-\\>\<C-N>:call VEnclose('\\".a:name."{', '}', '', '')<CR>" + + if g:Tex_SectionMaps && !exists('s:doneOnce') + exe 'vnoremap '.vlhs.' '.vrhs + call IMAP (a:lhs, "\\".a:name.'{<++>}<++>', 'tex') + endif + + if g:Tex_Menus && g:Tex_SectionMenus + let location = g:Tex_EnvMenuLocation.'Sections.'.a:name.'<tab>'.a:lhs.'\ ('.vlhs.')' + let advlocation = g:Tex_EnvMenuLocation.'Sections.Advanced.'.a:name + + let irhs = "\<C-r>=IMAP_PutTextWithMovement('\\".a:name."{<++>}<++>')\<CR>" + + let advirhs = "\<C-r>=Tex_InsSecAdv('".a:name."')\<CR>" + let advvrhs = "\<C-\\>\<C-N>:call Tex_VisSecAdv('".a:name."')\<CR>" + + exe 'amenu '.advlocation.' <plug>'.advirhs + exe 'vnoremenu '.advlocation." ".advvrhs + + exe 'amenu '.location.' <plug>'.irhs + exe 'vnoremenu '.location." ".vrhs + endif +endfunction " }}} + +" NewEnvironments {{{ +call s:Tex_SpecialMacros('', '', 'newenvironment', '\newenvironment{<++>}[<++>][<++>]{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', '', 'newenvironment*', '\newenvironment*{<++>}[<++>][<++>]{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', '', 'renewenvironment', '\renewenvironment{<++>}[<++>][<++>]{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', '', 'renewenvironment*', '\renewenvironment*{<++>}[<++>][<++>]{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', '', '-sepenv0-', ' :', 0) +" }}} +" Environments specific commands {{{ +call s:Tex_SpecialMacros('', 'Env&Commands.&Lists.', '&item', '\item', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Lists.', 'i&tem[]', '\item[<++>]<++>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Lists.', '&bibitem{}', '\bibitem{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&=', '\=', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&>', '\>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '&\\\\', '\\', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&+', '\+', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&-', '\-', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', "\\\'", "\\\'", 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&`', '\`', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&kill', '\kill', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '&makron\ \\CHAR=', '\<++>=<++>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', "&aigu\ \\CHAR\'", "\\<++>\'<++>", 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '&grave\ \\CHAR`', '\<++>`<++>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', 'p&ushtabs', '\pushtabs', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', 'p&optabs', '\poptabs', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&hline', '\hline', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&cline', '\cline', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&\&', '&', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&\\\\', '\\', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&multicolumn{}{}{}', '\multicolumn{<++>}{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&makelabels', '\makelabels', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&address', '\address', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&signature', '\signature', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&date', '\date', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '-sepenva4-', ' :', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&opening{}', '\opening{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&closing{}', '\closing{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&ps{}', '\ps{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', 'cc&{}', '\cc{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&onlyslides{}', '\onlyslides{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&onlynotes{}', '\onlynotes{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '-sepenva5-', ' :', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&invisible', '\invisible', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&visible', '\visible', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&settime', '\settime', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&addtime', '\addtime', 0) +call s:Tex_SpecialMacros('', '', '-sepenv0-', ' :', 0) +" }}} +" Lists {{{ +call s:Tex_SpecialMacros('ELI', '&Lists.', 'list', s:list) +call s:Tex_SpecialMacros('EDE', '&Lists.', 'description', s:description) +call s:Tex_EnvMacros('EEN', '&Lists.', 'enumerate') +call s:Tex_EnvMacros('EIT', '&Lists.', 'itemize') +call s:Tex_EnvMacros('ETI', '&Lists.', 'theindex') +call s:Tex_EnvMacros('ETL', '&Lists.', 'trivlist') +" }}} +" Tables {{{ +call s:Tex_SpecialMacros('ETE', '&Tables.', 'table', s:table) +call s:Tex_EnvMacros('ETG', '&Tables.', 'tabbing') +call s:Tex_EnvMacros('', '&Tables.', 'table*') +call s:Tex_EnvMacros('', '&Tables.', 'table2') +call s:Tex_SpecialMacros('ETR', '&Tables.', 'tabular', s:tabular) +call s:Tex_SpecialMacros('', '&Tables.', 'tabular*', s:tabular_star) +" }}} +" Math {{{ +call s:Tex_EnvMacros('EAR', '&Math.', 'array') +call s:Tex_EnvMacros('EDM', '&Math.', 'displaymath') +call s:Tex_EnvMacros('EEA', '&Math.', 'eqnarray') +call s:Tex_EnvMacros('', '&Math.', 'eqnarray*') +call s:Tex_EnvMacros('EEQ', '&Math.', 'equation') +call s:Tex_EnvMacros('EMA', '&Math.', 'math') +" }}} +" Structure {{{ +call s:Tex_SpecialMacros('EAR', 'Math.', 'array', s:array) +call s:Tex_EnvMacros('EAB', '&Structure.', 'abstract') +call s:Tex_EnvMacros('EAP', '&Structure.', 'appendix') +call s:Tex_EnvMacros('ECE', '&Structure.', 'center') +call s:Tex_EnvMacros('EDO', '&Structure.', 'document') +call s:Tex_EnvMacros('EFC', '&Structure.', 'filecontents') +call s:Tex_EnvMacros('', '&Structure.', 'filecontents*') +call s:Tex_EnvMacros('EFL', '&Structure.', 'flushleft') +call s:Tex_EnvMacros('EFR', '&Structure.', 'flushright') +call s:Tex_EnvMacros('EQN', '&Structure.', 'quotation') +call s:Tex_EnvMacros('EQE', '&Structure.', 'quote') +call s:Tex_EnvMacros('ESB', '&Structure.', 'sloppybar') +call s:Tex_EnvMacros('ETI', '&Structure.', 'theindex') +call s:Tex_EnvMacros('ETP', '&Structure.', 'titlepage') +call s:Tex_EnvMacros('EVM', '&Structure.', 'verbatim') +call s:Tex_EnvMacros('', '&Structure.', 'verbatim*') +call s:Tex_EnvMacros('EVE', '&Structure.', 'verse') +call s:Tex_EnvMacros('ETB', '&Structure.', 'thebibliography') +call s:Tex_SpecialMacros('', '&Structure.', '-sepstruct0-', ':', 0) +call s:Tex_EnvMacros('ENO', '&Structure.', 'note') +call s:Tex_EnvMacros('EOV', '&Structure.', 'overlay') +call s:Tex_EnvMacros('ESL', '&Structure.', 'slide') +" }}} +" Sections {{{ +call s:Tex_SectionMacros('SPA', 'part') +call s:Tex_SectionMacros('SCH', 'chapter') +call s:Tex_SectionMacros('SSE', 'section') +call s:Tex_SectionMacros('SSS', 'subsection') +call s:Tex_SectionMacros('SS2', 'subsubsection') +call s:Tex_SectionMacros('SPG', 'paragraph') +call s:Tex_SectionMacros('SSP', 'subparagraph') +" }}} +" Miscellaneous {{{ +call s:Tex_SpecialMacros('', '', '-sepenv1-', ' :', 0) +call s:Tex_SpecialMacros('EFI', '', 'figure', "\<C-r>=Tex_PutEnvironment('figure')\<CR>") +call s:Tex_EnvMacros('', '', 'figure*') +call s:Tex_EnvMacros('ELR', '', 'lrbox') +call s:Tex_SpecialMacros('EMP', '', 'minipage', s:minipage) +call s:Tex_SpecialMacros('EPI', '', 'picture', s:picture) +" }}} + +if g:Tex_CatchVisMapErrors + exe 'vnoremap '.g:Tex_Leader2." :\<C-u>call ExecMap('".g:Tex_Leader2."', 'v')\<CR>" +endif + +" ============================================================================== +" Specialized functions for various environments +" +" All these functions are to be used as: +" +" inoremap <lhs> <C-r>=Tex_itemize('enumerate')<CR> +" nnoremap <lhs> i<C-r>=Tex_itemize('enumerate')<CR> +" +" and so on... +" ============================================================================== +" Tex_itemize: {{{ +function! Tex_itemize(env) + return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr>\\item <++>\<cr>\\end{".a:env."}<++>") +endfunction +" }}} +" Tex_description: {{{ +function! Tex_description(env) + if g:Tex_UseMenuWizard == 1 + let itlabel = input('(Optional) Item label? ') + if itlabel != '' + let itlabel = '['.itlabel.']' + endif + return IMAP_PutTextWithMovement("\\begin{description}\<cr>\\item".itlabel." <++>\<cr>\\end{description}<++>") + else + return IMAP_PutTextWithMovement(s:description) + endif +endfunction +" }}} +" Tex_figure: {{{ +function! Tex_figure(env) + if g:Tex_UseMenuWizard == 1 + let flto = input('Float to (htbp)? ') + let caption = input('Caption? ') + let center = input('Center ([y]/n)? ') + let label = input('Label (for use with \ref)? ') + " additional to AUC Tex since my pics are usually external files + let pic = input('Name of Pic-File? ') + if flto != '' + let flto = '['.flto."]\<cr>" + else + let flto = "\<cr>" + endif + if pic != '' + let pic = '\input{'.pic."}\<cr>" + else + let pic = "<++>\<cr>" + endif + if caption != '' + let caption = '\caption{'.caption."}\<cr>" + endif + if label != '' + let label = '\label{fig:'.label."}\<cr>" + endif + if center == 'y' + let centr = '\begin{center}' . "\<cr>" + let centr = centr . pic + let centr = centr . caption + let centr = centr . label + let centr = centr . '\end{center}' . "\<cr>" + else + let centr = pic + let centr = centr . caption + let centr = centr . label + endif + let figure = '\begin{'.a:env.'}'.flto + let figure = figure . centr + let figure = figure . '\end{'.a:env.'}' + return IMAP_PutTextWithMovement(figure) + else + if g:Tex_package_detected =~ '\<graphicx\>' + return IMAP_PutTextWithMovement(s:figure_graphicx) + else + return IMAP_PutTextWithMovement(s:figure) + endif + endif +endfunction +" }}} +" Tex_table: {{{ +function! Tex_table(env) + if g:Tex_UseMenuWizard == 1 + let flto = input('Float to (htbp)? ') + let caption = input('Caption? ') + let center = input('Center (y/n)? ') + let label = input('Label? ') + if flto != '' + let flto ='['.flto."]\<cr>" + else + let flto = '' + endif + let ret='\begin{table}'.flto + if center == 'y' + let ret=ret."\\begin{center}\<cr>" + endif + let foo = '\begin{tabular}' + let pos = input('(Optional) Position (t b)? ') + if pos != '' + let foo = foo.'['.pos.']' + else + let foo = foo."\<cr>" + endif + let format = input("Format ( l r c p{width} | @{text} )? ") + if format == '' + let format = '<++>' + endif + let ret = ret.foo.'{'.format."}\<cr><++>\<cr>\\end{tabular}<++>\<cr>" + if center == 'y' + let ret=ret."\\end{center}\<cr>" + endif + if caption != '' + let ret=ret.'\caption{'.caption."}\<cr>" + endif + if label != '' + let ret=ret.'\label{tab:'.label."}\<cr>" + endif + let ret=ret.'\end{table}<++>' + return IMAP_PutTextWithMovement(ret) + else + return IMAP_PutTextWithMovement(s:table) + endif +endfunction +" }}} +" Tex_tabular: {{{ +function! Tex_tabular(env) + if g:Tex_UseMenuWizard == 1 + let pos = input('(Optional) Position (t b)? ') + let format = input("Format ( l r c p{width} | @{text} )? ") + if pos != '' + let pos = '['.pos.']' + endif + if format != '' + let format = '{'.format.'}' + endif + return IMAP_PutTextWithMovement('\begin{'.a:env.'}'.pos.format."\<cr> \<cr>\\end{".a:env.'}<++>') + else + return IMAP_PutTextWithMovement('\begin{'.a:env.'}[<+position+>]{<+format+>}'."\<cr><++>\<cr>\\end{".a:env.'}<++>') + endif +endfunction +" }}} +" Tex_eqnarray: {{{ +function! Tex_eqnarray(env) + if g:Tex_UseMenuWizard == 1 + if a:env !~ '\*' + let label = input('Label? ') + if label != '' + let arrlabel = '\label{'.label."}\<cr>" + else + let arrlabel = '' + endif + else + let arrlabel = '' + endif + else + if a:env !~ '\*' + let arrlabel = "\\label{<++>}\<cr>" + else + let arrlabel = "" + endif + endif + return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr><++>\<cr>".arrlabel."\\end{".a:env."}<++>") +endfunction +" }}} +" Tex_list: {{{ +function! Tex_list(env) + if g:Tex_UseMenuWizard == 1 + let label = input('Label (for \item)? ') + if label != '' + let label = '{'.label.'}' + let addcmd = input('Additional commands? ') + if addcmd != '' + let label = label . '{'.addcmd.'}' + endif + else + let label = '' + endif + return IMAP_PutTextWithMovement('\begin{list}'.label."\<cr>\\item \<cr>\\end{list}<++>") + else + return IMAP_PutTextWithMovement(s:list) + endif +endfunction +" }}} +" Tex_document: {{{ +function! Tex_document(env) + if g:Tex_UseMenuWizard == 1 + let dstyle = input('Document style? ') + let opts = input('(Optional) Options? ') + let foo = '\documentclass' + if opts == '' + let foo = foo.'{'.dstyle.'}' + else + let foo = foo.'['.opts.']'.'{'.dstyle.'}' + endif + return IMAP_PutTextWithMovement(foo."\<cr>\<cr>\\begin{document}\<cr><++>\<cr>\\end{document}") + else + return IMAP_PutTextWithMovement(s:document) + endif +endfunction +" }}} +" Tex_minipage: {{{ +function! Tex_minipage(env) + if g:Tex_UseMenuWizard == 1 + let foo = '\begin{minipage}' + let pos = input('(Optional) Position (t b)? ') + let width = input('Width? ') + if pos == '' + let foo = foo.'{'.width.'}' + else + let foo = foo.'['.pos.']{'.width.'}' + endif + return IMAP_PutTextWithMovement(foo."\<cr><++>\<cr>\\end{minipage}<++>") + else + return IMAP_PutTextWithMovement(s:minipage) + endif +endfunction +" }}} +" Tex_thebibliography: {{{ +function! Tex_thebibliography(env) + if g:Tex_UseMenuWizard == 1 + " AUC Tex: "Label for BibItem: 99" + let indent = input('Indent for BibItem? ') + let foo = '{'.indent.'}' + let biblabel = input('(Optional) Bibitem label? ') + let key = input('Add key? ') + let bar = '\bibitem' + if biblabel != '' + let bar = bar.'['.biblabel.']' + endif + let bar = bar.'{'.key.'}' + return IMAP_PutTextWithMovement('\begin{thebibliography}'.foo."\<cr>".bar." \<cr>\\end{thebibliography}<++>\<Up>") + else + return IMAP_PutTextWithMovement( + \ "\\begin{thebibliography}\<CR>". + \ "\\item[<+biblabel+>]{<+bibkey+>} <++>\<CR>". + \ "<++>\<CR>". + \ "\\end{thebibliography}<++>") + endif +endfunction +" }}} + +" ============================================================================== +" Contributions / suggestions from Carl Mueller (auctex.vim) +" ============================================================================== +" PromptForEnvironment: prompts for an environment {{{ +" Description: +function! PromptForEnvironment(ask) + return Tex_ChooseFromPrompt( + \ a:ask."\n" . + \ Tex_CreatePrompt(g:Tex_PromptedEnvironments, 2, ",") . + \ "\nEnter nae or number of environment :", + \ g:Tex_PromptedEnvironments, ",") +endfunction " }}} +" Tex_DoEnvironment: fast insertion of environments {{{ +" Description: +" The menus call this function with an argument (the name of the environment +" to insert). The maps call this without any arguments. In this case, it +" prompts for an environment to enter if the current line is empty. If +" called without arguments and there is a word on the current line, then use +" that as the name of a new environment. +function! Tex_DoEnvironment(...) + if a:0 < 1 + let env = matchstr(getline('.'), '^\s*\zs\w*\*\=\ze\s*$') + " If in current line is more than one word or in visual mode + " ignore contents of line and prompt for environment + if env == '' || (exists('s:isvisual') && s:isvisual == 'yes') + let env = PromptForEnvironment('Choose which environment to insert: ') + if env != '' + return Tex_PutEnvironment(env) + else + return '' + endif + else + " delete the word on the line into the blackhole register. + normal! 0"_D + return Tex_PutEnvironment(env) + endif + else + return Tex_PutEnvironment(a:1) + endif +endfunction " }}} +" Tex_PutEnvironment: calls various specialized functions {{{ +" Description: +" Based on input argument, it calls various specialized functions. +function! Tex_PutEnvironment(env) + if exists("s:isvisual") && s:isvisual == "yes" + let s:isvisual = 'no' + if a:env == '\[' + return VEnclose('', '', '\[', '\]') + elseif a:env == '$$' + return VEnclose('', '', '$$', '$$') + endif + return VEnclose('\begin{'.a:env.'}', '\end{'.a:env.'}', '\begin{'.a:env.'}', '\end{'.a:env.'}') + else + " The user can define something like + " let g:Tex_Env_theorem = "\\begin{theorem}\<CR><++>\<CR>\\end{theorem}" + " This will effectively over-write the default definition of the + " theorem environment which uses a \label. + if exists("b:Tex_Env_{'".a:env."'}") + return IMAP_PutTextWithMovement(b:Tex_Env_{a:env}) + elseif exists("g:Tex_Env_{'".a:env."'}") + return IMAP_PutTextWithMovement(g:Tex_Env_{a:env}) + elseif a:env =~ 'equation*\|eqnarray*\|theorem\|lemma\|equation\|eqnarray\|align\*\|align\>\|multline' + let g:aa = a:env + return Tex_eqnarray(a:env) + elseif a:env =~ "enumerate\\|itemize\\|theindex\\|trivlist" + return Tex_itemize(a:env) + elseif a:env =~ "table\\|table*" + return Tex_table(a:env) + elseif a:env =~ "tabular\\|tabular*\\|array\\|array*" + return Tex_tabular(a:env) + elseif exists('*Tex_'.a:env) + exe 'return Tex_'.a:env.'(a:env)' + elseif a:env == '$$' + return IMAP_PutTextWithMovement('$$<++>$$') + elseif a:env == '\[' + return IMAP_PutTextWithMovement("\\[\<CR><++>\<CR>\\]<++>") + else + " Look in supported packages if exists template for environment + " given in the line + if exists('g:Tex_package_supported') && g:Tex_package_supported != '' + let i = 1 + while Tex_Strntok(g:Tex_package_supported, ',', i) != '' + let checkpack = Tex_Strntok(g:Tex_package_supported, ',', i) + if g:TeX_package_{checkpack} =~ 'e..:'.a:env + if a:env =~ '*' + " Don't allow * to be treated as wildcard + let aenv = substitute(a:env, '*', '\\*', '') + else + let aenv = a:env + endif + let envcommand = matchstr(g:TeX_package_{checkpack}, '\zse..:'.aenv.'[^,]\{-}\ze,') + return Tex_ProcessPackageCommand(envcommand) + endif + let i = i + 1 + endwhile + endif + " If nothing before us managed to create an environment, then just + " create a bare-bones environment from the name. + return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr><++>\<cr>\\end{".a:env."}<++>") + endif +endfunction " }}} +" Mapping the <F5> key to insert/prompt for an environment/package {{{ +" and <S-F5> to prompt/replace an environment +" +" g:Tex_PromptedEnvironments is a variable containing a comma seperated list +" of environments. This list defines the prompt which latex-suite sets up when +" the user presses <F5> on an empty line. +" +" Leaving this empty is equivalent to disabling the feature. +if g:Tex_PromptedEnvironments != '' + + let b:DoubleDollars = 0 + + " Provide only <plug>s here. main.vim will create the actual maps. + inoremap <silent> <Plug>Tex_FastEnvironmentInsert <C-r>=Tex_FastEnvironmentInsert("no")<cr> + nnoremap <silent> <Plug>Tex_FastEnvironmentInsert i<C-r>=Tex_FastEnvironmentInsert("no")<cr> + vnoremap <silent> <Plug>Tex_FastEnvironmentInsert <C-\><C-N>:call Tex_FastEnvironmentInsert("yes")<CR> + inoremap <silent> <Plug>Tex_FastEnvironmentChange <C-O>:call Tex_ChangeEnvironments()<CR> + nnoremap <silent> <Plug>Tex_FastEnvironmentChange :call Tex_ChangeEnvironments()<CR> + + " Tex_FastEnvironmentInsert: maps <F5> to prompt for env and insert it " {{{ + " Description: + " This function calculates whether we are in the preamble. If we are + " then inserts a \usepackage line by either reading in a word from the + " current line or prompting to type in one. If not in the preamble, then + " inserts a environment template either by reading in a word from the + " current line or prompting the user to choose one. + " + function! Tex_FastEnvironmentInsert(isvisual) + + let start_line = line('.') + let pos = line('.').' | normal! '.virtcol('.').'|' + let s:isvisual = a:isvisual + + " decide if we are in the preamble of the document. If we are then + " insert a package, otherwise insert an environment. + " + if search('\\documentclass', 'bW') && search('\\begin{document}') + + " If there is a \documentclass line and a \begin{document} line in + " the file, then a part of the file is the preamble. + + " search for where the document begins. + let begin_line = search('\\begin{document}') + " if the document begins after where we are presently, then we are + " in the preamble. + if start_line < begin_line + " return to our original location and insert a package + " statement. + exe pos + return Tex_package_from_line() + else + " we are after the preamble. insert an environment. + exe pos + return Tex_DoEnvironment() + endif + + elseif search('\\documentclass') + " if there is only a \documentclass but no \begin{document}, then + " the entire file is a preamble. Put a package. + + exe pos + return Tex_package_from_line() + + else + " no \documentclass, put an environment. + + exe pos + return Tex_DoEnvironment() + + endif + + endfunction + + " }}} + " Tex_package_from_line: puts a \usepackage line in the current line. " {{{ + " Description: + " + function! Tex_package_from_line() + " Function Tex_PutPackage is defined in packages.vim + " Ignores <F5> in Visual mode + if s:isvisual == "yes" + return 0 + else + let l = getline(".") + let pack = matchstr(l, '^\s*\zs.*') + normal! 0"_D + return Tex_pack_one(pack) + endif + endfunction + + " }}} + " Tex_ChangeEnvironments: calls Change() to change the environment {{{ + " Description: + " Finds out which environment the cursor is positioned in and changes + " that to the chosen new environment. This function knows the changes + " which need to be made to change one env to another and calls + " Change() with the info. + " + function! Tex_ChangeEnvironments() + + let env_line = searchpair('$$\|\\[\|begin{', '', '$$\|\\]\|end{', "bn") + + if env_line != 0 + if getline(env_line) !~ 'begin{' + let env_name = '[' + else + let env_name = matchstr(getline(env_line), 'begin{\zs.\{-}\ze}') + endif + endif + + if !exists('env_name') + echomsg "You are not inside environment" + return 0 + endif + + exe 'echomsg "You are within a '.env_name.' environment."' + let change_env = PromptForEnvironment('What do you want to change it to? ') + + if change_env == 'eqnarray' + call <SID>Change('eqnarray', 1, '', 1) + elseif change_env == 'eqnarray*' + call <SID>Change('eqnarray*', 0, '\\nonumber', 0) + elseif change_env == 'align' + call <SID>Change('align', 1, '', 1) + elseif change_env == 'align*' + call <SID>Change('align*', 0, '\\nonumber', 0) + elseif change_env == 'equation*' + call <SID>Change('equation*', 0, '&\|\\lefteqn{\|\\nonumber\|\\\\', 0) + elseif change_env == '' + return 0 + else + call <SID>Change(change_env, 0, '', '') + return 0 + endif + + endfunction + + " }}} + " Change: changes the current env to the new env {{{ + " Description: + " This function needs to know the changes which need to be made while + " going from an old environment to a new one. This info, it gets from + " Tex_ChangeEnvironments + " + " env : name of the new environment. + " label : if 1, then insert a \label at the end of the environment. + " otherwise, delete any \label line found. + " delete : a pattern which is to be deleted from the original environment. + " for example, going to a eqnarray* environment means we need to + " delete \label's. + " putInNonumber : whether we need to put a \nonumber before the end of the + " environment. + function! s:Change(env, label, delete, putInNonumber) + + let start_line = line('.') + let start_col = virtcol('.') + + if a:env == '[' + if b:DoubleDollars == 0 + let first = '\\[' + let second = '\\]' + else + let first = '$$' + let second = '$$' + endif + else + let first = '\\begin{' . a:env . '}' + let second = '\\end{' . a:env . '}' + endif + + if b:DoubleDollars == 0 + let bottom = searchpair('\\\[\|\\begin{','','\\\]\|\\end{','') + s/\\\]\|\\end{.\{-}}/\=second/ + let top = searchpair('\\\[\|\\begin{','','\\\]\|\\end{','b') + s/\\\[\|\\begin{.\{-}}/\=first/ + else + let bottom = search('\$\$\|\\end{') + s/\$\$\|\\end{.\{-}}/\=second/ + let top = search('\$\$\|\\begin{','b') + s/\$\$\|\\begin{.\{-}}/\=first/ + end + if a:delete != '' + exe 'silent '. top . "," . bottom . 's/' . a:delete . '//e' + endif + + if a:putInNonumber == 1 + exe top + call search('\\end\|\\\\') + if line('.') != bottom + exe '.+1,' . bottom . 's/\\\\/\\nonumber\\\\/e' + exe (bottom-1) . 's/\s*$/ \\nonumber/' + endif + endif + + if a:label == 1 + exe top + if search("\\label", "W") > bottom + exe top + let local_label = input('Label? ') + if local_label != '' + put = '\label{'.local_label.'}' + endif + normal $ + endif + else + exe 'silent '.top . ',' . bottom . ' g/\\label/delete' + endif + + if exists('local_label') && local_label != '' + exe start_line + 1.' | normal! '.start_col.'|' + else + exe start_line.' | normal! '.start_col.'|' + endif + endfunction " }}} + +endif + +" }}} +" Map <S-F1> through <S-F4> to insert environments {{{ +if g:Tex_HotKeyMappings != '' + + " SetUpHotKeys: maps <F1> through <F4> to insert environments + " Description: + function! <SID>SetUpHotKeys() + let i = 1 + let envname = Tex_Strntok(g:Tex_HotKeyMappings, ',', i) + while envname != '' + + exec 'inoremap <silent> <buffer> <S-F'.i.'> <C-r>=Tex_PutEnvironment("'.envname.'")<CR>' + + let i = i + 1 + let envname = Tex_Strntok(g:Tex_HotKeyMappings, ',', i) + + endwhile + + endfunction + +endif + +" }}} +" Tex_SetFastEnvironmentMaps: function for setting up the <F5> and <S-F1>-<S-F4> keys {{{ +" Description: This function is made public so it can be called by the +" SetTeXOptions() function in main.vim +function! Tex_SetFastEnvironmentMaps() + if g:Tex_PromptedEnvironments != '' + call Tex_MakeMap("<F5>", "<Plug>Tex_FastEnvironmentInsert", 'i', '<silent> <buffer>') + call Tex_MakeMap("<F5>", "<Plug>Tex_FastEnvironmentInsert", 'n', '<silent> <buffer>') + call Tex_MakeMap("<F5>", "<Plug>Tex_FastEnvironmentInsert", 'v', '<silent> <buffer>') + call Tex_MakeMap("<S-F5>", "<Plug>Tex_FastEnvironmentChange", 'i', '<silent> <buffer>') + call Tex_MakeMap("<S-F5>", "<Plug>Tex_FastEnvironmentChange", 'n', '<silent> <buffer>') + endif + if g:Tex_HotKeyMappings != '' + call s:SetUpHotKeys() + endif +endfunction " }}} + +" ============================================================================== +" Contributions / Tex_InsertItem() from Johannes Tanzler +" ============================================================================== +" Tex_GetCurrentEnv: gets the current environment in which the cursor lies {{{ +" Description: handles cases such as: +" +" \begin{itemize} +" \item first item +" \item second item +" \begin{description} +" \item first desc +" \item second +" % Tex_GetCurrentEnv will return "description" when called from here +" \end{description} +" \item third item +" % Tex_GetCurrentEnv will return "itemize" when called from here +" \end{itemize} +" % Tex_GetCurrentEnv will return "" when called from here +" +" Author: Alan Schmitt +function! Tex_GetCurrentEnv() + let pos = line('.').' | normal! '.virtcol('.').'|' + let i = 0 + while 1 + let env_line = search('^[^%]*\\\%(begin\|end\){', 'bW') + if env_line == 0 + " we reached the beginning of the file, so we return the empty string + exe pos + return '' + endif + if match(getline(env_line), '^[^%]*\\begin{') == -1 + " we found a \\end, so we keep searching + let i = i + 1 + continue + else + " we found a \\begin which has not been \\end'ed. we are done. + if i == 0 + let env = matchstr(getline(env_line), '\\begin{\zs.\{-}\ze}') + exe pos + return env + else + " this \\begin closes a \\end, continue searching. + let i = i - 1 + continue + endif + endif + endwhile +endfunction +" }}} +" Tex_InsertItem: insert \item into a list {{{ +" Description: Find last \begin line, extract env name, return to the start +" position and insert proper \item, depending on env name. +" Env names are stored in g: variables it can be used by +" package files. + +TexLet g:Tex_ItemStyle_itemize = '\item ' +TexLet g:Tex_ItemStyle_enumerate = '\item ' +TexLet g:Tex_ItemStyle_theindex = '\item ' +TexLet g:Tex_ItemStyle_thebibliography = '\item[<+biblabel+>]{<+bibkey+>} <++>' +TexLet g:Tex_ItemStyle_description = '\item[<+label+>] <++>' + +function! Tex_InsertItem() + " Get current enclosing environment + let env = Tex_GetCurrentEnv() + + if exists('g:Tex_ItemStyle_'.env) + return IMAP_PutTextWithMovement(g:Tex_ItemStyle_{env}) + else + return '' + endif +endfunction +" }}} +" Tex_SetItemMaps: sets the \item inserting maps for current buffer {{{ +" Description: + +inoremap <script> <silent> <Plug>Tex_InsertItemOnThisLine <Esc>a<C-r>=Tex_InsertItem()<CR> +inoremap <script> <silent> <Plug>Tex_InsertItemOnNextLine <ESC>o<C-R>=Tex_InsertItem()<CR> + +function! Tex_SetItemMaps() + if !hasmapto("<Plug>Tex_InsertItem", "i") + imap <buffer> <M-i> <Plug>Tex_InsertItemOnThisLine + endif + if !hasmapto("<Plug>Tex_InsertItemOnNextLine", "i") + imap <buffer> <C-CR> <Plug>Tex_InsertItemOnNextLine + endif +endfunction " }}} + +" ============================================================================== +" Implementation of Fast Environment commands for LaTeX commands +" ============================================================================== +" Define certain commonly used command definitions {{{ + +TexLet g:Tex_Com_{'newtheorem'} = '\newtheorem{<+name+>}{<+caption+>}[<+within+>]' +TexLet g:Tex_Com_{'frac'} = '\frac{<+n+>}{<+d+>}<++>' + +" }}} +" PromptForCommand: prompts for a command {{{ +" Description: +function! PromptForCommand(ask) + let common_com_prompt = + \ Tex_CreatePrompt(g:Tex_PromptedCommands, 2, ',') . "\n" . + \ "Enter number or command name :" + + let inp = input(a:ask."\n".common_com_prompt) + if inp =~ '^[0-9]\+$' + let com = Tex_Strntok(g:Tex_PromptedCommands, ',', inp) + else + let com = inp + endif + + return com +endfunction " }}} +" Tex_DoCommand: fast insertion of commands {{{ +" Description: +" +function! Tex_DoCommand(isvisual) + " If the current line is empty or if a visual selection has been made, + " prompt for a new environment. + if getline('.') == '' || a:isvisual == 'yes' + let com = PromptForCommand('Choose a command to insert: ') + if com != '' + return Tex_PutCommand(com, a:isvisual) + else + return '' + endif + else + " We want to find out the word under the cursor without issuing + " any movement commands. + let presline = getline('.') + let c = col('.') + + let wordbef = matchstr(strpart(presline, 0, c-1), '\k\+\*\?$') + let wordaft = matchstr(strpart(presline, c-1), '^\k\+\*\?') + + let word = wordbef . wordaft + call Tex_Debug("Tex_DoCommand: wordbef = [".wordbef."], wordaft = [".wordaft."], word = [".word."]", 'env') + + " We use \<Del> instead of \<Bs> because \<Bs> does not work + " unless bs=2 + if word != '' + return substitute(wordbef, '.', "\<Left>", 'g') + \ . substitute(word, '.', "\<Del>", 'g') + \ . Tex_PutCommand(word, a:isvisual) + else + let cmd = PromptForCommand('Choose a command to insert: ') + if cmd != '' + return Tex_PutCommand(cmd, a:isvisual) + else + return '' + endif + endif + endif +endfunction " }}} +" Tex_PutCommand: calls various specialized functions {{{ +" Description: +" Based on input argument, it calls various specialized functions. +function! Tex_PutCommand(com, isvisual) + if a:isvisual == "yes" + if a:com == '$' + return VEnclose('$', '$', '$', '$') + elseif a:com == '\\(' + return VEnclose('\\(', '\\)', '\\(', '\\)') + else + return VEnclose("\\".a:com.'{', '}', "\\".a:com.'{', '}') + endif + else + if exists('b:Tex_Com_{"'.a:com.'"}') + return IMAP_PutTextWithMovement(b:Tex_Com_{a:com}) + elseif exists('g:Tex_Com_{"'.a:com.'"}') + return IMAP_PutTextWithMovement(g:Tex_Com_{a:com}) + elseif a:com == '$' + return IMAP_PutTextWithMovement('$<++>$') + else + return IMAP_PutTextWithMovement("\\".a:com.'{<++>}<++>') + endif + endif +endfunction " }}} +" Mapping the <F7> key to prompt/insert for command {{{ +" and <S-F7> to prompt/replace command +" +" g:Tex_PromptedCommands is a variable containing a comma seperated list +" of commands. +" +" Leaving this empty is equivalent to disabling the feature. +if g:Tex_PromptedCommands != '' + + let b:DoubleDollars = 0 + + inoremap <silent> <Plug>Tex_FastCommandInsert <C-r>=Tex_DoCommand('no')<cr> + nnoremap <silent> <Plug>Tex_FastCommandInsert i<C-r>=Tex_DoCommand('no')<cr> + vnoremap <silent> <Plug>Tex_FastCommandInsert <C-\><C-N>:call Tex_DoCommand('yes')<CR> + + inoremap <silent> <Plug>Tex_FastCommandChange <C-O>:call Tex_ChangeCommand('no')<CR> + nnoremap <silent> <Plug>Tex_FastCommandChange :call Tex_ChangeCommand('no')<CR> + + " Tex_ChangeCommand: calls ChangeCommand() to change the environment {{{ + " Description: + " Finds out which environment the cursor is positioned in and changes + " that to the chosen new environment. This function knows the changes + " which need to be made to change one env to another and calls + " ChangeCommand() with the info. + " + function! Tex_ChangeCommand(isvisual) + + let pos_com = line('.').' | normal! '.virtcol('.').'|' + + let com_line = searchpair('\\\k\{-}{', '', '}', 'b') + + if com_line != 0 + normal l + let com_name = expand('<cword>') + endif + + if !exists('com_name') + echomsg "You are not inside command" + exe pos_com + return 0 + endif + + exe 'echomsg "You are within a '.com_name.' command."' + let change_com = PromptForCommand('Do you want to change it to (number or name)? ') + + if change_com == '' + exe pos_com + return 0 + else + call <SID>ChangeCommand(change_com) + exe pos_com + return 0 + endif + + endfunction + + " }}} + " ChangeCommand: Changes current command according to prompt menu {{{ + " Description: + " + function! s:ChangeCommand(newcom) + + exe 'normal! ct{'.a:newcom."\<Esc>" + + endfunction + " }}} + +endif + +" }}} +" Tex_SetFastCommandMaps: function for setting up the <F7> keys {{{ +" Description: This function is made public so it can be called by the +" SetTeXOptions() function in main.vim +function! Tex_SetFastCommandMaps() + if g:Tex_PromptedCommands != '' + if !hasmapto('<Plug>Tex_FastCommandInsert', 'i') + imap <silent> <buffer> <F7> <Plug>Tex_FastCommandInsert + endif + if !hasmapto('<Plug>Tex_FastCommandInsert', 'n') + nmap <silent> <buffer> <F7> <Plug>Tex_FastCommandInsert + endif + if !hasmapto('<Plug>Tex_FastCommandChange', 'i') + imap <silent> <buffer> <S-F7> <Plug>Tex_FastCommandChange + endif + if !hasmapto('<Plug>Tex_FastCommandChange', 'n') + nmap <silent> <buffer> <S-F7> <Plug>Tex_FastCommandChange + endif + if !hasmapto('<Plug>Tex_FastCommandInsert', 'v') + vmap <silent> <buffer> <F7> <Plug>Tex_FastCommandInsert + endif + endif +endfunction " }}} + +" SetEnvMacrosOptions: sets mappings for buffers {{{ +" " Description: +function! <SID>SetEnvMacrosOptions() + if exists('b:doneTexEnvMaps') + return + endif + let b:doneTexEnvMaps = 1 + if g:Tex_PromptedEnvironments != '' || g:Tex_HotKeyMappings != '' + call Tex_SetFastEnvironmentMaps() + endif + if g:Tex_PromptedCommands != '' + call Tex_SetFastCommandMaps() + endif + call Tex_SetItemMaps() +endfunction " }}} +" Catch the Filetype event so we set maps for each buffer {{{ +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('envmacros.vim: Catching LatexSuiteFileType event', 'env') | + \ call s:SetEnvMacrosOptions() +augroup END +" }}} + +" this statement has to be at the end. +let s:doneOnce = 1 + +" vim:fdm=marker:nowrap:noet:ff=unix diff --git a/vimfiles.latex/ftplugin/latex-suite/folding.vim b/vimfiles.latex/ftplugin/latex-suite/folding.vim new file mode 100644 index 0000000..dfaa450 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/folding.vim @@ -0,0 +1,393 @@ +"============================================================================= +" File: folding.vim +" Author: Srinath Avadhanula +" modifications/additions by Zhang Linbo +" CVS: $Id: folding.vim 997 2006-03-20 09:45:45Z srinathava $ +" Created: Tue Apr 23 05:00 PM 2002 PST +" +" Description: functions to interact with Syntaxfolds.vim +"============================================================================= + +nnoremap <unique> <Plug>Tex_RefreshFolds :call MakeTexFolds(1)<cr> + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('folding.vim: catching LatexSuiteFileType', 'fold') | + \ call Tex_SetFoldOptions() +augroup END + +" Tex_SetFoldOptions: sets maps for every buffer {{{ +" Description: +function! Tex_SetFoldOptions() + if exists('b:doneSetFoldOptions') + return + endif + let b:doneSetFoldOptions = 1 + + setlocal foldtext=TexFoldTextFunction() + + if g:Tex_Folding && g:Tex_AutoFolding + call MakeTexFolds(0) + endif + + let s:ml = exists('g:mapleader') ? g:mapleader : "\\" + + call Tex_MakeMap(s:ml."rf", "<Plug>Tex_RefreshFolds", 'n', '<silent> <buffer>') + +endfunction " }}} +" Tex_FoldSections: creates section folds {{{ +" Author: Zhang Linbo +" Description: +" This function takes a comma seperated list of "sections" and creates fold +" definitions for them. The first item is supposed to be the "shallowest" field +" and the last is the "deepest". See g:Tex_FoldedSections for the default +" definition of the lst input argument. +" +" **works recursively** +function! Tex_FoldSections(lst, endpat) + let i = match(a:lst, ',') + if i > 0 + let s = strpart(a:lst, 0, i) + else + let s = a:lst + endif + if s =~ '%%fakesection' + let s = '^\s*' . s + else + let s = '^\s*\\' . s . '\W' + endif + let endpat = s . '\|' . a:endpat + if i > 0 + call Tex_FoldSections(strpart(a:lst,i+1), endpat) + endif + let endpat = '^\s*\\appendix\W\|' . endpat + call AddSyntaxFoldItem(s, endpat, 0, -1) +endfunction +" }}} +" MakeTexFolds: function to create fold items for latex. {{{ +" +" used in conjunction with MakeSyntaxFolds(). +" see ../plugin/syntaxFolds.vim for documentation +function! MakeTexFolds(force) + if exists('g:Tex_Folding') && !g:Tex_Folding + return + endif + if &ft != 'tex' + return + end + + " Setup folded items lists g:Tex_Foldedxxxx + " 1. Use default value if g:Tex_Foldedxxxxxx is not defined + " 2. prepend default value to g:Tex_Foldedxxxxxx if it starts with ',' + " 3. append default value to g:Tex_Foldedxxxxxx if it ends with ',' + + " Folding items which are not caught in any of the standard commands, + " environments or sections. + let s = 'item,slide,preamble,<<<' + if !exists('g:Tex_FoldedMisc') + let g:Tex_FoldedMisc = s + elseif g:Tex_FoldedMisc[0] == ',' + let g:Tex_FoldedMisc = s . g:Tex_FoldedMisc + elseif g:Tex_FoldedMisc =~ ',$' + let g:Tex_FoldedMisc = g:Tex_FoldedMisc . s + endif + + " By default do not fold any commands. It looks like trying to fold + " commands is a difficult problem since commands can be arbitrarily nested + " and the end patterns are not unique unlike the case of environments. + " For this to work well, we need a regexp which will match a line only if + " a command begins on that line but does not end on that line. This + " requires a regexp which will match unbalanced curly braces and that is + " apparently not doable with regexps. + let s = '' + if !exists('g:Tex_FoldedCommands') + let g:Tex_FoldedCommands = s + elseif g:Tex_FoldedCommands[0] == ',' + let g:Tex_FoldedCommands = s . g:Tex_FoldedCommands + elseif g:Tex_FoldedCommands =~ ',$' + let g:Tex_FoldedCommands = g:Tex_FoldedCommands . s + endif + + let s = 'verbatim,comment,eq,gather,align,figure,table,thebibliography,' + \. 'keywords,abstract,titlepage' + if !exists('g:Tex_FoldedEnvironments') + let g:Tex_FoldedEnvironments = s + elseif g:Tex_FoldedEnvironments[0] == ',' + let g:Tex_FoldedEnvironments = s . g:Tex_FoldedEnvironments + elseif g:Tex_FoldedEnvironments =~ ',$' + let g:Tex_FoldedEnvironments = g:Tex_FoldedEnvironments . s + endif + + if !exists('g:Tex_FoldedSections') + let g:Tex_FoldedSections = 'part,chapter,section,%%fakesection,' + \. 'subsection,subsubsection,paragraph' + endif + + " the order in which these calls are made decides the nestedness. in + " latex, a table environment will always be embedded in either an item or + " a section etc. not the other way around. so we first fold up all the + " tables. and then proceed with the other regions. + + let b:numFoldItems = 0 + + " ======================================================================== + " How to add new folding items {{{ + " ======================================================================== + " + " Each of the following function calls defines a syntax fold region. Each + " definition consists of a call to the AddSyntaxFoldItem() function. + " + " The order in which the folds are defined is important. Juggling the + " order of the function calls will create havoc with folding. The + " "deepest" folding item needs to be called first. For example, if + " the \begin{table} environment is a subset (or lies within) the \section + " environment, then add the definition for the \table first. + " + " The AddSyntaxFoldItem() function takes either 4 or 6 arguments. When it + " is called with 4 arguments, it is equivalent to calling it with 6 + " arguments with the last two left blank (i.e as empty strings) + " + " The explanation for each argument is as follows: + " startpat: a line matching this pattern defines the beginning of a fold. + " endpat : a line matching this pattern defines the end of a fold. + " startoff: this is the offset from the starting line at which folding will + " actually start + " endoff : like startoff, but gives the offset of the actual fold end from + " the line satisfying endpat. + " startoff and endoff are necessary when the folding region does + " not have a specific end pattern corresponding to a start + " pattern. for example in latex, + " \begin{section} + " defines the beginning of a section, but its not necessary to + " have a corresponding + " \end{section} + " the section is assumed to end 1 line _before_ another section + " starts. + " startskip: a pattern which defines the beginning of a "skipped" region. + " + " For example, suppose we define a \itemize fold as follows: + " startpat = '^\s*\\item', + " endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + " startoff = 0, + " endoff = -1 + " + " This defines a fold which starts with a line beginning with an + " \item and ending one line before a line beginning with an + " \item or \end{enumerate} etc. + " + " Then, as long as \item's are not nested things are fine. + " However, once items begin to nest, the fold started by one + " \item can end because of an \item in an \itemize + " environment within this \item. i.e, the following can happen: + " + " \begin{itemize} + " \item Some text <------- fold will start here + " This item will contain a nested item + " \begin{itemize} <----- fold will end here because next line contains \item... + " \item Hello + " \end{itemize} <----- ... instead of here. + " \item Next item of the parent itemize + " \end{itemize} + " + " Therefore, in order to completely define a folding item which + " allows nesting, we need to also define a "skip" pattern. + " startskip and end skip do that. + " Leave '' when there is no nesting. + " endskip: the pattern which defines the end of the "skip" pattern for + " nested folds. + " + " Example: + " 1. A syntax fold region for a latex section is + " startpat = "\\section{" + " endpat = "\\section{" + " startoff = 0 + " endoff = -1 + " startskip = '' + " endskip = '' + " Note that the start and end patterns are thus the same and endoff has a + " negative value to capture the effect of a section ending one line before + " the next starts. + " 2. A syntax fold region for the \itemize environment is: + " startpat = '^\s*\\item', + " endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + " startoff = 0, + " endoff = -1, + " startskip = '^\s*\\begin{\(enumerate\|itemize\|description\)}', + " endskip = '^\s*\\end{\(enumerate\|itemize\|description\)}' + " Note the use of startskip and endskip to allow nesting. + " + " + " }}} + " ======================================================================== + + " {{{ comment lines + if g:Tex_FoldedMisc =~ '\<comments\>' + call AddSyntaxFoldItem ( + \ '^%\([^%]\|[^f]\|[^a]\|[^k]\|[^e]\)', + \ '^[^%]', + \ 0, + \ -1 + \ ) + endif + " }}} + + " {{{ items + if g:Tex_FoldedMisc =~ '\<item\>' + call AddSyntaxFoldItem ( + \ '^\s*\\item', + \ '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + \ 0, + \ -1, + \ '^\s*\\begin{\(enumerate\|itemize\|description\)}', + \ '^\s*\\end{\(enumerate\|itemize\|description\)}' + \ ) + endif + " }}} + + " {{{ title + if g:Tex_FoldedMisc =~ '\<title\>' + call AddSyntaxFoldItem ( + \ '^\s*\\title\W', + \ '^\s*\\maketitle', + \ 0, + \ 0 + \ ) + endif + " }}} + + " Commands and Environments {{{ + " Fold the commands and environments in 2 passes. + let pass = 0 + while pass < 2 + if pass == 0 + let lst = g:Tex_FoldedCommands + else + let lst = g:Tex_FoldedEnvironments + endif + while lst != '' + let i = match(lst, ',') + if i > 0 + let s = strpart(lst, 0, i) + let lst = strpart(lst, i+1) + else + let s = lst + let lst = '' + endif + if s != '' + if pass == 0 + " NOTE: This pattern ensures that a command which is + " terminated on the same line will not start a fold. + " However, it will also refuse to fold certain commands + " which have not terminated. eg: + " \commandname{something \bf{text} and + " will _not_ start a fold. + " In other words, the pattern is safe, but not exact. + call AddSyntaxFoldItem('^\s*\\'.s.'{[^{}]*$','^[^}]*}',0,0) + else + call AddSyntaxFoldItem('^\s*\\begin{'.s,'^\s*\\end{'.s,0,0) + endif + endif + endwhile + let pass = pass + 1 + endwhile + " }}} + + " Sections {{{ + if g:Tex_FoldedSections != '' + call Tex_FoldSections(g:Tex_FoldedSections, + \ '^\s*\\frontmatter\|^\s*\\mainmatter\|^\s*\\backmatter\|' + \. '^\s*\\begin{thebibliography\|>>>\|^\s*\\endinput\|' + \. '^\s*\\begin{slide\|^\s*\\end{document') + endif + " }}} + + " {{{ slide + if g:Tex_FoldedMisc =~ '\<slide\>' + call AddSyntaxFoldItem ( + \ '^\s*\\begin{slide', + \ '^\s*\\appendix\W\|^\s*\\chapter\W\|^\s*\\end{slide\|^\s*\\end{document', + \ 0, + \ 0 + \ ) + endif + " }}} + + " {{{ preamble + if g:Tex_FoldedMisc =~ '\<preamble\>' + call AddSyntaxFoldItem ( + \ '^\s*\\document\(class\|style\).*{', + \ '^\s*\\begin{document}', + \ 0, + \ -1 + \ ) + endif + " }}} + + " Manually folded regions {{{ + if g:Tex_FoldedMisc =~ '\(^\|,\)<<<\(,\|$\)' + call AddSyntaxFoldItem ( + \ '<<<', + \ '>>>', + \ 0, + \ 0 + \ ) + endif + " }}} + + call MakeSyntaxFolds(a:force) + normal! zv +endfunction + +" }}} +" TexFoldTextFunction: create fold text for folds {{{ +function! TexFoldTextFunction() + let leadingSpace = matchstr(' ', ' \{,'.indent(v:foldstart).'}') + if getline(v:foldstart) =~ '^\s*\\begin{' + let header = matchstr(getline(v:foldstart), + \ '^\s*\\begin{\zs\([:alpha:]*\)[^}]*\ze}') + let caption = '' + let label = '' + let i = v:foldstart + while i <= v:foldend + if getline(i) =~ '\\caption' + " distinguish between + " \caption{fulldesc} - fulldesc will be displayed + " \caption[shortdesc]{fulldesc} - shortdesc will be displayed + if getline(i) =~ '\\caption\[' + let caption = matchstr(getline(i), '\\caption\[\zs[^\]]*') + let caption = substitute(caption, '\zs\]{.*}[^}]*$', '', '') + else + let caption = matchstr(getline(i), '\\caption{\zs.*') + let caption = substitute(caption, '\zs}[^}]*$', '', '') + end + elseif getline(i) =~ '\\label' + let label = matchstr(getline(i), '\\label{\zs.*') + let label = substitute(label, '\zs}[^}]*$', '', '') + end + + let i = i + 1 + endwhile + + let ftxto = foldtext() + " if no caption found, then use the second line. + if caption == '' + let caption = getline(v:foldstart + 1) + end + + let retText = matchstr(ftxto, '^[^:]*').': '.header. + \ ' ('.label.') : '.caption + return leadingSpace.retText + + elseif getline(v:foldstart) =~ '^%' && getline(v:foldstart) !~ '^%%fake' + let ftxto = foldtext() + return leadingSpace.substitute(ftxto, ':', ': % ', '') + elseif getline(v:foldstart) =~ '^\s*\\document\(class\|style\).*{' + let ftxto = leadingSpace.foldtext() + return substitute(ftxto, ':', ': Preamble: ', '') + else + return leadingSpace.foldtext() + end +endfunction +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/macros/example b/vimfiles.latex/ftplugin/latex-suite/macros/example new file mode 100644 index 0000000..395311f --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/macros/example @@ -0,0 +1,11 @@ +% my long complicated macro. This is an example of how to set up a +% tex-macro for latex-suite. simply type in the lines as you would in +% latex. Place holders are allowed. +% NOTE: if you have filetype indentation turned on, then do not do +% formatting here. the indentation will follow automatically... +\begin{mycomplicatedenvironment} +\mycommand1{<++>} +\mycommand2{<+hint2+>} +\mycommand3{<++>} +\mycommand4{<++>} +\end{mycomplicatedenvironment}<++> diff --git a/vimfiles.latex/ftplugin/latex-suite/main.vim b/vimfiles.latex/ftplugin/latex-suite/main.vim new file mode 100644 index 0000000..063c6f6 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/main.vim @@ -0,0 +1,1024 @@ +" LaTeX filetype +" Language: LaTeX (ft=tex) +" Maintainer: Srinath Avadhanula +" CVS: $Id: main.vim 999 2006-03-21 05:32:37Z srinathava $ +" URL: + +" line continuation used here. +let s:save_cpo = &cpo +set cpo&vim + +" avoiding re-inclusion {{{ +" the avoiding re-inclusion statement is not provided here because the files +" which call this file should in the normal course of events handle the +" re-inclusion stuff. + +" we definitely dont want to run through the entire file each and every time. +" only once to define the functions. for successive latex files, just set up +" the folding and mappings and quit. +if exists('s:doneFunctionDefinitions') && !exists('b:forceRedoLocalTex') + call s:SetTeXOptions() + finish +endif + +let s:doneFunctionDefinitions = 1 + +" get the place where this plugin resides for setting cpt and dict options. +" these lines need to be outside the function. +let s:path = expand('<sfile>:p:h') +" set up personal defaults. +runtime ftplugin/tex/texrc +" set up global defaults. +exe "so ".s:path.'/texrc' + +" }}} + +nmap <silent> <script> <plug> i +imap <silent> <script> <C-o><plug> <Nop> + +" ============================================================================== +" mappings +" ============================================================================== +" {{{ +" calculate the mapleader character. +let s:ml = exists('g:mapleader') ? g:mapleader : '\' + +if !exists('s:doneMappings') + let s:doneMappings = 1 + " short forms for latex formatting and math elements. {{{ + " taken from auctex.vim or miktexmacros.vim + call IMAP ('__', '_{<++>}<++>', "tex") + call IMAP ('()', '(<++>)<++>', "tex") + call IMAP ('[]', '[<++>]<++>', "tex") + call IMAP ('{}', '{<++>}<++>', "tex") + call IMAP ('^^', '^{<++>}<++>', "tex") + call IMAP ('$$', '$<++>$<++>', "tex") + call IMAP ('==', '&=& ', "tex") + call IMAP ('~~', '&\approx& ', "tex") + call IMAP ('=~', '\approx', "tex") + call IMAP ('::', '\dots', "tex") + call IMAP ('((', '\left( <++> \right)<++>', "tex") + call IMAP ('[[', '\left[ <++> \right]<++>', "tex") + call IMAP ('{{', '\left\{ <++> \right\}<++>', "tex") + call IMAP (g:Tex_Leader.'^', '\hat{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'_', '\bar{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'6', '\partial', "tex") + call IMAP (g:Tex_Leader.'8', '\infty', "tex") + call IMAP (g:Tex_Leader.'/', '\frac{<++>}{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'%', '\frac{<++>}{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'@', '\circ', "tex") + call IMAP (g:Tex_Leader.'0', '^\circ', "tex") + call IMAP (g:Tex_Leader.'=', '\equiv', "tex") + call IMAP (g:Tex_Leader."\\",'\setminus', "tex") + call IMAP (g:Tex_Leader.'.', '\cdot', "tex") + call IMAP (g:Tex_Leader.'*', '\times', "tex") + call IMAP (g:Tex_Leader.'&', '\wedge', "tex") + call IMAP (g:Tex_Leader.'-', '\bigcap', "tex") + call IMAP (g:Tex_Leader.'+', '\bigcup', "tex") + call IMAP (g:Tex_Leader.'M', '\sum_{<++>}^{<++>}<++>', 'tex') + call IMAP (g:Tex_Leader.'S', '\sum_{<++>}^{<++>}<++>', 'tex') + call IMAP (g:Tex_Leader.'(', '\subset', "tex") + call IMAP (g:Tex_Leader.')', '\supset', "tex") + call IMAP (g:Tex_Leader.'<', '\le', "tex") + call IMAP (g:Tex_Leader.'>', '\ge', "tex") + call IMAP (g:Tex_Leader.',', '\nonumber', "tex") + call IMAP (g:Tex_Leader.'~', '\tilde{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.';', '\dot{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.':', '\ddot{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'2', '\sqrt{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'|', '\Big|', "tex") + call IMAP (g:Tex_Leader.'I', "\\int_{<++>}^{<++>}<++>", 'tex') + " }}} + " Greek Letters {{{ + call IMAP(g:Tex_Leader.'a', '\alpha', 'tex') + call IMAP(g:Tex_Leader.'b', '\beta', 'tex') + call IMAP(g:Tex_Leader.'c', '\chi', 'tex') + call IMAP(g:Tex_Leader.'d', '\delta', 'tex') + call IMAP(g:Tex_Leader.'e', '\varepsilon', 'tex') + call IMAP(g:Tex_Leader.'f', '\varphi', 'tex') + call IMAP(g:Tex_Leader.'g', '\gamma', 'tex') + call IMAP(g:Tex_Leader.'h', '\eta', 'tex') + call IMAP(g:Tex_Leader.'k', '\kappa', 'tex') + call IMAP(g:Tex_Leader.'l', '\lambda', 'tex') + call IMAP(g:Tex_Leader.'m', '\mu', 'tex') + call IMAP(g:Tex_Leader.'n', '\nu', 'tex') + call IMAP(g:Tex_Leader.'p', '\pi', 'tex') + call IMAP(g:Tex_Leader.'q', '\theta', 'tex') + call IMAP(g:Tex_Leader.'r', '\rho', 'tex') + call IMAP(g:Tex_Leader.'s', '\sigma', 'tex') + call IMAP(g:Tex_Leader.'t', '\tau', 'tex') + call IMAP(g:Tex_Leader.'u', '\upsilon', 'tex') + call IMAP(g:Tex_Leader.'v', '\varsigma', 'tex') + call IMAP(g:Tex_Leader.'w', '\omega', 'tex') + call IMAP(g:Tex_Leader.'w', '\wedge', 'tex') " AUCTEX style + call IMAP(g:Tex_Leader.'x', '\xi', 'tex') + call IMAP(g:Tex_Leader.'y', '\psi', 'tex') + call IMAP(g:Tex_Leader.'z', '\zeta', 'tex') + " not all capital greek letters exist in LaTeX! + " reference: http://www.giss.nasa.gov/latex/ltx-405.html + call IMAP(g:Tex_Leader.'D', '\Delta', 'tex') + call IMAP(g:Tex_Leader.'F', '\Phi', 'tex') + call IMAP(g:Tex_Leader.'G', '\Gamma', 'tex') + call IMAP(g:Tex_Leader.'Q', '\Theta', 'tex') + call IMAP(g:Tex_Leader.'L', '\Lambda', 'tex') + call IMAP(g:Tex_Leader.'X', '\Xi', 'tex') + call IMAP(g:Tex_Leader.'Y', '\Psi', 'tex') + call IMAP(g:Tex_Leader.'S', '\Sigma', 'tex') + call IMAP(g:Tex_Leader.'U', '\Upsilon', 'tex') + call IMAP(g:Tex_Leader.'W', '\Omega', 'tex') + " }}} + " ProtectLetters: sets up indentity maps for things like ``a {{{ + " " Description: If we simply do + " call IMAP('`a', '\alpha', 'tex') + " then we will never be able to type 'a' after a tex-quotation. Since + " IMAP() always uses the longest map ending in the letter, this problem + " can be avoided by creating a fake map for ``a -> ``a. + " This function sets up fake maps of the following forms: + " ``[aA] -> ``[aA] (for writing in quotations) + " \`[aA] -> \`[aA] (for writing diacritics) + " "`[aA] -> "`[aA] (for writing german quotations) + " It does this for all printable lower ascii characters just to make sure + " we dont let anything slip by. + function! s:ProtectLetters(first, last) + let i = a:first + while i <= a:last + if nr2char(i) =~ '[[:print:]]' + call IMAP('``'.nr2char(i), '``'.nr2char(i), 'tex') + call IMAP('\`'.nr2char(i), '\`'.nr2char(i), 'tex') + call IMAP('"`'.nr2char(i), '"`'.nr2char(i), 'tex') + endif + let i = i + 1 + endwhile + endfunction + call s:ProtectLetters(32, 127) + " }}} + " vmaps: enclose selected region in brackets, environments {{{ + " The action changes depending on whether the selection is character-wise + " or line wise. for example, selecting linewise and pressing \v will + " result in the region being enclosed in \begin{verbatim}, \end{verbatim}, + " whereas in characterise visual mode, the thingie is enclosed in \verb| + " and |. + exec 'vnoremap <silent> '.g:Tex_Leader."( \<C-\\>\<C-N>:call VEnclose('\\left( ', ' \\right)', '\\left(', '\\right)')\<CR>" + exec 'vnoremap <silent> '.g:Tex_Leader."[ \<C-\\>\<C-N>:call VEnclose('\\left[ ', ' \\right]', '\\left[', '\\right]')\<CR>" + exec 'vnoremap <silent> '.g:Tex_Leader."{ \<C-\\>\<C-N>:call VEnclose('\\left\\{ ', ' \\right\\}', '\\left\\{', '\\right\\}')\<CR>" + exec 'vnoremap <silent> '.g:Tex_Leader."$ \<C-\\>\<C-N>:call VEnclose('$', '$', '\\[', '\\]')\<CR>" + " }}} +end + +" }}} + +" ============================================================================== +" Helper functions for debugging +" ============================================================================== +" Tex_Debug: appends the argument into s:debugString {{{ +" Description: +" +" Do not want a memory leak! Set this to zero so that latex-suite always +" starts out in a non-debugging mode. +if !exists('g:Tex_Debug') + let g:Tex_Debug = 0 +endif +function! Tex_Debug(str, ...) + if !g:Tex_Debug + return + endif + if a:0 > 0 + let pattern = a:1 + else + let pattern = '' + endif + if !exists('s:debugString_'.pattern) + let s:debugString_{pattern} = '' + endif + let s:debugString_{pattern} = s:debugString_{pattern}.a:str."\n" + + let s:debugString_ = (exists('s:debugString_') ? s:debugString_ : '') + \ . pattern.' : '.a:str."\n" + + if Tex_GetVarValue('Tex_DebugLog') != '' + exec 'redir! >> '.Tex_GetVarValue('Tex_DebugLog') + silent! echo pattern.' : '.a:str + redir END + endif +endfunction " }}} +" Tex_PrintDebug: prings s:debugString {{{ +" Description: +" +function! Tex_PrintDebug(...) + if a:0 > 0 + let pattern = a:1 + else + let pattern = '' + endif + if exists('s:debugString_'.pattern) + echo s:debugString_{pattern} + endif +endfunction " }}} +" Tex_ClearDebug: clears the s:debugString string {{{ +" Description: +" +function! Tex_ClearDebug(...) + if a:0 > 0 + let pattern = a:1 + else + let pattern = '' + endif + if exists('s:debugString_'.pattern) + let s:debugString_{pattern} = '' + endif +endfunction " }}} +" Tex_ShowVariableValue: debugging help {{{ +" provides a way to examine script local variables from outside the script. +" very handy for debugging. +function! Tex_ShowVariableValue(...) + let i = 1 + while i <= a:0 + exe 'let arg = a:'.i + if exists('s:'.arg) || + \ exists('*s:'.arg) + exe 'let val = s:'.arg + echomsg 's:'.arg.' = '.val + end + let i = i + 1 + endwhile +endfunction + +" }}} + +" ============================================================================== +" Helper functions for grepping +" ============================================================================== +" Tex_Grep: shorthand for :grep or :vimgrep {{{ +function! Tex_Grep(string, where) + if v:version >= 700 + exec 'silent! vimgrep! /'.a:string.'/ '.a:where + else + exec 'silent! grep! '.Tex_EscapeForGrep(a:string).' '.a:where + endif +endfunction + +" }}} +" Tex_Grepadd: shorthand for :grepadd or :vimgrepadd {{{ +function! Tex_Grepadd(string, where) + if v:version >= 700 + exec 'silent! vimgrepadd! /'.a:string.'/ '.a:where + else + exec "silent! grepadd! ".Tex_EscapeForGrep(a:string).' '.a:where + endif +endfunction + +" }}} +" Tex_EscapeForGrep: escapes back-slashes and doublequotes the correct number of times {{{ +" Description: This command escapes the backslash and double quotes in a +" search pattern the correct number of times so it can be used in the ``:grep`` +" command. This command is meant to be used as:: +" +" exec "silent! grep ".Tex_EscapeForGrep(pattern)." file" +" +" The input argument to this function should be the string which you want +" the external command to finally see. For example, to search for a string +" ``'\bibitem'``, the grep command needs to be passed a string like +" ``'\\bibitem'``. Examples:: +" +" Tex_EscapeForGrep('\\bibitem') " correct +" Tex_EscapeForGrep('\bibitem') " wrong +" Tex_EscapeForGrep("\\bibitem") " wrong +" Tex_EscapeForGrep('\<word\>') " correct +" +function! Tex_EscapeForGrep(string) + let retVal = a:string + + " The shell halves the backslashes. + if &shell =~ 'sh' + let retVal = escape(retVal, "\\") + + " If shellxquote is set, then the backslashes are halved yet again. + if &shellxquote == '"' + let retVal = escape(retVal, "\"\\") + endif + + endif + " escape special characters which bash/cmd.exe might interpret + let retVal = escape(retVal, "<>") + + return retVal +endfunction " }}} + +" ============================================================================== +" Uncategorized helper functions +" ============================================================================== +" Tex_Strntok: extract the n^th token from a list {{{ +" example: Strntok('1,23,3', ',', 2) = 23 +fun! Tex_Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun + +" }}} +" Tex_CreatePrompt: creates a prompt string {{{ +" Description: +" Arguments: +" promptList: This is a string of the form: +" 'item1,item2,item3,item4' +" cols: the number of columns in the resultant prompt +" sep: the list seperator token +" +" Example: +" Tex_CreatePrompt('item1,item2,item3,item4', 2, ',') +" returns +" "(1) item1\t(2)item2\n(3)item3\t(4)item4" +" +" This string can be used in the input() function. +function! Tex_CreatePrompt(promptList, cols, sep) + + let g:listSep = a:sep + let num_common = GetListCount(a:promptList) + + let i = 1 + let promptStr = "" + + while i <= num_common + + let j = 0 + while j < a:cols && i + j <= num_common + let com = Tex_Strntok(a:promptList, a:sep, i+j) + let promptStr = promptStr.'('.(i+j).') '. + \ com."\t".( strlen(com) < 4 ? "\t" : '' ) + + let j = j + 1 + endwhile + + let promptStr = promptStr."\n" + + let i = i + a:cols + endwhile + return promptStr +endfunction + +" }}} +" Tex_CleanSearchHistory: removes last search item from search history {{{ +" Description: This function needs to be globally visible because its +" called from outside the script during expansion. +function! Tex_CleanSearchHistory() + call histdel("/", -1) + let @/ = histget("/", -1) +endfunction +nmap <silent> <script> <plug>cleanHistory :call Tex_CleanSearchHistory()<CR> + +" }}} +" Tex_GetVarValue: gets the value of the variable {{{ +" Description: +" See if a window-local, buffer-local or global variable with the given name +" exists and if so, returns the corresponding value. If none exist, return +" an empty string. +function! Tex_GetVarValue(varname, ...) + if exists('w:'.a:varname) + return w:{a:varname} + elseif exists('b:'.a:varname) + return b:{a:varname} + elseif exists('g:'.a:varname) + return g:{a:varname} + elseif a:0 > 0 + return a:1 + else + return '' + endif +endfunction " }}} +" Tex_GetMainFileName: gets the name of the main file being compiled. {{{ +" Description: returns the full path name of the main file. +" This function checks for the existence of a .latexmain file +" which might point to the location of a "main" latex file. +" If .latexmain exists, then return the full path name of the +" file being pointed to by it. +" +" Otherwise, return the full path name of the current buffer. +" +" You can supply an optional "modifier" argument to the +" function, which will optionally modify the file name before +" returning. +" NOTE: From version 1.6 onwards, this function always trims +" away the .latexmain part of the file name before applying the +" modifier argument. +function! Tex_GetMainFileName(...) + if a:0 > 0 + let modifier = a:1 + else + let modifier = ':p' + endif + + " If the user wants to use his own way to specify the main file name, then + " use it straight away. + if Tex_GetVarValue('Tex_MainFileExpression') != '' + exec 'let retval = '.Tex_GetVarValue('Tex_MainFileExpression') + return retval + endif + + let curd = getcwd() + + let dirmodifier = '%:p:h' + let dirLast = expand(dirmodifier) + call Tex_CD(dirLast) + + " move up the directory tree until we find a .latexmain file. + " TODO: Should we be doing this recursion by default, or should there be a + " setting? + while glob('*.latexmain') == '' + let dirmodifier = dirmodifier.':h' + " break from the loop if we cannot go up any further. + if expand(dirmodifier) == dirLast + break + endif + let dirLast = expand(dirmodifier) + call Tex_CD(dirLast) + endwhile + + let lheadfile = glob('*.latexmain') + if lheadfile != '' + " Remove the trailing .latexmain part of the filename... We never want + " that. + let lheadfile = fnamemodify(substitute(lheadfile, '\.latexmain$', '', ''), modifier) + else + " If we cannot find any main file, just modify the filename of the + " current buffer. + let lheadfile = expand('%'.modifier) + endif + + call Tex_CD(curd) + + " NOTE: The caller of this function needs to escape spaces in the + " file name as appropriate. The reason its not done here is that + " escaping spaces is not safe if this file is to be used as part of + " an external command on certain platforms. + return lheadfile +endfunction + +" }}} +" Tex_ChooseFromPrompt: process a user input to a prompt string {{{ +" " Description: +function! Tex_ChooseFromPrompt(dialog, list, sep) + let g:Tex_ASDF = a:dialog + let inp = input(a:dialog) + if inp =~ '\d\+' + return Tex_Strntok(a:list, a:sep, inp) + else + return inp + endif +endfunction " }}} +" Tex_ChooseFile: produces a file list and prompts for choice {{{ +" Description: +function! Tex_ChooseFile(dialog) + let files = glob('*') + if files == '' + return '' + endif + let s:incnum = 0 + echo a:dialog + let filenames = substitute(files, "\\v(^|\n)", "\\=submatch(0).Tex_IncrementNumber(1).' : '", 'g') + echo filenames + let choice = input('Enter Choice : ') + let g:choice = choice + if choice == '' + return '' + endif + if choice =~ '^\s*\d\+\s*$' + let retval = Tex_Strntok(files, "\n", choice) + else + let filescomma = substitute(files, "\n", ",", "g") + let retval = GetListMatchItem(filescomma, choice) + endif + if retval == '' + return '' + endif + return retval +endfunction + +" }}} +" Tex_IncrementNumber: returns an incremented number each time {{{ +" Description: +let s:incnum = 0 +function! Tex_IncrementNumber(increm) + let s:incnum = s:incnum + a:increm + return s:incnum +endfunction + +" }}} +" Tex_ResetIncrementNumber: increments s:incnum to zero {{{ +" Description: +function! Tex_ResetIncrementNumber(val) + let s:incnum = a:val +endfunction " }}} +" Tex_FindInRtp: check if file exists in &rtp {{{ +" Description: Checks if file exists in globpath(&rtp, ...) and cuts off the +" rest of returned names. This guarantees that sourced file is +" from $HOME. +" If an optional argument is given, it specifies how to expand +" each filename found. For example, '%:p' will return a list of +" the complete paths to the files. By default returns trailing +" path-names without extenions. +" NOTE: This function is very slow when a large number of +" matches are found because of a while loop which modifies +" each filename found. Some speedup was acheived by using +" a tokenizer approach rather than using Tex_Strntok which +" would have been more obvious. +function! Tex_FindInRtp(filename, directory, ...) + " how to expand each filename. ':p:t:r' modifies each filename to its + " trailing part without extension. + let expand = (a:0 > 0 ? a:1 : ':p:t:r') + " The pattern used... An empty filename should be regarded as '*' + let pattern = (a:filename != '' ? a:filename : '*') + + let filelist = globpath(&rtp, 'ftplugin/latex-suite/'.a:directory.'/'.pattern)."\n" + + if filelist == "\n" + return '' + endif + + if a:filename != '' + return fnamemodify(Tex_Strntok(filelist, "\n", 1), expand) + endif + + " Now cycle through the files modifying each filename in the desired + " manner. + let retfilelist = '' + let i = 1 + while 1 + " Extract the portion till the next newline. Then shorten the filelist + " by removing till the newline. + let nextnewline = stridx(filelist, "\n") + if nextnewline == -1 + break + endif + let filename = strpart(filelist, 0, nextnewline) + let filelist = strpart(filelist, nextnewline+1) + + " The actual modification. + if fnamemodify(filename, expand) != '' + let retfilelist = retfilelist.fnamemodify(filename, expand)."," + endif + let i = i + 1 + endwhile + + return substitute(retfilelist, ',$', '', '') +endfunction + +" }}} +" Tex_GetErrorList: returns vim's clist {{{ +" Description: returns the contents of the error list available via the :clist +" command. +function! Tex_GetErrorList() + let _a = @a + redir @a | silent! clist | redir END + let errlist = @a + let @a = _a + + if errlist =~ 'E42: ' + let errlist = '' + endif + + return errlist +endfunction " }}} +" Tex_GetTempName: get the name of a temporary file in specified directory {{{ +" Description: Unlike vim's native tempname(), this function returns the name +" of a temporary file in the directory specified. This enables +" us to create temporary files in a specified directory. +function! Tex_GetTempName(dirname) + let prefix = 'latexSuiteTemp' + let slash = (a:dirname =~ '\\\|/$' ? '' : '/') + let i = 0 + while filereadable(a:dirname.slash.prefix.i.'.tex') && i < 1000 + let i = i + 1 + endwhile + if filereadable(a:dirname.slash.prefix.i.'.tex') + echoerr "Temporary file could not be created in ".a:dirname + return '' + endif + return expand(a:dirname.slash.prefix.i.'.tex', ':p') +endfunction +" }}} +" Tex_MakeMap: creates a mapping from lhs to rhs if rhs is not already mapped {{{ +" Description: +function! Tex_MakeMap(lhs, rhs, mode, extraargs) + if !hasmapto(a:rhs, a:mode) + exec a:mode.'map '.a:extraargs.' '.a:lhs.' '.a:rhs + endif +endfunction " }}} +" Tex_CD: cds to given directory escaping spaces if necessary {{{ +" " Description: +function! Tex_CD(dirname) + exec 'cd '.Tex_EscapeSpaces(a:dirname) +endfunction " }}} +" Tex_EscapeSpaces: escapes unescaped spaces from a path name {{{ +" Description: +function! Tex_EscapeSpaces(path) + return substitute(a:path, '[^\\]\(\\\\\)*\zs ', '\\ ', 'g') +endfunction " }}} +" Tex_FindFile: finds a file in the vim's 'path' {{{ +" Description: finds a file in vim's 'path' +function! Tex_FindFile(fname, path, suffixesadd) + if exists('*findfile') + let _suffixesadd = &suffixesadd + let &suffixesadd = a:suffixesadd + let retval = findfile(a:fname, a:path) + let &suffixesadd = _suffixesadd + else + " split a new window so we do not screw with the current buffer. We + " want to use the same filename each time so that multiple scratch + " buffers are not created. + let retval = '' + silent! split __HOPEFULLY_THIS_FILE_DOES_NOT_EXIST__ + let _suffixesadd = &suffixesadd + let _path = &path + let &suffixesadd = a:suffixesadd + let &path = a:path + exec 'silent! find '.a:fname + if bufname('%') != '__HOPEFULLY_THIS_FILE_DOES_NOT_EXIST__' + let retval = expand('%:p') + end + silent! bdelete! + let &suffixesadd = _suffixesadd + let &path = _path + endif + return retval +endfunction " }}} + +" ============================================================================== +" Smart key-mappings +" ============================================================================== +" TexQuotes: inserts `` or '' instead of " {{{ +if g:Tex_SmartKeyQuote + + " TexQuotes: inserts `` or '' instead of " + " Taken from texmacro.vim by Benji Fisher <benji@e-math.AMS.org> + " TODO: Deal with nested quotes. + " The :imap that calls this function should insert a ", move the cursor to + " the left of that character, then call this with <C-R>= . + function! s:TexQuotes() + let l = line(".") + let c = col(".") + let restore_cursor = l . "G" . virtcol(".") . "|" + normal! H + let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor + execute restore_cursor + " In math mode, or when preceded by a \, just move the cursor past the + " already-inserted " character. + if synIDattr(synID(l, c, 1), "name") =~ "^texMath" + \ || (c > 1 && getline(l)[c-2] == '\') + return "\<Right>" + endif + " Find the appropriate open-quote and close-quote strings. + if exists("b:Tex_SmartQuoteOpen") + let open = b:Tex_SmartQuoteOpen + elseif exists("g:Tex_SmartQuoteOpen") + let open = g:Tex_SmartQuoteOpen + else + let open = "``" + endif + if exists("b:Tex_SmartQuoteClose") + let close = b:Tex_SmartQuoteClose + elseif exists("g:Tex_SmartQuoteClose") + let close = g:Tex_SmartQuoteClose + else + let close = "''" + endif + let boundary = '\|' + " This code seems to be obsolete, since this script variable is never + " set. The idea is that some languages use ",," as an open- or + " close-quote string, and we want to avoid confusing ordinary "," + " with a quote boundary. + if exists("s:TeX_strictquote") + if( s:TeX_strictquote == "open" || s:TeX_strictquote == "both" ) + let boundary = '\<' . boundary + endif + if( s:TeX_strictquote == "close" || s:TeX_strictquote == "both" ) + let boundary = boundary . '\>' + endif + endif + + " Eventually return q; set it to the default value now. + let q = open + let pattern = + \ escape(open, '\~') . + \ boundary . + \ escape(close, '\~') . + \ '\|^$\|"' + + while 1 " Look for preceding quote (open or close), ignoring + " math mode and '\"' . + call search(pattern, "bw") + if synIDattr(synID(line("."), col("."), 1), "name") !~ "^texMath" + \ && strpart(getline('.'), col('.')-2, 2) != '\"' + break + endif + endwhile + + " Now, test whether we actually found a _preceding_ quote; if so, is it + " an open quote? + if ( line(".") < l || line(".") == l && col(".") < c ) + if strpart(getline("."), col(".")-1) =~ '\V\^' . escape(open, '\') + if line(".") == l && col(".") + strlen(open) == c + " Insert "<++>''<++>" instead of just "''". + let q = IMAP_PutTextWithMovement("<++>".close."<++>") + else + let q = close + endif + endif + endif + + " Return to line l, column c: + execute restore_cursor + " Start with <Del> to remove the " put in by the :imap . + return "\<Del>" . q + + endfunction + +endif +" }}} +" SmartBS: smart backspacing {{{ +if g:Tex_SmartKeyBS + + " SmartBS: smart backspacing + " SmartBS lets you treat diacritic characters (those \'{a} thingies) as a + " single character. This is useful for example in the following situation: + " + " \v{s}\v{t}astn\'{y} ('happy' in Slovak language :-) ) + " If you will delete this normally (without using smartBS() function), you + " must press <BS> about 19x. With function smartBS() you must press <BS> only + " 7x. Strings like "\v{s}", "\'{y}" are considered like one character and are + " deleted with one <BS>. + let s:smartBS_pat = Tex_GetVarValue('Tex_SmartBSPattern') + + fun! s:SmartBS_pat() + return s:smartBS_pat + endfun + + " This function comes from Benji Fisher <benji@e-math.AMS.org> + " http://vim.sourceforge.net/scripts/download.php?src_id=409 + " (modified/patched by Lubomir Host 'rajo' <host8 AT keplerDOTfmphDOTuniba.sk>) + function! s:SmartBS(pat) + let init = strpart(getline("."), 0, col(".")-1) + let matchtxt = matchstr(init, a:pat) + if matchtxt != '' + let bstxt = substitute(matchtxt, '.', "\<bs>", 'g') + return bstxt + else + return "\<bs>" + endif + endfun + +endif " }}} +" SmartDots: inserts \cdots instead of ... in math mode otherwise \ldots {{{ +" if amsmath package is detected then just use \dots and let amsmath take care +" of it. +if g:Tex_SmartKeyDot + + function! <SID>SmartDots() + if strpart(getline('.'), col('.')-3, 2) == '..' && + \ g:Tex_package_detected =~ '\<amsmath\>' + return "\<bs>\<bs>\\dots" + elseif synIDattr(synID(line('.'),col('.')-1,0),"name") =~ '^texMath' + \&& strpart(getline('.'), col('.')-3, 2) == '..' + return "\<bs>\<bs>\\cdots" + elseif strpart(getline('.'), col('.')-3, 2) == '..' + return "\<bs>\<bs>\\ldots" + else + return '.' + endif + endfunction + +endif +" }}} + +" source texproject.vim before other files +exe 'source '.s:path.'/texproject.vim' + +" source all the relevant files. +exe 'source '.s:path.'/texmenuconf.vim' +exe 'source '.s:path.'/envmacros.vim' +exe 'source '.s:path.'/elementmacros.vim' + +" source utf-8 or plain math menus +if exists("g:Tex_UseUtfMenus") && g:Tex_UseUtfMenus != 0 && has("gui_running") + exe 'source '.s:path.'/mathmacros-utf.vim' +else + exe 'source '.s:path.'/mathmacros.vim' +endif + +exe 'source '.s:path.'/multicompile.vim' +exe 'source '.s:path.'/compiler.vim' +exe 'source '.s:path.'/folding.vim' +exe 'source '.s:path.'/templates.vim' +exe 'source '.s:path.'/custommacros.vim' +exe 'source '.s:path.'/bibtex.vim' + +" source advanced math functions +if g:Tex_AdvancedMath == 1 + exe 'source '.s:path.'/brackets.vim' + exe 'source '.s:path.'/smartspace.vim' +endif + +if g:Tex_Diacritics != 0 + exe 'source '.s:path.'/diacritics.vim' +endif + +exe 'source '.s:path.'/texviewer.vim' +exe 'source '.s:path.'/version.vim' + +" ============================================================================== +" Finally set up the folding, options, mappings and quit. +" ============================================================================== +" SetTeXOptions: sets options/mappings for this file. {{{ +function! <SID>SetTeXOptions() + " Avoid reinclusion. + if exists('b:doneSetTeXOptions') + return + endif + let b:doneSetTeXOptions = 1 + + exe 'setlocal dict^='.s:path.'/dictionaries/dictionary' + + call Tex_Debug('SetTeXOptions: sourcing maps', 'main') + " smart functions + if g:Tex_SmartKeyQuote + inoremap <buffer> <silent> " "<Left><C-R>=<SID>TexQuotes()<CR> + endif + if g:Tex_SmartKeyBS + inoremap <buffer> <silent> <BS> <C-R>=<SID>SmartBS(<SID>SmartBS_pat())<CR> + endif + if g:Tex_SmartKeyDot + inoremap <buffer> <silent> . <C-R>=<SID>SmartDots()<CR> + endif + + " This line seems to be necessary to source our compiler/tex.vim file. + " The docs are unclear why this needs to be done even though this file is + " the first compiler plugin in 'runtimepath'. + runtime compiler/tex.vim + +endfunction + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('main.vim: Catching LatexSuiteFileType event', 'main') | + \ call <SID>SetTeXOptions() +augroup END + +" }}} + +" ============================================================================== +" Settings for taglist.vim plugin +" ============================================================================== +" Sets Tlist_Ctags_Cmd for taglist.vim and regexps for ctags {{{ +if exists("g:Tex_TaglistSupport") && g:Tex_TaglistSupport == 1 + if !exists("g:tlist_tex_settings") + let g:tlist_tex_settings = 'tex;s:section;c:chapter;l:label;r:ref' + endif + + if exists("Tlist_Ctags_Cmd") + let s:tex_ctags = Tlist_Ctags_Cmd + else + let s:tex_ctags = 'ctags' " Configurable in texrc? + endif + + if exists("g:Tex_InternalTagsDefinitions") && g:Tex_InternalTagsDefinitions == 1 + let Tlist_Ctags_Cmd = s:tex_ctags ." --langdef=tex --langmap=tex:.tex.ltx.latex" + \.' --regex-tex="/\\\\begin{abstract}/Abstract/s,abstract/"' + \.' --regex-tex="/\\\\part[ \t]*\*?\{[ \t]*([^}]*)\}/\1/s,part/"' + \.' --regex-tex="/\\\\chapter[ \t]*\*?\{[ \t]*([^}]*)\}/\1/s,chapter/"' + \.' --regex-tex="/\\\\section[ \t]*\*?\{[ \t]*([^}]*)\}/\1/s,section/"' + \.' --regex-tex="/\\\\subsection[ \t]*\*?\{[ \t]*([^}]*)\}/+ \1/s,subsection/"' + \.' --regex-tex="/\\\\subsubsection[ \t]*\*?\{[ \t]*([^}]*)\}/+ \1/s,subsubsection/"' + \.' --regex-tex="/\\\\paragraph[ \t]*\*?\{[ \t]*([^}]*)\}/+ \1/s,paragraph/"' + \.' --regex-tex="/\\\\subparagraph[ \t]*\*?\{[ \t]*([^}]*)\}/+ \1/s,subparagraph/"' + \.' --regex-tex="/\\\\begin{thebibliography}/BIBLIOGRAPHY/s,thebibliography/"' + \.' --regex-tex="/\\\\tableofcontents/TABLE OF CONTENTS/s,tableofcontents/"' + \.' --regex-tex="/\\\\frontmatter/FRONTMATTER/s,frontmatter/"' + \.' --regex-tex="/\\\\mainmatter/MAINMATTER/s,mainmatter/"' + \.' --regex-tex="/\\\\backmatter/BACKMATTER/s,backmatter/"' + \.' --regex-tex="/\\\\appendix/APPENDIX/s,appendix/"' + \.' --regex-tex="/\\\\label[ \t]*\*?\{[ \t]*([^}]*)\}/\1/l,label/"' + \.' --regex-tex="/\\\\ref[ \t]*\*?\{[ \t]*([^}]*)\}/\1/r,ref/"' + endif +endif + +" }}} + +" commands to completion +let g:Tex_completion_explorer = ',' + +" Mappings defined in package files will overwrite all other +exe 'source '.s:path.'/packages.vim' + +" ============================================================================== +" These functions are used to immitate certain operating system type functions +" (like reading the contents of a file), which are not available in vim. For +" example, in Vim, its not possible to read the contents of a file without +" opening a buffer on it, which means that over time, lots of buffers can open +" up needlessly. +" +" If python is available (and allowed), then these functions utilize python +" library functions without making calls to external programs. +" ============================================================================== +" Tex_GotoTempFile: open a temp file. reuse from next time on {{{ +function! Tex_GotoTempFile() + if !exists('s:tempFileName') + let s:tempFileName = tempname() + endif + exec 'silent! split '.s:tempFileName +endfunction " }}} +" Tex_IsPresentInFile: finds if a string str, is present in filename {{{ +if has('python') && g:Tex_UsePython + function! Tex_IsPresentInFile(regexp, filename) + exec 'python isPresentInFile(r"'.a:regexp.'", r"'.a:filename.'")' + + return retval + endfunction +else + function! Tex_IsPresentInFile(regexp, filename) + call Tex_GotoTempFile() + + silent! 1,$ d _ + let _report = &report + let _sc = &sc + set report=9999999 nosc + exec 'silent! 0r! '.g:Tex_CatCmd.' '.a:filename + set nomod + let &report = _report + let &sc = _sc + + if search(a:regexp, 'w') + let retval = 1 + else + let retval = 0 + endif + silent! bd + return retval + endfunction +endif " }}} +" Tex_CatFile: returns the contents of a file in a <NL> seperated string {{{ +if has('*readfile') + function! Tex_CatFile(filename) + return join(readfile(filename), "\n") + endfunction +elseif has('python') && g:Tex_UsePython + function! Tex_CatFile(filename) + " catFile assigns a value to retval + exec 'python catFile("'.a:filename.'")' + + return retval + endfunction +else + function! Tex_CatFile(filename) + if glob(a:filename) == '' + return '' + endif + + call Tex_GotoTempFile() + + silent! 1,$ d _ + + let _report = &report + let _sc = &sc + set report=9999999 nosc + exec 'silent! 0r! '.g:Tex_CatCmd.' '.a:filename + + set nomod + let _a = @a + silent! normal! ggVG"ay + let retval = @a + let @a = _a + + silent! bd + let &report = _report + let &sc = _sc + return retval + endfunction +endif +" }}} +" Tex_DeleteFile: removes a file if present {{{ +" Description: +if has('python') && g:Tex_UsePython + function! Tex_DeleteFile(filename) + exec 'python deleteFile(r"'.a:filename.'")' + + if exists('retval') + return retval + endif + endfunction +else + function! Tex_DeleteFile(filename) + if filereadable(a:filename) + exec '! '.g:Tex_RmCmd.' '.a:filename + endif + endfunction +endif +" }}} + + +let &cpo = s:save_cpo + +" Define the functions in python if available. +if !has('python') || !g:Tex_UsePython + finish +endif + +exec 'pyfile '.expand('<sfile>:p:h').'/pytools.py' + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap diff --git a/vimfiles.latex/ftplugin/latex-suite/mathmacros-utf.vim b/vimfiles.latex/ftplugin/latex-suite/mathmacros-utf.vim new file mode 100644 index 0000000..ac9cf7e --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/mathmacros-utf.vim @@ -0,0 +1,729 @@ +"============================================================================= +" File: mathmacros.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 06:00 PM 2002 PST +" +" Description: macros for everything mathematical in latex. +"============================================================================= + +if !(has('gui_running') && g:Tex_MathMenus && g:Tex_Menus) + finish +endif + +let s:MathMenuName = g:Tex_MenuPrefix.'Ma&th.' + +function! Tex_MathMenuRemove() + exe 'silent! aunmenu '.s:MathMenuName +endfunction + +let s:pA = 'amenu <silent> 85 '.s:MathMenuName + +" brackets and dollars {{{ +exe s:pA.'\\&[\ \\] <plug><C-r>=IMAP_PutTextWithMovement("\\[<++>\\]<++>")<cr>' +exe s:pA.'\\&(\ \\) <plug><C-r>=IMAP_PutTextWithMovement("\\(<++>\\)<++>")<cr>' +exe s:pA.'&$\ $ <plug>$$' +exe s:pA.'-sepmath1- :' +" }}} +" MATH arrows {{{ +let s:pA1 = s:pA."&Arrows." +exe s:pA1.'Leftarrow<Tab>⇐ <plug>\Leftarrow ' +exe s:pA1.'leftarrow<Tab>← <plug>\leftarrow' +exe s:pA1.'longleftarrow<Tab>← <plug>\longleftarrow ' +exe s:pA1.'Longleftarrow<Tab>⇐ <plug>\Longleftarrow ' +exe s:pA1.'rightarrow<Tab>→ <plug>\rightarrow ' +exe s:pA1.'longrightarrow<Tab>→ <plug>\longrightarrow ' +exe s:pA1.'Rightarrow<Tab>⇒ <plug>\Rightarrow ' +exe s:pA1.'Longrightarrow<Tab>⇒ <plug>\Longrightarrow ' +exe s:pA1.'leftrightarrow<Tab>⇆ <plug>\leftrightarrow ' +exe s:pA1.'longleftrightarrow<Tab>↔ <plug>\longleftrightarrow ' +exe s:pA1.'Leftrightarrow<Tab>⇔ <plug>\Leftrightarrow ' +exe s:pA1.'Longleftrightarrow<Tab>⇔ <plug>\Longleftrightarrow ' +exe s:pA1.'uparrow<Tab>↑ <plug>\uparrow ' +exe s:pA1.'Uparrow<Tab>⇑ <plug>\Uparrow ' +exe s:pA1.'downarrow<Tab>↓ <plug>\downarrow ' +exe s:pA1.'Downarrow<Tab>⇓ <plug>\Downarrow ' +exe s:pA1.'updownarrow<Tab>↕ <plug>\updownarrow ' +exe s:pA1.'Updownarrow<Tab>⇕ <plug>\Updownarrow ' +exe s:pA1.'nearrow<Tab>↗ <plug>\nearrow ' +exe s:pA1.'searrow<Tab>↘ <plug>\searrow ' +exe s:pA1.'swarrow<Tab>↙ <plug>\swarrow ' +exe s:pA1.'nwarrow<Tab>↖ <plug>\nwarrow ' +exe s:pA1.'mapsto<Tab>↦ <plug>\mapsto ' +exe s:pA1.'leadsto<Tab>↝ <plug>\leadsto ' +exe s:pA1.'longmapsto<Tab>⇖ <plug>\longmapsto ' +exe s:pA1.'hookleftarrow<Tab>↩ <plug>\hookleftarrow ' +exe s:pA1.'hookrightarrow<Tab>↪ <plug>\hookrightarrow ' +exe s:pA1.'leftharpoonup<Tab>↼ <plug>\leftharpoonup ' +exe s:pA1.'leftharpoondown<Tab>↽ <plug>\leftharpoondown ' +exe s:pA1.'rightharpoonup<Tab>⇀ <plug>\rightharpoonup ' +exe s:pA1.'rightharpoondown<Tab>⇁ <plug>\rightharpoondown ' +exe s:pA1.'rightleftharpoons<Tab>⇌ <plug>\rightleftharpoons ' +exe s:pA1.'overleftarrow<Tab> <plug>\overleftarrow ' +exe s:pA1.'overrightarrow<Tab> <plug>\overrightarrow ' +exe s:pA1.'overleftrightarrow<Tab> <plug>\overleftrightarrow ' +exe s:pA1.'underleftarrow<Tab> <plug>\underleftarrow ' +exe s:pA1.'underrightarrow<Tab> <plug>\underrightarrow ' +exe s:pA1.'underleftrightarrow<Tab> <plug>\underleftrightarrow ' +exe s:pA1.'xleftarrow<Tab> <plug>\xleftarrow ' +exe s:pA1.'xrightarrow<Tab> <plug>\xrightarrow ' +" }}} +" MATH Arrows2 {{{ +let s:pA1a = s:pA."Arrows2." +exe s:pA1a.'dashleftarrow<Tab>⇠ <plug>\dashleftarrow ' +exe s:pA1a.'leftleftarrows<Tab>⇇ <plug>\leftleftarrows ' +exe s:pA1a.'leftrightarrows<Tab>⇆ <plug>\leftrightarrows ' +exe s:pA1a.'Lleftarrow<Tab>⇚ <plug>\Lleftarrow ' +exe s:pA1a.'twoheadleftarrow<Tab>↞ <plug>\twoheadleftarrow ' +exe s:pA1a.'leftarrowtail<Tab>↢ <plug>\leftarrowtail ' +exe s:pA1a.'leftrightharpoons<Tab>⇋ <plug>\leftrightharpoons ' +exe s:pA1a.'Lsh<Tab>↰ <plug>\Lsh ' +exe s:pA1a.'looparrowleft<Tab>↫ <plug>\looparrowleft ' +exe s:pA1a.'curvearrowleft<Tab>↶ <plug>\curvearrowleft ' +exe s:pA1a.'circlearrowleft<Tab>↺ <plug>\circlearrowleft ' +exe s:pA1a.'dashrightarrow<Tab>⇢ <plug>\dashrightarrow ' +exe s:pA1a.'rightrightarrows<Tab>⇉ <plug>\rightrightarrows ' +exe s:pA1a.'rightleftarrows<Tab>⇄ <plug>\rightleftarrows ' +exe s:pA1a.'Rrightarrow<Tab>⇛ <plug>\Rrightarrow ' +exe s:pA1a.'twoheadrightarrow<Tab>↠ <plug>\twoheadrightarrow ' +exe s:pA1a.'rightarrowtail<Tab>↣ <plug>\rightarrowtail ' +exe s:pA1a.'rightleftharpoons<Tab>⇌ <plug>\rightleftharpoons ' +exe s:pA1a.'Rsh<Tab>↱ <plug>\Rsh ' +exe s:pA1a.'looparrowright<Tab>↬ <plug>\looparrowright ' +exe s:pA1a.'curvearrowright<Tab>↷ <plug>\curvearrowright ' +exe s:pA1a.'circlearrowright<Tab>↻ <plug>\circlearrowright ' +exe s:pA1a.'multimap<Tab>⊸ <plug>\multimap ' +exe s:pA1a.'upuparrows<Tab>⇈ <plug>\upuparrows ' +exe s:pA1a.'downdownarrows<Tab>⇊ <plug>\downdownarrows ' +exe s:pA1a.'upharpoonleft<Tab>↿ <plug>\upharpoonleft ' +exe s:pA1a.'upharpoonright<Tab>↾ <plug>\upharpoonright ' +exe s:pA1a.'downharpoonleft<Tab>⇃ <plug>\downharpoonleft ' +exe s:pA1a.'downharpoonright<Tab>⇂ <plug>\downharpoonright ' +exe s:pA1a.'rightsquigarrow<Tab>⇝ <plug>\rightsquigarrow ' +exe s:pA1a.'leftrightsquigarrow<Tab>↭ <plug>\leftrightsquigarrow ' +" }}} +" MATH nArrows {{{ +let s:pA1b = s:pA."&nArrows." +exe s:pA1b.'nleftarrow<Tab>↚ <plug>\nleftarrow ' +exe s:pA1b.'nLeftarrow<Tab>⇍ <plug>\nLeftarrow ' +exe s:pA1b.'nleftrightarrow<Tab>↮ <plug>\nleftrightarrow ' +exe s:pA1b.'nLeftrightarrow<Tab>⇎ <plug>\nleftrightarrow ' +exe s:pA1b.'nrightarrow<Tab>↛ <plug>\nrightarrow ' +exe s:pA1b.'nRightarrow<Tab>⇏ <plug>\nRightarrow ' +" }}} +" MATH Fonts {{{ +let s:pA2a = s:pA."&MathFonts." +exe s:pA2a.'mathbf{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathbf{<++>}<++>")<cr>' +exe s:pA2a.'mathrm{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathrm{<++>}<++>")<cr>' +exe s:pA2a.'mathsf{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathsf{<++>}<++>")<cr>' +exe s:pA2a.'mathtt{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathtt{<++>}<++>")<cr>' +exe s:pA2a.'mathit{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathit{<++>}<++>")<cr>' +exe s:pA2a.'mathfrak{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathfrak{<++>}<++>")<cr>' +exe s:pA2a.'mathcal{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathcal{<++>}<++>")<cr>' +exe s:pA2a.'mathscr{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathscr{<++>}<++>")<cr>' +exe s:pA2a.'mathbb{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathbb{<++>}<++>")<cr>' +" }}} +" Greek Letters small {{{ +let s:pA2 = s:pA."&Greek.&Small." +exe s:pA2.'alpha<Tab>`a\ \ α <plug>\alpha ' +exe s:pA2.'beta<Tab>`b\ \ β <plug>\beta ' +exe s:pA2.'gamma<Tab>`g\ \ γ <plug>\gamma ' +exe s:pA2.'delta<Tab>`d\ \ δ <plug>\delta ' +exe s:pA2.'epsilon<Tab>∊ <plug>\epsilon ' +exe s:pA2.'varepsilon<Tab>`e\ \ ε <plug>\varepsilon ' +exe s:pA2.'zeta<Tab>`z\ \ ζ <plug>\zeta ' +exe s:pA2.'eta<Tab>`h\ \ η <plug>\eta ' +exe s:pA2.'theta<Tab>`q\ \ θ <plug>\theta ' +exe s:pA2.'vartheta<Tab>ϑ <plug>\vartheta ' +exe s:pA2.'iota<Tab>`i\ \ ι <plug>\iota ' +exe s:pA2.'kappa<Tab>`k\ \ κ <plug>\kappa ' +exe s:pA2.'lambda<Tab>`l\ \ λ <plug>\lambda ' +exe s:pA2.'mu<Tab>`m\ \ μ <plug>\mu ' +exe s:pA2.'nu<Tab>`n\ \ ν <plug>\nu ' +exe s:pA2.'xi<Tab>`x\ \ ξ <plug>\xi ' +exe s:pA2.'pi<Tab>`p\ \ π <plug>\pi ' +exe s:pA2.'varpi<Tab>ϖ <plug>\varpi ' +exe s:pA2.'rho<Tab>`r\ \ ρ <plug>\rho ' +exe s:pA2.'varrho<Tab>ϱ <plug>\varrho ' +exe s:pA2.'sigma<Tab>`s\ \ σ <plug>\sigma ' +exe s:pA2.'varsigma<Tab>`v\ \ ς <plug>\varsigma ' +exe s:pA2.'tau<Tab>`t\ \ τ <plug>\tau ' +exe s:pA2.'upsilon<Tab>`u\ \ υ <plug>\upsilon ' +exe s:pA2.'phi<Tab>φ <plug>\phi ' +exe s:pA2.'varphi<Tab>`f\ \ ϕ <plug>\varphi ' +exe s:pA2.'chi<Tab>`c\ \ χ <plug>\chi ' +exe s:pA2.'psi<Tab>`y\ \ ψ <plug>\psi ' +exe s:pA2.'omega<Tab>`w\ \ ω <plug>\omega ' +" }}} +" Greek Letters big {{{ +let s:pA3 = s:pA.'&Greek.&Big.' +exe s:pA3.'Alpha<Tab>`A\ \ A <plug>\Alpha ' +exe s:pA3.'Beta<Tab>`B\ \ B <plug>\Beta ' +exe s:pA3.'Gamma<Tab>`G\ \ Γ <plug>\Gamma ' +exe s:pA3.'Delta<Tab>`D\ \ Δ <plug>\Delta ' +exe s:pA3.'Epsilon<Tab>`E\ \ E <plug>\Epsilon ' +exe s:pA3.'Zeta<Tab>`Z\ \ Z <plug>\mathrm{Z} ' +exe s:pA3.'Eta<Tab>`H\ \ H <plug>\Eta ' +exe s:pA3.'Theta<Tab>Θ <plug>\Theta ' +exe s:pA3.'Iota<Tab>I <plug>\mathrm{I} ' +exe s:pA3.'Kappa<Tab>`K\ \ K <plug>\Kappa ' +exe s:pA3.'Lambda<Tab>`L\ \ Λ <plug>\Lambda ' +exe s:pA3.'Mu<Tab>`M\ \ M <plug>\Mu ' +exe s:pA3.'Nu<Tab>`N\ \ N <plug>\Nu ' +exe s:pA3.'Xi<Tab>`X\ \ Ξ <plug>\Xi ' +exe s:pA3.'Pi<Tab>`P\ \ Π <plug>\Pi ' +exe s:pA3.'Rho<Tab>`R\ \ P <plug>\Rho ' +exe s:pA3.'Sigma<Tab>`S\ \ Σ <plug>\Sigma ' +exe s:pA3.'Tau<Tab>`T\ \ T <plug>\Tau ' +exe s:pA3.'Upsilon<Tab>`U\ \ Y <plug>\Upsilon ' +exe s:pA3.'Phi<Tab>Φ <plug>\Phi ' +exe s:pA3.'Chi<Tab>`C\ \ X <plug>\Chi ' +exe s:pA3.'Psi<Tab>`Y\ \ Ψ <plug>\Psi ' +exe s:pA3.'Omega<Tab>`W\ \ Ω <plug>\Omega ' +" }}} +" BinaryRel1 {{{ +let s:pA4 = s:pA."&BinaryRel1." +exe s:pA4.'ll<Tab>≪ <plug>\ll ' +exe s:pA4.'lll<Tab>⋘ <plug>\lll ' +exe s:pA4.'leqslant<Tab>≤ <plug>\leqslant ' +exe s:pA4.'leq<Tab>≤ <plug>\leq ' +exe s:pA4.'leqq<Tab>≦ <plug>\leqq ' +exe s:pA4.'eqslantless<Tab>⋜ <plug>\eqslantless ' +exe s:pA4.'lessdot<Tab>⋖ <plug>\lessdot ' +exe s:pA4.'prec<Tab>≺ <plug>\prec ' +exe s:pA4.'preceq<Tab>≼ <plug>\preceq ' +exe s:pA4.'preccurlyeq<Tab>≼ <plug>\preccurlyeq ' +exe s:pA4.'curlyeqprec<Tab>⋞ <plug>\curlyeqprec ' +exe s:pA4.'lesssim<Tab>≲ <plug>\lesssim ' +exe s:pA4.'lessapprox<Tab> <plug>\lessapprox ' +exe s:pA4.'precsim<Tab>≾ <plug>\precsim ' +exe s:pA4.'precapprox<Tab> <plug>\precapprox ' +exe s:pA4.'in<Tab>∈ <plug>\in ' +exe s:pA4.'subset<Tab>`(\ \ ⊂ <plug>\subset ' +exe s:pA4.'Subset<Tab>`)\ \ ⋐ <plug>\Subset ' +exe s:pA4.'subseteq<Tab>⊆ <plug>\subseteq ' +exe s:pA4.'subseteqq<Tab> <plug>\subseteqq ' +exe s:pA4.'sqsubset<Tab>⊏ <plug>\sqsubset ' +exe s:pA4.'sqsubseteq<Tab>⊑ <plug>\sqsubseteq ' +exe s:pA4.'smile<Tab>⌣ <plug>\smile ' +exe s:pA4.'smallsmile<Tab>⌣ <plug>\smallsmile ' +exe s:pA4.'parallel<Tab>∥ <plug>\parallel ' +exe s:pA4.'shortparallel<Tab>∥ <plug>\shortparallel ' +exe s:pA4.'dashv<Tab>⊣ <plug>\dashv ' +exe s:pA4.'vdash<Tab>⊢ <plug>\vdash ' +exe s:pA4.'vDash<Tab>⊨ <plug>\vDash ' +exe s:pA4.'models<Tab>⊨ <plug>\models ' +exe s:pA4.'therefore<Tab>∴ <plug>\therefore ' +exe s:pA4.'backepsilon<Tab>∍ <plug>\backepsilon ' +" }}} +" nBinaryRel1 {{{ +let s:pA4a = s:pA."&nBinaryRel1." +exe s:pA4a.'nless<Tab>≮ <plug>\nless ' +exe s:pA4a.'nleqslant<Tab>≰ <plug>\nleqslant ' +exe s:pA4a.'nleq<Tab> <plug>\nleq ' +exe s:pA4a.'lneq<Tab> <plug>\lneq ' +exe s:pA4a.'nleqq<Tab> <plug>\nleqq ' +exe s:pA4a.'lneqq<Tab>≨ <plug>\lneqq ' +exe s:pA4a.'lvertneqq<Tab> <plug>\lvertneqq ' +exe s:pA4a.'nprec<Tab>⊀ <plug>\nprec ' +exe s:pA4a.'npreceq<Tab>⋠ <plug>\npreceq ' +exe s:pA4a.'precneqq<Tab> <plug>\precneqq ' +exe s:pA4a.'lnsim<Tab>⋦ <plug>\lnsim ' +exe s:pA4a.'lnapprox<Tab> <plug>\lnapprox ' +exe s:pA4a.'precnsim<Tab>⋨ <plug>\precnsim ' +exe s:pA4a.'precnapprox<Tab> <plug>\precnapprox ' +exe s:pA4a.'notin<Tab>∉ <plug>\notin ' +exe s:pA4a.'nsubseteq<Tab>⊈ <plug>\nsubseteq ' +exe s:pA4a.'varsubsetneq<Tab> <plug>\varsubsetneq ' +exe s:pA4a.'subsetneq<Tab>⊊ <plug>\subsetneq ' +exe s:pA4a.'nsubseteqq<Tab> <plug>\nsubseteqq ' +exe s:pA4a.'varsubsetneqq<Tab> <plug>\varsubsetneqq ' +exe s:pA4a.'subsetneqq<Tab>⊈ <plug>\subsetneqq ' +exe s:pA4a.'nparallel<Tab>∦ <plug>\nparallel ' +exe s:pA4a.'nshortparallel<Tab> <plug>\nshortparallel ' +exe s:pA4a.'nvdash<Tab>⊬ <plug>\nvdash ' +exe s:pA4a.'nvDash<Tab>⊭ <plug>\nvDash ' +" }}} +" BinaryRel2 {{{ +let s:pA5 = s:pA."&BinaryRel2." +exe s:pA5.'gg<Tab>≫ <plug>\gg ' +exe s:pA5.'ggg<Tab>⋙ <plug>\ggg ' +exe s:pA5.'gggtr<Tab>⋙ <plug>\gggtr ' +exe s:pA5.'geqslant<Tab> <plug>\geqslant ' +exe s:pA5.'geq<Tab>≥ <plug>\geq ' +exe s:pA5.'geqq<Tab>≧ <plug>\geqq ' +exe s:pA5.'eqslantgtr<Tab> <plug>\eqslantgtr ' +exe s:pA5.'gtrdot<Tab>⋗ <plug>\gtrdot ' +exe s:pA5.'succ<Tab>≻ <plug>\succ ' +exe s:pA5.'succeq<Tab>≽ <plug>\succeq ' +exe s:pA5.'succcurlyeq<Tab>≽ <plug>\succcurlyeq ' +exe s:pA5.'curlyeqsucc<Tab>⋟ <plug>\curlyeqsucc ' +exe s:pA5.'gtrsim<Tab>≳ <plug>\gtrsim ' +exe s:pA5.'gtrapprox<Tab> <plug>\gtrapprox ' +exe s:pA5.'succsim<Tab>≿ <plug>\succsim ' +exe s:pA5.'succapprox<Tab> <plug>\succapprox ' +exe s:pA5.'ni<Tab>∋ <plug>\ni ' +exe s:pA5.'owns<Tab> <plug>\owns ' +exe s:pA5.'supset<Tab>⊃ <plug>\supset ' +exe s:pA5.'Supset<Tab>⋑ <plug>\Supset ' +exe s:pA5.'supseteq<Tab>⊇ <plug>\supseteq ' +exe s:pA5.'supseteqq<Tab> <plug>\supseteqq ' +exe s:pA5.'sqsupset<Tab>⊐ <plug>\sqsupset ' +exe s:pA5.'sqsupseteq<Tab>⊒ <plug>\sqsupseteq ' +exe s:pA5.'frown<Tab>⌢ <plug>\frown ' +exe s:pA5.'smallfrown<Tab>⌢ <plug>\smallfrown ' +exe s:pA5.'mid<Tab>∣ <plug>\mid ' +exe s:pA5.'shortmid<Tab> <plug>\shortmid ' +exe s:pA5.'between<Tab>≬ <plug>\between ' +exe s:pA5.'Vdash<Tab>⊩ <plug>\Vdash ' +exe s:pA5.'bowtie<Tab>⋈ <plug>\bowtie ' +exe s:pA5.'Join<Tab>⋈ <plug>\Join ' +exe s:pA5.'pitchfork<Tab>⋔ <plug>\pitchfork ' +" }}} +" {{{ nBinaryRel2 +let s:pA5a = s:pA."n&BinaryRel2." "TODO: dorobiæ logarytmy +exe s:pA5a.'ngtr<Tab>≯ <plug>\ngtr ' +exe s:pA5a.'ngeqslant<Tab>≱ <plug>\ngeqslant ' +exe s:pA5a.'ngeq<Tab> <plug>\ngeq ' +exe s:pA5a.'gneq<Tab> <plug>\gneq ' +exe s:pA5a.'ngeqq<Tab> <plug>\ngeqq ' +exe s:pA5a.'gneqq<Tab>≩ <plug>\gneqq ' +exe s:pA5a.'nsucc<Tab>⊁ <plug>\nsucc ' +exe s:pA5a.'nsucceq<Tab>⋡ <plug>\nsucceq ' +exe s:pA5a.'succneqq<Tab> <plug>\succneqq ' +exe s:pA5a.'gnsim<Tab>⋧ <plug>\gnsim ' +exe s:pA5a.'gnapprox<Tab> <plug>\gnapprox ' +exe s:pA5a.'succnsim<Tab>⋩ <plug>\succnsim ' +exe s:pA5a.'succnapprox<Tab> <plug>\succnapprox ' +exe s:pA5a.'nsupseteq<Tab>⊉ <plug>\nsupseteq ' +exe s:pA5a.'varsupsetneq<Tab> <plug>\varsupsetneq ' +exe s:pA5a.'supsetneq<Tab>⊋ <plug>\supsetneq ' +exe s:pA5a.'nsupseteqq<Tab> <plug>\nsupseteqq ' +exe s:pA5a.'varsupsetneqq<Tab> <plug>\varsupsetneqq ' +exe s:pA5a.'supsetneqq<Tab> <plug>\supsetneqq ' +exe s:pA5a.'nmid<Tab>∤ <plug>\nmid ' +exe s:pA5a.'nshortmid<Tab> <plug>\nshortmid ' +exe s:pA5a.'nVdash<Tab>⊮ <plug>\nVdash ' +" }}} +" {{{ BinaryRel3 +let s:pA6 = s:pA."&BinaryRel3." +exe s:pA6.'doteq<Tab>≐ <plug>\doteq ' +exe s:pA6.'circeq<Tab>≗ <plug>\circeq ' +exe s:pA6.'eqcirc<Tab>≖ <plug>\eqcirc ' +exe s:pA6.'risingdotseq<Tab>≓ <plug>\risingdotseq ' +exe s:pA6.'doteqdot<Tab>≑ <plug>\doteqdot ' +exe s:pA6.'Doteq<Tab>≑ <plug>\Doteq ' +exe s:pA6.'fallingdotseq<Tab>≒ <plug>\fallingdotseq ' +exe s:pA6.'triangleq<Tab>≜ <plug>\triangleq ' +exe s:pA6.'bumpeq<Tab>≏ <plug>\bumpeq ' +exe s:pA6.'Bumpeq<Tab>≎ <plug>\Bumpeq ' +exe s:pA6.'equiv<Tab>`=\ \ ≡ <plug>\equiv ' +exe s:pA6.'sim<Tab>∼ <plug>\sim ' +exe s:pA6.'thicksim<Tab>∼ <plug>\thicksim ' +exe s:pA6.'backsim<Tab>∽ <plug>\backsim ' +exe s:pA6.'simeq<Tab>≃ <plug>\simeq ' +exe s:pA6.'backsimeq<Tab>⋍ <plug>\backsimeq ' +exe s:pA6.'cong<Tab>≅ <plug>\cong ' +exe s:pA6.'approx<tab>=~\ \ ≈ <plug>\approx ' +exe s:pA6.'thickapprox<Tab>≈ <plug>\thickapprox ' +exe s:pA6.'approxeq<Tab>≊ <plug>\approxeq ' +exe s:pA6.'blacktriangleleft<Tab>◀ <plug>\blacktriangleleft ' +exe s:pA6.'vartriangleleft<Tab>⊲ <plug>\vartriangleleft ' +exe s:pA6.'trianglelefteq<Tab>⊴ <plug>\trianglelefteq ' +exe s:pA6.'blacktriangleright<Tab>▶ <plug>\blacktriangleright ' +exe s:pA6.'vartriangleright<Tab>⊳ <plug>\vartriangleright ' +exe s:pA6.'trianglerighteq<Tab>⊵ <plug>\trianglerighteq ' +exe s:pA6.'perp<Tab>⊥ <plug>\perp ' +exe s:pA6.'asymp<Tab>≍ <plug>\asymp ' +exe s:pA6.'Vvdash<Tab>⊪ <plug>\Vvdash ' +exe s:pA6.'propto<Tab>∝ <plug>\propto ' +exe s:pA6.'varpropto<Tab>∝ <plug>\varpropto ' +exe s:pA6.'because<Tab>∵ <plug>\because ' +" }}} +" {{{ nBinaryRel3 +let s:pA6a = s:pA."&nBinaryRel3." +exe s:pA6a.'neq<Tab>≠ <plug>\neq ' +exe s:pA6a.'nsim<Tab>≁ <plug>\nsim ' +exe s:pA6a.'ncong<Tab>≆ <plug>\ncong ' +exe s:pA6a.'ntriangleleft<Tab>⋪ <plug>\ntriangleleft ' +exe s:pA6a.'ntrianglelefteq<Tab>⋬ <plug>\ntrianglelefteq ' +exe s:pA6a.'ntriangleright<Tab>⋫ <plug>\ntriangleright ' +exe s:pA6a.'ntrianglerighteq<Tab>⋭ <plug>\ntrianglerighteq ' +" }}} +" {{{ BinaryRel4 +let s:pA7 = s:pA."&BinaryRel4." +exe s:pA7.'lessgtr<Tab>≶ <plug>\lessgtr ' +exe s:pA7.'gtrless<Tab>≷ <plug>\gtrless ' +exe s:pA7.'lesseqgtr<Tab>⋚ <plug>\lesseqgtr ' +exe s:pA7.'gtreqless<Tab>⋛ <plug>\gtreqless ' +exe s:pA7.'lesseqqgtr<Tab> <plug>\lesseqqgtr ' +exe s:pA7.'gtreqqless<Tab> <plug>\gtreqqless ' +" }}} +" {{{ BigOp +let s:pA8a = s:pA."&BigOp." +exe s:pA8a.'limits<Tab> <plug>\limits' +exe s:pA8a.'nolimits<Tab> <plug>\nolimits' +exe s:pA8a.'displaylimits<Tab> <plug>\displaylimits' +exe s:pA8a.'-seplimits- :' +exe s:pA8a.'bigcap<Tab>`-\ \ ⋂ <plug>\bigcap' +exe s:pA8a.'bigcup<Tab>`+\ \ ⋃ <plug>\bigcup' +exe s:pA8a.'bigodot<Tab>⊙ <plug>\bigodot' +exe s:pA8a.'bigoplus<Tab>⊕ <plug>\bigoplus' +exe s:pA8a.'bigotimes<Tab>⊗ <plug>\bigotimes' +exe s:pA8a.'bigsqcup<Tab>⊔ <plug>\bigsqcup' +exe s:pA8a.'biguplus<Tab>⊎ <plug>\biguplus' +exe s:pA8a.'bigvee<Tab>⋁ <plug>\bigvee' +exe s:pA8a.'bigwedge<Tab>⋀ <plug>\bigwedge' +exe s:pA8a.'coprod<Tab>∐ <plug>\coprod' +exe s:pA8a.'int<Tab>∫ <plug>\int' +exe s:pA8a.'iint<Tab>∬ <plug>\int' +exe s:pA8a.'iiint<Tab>∭ <plug>\int' +exe s:pA8a.'oint<Tab>∮ <plug>\oint' +exe s:pA8a.'prod<Tab>∏ <plug>\prod' +exe s:pA8a.'sum<Tab>∑ <plug>\sum' +" }}} +" {{{ BinaryOp +let s:pA8 = s:pA."&BinaryOp." +exe s:pA8.'pm<Tab>± <plug>\pm ' +exe s:pA8.'mp<Tab>∓ <plug>\mp ' +exe s:pA8.'dotplus<Tab>∔ <plug>\dotplus ' +exe s:pA8.'cdot<Tab>`.\ \ ⋅ <plug>\cdot ' +exe s:pA8.'centerdot<Tab>⋅ <plug>\centerdot ' +exe s:pA8.'times<Tab>`*\ \ × <plug>\times ' +exe s:pA8.'ltimes<Tab>⋉ <plug>\ltimes ' +exe s:pA8.'rtimes<Tab>⋊ <plug>\rtimes ' +exe s:pA8.'leftthreetimes<Tab>⋋ <plug>\leftthreetimes ' +exe s:pA8.'rightthreetimes<Tab>⋌ <plug>\rightthreetimes ' +exe s:pA8.'div<Tab>÷ <plug>\div ' +exe s:pA8.'divideontimes<Tab>⋇ <plug>\divideontimes ' +exe s:pA8.'bmod<Tab> <plug>\bmod ' +exe s:pA8.'ast<Tab>∗ <plug>\ast ' +exe s:pA8.'star<Tab>⋆ <plug>\star ' +exe s:pA8.'setminus<Tab>`\\\ \ ∖ <plug>\setminus ' +exe s:pA8.'smallsetminus<Tab>∖ <plug>\smallsetminus ' +exe s:pA8.'diamond<Tab>⋄ <plug>\diamond ' +exe s:pA8.'wr<Tab>≀ <plug>\wr ' +exe s:pA8.'intercal<Tab>⊺ <plug>\intercal ' +exe s:pA8.'circ<Tab>`@\ \ ∘ <plug>\circ ' +exe s:pA8.'bigcirc<Tab>○ <plug>\bigcirc ' +exe s:pA8.'bullet<Tab>∙ <plug>\bullet ' +exe s:pA8.'cap<Tab>∩ <plug>\cap ' +exe s:pA8.'Cap<Tab>⋒ <plug>\Cap ' +exe s:pA8.'cup<Tab>∪ <plug>\cup ' +exe s:pA8.'Cup<Tab>⋓ <plug>\Cup ' +exe s:pA8.'sqcap<Tab>⊓ <plug>\sqcap ' +exe s:pA8.'sqcup<Tab>⊔ <plug>\sqcup' +exe s:pA8.'amalg<Tab> <plug>\amalg ' +exe s:pA8.'uplus<Tab>⊎ <plug>\uplus ' +exe s:pA8.'triangleleft<Tab>◁ <plug>\triangleleft ' +exe s:pA8.'triangleright<Tab>▷ <plug>\triangleright ' +exe s:pA8.'bigtriangleup<Tab>△ <plug>\bigtriangleup ' +exe s:pA8.'bigtriangledown<Tab>▽ <plug>\bigtriangledown ' +exe s:pA8.'vee<Tab>∨ <plug>\vee ' +exe s:pA8.'veebar<Tab>⊻ <plug>\veebar ' +exe s:pA8.'curlyvee<Tab>⋎ <plug>\curlyvee ' +exe s:pA8.'wedge<Tab>`&\ \ ∧ <plug>\wedge ' +exe s:pA8.'barwedge<Tab>⊼ <plug>\barwedge ' +exe s:pA8.'doublebarwedge<Tab>⌆ <plug>\doublebarwedge ' +exe s:pA8.'curlywedge<Tab>⋏ <plug>\curlywedge ' +exe s:pA8.'oplus<Tab>⊕ <plug>\oplus ' +exe s:pA8.'ominus<Tab>⊖ <plug>\ominus ' +exe s:pA8.'otimes<Tab>⊗ <plug>\otimes ' +exe s:pA8.'oslash<Tab>⊘ <plug>\oslash ' +exe s:pA8.'boxplus<Tab>⊞ <plug>\boxplus ' +exe s:pA8.'boxminus<Tab>⊟ <plug>\boxminus ' +exe s:pA8.'boxtimes<Tab>⊠ <plug>\boxtimes ' +exe s:pA8.'boxdot<Tab>⊡ <plug>\boxdot ' +exe s:pA8.'odot<Tab>⊙ <plug>\odot ' +exe s:pA8.'circledast<Tab>⊛ <plug>\circledast ' +exe s:pA8.'circleddash<Tab>⊝ <plug>\circleddash ' +exe s:pA8.'circledcirc<Tab>⊚ <plug>\circledcirc ' +exe s:pA8.'dagger<Tab>† <plug>\dagger ' +exe s:pA8.'ddagger<Tab>‡ <plug>\ddagger ' +exe s:pA8.'lhd<Tab>⊲ <plug>\lhd ' +exe s:pA8.'unlhd<Tab>⊴ <plug>\unlhd ' +exe s:pA8.'rhd<Tab>⊳ <plug>\rhd ' +exe s:pA8.'unrhd<Tab>⊵ <plug>\unrhd ' +" }}} +" {{{ Other1 +let s:pA9 = s:pA."&Other1." +exe s:pA9.'hat<Tab>â <plug>\hat ' +exe s:pA9.'check<Tab>ǎ <plug>\check ' +exe s:pA9.'grave<Tab>à <plug>\grave ' +exe s:pA9.'acute<Tab>á <plug>\acute ' +exe s:pA9.'dot<Tab>ȧ <plug>\dot ' +exe s:pA9.'ddot<Tab>ä <plug>\ddot ' +exe s:pA9.'tilde<Tab>`,\ \ ã <plug>\tilde ' +exe s:pA9.'breve<Tab>ă <plug>\breve ' +exe s:pA9.'bar<Tab>ā <plug>\bar ' +exe s:pA9.'vec<Tab>a⃗ <plug>\vec ' +exe s:pA9.'aleph<Tab>א <plug>\aleph ' +exe s:pA9.'hbar<Tab>ℏ <plug>\hbar ' +exe s:pA9.'imath<Tab> <plug>\imath ' +exe s:pA9.'jmath<Tab> <plug>\jmath ' +exe s:pA9.'ell<Tab>ℓ <plug>\ell ' +exe s:pA9.'wp<Tab>℘ <plug>\wp ' +exe s:pA9.'Re<Tab>ℜ <plug>\Re ' +exe s:pA9.'Im<Tab>ℑ <plug>\Im ' +exe s:pA9.'partial<Tab>∂ <plug>\partial ' +exe s:pA9.'infty<Tab>`8\ \ ∞ <plug>\infty ' +exe s:pA9.'prime<Tab>′ <plug>\prime ' +exe s:pA9.'emptyset<Tab>∅ <plug>\emptyset ' +exe s:pA9.'nabla<Tab>∇ <plug>\nabla ' +exe s:pA9.'surd<Tab>√ <plug>\surd ' +exe s:pA9.'top<Tab>⊤ <plug>\top ' +exe s:pA9.'bot<Tab>⊥ <plug>\bot ' +exe s:pA9.'angle<Tab>∠ <plug>\angle ' +exe s:pA9.'triangle<Tab>△ <plug>\triangle ' +exe s:pA9.'backslash<Tab>\\ <plug>\backslash ' +exe s:pA9.'forall<Tab>∀ <plug>\forall ' +exe s:pA9.'exists<Tab>∃ <plug>\exists ' +exe s:pA9.'neg<Tab>¬ <plug>\neg ' +exe s:pA9.'flat<Tab>♭ <plug>\flat ' +exe s:pA9.'natural<Tab>♮ <plug>\natural ' +exe s:pA9.'sharp<Tab>♯ <plug>\sharp ' +exe s:pA9.'clubsuit<Tab>♣ <plug>\clubsuit ' +exe s:pA9.'diamondsuit<Tab>♢ <plug>\diamondsuit ' +exe s:pA9.'heartsuit<Tab>♡ <plug>\heartsuit ' +exe s:pA9.'spadesuit<Tab>♠ <plug>\spadesuit ' +exe s:pA9.'S<Tab>§ <plug>\S ' +exe s:pA9.'P<Tab>¶ <plug>\P' +" }}} +" {{{ MathCreating +let s:pA10 = s:pA."&MathCreating." +exe s:pA10.'not<Tab> <plug>\not' +exe s:pA10.'mkern<Tab> <plug>\mkern' +exe s:pA10.'mathbin<Tab> <plug>\mathbin' +exe s:pA10.'mathrel<Tab> <plug>\mathrel' +exe s:pA10.'stackrel<Tab> <plug>\stackrel' +exe s:pA10.'mathord<Tab> <plug>\mathord' +" }}} +" {{{ Styles +let s:pA11 = s:pA."&Styles." +exe s:pA11.'displaystyle<Tab> <plug>\displaystyle' +exe s:pA11.'textstyle<Tab> <plug>\textstyle' +exe s:pA11.'scritpstyle<Tab> <plug>\scritpstyle' +exe s:pA11.'scriptscriptstyle<Tab> <plug>\scriptscriptstyle' +" }}} +" {{{ MathDiacritics +let s:pA12 = s:pA."&MathDiacritics." +exe s:pA12.'acute{}<Tab>á <plug><C-r>=IMAP_PutTextWithMovement("\\acute{<++>}<++>")<cr>' +exe s:pA12.'bar{}<Tab>`_\ \ ā <plug><C-r>=IMAP_PutTextWithMovement("\\bar{<++>}<++>")<cr>' +exe s:pA12.'breve{}<Tab>ă <plug><C-r>=IMAP_PutTextWithMovement("\\breve{<++>}<++>")<cr>' +exe s:pA12.'check{}<Tab>ǎ <plug><C-r>=IMAP_PutTextWithMovement("\\check{<++>}<++>")<cr>' +exe s:pA12.'ddot{}<Tab>`:\ \ ä <plug><C-r>=IMAP_PutTextWithMovement("\\ddot{<++>}<++>")<cr>' +exe s:pA12.'dot{}<Tab>`;\ \ ȧ <plug><C-r>=IMAP_PutTextWithMovement("\\dot{<++>}<++>")<cr>' +exe s:pA12.'grave{}<Tab>à <plug><C-r>=IMAP_PutTextWithMovement("\\grave{<++>}<++>")<cr>' +exe s:pA12.'hat{}<Tab>`^\ \ â <plug><C-r>=IMAP_PutTextWithMovement("\\hat{<++>}<++>")<cr>' +exe s:pA12.'tilde{}<tab>`~\ \ ã <plug><C-r>=IMAP_PutTextWithMovement("\\tilde{<++>}<++>")<cr>' +exe s:pA12.'vec{}<Tab>a⃗ <plug><C-r>=IMAP_PutTextWithMovement("\\vec{<++>}<++>")<cr>' +exe s:pA12.'widehat{}<Tab> <plug><C-r>=IMAP_PutTextWithMovement("\\widehat{<++>}<++>")<cr>' +exe s:pA12.'widetilde{}<Tab> <plug><C-r>=IMAP_PutTextWithMovement("\\widetilde{<++>}<++>")<cr>' +exe s:pA12.'imath<Tab> <plug><C-r>=IMAP_PutTextWithMovement("\\imath")<cr>' +exe s:pA12.'jmath<Tab> <plug><C-r>=IMAP_PutTextWithMovement("\\jmath")<cr>' +" }}} +" {{{ OverlineAndCo +let s:pA13 = s:pA."&OverlineAndCo." +exe s:pA13.'overline{} <plug><C-r>=IMAP_PutTextWithMovement("\\overline{}")<cr>' +exe s:pA13.'underline{} <plug><C-r>=IMAP_PutTextWithMovement("\\underline{}")<cr>' +exe s:pA13.'overrightarrow{} <plug><C-r>=IMAP_PutTextWithMovement("\\overrightarrow{}")<cr>' +exe s:pA13.'overleftarrow{} <plug><C-r>=IMAP_PutTextWithMovement("\\overleftarrow{}")<cr>' +exe s:pA13.'overbrace{} <plug><C-r>=IMAP_PutTextWithMovement("\\overbrace{}")<cr>' +exe s:pA13.'underbrace{} <plug><C-r>=IMAP_PutTextWithMovement("\\underbrace{}")<cr>' +" }}} +" {{{ Symbols1 +let s:pA14a = s:pA."&Symbols1." +exe s:pA14a.'forall<Tab>∀ <plug>\forall ' +exe s:pA14a.'exists<Tab>∃ <plug>\exists ' +exe s:pA14a.'nexists<Tab>∄ <plug>\nexists ' +exe s:pA14a.'neg<Tab>¬ <plug>\neg ' +exe s:pA14a.'top<Tab>⊤ <plug>\top ' +exe s:pA14a.'bot<Tab>⊥ <plug>\bot ' +exe s:pA14a.'emptyset<Tab>∅ <plug>\emptyset ' +exe s:pA14a.'varnothing<Tab>⌀ <plug>\varnothing ' +exe s:pA14a.'infty<Tab>∞ <plug>\infty ' +exe s:pA14a.'aleph<Tab>א <plug>\aleph ' +exe s:pA14a.'beth<Tab>ב <plug>\beth ' +exe s:pA14a.'gimel<Tab>ג <plug>\gimel ' +exe s:pA14a.'daleth<Tab>ד <plug>\daleth ' +exe s:pA14a.'hbar<Tab> <plug>\hbar ' +exe s:pA14a.'hslash<Tab>ℏ <plug>\hslash ' +exe s:pA14a.'diagup<Tab>⁄ <plug>\diagup ' +exe s:pA14a.'vert<Tab>\| <plug>\vert ' +exe s:pA14a.'Vert<Tab>∥ <plug>\Vert ' +exe s:pA14a.'backslash<Tab>\\ <plug>\backslash ' +exe s:pA14a.'diagdown<Tab> <plug>\diagdown ' +exe s:pA14a.'Bbbk<Tab>ᵕ <plug>\Bbbk ' +exe s:pA14a.'P<Tab>¶ <plug>\P ' +exe s:pA14a.'S<Tab>§ <plug>\S ' +" }}} +" {{{ Symbols2 +let s:pA14b = s:pA."&Symbols2." +exe s:pA14b.'# <plug>\# ' +exe s:pA14b.'% <plug>\% ' +exe s:pA14b.'_<Tab> <plug>\_ ' +exe s:pA14b.'$ <plug>\$ ' +exe s:pA14b.'& <plug>\& ' +exe s:pA14b.'imath<Tab> <plug>\imath ' +exe s:pA14b.'jmath<Tab> <plug>\jmath ' +exe s:pA14b.'ell<Tab>ℓ <plug>\ell ' +exe s:pA14b.'wp<Tab>℘ <plug>\wp ' +exe s:pA14b.'Re<Tab>ℜ <plug>\Re ' +exe s:pA14b.'Im<Tab>ℑ <plug>\Im ' +exe s:pA14b.'prime<Tab>′ <plug>\prime ' +exe s:pA14b.'backprime<Tab>‵ <plug>\backprime ' +exe s:pA14b.'nabla<Tab>∇ <plug>\nabla ' +exe s:pA14b.'surd<Tab>√ <plug>\surd ' +exe s:pA14b.'flat<Tab>♭ <plug>\flat ' +exe s:pA14b.'sharp<Tab>♯ <plug>\sharp ' +exe s:pA14b.'natural<Tab>♮ <plug>\natural ' +exe s:pA14b.'eth<Tab>ð <plug>\eth ' +exe s:pA14b.'bigstar<Tab>★ <plug>\bigstar ' +exe s:pA14b.'circledS<Tab>Ⓢ <plug>\circledS ' +exe s:pA14b.'Finv<Tab>Ⅎ <plug>\Finv ' +exe s:pA14b.'dag<Tab>† <plug>\dag ' +exe s:pA14b.'ddag<Tab>‡ <plug>\ddag ' +" }}} +" {{{ Symbols3 +let s:pA14c = s:pA."&Symbols3." +exe s:pA14c.'angle<Tab>∠ <plug>\angle ' +exe s:pA14c.'measuredangle<Tab>∡ <plug>\measuredangle ' +exe s:pA14c.'sphericalangle<Tab>∢ <plug>\sphericalangle ' +exe s:pA14c.'spadesuit<Tab>♠ <plug>\spadesuit ' +exe s:pA14c.'heartsuit<Tab>♡ <plug>\heartsuit ' +exe s:pA14c.'diamondsuit<Tab>♢ <plug>\diamondsuit ' +exe s:pA14c.'clubsuit<Tab>♣ <plug>\clubsuit ' +exe s:pA14c.'lozenge<Tab>◊ <plug>\lozenge ' +exe s:pA14c.'blacklozenge<Tab>◆ <plug>\blacklozenge ' +exe s:pA14c.'Diamond<Tab>◇ <plug>\Diamond ' +exe s:pA14c.'triangle<Tab>△ <plug>\triangle ' +exe s:pA14c.'vartriangle<Tab>△ <plug>\vartriangle ' +exe s:pA14c.'blacktriangle<Tab>▲ <plug>\blacktriangle ' +exe s:pA14c.'triangledown<Tab>▽ <plug>\triangledown ' +exe s:pA14c.'blacktriangledown<Tab>▼ <plug>\blacktriangledown ' +exe s:pA14c.'Box<Tab>□ <plug>\Box ' +exe s:pA14c.'square<Tab>□ <plug>\square ' +exe s:pA14c.'blacksquare<Tab>■ <plug>\blacksquare ' +exe s:pA14c.'complement<Tab>∁ <plug>\complement ' +exe s:pA14c.'mho<Tab>℧ <plug>\mho ' +exe s:pA14c.'Game<Tab>⅁ <plug>\Game ' +exe s:pA14c.'partial<Tab>`6\ \ ∂ <plug>\partial ' +exe s:pA14c.'smallint<Tab>∫ <plug>\smallint ' +" }}} +" {{{ Logic +let s:pA15 = s:pA."&Logic." +exe s:pA15.'lnot<Tab>¬ <plug>\lnot ' +exe s:pA15.'lor<Tab>∨ <plug>\lor ' +exe s:pA15.'land<Tab>∧ <plug>\land ' +" }}} +" {{{ Limits1 +let s:pA16 = s:pA."&Limits1." +exe s:pA16.'left<Tab>( <plug>\left' +exe s:pA16.'right<Tab>) <plug>\right' +exe s:pA16.'-sepbigl- :' +exe s:pA16.'bigl<Tab> <plug>\bigl' +exe s:pA16.'Bigl<Tab> <plug>\Bigl' +exe s:pA16.'biggl<Tab> <plug>\biggl' +exe s:pA16.'Biggl<Tab> <plug>\Biggl' +exe s:pA16.'-sepbigr- :' +exe s:pA16.'bigr<Tab> <plug>\bigr' +exe s:pA16.'Bigr<Tab> <plug>\Bigr' +exe s:pA16.'biggr<Tab> <plug>\biggr' +exe s:pA16.'Biggr<Tab> <plug>\Biggr' +exe s:pA16.'-sepbig- :' +exe s:pA16.'big<Tab> <plug>\big' +exe s:pA16.'bigm<Tab> <plug>\bigm' +exe s:pA16.'-sepfloor- :' +exe s:pA16.'lfloor<Tab>⌊ <plug>\lfloor ' +exe s:pA16.'lceil<Tab>⌈ <plug>\lceil ' +exe s:pA16.'rfloor<Tab>⌋ <plug>\rfloor ' +exe s:pA16.'rceil<Tab>⌉ <plug>\rceil ' +exe s:pA16.'-sepangle- :' +exe s:pA16.'langle<Tab>〈 <plug>\langle ' +exe s:pA16.'rangle<Tab>〉 <plug>\rangle ' +" }}} +" {{{ Limits2 +let s:pA16a = s:pA."&Limits2." +exe s:pA16a.'ulcorner<Tab>⌜ <plug>\ulcorner ' +exe s:pA16a.'urcorner<Tab>⌝ <plug>\urcorner ' +exe s:pA16a.'llcorner<Tab>⌞ <plug>\llcorner ' +exe s:pA16a.'rlcorner<Tab>⌟ <plug>\rlcorner ' +exe s:pA16a.'-sepcorner- :' +exe s:pA16a.'vert<Tab>\| <plug>\vert ' +exe s:pA16a.'Vert<Tab>∥ <plug>\Vert ' +exe s:pA16a.'lvert<Tab> <plug>\lvert ' +exe s:pA16a.'lVert<Tab> <plug>\lVert ' +exe s:pA16a.'rvert<Tab> <plug>\rvert ' +exe s:pA16a.'rVert<Tab> <plug>\rVert ' +exe s:pA16a.'uparrow<Tab>↑ <plug>\uparrow ' +exe s:pA16a.'Uparrow<Tab>⇑ <plug>\Uparrow ' +exe s:pA16a.'downarrow<Tab>↓ <plug>\downarrow ' +exe s:pA16a.'Downarrow<Tab>⇓ <plug>\Downarrow ' +exe s:pA16a.'updownarrow<Tab>↕ <plug>\updownarrow ' +exe s:pA16a.'Updownarrow<Tab>⇕ <plug>\Updownarrow ' +exe s:pA16a.'lgroup<Tab> <plug>\lgroup ' +exe s:pA16a.'rgroup<Tab> <plug>\rgroup ' +exe s:pA16a.'lmoustache<Tab>∫ <plug>\lmoustache ' +exe s:pA16a.'rmoustache<Tab> <plug>\rmoustache ' +exe s:pA16a.'arrowvert<Tab> <plug>\arrowvert ' +exe s:pA16a.'Arrowvert<Tab> <plug>\Arrowvert ' +exe s:pA16a.'bracevert<Tab> <plug>\bracevert ' +" }}} +" {{{ Log-likes +let s:pA17 = s:pA."Lo&g-likes." +exe s:pA17.'arccos<Tab> <plug>\arccos ' +exe s:pA17.'arcsin<Tab> <plug>\arcsin ' +exe s:pA17.'arctan<Tab> <plug>\arctan ' +exe s:pA17.'arg<Tab> <plug>\arg ' +exe s:pA17.'cos<Tab> <plug>\cos ' +exe s:pA17.'cosh<Tab> <plug>\cosh ' +exe s:pA17.'cot<Tab> <plug>\cot ' +exe s:pA17.'coth<Tab> <plug>\coth ' +exe s:pA17.'csc<Tab> <plug>\csc ' +exe s:pA17.'deg<Tab> <plug>\deg ' +exe s:pA17.'det<Tab> <plug>\det ' +exe s:pA17.'dim<Tab> <plug>\dim ' +exe s:pA17.'exp<Tab> <plug>\exp ' +exe s:pA17.'gcd<Tab> <plug>\gcd ' +exe s:pA17.'hom<Tab> <plug>\hom ' +exe s:pA17.'inf<Tab> <plug>\inf ' +exe s:pA17.'injlim<Tab> <plug>\injlim ' +exe s:pA17.'ker<Tab> <plug>\ker ' +exe s:pA17.'lg<Tab> <plug>\lg ' +exe s:pA17.'lim<Tab> <plug>\lim ' +exe s:pA17.'liminf<Tab> <plug>\liminf ' +exe s:pA17.'limsup<Tab> <plug>\limsup ' +exe s:pA17.'ln<Tab> <plug>\ln ' +exe s:pA17.'log<Tab> <plug>\log ' +exe s:pA17.'max<Tab> <plug>\max ' +exe s:pA17.'min<Tab> <plug>\min ' +exe s:pA17.'Pr<Tab> <plug>\Pr ' +exe s:pA17.'projlim<Tab> <plug>\projlim ' +exe s:pA17.'sec<Tab> <plug>\sec ' +exe s:pA17.'sin<Tab> <plug>\sin ' +exe s:pA17.'sinh<Tab> <plug>\sinh ' +exe s:pA17.'sup<Tab> <plug>\sup ' +exe s:pA17.'tan<Tab> <plug>\tan ' +exe s:pA17.'tanh<Tab> <plug>\tanh ' +exe s:pA17.'varlimsup<Tab> <plug>\varlimsup ' +exe s:pA17.'varliminf<Tab> <plug>\varliminf ' +exe s:pA17.'varinjlim<Tab> <plug>\varinjlim ' +exe s:pA17.'varprojlim<Tab> <plug>\varprojlim ' +" }}} +" {{{ MathSpacing +let s:pA18 = s:pA."MathSpacing." +exe s:pA18.', <plug>\, ' +exe s:pA18.': <plug>\: ' +exe s:pA18.'; <plug>\; ' +exe s:pA18.'[space] <plug>\ ' +exe s:pA18.'quad<Tab> <plug>\quad ' +exe s:pA18.'qquad<Tab> <plug>\qquad ' +exe s:pA18.'! <plug>\! ' +exe s:pA18.'thinspace<Tab> <plug>\thinspace ' +exe s:pA18.'medspace<Tab> <plug>\medspace ' +exe s:pA18.'thickspace<Tab> <plug>\thickspace ' +exe s:pA18.'negthinspace<Tab> <plug>\negthinspace ' +exe s:pA18.'negmedspace<Tab> <plug>\negmedspace ' +exe s:pA18.'negthickspace<Tab> <plug>\negthickspace ' +" 1}}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:fenc=utf-8 diff --git a/vimfiles.latex/ftplugin/latex-suite/mathmacros.vim b/vimfiles.latex/ftplugin/latex-suite/mathmacros.vim new file mode 100644 index 0000000..553965c --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/mathmacros.vim @@ -0,0 +1,730 @@ +"============================================================================= +" File: mathmacros.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 06:00 PM 2002 PST +" +" Description: macros for everything mathematical in latex. +"============================================================================= + +if !(has('gui_running') && g:Tex_MathMenus && g:Tex_Menus) + finish +endif + +let s:MathMenuName = g:Tex_MenuPrefix.'&Math.' + +function! Tex_MathMenuRemove() + exe 'silent! aunmenu '.s:MathMenuName +endfunction + +let s:pA = 'amenu <silent> '.g:Tex_NextMenuLocation.' '.s:MathMenuName +let g:Tex_NextMenuLocation = g:Tex_NextMenuLocation + 1 + +" brackets and dollars {{{ +exe s:pA.'\\&[\ \\] <plug><C-r>=IMAP_PutTextWithMovement("\\[<++>\\]<++>")<cr>' +exe s:pA.'\\&(\ \\) <plug><C-r>=IMAP_PutTextWithMovement("\\(<++>\\)<++>")<cr>' +exe s:pA.'&$\ $ <plug>$$' +exe s:pA.'-sepmath1- :' +" }}} +" MATH arrows {{{ +let s:pA1 = s:pA."&Arrows." +exe s:pA1.'Leftarrow <plug>\leftarrow ' +exe s:pA1.'leftarrow <plug>\leftarrow' +exe s:pA1.'longleftarrow <plug>\longleftarrow ' +exe s:pA1.'Leftarrow <plug>\Leftarrow ' +exe s:pA1.'Longleftarrow <plug>\Longleftarrow ' +exe s:pA1.'rightarrow <plug>\rightarrow ' +exe s:pA1.'longrightarrow <plug>\longrightarrow ' +exe s:pA1.'Rightarrow <plug>\Rightarrow ' +exe s:pA1.'Longrightarrow <plug>\Longrightarrow ' +exe s:pA1.'leftrightarrow <plug>\leftrightarrow ' +exe s:pA1.'longleftrightarrow <plug>\longleftrightarrow ' +exe s:pA1.'Leftrightarrow <plug>\Leftrightarrow ' +exe s:pA1.'Longleftrightarrow <plug>\Longleftrightarrow ' +exe s:pA1.'uparrow <plug>\uparrow ' +exe s:pA1.'Uparrow <plug>\Uparrow ' +exe s:pA1.'downarrow <plug>\downarrow ' +exe s:pA1.'Downarrow <plug>\Downarrow ' +exe s:pA1.'updownarrow <plug>\updownarrow ' +exe s:pA1.'Updownarrow <plug>\Updownarrow ' +exe s:pA1.'nearrow <plug>\nearrow ' +exe s:pA1.'searrow <plug>\searrow ' +exe s:pA1.'swarrow <plug>\swarrow ' +exe s:pA1.'nwarrow <plug>\nwarrow ' +exe s:pA1.'mapsto <plug>\mapsto ' +exe s:pA1.'leadsto <plug>\leadsto ' +exe s:pA1.'longmapsto <plug>\longmapsto ' +exe s:pA1.'hookleftarrow <plug>\hookleftarrow ' +exe s:pA1.'hookrightarrow <plug>\hookrightarrow ' +exe s:pA1.'leftharpoonup <plug>\leftharpoonup ' +exe s:pA1.'leftharpoondown <plug>\leftharpoondown ' +exe s:pA1.'rightharpoonup <plug>\rightharpoonup ' +exe s:pA1.'rightharpoondown <plug>\rightharpoondown ' +exe s:pA1.'rightleftharpoons <plug>\rightleftharpoons ' +exe s:pA1.'overleftarrow <plug>\overleftarrow ' +exe s:pA1.'overrightarrow <plug>\overrightarrow ' +exe s:pA1.'overleftrightarrow <plug>\overleftrightarrow ' +exe s:pA1.'underleftarrow <plug>\underleftarrow ' +exe s:pA1.'underrightarrow <plug>\underrightarrow ' +exe s:pA1.'underleftrightarrow <plug>\underleftrightarrow ' +exe s:pA1.'xleftarrow <plug>\xleftarrow ' +exe s:pA1.'xrightarrow <plug>\xrightarrow ' +" }}} + + +" MATH nArrows {{{ +let s:pA1a = s:pA."&nArrows." +exe s:pA1a.'nleftarrow <plug>\nleftarrow ' +exe s:pA1a.'nLeftarrow <plug>\nLeftarrow ' +exe s:pA1a.'nleftrightarrow <plug>\nleftrightarrow ' +exe s:pA1a.'nrightarrow <plug>\nrightarrow ' +exe s:pA1a.'nRightarrow <plug>\nRightarrow ' +" }}} +" MATH Arrows2 {{{ +let s:pA1a = s:pA."Arrows2." +exe s:pA1a.'dashleftarrow <plug>\dashleftarrow ' +exe s:pA1a.'leftleftarrows <plug>\leftleftarrows ' +exe s:pA1a.'leftrightarrows <plug>\leftrightarrows ' +exe s:pA1a.'Lleftarrow <plug>\Lleftarrow ' +exe s:pA1a.'twoheadleftarrow <plug>\twoheadleftarrow ' +exe s:pA1a.'leftarrowtail <plug>\leftarrowtail ' +exe s:pA1a.'leftrightharpoons <plug>\leftrightharpoons ' +exe s:pA1a.'Lsh <plug>\Lsh ' +exe s:pA1a.'looparrowleft <plug>\looparrowleft ' +exe s:pA1a.'curvearrowleft <plug>\curvearrowleft ' +exe s:pA1a.'circlearrowleft <plug>\circlearrowleft ' +exe s:pA1a.'dashrightarrow <plug>\dashrightarrow ' +exe s:pA1a.'rightrightarrows <plug>\rightrightarrows ' +exe s:pA1a.'rightleftarrows <plug>\rightleftarrows ' +exe s:pA1a.'Rrightarrow <plug>\Rrightarrow ' +exe s:pA1a.'twoheadrightarrow <plug>\twoheadrightarrow ' +exe s:pA1a.'rightarrowtail <plug>\rightarrowtail ' +exe s:pA1a.'rightleftharpoons <plug>\rightleftharpoons ' +exe s:pA1a.'Rsh <plug>\Rsh ' +exe s:pA1a.'looparrowright <plug>\looparrowright ' +exe s:pA1a.'curvearrowright <plug>\curvearrowright ' +exe s:pA1a.'circlearrowright <plug>\circlearrowright ' +exe s:pA1a.'multimap <plug>\multimap ' +exe s:pA1a.'upuparrows <plug>\upuparrows ' +exe s:pA1a.'downdownarrows <plug>\downdownarrows ' +exe s:pA1a.'upharpoonleft <plug>\upharpoonleft ' +exe s:pA1a.'upharpoonright <plug>\upharpoonright ' +exe s:pA1a.'downharpoonleft <plug>\downharpoonleft ' +exe s:pA1a.'downharpoonright <plug>\downharpoonright ' +exe s:pA1a.'rightsquigarrow <plug>\rightsquigarrow ' +exe s:pA1a.'leftrightsquigarrow <plug>\leftrightsquigarrow ' +" }}} +" MATH Fonts {{{ +let s:pA2a = s:pA."&MathFonts." +exe s:pA2a.'mathbf{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathbf{<++>}<++>")<cr>' +exe s:pA2a.'mathrm{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathrm{<++>}<++>")<cr>' +exe s:pA2a.'mathsf{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathsf{<++>}<++>")<cr>' +exe s:pA2a.'mathtt{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathtt{<++>}<++>")<cr>' +exe s:pA2a.'mathit{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathit{<++>}<++>")<cr>' +exe s:pA2a.'mathfrak{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathfrak{<++>}<++>")<cr>' +exe s:pA2a.'mathcal{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathcal{<++>}<++>")<cr>' +exe s:pA2a.'mathscr{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathscr{<++>}<++>")<cr>' +exe s:pA2a.'mathbb{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathbb{<++>}<++>")<cr>' +" }}} +" Greek Letters small {{{ +let s:pA2 = s:pA."&Greek.&Small." +exe s:pA2.'alpha<Tab>`a <plug>\alpha ' +exe s:pA2.'beta<Tab>`b <plug>\beta ' +exe s:pA2.'gamma<Tab>`g <plug>\gamma ' +exe s:pA2.'delta<Tab>`d <plug>\delta ' +exe s:pA2.'epsilon <plug>\epsilon ' +exe s:pA2.'varepsilon<Tab>`e <plug>\varepsilon ' +exe s:pA2.'zeta<Tab>`z <plug>\zeta ' +exe s:pA2.'eta<Tab>`h <plug>\eta ' +exe s:pA2.'theta<Tab>`q <plug>\theta ' +exe s:pA2.'vartheta <plug>\vartheta ' +exe s:pA2.'iota<Tab>`i <plug>\iota ' +exe s:pA2.'kappa<Tab>`k <plug>\kappa ' +exe s:pA2.'lambda<Tab>`l <plug>\lambda ' +exe s:pA2.'mu<Tab>`m <plug>\mu ' +exe s:pA2.'nu<Tab>`n <plug>\nu ' +exe s:pA2.'xi<Tab>`x <plug>\xi ' +exe s:pA2.'pi<Tab>`p <plug>\pi ' +exe s:pA2.'varpi <plug>\varpi ' +exe s:pA2.'rho<Tab>`r <plug>\rho ' +exe s:pA2.'varrho <plug>\varrho ' +exe s:pA2.'sigma<Tab>`s <plug>\sigma ' +exe s:pA2.'varsigma<Tab>`v <plug>\varsigma ' +exe s:pA2.'tau<Tab>`t <plug>\tau ' +exe s:pA2.'upsilon<Tab>`u <plug>\upsilon ' +exe s:pA2.'phi <plug>\phi ' +exe s:pA2.'varphi<Tab>`f <plug>\varphi ' +exe s:pA2.'chi<Tab>`c <plug>\chi ' +exe s:pA2.'psi<Tab>`y <plug>\psi ' +exe s:pA2.'omega<Tab>`w <plug>\omega ' +" }}} +" Greek Letters big {{{ +let s:pA3 = s:pA.'&Greek.&Big.' +exe s:pA3.'Alpha<Tab>`A <plug>\Alpha ' +exe s:pA3.'Beta<Tab>`B <plug>\Beta ' +exe s:pA3.'Gamma<Tab>`G <plug>\Gamma ' +exe s:pA3.'Delta<Tab>`D <plug>\Delta ' +exe s:pA3.'Epsilon<Tab>`E <plug>\Epsilon ' +exe s:pA3.'Zeta<Tab>`Z <plug>\mathrm{Z} ' +exe s:pA3.'Eta<Tab>`H <plug>\Eta ' +exe s:pA3.'Theta <plug>\Theta ' +exe s:pA3.'Iota <plug>\mathrm{I} ' +exe s:pA3.'Kappa<Tab>`K <plug>\Kappa ' +exe s:pA3.'Lambda<Tab>`L <plug>\Lambda ' +exe s:pA3.'Mu<Tab>`M <plug>\Mu ' +exe s:pA3.'Nu<Tab>`N <plug>\Nu ' +exe s:pA3.'Xi<Tab>`X <plug>\Xi ' +exe s:pA3.'Pi<Tab>`P <plug>\Pi ' +exe s:pA3.'Rho<Tab>`R <plug>\Rho ' +exe s:pA3.'Sigma<Tab>`S <plug>\Sigma ' +exe s:pA3.'Tau<Tab>`T <plug>\Tau ' +exe s:pA3.'Upsilon<Tab>`U <plug>\Upsilon ' +exe s:pA3.'Phi <plug>\Phi ' +exe s:pA3.'Chi<Tab>`C <plug>\Chi ' +exe s:pA3.'Psi<Tab>`Y <plug>\Psi ' +exe s:pA3.'Omega<Tab>`W <plug>\Omega ' +" }}} +" BinaryRel1 {{{ +let s:pA4 = s:pA."&BinaryRel1." +exe s:pA4.'ll <plug>\ll ' +exe s:pA4.'lll <plug>\lll ' +exe s:pA4.'leqslant <plug>\leqslant ' +exe s:pA4.'leq <plug>\leq ' +exe s:pA4.'leqq <plug>\leqq ' +exe s:pA4.'eqslantless <plug>\eqslantless ' +exe s:pA4.'lessdot <plug>\lessdot ' +exe s:pA4.'prec <plug>\prec ' +exe s:pA4.'preceq <plug>\preceq ' +exe s:pA4.'preccurlyeq <plug>\preccurlyeq ' +exe s:pA4.'curlyeqprec <plug>\curlyeqprec ' +exe s:pA4.'lesssim <plug>\lesssim ' +exe s:pA4.'lessapprox <plug>\lessapprox ' +exe s:pA4.'precsim <plug>\precsim ' +exe s:pA4.'precapprox <plug>\precapprox ' +exe s:pA4.'in <plug>\in ' +exe s:pA4.'subset<Tab>`( <plug>\subset ' +exe s:pA4.'Subset<Tab>`) <plug>\Subset ' +exe s:pA4.'subseteq <plug>\subseteq ' +exe s:pA4.'subseteqq <plug>\subseteqq ' +exe s:pA4.'sqsubset <plug>\sqsubset ' +exe s:pA4.'sqsubseteq <plug>\sqsubseteq ' +exe s:pA4.'smile <plug>\smile ' +exe s:pA4.'smallsmile <plug>\smallsmile ' +exe s:pA4.'parallel <plug>\parallel ' +exe s:pA4.'shortparallel <plug>\shortparallel ' +exe s:pA4.'dashv <plug>\dashv ' +exe s:pA4.'vdash <plug>\vdash ' +exe s:pA4.'vDash <plug>\vDash ' +exe s:pA4.'models <plug>\models ' +exe s:pA4.'therefore <plug>\therefore ' +exe s:pA4.'backepsilon <plug>\backepsilon ' +" }}} +" nBinaryRel1 {{{ +let s:pA4a = s:pA."&nBinaryRel1." +exe s:pA4a.'nless <plug>\nless ' +exe s:pA4a.'nleqslant <plug>\nleqslant ' +exe s:pA4a.'nleq <plug>\nleq ' +exe s:pA4a.'lneq <plug>\lneq ' +exe s:pA4a.'nleqq <plug>\nleqq ' +exe s:pA4a.'lneqq <plug>\lneqq ' +exe s:pA4a.'lvertneqq <plug>\lvertneqq ' +exe s:pA4a.'nprec <plug>\nprec ' +exe s:pA4a.'npreceq <plug>\npreceq ' +exe s:pA4a.'precneqq <plug>\precneqq ' +exe s:pA4a.'lnsim <plug>\lnsim ' +exe s:pA4a.'lnapprox <plug>\lnapprox ' +exe s:pA4a.'precnsim <plug>\precnsim ' +exe s:pA4a.'precnapprox <plug>\precnapprox ' +exe s:pA4a.'notin <plug>\notin ' +exe s:pA4a.'nsubseteq <plug>\nsubseteq ' +exe s:pA4a.'varsubsetneq <plug>\varsubsetneq ' +exe s:pA4a.'subsetneq <plug>\subsetneq ' +exe s:pA4a.'nsubseteqq <plug>\nsubseteqq ' +exe s:pA4a.'varsubsetneqq <plug>\varsubsetneqq ' +exe s:pA4a.'subsetneqq <plug>\subsetneqq ' +exe s:pA4a.'nparallel <plug>\nparallel ' +exe s:pA4a.'nshortparallel <plug>\nshortparallel ' +exe s:pA4a.'nvdash <plug>\nvdash ' +exe s:pA4a.'nvDash <plug>\nvDash ' +" }}} +" BinaryRel2 {{{ +let s:pA5 = s:pA."&BinaryRel2." +exe s:pA5.'gg <plug>\gg ' +exe s:pA5.'ggg <plug>\ggg ' +exe s:pA5.'gggtr <plug>\gggtr ' +exe s:pA5.'geqslant <plug>\geqslant ' +exe s:pA5.'geq <plug>\geq ' +exe s:pA5.'geqq <plug>\geqq ' +exe s:pA5.'eqslantgtr <plug>\eqslantgtr ' +exe s:pA5.'gtrdot <plug>\gtrdot ' +exe s:pA5.'succ <plug>\succ ' +exe s:pA5.'succeq <plug>\succeq ' +exe s:pA5.'succcurlyeq <plug>\succcurlyeq ' +exe s:pA5.'curlyeqsucc <plug>\curlyeqsucc ' +exe s:pA5.'gtrsim <plug>\gtrsim ' +exe s:pA5.'gtrapprox <plug>\gtrapprox ' +exe s:pA5.'succsim <plug>\succsim ' +exe s:pA5.'succapprox <plug>\succapprox ' +exe s:pA5.'ni <plug>\ni ' +exe s:pA5.'owns <plug>\owns ' +exe s:pA5.'supset <plug>\supset ' +exe s:pA5.'Supset <plug>\Supset ' +exe s:pA5.'supseteq <plug>\supseteq ' +exe s:pA5.'supseteqq <plug>\supseteqq ' +exe s:pA5.'sqsupset <plug>\sqsupset ' +exe s:pA5.'sqsupseteq <plug>\sqsupseteq ' +exe s:pA5.'frown <plug>\frown ' +exe s:pA5.'smallfrown <plug>\smallfrown ' +exe s:pA5.'mid <plug>\mid ' +exe s:pA5.'shortmid <plug>\shortmid ' +exe s:pA5.'between <plug>\between ' +exe s:pA5.'Vdash <plug>\Vdash ' +exe s:pA5.'bowtie <plug>\bowtie ' +exe s:pA5.'Join <plug>\Join ' +exe s:pA5.'pitchfork <plug>\pitchfork ' +" }}} +" {{{ nBinaryRel2 +let s:pA5a = s:pA."n&BinaryRel2." "TODO: dorobi� logarytmy +exe s:pA5a.'ngtr <plug>\ngtr ' +exe s:pA5a.'ngeqslant <plug>\ngeqslant ' +exe s:pA5a.'ngeq <plug>\ngeq ' +exe s:pA5a.'gneq <plug>\gneq ' +exe s:pA5a.'ngeqq <plug>\ngeqq ' +exe s:pA5a.'gneqq <plug>\gneqq ' +exe s:pA5a.'nsucc <plug>\nsucc ' +exe s:pA5a.'nsucceq <plug>\nsucceq ' +exe s:pA5a.'succneqq <plug>\succneqq ' +exe s:pA5a.'gnsim <plug>\gnsim ' +exe s:pA5a.'gnapprox <plug>\gnapprox ' +exe s:pA5a.'succnsim <plug>\succnsim ' +exe s:pA5a.'succnapprox <plug>\succnapprox ' +exe s:pA5a.'nsupseteq <plug>\nsupseteq ' +exe s:pA5a.'varsupsetneq <plug>\varsupsetneq ' +exe s:pA5a.'supsetneq <plug>\supsetneq ' +exe s:pA5a.'nsupseteqq <plug>\nsupseteqq ' +exe s:pA5a.'varsupsetneqq <plug>\varsupsetneqq ' +exe s:pA5a.'supsetneqq <plug>\supsetneqq ' +exe s:pA5a.'nmid <plug>\nmid ' +exe s:pA5a.'nshortmid <plug>\nshortmid ' +exe s:pA5a.'nVdash <plug>\nVdash ' +" }}} +" {{{ BinaryRel3 +let s:pA6 = s:pA."&BinaryRel3." +exe s:pA6.'doteq <plug>\doteq ' +exe s:pA6.'circeq <plug>\circeq ' +exe s:pA6.'eqcirc <plug>\eqcirc ' +exe s:pA6.'risingdotseq <plug>\risingdotseq ' +exe s:pA6.'doteqdot <plug>\doteqdot ' +exe s:pA6.'Doteq <plug>\Doteq ' +exe s:pA6.'fallingdotseq <plug>\fallingdotseq ' +exe s:pA6.'triangleq <plug>\triangleq ' +exe s:pA6.'bumpeq <plug>\bumpeq ' +exe s:pA6.'Bumpeq <plug>\Bumpeq ' +exe s:pA6.'equiv<Tab>`= <plug>\equiv ' +exe s:pA6.'sim <plug>\sim ' +exe s:pA6.'thicksim <plug>\thicksim ' +exe s:pA6.'backsim <plug>\backsim ' +exe s:pA6.'simeq <plug>\simeq ' +exe s:pA6.'backsimeq <plug>\backsimeq ' +exe s:pA6.'cong <plug>\cong ' +exe s:pA6.'approx<tab>=~ <plug>\approx ' +exe s:pA6.'thickapprox <plug>\thickapprox ' +exe s:pA6.'approxeq <plug>\approxeq ' +exe s:pA6.'blacktriangleleft <plug>\blacktriangleleft ' +exe s:pA6.'vartriangleleft <plug>\vartriangleleft ' +exe s:pA6.'trianglelefteq <plug>\trianglelefteq ' +exe s:pA6.'blacktriangleright <plug>\blacktriangleright ' +exe s:pA6.'vartriangleright <plug>\vartriangleright ' +exe s:pA6.'trianglerighteq <plug>\trianglerighteq ' +exe s:pA6.'perp <plug>\perp ' +exe s:pA6.'asymp <plug>\asymp ' +exe s:pA6.'Vvdash <plug>\Vvdash ' +exe s:pA6.'propto <plug>\propto ' +exe s:pA6.'varpropto <plug>\varpropto ' +exe s:pA6.'because <plug>\because ' +" }}} +" {{{ nBinaryRel3 +let s:pA6a = s:pA."&nBinaryRel3." +exe s:pA6a.'neq <plug>\neq ' +exe s:pA6a.'nsim <plug>\nsim ' +exe s:pA6a.'ncong <plug>\ncong ' +exe s:pA6a.'ntriangleleft <plug>\ntriangleleft ' +exe s:pA6a.'ntrianglelefteq <plug>\ntrianglelefteq ' +exe s:pA6a.'ntriangleright <plug>\ntriangleright ' +exe s:pA6a.'ntrianglerighteq <plug>\ntrianglerighteq ' +" }}} +" {{{ BinaryRel4 +let s:pA7 = s:pA."&BinaryRel4." +exe s:pA7.'lessgtr <plug>\lessgtr ' +exe s:pA7.'gtrless <plug>\gtrless ' +exe s:pA7.'lesseqgtr <plug>\lesseqgtr ' +exe s:pA7.'gtreqless <plug>\gtreqless ' +exe s:pA7.'lesseqqgtr <plug>\lesseqqgtr ' +exe s:pA7.'gtreqqless <plug>\gtreqqless ' +" }}} +" {{{ BigOp +let s:pA8a = s:pA."&BigOp." +exe s:pA8a.'limits <plug>\limits' +exe s:pA8a.'nolimits <plug>\nolimits' +exe s:pA8a.'displaylimits <plug>\displaylimits' +exe s:pA8a.'-seplimits- :' +exe s:pA8a.'bigcap<Tab>`- <plug>\bigcap' +exe s:pA8a.'bigcup<Tab>`+ <plug>\bigcup' +exe s:pA8a.'bigodot <plug>\bigodot' +exe s:pA8a.'bigoplus <plug>\bigoplus' +exe s:pA8a.'bigotimes <plug>\bigotimes' +exe s:pA8a.'bigsqcup <plug>\bigsqcup' +exe s:pA8a.'biguplus <plug>\biguplus' +exe s:pA8a.'bigvee <plug>\bigvee' +exe s:pA8a.'bigwedge <plug>\bigwedge' +exe s:pA8a.'coprod <plug>\coprod' +exe s:pA8a.'int <plug>\int' +exe s:pA8a.'oint <plug>\oint' +exe s:pA8a.'prod <plug>\prod' +exe s:pA8a.'sum <plug>\sum' +" }}} +" {{{ BinaryOp +let s:pA8 = s:pA."&BinaryOp." +exe s:pA8.'pm <plug>\pm ' +exe s:pA8.'mp <plug>\mp ' +exe s:pA8.'dotplus <plug>\dotplus ' +exe s:pA8.'cdot<Tab>`. <plug>\cdot ' +exe s:pA8.'centerdot <plug>\centerdot ' +exe s:pA8.'times<Tab>`* <plug>\times ' +exe s:pA8.'ltimes <plug>\ltimes ' +exe s:pA8.'rtimes <plug>\rtimes ' +exe s:pA8.'leftthreetimes <plug>\leftthreetimes ' +exe s:pA8.'rightthreetimes <plug>\rightthreetimes ' +exe s:pA8.'div <plug>\div ' +exe s:pA8.'divideontimes <plug>\divideontimes ' +exe s:pA8.'bmod <plug>\bmod ' +exe s:pA8.'ast <plug>\ast ' +exe s:pA8.'star <plug>\star ' +exe s:pA8.'setminus<Tab>`\\ <plug>\setminus ' +exe s:pA8.'smallsetminus <plug>\smallsetminus ' +exe s:pA8.'diamond <plug>\diamond ' +exe s:pA8.'wr <plug>\wr ' +exe s:pA8.'intercal <plug>\intercal ' +exe s:pA8.'circ<Tab>`@ <plug>\circ ' +exe s:pA8.'bigcirc <plug>\bigcirc ' +exe s:pA8.'bullet <plug>\bullet ' +exe s:pA8.'cap <plug>\cap ' +exe s:pA8.'Cap <plug>\Cap ' +exe s:pA8.'cup <plug>\cup ' +exe s:pA8.'Cup <plug>\Cup ' +exe s:pA8.'sqcap <plug>\sqcap ' +exe s:pA8.'sqcup <plug>\sqcup' +exe s:pA8.'amalg <plug>\amalg ' +exe s:pA8.'uplus <plug>\uplus ' +exe s:pA8.'triangleleft <plug>\triangleleft ' +exe s:pA8.'triangleright <plug>\triangleright ' +exe s:pA8.'bigtriangleup <plug>\bigtriangleup ' +exe s:pA8.'bigtriangledown <plug>\bigtriangledown ' +exe s:pA8.'vee <plug>\vee ' +exe s:pA8.'veebar <plug>\veebar ' +exe s:pA8.'curlyvee <plug>\curlyvee ' +exe s:pA8.'wedge<Tab>`& <plug>\wedge ' +exe s:pA8.'barwedge <plug>\barwedge ' +exe s:pA8.'doublebarwedge <plug>\doublebarwedge ' +exe s:pA8.'curlywedge <plug>\curlywedge ' +exe s:pA8.'oplus <plug>\oplus ' +exe s:pA8.'ominus <plug>\ominus ' +exe s:pA8.'otimes <plug>\otimes ' +exe s:pA8.'oslash <plug>\oslash ' +exe s:pA8.'boxplus <plug>\boxplus ' +exe s:pA8.'boxminus <plug>\boxminus ' +exe s:pA8.'boxtimes <plug>\boxtimes ' +exe s:pA8.'boxdot <plug>\boxdot ' +exe s:pA8.'odot <plug>\odot ' +exe s:pA8.'circledast <plug>\circledast ' +exe s:pA8.'circleddash <plug>\circleddash ' +exe s:pA8.'circledcirc <plug>\circledcirc ' +exe s:pA8.'dagger <plug>\dagger ' +exe s:pA8.'ddagger <plug>\ddagger ' +exe s:pA8.'lhd <plug>\lhd ' +exe s:pA8.'unlhd <plug>\unlhd ' +exe s:pA8.'rhd <plug>\rhd ' +exe s:pA8.'unrhd <plug>\unrhd ' +" }}} +" {{{ Other1 +let s:pA9 = s:pA."&Other1." +exe s:pA9.'hat <plug>\hat ' +exe s:pA9.'check <plug>\check ' +exe s:pA9.'grave <plug>\grave ' +exe s:pA9.'acute <plug>\acute ' +exe s:pA9.'dot <plug>\dot ' +exe s:pA9.'ddot <plug>\ddot ' +exe s:pA9.'tilde<Tab>`, <plug>\tilde ' +exe s:pA9.'breve <plug>\breve ' +exe s:pA9.'bar <plug>\bar ' +exe s:pA9.'vec <plug>\vec ' +exe s:pA9.'aleph <plug>\aleph ' +exe s:pA9.'hbar <plug>\hbar ' +exe s:pA9.'imath <plug>\imath ' +exe s:pA9.'jmath <plug>\jmath ' +exe s:pA9.'ell <plug>\ell ' +exe s:pA9.'wp <plug>\wp ' +exe s:pA9.'Re <plug>\Re ' +exe s:pA9.'Im <plug>\Im ' +exe s:pA9.'partial <plug>\partial ' +exe s:pA9.'infty<Tab>`8 <plug>\infty ' +exe s:pA9.'prime <plug>\prime ' +exe s:pA9.'emptyset <plug>\emptyset ' +exe s:pA9.'nabla <plug>\nabla ' +exe s:pA9.'surd <plug>\surd ' +exe s:pA9.'top <plug>\top ' +exe s:pA9.'bot <plug>\bot ' +exe s:pA9.'angle <plug>\angle ' +exe s:pA9.'triangle <plug>\triangle ' +exe s:pA9.'backslash <plug>\backslash ' +exe s:pA9.'forall <plug>\forall ' +exe s:pA9.'exists <plug>\exists ' +exe s:pA9.'neg <plug>\neg ' +exe s:pA9.'flat <plug>\flat ' +exe s:pA9.'natural <plug>\natural ' +exe s:pA9.'sharp <plug>\sharp ' +exe s:pA9.'clubsuit <plug>\clubsuit ' +exe s:pA9.'diamondsuit <plug>\diamondsuit ' +exe s:pA9.'heartsuit <plug>\heartsuit ' +exe s:pA9.'spadesuit <plug>\spadesuit ' +exe s:pA9.'S <plug>\S ' +exe s:pA9.'P <plug>\P' +" }}} +" {{{ MathCreating +let s:pA10 = s:pA."&MathCreating." +exe s:pA10.'not <plug>\not' +exe s:pA10.'mkern <plug>\mkern' +exe s:pA10.'mathbin <plug>\mathbin' +exe s:pA10.'mathrel <plug>\mathrel' +exe s:pA10.'stackrel <plug>\stackrel' +exe s:pA10.'mathord <plug>\mathord' +" }}} +" {{{ Styles +let s:pA11 = s:pA."&Styles." +exe s:pA11.'displaystyle <plug>\displaystyle' +exe s:pA11.'textstyle <plug>\textstyle' +exe s:pA11.'scritpstyle <plug>\scritpstyle' +exe s:pA11.'scriptscriptstyle <plug>\scriptscriptstyle' +" }}} +" {{{ MathDiacritics +let s:pA12 = s:pA."&MathDiacritics." +exe s:pA12.'acute{} <plug><C-r>=IMAP_PutTextWithMovement("\\acute{<++>}<++>")<cr>' +exe s:pA12.'bar{}<Tab>`_ <plug><C-r>=IMAP_PutTextWithMovement("\\bar{<++>}<++>")<cr>' +exe s:pA12.'breve{} <plug><C-r>=IMAP_PutTextWithMovement("\\breve{<++>}<++>")<cr>' +exe s:pA12.'check{} <plug><C-r>=IMAP_PutTextWithMovement("\\check{<++>}<++>")<cr>' +exe s:pA12.'ddot{}<Tab>`: <plug><C-r>=IMAP_PutTextWithMovement("\\ddot{<++>}<++>")<cr>' +exe s:pA12.'dot{}<Tab>`; <plug><C-r>=IMAP_PutTextWithMovement("\\dot{<++>}<++>")<cr>' +exe s:pA12.'grave{} <plug><C-r>=IMAP_PutTextWithMovement("\\grave{<++>}<++>")<cr>' +exe s:pA12.'hat{}<Tab>`^ <plug><C-r>=IMAP_PutTextWithMovement("\\hat{<++>}<++>")<cr>' +exe s:pA12.'tilde{}<tab>`~ <plug><C-r>=IMAP_PutTextWithMovement("\\tilde{<++>}<++>")<cr>' +exe s:pA12.'vec{} <plug><C-r>=IMAP_PutTextWithMovement("\\vec{<++>}<++>")<cr>' +exe s:pA12.'widehat{} <plug><C-r>=IMAP_PutTextWithMovement("\\widehat{<++>}<++>")<cr>' +exe s:pA12.'widetilde{} <plug><C-r>=IMAP_PutTextWithMovement("\\widetilde{<++>}<++>")<cr>' +exe s:pA12.'imath <plug><C-r>=IMAP_PutTextWithMovement("\\imath")<cr>' +exe s:pA12.'jmath <plug><C-r>=IMAP_PutTextWithMovement("\\jmath")<cr>' +" }}} +" {{{ OverlineAndCo +let s:pA13 = s:pA."&OverlineAndCo." +exe s:pA13.'overline{} <plug><C-r>=IMAP_PutTextWithMovement("\\overline{}")<cr>' +exe s:pA13.'underline{} <plug><C-r>=IMAP_PutTextWithMovement("\\underline{}")<cr>' +exe s:pA13.'overrightarrow{} <plug><C-r>=IMAP_PutTextWithMovement("\\overrightarrow{}")<cr>' +exe s:pA13.'overleftarrow{} <plug><C-r>=IMAP_PutTextWithMovement("\\overleftarrow{}")<cr>' +exe s:pA13.'overbrace{} <plug><C-r>=IMAP_PutTextWithMovement("\\overbrace{}")<cr>' +exe s:pA13.'underbrace{} <plug><C-r>=IMAP_PutTextWithMovement("\\underbrace{}")<cr>' +" }}} +" {{{ Symbols1 +let s:pA14a = s:pA."&Symbols1." +exe s:pA14a.'forall <plug>\forall ' +exe s:pA14a.'exists <plug>\exists ' +exe s:pA14a.'nexists <plug>\nexists ' +exe s:pA14a.'neg <plug>\neg ' +exe s:pA14a.'top <plug>\top ' +exe s:pA14a.'bot <plug>\bot ' +exe s:pA14a.'emptyset <plug>\emptyset ' +exe s:pA14a.'varnothing <plug>\varnothing ' +exe s:pA14a.'infty <plug>\infty ' +exe s:pA14a.'aleph <plug>\aleph ' +exe s:pA14a.'beth <plug>\beth ' +exe s:pA14a.'gimel <plug>\gimel ' +exe s:pA14a.'daleth <plug>\daleth ' +exe s:pA14a.'hbar <plug>\hbar ' +exe s:pA14a.'hslash <plug>\hslash ' +exe s:pA14a.'diagup <plug>\diagup ' +exe s:pA14a.'vert <plug>\vert ' +exe s:pA14a.'Vert <plug>\Vert ' +exe s:pA14a.'backslash <plug>\backslash ' +exe s:pA14a.'diagdown <plug>\diagdown ' +exe s:pA14a.'Bbbk <plug>\Bbbk ' +exe s:pA14a.'P <plug>\P ' +exe s:pA14a.'S <plug>\S ' +" }}} +" {{{ Symbols2 +let s:pA14b = s:pA."&Symbols2." +exe s:pA14b.'# <plug>\# ' +exe s:pA14b.'% <plug>\% ' +exe s:pA14b.'_ <plug>\_ ' +exe s:pA14b.'$ <plug>\$ ' +exe s:pA14b.'& <plug>\& ' +exe s:pA14b.'imath <plug>\imath ' +exe s:pA14b.'jmath <plug>\jmath ' +exe s:pA14b.'ell <plug>\ell ' +exe s:pA14b.'wp <plug>\wp ' +exe s:pA14b.'Re <plug>\Re ' +exe s:pA14b.'Im <plug>\Im ' +exe s:pA14b.'prime <plug>\prime ' +exe s:pA14b.'backprime <plug>\backprime ' +exe s:pA14b.'nabla <plug>\nabla ' +exe s:pA14b.'surd <plug>\surd ' +exe s:pA14b.'flat <plug>\flat ' +exe s:pA14b.'sharp <plug>\sharp ' +exe s:pA14b.'natural <plug>\natural ' +exe s:pA14b.'eth <plug>\eth ' +exe s:pA14b.'bigstar <plug>\bigstar ' +exe s:pA14b.'circledS <plug>\circledS ' +exe s:pA14b.'Finv <plug>\Finv ' +exe s:pA14b.'dag <plug>\dag ' +exe s:pA14b.'ddag <plug>\ddag ' +" }}} +" {{{ Symbols3 +let s:pA14c = s:pA."&Symbols3." +exe s:pA14c.'angle <plug>\angle ' +exe s:pA14c.'measuredangle <plug>\measuredangle ' +exe s:pA14c.'sphericalangle <plug>\sphericalangle ' +exe s:pA14c.'spadesuit <plug>\spadesuit ' +exe s:pA14c.'heartsuit <plug>\heartsuit ' +exe s:pA14c.'diamondsuit <plug>\diamondsuit ' +exe s:pA14c.'clubsuit <plug>\clubsuit ' +exe s:pA14c.'lozenge <plug>\lozenge ' +exe s:pA14c.'blacklozenge <plug>\blacklozenge ' +exe s:pA14c.'Diamond <plug>\Diamond ' +exe s:pA14c.'triangle <plug>\triangle ' +exe s:pA14c.'vartriangle <plug>\vartriangle ' +exe s:pA14c.'blacktriangle <plug>\blacktriangle ' +exe s:pA14c.'triangledown <plug>\triangledown ' +exe s:pA14c.'blacktriangledown <plug>\blacktriangledown ' +exe s:pA14c.'Box <plug>\Box ' +exe s:pA14c.'square <plug>\square ' +exe s:pA14c.'blacksquare <plug>\blacksquare ' +exe s:pA14c.'complement <plug>\complement ' +exe s:pA14c.'mho <plug>\mho ' +exe s:pA14c.'Game <plug>\Game ' +exe s:pA14c.'partial<Tab>`6 <plug>\partial ' +exe s:pA14c.'smallint <plug>\smallint ' +" }}} +" {{{ Logic +let s:pA15 = s:pA."&Logic." +exe s:pA15.'lnot <plug>\lnot ' +exe s:pA15.'lor <plug>\lor ' +exe s:pA15.'land <plug>\land ' +" }}} +" {{{ Limits1 +let s:pA16 = s:pA."&Limits1." +exe s:pA16.'left <plug>\left' +exe s:pA16.'right <plug>\right' +exe s:pA16.'-sepbigl- :' +exe s:pA16.'bigl <plug>\bigl' +exe s:pA16.'Bigl <plug>\Bigl' +exe s:pA16.'biggl <plug>\biggl' +exe s:pA16.'Biggl <plug>\Biggl' +exe s:pA16.'-sepbigr- :' +exe s:pA16.'bigr <plug>\bigr' +exe s:pA16.'Bigr <plug>\Bigr' +exe s:pA16.'biggr <plug>\biggr' +exe s:pA16.'Biggr <plug>\Biggr' +exe s:pA16.'-sepbig- :' +exe s:pA16.'big <plug>\big' +exe s:pA16.'bigm <plug>\bigm' +exe s:pA16.'-sepfloor- :' +exe s:pA16.'lfloor <plug>\lfloor ' +exe s:pA16.'lceil <plug>\lceil ' +exe s:pA16.'rfloor <plug>\rfloor ' +exe s:pA16.'rceil <plug>\rceil ' +exe s:pA16.'-sepangle- :' +exe s:pA16.'langle <plug>\langle ' +exe s:pA16.'rangle <plug>\rangle ' +" }}} +" {{{ Limits2 +let s:pA16a = s:pA."&Limits2." +exe s:pA16a.'ulcorner <plug>\ulcorner ' +exe s:pA16a.'urcorner <plug>\urcorner ' +exe s:pA16a.'llcorner <plug>\llcorner ' +exe s:pA16a.'rlcorner <plug>\rlcorner ' +exe s:pA16a.'-sepcorner- :' +exe s:pA16a.'vert <plug>\vert ' +exe s:pA16a.'Vert <plug>\Vert ' +exe s:pA16a.'lvert <plug>\lvert ' +exe s:pA16a.'lVert <plug>\lVert ' +exe s:pA16a.'rvert <plug>\rvert ' +exe s:pA16a.'rVert <plug>\rVert ' +exe s:pA16a.'uparrow <plug>\uparrow ' +exe s:pA16a.'Uparrow <plug>\Uparrow ' +exe s:pA16a.'downarrow <plug>\downarrow ' +exe s:pA16a.'Downarrow <plug>\Downarrow ' +exe s:pA16a.'updownarrow <plug>\updownarrow ' +exe s:pA16a.'Updownarrow <plug>\Updownarrow ' +exe s:pA16a.'lgroup <plug>\lgroup ' +exe s:pA16a.'rgroup <plug>\rgroup ' +exe s:pA16a.'lmoustache <plug>\lmoustache ' +exe s:pA16a.'rmoustache <plug>\rmoustache ' +exe s:pA16a.'arrowvert <plug>\arrowvert ' +exe s:pA16a.'Arrowvert <plug>\Arrowvert ' +exe s:pA16a.'bracevert <plug>\bracevert ' +" }}} +" {{{ Log-likes +let s:pA17 = s:pA."Lo&g-likes." +exe s:pA17.'arccos <plug>\arccos ' +exe s:pA17.'arcsin <plug>\arcsin ' +exe s:pA17.'arctan <plug>\arctan ' +exe s:pA17.'arg <plug>\arg ' +exe s:pA17.'cos <plug>\cos ' +exe s:pA17.'cosh <plug>\cosh ' +exe s:pA17.'cot <plug>\cot ' +exe s:pA17.'coth <plug>\coth ' +exe s:pA17.'csc <plug>\csc ' +exe s:pA17.'deg <plug>\deg ' +exe s:pA17.'det <plug>\det ' +exe s:pA17.'dim <plug>\dim ' +exe s:pA17.'exp <plug>\exp ' +exe s:pA17.'gcd <plug>\gcd ' +exe s:pA17.'hom <plug>\hom ' +exe s:pA17.'inf <plug>\inf ' +exe s:pA17.'injlim <plug>\injlim ' +exe s:pA17.'ker <plug>\ker ' +exe s:pA17.'lg <plug>\lg ' +exe s:pA17.'lim <plug>\lim ' +exe s:pA17.'liminf <plug>\liminf ' +exe s:pA17.'limsup <plug>\limsup ' +exe s:pA17.'ln <plug>\ln ' +exe s:pA17.'log <plug>\log ' +exe s:pA17.'max <plug>\max ' +exe s:pA17.'min <plug>\min ' +exe s:pA17.'Pr <plug>\Pr ' +exe s:pA17.'projlim <plug>\projlim ' +exe s:pA17.'sec <plug>\sec ' +exe s:pA17.'sin <plug>\sin ' +exe s:pA17.'sinh <plug>\sinh ' +exe s:pA17.'sup <plug>\sup ' +exe s:pA17.'tan <plug>\tan ' +exe s:pA17.'tanh <plug>\tanh ' +exe s:pA17.'varlimsup <plug>\varlimsup ' +exe s:pA17.'varliminf <plug>\varliminf ' +exe s:pA17.'varinjlim <plug>\varinjlim ' +exe s:pA17.'varprojlim <plug>\varprojlim ' +" }}} +" {{{ MathSpacing +let s:pA18 = s:pA."MathSpacing." +exe s:pA18.', <plug>\, ' +exe s:pA18.': <plug>\: ' +exe s:pA18.'; <plug>\; ' +exe s:pA18.'[space] <plug>\ ' +exe s:pA18.'quad <plug>\quad ' +exe s:pA18.'qquad <plug>\qquad ' +exe s:pA18.'! <plug>\! ' +exe s:pA18.'thinspace <plug>\thinspace ' +exe s:pA18.'medspace <plug>\medspace ' +exe s:pA18.'thickspace <plug>\thickspace ' +exe s:pA18.'negthinspace <plug>\negthinspace ' +exe s:pA18.'negmedspace <plug>\negmedspace ' +exe s:pA18.'negthickspace <plug>\negthickspace ' +" 1}}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/multicompile.vim b/vimfiles.latex/ftplugin/latex-suite/multicompile.vim new file mode 100644 index 0000000..f5598cc --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/multicompile.vim @@ -0,0 +1,17 @@ +" ============================================================================ +" File: multicompile.vim +" Author: Srinath Avadhanula +" Created: Sat Jul 05 03:00 PM 2003 +" Description: compile a .tex file multiple times to get cross references +" right. +" License: Vim Charityware License +" Part of vim-latexSuite: http://vim-latex.sourceforge.net +" CVS: $Id: multicompile.vim 997 2006-03-20 09:45:45Z srinathava $ +" ============================================================================ + +" The contents of this file have been moved to compiler.vim, the file which +" contains all functions relevant to compiling and viewing. +" This file is kept empty on purpose so that it will over-write previous +" versions of multicompile.vim, therby preventing conflicts. + +" vim:fdm=marker:nowrap:noet:ff=unix:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/outline.py b/vimfiles.latex/ftplugin/latex-suite/outline.py new file mode 100644 index 0000000..7bb6896 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/outline.py @@ -0,0 +1,186 @@ +#!/usr/bin/python + +# Part of Latex-Suite +# +# Copyright: Srinath Avadhanula +# Description: +# This file implements a simple outline creation for latex documents. + +import re +import os +import sys +import StringIO + +# getFileContents {{{ +def getFileContents(argin, ext=''): + if type(argin) is str: + fname = argin + ext + else: + fname = argin.group(3) + ext + + # This longish thing is to make sure that all files are converted into + # \n seperated lines. + contents = '\n'.join(open(fname).read().splitlines()) + + # TODO what are all the ways in which a tex file can include another? + pat = re.compile(r'^\\(@?)(include|input){(.*?)}', re.M) + contents = re.sub(pat, lambda input: getFileContents(input, ext), contents) + + return ('%%==== FILENAME: %s' % fname) + '\n' + contents + +# }}} +# stripComments {{{ +def stripComments(contents): + # remove all comments except those of the form + # %%==== FILENAME: <filename.tex> + uncomm = [re.sub('%(?!==== FILENAME: ).*', '', line) for line in contents.splitlines()] + # also remove all only-whitespace lines. + nonempty = [line for line in uncomm if line.strip()] + + return nonempty +# }}} +# addFileNameAndNumber {{{ +def addFileNameAndNumber(lines): + filename = '' + retval = '' + for line in lines: + if re.match('%==== FILENAME: ', line): + filename = line.split('%==== FILENAME: ')[1] + else: + retval += '<%s>%s\n' % (filename, line) + + return retval +# }}} +# getSectionLabels_Root {{{ +def getSectionLabels_Root(lineinfo, section_prefix, label_prefix): + prev_txt = '' + inside_env = 0 + prev_env = '' + outstr = StringIO.StringIO('') + pres_depth = len(section_prefix) + + #print '+getSectionLabels_Root: lineinfo = [%s]' % lineinfo + for line in lineinfo.splitlines(): + if not line: + continue + + # throw away leading white-space + m = re.search('<(.*?)>(.*)', line) + + fname = m.group(1) + line = m.group(2).lstrip() + + # we found a label! + m = re.search(r'\\label{(%s.*?)}' % label_prefix, line) + if m: + # add the current line (except the \label command) to the text + # which will be displayed below this label + prev_txt += re.search(r'(^.*?)\\label{', line).group(1) + + # for the figure environment however, just display the caption. + # instead of everything since the \begin command. + if prev_env == 'figure': + cm = re.search(r'\caption(\[.*?\]\s*)?{(.*?)}', prev_txt) + if cm: + prev_txt = cm.group(2) + + # print a nice formatted text entry like so + # + # > eqn:label + # : e^{i\pi} + 1 = 0 + # + # Use the current "section depth" for the leading indentation. + print >>outstr, '>%s%s\t\t<%s>' % (' '*(2*pres_depth+2), + m.group(1), fname) + print >>outstr, ':%s%s' % (' '*(2*pres_depth+4), prev_txt) + prev_txt = '' + + # If we just encoutered the start or end of an environment or a + # label, then do not remember this line. + # NOTE: This assumes that there is no equation text on the same + # line as the \begin or \end command. The text on the same line as + # the \label was already handled. + if re.search(r'\\begin{(equation|eqnarray|align|figure)', line): + prev_txt = '' + prev_env = re.search(r'\\begin{(.*?)}', line).group(1) + inside_env = 1 + + elif re.search(r'\\label', line): + prev_txt = '' + + elif re.search(r'\\end{(equation|eqnarray|align|figure)', line): + inside_env = 0 + prev_env = '' + + else: + # If we are inside an environment, then the text displayed with + # the label is the complete text within the environment, + # otherwise its just the previous line. + if inside_env: + prev_txt += line + else: + prev_txt = line + + return outstr.getvalue() + +# }}} +# getSectionLabels {{{ +def getSectionLabels(lineinfo, + sectypes=['chapter', 'section', 'subsection', 'subsubsection'], + section_prefix='', label_prefix=''): + + if not sectypes: + return getSectionLabels_Root(lineinfo, section_prefix, label_prefix) + + ##print 'sectypes[0] = %s, section_prefix = [%s], lineinfo = [%s]' % ( + ## sectypes[0], section_prefix, lineinfo) + + sections = re.split(r'(<.*?>\\%s{.*})' % sectypes[0], lineinfo) + + # there will 1+2n sections, the first containing the "preamble" and the + # others containing the child sections as paris of [section_name, + # section_text] + + rettext = getSectionLabels(sections[0], sectypes[1:], section_prefix, label_prefix) + + for i in range(1,len(sections),2): + sec_num = (i+1)/2 + section_name = re.search(r'\\%s{(.*?)}' % sectypes[0], sections[i]).group(1) + section_label_text = getSectionLabels(sections[i] + sections[i+1], sectypes[1:], + section_prefix+('%d.' % sec_num), label_prefix) + + if section_label_text: + sec_heading = 2*' '*len(section_prefix) + section_prefix + sec_heading += '%d. %s' % (sec_num, section_name) + sec_heading += '<<<%d\n' % (len(section_prefix)/2+1) + + rettext += sec_heading + section_label_text + + return rettext + +# }}} + +# main {{{ +def main(fname, label_prefix): + [head, tail] = os.path.split(fname) + if head: + os.chdir(head) + + [root, ext] = os.path.splitext(tail) + contents = getFileContents(root, ext) + nonempty = stripComments(contents) + lineinfo = addFileNameAndNumber(nonempty) + + return getSectionLabels(lineinfo, label_prefix=label_prefix) +# }}} + +if __name__ == "__main__": + if len(sys.argv) > 2: + prefix = sys.argv[2] + else: + prefix = '' + + print main(sys.argv[1], prefix) + + +# vim: fdm=marker diff --git a/vimfiles.latex/ftplugin/latex-suite/packages.vim b/vimfiles.latex/ftplugin/latex-suite/packages.vim new file mode 100644 index 0000000..c3bf2b1 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages.vim @@ -0,0 +1,669 @@ +"============================================================================= +" File: packages.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 06:00 PM 2002 PST +" CVS: $Id: packages.vim 997 2006-03-20 09:45:45Z srinathava $ +" +" Description: handling packages from within vim +"============================================================================= + +" avoid reinclusion. +if !g:Tex_PackagesMenu || exists('s:doneOnce') + finish +endif +let s:doneOnce = 1 + +let s:path = expand("<sfile>:p:h") + +let s:menu_div = 20 + +com! -nargs=0 TPackageUpdate :silent! call Tex_pack_updateall(1) +com! -nargs=0 TPackageUpdateAll :silent! call Tex_pack_updateall(1) + +" Custom command-line completion of Tcommands is very useful but this feature +" is available only in Vim 6.2 and above. Check number of version and choose +" proper command and function. +if v:version >= 602 + com! -complete=custom,Tex_CompletePackageName -nargs=* TPackage let s:retVal = Tex_pack_one(<f-args>) <bar> normal! i<C-r>=s:retVal<CR> + + " Tex_CompletePackageName: for completing names in TPackage command {{{ + " Description: get list of package names with globpath(), remove full path + " and return list of names separated with newlines. + " + function! Tex_CompletePackageName(A,P,L) + " Get name of packages from all runtimepath directories + let packnames = Tex_FindInRtp('', 'packages') + let packnames = substitute(packnames, '^,', '', 'e') + " Separate names with \n not , + let packnames = substitute(packnames,',','\n','g') + return packnames + endfunction + " }}} + +else + com! -nargs=* TPackage let s:retVal = Tex_pack_one(<f-args>) <bar> normal! i<C-r>=s:retVal<CR> + +endif + +imap <silent> <plug> <Nop> +nmap <silent> <plug> i + +let g:Tex_package_supported = '' +let g:Tex_package_detected = '' +" Remember the defaults because we want g:Tex_PromptedEnvironments to contain +" in addition to the default, \newenvironments, and the \newenvironments might +" change... +let g:Tex_PromptedEnvironmentsDefault = g:Tex_PromptedEnvironments +let g:Tex_PromptedCommandsDefault = g:Tex_PromptedCommands + + +" Tex_pack_check: creates the package menu and adds to 'dict' setting. {{{ +" +function! Tex_pack_check(package) + " Use Tex_FindInRtp() function to get first name from packages list in all + " rtp directories conforming with latex-suite directories hierarchy + " Store names in variables to process functions only once. + let packname = Tex_FindInRtp(a:package, 'packages') + if packname != '' + exe 'runtime! ftplugin/latex-suite/packages/' . a:package + if has("gui_running") + call Tex_pack(a:package) + endif + if g:Tex_package_supported !~ a:package + let g:Tex_package_supported = g:Tex_package_supported.','.a:package + endif + endif + " Return full list of dictionaries (separated with ,) for package in &rtp + call Tex_Debug("Tex_pack_check: searching for ".a:package." in dictionaries/ in &rtp", "pack") + let dictname = Tex_FindInRtp(a:package, 'dictionaries', ':p') + if dictname != '' + exe 'setlocal dict^=' . dictname + call Tex_Debug('Tex_pack_check: setlocal dict^=' . dictname, 'pack') + if g:Tex_package_supported !~ a:package + let g:Tex_package_supported = g:Tex_package_supported.','.a:package + endif + endif + if g:Tex_package_detected !~ '\<'.a:package.'\>' + let g:Tex_package_detected = g:Tex_package_detected.','.a:package + endif + let g:Tex_package_detected = substitute(g:Tex_package_detected, '^,', '', '') + let g:Tex_package_supported = substitute(g:Tex_package_supported, '^,', '', '') +endfunction + +" }}} +" Tex_pack_uncheck: removes package from menu and 'dict' settings. {{{ +function! Tex_pack_uncheck(package) + if has("gui_running") && Tex_FindInRtp(a:package, 'packages') != '' + exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.'-sep'.a:package.'-' + exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.a:package.'\ Options' + exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.a:package.'\ Commands' + endif + if Tex_FindInRtp(a:package, 'dictionaries') != '' + exe 'setlocal dict-='.Tex_FindInRtp(a:package, 'dictionaries') + endif +endfunction + +" }}} +" Tex_pack_updateall: updates the TeX-Packages menu {{{ +" Description: +" This function first calls Tex_pack_all to scan for \usepackage's etc if +" necessary. After that, it 'supports' and 'unsupports' packages as needed +" in such a way as to not repeat work. +function! Tex_pack_updateall(force) + call Tex_Debug('+Tex_pack_updateall', 'pack') + + " Find out which file we need to scan. + let fname = Tex_GetMainFileName(':p') + + " If this is the same as last time, don't repeat. + if !a:force && exists('s:lastScannedFile') && + \ s:lastScannedFile == fname + return + endif + " Remember which file we scanned for next time. + let s:lastScannedFile = fname + + " Remember which packages we detected last time. + if exists('g:Tex_package_detected') + let oldpackages = g:Tex_package_detected + else + let oldpackages = '' + endif + + " This sets up a global variable of all detected packages. + let g:Tex_package_detected = '' + " reset the environments and commands. + let g:Tex_PromptedEnvironments = g:Tex_PromptedEnvironmentsDefault + let g:Tex_PromptedCommands = g:Tex_PromptedCommandsDefault + + if expand('%:p') != fname + call Tex_Debug(':Tex_pack_updateall: sview '.Tex_EscapeSpaces(fname), 'pack') + exe 'sview '.Tex_EscapeSpaces(fname) + else + call Tex_Debug(':Tex_pack_updateall: split', 'pack') + split + endif + + call Tex_ScanForPackages() + q + + call Tex_Debug(':Tex_pack_updateall: detected ['.g:Tex_package_detected.'] in first run', 'pack') + + " Now for each package find out if this is a custom package and if so, + " scan that as well. We will use the ':find' command in vim to let vim + " search through the file paths for us. + " + " NOTE: This while loop will also take into account packages included + " within packages to any level of recursion as long as + " g:Tex_package_detected is always padded with new package names + " from the end. + " + " First set the &path setting to the user's TEXINPUTS setting. + let _path = &path + let _suffixesadd = &suffixesadd + + let &path = '.,'.g:Tex_TEXINPUTS + let &suffixesadd = '.sty,.tex' + + let scannedPackages = '' + + let i = 1 + let packname = Tex_Strntok(g:Tex_package_detected, ',', i) + while packname != '' + + call Tex_Debug(':Tex_pack_updateall: scanning package '.packname, 'pack') + + " Scan this package only if we have not scanned it before in this + " run. + if scannedPackages =~ '\<'.packname.'\>' + let i = i + 1 + + call Tex_Debug(':Tex_pack_updateall: '.packname.' already scanned', 'pack') + let packname = Tex_Strntok(g:Tex_package_detected, ',', i) + continue + endif + + " Split this window in two. The packages/files being found will open + " in this new window and we also need not bother with files being + " modified etc. + split + + call Tex_Debug(':Tex_pack_updateall: silent! find '.Tex_EscapeSpaces(packname).'.sty', 'pack') + let thisbufnum = bufnr('%') + exec 'silent! find '.Tex_EscapeSpaces(packname).'.sty' + call Tex_Debug(':Tex_pack_updateall: present file = '.bufname('%'), 'pack') + + " If this file was not found, assume that it means its not a + " custom package and mark it "scanned". + " A package is not found if we stay in the same buffer as before and + " its not the one where we want to go. + if bufnr('%') == thisbufnum && bufnr('%') != bufnr(packname.'.sty') + let scannedPackages = scannedPackages.','.packname + q + + call Tex_Debug(':Tex_pack_updateall: '.packname.' not found anywhere', 'pack') + let i = i + 1 + let packname = Tex_Strntok(g:Tex_package_detected, ',', i) + continue + endif + + " otherwise we are presently editing a custom package, scan it for + " more \usepackage lines from the first line to the last. + let packpath = expand('%:p') + let &complete = &complete.'s'.packpath + + call Tex_Debug(':Tex_pack_updateall: found custom package '.packpath, 'pack') + call Tex_ScanForPackages(line('$'), line('$')) + call Tex_Debug(':Tex_pack_updateall: After scanning, g:Tex_package_detected = '.g:Tex_package_detected, 'pack') + + let scannedPackages = scannedPackages.','.packname + " Do not use bwipe, but that leads to excessive buffer number + " consumption. Besides, its intuitive for a custom package to remain + " on the buffer list. + q + + let i = i + 1 + let packname = Tex_Strntok(g:Tex_package_detected, ',', i) + endwhile + + let &path = _path + let &suffixesadd = _suffixesadd + + " Now only support packages we didn't last time. + " First remove packages which were used last time but are no longer used. + let i = 1 + let oldPackName = Tex_Strntok(oldpackages, ',', i) + while oldPackName != '' + if g:Tex_package_detected !~ oldPackName + call Tex_pack_uncheck(oldPackName) + endif + let i = i + 1 + let oldPackName = Tex_Strntok(oldpackages, ',', i) + endwhile + + " Then support packages which are used this time but weren't used last + " time. + let i = 1 + let newPackName = Tex_Strntok(g:Tex_package_detected, ',', i) + while newPackName != '' + if oldpackages !~ newPackName + call Tex_pack_one(newPackName) + endif + let i = i + 1 + let newPackName = Tex_Strntok(g:Tex_package_detected, ',', i) + endwhile + + " Throw an event that we are done scanning packages. Some packages might + " use this to change behavior based on which options have been used etc. + call Tex_Debug(":Tex_pack_updateall: throwing LatexSuiteScannedPackages event", "pack") + silent! do LatexSuite User LatexSuiteScannedPackages + + call Tex_Debug("-Tex_pack_updateall", "pack") +endfunction + +" }}} +" Tex_pack_one: supports each package in the argument list.{{{ +" Description: +" If no arguments are supplied, then the user is asked to choose from the +" packages found in the packages/ directory +function! Tex_pack_one(...) + if a:0 == 0 || (a:0 > 0 && a:1 == '') + let packlist = Tex_FindInRtp('', 'packages') + let packname = Tex_ChooseFromPrompt( + \ "Choose a package: \n" . + \ Tex_CreatePrompt(packlist, '3', ',') . + \ "\nEnter number or filename :", + \ packlist, ',') + if packname != '' + return Tex_pack_one(packname) + else + return '' + endif + else + " Support the packages supplied. This function can be called with + " multiple arguments in which case, support each of them in turn. + let retVal = '' + let omega = 1 + while omega <= a:0 + let packname = a:{omega} + if Tex_FindInRtp(packname, 'packages') != '' + call Tex_pack_check(packname) + if exists('g:TeX_package_option_'.packname) + \ && g:TeX_package_option_{packname} != '' + let retVal = retVal.'\usepackage[<++>]{'.packname.'}<++>' + else + let retVal = retVal.'\usepackage{'.packname.'}'."\<CR>" + endif + else + let retVal = retVal.'\usepackage{'.packname.'}'."\<CR>" + endif + let omega = omega + 1 + endwhile + return IMAP_PutTextWithMovement(substitute(retVal, "\<CR>$", '', ''), '<+', '+>') + endif +endfunction +" }}} +" Tex_ScanForPackages: scans the current file for \usepackage{} lines {{{ +" and if supported, loads the options and commands found in the +" corresponding package file. Also scans for \newenvironment and +" \newcommand lines and adds names to g:Tex_Prompted variables, they can be +" easy available through <F5> and <F7> shortcuts +function! Tex_ScanForPackages(...) + call Tex_Debug("+Tex_ScanForPackages", "pack") + + let pos = line('.').' | normal! '.virtcol('.').'|' + + " For package files without \begin and \end{document}, we might be told to + " search from beginning to end. + if a:0 < 2 + 0 + let beginline = search('\\begin{document}', 'W') + let endline = search('\\end{document}', 'W') + 0 + else + let beginline = a:1 + let endline = a:2 + endif + + call Tex_Debug(":Tex_ScanForPackages: Begining scans in [".bufname('%')."], beginline = ".beginline, "pack") + + + " Scan the file. First open up all the folds, because the command + " /somepattern + " issued in a closed fold _always_ goes to the first match. + let erm = v:errmsg + silent! normal! ggVGzO + let v:errmsg = erm + + call Tex_Debug(":Tex_ScanForPackages: beginning scan for \\usepackage lines", "pack") + " The wrap trick enables us to match \usepackage on the first line as + " well. + let wrap = 'w' + while search('^\s*\\usepackage\_.\{-}{\_.\+}', wrap) + let wrap = 'W' + + if line('.') > beginline + break + endif + + let saveA = @a + + " If there are options, then find those. + if getline('.') =~ '\\usepackage\[.\{-}\]' + let options = matchstr(getline('.'), '\\usepackage\[\zs.\{-}\ze\]') + elseif getline('.') =~ '\\usepackage\[' + " Entering here means that the user has split the \usepackage + " across newlines. Therefore, use yank. + exec "normal! /{\<CR>\"ayi}" + let options = @a + else + let options = '' + endif + + " The following statement puts the stuff between the { }'s of a + " \usepackage{stuff,foo} into @a. Do not use matchstr() and the like + " because we can have things split across lines and such. + exec "normal! /{\<CR>\"ay/}\<CR>" + + " now remove all whitespace from @a. We need to remove \n and \r + " because we can encounter stuff like + " \usepackage{pack1, + " newpackonanotherline} + let @a = substitute(@a, "[ \t\n\r]", '', 'g') + + " Now we have something like pack1,pack2,pack3 with possibly commas + " and stuff before the first package and after the last package name. + " Remove those. + let @a = substitute(@a, '\(^\W*\|\W*$\)', '', 'g') + + " This gets us a string like 'pack1,pack2,pack3' + " TODO: This will contain duplicates if the user has duplicates. + " Should we bother taking care of this? + let g:Tex_package_detected = g:Tex_package_detected.','.@a + + " For each package found, form a global variable of the form + " g:Tex_{packagename}_options + " which contains a list of the options. + let j = 1 + while Tex_Strntok(@a, ',', j) != '' + let g:Tex_{Tex_Strntok(@a, ',', j)}_options = options + let j = j + 1 + endwhile + + " Finally convert @a into something like '"pack1","pack2"' + let @a = substitute(@a, '^\|$', '"', 'g') + let @a = substitute(@a, ',', '","', 'g') + + call Tex_Debug(":Tex_ScanForPackages: found package(s) [".@a."] on line ".line('.'), "pack") + + " restore @a + let @a = saveA + endwhile + call Tex_Debug(":Tex_ScanForPackages: End scan \\usepackage, detected packages = ".g:Tex_package_detected, "pack") + + " TODO: This needs to be changed. In the future, we might have + " functionality to remember the fold-state before opening up all the folds + " and then re-creating them. Use mkview.vim. + let erm = v:errmsg + silent! normal! ggVGzC + let v:errmsg = erm + + " Because creating list of detected packages gives string + " ',pack1,pack2,pack3' remove leading , + let g:Tex_package_detected = substitute(g:Tex_package_detected, '^,', '', '') + + call Tex_Debug(":Tex_ScanForPackages: Beginning scan for \\newcommand's", "pack") + " Scans whole file (up to \end{document}) for \newcommand and adds this + " commands to g:Tex_PromptedCommands variable, it is easily available + " through <F7> + 0 + while search('^\s*\\newcommand\*\?{.\{-}}', 'W') + + if line('.') > endline + break + endif + + let newcommand = matchstr(getline('.'), '\\newcommand\*\?{\\\zs.\{-}\ze}') + let g:Tex_PromptedCommands = g:Tex_PromptedCommands . ',' . newcommand + + endwhile + + " Scans whole file (up to \end{document}) for \newenvironment and adds this + " environments to g:Tex_PromptedEnvironments variable, it is easily available + " through <F5> + 0 + call Tex_Debug(":Tex_ScanForPackages: Beginning scan for \\newenvironment's", 'pack') + + while search('^\s*\\newenvironment\*\?{.\{-}}', 'W') + call Tex_Debug('found newenvironment on '.line('.'), 'pack') + + if line('.') > endline + break + endif + + let newenvironment = matchstr(getline('.'), '\\newenvironment\*\?{\zs.\{-}\ze}') + let g:Tex_PromptedEnvironments = g:Tex_PromptedEnvironments . ',' . newenvironment + + endwhile + + exe pos + " first make a random search so that we push at least one item onto the + " search history. Since vim puts only one item in the history per function + " call, this way we make sure that one and only item is put into the + " search history. + normal! /^<CR> + " now delete it... + call histdel('/', -1) + + call Tex_Debug("-Tex_ScanForPackages", "pack") +endfunction + +" }}} +" Tex_pack_supp_menu: sets up a menu for package files {{{ +" found in the packages directory groups the packages thus found into groups +" of 20... +function! Tex_pack_supp_menu() + let suplist = Tex_FindInRtp('', 'packages') + + call Tex_MakeSubmenu(suplist, g:Tex_PackagesMenuLocation.'Supported.', + \ '<plug><C-r>=Tex_pack_one("', '")<CR>') +endfunction + +" }}} +" Tex_pack: loads the options (and commands) for the given package {{{ +function! Tex_pack(pack) + if exists('g:TeX_package_'.a:pack) + + let optionList = g:TeX_package_option_{a:pack}.',' + let commandList = g:TeX_package_{a:pack}.',' + + " Don't create separator if in package file are only Vim commands. + " Rare but possible. + if !(commandList == ',' && optionList == ',') + exec 'amenu '.g:Tex_PackagesMenuLocation.'-sep'.a:pack.'- <Nop>' + endif + + if optionList != '' + + let mainMenuName = g:Tex_PackagesMenuLocation.a:pack.'\ Options.' + call s:GroupPackageMenuItems(optionList, mainMenuName, + \ '<plug><C-r>=IMAP_PutTextWithMovement("', ',")<CR>') + + endif + + if commandList != '' + + let mainMenuName = g:Tex_PackagesMenuLocation.a:pack.'\ Commands.' + call s:GroupPackageMenuItems(commandList, mainMenuName, + \ '<plug><C-r>=Tex_ProcessPackageCommand("', '")<CR>', + \ '<SID>FilterPackageMenuLHS') + endif + endif +endfunction + +" }}} + +" ============================================================================== +" Menu Functions +" Creating menu items for the all the package files found in the packages/ +" directory as well as creating menus for each supported package found in the +" preamble. +" ============================================================================== +" Tex_MakeSubmenu: makes a submenu given a list of items {{{ +" Description: +" This function takes a comma seperated list of menu items and creates a +" 'grouped' menu. i.e, it groups the items into s:menu_div items each and +" puts them in submenus of the given mainMenu. +" Each menu item is linked to the HandlerFunc. +" If an additional argument is supplied, then it is used to filter each of +" the menu items to generate better names for the menu display. +" +function! Tex_MakeSubmenu(menuList, mainMenuName, + \ handlerFuncLHS, handlerFuncRHS, ...) + + let extractFunction = (a:0 > 0 ? a:1 : '' ) + let menuList = substitute(a:menuList, '[^,]$', ',', '') + + let doneMenuSubmenu = 0 + + while menuList != '' + + " Extract upto s:menu_div menus at once. + let menuBunch = matchstr(menuList, '\v(.{-},){,'.s:menu_div.'}') + + " The remaining menus go into the list. + let menuList = strpart(menuList, strlen(menuBunch)) + + let submenu = '' + " If there is something remaining, then we got s:menu_div items. + " therefore put these menu items into a submenu. + if strlen(menuList) || doneMenuSubmenu + exec 'let firstMenu = '.extractFunction."(matchstr(menuBunch, '\\v^.{-}\\ze,'))" + exec 'let lastMenu = '.extractFunction."(matchstr(menuBunch, '\\v[^,]{-}\\ze,$'))" + + let submenu = firstMenu.'\ \-\ '.lastMenu.'.' + + let doneMenuSubmenu = 1 + endif + + " Now for each menu create a menu under the submenu + let i = 1 + let menuName = Tex_Strntok(menuBunch, ',', i) + while menuName != '' + exec 'let menuItem = '.extractFunction.'(menuName)' + execute 'amenu '.a:mainMenuName.submenu.menuItem + \ ' '.a:handlerFuncLHS.menuName.a:handlerFuncRHS + + let i = i + 1 + let menuName = Tex_Strntok(menuBunch, ',', i) + endwhile + endwhile +endfunction + +" }}} +" GroupPackageMenuItems: uses the sbr: to split menus into groups {{{ +" Description: +" This function first splits up the menuList into groups based on the +" special sbr: tag and then calls Tex_MakeSubmenu +" +function! <SID>GroupPackageMenuItems(menuList, menuName, + \ handlerFuncLHS, handlerFuncRHS,...) + + if a:0 > 0 + let extractFunction = a:1 + else + let extractFunction = '' + endif + let menuList = a:menuList + + while matchstr(menuList, 'sbr:') != '' + let groupName = matchstr(menuList, '\v^sbr:\zs.{-}\ze,') + let menuList = strpart(menuList, strlen('sbr:'.groupName.',')) + if matchstr(menuList, 'sbr:') != '' + let menuGroup = matchstr(menuList, '\v^.{-},\zesbr:') + else + let menuGroup = menuList + endif + + call Tex_MakeSubmenu(menuGroup, a:menuName.groupName.'.', + \ a:handlerFuncLHS, a:handlerFuncRHS, extractFunction) + + let menuList = strpart(menuList, strlen(menuGroup)) + endwhile + + call Tex_MakeSubmenu(menuList, a:menuName, + \ a:handlerFuncLHS, a:handlerFuncRHS, extractFunction) + +endfunction " }}} +" Definition of what to do for various package commands {{{ +let s:CommandSpec_bra = '\<+replace+>{<++>}<++>' +let s:CommandSpec_brs = '\<+replace+><++>' +let s:CommandSpec_brd = '\<+replace+>{<++>}{<++>}<++>' +let s:CommandSpec_env = '\begin{<+replace+>}'."\<CR><++>\<CR>".'\end{<+replace+>}<++>' +let s:CommandSpec_ens = '\begin{<+replace+>}<+extra+>'."\<CR><++>\<CR>".'\end{<+replace+>}<++>' +let s:CommandSpec_eno = '\begin[<++>]{<+replace+>}'."\<CR><++>\<CR>".'\end{<+replace+>}' +let s:CommandSpec_nor = '\<+replace+>' +let s:CommandSpec_noo = '\<+replace+>[<++>]' +let s:CommandSpec_nob = '\<+replace+>[<++>]{<++>}{<++>}<++>' +let s:CommandSpec_spe = '<+replace+>' +let s:CommandSpec_ = '\<+replace+>' + +let s:MenuLHS_bra = '\\&<+replace+>{}' +let s:MenuLHS_brs = '\\&<+replace+>{}' +let s:MenuLHS_brd = '\\&<+replace+>{}{}' +let s:MenuLHS_env = '&<+replace+>\ (E)' +let s:MenuLHS_ens = '&<+replace+>\ (E)' +let s:MenuLHS_eno = '&<+replace+>\ (E)' +let s:MenuLHS_nor = '\\&<+replace+>' +let s:MenuLHS_noo = '\\&<+replace+>[]' +let s:MenuLHS_nob = '\\&<+replace+>[]{}{}' +let s:MenuLHS_spe = '&<+replace+>' +let s:MenuLHS_sep = '-sep<+replace+>-' +let s:MenuLHS_ = '\\&<+replace+>' +" }}} +" Tex_ProcessPackageCommand: processes a command from the package menu {{{ +" Description: +function! Tex_ProcessPackageCommand(command) + if a:command =~ ':' + let commandType = matchstr(a:command, '^\w\+\ze:') + let commandName = matchstr(a:command, '^\w\+:\zs[^:]\+\ze:\?') + let extrapart = strpart(a:command, strlen(commandType.':'.commandName.':')) + else + let commandType = '' + let commandName = a:command + let extrapart = '' + endif + + let command = s:CommandSpec_{commandType} + let command = substitute(command, '<+replace+>', commandName, 'g') + let command = substitute(command, '<+extra+>', extrapart, 'g') + return IMAP_PutTextWithMovement(command) +endfunction +" }}} +" FilterPackageMenuLHS: filters the command description to provide a better menu item {{{ +" Description: +function! <SID>FilterPackageMenuLHS(command) + let commandType = matchstr(a:command, '^\w\+\ze:') + if commandType != '' + let commandName = strpart(a:command, strlen(commandType.':')) + else + let commandName = a:command + endif + + return substitute(s:MenuLHS_{commandType}, '<+replace+>', commandName, 'g') +endfunction " }}} + +if g:Tex_Menus + exe 'amenu '.g:Tex_PackagesMenuLocation.'&UpdatePackage :call Tex_pack(expand("<cword>"))<cr>' + exe 'amenu '.g:Tex_PackagesMenuLocation.'&UpdateAll :call Tex_pack_updateall(1)<cr>' + + call Tex_pack_supp_menu() +endif + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('packages.vim: Catching LatexSuiteFileType event', 'pack') | + \ call Tex_pack_updateall(0) +augroup END + +" vim:fdm=marker:ts=4:sw=4:noet:ff=unix diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/SIunits b/vimfiles.latex/ftplugin/latex-suite/packages/SIunits new file mode 100644 index 0000000..ba110fa --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/SIunits @@ -0,0 +1,315 @@ +if exists("SIunits_package_file") + finish +endif +let SIunits_package_file = 1 + +let g:TeX_package_SIunits = +\'nor:addprefix,'. +\'nor:addunit,'. +\'nor:ampere,'. +\'nor:amperemetresecond,'. +\'nor:amperepermetre,'. +\'nor:amperepermetrenp,'. +\'nor:amperepersquaremetre,'. +\'nor:amperepersquaremetrenp,'. +\'nor:angstrom,'. +\'nor:arad,'. +\'nor:arcminute,'. +\'nor:arcsecond,'. +\'nor:are,'. +\'nor:atomicmass,'. +\'nor:atto,'. +\'nor:attod,'. +\'nor:barn,'. +\'nor:bbar,'. +\'nor:becquerel,'. +\'nor:becquerelbase,'. +\'nor:bel,'. +\'nor:candela,'. +\'nor:candelapersquaremetre,'. +\'nor:candelapersquaremetrenp,'. +\'nor:celsius,'. +\'nor:Celsius,'. +\'nor:celsiusbase,'. +\'nor:centi,'. +\'nor:centid,'. +\'nor:coulomb,'. +\'nor:coulombbase,'. +\'nor:coulombpercubicmetre,'. +\'nor:coulombpercubicmetrenp,'. +\'nor:coulombperkilogram,'. +\'nor:coulombperkilogramnp,'. +\'nor:coulombpermol,'. +\'nor:coulombpermolnp,'. +\'nor:coulombpersquaremetre,'. +\'nor:coulombpersquaremetrenp,'. +\'nor:cubed,'. +\'nor:cubic,'. +\'nor:cubicmetre,'. +\'nor:cubicmetreperkilogram,'. +\'nor:cubicmetrepersecond,'. +\'nor:curie,'. +\'nor:dday,'. +\'nor:deca,'. +\'nor:decad,'. +\'nor:deci,'. +\'nor:decid,'. +\'nor:degree,'. +\'nor:degreecelsius,'. +\'nor:deka,'. +\'nor:dekad,'. +\'nor:derbecquerel,'. +\'nor:dercelsius,'. +\'nor:dercoulomb,'. +\'nor:derfarad,'. +\'nor:dergray,'. +\'nor:derhenry,'. +\'nor:derhertz,'. +\'nor:derjoule,'. +\'nor:derkatal,'. +\'nor:derlumen,'. +\'nor:derlux,'. +\'nor:dernewton,'. +\'nor:derohm,'. +\'nor:derpascal,'. +\'nor:derradian,'. +\'nor:dersiemens,'. +\'nor:dersievert,'. +\'nor:dersteradian,'. +\'nor:dertesla,'. +\'nor:dervolt,'. +\'nor:derwatt,'. +\'nor:derweber,'. +\'nor:electronvolt,'. +\'nor:exa,'. +\'nor:exad,'. +\'nor:farad,'. +\'nor:faradbase,'. +\'nor:faradpermetre,'. +\'nor:faradpermetrenp,'. +\'nor:femto,'. +\'nor:femtod,'. +\'nor:fourth,'. +\'nor:gal,'. +\'nor:giga,'. +\'nor:gigad,'. +\'nor:gram,'. +\'nor:graybase,'. +\'nor:graypersecond,'. +\'nor:graypersecondnp,'. +\'nor:hectare,'. +\'nor:hecto,'. +\'nor:hectod,'. +\'nor:henry,'. +\'nor:henrybase,'. +\'nor:henrypermetre,'. +\'nor:henrypermetrenp,'. +\'nor:hertz,'. +\'nor:hertzbase,'. +\'nor:hour,'. +\'nor:joule,'. +\'nor:joulebase,'. +\'nor:joulepercubicmetre,'. +\'nor:joulepercubicmetrenp,'. +\'nor:jouleperkelvin,'. +\'nor:jouleperkelvinnp,'. +\'nor:jouleperkilogram,'. +\'nor:jouleperkilogramkelvin,'. +\'nor:jouleperkilogramkelvinnp,'. +\'nor:jouleperkilogramnp,'. +\'nor:joulepermole,'. +\'nor:joulepermolekelvin,'. +\'nor:joulepermolekelvinnp,'. +\'nor:joulepermolenp,'. +\'nor:joulepersquaremetre,'. +\'nor:joulepersquaremetrenp,'. +\'nor:joulepertesla,'. +\'nor:jouleperteslanp,'. +\'nor:katal,'. +\'nor:katalbase,'. +\'nor:katalpercubicmetre,'. +\'nor:katalpercubicmetrenp,'. +\'nor:kelvin,'. +\'nor:kilo,'. +\'nor:kilod,'. +\'nor:kilogram,'. +\'nor:kilogrammetrepersecond,'. +\'nor:kilogrammetrepersecondnp,'. +\'nor:kilogrammetrepersquaresecond,'. +\'nor:kilogrammetrepersquaresecondnp,'. +\'nor:kilogrampercubicmetre,'. +\'nor:kilogrampercubicmetrecoulomb,'. +\'nor:kilogrampercubicmetrecoulombnp,'. +\'nor:kilogrampercubicmetrenp,'. +\'nor:kilogramperkilomole,'. +\'nor:kilogramperkilomolenp,'. +\'nor:kilogrampermetre,'. +\'nor:kilogrampermetrenp,'. +\'nor:kilogrampersecond,'. +\'nor:kilogrampersecondcubicmetre,'. +\'nor:kilogrampersecondcubicmetrenp,'. +\'nor:kilogrampersecondnp,'. +\'nor:kilogrampersquaremetre,'. +\'nor:kilogrampersquaremetrenp,'. +\'nor:kilogrampersquaremetresecond,'. +\'nor:kilogrampersquaremetresecondnp,'. +\'nor:kilogramsquaremetre,'. +\'nor:kilogramsquaremetrenp,'. +\'nor:kilogramsquaremetrepersecond,'. +\'nor:kilogramsquaremetrepersecondnp,'. +\'nor:kilowatthour,'. +\'nor:liter,'. +\'nor:litre,'. +\'nor:lumen,'. +\'nor:lumenbase,'. +\'nor:lux,'. +\'nor:luxbase,'. +\'nor:mega,'. +\'nor:megad,'. +\'nor:meter,'. +\'nor:metre,'. +\'nor:metrepersecond,'. +\'nor:metrepersecondnp,'. +\'nor:metrepersquaresecond,'. +\'nor:metrepersquaresecondnp,'. +\'nor:micro,'. +\'nor:microd,'. +\'nor:milli,'. +\'nor:millid,'. +\'nor:minute,'. +\'nor:mole,'. +\'nor:molepercubicmetre,'. +\'nor:molepercubicmetrenp,'. +\'nor:nano,'. +\'nor:nanod,'. +\'nor:neper,'. +\'nor:newton,'. +\'nor:newtonbase,'. +\'nor:newtonmetre,'. +\'nor:newtonpercubicmetre,'. +\'nor:newtonpercubicmetrenp,'. +\'nor:newtonperkilogram,'. +\'nor:newtonperkilogramnp,'. +\'nor:newtonpermetre,'. +\'nor:newtonpermetrenp,'. +\'nor:newtonpersquaremetre,'. +\'nor:newtonpersquaremetrenp,'. +\'nor:NoAMS,'. +\'nor:no@qsk,'. +\'nor:ohm,'. +\'nor:ohmbase,'. +\'nor:ohmmetre,'. +\'nor:one,'. +\'nor:paminute,'. +\'nor:pascal,'. +\'nor:pascalbase,'. +\'nor:pascalsecond,'. +\'nor:pasecond,'. +\'nor:per,'. +\'nor:period@active,'. +\'nor:persquaremetresecond,'. +\'nor:persquaremetresecondnp,'. +\'nor:peta,'. +\'nor:petad,'. +\'nor:pico,'. +\'nor:picod,'. +\'nor:power,'. +\'nor:@qsk,'. +\'nor:quantityskip,'. +\'nor:rad,'. +\'nor:radian,'. +\'nor:radianbase,'. +\'nor:radianpersecond,'. +\'nor:radianpersecondnp,'. +\'nor:radianpersquaresecond,'. +\'nor:radianpersquaresecondnp,'. +\'nor:reciprocal,'. +\'nor:rem,'. +\'nor:roentgen,'. +\'nor:rp,'. +\'nor:rpcubed,'. +\'nor:rpcubic,'. +\'nor:rpcubicmetreperkilogram,'. +\'nor:rpcubicmetrepersecond,'. +\'nor:rperminute,'. +\'nor:rpersecond,'. +\'nor:rpfourth,'. +\'nor:rpsquare,'. +\'nor:rpsquared,'. +\'nor:rpsquaremetreperkilogram,'. +\'nor:second,'. +\'nor:siemens,'. +\'nor:siemensbase,'. +\'nor:sievert,'. +\'nor:sievertbase,'. +\'nor:square,'. +\'nor:squared,'. +\'nor:squaremetre,'. +\'nor:squaremetrepercubicmetre,'. +\'nor:squaremetrepercubicmetrenp,'. +\'nor:squaremetrepercubicsecond,'. +\'nor:squaremetrepercubicsecondnp,'. +\'nor:squaremetreperkilogram,'. +\'nor:squaremetrepernewtonsecond,'. +\'nor:squaremetrepernewtonsecondnp,'. +\'nor:squaremetrepersecond,'. +\'nor:squaremetrepersecondnp,'. +\'nor:squaremetrepersquaresecond,'. +\'nor:squaremetrepersquaresecondnp,'. +\'nor:steradian,'. +\'nor:steradianbase,'. +\'nor:tera,'. +\'nor:terad,'. +\'nor:tesla,'. +\'nor:teslabase,'. +\'nor:ton,'. +\'nor:tonne,'. +\'nor:unit,'. +\'nor:unitskip,'. +\'nor:usk,'. +\'nor:volt,'. +\'nor:voltbase,'. +\'nor:voltpermetre,'. +\'nor:voltpermetrenp,'. +\'nor:watt,'. +\'nor:wattbase,'. +\'nor:wattpercubicmetre,'. +\'nor:wattpercubicmetrenp,'. +\'nor:wattperkilogram,'. +\'nor:wattperkilogramnp,'. +\'nor:wattpermetrekelvin,'. +\'nor:wattpermetrekelvinnp,'. +\'nor:wattpersquaremetre,'. +\'nor:wattpersquaremetrenp,'. +\'nor:wattpersquaremetresteradian,'. +\'nor:wattpersquaremetresteradiannp,'. +\'nor:weber,'. +\'nor:weberbase,'. +\'nor:yocto,'. +\'nor:yoctod,'. +\'nor:yotta,'. +\'nor:yottad,'. +\'nor:zepto,'. +\'nor:zeptod,'. +\'nor:zetta,'. +\'nor:zettad' + +let g:TeX_package_option_SIunits = +\'amssymb,'. +\'binary,'. +\'cdot,'. +\'derived,'. +\'derivedinbase,'. +\'Gray,'. +\'mediumqspace,'. +\'mediumspace,'. +\'noams,'. +\'pstricks,'. +\'squaren,'. +\'textstyle,'. +\'thickqspace,'. +\'thickspace,'. +\'thinqspace,'. +\'thinspace' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/accents b/vimfiles.latex/ftplugin/latex-suite/packages/accents new file mode 100644 index 0000000..706d95e --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/accents @@ -0,0 +1,28 @@ +if exists("accents_package_file") + finish +endif +let accents_package_file = 1 + +let g:TeX_package_option_accents = +\ 'nonscript,' +\.'single' + +let g:TeX_package_accents = +\ 'bra:grave,' +\.'bra:acute,' +\.'bra:check,' +\.'bra:breve,' +\.'bra:bar,' +\.'bra:ring,' +\.'bra:hat,' +\.'bra:dot,' +\.'bra:tilde,' +\.'bra:undertilde,' +\.'bra:ddot,' +\.'bra:dddot,' +\.'bra:ddddot,' +\.'bra:vec,' +\.'brd:accentset,' +\.'brd:underaccent' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/acromake b/vimfiles.latex/ftplugin/latex-suite/packages/acromake new file mode 100644 index 0000000..2130f61 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/acromake @@ -0,0 +1,10 @@ +if exists("acromake_package_file") + finish +endif +let acromake_package_file = 1 + +let g:TeX_package_option_acromake = '' + +let g:TeX_package_acromake = 'brs:acromake{<++>}{<++>}{<++>}' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/afterpage b/vimfiles.latex/ftplugin/latex-suite/packages/afterpage new file mode 100644 index 0000000..5087321 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/afterpage @@ -0,0 +1,10 @@ +if exists("afterpage_package_file") + finish +endif +let afterpage_package_file = 1 + +let g:TeX_package_option_afterpage = '' + +let g:TeX_package_afterpage = 'bra:afterpage' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/alltt b/vimfiles.latex/ftplugin/latex-suite/packages/alltt new file mode 100644 index 0000000..c30b684 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/alltt @@ -0,0 +1,12 @@ +if exists("alltt_package_file") + finish +endif +let alltt_package_file = 1 + +let g:TeX_package_option_alltt = '' + +let g:TeX_package_alltt = 'env:alltt' + +syn region texZone start="\\begin{alltt}" end="\\end{alltt}\|%stopzone\>" fold + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/amsmath b/vimfiles.latex/ftplugin/latex-suite/packages/amsmath new file mode 100644 index 0000000..fd7dcda --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/amsmath @@ -0,0 +1,106 @@ +if exists("amsmath_package_file") + finish +endif +let amsmath_package_file = 1 + +let g:TeX_package_option_amsmath = +\ 'centertags,' +\.'tbtags,' +\.'sumlimits,' +\.'nosumlimits,' +\.'intlimits,' +\.'nointlimits,' +\.'namelimits,' +\.'nonamelimits,' +\.'leqno,' +\.'reqno,' +\.'fleqno' + +let g:TeX_package_amsmath = +\ 'sbr:Environments,' +\.'env:equation,' +\.'env:equation*,' +\.'env:align,' +\.'env:align*,' +\.'env:gather,' +\.'env:gather*,' +\.'env:flalign,' +\.'env:flalign*,' +\.'env:multline,' +\.'env:multline*,' +\.'ens:alignat:{<+arg1+>}{<+arg2+>},' +\.'env:alignat,' +\.'ens:alignat*:{<+arg1+>}{<+arg2+>},,' +\.'env:alignat*,' +\.'env:subequations,' +\.'env:subarray,' +\.'env:split,' +\.'env:cases,' +\.'sbr:Matrices,' +\.'env:matrix,' +\.'env:pmatrix,' +\.'env:bmatrix,' +\.'env:Bmatrix,' +\.'env:vmatrix,' +\.'env:Vmatrix,' +\.'env:smallmatrix,' +\.'bra:hdotsfor,' +\.'sbr:Dots,' +\.'dotsc,' +\.'dotsb,' +\.'dotsm,' +\.'dotsi,' +\.'dotso,' +\.'sbr:ItalicGreek,' +\.'nor:varGamma,' +\.'nor:varDelta,' +\.'nor:varTheta,' +\.'nor:varLambda,' +\.'nor:varXi,' +\.'nor:varPi,' +\.'nor:varSigma,' +\.'nor:varUpsilon,' +\.'nor:varPhi,' +\.'nor:varPsi,' +\.'nor:varOmega,' +\.'sbr:Mod,' +\.'nor:mod,' +\.'nor:bmod,' +\.'nor:pmod,' +\.'nor:pod,' +\.'sbr:CreatingSymbols,' +\.'brd:overset,' +\.'brd:underset,' +\.'brd:sideset,' +\.'sbr:Fractions,' +\.'brd:frac,' +\.'brd:dfrac,' +\.'brd:tfrac,' +\.'brd:cfrac,' +\.'brd:binom,' +\.'brd:dbinom,' +\.'brd:tbinom,' +\.'brs:genfrac{<+ldelim+>}{<+rdelim+>}{<+thick+>}{<+style+>}{<+numer+>}{<+denom+>},' +\.'sbr:Commands,' +\.'nob:smash,' +\.'bra:substack,' +\.'bra:tag,' +\.'bra:tag*,' +\.'nor:notag,' +\.'bra:raisetag,' +\.'bra:shoveleft,' +\.'bra:shoveright,' +\.'bra:intertext,' +\.'bra:text,' +\.'nor:displaybreak,' +\.'noo:displaybreak,' +\.'noo:allowdisplaybreaks,' +\.'nor:nobreakdash,' +\.'brs:numberwithin{<+env+>}{<+parent+>},' +\.'bra:leftroot,' +\.'bra:uproot,' +\.'bra:boxed,' +\.'brs:DeclareMathSymbol{<++>}{<++>}{<++>}{<++>},' +\.'bra:eqref' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/amsthm b/vimfiles.latex/ftplugin/latex-suite/packages/amsthm new file mode 100644 index 0000000..6bae018 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/amsthm @@ -0,0 +1,21 @@ +if exists("amsthm_package_file") + finish +endif +let amsthm_package_file = 1 + +let TeX_package_option_amsthm = '' + +let TeX_package_amsthm = +\ 'env:proof,' +\.'nor:swapnumbers,' +\.'brd:newtheorem,' +\.'brd:newtheorem*,' +\.'nor:theoremstyle{plain},' +\.'nor:theoremstyle{definition},' +\.'nor:theoremstyle{remark},' +\.'nor:newtheoremstyle,' +\.'nor:qedsymbol,' +\.'nor:qed,' +\.'nor:qedhere' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/amsxtra b/vimfiles.latex/ftplugin/latex-suite/packages/amsxtra new file mode 100644 index 0000000..3875cc3 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/amsxtra @@ -0,0 +1,12 @@ +if exists("amsxtra_package_file") + finish +endif +let amsxtra_package_file = 1 + +let g:TeX_package_option_amsxtra = '' + +let g:TeX_package_amsxtra = +\ 'nor:sphat,' +\.'nor:sptilde' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/arabic b/vimfiles.latex/ftplugin/latex-suite/packages/arabic new file mode 100644 index 0000000..46f8314 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/arabic @@ -0,0 +1,10 @@ +if exists("arabic_package_file") + finish +endif +let arabic_package_file = 1 + +let g:TeX_package_option_arabic = '' + +let g:TeX_package_arabic = 'bra:arabicnumeral' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/array b/vimfiles.latex/ftplugin/latex-suite/packages/array new file mode 100644 index 0000000..99f3dbc --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/array @@ -0,0 +1,17 @@ +if exists("array_package_file") + finish +endif +let array_package_file = 1 + +let g:TeX_package_option_array = '' + +let g:TeX_package_array = +\ 'brs:newcolumntype{<+type+>}[<+no+>]{<+preamble+>},' +\.'arraycolsep,' +\.'tabcolsep,' +\.'arrayrulewidth,' +\.'doublerulesep,' +\.'arraystretch,' +\.'extrarowheight' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/babel b/vimfiles.latex/ftplugin/latex-suite/packages/babel new file mode 100644 index 0000000..cdb76ec --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/babel @@ -0,0 +1,98 @@ +if exists("babel_package_file") + finish +endif +let babel_package_file = 1 + +" This package sets some language specific options. +" Since it needs to find out which options the user used with the babel +" package, it needs to wait till latex-suite is done scanning packages. It +" then catches the LatexSuiteScannedPackages event which +" Tex_pack_updateall() throws at which time g:Tex_pack_detected and +" g:Tex_babel_options contain the necessary information. + +let g:TeX_package_option_babel = +\ 'afrikaans,' +\.'bahasa,' +\.'basque,' +\.'breton,' +\.'bulgarian,' +\.'catalan,' +\.'croatian,' +\.'chech,' +\.'danish,' +\.'dutch,' +\.'english,USenglish,american,UKenglish,british,canadian,' +\.'esperanto,' +\.'estonian,' +\.'finnish,' +\.'french,francais,canadien,acadian,' +\.'galician,' +\.'austrian,german,germanb,ngerman,naustrian,' +\.'greek,polutonikogreek,' +\.'hebrew,' +\.'magyar,hungarian,' +\.'icelandic,' +\.'irish,' +\.'italian,' +\.'latin,' +\.'lowersorbian,' +\.'samin,' +\.'norsk,nynorsk,' +\.'polish,' +\.'portuges,portuguese,brazilian,brazil,' +\.'romanian,' +\.'russian,' +\.'scottish,' +\.'spanish,' +\.'slovak,' +\.'slovene,' +\.'swedish,' +\.'serbian,' +\.'turkish,' +\.'ukrainian,' +\.'uppersorbian,' +\.'welsh' + +let g:TeX_package_babel = +\ 'bra:selectlanguage,' +\.'env:otherlanguage,' +\.'env:otherlanguage*,' +\.'env:hyphenrules,' +\.'brd:foreignlanguage,' +\.'spe:iflanguage{<+name+>}{<+true+>}{<+false+>},' +\.'languagename,' +\.'bra:useshorthands,' +\.'brd:defineshorthand,' +\.'brd:aliasshorthand,' +\.'bra:languageshorthans,' +\.'bra:shorthandon,' +\.'bra:shorthandoff,' +\.'brd:languageattribute' + +" vim:ft=vim:ff=unix: +if exists('s:doneOnce') + finish +endif +let s:doneOnce = 1 + +augroup LatexSuite + au LatexSuite User LatexSuiteScannedPackages + \ call Tex_Debug('babel: catching LatexSuiteScannedPackages event') | + \ call s:SetQuotes() +augroup END + +let s:path = expand('<sfile>:p:h') + +" SetQuotes: sets quotes for various languages {{{ +" Description: +function! <SID>SetQuotes() + if g:Tex_package_detected =~ '\<babel\>' + if g:Tex_babel_options =~ '\<german\>' + exec 'so '.s:path.'/german' + elseif g:Tex_babel_options =~ '\<ngerman\>' + exec 'so '.s:path.'/ngerman' + endif + endif +endfunction " }}} + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/bar b/vimfiles.latex/ftplugin/latex-suite/packages/bar new file mode 100644 index 0000000..0087b95 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/bar @@ -0,0 +1,27 @@ +if exists("bar_package_file") + finish +endif +let bar_package_file = 1 + +let g:TeX_package_option_bar = '' + +let g:TeX_package_bar = +\ 'env:barenv,' +\.'brs:bar{<+height+>}{<+index+>}[<+desc+>],' +\.'hlineon,' +\.'brs:legend{<+index+>}{<+text+>},' +\.'bra:setdepth,' +\.'bra:sethspace,' +\.'brs:setlinestyle{<+solid-dotted+>},' +\.'brs:setnumberpos{<+empty-axis-down-inside-outside-up+>},' +\.'bra:setprecision,' +\.'bra:setstretch,' +\.'bra:setstyle,' +\.'bra:setwidth,' +\.'brs:setxaxis{<+w1+>}{<+w2+>}{<+step+>},' +\.'brs:setyaxis[<+n+>]{<+w1+>}{<+w2+>}{<+step+>},' +\.'brs:setxname[<+lrbt+>]{<+etiquette+>},' +\.'brs:setyname[<+lrbt+>]{<+etiquette+>},' +\.'brs:setxvaluetyp{<+day-month+>}' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/bm b/vimfiles.latex/ftplugin/latex-suite/packages/bm new file mode 100644 index 0000000..1cd5109 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/bm @@ -0,0 +1,10 @@ +if exists("bm_package_file") + finish +endif +let bm_package_file = 1 + +let g:TeX_package_option_bm = '' + +let g:TeX_package_bm = 'bra:bm' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/bophook b/vimfiles.latex/ftplugin/latex-suite/packages/bophook new file mode 100644 index 0000000..16ca8b0 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/bophook @@ -0,0 +1,12 @@ +if exists("bophook_package_file") + finish +endif +let bophook_package_file = 1 + +let g:TeX_package_option_bophook = '' + +let g:TeX_package_bophook = +\ 'bra:AtBeginPage,' +\.'bra:PageLayout' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/boxedminipage b/vimfiles.latex/ftplugin/latex-suite/packages/boxedminipage new file mode 100644 index 0000000..0917352 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/boxedminipage @@ -0,0 +1,10 @@ +if exists("boxedminipage_package_file") + finish +endif +let boxedminipage_package_file = 1 + +let g:TeX_package_option_boxedminipage = '' + +let g:TeX_package_boxedminipage = 'ens:boxedminipage:[<+pos+>]{<+size+>}' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/caption2 b/vimfiles.latex/ftplugin/latex-suite/packages/caption2 new file mode 100644 index 0000000..7e16031 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/caption2 @@ -0,0 +1,43 @@ +if exists("caption2_package_file") + finish +endif +let caption2_package_file = 1 + +let g:TeX_package_option_caption2 = +\ 'scriptsize,' +\.'footnotesize,' +\.'small,' +\.'normalsize,' +\.'large,' +\.'Large,' +\.'up,' +\.'it,' +\.'sl,' +\.'sc,' +\.'md,' +\.'bf,' +\.'rm,' +\.'sf,' +\.'tt,' +\.'ruled,' +\.'boxed,' +\.'centerlast,' +\.'anne,' +\.'center,' +\.'flushleft,' +\.'flushright,' +\.'oneline,' +\.'nooneline,' +\.'hang,' +\.'isu,' +\.'indent,' +\.'longtable' + +let g:TeX_package_caption2 = +\ 'bra:captionsize,' +\.'bra:captionfont,' +\.'bra:captionlabelfont,' +\.'bra:setcaptionmargin,' +\.'bra:setcaptionwidth' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/cases b/vimfiles.latex/ftplugin/latex-suite/packages/cases new file mode 100644 index 0000000..a2deafe --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/cases @@ -0,0 +1,12 @@ +if exists("cases_package_file") + finish +endif +let cases_package_file = 1 + +let g:TeX_package_option_cases = '' + +let g:TeX_package_cases = +\ 'ens:numcases:{<+label+>},' +\.'ens:subnumcases:{<+label+>}' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/ccaption b/vimfiles.latex/ftplugin/latex-suite/packages/ccaption new file mode 100644 index 0000000..2ec3f2f --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/ccaption @@ -0,0 +1,20 @@ +if exists("ccaption_package_file") + finish +endif +let ccaption_package_file = 1 + +let g:TeX_package_option_ccaption = '' + +let g:TeX_package_ccaption = +\ 'bra:contcaption,' +\.'bra:legend,' +\.'bra:namedlegend,' +\.'abovelegendskip,' +\.'belowlegendskip,' +\.'brd:newfixedcaption,' +\.'brd:renewfixedcaption,' +\.'brd:providefixedcaption,' +\.'brs:newfloatenv[<+counter+>]{<+name+>}{<+ext+>}{<+etiq+>},' +\.'brd:listfloats' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/changebar b/vimfiles.latex/ftplugin/latex-suite/packages/changebar new file mode 100644 index 0000000..e5002cf --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/changebar @@ -0,0 +1,35 @@ +if exists("changebar_package_file") + finish +endif +let changebar_package_file = 1 + +let g:TeX_package_option_changebar = +\ 'DVItoLN03,' +\.'dvitoln03,' +\.'DVItoPS,' +\.'dvitops,' +\.'DVIps,' +\.'dvips,' +\.'emTeX,' +\.'emtex,' +\.'textures,' +\.'Textures,' +\.'outerbars,' +\.'innerbars,' +\.'leftbars,' +\.'rightbars,' +\.'traceon,' +\.'traceoff' + +let g:TeX_package_changebar = +\ 'ens:changebar:[<+thickness+>],' +\.'noo:cbstart,' +\.'cbend,' +\.'cbdelete,' +\.'changebarwidth,' +\.'deletebarwidth,' +\.'changebarsep,' +\.'spe:changebargrey,' +\.'nochangebars' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/chapterbib b/vimfiles.latex/ftplugin/latex-suite/packages/chapterbib new file mode 100644 index 0000000..331e901 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/chapterbib @@ -0,0 +1,24 @@ +if exists("chapterbib_package_file") + finish +endif +let chapterbib_package_file = 1 + +let g:TeX_package_option_chapterbib = +\ 'sectionbib,' +\.'rootbib,' +\.'gather,' +\.'duplicate' + +let g:TeX_package_chapterbib = +\ 'env:cbunit,' +\.'brd:sectionbib,' +\.'bra:cbinput,' +\.'sep:redefine,' +\.'bra:citeform,' +\.'bra:citepunct,' +\.'bra:citeleft,' +\.'bra:citeright,' +\.'bra:citemid,' +\.'bra:citedash' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/cite b/vimfiles.latex/ftplugin/latex-suite/packages/cite new file mode 100644 index 0000000..aa43e5b --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/cite @@ -0,0 +1,32 @@ +if exists("cite_package_file") + finish +endif +let cite_package_file = 1 + +let g:TeX_package_option_cite = +\ 'verbose,' +\.'nospace,' +\.'space,' +\.'nosort,' +\.'sort,' +\.'noadjust' + +let g:TeX_package_cite = +\ 'bra:cite,' +\.'bra:citen,' +\.'bra:citenum,' +\.'bra:citeonline,' +\.'bra:nocite,' +\.'sep:redefine,' +\.'bra:citeform,' +\.'bra:citepunct,' +\.'bra:citeleft,' +\.'bra:citeright,' +\.'bra:citemid,' +\.'bra:citedash' + +syn region texRefZone matchgroup=texStatement start="\\citen\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter +syn region texRefZone matchgroup=texStatement start="\\citenum\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter +syn region texRefZone matchgroup=texStatement start="\\citeonline\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/color b/vimfiles.latex/ftplugin/latex-suite/packages/color new file mode 100644 index 0000000..7f3aeac --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/color @@ -0,0 +1,43 @@ +if exists("color_package_file") + finish +endif +let color_package_file = 1 + +let g:TeX_package_option_color = +\ 'monochrome,' +\.'debugshow,' +\.'dvips,' +\.'xdvi,' +\.'dvipdf,' +\.'pdftex,' +\.'dvipsone,' +\.'dviwindo,' +\.'emtex,' +\.'dviwin,' +\.'oztex,' +\.'textures,' +\.'pctexps,' +\.'pctexwin,' +\.'pctexhp,' +\.'pctex32,' +\.'truetex,' +\.'tcidvi,' +\.'dvipsnames,' +\.'nodvipsnames,' +\.'usenames' + +let g:TeX_package_color = +\ 'brs:definecolor{<++>}{<++>}{<++>},' +\.'brs:DefineNamedColor{<++>}{<++>}{<++>}{<++>},' +\.'bra:color,' +\.'nob:color,' +\.'brd:textcolor,' +\.'brs:textcolor[<++>]{<++>}{<++>},' +\.'brd:colorbox,' +\.'brs:colorbox[<++>]{<++>}{<++>},' +\.'brs:fcolorbox{<++>}{<++>}{<++>},' +\.'brs:fcolorbox[<++>]{<++>}{<++>}{<++>},' +\.'brd:pagecolor,' +\.'nob:pagecolor' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/comma b/vimfiles.latex/ftplugin/latex-suite/packages/comma new file mode 100644 index 0000000..5ec8d70 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/comma @@ -0,0 +1,12 @@ +if exists("comma_package_file") + finish +endif +let comma_package_file = 1 + +let g:TeX_package_option_comma = '' + +let g:TeX_package_comma = +\ 'bra:commaform,' +\.'bra:commaformtoken' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/deleq b/vimfiles.latex/ftplugin/latex-suite/packages/deleq new file mode 100644 index 0000000..58426d2 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/deleq @@ -0,0 +1,36 @@ +if exists("deleq_package_file") + finish +endif +let deleq_package_file = 1 + +let g:TeX_package_option_deleq = '' + +let g:TeX_package_deleq = +\.'env:deqn,' +\.'env:ddeqn,' +\.'env:deqarr,' +\.'env:ddeqar,' +\.'env:deqrarr,' +\.'nor:nydeqno,' +\.'nor:heqno,' +\.'bra:reqno,' +\.'bra:rndeqno,' +\.'bra:rdeqno,' +\.'nob:eqreqno,' +\.'nob:deqreqno,' +\.'nob:ddeqreqno,' +\.'bra:arrlabel,' +\.'nor:where,' +\.'bra:remtext,' +\.'nor:nydeleqno,' +\.'nor:deleqno,' +\.'nor:jotbaseline' + +if !exists("tex_no_math") + syn region texMathZoneA start="\\begin\s*{\s*deqn\*\s*}" end="\\end\s*{\s*deqn\*\s*}" keepend fold contains=@texMathZoneGroup + syn region texMathZoneB start="\\begin\s*{\s*ddeqn\*\s*}" end="\\end\s*{\s*ddeqn\*\s*}" keepend fold contains=@texMathZoneGroup + syn region texMathZoneC start="\\begin\s*{\s*deqarr\s*}" end="\\end\s*{\s*deqarr\s*}" keepend fold contains=@texMathZoneGroup + syn region texMathZoneD start="\\begin\s*{\s*ddeqar\s*}" end="\\end\s*{\s*ddeqar\s*}" keepend fold contains=@texMathZoneGroup + syn region texMathZoneE start="\\begin\s*{\s*deqrarr\*\s*}" end="\\end\s*{\s*deqrarr\*\s*}" keepend fold contains=@texMathZoneGroup +endif +" vim:ft=vim:ff=unix:noet:ts=4: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/drftcite b/vimfiles.latex/ftplugin/latex-suite/packages/drftcite new file mode 100644 index 0000000..8c30447 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/drftcite @@ -0,0 +1,29 @@ +if exists("drftcite_package_file") + finish +endif +let drftcite_package_file = 1 + +let g:TeX_package_option_drftcite = +\ 'verbose,' +\.'nospace,' +\.'space,' +\.'breakcites,' +\.'manualsort,' +\.'tt,' +\.'shownumbers,' +\.'nocitecount' + +let g:TeX_package_drftcite = +\ 'bra:cite,' +\.'bra:citen,' +\.'sep:redefine,' +\.'bra:citeform,' +\.'bra:citepunct,' +\.'bra:citeleft,' +\.'bra:citeright,' +\.'bra:citemid,' +\.'bra:citedash' + +syn region texRefZone matchgroup=texStatement start="\\citen\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/dropping b/vimfiles.latex/ftplugin/latex-suite/packages/dropping new file mode 100644 index 0000000..bcfc11f --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/dropping @@ -0,0 +1,12 @@ +if exists("dropping_package_file") + finish +endif +let dropping_package_file = 1 + +let g:TeX_package_option_dropping = '' + +let g:TeX_package_dropping = +\ 'brs:bigdrop{<+indent+>}{<+big+>}{<+font+>}{<+text+>},' +\.'brs:dropping[<+indent+>]{<+big+>}{<+text+>}' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/enumerate b/vimfiles.latex/ftplugin/latex-suite/packages/enumerate new file mode 100644 index 0000000..40c3f7c --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/enumerate @@ -0,0 +1,10 @@ +if exists("enumerate_package_file") + finish +endif +let enumerate_package_file = 1 + +let g:TeX_package_option_enumerate = '' + +let g:TeX_package_enumerate = 'ens:enumerate:[<+prefix+>]' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/eqlist b/vimfiles.latex/ftplugin/latex-suite/packages/eqlist new file mode 100644 index 0000000..e1e249e --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/eqlist @@ -0,0 +1,19 @@ +if exists("eqlist_package_file") + finish +endif +let eqlist_package_file = 1 + +let g:TeX_package_option_eqlist = '' + +let g:TeX_package_eqlist = +\ 'env:eqlist,' +\.'env:eqlist*,' +\.'env:Eqlist,' +\.'env:Eqlist*,' +\.'sep:modificators,' +\.'eqlistinit,' +\.'eqliststarinit,' +\.'eqlistinitpar,' +\.'eqlistlabel' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/eqparbox b/vimfiles.latex/ftplugin/latex-suite/packages/eqparbox new file mode 100644 index 0000000..a05061b --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/eqparbox @@ -0,0 +1,12 @@ +if exists("eqparbox_package_file") + finish +endif +let eqparbox_package_file = 1 + +let g:TeX_package_option_eqparbox = '' + +let g:TeX_package_eqparbox = +\ 'brs:eqparbox[<+pos+>][<+height+>][<+inner-pos+>]{<+tag+>}{<+text+>},' +\.'bra:eqboxwidth' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/everyshi b/vimfiles.latex/ftplugin/latex-suite/packages/everyshi new file mode 100644 index 0000000..e42a3d5 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/everyshi @@ -0,0 +1,10 @@ +if exists("everyshi_package_file") + finish +endif +let everyshi_package_file = 1 + +let g:TeX_package_option_everyshi = '' + +let g:TeX_package_everyshi = 'bra:EveryShipOut' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/exmpl b/vimfiles.latex/ftplugin/latex-suite/packages/exmpl new file mode 100644 index 0000000..e9e37fc --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/exmpl @@ -0,0 +1,55 @@ +if exists("exmpl_package_file") + finish +endif +let exmpl_package_file = 1 + +" Author: Mikolaj Machowski +" Date: 10.04.2002 +" Example plugin for packages in latexSuite +" + +" This variable creates Options submenu in package menu. Even when no options are +" given for this package it HAS to exist in form +" let TeX_package_option_exmpl = "" +" Options and commands are delimited with comma , + +let g:TeX_package_option_exmpl = "OpcjaA=,OpcjaB,OpcjaC" + +" Most command should have some definition before. Package menu system can +" recognize type of command and behave in good manner: +" env: (environment) creates simple environment template +" \begin{command} +" x <- cursor here +" \end{command} +" +" bra: (brackets) useful when inserting brackets commands +" \command{x}<<>> <- cursor at x, and placeholders as in other menu entries +" +" nor: (normal) nor: and pla: are `highlighted' in menu with `'' +" \command<Space> +" +" pla: (plain) +" command<Space> +" +" spe: (special) +" command <-literal insertion of command, in future here should go +" commands with special characters +" +" sep: (separator) creates separator. Good for aesthetics and usability :) +" +" Command can be also given with no prefix:. The result is +" \command (as in nor: but without <Space>) + + +let g:TeX_package_exmpl = "env:AEnvFirst,env:aEnvSec,env:BThi," + \ . "sep:a,env:zzzz," + \ . "bra:aBraFirst,bra:bBraSec,bra:cBraThi," + \ . "sep:b," + \ . "nor:aNorPri,nor:bNorSec,nor:cNorTer," + \ . "sep:c," + \ . "pla:aPla1,pla:bPla2,pla:cPla3," + \ . "sep:d," + \ . "spe:aSpe1,spe:bSpe2,spe:cSpe3," + \ . "sep:e," + \ . "aNo1,bNo2,cNo3" +" vim:ft=vim diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/flafter b/vimfiles.latex/ftplugin/latex-suite/packages/flafter new file mode 100644 index 0000000..8859397 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/flafter @@ -0,0 +1,10 @@ +if exists("flafter_package_file") + finish +endif +let flafter_package_file = 1 + +let g:TeX_package_option_flafter = '' + +let g:TeX_package_flafter = 'noo:suppressfloats,noo:suppress' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/float b/vimfiles.latex/ftplugin/latex-suite/packages/float new file mode 100644 index 0000000..7c1cf46 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/float @@ -0,0 +1,16 @@ +if exists("float_package_file") + finish +endif +let float_package_file = 1 + +let g:TeX_package_option_float = '' + +let g:TeX_package_float = +\ 'bra:floatstyle,' +\.'brs:newfloat{<++>}{<++>}{<++>}[<++>],' +\.'brd:floatname,' +\.'brd:listof,' +\.'bra:restylefloat,' +\.'brd:floatplacement' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/floatflt b/vimfiles.latex/ftplugin/latex-suite/packages/floatflt new file mode 100644 index 0000000..4902d89 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/floatflt @@ -0,0 +1,12 @@ +if exists("floatflt_package_file") + finish +endif +let floatflt_package_file = 1 + +let g:TeX_package_option_floatflt = 'rflt,lflt,vflt' + +let g:TeX_package_floatflt = +\ 'ens:floatingfigure:[<+loc+>]{<+spec+>},' +\.'ens:floatingtable:[<+loc+>]{<+spec+>}' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/fn2end b/vimfiles.latex/ftplugin/latex-suite/packages/fn2end new file mode 100644 index 0000000..aac4184 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/fn2end @@ -0,0 +1,10 @@ +if exists("fn2end_package_file") + finish +endif +let fn2end_package_file = 1 + +let g:TeX_package_option_fn2end = '' + +let g:TeX_package_fn2end = 'makeendnotes,theendnotes' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/footmisc b/vimfiles.latex/ftplugin/latex-suite/packages/footmisc new file mode 100644 index 0000000..04723f6 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/footmisc @@ -0,0 +1,21 @@ +if exists("footmisc_package_file") + finish +endif +let footmisc_package_file = 1 + +let g:TeX_package_option_footmisc = +\ 'bottom,' +\.'flushmargin,' +\.'marginal,' +\.'multiple,' +\.'norule,' +\.'para,' +\.'perpage,' +\.'splitrule,' +\.'stable,' +\.'symbol,' +\.'symbol+' + +let g:TeX_package_footmisc = '' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/geometry b/vimfiles.latex/ftplugin/latex-suite/packages/geometry new file mode 100644 index 0000000..667a289 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/geometry @@ -0,0 +1,93 @@ +if exists("geometry_package_file") + finish +endif +let geometry_package_file = 1 + +let g:TeX_package_option_geometry = +\ 'sbr:Boolean,' +\.'verbose,' +\.'landscape,' +\.'portrait,' +\.'twoside,' +\.'includemp,' +\.'reversemp,' +\.'reversemarginpar,' +\.'nohead,' +\.'nofoot,' +\.'noheadfoot,' +\.'dvips,' +\.'pdftex,' +\.'vtex,' +\.'truedimen,' +\.'reset,' +\.'sbr:BooleanDimensions,' +\.'a0paper,' +\.'a1paper,' +\.'a2paper,' +\.'a3paper,' +\.'a4paper,' +\.'a5paper,' +\.'a6paper,' +\.'b0paper,' +\.'b1paper,' +\.'b2paper,' +\.'b3paper,' +\.'b4paper,' +\.'b5paper,' +\.'b6paper,' +\.'letterpaper,' +\.'executivepaper,' +\.'legalpaper,' +\.'sbr:SingleValueOption,' +\.'paper=,' +\.'papername=,' +\.'paperwidth=,' +\.'paperheight=,' +\.'width=,' +\.'totalwidth=,' +\.'height=,' +\.'totalheight=,' +\.'left=,' +\.'lmargin=,' +\.'right=,' +\.'rmargin=,' +\.'top=,' +\.'tmargin=,' +\.'bottom=,' +\.'bmargin=,' +\.'hscale=,' +\.'vscale=,' +\.'textwidth=,' +\.'textheight=,' +\.'marginparwidth=,' +\.'marginpar=,' +\.'marginparsep=,' +\.'headheight=,' +\.'head=,' +\.'headsep=,' +\.'footskip=,' +\.'hoffset=,' +\.'voffset=,' +\.'twosideshift=,' +\.'mag=,' +\.'columnsep=,' +\.'footnotesep=,' +\.'sbr:TwoValueOptions,' +\.'papersize={<++>},' +\.'total={<++>},' +\.'body={<++>},' +\.'text={<++>},' +\.'scale={<++>},' +\.'hmargin={<++>},' +\.'vmargin={<++>},' +\.'margin={<++>},' +\.'offset={<++>},' +\.'sbr:ThreeValueOptions,' +\.'hdivide={<++>},' +\.'vdivide={<++>},' +\.'divide={<++>}' + +let g:TeX_package_geometry = +\ 'bra:geometry' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/german b/vimfiles.latex/ftplugin/latex-suite/packages/german new file mode 100644 index 0000000..9aa7519 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/german @@ -0,0 +1,12 @@ +if exists("german_package_file") + finish +endif +let german_package_file = 1 + +let g:TeX_package_german = '' +let g:TeX_package_option_german = '' +" For now just define the smart quotes. +let b:Tex_SmartQuoteOpen = '"`' +let b:Tex_SmartQuoteClose = "\"'" + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/graphicx b/vimfiles.latex/ftplugin/latex-suite/packages/graphicx new file mode 100644 index 0000000..4aa7571 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/graphicx @@ -0,0 +1,69 @@ +if exists("graphicx_package_file") + finish +endif +let graphicx_package_file = 1 + +let g:TeX_package_option_graphicx = +\ 'sbr:Drivers,' +\.'xdvi,' +\.'dvipdf,' +\.'dvipdfm,' +\.'pdftex,' +\.'dvipsone,' +\.'dviwindo,' +\.'emtex,' +\.'dviwin,' +\.'oztex,' +\.'textures,' +\.'pctexps,' +\.'pctexwin,' +\.'pctexhp,' +\.'pctex32,' +\.'truetex,' +\.'tcidvi,' +\.'vtex,' +\.'sbr:Rest,' +\.'debugshow,' +\.'draft,' +\.'final,' +\.'hiderotate,' +\.'hiresbb,' +\.'hidescale,' +\.'unknownkeysallowed,' +\.'unknownkeyserror' + +let g:TeX_package_graphicx = +\ 'sbr:Includegraphics,' +\.'brs:includegraphics[<++>]{<++>},' +\.'spe:height=,' +\.'spe:width=,' +\.'spe:keepaspectratio=,' +\.'spe:totalheight=,' +\.'spe:angle=,' +\.'spe:scale=,' +\.'spe:origin=,' +\.'spe:clip,' +\.'spe:bb=,' +\.'spe:viewport=,' +\.'spe:trim=,' +\.'spe:draft,' +\.'spe:hiresbb,' +\.'spe:type=,' +\.'spe:ext=,' +\.'spe:read=,' +\.'spe:command=,' +\.'sbr:Rotatebox,' +\.'brs:rotatebox[<++>]{<++>}{<++>},' +\.'spe:origin=,' +\.'spe:x=,' +\.'spe:y=,' +\.'spe:units=,' +\.'sbr:Rest,' +\.'brs:scalebox{<++>}[<++>]{<++>},' +\.'brs:resizebox{<++>}{<++>}{<++>},' +\.'brs:resizebox*{<++>}{<++>}{<++>},' +\.'bra:DeclareGraphicsExtensions,' +\.'brs:DeclareGraphicsRule{<++>}{<++>}{<++>}{<++>},' +\.'bra:graphicspath' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/graphpap b/vimfiles.latex/ftplugin/latex-suite/packages/graphpap new file mode 100644 index 0000000..ebbd268 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/graphpap @@ -0,0 +1,10 @@ +if exists("graphpap_package_file") + finish +endif +let graphpap_package_file = 1 + +let g:TeX_package_option_graphpap = '' + +let g:TeX_package_graphpap = 'brs:graphpaper[<+step+>](<+x1,y1+>)(<+x2,y2+>)' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/harpoon b/vimfiles.latex/ftplugin/latex-suite/packages/harpoon new file mode 100644 index 0000000..994801d --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/harpoon @@ -0,0 +1,18 @@ +if exists("harpoon_package_file") + finish +endif +let harpoon_package_file = 1 + +let g:TeX_package_option_harpoon = '' + +let g:TeX_package_harpoon = +\ 'bra:overleftharp,' +\.'bra:overrightharp,' +\.'bra:overleftharpdown,' +\.'bra:overrightharpdown,' +\.'bra:underleftharp,' +\.'bra:underrightharp,' +\.'bra:underleftharpdown,' +\.'bra:underrightharpdown' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/hhline b/vimfiles.latex/ftplugin/latex-suite/packages/hhline new file mode 100644 index 0000000..a024c19 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/hhline @@ -0,0 +1,21 @@ +if exists("hhline_package_file") + finish +endif +let hhline_package_file = 1 + +let g:TeX_package_option_hhline = '' + +let g:TeX_package_hhline = +\ 'bra:hhline,' +\.'sep:a,' +\.'spe:=,' +\.'spe:-,' +\.'spe:~,' +\."spe:\\\|," +\.'spe::,' +\.'spe:#,' +\.'spe:t,' +\.'spe:b,' +\.'spe:*' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/histogram b/vimfiles.latex/ftplugin/latex-suite/packages/histogram new file mode 100644 index 0000000..b18fc07 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/histogram @@ -0,0 +1,13 @@ +if exists("histogram_package_file") + finish +endif +let histogram_package_file = 1 + +let g:TeX_package_option_histogram = '' + +let g:TeX_package_histogram = +\ 'histogram,' +\.'noverticallines,' +\.'verticallines' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/hyperref b/vimfiles.latex/ftplugin/latex-suite/packages/hyperref new file mode 100644 index 0000000..a82aac3 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/hyperref @@ -0,0 +1,167 @@ +if exists("hyperref_package_file") + finish +endif +let hyperref_package_file = 1 + +let g:TeX_package_option_hyperref = +\ '4=,' +\.'a4paper,' +\.'a5paper,' +\.'anchorcolor=,' +\.'b5paper,' +\.'backref=,' +\.'baseurl={<++>},' +\.'bookmarks=,' +\.'bookmarksnumbered=,' +\.'bookmarksopen=,' +\.'bookmarksopenlevel=,' +\.'bookmarkstype=,' +\.'breaklinks=,' +\.'citebordercolor=,' +\.'citecolor=,' +\.'colorlinks=,' +\.'debug=,' +\.'draft,' +\.'dvipdf,' +\.'dvipdfm,' +\.'dvips,' +\.'dvipsone,' +\.'dviwindo,' +\.'executivepaper,' +\.'extension=,' +\.'filebordercolor=,' +\.'filecolor=,' +\.'frenchlinks=,' +\.'hyperfigures=,' +\.'hyperindex=,' +\.'hypertex,' +\.'hypertexnames=,' +\.'implicit=,' +\.'latex2html,' +\.'legalpaper,' +\.'letterpaper,' +\.'linkbordercolor=,' +\.'linkcolor=,' +\.'linktocpage=,' +\.'menubordercolor=,' +\.'menucolor=,' +\.'naturalnames,' +\.'nesting=,' +\.'pageanchor=,' +\.'pagebackref=,' +\.'pagebordercolor=,' +\.'pagecolor=,' +\.'pdfauthor={<++>},' +\.'pdfborder=,' +\.'pdfcenterwindow=,' +\.'pdfcreator={<++>},' +\.'pdffitwindow,' +\.'pdfhighlight=,' +\.'pdfkeywords={<++>},' +\.'pdfmenubar=,' +\.'pdfnewwindow=,' +\.'pdfpagelabels=,' +\.'pdfpagelayout=,' +\.'pdfpagemode=,' +\.'pdfpagescrop=,' +\.'pdfpagetransition=,' +\.'pdfproducer={<++>},' +\.'pdfstartpage={<++>},' +\.'pdfstartview={<++>},' +\.'pdfsubject={<++>},' +\.'pdftex,' +\.'pdftitle={<++>},' +\.'pdftoolbar=,' +\.'pdfusetitle=,' +\.'pdfview,' +\.'pdfwindowui=,' +\.'plainpages=,' +\.'ps2pdf,' +\.'raiselinks=,' +\.'runbordercolor,' +\.'tex4ht,' +\.'textures,' +\.'unicode=,' +\.'urlbordercolor=,' +\.'urlcolor=,' +\.'verbose=,' +\.'vtex' + +let g:TeX_package_hyperref = +\ 'sbr:Preamble,' +\.'bra:hypersetup,' +\.'wwwbrowser,' +\.'sbr:Links,' +\.'bra:hyperbaseurl,' +\.'brs:href{<+URL+>}{<+text+>},' +\.'bra:hyperimage,' +\.'brs:hyperdef{<+category+>}{<+name+>}{<+text+>},' +\.'brs:hyperref{<+URL+>}{<+category+>}{<+name+>}{<+text+>},' +\.'brs:hyperlink{<+name+>}{<+text+>},' +\.'brs:hypertarget{<+name+>}{<+text+>},' +\.'bra:url,' +\.'bra:htmladdnormallink,' +\.'brs:Acrobatmenu{<+option+>}{<+tekst+>},' +\.'brs:pdfbookmark[<++>]{<++>}{<++>},' +\.'bra:thispdfpagelabel,' +\.'sbr:Forms,' +\.'env:Form,' +\.'sep:Forms1,' +\.'brs:TextField[<+parameters+>]{<+label+>},' +\.'brs:CheckBox[<+parameters+>]{<+label+>},' +\.'brs:ChoiceMenu[<+parameters+>]{<+label+>}{<+choices+>},' +\.'brs:PushButton[<+parameters+>]{<+label+>},' +\.'brs:Submit[<+parameters+>]{<+label+>},' +\.'brs:Reset[<+parameters+>]{<+label+>},' +\.'sep:Forms2,' +\.'brs:LayoutTextField{<+label+>}{<+field+>},' +\.'brs:LayoutChoiceField{<+label+>}{<+field+>},' +\.'brs:LayoutCheckboxField{<+label+>}{<+field+>},' +\.'sep:Forms3,' +\.'brs:MakeRadioField{<+width+>}{<+height+>},' +\.'brs:MakeCheckField{<+width+>}{<+height+>},' +\.'brs:MakeTextField{<+width+>}{<+height+>},' +\.'brs:MakeChoiceField{<+width+>}{<+height+>},' +\.'brs:MakeButtonField{<+text+>},' +\.'sbr:Parameters,' +\.'spe:accesskey,' +\.'spe:align,' +\.'spe:backgroundcolor,' +\.'spe:bordercolor,' +\.'spe:bordersep,' +\.'spe:borderwidth,' +\.'spe:charsize,' +\.'spe:checked,' +\.'spe:color,' +\.'spe:combo,' +\.'spe:default,' +\.'spe:disabled,' +\.'spe:height,' +\.'spe:hidden,' +\.'spe:maxlen,' +\.'spe:menulength,' +\.'spe:multiline,' +\.'spe:name,' +\.'spe:onblur,' +\.'spe:onchange,' +\.'spe:onclick,' +\.'spe:ondblclick,' +\.'spe:onfocus,' +\.'spe:onkeydown,' +\.'spe:onkeypress,' +\.'spe:onkeyup,' +\.'spe:onmousedown,' +\.'spe:onmousemove,' +\.'spe:onmouseout,' +\.'spe:onmouseover,' +\.'spe:onmouseup,' +\.'spe:onselect,' +\.'spe:password,' +\.'spe:popdown,' +\.'spe:radio,' +\.'spe:readonly,' +\.'spe:tabkey,' +\.'spe:value,' +\.'spe:width' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/ifthen b/vimfiles.latex/ftplugin/latex-suite/packages/ifthen new file mode 100644 index 0000000..82dbe69 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/ifthen @@ -0,0 +1,21 @@ +if exists("ifthen_package_file") + finish +endif +let ifthen_package_file = 1 + +let g:TeX_package_option_ifthen = '' + +let g:TeX_package_ifthen = +\ 'brs:ifthenelse{<++>}{<++>}{<++>},' +\.'brd:equal,' +\.'bra:boolean,' +\.'bra:lengthtest,' +\.'bra:isodd,' +\.'brd:whiledo,' +\.'bra:newboolean,' +\.'brd:setboolean,' +\.'nor:and,' +\.'nor:or,' +\.'nor:not' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/inputenc b/vimfiles.latex/ftplugin/latex-suite/packages/inputenc new file mode 100644 index 0000000..73abe9a --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/inputenc @@ -0,0 +1,29 @@ +if exists("inputenc_package_file") + finish +endif +let inputenc_package_file = 1 + +let g:TeX_package_option_inputenc = +\ 'ascii,' +\.'latin1,' +\.'latin2,' +\.'latin3,' +\.'latin4,' +\.'latin5,' +\.'latin9,' +\.'decmulti,' +\.'cp850,' +\.'cp852,' +\.'cp437,' +\.'cp437de,' +\.'cp865,' +\.'applemac,' +\.'next,' +\.'ansinew,' +\.'cp1250,' +\.'cp1252' + +let g:TeX_package_inputenc = +\ 'bra:inputencoding' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/letterspace b/vimfiles.latex/ftplugin/latex-suite/packages/letterspace new file mode 100644 index 0000000..9a53eaa --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/letterspace @@ -0,0 +1,10 @@ +if exists("letterspace_package_file") + finish +endif +let letterspace_package_file = 1 + +let g:TeX_package_option_letterspace = '' + +let g:TeX_package_letterspace = 'nor:letterspace' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/lineno b/vimfiles.latex/ftplugin/latex-suite/packages/lineno new file mode 100644 index 0000000..4567602 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/lineno @@ -0,0 +1,60 @@ +if exists("lineno_package_file") + finish +endif +let lineno_package_file = 1 + +let g:TeX_package_option_lineno = +\ 'left,' +\.'right,' +\.'switch,' +\.'switch*,' +\.'pagewise,' +\.'running,' +\.'modulo,' +\.'mathlines,' +\.'displaymath,' +\.'hyperref' + +let g:TeX_package_lineno = +\ 'sbr:Environments,' +\.'env:linenumbers,' +\.'env:linenumbers*,' +\.'env:numquote,' +\.'env:numquote*,' +\.'env:numquotation,' +\.'env:numquotation*,' +\.'env:bframe,' +\.'env:linenomath,' +\.'env:linenomath*,' +\.'bra:linelabel,' +\.'sbr:Commands,' +\.'nor:linenumbers,' +\.'nor:linenumbers*,' +\.'noo:linenumbers,' +\.'nor:nolinenumbers,' +\.'nor:runninglinenumbers,' +\.'nor:runninglinenumbers*,' +\.'noo:runninglinenumbers,' +\.'nor:pagewiselinenumbers,' +\.'nor:resetlinenumber,' +\.'noo:resetlinenumber,' +\.'nor:setrunninglinenumbers,' +\.'nor:setpagewiselinenumbers,' +\.'nor:switchlinenumbers,' +\.'nor:switchlinenumbers*,' +\.'nor:leftlinenumbers,' +\.'nor:leftlinenumbers*,' +\.'nor:rightlinenumbers,' +\.'nor:rightlinenumbers*,' +\.'nor:runningpagewiselinenumbers,' +\.'nor:realpagewiselinenumbers,' +\.'nor:modulolinenumbers,' +\.'noo:modulolinenumbers,' +\.'nor:linenumberdisplaymath,' +\.'nor:nolinenumberdisplaymath,' +\.'nor:thelinenumber,' +\.'nob:linerefp,' +\.'nob:linerefr,' +\.'nob:lineref' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/longtable b/vimfiles.latex/ftplugin/latex-suite/packages/longtable new file mode 100644 index 0000000..6644862 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/longtable @@ -0,0 +1,35 @@ +if exists("longtable_package_file") + finish +endif +let longtable_package_file = 1 + +let g:TeX_package_option_longtable = +\ 'errorshow,' +\.'pausing,' +\.'set,' +\.'final' + +let g:TeX_package_longtable = +\ 'sbr:Commands,' +\.'nor:setlongtables,' +\.'bra:LTleft,' +\.'bra:LTright,' +\.'bra:LTpre,' +\.'bra:LTpost,' +\.'bra:LTchunksize,' +\.'bra:LTcapwidth,' +\.'bra:LTcapwidth,' +\.'sbr:Longtable,' +\.'env:longtable,' +\.'sep:lt,' +\.'nor:endhead,' +\.'nor:endfirsthead,' +\.'nor:endfoot,' +\.'nor:endlastfoot,' +\.'nor:kill,' +\.'bra:caption,' +\.'nob:caption,' +\.'bra:caption*,' +\.'nor:newpage' + +" vim:ft=vim:ts=4:sw=4:noet:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/lscape b/vimfiles.latex/ftplugin/latex-suite/packages/lscape new file mode 100644 index 0000000..33976ea --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/lscape @@ -0,0 +1,10 @@ +if exists("lscape_package_file") + finish +endif +let lscape_package_file = 1 + +let g:TeX_package_option_lscape = '' + +let g:TeX_package_lscape = 'env:landscape' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/manyfoot b/vimfiles.latex/ftplugin/latex-suite/packages/manyfoot new file mode 100644 index 0000000..7cab55f --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/manyfoot @@ -0,0 +1,15 @@ +if exists("manyfoot_package_file") + finish +endif +let manyfoot_package_file = 1 + +let g:TeX_package_option_manyfoot = 'para' + +let g:TeX_package_manyfoot = +\ 'bra:newfootnote,bra:newfootnote[para],' +\.'bra:footnoteA,bra:footnoteB,' +\.'bra:FootnoteA,bra:FootnoteB,' +\.'bra:Footnotemark,bra:Footnotetext,' +\.'SplitNote' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/moreverb b/vimfiles.latex/ftplugin/latex-suite/packages/moreverb new file mode 100644 index 0000000..8614e3b --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/moreverb @@ -0,0 +1,28 @@ +if exists("moreverb_package_file") + finish +endif +let moreverb_package_file = 1 + +let g:TeX_package_option_moreverb = '' + +let g:TeX_package_moreverb = +\ 'ens:verbatimwrite:{<++>},' +\.'ens:verbatimtab:[<++>],' +\.'ens:listing:[<+step+>]{<+number+>},' +\.'ens:listing*:[<+step+>]{<+number+>},' +\.'env:boxedverbatim,' +\.'bra:verbatimtabsize,' +\.'bra:listingoffset,' +\.'brs:listinginput[<++>]{<++>}{<++>},' +\.'brs:verbatimtabinput[<++>]{<++>}' + +let g:Tex_completion_explorer = g:Tex_completion_explorer.'verbatimtabinput,' + +syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" fold +syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" fold +syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" fold +syn region texZone start="\\begin{listing}" end="\\end{listing}\|%stopzone\>" fold +syn region texZone start="\\begin{listing*}" end="\\end{listing*}\|%stopzone\>" fold + + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/moreverbatim b/vimfiles.latex/ftplugin/latex-suite/packages/moreverbatim new file mode 100644 index 0000000..b32d0be --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/moreverbatim @@ -0,0 +1,21 @@ +let g:TeX_package_option_moreverbatim = '' + +let g:TeX_package_moreverbatim = +\ 'ens:verbatimwrite:{<++>},' +\.'ens:verbatimtab:[<++>],' +\.'ens:listing:[<+step+>]{<+number+>},' +\.'ens:listing*:[<+step+>]{<+number+>},' +\.'env:boxedverbatim,' +\.'bra:verbatimtabsize,' +\.'bra:listingoffset,' +\.'brs:listinginput[<++>]{<++>}{<++>},' +\.'brs:verbatimtabinput[<++>]{<++>}' + +syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" fold +syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" fold +syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" fold +syn region texZone start="\\begin{listing}" end="\\end{listing}\|%stopzone\>" fold +syn region texZone start="\\begin{listing*}" end="\\end{listing*}\|%stopzone\>" fold + + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/multibox b/vimfiles.latex/ftplugin/latex-suite/packages/multibox new file mode 100644 index 0000000..00bccb2 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/multibox @@ -0,0 +1,10 @@ +if exists("multibox_package_file") + finish +endif +let multibox_package_file = 1 + +let g:TeX_package_option_multibox = '' + +let g:TeX_package_multibox = 'multimake,multiframe' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/multicol b/vimfiles.latex/ftplugin/latex-suite/packages/multicol new file mode 100644 index 0000000..ca93189 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/multicol @@ -0,0 +1,21 @@ +if exists("multicol_package_file") + finish +endif +let multicol_package_file = 1 + +let g:TeX_package_option_multicol = '' + +let g:TeX_package_multicol = +\ 'ens:multicols:{<+cols+>}[<+text+>][<+sep+>],' +\.'columnbreak,' +\.'premulticols,' +\.'postmulticols,' +\.'multicolsep,' +\.'columnsep,' +\.'linewidth,' +\.'columnseprule,' +\.'flushcolumnt,' +\.'raggedcolumns,' +\.'unbalanced' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/newalg b/vimfiles.latex/ftplugin/latex-suite/packages/newalg new file mode 100644 index 0000000..1480bb6 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/newalg @@ -0,0 +1,26 @@ +if exists("newalg_package_file") + finish +endif +let newalg_package_file = 1 + +let g:TeX_package_option_newalg = '' + +let g:TeX_package_newalg = +\ 'ens:algorithm:{<+name+>}{<++>},' +\.'ens:IF:{<+cond+>},' +\.'ens:FOR:{<+loop+>},' +\.'ens:WHILE:{<+cond+>},' +\.'bra:ERROR,' +\.'nor:ELSE,' +\.'nor:RETURN,' +\.'nor:NIL,' +\.'nor:TO,' +\.'bra:CALL,' +\.'bra:text,' +\.'env:REPEAT,' +\.'env:SWITCH,' +\.'nor:=,' +\.'bra:item,' +\.'nor:algkey' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/ngerman b/vimfiles.latex/ftplugin/latex-suite/packages/ngerman new file mode 100644 index 0000000..534ac30 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/ngerman @@ -0,0 +1,10 @@ +if exists("ngerman_package_file") + finish +endif +let ngerman_package_file = 1 + +" For now just define the smart quotes. +let b:Tex_SmartQuoteOpen = '"`' +let b:Tex_SmartQuoteClose = "\"'" + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/numprint b/vimfiles.latex/ftplugin/latex-suite/packages/numprint new file mode 100644 index 0000000..4eab5a2 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/numprint @@ -0,0 +1,18 @@ +if exists("numprint_package_file") + finish +endif +let numprint_package_file = 1 + +let g:TeX_package_option_numprint = '' + +let g:TeX_package_numprint = +\ 'bra:numprint,' +\.'nob:numprint,' +\.'bra:thousandsep,' +\.'bra:decimalsign,' +\.'bra:productsign,' +\.'bra:unitseparator,' +\.'brd:expnumprint,' +\.'global' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/oldstyle b/vimfiles.latex/ftplugin/latex-suite/packages/oldstyle new file mode 100644 index 0000000..72b2774 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/oldstyle @@ -0,0 +1,12 @@ +if exists("oldstyle_package_file") + finish +endif +let oldstyle_package_file = 1 + +let g:TeX_package_option_oldstyle = '' + +let g:TeX_package_oldstyle = +\ 'bra:textos,' +\.'bra:mathos' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/outliner b/vimfiles.latex/ftplugin/latex-suite/packages/outliner new file mode 100644 index 0000000..ca64322 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/outliner @@ -0,0 +1,19 @@ +if exists("outliner_package_file") + finish +endif +let outliner_package_file = 1 + +let g:TeX_package_option_outliner = '' + +let g:TeX_package_outliner = +\ 'env:Outline,' +\.'bra:Level,' +\.'bra:SetBaseLevel,' +\.'sep:preamble,' +\.'bra:OutlinePageBreaks,' +\.'bra:OutlinePageBreaks,' +\.'bra:OutlineLevelStart,' +\.'bra:OutlineLevelCont,' +\.'bra:OutlineLevelEnd' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/overcite b/vimfiles.latex/ftplugin/latex-suite/packages/overcite new file mode 100644 index 0000000..25bc17d --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/overcite @@ -0,0 +1,34 @@ +if exists("overcite_package_file") + finish +endif +let overcite_package_file = 1 + +let g:TeX_package_option_overcite = +\ 'verbose,' +\.'ref,' +\.'nospace,' +\.'space,' +\.'nosort,' +\.'sort,' +\.'nomove,' +\.'noadjust' + +let g:TeX_package_overcite = +\ 'bra:cite,' +\.'bra:citen,' +\.'bra:citenum,' +\.'bra:citeonline,' +\.'bra:nocite,' +\.'sep:redefine,' +\.'bra:citeform,' +\.'bra:citepunct,' +\.'bra:citeleft,' +\.'bra:citeright,' +\.'bra:citemid,' +\.'bra:citedash' + +syn region texRefZone matchgroup=texStatement start="\\citen\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter +syn region texRefZone matchgroup=texStatement start="\\citenum\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter +syn region texRefZone matchgroup=texStatement start="\\citeonline\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/parallel b/vimfiles.latex/ftplugin/latex-suite/packages/parallel new file mode 100644 index 0000000..19dfe8e --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/parallel @@ -0,0 +1,15 @@ +if exists("parallel_package_file") + finish +endif +let parallel_package_file = 1 + +let g:TeX_package_option_parallel = '' + +let g:TeX_package_parallel = +\ 'env:Parallel,' +\.'bra:ParallelLText,' +\.'bra:ParallelRText,' +\.'nor:ParallelPar,' +\.'nor:tolerance' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/plain b/vimfiles.latex/ftplugin/latex-suite/packages/plain new file mode 100644 index 0000000..6a3d092 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/plain @@ -0,0 +1,10 @@ +if exists("plain_package_file") + finish +endif +let plain_package_file = 1 + +let g:TeX_package_option_plain = '' + +let g:TeX_package_plain = 'env:plain' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/plates b/vimfiles.latex/ftplugin/latex-suite/packages/plates new file mode 100644 index 0000000..e22817e --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/plates @@ -0,0 +1,16 @@ +if exists("plates_package_file") + finish +endif +let plates_package_file = 1 + +let g:TeX_package_option_plates = 'figures,onefloatperpage,memoir' + +let g:TeX_package_plates = +\ 'env:plate,' +\.'listofplates,' +\.'ProcessPlates,' +\.'bra:setplatename,' +\.'bra:setplatename,' +\.'bra:atBeginPlates' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/polski b/vimfiles.latex/ftplugin/latex-suite/packages/polski new file mode 100644 index 0000000..e2c4efe --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/polski @@ -0,0 +1,165 @@ +" Author: Mikolaj Machowski <mikmach@wp.pl> +" (c) Copyright by Mikolaj Machowski 2002-2003 +" License: Vim Charityware +" Version: 1.6 +" +" Plik jest w kodowaniu iso-8859-2. Je�li chcesz go uzywac w MS-Windows musisz +" go przekonwertowac na cp-1250. +" +" Plik ten jest cz�ci� vim-latexSuite, ale: +" Nie u�ywaj�cy vim-latexSuite (http://vim-latex.sourceforge.net) mog� wyci�� +" oznaczon� cz��. Reszta mo�e by� kopiowana jako osobny plik pod warunkiem +" niezmieniania tej notki i informacji o prawach autorskich. +" +" This file is in iso-8859-2 encoding. If you want to use it in MS-Windows you +" have to convert it to cp-1250. +" +" This file is part of vim-latexSuite but: +" Those who do not use vim-latexSuite (http://vim-latex.sourceforge.net) can +" cut off marked part. Rest of the file can be copied as separate file under +" condition of leaving this notice and information about copyrights unchanged. + +if exists("acromake_package_file") + finish +endif +let acromake_package_file = 1 + +" --------8<------------- +" Czesc odpowiedzialna za menu +let g:TeX_package_option_polski = +\'OT1,OT4,T1,QX,plmath,nomathsymbols,MeX,prefixingverb,noprefixingverb' +let g:TeX_package_polski = +\'sbr:Dywiz&Ska,'. +\'nor:dywiz,'. +\'nor:ppauza,'. +\'nor:pauza,'. +\'nor:prefixing,'. +\'nor:nonprefixing,'. +\'nor:PLdateending,'. +\'sbr:Matematyka,'. +\'nor:arccos,'. +\'nor:arcctan,'. +\'nor:arcsin,'. +\'nor:arctan,'. +\'nor:cot,'. +\'nor:ctanh,'. +\'nor:tan,'. +\'nor:tanh,'. +\'bra:arc,'. +\'nor:ctg,'. +\'nor:ctgh,'. +\'nor:tg,'. +\'nor:tgh,'. +\'nor:nwd' + +" To wymaga calego pakietu vim-latexSuite - zakomentuj lub wytnij je�li nie +" u�ywasz (albo go �ci�gnij z http://vim-latex.sf.net) +function! TPackagePolskiTylda() + call IMAP (" ---", "~---", "tex") +endfunction +call TPackagePolskiTylda() +" --------8<------------- + +" Polskie znaki cudzyslowow +TexLet g:Tex_SmartQuoteOpen = ",," +TexLet g:Tex_SmartQuoteClose = "''" + +" Zmodyfikowana i rozwinieta funkcja Andrzeja Ostruszki +" Z dodatkiem od Benjiego Fishera (sprawdzanie sk�adni) +" +" Spacja +inoremap <buffer> <silent> <Space> <C-R>=<SID>Tex_polish_space()<CR> +inoremap <buffer> <silent> <CR> <C-R>=<SID>Tex_polish_space()<CR><BS><CR> + +" Wymuszenie tyldy +inoremap <buffer> <silent> <S-Space> ~ + +" Wymuszenie zwyklej spacji +inoremap <buffer> <silent> <C-Space> <Space> + +" Latwe przelaczanie sie miedzy magiczna spacja a zwykla +inoremap <buffer> <silent> <F8> <C-R>=<SID>TogglePolishSpace()<CR> + +function! s:TogglePolishSpace() + if !exists("b:polishspace") + iunmap <buffer> <Space> + iunmap <buffer> <CR> + let b:polishspace = 1 + return '' + else + inoremap <buffer> <silent> <Space> <C-R>=<SID>Tex_polish_space()<CR> + inoremap <buffer> <silent> <CR> <C-R>=<SID>Tex_polish_space()<CR><BS><CR> + unlet b:polishspace + return '' + endif +endfunction + + +function! s:Tex_polish_space() + "Nic magicznego w matematyce + if synIDattr(synID(line('.'),col('.')-1,0),"name") =~ '^texMath\|^texZone\^texRefZone' + return ' ' + else + let s:col = col('.') + let s:linelength = strlen(getline('.')) + 1 + " Wstaw tylde po spojnikach + if strpart(getline('.'), col('.') - 3, 2) =~? '^[[:space:]~(\[{]\?[aiouwz]$' + return '~' + " Wstaw tylde po inicjalach - konkretnie po pojedynczych wielkich + " literach i kropce. Obs�uguje poprawnie wiekszosc sytuacji. + elseif strpart(getline('.'), col('.') - 4, 3) =~? '^[[:space:]~(\[{]\?\u\.$' + return '~' + " Wstaw tylde po tytulach, skrotach bibliograficznych, podpisach + elseif strpart(getline('.'), col('.') - 9, 8) =~? '\(\s\|^\|\~\)\(str\.\|ryc\.\|rys\.\|tab\.\|art\.\|vol\.\|nr\|tabl\.\|rozdz\.\|ss\.\|s\.\|t\.\|z\.\|sir\|prof\.\|hab\.\|red\.\|min\.\|gen\.\|kpt\.\|przew\.\|p�k\|mjr\|mgr\|bp\|ks\.\|o\+\.\|�w\.\|dr\)$' + return '~' + " Wstaw tylde miedzy rokiem, wiekiem, a odpowiednim skrotem + elseif strpart(getline('.'), col('.') - 8, 7) =~? '[0-9IVXLCM]\s\+\(r\|w\)\.[^a-z����]\{-}$' + s/[0-9IVXLCM]\zs\s\+\ze\(w\|r\)\.[^a-z����]\{-}\%#/\~/ei + exe 'normal '.s:col.'|' + if s:col == s:linelength + startinsert! + else + startinsert + endif + return ' ' + " Wstaw tylde miedzy liczba a miara, itd. + elseif strpart(getline('.'), col('.') - 10, 9) =~? '\(\d\|mln\|mld\|tys\.\)\s\+\(z�\|gr\|ha\|t\|mies\|godz\|min\|sek\|cm\|km\|mln\|mld\|tys\.\)[^a-z����]\{-}$' + s/\(\d\|mln\|mld\|tys\.\)\zs\s\+\ze\(z�\|gr\|ha\|m\|t\|mies\|godz\|min\|sek\|cm\|km\|mln\|mld\|tys\.\)[^a-z����]\{-}\%#/\~/ei + exe 'normal '.s:col.'|' + if s:col == s:linelength + startinsert! + else + startinsert + endif + return ' ' + " Rozwin myslnik w zbitkach w '\dywiz ': + " bialo-czerwony -> bialo\dywiz czerwony + elseif strpart(getline('.'), col('.') - 20, 19) =~? '[a-z����]-[a-z����]\{-}[^a-z����]\{-}$' + s/[a-z����]\zs-\ze[a-z����]\{-}[^a-z����]\{-}\%#/\\dywiz /ei + let colb = s:col + 6 + exe 'normal '.colb.'|' + if s:col == s:linelength + startinsert! + else + startinsert + endif + return ' ' + " Rozwin '--' miedzy liczbami w '\ppauza ': + " 39--45 -> 39\ppauza 45 + elseif strpart(getline('.'), col('.') - 10, 9) =~? '[0-9IVXLCM]--[0-9IVXLCM]\{-}[^0-9IVXLCM]\{-}$' + s/[0-9IVXLCM]\zs--\ze[0-9IVXLCM]\{-}[^0-9IVXLCM]\{-}\%#/\\ppauza /ei + let colb = s:col + 6 + exe 'normal '.colb.'|' + if s:col == s:linelength + startinsert! + else + startinsert + endif + return ' ' + endif + " Tu koncz komentowanie ostatniej sekcji + endif + return " " +endfunction + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/psgo b/vimfiles.latex/ftplugin/latex-suite/packages/psgo new file mode 100644 index 0000000..1ef852c --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/psgo @@ -0,0 +1,27 @@ +if exists("psgo_package_file") + finish +endif +let psgo_package_file = 1 + +let g:TeX_package_option_psgo = '' + +let g:TeX_package_psgo = +\ 'env:psgogoard,' +\.'env:psgoboard*,' +\.'brs:stone{<+color+>}{<+letter+>}{<+number+>},' +\.'brs:stone[<+marker+>]{<+color+>}{<+letter+>}{<+number+>},' +\.'brs:move{<+letter+>}{<+number+>},' +\.'brs:move*{<+letter+>}{<+number+>},' +\.'brs:goline{<+letter1+>}{<+number1+>}{<+letter2+>}{<+number2+>},' +\.'brs:goarrow{<+letter1+>}{<+number1+>}{<+letter2+>}{<+number2+>},' +\.'sbr:Markers,' +\.'brs:markpos{<+marker+>}{<+letter+>}{<+number+>},' +\.'markma,' +\.'marktr,' +\.'markcr,' +\.'marksq,' +\.'bra:marklb,' +\.'marksl,' +\.'markdd' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/schedule b/vimfiles.latex/ftplugin/latex-suite/packages/schedule new file mode 100644 index 0000000..7d58f6d --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/schedule @@ -0,0 +1,20 @@ +if exists("schedule_package_file") + finish +endif +let schedule_package_file = 1 + +let g:TeX_package_option_schedule = '' + +let g:TeX_package_schedule = +\ 'ens:schedule:[<+title+>],' +\.'bra:CellHeight,' +\.'bra:CellWidth,' +\.'bra:TimeRange,' +\.'bra:SubUnits,' +\.'bra:BeginOn,' +\.'bra:TextSize,' +\.'nor:FiveDay,' +\.'nor:SevenDay,' +\.'brs:NewAppointment{<+name+>}{<+bg+>}{<+fg+>}' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/textfit b/vimfiles.latex/ftplugin/latex-suite/packages/textfit new file mode 100644 index 0000000..4d52785 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/textfit @@ -0,0 +1,12 @@ +if exists("textfit_package_file") + finish +endif +let textfit_package_file = 1 + +let g:TeX_package_option_textfit = '' + +let g:TeX_package_textfit = +\ 'brd:scaletowidth,' +\.'brd:scaletoheight' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/times b/vimfiles.latex/ftplugin/latex-suite/packages/times new file mode 100644 index 0000000..499a13b --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/times @@ -0,0 +1,10 @@ +if exists("times_package_file") + finish +endif +let times_package_file = 1 + +let g:TeX_package_option_times = '' + +let g:TeX_package_times = '' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/tipa b/vimfiles.latex/ftplugin/latex-suite/packages/tipa new file mode 100644 index 0000000..c89cc5d --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/tipa @@ -0,0 +1,364 @@ +if exists("tipa_package_file") + finish +endif +let tipa_package_file = 1 + +let g:TeX_package_option_tipa = +\ 'T1,' +\.'noenc,' +\.'tone,' +\.'extra,' +\.'safe' + +let g:TeX_package_tipa = +\ 'sbr:Common,' +\.'bra:textipa,' +\.'env:IPA,' +\.'tipaencoding,' +\.'bra:super,' +\.'nor:ipabar,' +\.'brd:tipalowaraccent,' +\.'brd:tipaupperaccent,' +\.'brd:tipaLowaraccent,' +\.'brd:tipaUpperaccent,' +\.'brd:ipaclap,' +\.'sbr:VowelsandConsonants,' +\.'nor:textturna,' +\.'nor:textrhooka,' +\.'nor:textlhookfour,' +\.'nor:textscripta,' +\.'nor:textturnscripta,' +\.'nor:textinvscripta,' +\.'ae,' +\.'nor:textaolig,' +\.'nor:textsca,' +\.'nor:textinvsca,' +\.'nor:textscaolig,' +\.'nor:textturnv,' +\.'nor:textsoftsign,' +\.'nor:texthardsign,' +\.'nor:texthtb,' +\.'nor:textscb,' +\.'nor:textcrb,' +\.'nor:textbarb,' +\.'nor:textbeta,' +\.'nor:textbarc,' +\.'nor:texthtc,' +\.'bra:v,' +\.'bra:c,' +\.'nor:textctc,' +\.'nor:textstretchc,' +\.'nor:textstretchcvar,' +\.'nor:textctstretchc,' +\.'nor:textctstretchcvar,' +\.'nor:textcrd,' +\.'nor:textbard,' +\.'nor:texthtd,' +\.'nor:textrtaild,' +\.'nor:texthtrtaild,' +\.'nor:textctd,' +\.'nor:textfrhookd,' +\.'nor:textfrhookdvar,' +\.'nor:textdblig,' +\.'nor:textdzlig,' +\.'nor:textdctzlig,' +\.'nor:textdyoghlig,' +\.'nor:textctdctzlig,' +\.'nor:textscdelta,' +\.'nor:dh,' +\.'nor:textrhooke,' +\.'nor:textschwa,' +\.'nor:textrhookschwa,' +\.'nor:textreve,' +\.'nor:textsce,' +\.'nor:textepsilon,' +\.'nor:textrhookepsilon,' +\.'nor:textcloseepsilon,' +\.'nor:textrevepsilon,' +\.'nor:textrhookrevepsilon,' +\.'nor:textcloserevepsilon,' +\.'nor:textscf,' +\.'nor:textscriptg,' +\.'nor:textbarg,' +\.'nor:textcrg,' +\.'nor:texthtg,' +\.'nor:textg,' +\.'nor:textscg,' +\.'nor:texthtscg,' +\.'nor:textgamma,' +\.'nor:textgrgamma,' +\.'nor:textfrtailgamma,' +\.'nor:textbktailgamma,' +\.'nor:textbabygamma,' +\.'nor:textramshorns,' +\.'nor:texthvlig,' +\.'nor:textcrh,' +\.'nor:texthth,' +\.'nor:textrtailhth,' +\.'nor:textheng,' +\.'nor:texththeng,' +\.'nor:textturnh,' +\.'nor:textsch,' +\.'nor:i,' +\.'nor:textbari,' +\.'nor:textiota,' +\.'nor:textlhti,' +\.'nor:textlhtlongi,' +\.'nor:textvibyi,' +\.'nor:textraisevibyi,' +\.'nor:textsci,' +\.'nor:j,' +\.'nor:textctj,' +\.'nor:textctjvar,' +\.'nor:textscj,' +\.'bra:v,' +\.'nor:textbardotlessj,' +\.'nor:textObardotlessj,' +\.'nor:texthtbardotlessj,' +\.'nor:texthtbardotlessjvar,' +\.'nor:texthtk,' +\.'nor:textturnk,' +\.'nor:textsck,' +\.'nor:textturnsck,' +\.'nor:textltilde,' +\.'nor:textbarl,' +\.'nor:textbeltl,' +\.'nor:textrtaill,' +\.'nor:textlyoghlig,' +\.'nor:textOlyoghlig,' +\.'nor:textscl,' +\.'nor:textrevscl,' +\.'nor:textlambda,' +\.'nor:textcrlambda,' +\.'nor:textltailm,' +\.'nor:textturnm,' +\.'nor:textturnmrleg,' +\.'nor:texthmlig,' +\.'nor:textscm,' +\.'nor:textnrleg,' +\.'~,' +\.'nor:textltailn,' +\.'nor:textfrbarn,' +\.'nor:ng,' +\.'nor:textrtailn,' +\.'nor:textctn,' +\.'nor:textnrleg,' +\.'nor:textscn,' +\.'nor:textbullseye,' +\.'nor:textObullseye,' +\.'nor:textbaro,' +\.'nor:o,' +\.'nor:textfemale,' +\.'nor:textuncrfemale,' +\.'nor:oe,' +\.'nor:textscoelig,' +\.'nor:textopeno,' +\.'nor:textrhookopeno,' +\.'nor:textturncelig,' +\.'nor:textomega,' +\.'nor:textinvomega,' +\.'nor:textscomega,' +\.'nor:textcloseomega,' +\.'nor:textlhookp,' +\.'nor:textscp,' +\.'nor:textwynn,' +\.'nor:textthorn,' +\.'nor:textthornvari,' +\.'nor:textthornvarii,' +\.'nor:textthornvariii,' +\.'nor:textthornvariv,' +\.'nor:texthtp,' +\.'nor:textphi,' +\.'nor:texthtq,' +\.'nor:textqplig,' +\.'nor:textscq,' +\.'nor:textfishhookr,' +\.'nor:textlonglegr,' +\.'nor:textrtailr,' +\.'nor:textturnr,' +\.'nor:textturnrrtail,' +\.'nor:textturnlonglegr,' +\.'nor:textscr,' +\.'nor:textinvscr,' +\.'nor:textrevscr,' +\.'bra:v,' +\.'nor:textrtails,' +\.'nor:textesh,' +\.'nor:textdoublebaresh,' +\.'nor:textctesh,' +\.'nor:textlooptoprevesh,' +\.'nor:texthtt,' +\.'nor:textlhookt,' +\.'nor:textrtailt,' +\.'nor:textfrhookt,' +\.'nor:textctturnt,' +\.'nor:texttctclig,' +\.'nor:texttslig,' +\.'nor:textteshlig,' +\.'nor:textturnt,' +\.'nor:textctt,' +\.'nor:textcttctclig,' +\.'nor:texttheta,' +\.'nor:textbaru,' +\.'nor:textupsilon,' +\.'nor:textscu,' +\.'nor:textturnscu,' +\.'nor:textscriptv,' +\.'nor:textturnw,' +\.'nor:textchi,' +\.'nor:textturny,' +\.'nor:textscy,' +\.'nor:textlhtlongy,' +\.'nor:textvibyy,' +\.'nor:textcommatailz,' +\.'bra:v,' +\.'nor:textctz,' +\.'nor:textrtailz,' +\.'nor:textcrtwo,' +\.'nor:textturntwo,' +\.'nor:textyogh,' +\.'nor:textbenttailyogh,' +\.'nor:textrevyogh,' +\.'nor:textctyogh,' +\.'nor:textturnthree,' +\.'nor:textglotstop,' +\.'nor:textraiseglotstop,' +\.'nor:textbarglotstop,' +\.'nor:textinvglotstop,' +\.'nor:textcrinvglotstop,' +\.'nor:textctinvglotstop,' +\.'nor:textrevglotstop,' +\.'nor:textturnglotstop,' +\.'nor:textbarrevglotstop,' +\.'nor:textpipe,' +\.'nor:textpipevar,' +\.'nor:textdoublebarpipe,' +\.'nor:textdoublebarpipevar,' +\.'nor:textdoublepipevar,' +\.'nor:textdoublepipe,' +\.'nor:textdoublebarslash,' +\.'sbr:Suprasegmentals,' +\.'nor:textprimstress,' +\.'nor:textsecstress,' +\.'nor:textlengthmark,' +\.'nor:texthalflength,' +\.'nor:textvertline,' +\.'nor:textdoublevertline,' +\.'bra:textbottomtiebar,' +\.'nor:textdownstep,' +\.'nor:textupstep,' +\.'nor:textglobfall,' +\.'nor:textglobrise,' +\.'nor:textspleftarrow,' +\.'nor:textdownfullarrow,' +\.'nor:textupfullarrow,' +\.'nor:textsubrightarrow,' +\.'nor:textsubdoublearrow,' +\.'sbr:AccentsandDiacritics,' +\.'`,' +\."'," +\.'^,' +\.'~,' +\.'",' +\.'bra:H,' +\.'bra:r,' +\.'bra:v,' +\.'bra:u,' +\.'=,' +\.'.,' +\.'bra:c,' +\.'bra:textpolhook,' +\.'nor:textrevpolhook{o,' +\.'bra:textdoublegrave,' +\.'bra:textsubgrave,' +\.'bra:textsubacute,' +\.'bra:textsubcircum,' +\.'bra:textroundcap,' +\.'bra:textacutemacron,' +\.'bra:textgravemacron,' +\.'bra:textvbaraccent,' +\.'bra:textdoublevbaraccent,' +\.'bra:textgravedot,' +\.'bra:textdotacute,' +\.'bra:textcircumdot,' +\.'bra:texttildedot,' +\.'bra:textbrevemacron,' +\.'bra:textringmacron,' +\.'bra:textacutewedge,' +\.'bra:textdotbreve,' +\.'bra:textsubbridge,' +\.'bra:textinvsubbridge,' +\.'sbr:SubscriptSquare,' +\.'bra:textsubrhalfring,' +\.'bra:textsublhalfring,' +\.'bra:textsubw,' +\.'bra:textoverw,' +\.'bra:textseagull,' +\.'bra:textovercross,' +\.'bra:textsubplus,' +\.'bra:textraising,' +\.'bra:textlowering,' +\.'bra:textadvancing,' +\.'bra:textretracting,' +\.'bra:textsubtilde,' +\.'bra:textsubumlaut,' +\.'bra:textsubring,' +\.'bra:textsubwedge,' +\.'bra:textsubbar,' +\.'bra:textsubdot,' +\.'bra:textsubarch,' +\.'bra:textsyllabic,' +\.'bra:textsuperimposetilde,' +\.'nor:textcorner,' +\.'nor:textopencorner,' +\.'nor:textrhoticity,' +\.'nor:textceltpal,' +\.'nor:textlptr,' +\.'nor:textrptr,' +\.'nor:textrectangle,' +\.'nor:textretractingvar,' +\.'bra:texttoptiebar,' +\.'nor:textrevapostrophe,' +\.'nor:texthooktop,' +\.'nor:textrthook,' +\.'nor:textrthooklong,' +\.'nor:textpalhook,' +\.'nor:textpalhooklong,' +\.'nor:textpalhookvar,' +\.'bra:textsuperscript,' +\.'sbr:ToneLetters,' +\.'bra:tone,' +\.'bra:stone,' +\.'bra:rtone,' +\.'nor:tone{55},' +\.'nor:tone{44},' +\.'nor:tone{33},' +\.'nor:tone{22},' +\.'nor:tone{11},' +\.'nor:tone{51},' +\.'nor:tone{15},' +\.'nor:tone{45},' +\.'nor:tone{12},' +\.'nor:tone{454},' +\.'sbr:DiacriticsExtIPA,' +\.'bra:spreadlips,' +\.'bra:overbridge,' +\.'bra:bibridge,' +\.'bra:subdoublebar,' +\.'bra:subdoublevert,' +\.'bra:subcorner,' +\.'bra:whistle,' +\.'bra:sliding,' +\.'bra:crtilde,' +\.'bra:dottedtilde,' +\.'bra:doubletilde,' +\.'bra:partvoiceless,' +\.'bra:inipartvoiceless,' +\.'bra:finpartvoiceless,' +\.'bra:partvoice,' +\.'bra:inipartvoice,' +\.'bra:finpartvoice,' +\.'bra:sublptr,' +\.'bra:subrptr' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/ulem b/vimfiles.latex/ftplugin/latex-suite/packages/ulem new file mode 100644 index 0000000..9257713 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/ulem @@ -0,0 +1,21 @@ +if exists("ulem_package_file") + finish +endif +let ulem_package_file = 1 + +let g:TeX_package_option_ulem = +\ 'normalem,' +\.'ULforem,' +\.'normalbf,' +\.'UWforbf' + +let g:TeX_package_ulem = +\ 'bra:uwave,' +\.'bra:uline,' +\.'bra:uuline,' +\.'bra:sout,' +\.'bra:xout,' +\.'ULthickness,' +\.'ULdepth' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/url b/vimfiles.latex/ftplugin/latex-suite/packages/url new file mode 100644 index 0000000..642148a --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/url @@ -0,0 +1,24 @@ +if exists("url_package_file") + finish +endif +let url_package_file = 1 + +let g:TeX_package_option_url = +\ 'hyphens,' +\.'obeyspaces,' +\.'spaces,' +\.'T1' + +let g:TeX_package_url = +\ 'bra:urlstyle,' +\.'bra:url,' +\.'bra:path,' +\.'bra:urldef' + +" TODO uncomment if you figure out +" 1. how to get this syn command to work every time instead of only the +" first time this file is sourced. +" syn region texZone start="\\url{" end="}\|%stopzone\>" +" syn region texZone start="\\path{" end="}\|%stopzone\>" + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/verbatim b/vimfiles.latex/ftplugin/latex-suite/packages/verbatim new file mode 100644 index 0000000..f2137ff --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/verbatim @@ -0,0 +1,18 @@ +if exists("verbatim_package_file") + finish +endif +let verbatim_package_file = 1 + +let g:TeX_package_option_verbatim = '' + +let g:TeX_package_verbatim = +\ 'env:comment,' +\.'env:verbatim,' +\.'env:verbatim*,' +\.'bra:verbatiminput,' +\.'bra:verbatiminput' + +syn region texZone start="\\begin{comment}" end="\\end{comment}\|%stopzone\>" fold +syn region texZone start="\\begin{verbatim}" end="\\end{verbatim}\|%stopzone\>" fold + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/packages/version b/vimfiles.latex/ftplugin/latex-suite/packages/version new file mode 100644 index 0000000..4de9da8 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/packages/version @@ -0,0 +1,12 @@ +if exists("version_package_file") + finish +endif +let version_package_file = 1 + +let g:TeX_package_option_version = '' + +let g:TeX_package_version = +\ 'bra:includeversion,' +\.'bra:excludeversion' + +" vim:ft=vim:ff=unix: diff --git a/vimfiles.latex/ftplugin/latex-suite/projecttemplate.vim b/vimfiles.latex/ftplugin/latex-suite/projecttemplate.vim new file mode 100644 index 0000000..1ab4be0 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/projecttemplate.vim @@ -0,0 +1,11 @@ +" Project name +" let g:projName = '' +" +" Project files +" let g:projFiles = '' + + +" Vim settings/maps/abbrs specific for this project + +" Modeline for this file +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:ft=vim diff --git a/vimfiles.latex/ftplugin/latex-suite/pytools.py b/vimfiles.latex/ftplugin/latex-suite/pytools.py new file mode 100644 index 0000000..1934e23 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/pytools.py @@ -0,0 +1,52 @@ +import string, vim, re, os, glob +# catFile: assigns a local variable retval to the contents of a file {{{ +def catFile(filename): + try: + file = open(filename) + lines = ''.join(file.readlines()) + file.close() + except: + lines = '' + + # escape double quotes and backslashes before quoting the string so + # everything passes throught. + vim.command("""let retval = "%s" """ % re.sub(r'"|\\', r'\\\g<0>', lines)) + return lines + +# }}} +# isPresentInFile: check if regexp is present in the file {{{ +def isPresentInFile(regexp, filename): + try: + fp = open(filename) + fcontents = string.join(fp.readlines(), '') + fp.close() + if re.search(regexp, fcontents): + vim.command('let retval = 1') + return 1 + else: + vim.command('let retval = 0') + return None + except: + vim.command('let retval = 0') + return None + +# }}} +# deleteFile: deletes a file if present {{{ +# If the file does not exist, check if its a filepattern rather than a +# filename. If its a pattern, then deletes all files matching the +# pattern. +def deleteFile(filepattern): + if os.path.exists(filepattern): + try: + os.remove(filepattern) + except: + vim.command('let retval = -1') + else: + if glob.glob(filepattern): + for filename in glob.glob(filepattern): + os.remove(filename) + else: + vim.command('let retval = -1') + +# }}} +# vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap diff --git a/vimfiles.latex/ftplugin/latex-suite/smartspace.vim b/vimfiles.latex/ftplugin/latex-suite/smartspace.vim new file mode 100644 index 0000000..07526d8 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/smartspace.vim @@ -0,0 +1,102 @@ +"============================================================================= +" File: smartspace.vim +" Author: Carl Muller +" Created: Fri Dec 06 12:00 AM 2002 PST +" +" Description: +" Maps the <space> key in insert mode so that mathematical formulaes are +" always kept on the same line. i.e, $$'s dont get broken across multiple +" lines. +"============================================================================= + +" Avoid reinclusion or if the user doesn't want us. +if exists('b:done_smartspace') + \ || (exists('g:Tex_SmartKeySpace') && !g:Tex_SmartKeySpace) + finish +endif +let b:done_smartspace = 1 + +" Smart space relies on taking over vim's insertion of carriage returns in +" order to keep $$'s on the same line. The only way to get vim not to break +" lines is to set tw=0. +" +" NOTE: setting tw != 0 will break smartspace +" the user's 'tw' setting is still respected in the insert mode. +" However, normal mode actions which rely on 'tw' such as gqap will be +" broken because of the faulty 'tw' setting. +let b:tw = &l:tw +setlocal tw=0 + +inoremap <buffer> <silent> <Space> <Space><Esc>:call <SID>TexFill(b:tw)<CR>a + +" Do not redefine the function. +if exists('*s:TexFill') + finish +endif + +" TexFormatLine: format line retaining $$'s on the same line. {{{ +function! s:TexFill(width) + if a:width != 0 && col(".") > a:width + " For future use, record the current line and the number of the current column + let current_line = getline(".") + let current_column = col(".") + exe "normal! a##\<Esc>" + call <SID>TexFormatLine(a:width,current_line,current_column) + exe "normal! ?##\<CR>2s\<Esc>" + " Remove ## from the search history. + call histdel("/", -1)|let @/=histget("/", -1) + endif +endfunction + +" }}} +function! s:TexFormatLine(width, current_line, current_column) " {{{ + " get the first non-blank character. + let first = matchstr(getline('.'), '\S') + normal! $ + let length = col('.') + let go = 1 + while length > a:width+2 && go + let between = 0 + let string = strpart(getline('.'), 0, a:width) + " Count the dollar signs + let number_of_dollars = 0 + let evendollars = 1 + let counter = 0 + while counter <= a:width-1 + " Pay attention to '$$'. + if string[counter] == '$' && string[counter-1] != '$' + let evendollars = 1 - evendollars + let number_of_dollars = number_of_dollars + 1 + endif + let counter = counter + 1 + endwhile + " Get ready to split the line. + exe 'normal! ' . (a:width + 1) . '|' + if evendollars + " Then you are not between dollars. + exe "normal! ?\\$\\+\\| \<CR>W" + else + " Then you are between dollars. + normal! F$ + if col(".") == 1 || getline('.')[col(".")-1] != "$" + let go = 0 + endif + endif + if first == '$' && number_of_dollars == 1 + let go = 0 + else + exe "normal! i\<CR>\<Esc>$" + " get the first non-blank character. + let first = matchstr(getline('.'), '\S') + endif + let length = col(".") + endwhile + if go == 0 && strpart(a:current_line, 0, a:current_column) =~ '.*\$.*\$.*' + exe "normal! ^f$a\<CR>\<Esc>" + call <SID>TexFormatLine(a:width, a:current_line, a:current_column) + endif +endfunction + +" }}} + +" vim:fdm=marker:ts=4:sw=4:noet diff --git a/vimfiles.latex/ftplugin/latex-suite/templates.vim b/vimfiles.latex/ftplugin/latex-suite/templates.vim new file mode 100644 index 0000000..8f4ff39 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/templates.vim @@ -0,0 +1,148 @@ +"============================================================================= +" File: templates.vim +" Author: Gergely Kontra +" (minor modifications by Srinath Avadhanula) +" (plus other modifications by Mikolaj Machowski) +" Version: 1.0 +" Created: Tue Apr 23 05:00 PM 2002 PST +" CVS: $Id: templates.vim 997 2006-03-20 09:45:45Z srinathava $ +" +" Description: functions for handling templates in latex-suite/templates +" directory. +"============================================================================= + +let s:path = expand("<sfile>:p:h") + +" SetTemplateMenu: sets up the menu for templates {{{ +function! <SID>SetTemplateMenu() + let flist = Tex_FindInRtp('', 'templates') + let i = 1 + while 1 + let fname = Tex_Strntok(flist, ',', i) + if fname == '' + break + endif + exe "amenu ".g:Tex_TemplatesMenuLocation."&".i.":<Tab>".fname." ". + \":call <SID>ReadTemplate('".fname."')<CR>" + let i = i + 1 + endwhile +endfunction + +if g:Tex_Menus + call <SID>SetTemplateMenu() +endif + +" }}} +" ReadTemplate: reads in the template file from the template directory. {{{ +function! <SID>ReadTemplate(...) + if a:0 > 0 + let filename = a:1 + else + let filelist = Tex_FindInRtp('', 'templates') + let filename = + \ Tex_ChooseFromPrompt("Choose a template file:\n" . + \ Tex_CreatePrompt(filelist, 2, ',') . + \ "\nEnter number or name of file :", + \ filelist, ',') + endif + + let fname = Tex_FindInRtp(filename.'.tex', 'templates', ':p') + call Tex_Debug("0read ".fname, 'templates') + + silent! exe "0read ".fname + + " The first line of the file contains the specifications of what the + " placeholder characters and the other special characters are. + let pattern = '\v(\S+)\t(\S+)\t(\S+)\t(\S+)' + + let s:phsTemp = substitute(getline(1), pattern, '\1', '') + let s:pheTemp = substitute(getline(1), pattern, '\2', '') + let s:exeTemp = substitute(getline(1), pattern, '\3', '') + let s:comTemp = substitute(getline(1), pattern, '\4', '') + + call s:ProcessTemplate() + 0 d_ + + " Do not handle the placeholders here. Let IMAP_PutTextWithMovement do it + " because it handles UTF-8 character substitutions etc. Therefore delete + " the text into @a and paste it using IMAP_PutTextWithMovement(). + let _a = @a + normal! ggVG"ax + + let _fo = &fo + " Since IMAP_PutTextWithMovement simulates the key-presses, leading + " indendatation can get duplicated in strange ways if ``fo`` is non-empty. + " NOTE: the indentexpr thingie is still respected with an empty fo so that + " environments etc are properly indented. + set fo= + + call Tex_Debug("normal! i\<C-r>=IMAP_PutTextWithMovement(@a, '".s:phsTemp."', '".s:pheTemp."')\<CR>", 'templates') + exec "normal! i\<C-r>=IMAP_PutTextWithMovement(@a, '".s:phsTemp."', '".s:pheTemp."')\<CR>" + + let &fo = _fo + let @a = _a + + call Tex_Debug('phs = '.s:phsTemp.', phe = '.s:pheTemp.', exe = '.s:exeTemp.', com = '.s:comTemp, 'templates') + + call Tex_pack_updateall(1) +endfunction + +" }}} +" ProcessTemplate: processes the special characters in template file. {{{ +" This implementation follows from Gergely Kontra's +" mu-template.vim +" http://vim.sourceforge.net/scripts/script.php?script_id=222 +function! <SID>ProcessTemplate() + if exists('s:phsTemp') && s:phsTemp != '' + + exec 'silent! %s/^'.s:comTemp.'\(\_.\{-}\)'.s:comTemp.'$/\=<SID>Compute(submatch(1))/ge' + exec 'silent! %s/'.s:exeTemp.'\(.\{-}\)'.s:exeTemp.'/\=<SID>Exec(submatch(1))/ge' + exec 'silent! g/'.s:comTemp.s:comTemp.'/d' + + " A function only puts one item into the search history... + call Tex_CleanSearchHistory() + endif +endfunction + +function! <SID>Exec(what) + exec 'return '.a:what +endfunction + +" Back-Door to trojans !!! +function! <SID>Compute(what) + exe a:what + if exists('s:comTemp') + return s:comTemp.s:comTemp + else + return '' + endif +endfunction + +" }}} +" Command definitions {{{ +if v:version >= 602 + com! -complete=custom,Tex_CompleteTemplateName -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>) + \| :startinsert + + " Tex_CompleteTemplateName: for completing names in TTemplate command {{{ + " Description: get list of template names with Tex_FindInRtp(), remove full path + " and return list of names separated with newlines. + " + function! Tex_CompleteTemplateName(A,P,L) + " Get name of macros from all runtimepath directories + let tmplnames = Tex_FindInRtp('', 'templates') + " Separate names with \n not , + let tmplnames = substitute(tmplnames,',','\n','g') + return tmplnames + endfunction + " }}} + +else + com! -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>) + \| :startinsert + +endif + +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/templates/IEEEtran.tex b/vimfiles.latex/ftplugin/latex-suite/templates/IEEEtran.tex new file mode 100644 index 0000000..104f9b2 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/templates/IEEEtran.tex @@ -0,0 +1,142 @@ +<+ +> !comp! !exe! +%% Based on <bare_jrnl.tex> in the ieee package available from CTAN, +%% I have changed the options so that most useful ones are clubbed together, +%% Have a look at <bare_jrnl.tex> to understand the function of each package. + +%% This code is offered as-is - no warranty - user assumes all risk. +%% Free to use, distribute and modify. + +% *** Authors should verify (and, if needed, correct) their LaTeX system *** +% *** with the testflow diagnostic prior to trusting their LaTeX platform *** +% *** with production work. IEEE's font choices can trigger bugs that do *** +% *** not appear when using other class files. *** +% Testflow can be obtained at: +% http://www.ctan.org/tex-archive/macros/latex/contrib/supported/IEEEtran/testflow + +% File: !comp!expand("%:p:t")!comp! +% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% +\documentclass[journal]{IEEEtran} + +\usepackage{cite, graphicx, subfigure, amsmath} +\interdisplaylinepenalty=2500 + +% *** Do not adjust lengths that control margins, column widths, etc. *** +% *** Do not use packages that alter fonts (such as pslatex). *** +% There should be no need to do such things with IEEEtran.cls V1.6 and later. + +<++> +% correct bad hyphenation here +\hyphenation{<+op-tical net-works semi-conduc-tor+>} + + +\begin{document} +% +% paper title +\title{<+Skeleton of IEEEtran.cls for Journals in VIM-Latex+>} +% +% +% author names and IEEE memberships +% note positions of commas and nonbreaking spaces ( ~ ) LaTeX will not break +% a structure at a ~ so this keeps an author's name from being broken across +% two lines. +% use \thanks{} to gain access to the first footnote area +% a separate \thanks must be used for each paragraph as LaTeX2e's \thanks +% was not built to handle multiple paragraphs +\author{<+Sumit Bhardwaj+>~\IEEEmembership{<+Student~Member,~IEEE,+>} +<+John~Doe+>,~\IEEEmembership{<+Fellow,~OSA,+>} +<+and~Jane~Doe,+>~\IEEEmembership{<+Life~Fellow,~IEEE+>}}% <-this % stops a space +\thanks{<+Manuscript received January 20, 2002; revised August 13, 2002. +This work was supported by the IEEE.+>}% <-this % stops a space +\thanks{<+S. Bhardwaj is with the Indian Institute of Technology, Delhi.+>} +% +% The paper headers +\markboth{<+Journal of VIM-\LaTeX\ Class Files,~Vol.~1, No.~8,~August~2002+>}{ +<+Bhardwaj \MakeLowercase{\textit{et al.}+>}: <+Skeleton of IEEEtran.cls for Journals in VIM-Latex+>} +% The only time the second header will appear is for the odd numbered pages +% after the title page when using the twoside option. + + +% If you want to put a publisher's ID mark on the page +% (can leave text blank if you just want to see how the +% text height on the first page will be reduced by IEEE) +%\pubid{0000--0000/00\$00.00~\copyright~2002 IEEE} + +% use only for invited papers +%\specialpapernotice{(Invited Paper)} + +% make the title area +\maketitle + + +\begin{abstract} +<+The abstract goes here.+> +\end{abstract} + +\begin{keywords} +<+IEEEtran, journal, \LaTeX, paper, template, VIM, VIM-\LaTeX+>. +\end{keywords} + +\section{Introduction} +\PARstart{<+T+>}{<+his+>} <+demo file is intended to serve as a ``starter file" +for IEEE journal papers produced under \LaTeX\ using IEEEtran.cls version +1.6 and later.+> +% You must have at least 2 lines in the paragraph with the drop letter +% (should never be an issue) +<+May all your publication endeavors be successful.+> + +% needed in second column of first page if using \pubid +%\pubidadjcol + +% trigger a \newpage just before the given reference +% number - used to balance the columns on the last page +% adjust value as needed - may need to be readjusted if +% the document is modified later +%\IEEEtriggeratref{8} +% The "triggered" command can be changed if desired: +%\IEEEtriggercmd{\enlargethispage{-5in}} + +% references section + +%\bibliographystyle{IEEEtran.bst} +%\bibliography{IEEEabrv,../bib/paper} +\begin{thebibliography}{1} + +\bibitem{IEEEhowto:kopka} +H.~Kopka and P.~W. Daly, \emph{A Guide to {\LaTeX}}, 3rd~ed.\hskip 1em plus +0.5em minus 0.4em\relax Harlow, England: Addison-Wesley, 1999. + +\end{thebibliography} + +% biography section +% +\begin{biography}{Sumit Bhardwaj} +Biography text here. +\end{biography} + +% if you will not have a photo +\begin{biographynophoto}{John Doe} +Biography text here. +\end{biographynophoto} + +% insert where needed to balance the two columns on the last page +%\newpage + +\begin{biographynophoto}{Jane Doe} +Biography text here. +\end{biographynophoto} + +% You can push biographies down or up by placing +% a \vfill before or after them. The appropriate +% use of \vfill depends on what kind of text is +% on the last page and whether or not the columns +% are being equalized. + +%\vfill + +% Can be used to pull up biographies so that the bottom of the last one +% is flush with the other column. +%\enlargethispage{-5in} + +\end{document} diff --git a/vimfiles.latex/ftplugin/latex-suite/templates/article.tex b/vimfiles.latex/ftplugin/latex-suite/templates/article.tex new file mode 100644 index 0000000..ea7e1d1 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/templates/article.tex @@ -0,0 +1,9 @@ +<+ +> !comp! !exe! +% File: !comp!expand("%:p:t")!comp! +% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% +\documentclass[a4paper]{article} +\begin{document} +<++> +\end{document} diff --git a/vimfiles.latex/ftplugin/latex-suite/templates/report.tex b/vimfiles.latex/ftplugin/latex-suite/templates/report.tex new file mode 100644 index 0000000..479c7b3 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/templates/report.tex @@ -0,0 +1,9 @@ +<+ +> !comp! !exe! +% File: !comp!expand("%")!comp! +% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% +\documentclass[a4paper]{report} +\begin{document} +<++> +\end{document} diff --git a/vimfiles.latex/ftplugin/latex-suite/templates/report_two_column.tex b/vimfiles.latex/ftplugin/latex-suite/templates/report_two_column.tex new file mode 100644 index 0000000..15bd95e --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/templates/report_two_column.tex @@ -0,0 +1,9 @@ +<+ +> !comp! !exe! +% File: !comp!expand("%:p:t")!comp! +% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% +\documentclass[a4paper,twocolumn]{report} +\begin{document} +<++> +\end{document} diff --git a/vimfiles.latex/ftplugin/latex-suite/texmenuconf.vim b/vimfiles.latex/ftplugin/latex-suite/texmenuconf.vim new file mode 100644 index 0000000..405e46a --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/texmenuconf.vim @@ -0,0 +1,131 @@ +"============================================================================= +" File: texmenuconf.vim +" Author: Srinath Avadhanula +" Copyright: Vim charityware license. :help license +" Description: +" CVS: $Id: texmenuconf.vim 997 2006-03-20 09:45:45Z srinathava $ +" +"============================================================================= + +" Paths, crucial for functions +let s:path = expand("<sfile>:p:h") +let s:up_path = expand("<sfile>:p:h:h") +let s:mainmenuname = g:Tex_MenuPrefix.'S&uite.' +let s:mapleader = exists('mapleader') ? mapleader : "\\" + +" This glboal variable is incremented each time a top-level latex-suite menu +" is created. We should always use this variable for setting the locations of +" newly created top-level menus. +let g:Tex_NextMenuLocation = g:Tex_MainMenuLocation + +" The templates and macros menus are always nested within the main latex-suit +" menu. +let g:Tex_TemplatesMenuLocation = g:Tex_MainMenuLocation.'.20 '.s:mainmenuname.'&Templates.' +let g:Tex_MacrosMenuLocation = g:Tex_MainMenuLocation.'.20 '.s:mainmenuname.'&Macros.' + +" The packages menu can either be a child of the main menu or be a top-level +" menu by itself. +if g:Tex_NestPackagesMenu + let g:Tex_PackagesMenuLocation = (g:Tex_MainMenuLocation).'.10 '.s:mainmenuname.'&Packages.' +else + let g:Tex_PackagesMenuLocation = (g:Tex_NextMenuLocation).'.10 '.g:Tex_MenuPrefix.'Packages.' + let g:Tex_NextMenuLocation = g:Tex_NextMenuLocation + 1 +endif + +" Environments are always a top-level menu. +let g:Tex_EnvMenuLocation = (g:Tex_NextMenuLocation).'.20 '.g:Tex_MenuPrefix.'E&nvironments.' +let g:Tex_NextMenuLocation = g:Tex_NextMenuLocation + 1 + +" Elements are always a top-level menu. +" If we choose to nest elements, then the top-level &TeX-Elements menu +" contains <Fonts / Counters / Dimensions> +" otherwise, the Fonts, Counters and Dimensions menus become top-level menus. +if g:Tex_NestElementMenus + let g:Tex_ElementsMenuLocation = (g:Tex_NextMenuLocation).'.20 '.g:Tex_MenuPrefix.'E&lements.' +else + let g:Tex_ElementsMenuLocation = (g:Tex_NextMenuLocation).'.20 '.g:Tex_MenuPrefix +endif +let g:Tex_NextMenuLocation = g:Tex_NextMenuLocation + 1 + + +" Set up the compiler/viewer menus. {{{ +" +if has('gui_running') && g:Tex_Menus + exec 'anoremenu '.g:Tex_MainMenuLocation.'.25 '. s:mainmenuname.'-sepsuite0- :' + + " menus for compiling / viewing etc. + exec 'anoremenu '.g:Tex_MainMenuLocation.'.30 '.s:mainmenuname.'&Compile<tab>'.s:mapleader.'ll'. + \' :silent! call Tex_RunLaTeX()<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.40 '.s:mainmenuname.'&View<tab>'.s:mapleader.'lv'. + \' :silent! call Tex_ViewLaTeX()<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.50 '.s:mainmenuname.'&Search<tab>'.s:mapleader.'ls'. + \' :silent! call ForwardSearchLaTeX()<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.60 '.s:mainmenuname.'&Target\ Format<tab>:TTarget'. + \' :call SetTeXTarget()<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.70 '.s:mainmenuname.'&Compiler\ Target<tab>:TCTarget'. + \' :call Tex_SetTeXCompilerTarget("Compile", "")<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.80 '.s:mainmenuname.'&Viewer\ Target<tab>:TVTarget'. + \' :call Tex_SetTeXCompilerTarget("View", "")<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.90 '.s:mainmenuname.'Set\ &Ignore\ Level<tab>:TCLevel'. + \' :TCLevel<CR>' + exec 'imenu '.g:Tex_MainMenuLocation.'.100 '.s:mainmenuname.'C&omplete\ Ref/Cite'. + \' <Plug>Tex_Completion' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.110 '.s:mainmenuname.'-sepsuite1- :' + " refreshing folds + if g:Tex_Folding + exec 'anoremenu '.g:Tex_MainMenuLocation.'.120 '.s:mainmenuname.'&Refresh\ Folds<tab>'.s:mapleader.'rf'. + \' :call MakeTexFolds(1)<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.130 '.s:mainmenuname.'-sepsuite2- :' + endif +endif + +" }}} + +" ============================================================================== +" MenuConf: configure the menus as compact/extended, with/without math +" ============================================================================== +function! Tex_MenuConfigure(type, action) " {{{ + let menuloc = s:mainmenuname.'Configure\ Menu.' + if a:type == 'math' + if a:action == 1 + let g:Tex_MathMenus = 1 + exe 'so '.s:path.'/mathmacros.vim' + exe 'amenu disable '.menuloc.'Add\ Math\ Menu' + exe 'amenu enable '.menuloc.'Remove\ Math\ Menu' + elseif a:action == 0 + call Tex_MathMenuRemove() + exe 'amenu enable '.menuloc.'Add\ Math\ Menu' + exe 'amenu disable '.menuloc.'Remove\ Math\ Menu' + endif + elseif a:type == 'elements' + if a:action == 'expand' + let g:Tex_ElementsMenuLocation = '80.20 '.g:Tex_MenuPrefix + exe 'amenu disable '.menuloc.'Expand\ Elements' + exe 'amenu enable '.menuloc.'Compress\ Elements' + elseif a:action == 'nest' + let g:Tex_ElementsMenuLocation = '80.20 '.g:Tex_MenuPrefix.'Elements.' + exe 'amenu enable '.menuloc.'Expand\ Elements' + exe 'amenu disable '.menuloc.'Compress\ Elements' + endif + exe 'source '.s:path.'/elementmacros.vim' + elseif a:type == 'packages' + if a:action == 1 + let g:Tex_PackagesMenu = 1 + exe 'so '.s:path.'/packages.vim' + exe 'amenu disable '.menuloc.'Load\ Packages\ Menu' + endif + endif +endfunction + +" }}} + +" configuration menu. +if g:Tex_Menus + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Add\ Math\ Menu :call Tex_MenuConfigure("math", 1)<cr>' + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Remove\ Math\ Menu :call Tex_MenuConfigure("math", 0)<cr>' + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Expand\ Elements :call Tex_MenuConfigure("elements", "expand")<cr>' + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Compress\ Elements :call Tex_MenuConfigure("elements", "nest")<cr>' + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Load\ Packages\ Menu :call Tex_MenuConfigure("packages", 1)<cr>' +endif + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/texproject.vim b/vimfiles.latex/ftplugin/latex-suite/texproject.vim new file mode 100644 index 0000000..bed9ed3 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/texproject.vim @@ -0,0 +1,54 @@ +"============================================================================= +" File: texproject.vim +" Author: Mikolaj Machowski +" Version: 1.0 +" Created: Wen Apr 16 05:00 PM 2003 +" +" Description: Handling tex projects. +"============================================================================= + +let s:path = expand("<sfile>:p:h") + +command! -nargs=0 TProjectEdit :call <SID>Tex_ProjectEdit() + +" Tex_ProjectEdit: Edit project file " {{{ +" Description: If project file exists (*.latexmain) open it in window created +" with ':split', if no create ':new' window and read there +" project template +" +function! s:Tex_ProjectEdit() + + let file = expand("%:p") + let mainfname = Tex_GetMainFileName() + if glob(mainfname.'.latexmain') != '' + exec 'split '.Tex_EscapeSpaces(mainfname.'.latexmain') + else + echohl WarningMsg + echomsg "Master file not found." + echomsg " :help latex-master-file" + echomsg "for more information" + echohl None + endif + +endfunction " }}} +" Tex_ProjectLoad: loads the .latexmain file {{{ +" Description: If a *.latexmain file exists, then sources it +function! Tex_ProjectLoad() + let curd = getcwd() + call Tex_CD(expand('%:p:h')) + + if glob(Tex_GetMainFileName(':p').'.latexmain') != '' + call Tex_Debug("Tex_ProjectLoad: sourcing [".Tex_GetMainFileName().".latexmain]", "proj") + exec 'source '.Tex_GetMainFileName().'.latexmain' + endif + + call Tex_CD(curd) +endfunction " }}} + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug("texproject.vim: catching LatexSuiteFileType event", "proj") | + \ call Tex_ProjectLoad() +augroup END + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/texrc b/vimfiles.latex/ftplugin/latex-suite/texrc new file mode 100644 index 0000000..79068a8 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/texrc @@ -0,0 +1,738 @@ +"============================================================================= +" vim:ft=vim:ts=4:sw=4:noet:fdm=marker:commentstring=\"\ %s:ff=unix +" File: texrc.vim +" Author: Srinath Avadhanula +" Created: Mon Apr 01 11:00 AM 2002 PST +" CVS: $Id: texrc 998 2006-03-20 09:52:12Z srinathava $ +" +" Description: This file contains resource configuration information for the +" latex-suite package. +" +" NOTE: Do NOT be edit this file directly: +" this file will be over-written each time you install a new copy +" of latex-suite. +" +" You can do one of the following: +" 1. Copy this file into $VIMFILES/ftplugin/tex/texrc +" and edit the values in that file. +" $VIMFILES is ~/.vim for UNIX systems and ~/vimfiles for +" WINDOWS systems. +" +" 2. Just set values of each setting individually in your +" $VIMFILES/ftplugin/tex.vim file. (See above for what +" $VIMFILES is). You will need to use :let instead of :TexLet +" in this case. +" +" NOTE: This file is best viewed with Vim-6.0+ with folding turned on. +" CVS: $Id: texrc 998 2006-03-20 09:52:12Z srinathava $ +"============================================================================= + +" ============================================================================== +" SafeLet: checks for value before giving default value {{{ +" Description: The function takes in a single argument and splits it into 2 +" parts, the first being the first <CWORD> found. this is taken +" as a variable name and the next part is assigned to it +" depending on whether the variable already exists or not. +" handles the case where the next part is quoted or not. +" All these calls work: +" TexLet g:varname = 1 +" TexLet g:varname = '1' +" TexLet g:varname = 'foo bar' +" TexLet g:varname = "foo\nbar" +" TexLet g:varname = foo bar +function! <SID>SafeLet(arg) + let name = matchstr(a:arg, '^\s*\zs\(\S\+\)\ze\s*=') + let value = matchstr(a:arg, '=\s*\zs.*\ze') + let value = substitute(value, '\s*$', '', '') + if !exists(name) + if value =~ "^'\\|^\"" + exec "let ".name." = ".value + else + exe "let ".name." = value" + endif + endif +endfunction +com! -nargs=+ TexLet :call <SID>SafeLet(<q-args>) +" }}} +" ============================================================================== + +" ============================================================================== +" General settings {{{ + +TexLet g:Tex_UsePython = 1 + +" the system command which pulls in a file. +if &shell =~ 'sh' + TexLet g:Tex_CatCmd = 'cat' + TexLet g:Tex_RmCmd = 'rm' +else + TexLet g:Tex_CatCmd = 'type' + TexLet g:Tex_RmCmd = 'del' +endif + +" whether to turn on debugging +TexLet g:Tex_Debug = 0 +" If non empty, all the debugging information will be written to a file of +" this name. +TexLet g:Tex_DebugLog = '' + +" }}} +" ============================================================================== +" Rules: specifications of programs for compiling and viewing {{{ +" + +" By default, when you compile a tex file using \ll, then you will be +" generating a .dvi file. Change this line if you want to set another default. +" NOTE: Make sure that a target for this format exists in the 'Compiler rules' +" section below and is set up properly for your system. +if has('macunix') + TexLet g:Tex_DefaultTargetFormat = 'pdf' +else + TexLet g:Tex_DefaultTargetFormat = 'dvi' +endif + +" A comma seperated list of formats which need multiple compilations to be +" correctly compiled. +TexLet g:Tex_MultipleCompileFormats = 'dvi' + +" Uncomment this line if you compile ps files via dvi files. +" TexLet g:Tex_FormatDependency_ps = 'dvi,ps' + +" ------------------------------------------------------------------------------ +" Compiler rules {{{ +" This is the first thing you should customize. It is set up for most common +" values, but if use some other compiler, then you will want to change this. +" As CompileFlags value you'd perhaps like to use, e.g., '-src-specials', +" but it is known that it can sometimes give different results in the output, +" so use it with care. +TexLet g:Tex_CompileRule_dvi = 'latex -interaction=nonstopmode $*' +TexLet g:Tex_EscapeChars = '{}\' + +TexLet g:Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi' + +" ways to generate pdf files. there are soo many... +" NOTE: pdflatex generates the same output as latex. therefore quickfix is +" possible. +TexLet g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode $*' + +" TexLet g:Tex_CompileRule_pdf = 'ps2pdf $*.ps' +" TexLet g:Tex_CompileRule_pdf = 'dvipdfm $*.dvi' +" TexLet g:Tex_CompileRule_pdf = 'dvipdf $*.dvi' + +TexLet g:Tex_CompileRule_html = 'latex2html $*.tex' + +TexLet g:Tex_CompileRule_bib = g:Tex_BibtexFlavor . ' $*' + +" Set Tex_UseMakefile to 0 if you want to ignore the presence of a Makefile +" when deciding how to compile +TexLet g:Tex_UseMakefile = 1 + +" }}} +" ------------------------------------------------------------------------------ +" Viewer rules {{{ +" these programs are for viewing other formats. +" NOTE: latex-suite will automatically append file.<format> to these functions +" when calling them. The viewer therefore cannot accept arguments after +" the filename. +" NOTE: Windows users: +" Set your $PATH variable to include the full path to these programs. +if has('win32') + TexLet g:Tex_ViewRule_ps = 'gsview32' + TexLet g:Tex_ViewRule_pdf = 'AcroRd32' + TexLet g:Tex_ViewRule_dvi = 'yap -1' +elseif has('macunix') + " Let the system pick. If you want, you can override the choice here. + TexLet g:Tex_ViewRule_ps = '' + TexLet g:Tex_ViewRule_pdf = '' + " TexLet g:Tex_ViewRule_pdf = 'Acrobat\ Reader\ 5.1' + TexLet g:Tex_ViewRule_dvi = '' +else + TexLet g:Tex_ViewRule_ps = 'ghostview' + TexLet g:Tex_ViewRule_pdf = 'xpdf' + TexLet g:Tex_ViewRule_dvi = 'xdvi' + " the option below specifies an editor for the dvi viewer while starting + " up the dvi viewer according to Dimitri Antoniou's tip on vim.sf.net (tip + " #225) + TexLet g:Tex_UseEditorSettingInDVIViewer = 0 +endif + +" Tex_ViewRuleComplete_{format} +" +" If a variable like this is specified, then it takes precedence over the +" variable with the same suffix defined above. i.e, Tex_ViewRuleComplete_dvi +" takes precedence over Tex_ViewRule_dvi. +" +" If only Tex_ViewRule_{format} is specified, then latex-suite constructs the +" actual system command which calls that program automatically. For example, +" if you specify Tex_ViewRule_dvi = 'kdvi', then latex-suite will issue the +" command +" !kdvi --unique file.dvi & +" +" However, if your viewer program accepts the file to be viewed in a way which +" doesn't fit with the way latex-suite constructs the system command, then +" specify it using this variable. You can use the same format here which +" 'makeprg' accepts. So $* can be used in place of the main file name. +" +" IMPORTANT: Make sure you make the process go into the background otherwise +" vim will wait for the viewer to terminate before letting you edit +" the file again. +" +" Example: +" Suppose you have a latex->html converter which converts a file say foo.tex +" to a file foo/index.html. Then you would use: +" +" let g:Tex_ViewRuleComplete_html = 'MozillaFirebird $*/index.html &' +" +" Doing something like this would not be possible using Tex_ViewRule_html +TexLet g:Tex_ViewRuleComplete_dvi = '' + +" }}} +" ------------------------------------------------------------------------------ +" }}} +" ============================================================================== +" Compiler: latex-suite comes with a customizable compiler plugin. {{{ +" :help latex-compiling for a detailed description of these options. +" +" this is the list of patterns which will be ignored from the compiler output. +" This is a handy way of specifying which warnings/errors to ignore. This is a +" list of patterns seperated by '�' +TexLet g:Tex_IgnoredWarnings = + \'Underfull'."\n". + \'Overfull'."\n". + \'specifier changed to'."\n". + \'You have requested'."\n". + \'Missing number, treated as zero.'."\n". + \'There were undefined references'."\n". + \'Citation %.%# undefined' + +" the 'ignore level' of the 'efm'. A value of 4 says that the first 4 kinds of +" warnings in the list above will be ignored. Use the command TCLevel to set a +" level dynamically. +TexLet g:Tex_IgnoreLevel = 7 + +" NOTE: The values of g:Tex_Flavor and g:Tex_CompilerFlags are provided as a +" way to make compiler/tex.vim standalone. i.e independent of the rest +" of latex-suite. These variables are NOT used if you have already +" defined g:Tex_CompileRule_dvi above. +" +" specifies the current latex flavor. +TexLet g:Tex_Flavor = 'latex' + +" specifies the BibTeX flavor and if necessary options. If you use $* in this +" setting, it will be replaced by the *root* of the main file name, i.e, if +" the main file is "thesis.tex", $* will be "thesis". +TexLet g:Tex_BibtexFlavor = 'bibtex' + +" specifies the MakeIndedx flavor and if necessary options. $* will be +" replaced by the *root* of the main file name. See above. +TexLet g:Tex_MakeIndexFlavor = 'makeindex $*.idx' + +" By default the program described by g:Tex_Flavor above is called with the +" flags '--src-specials --interaction=nonstopmode'. If your particular version +" of latex does not accept these arguments, you will need to set this variable +" to the appropriate value. +" NOTE: leave commented for using the default flags. +" TODO: Is it necessary (or even desirable) to use 2 variables to specify a +" flavor and flags seperately? --SA +" TexLet g:Tex_CompilerFlags = '' + +" If disabled (set to 0) LaTeX-Suite doesn't go immediately to warnings or +" errors after compilation +TexLet g:Tex_GotoError = 1 + +" If set to 1, then latex-suite shows the context of the error in a preview +" window beneath the window showing the actual errors. +TexLet g:Tex_ShowErrorContext = 1 + +" Remove temp files created during part compilations when vim exits. +TexLet g:Tex_RemoveTempFiles = 1 + +" }}} +" ============================================================================== +" Project: how to deal with multi file projects via latex-suite {{{ + +" Use a valid vim expression here if you want to customize the way latex-suite +" searches for a master file from within another file. +TexLet g:Tex_MainFileExpression = '' + +" }}} +" ============================================================================== +" Macros: latex-suite comes with a large number of macros to speed up typing {{{ +" latex. +" +" Place Holder Options: {{{ +" (See |placeholders| for a description of what place-holders are). +" +" these options are actually used by imaps.vim, therefore the prefix is Imap_ +" and not Tex_. See |placeholders| for a description of how to use +" place-holders. You can either completely disable placeholders (not +" recommended) and/or you can change the place holder characters. + +TexLet g:Imap_UsePlaceHolders = 1 +TexLet g:Imap_PlaceHolderStart = '<+' +TexLet g:Imap_PlaceHolderEnd = '+>' + +" This option when set to 1 makes <C-J> in insert mode delete +" non-descriptive (empty) placeholders and enters insert mode. +" NOTE: This option _has_ to be set in the .vimrc. Setting this in a filetype +" plugin file such as ftplugin/tex.vim will not have any affect. +TexLet g:Imap_DeleteEmptyPlaceHolders = 0 + +" When set to 1, in visual mode, <C-J> takes you to the next placeholder +" without deleting the current placeholder. +" NOTE: This option _has_ to be set in the .vimrc. Setting this in a filetype +" plugin file such as ftplugin/tex.vim will not have any affect. +TexLet g:Imap_StickyPlaceHolders = 1 + + +" }}} +" Menu Wizard Option: {{{ +" If the following variable is set to 1, then when an enviroment is chosen +" from the menu then for selected environments, latex-suite asks a series of +" questions on the command line and inserts a template with the corresponding +" fields already filled in. +" Setting this to zero will insert a template with |placeholders| marking off +" the places where fields need to be filled. +TexLet g:Tex_UseMenuWizard = 0 + +" }}} +" Visual Mode Mapping Correction: {{{ +" With so many visual maps, its helpful to have a way of catching typing +" errors made in visual mode. What this does is to prompt you to correct your +" visual mode mapping if you start out with g:Tex_Leader and then type some +" illegal keys. +" It basically maps just the g:Tex_Leader character to a function +TexLet g:Tex_CatchVisMapErrors = 1 + +" }}} +" Diacritics: {{{ +" whether or not you want to use diacritics +" (diacritics speed up typing some languages. the way they are set up in +" latex-suite is +" =char> = \'{<char>} +" +char> = \v{<char>} +" +} = \"a +" :o = \^o +" Default: 0 +TexLet g:Tex_Diacritics = 0 + +" }}} +" Leader Options: {{{ +" The mappings in latex-suite are by default prefixed with the back-tick +" character. For example, `/ inserts \frac{<++>}{<++>}<++> etc. You can change the +" prefix with the following setting. +" ',', '/', '`' are preferred values. '' or '\' will lead to a _lot_ of +" trouble. +" g:Tex_Leader is also used for visual mode mappings for fonts. +TexLet g:Tex_Leader = '`' + +" In order to avoid ambiguity between the large number of visual mode macros +" provided, the visual mode macros for environments and sections start with a +" character different from '`'. +TexLet g:Tex_Leader2 = ',' + +" }}} +" Environment Macros: {{{ +" These mappings insert LaTeX "environments" such as +" \begin{center} +" <++> +" \end{center}<++> +" with the cursor left at the first place-holder. +" (See |placeholders| for what these are.) +" Mnemonic: +" 1. All environment mappings begin with 'E' +" 2. The next two capital letters are (for the common environments) the +" first 2 letters of the environment name converted into upper case. For +" example, for the center environment above, use ECE. There are a few +" necessary exceptions such as: +" equation --> EEQ +" eqnarray --> EEA +" Please see texmaps.vim for the complete list. +" +" Along with the insert mode mappings, a set of visual mode mappings is +" provided which encloses the visually selected region in an environment. +" These maps are related to the corresponding insert mode mappings by the +" following rule: +" EFI --> ,fi +" and so on. i.e, the leading E becomes '`' and the next 2 letters are small +" case. Some of the visual mode mappings are sensetive to whether you choose +" line-wise or character wise. For example, if you choose a word and press +" `ve, then you get \verb|word|, whereas if you press `ve on a line-wise +" selection, you get: +" \begin{verbatim} +" line +" \end{verbatim} +" +" these 2 options give finer control on which aspect of the macros you want +" to enable. +TexLet g:Tex_EnvironmentMaps = 1 +TexLet g:Tex_EnvironmentMenus = 1 + + +" }}} +" Font Macros: {{{ +" These mappings insert font descriptions such as: +" \textsf{<++>}<++> +" again with the cursor at the first place-holder. +" Mnemonic: +" 1. first letter is always F (F for font) +" 2. next 2 letters are the 2 letters describing the font. +" +" Example: the above mapping is triggered by FSF. +" +" Just like environment mappings, you can visually select an area and press +" `sf to have it enclosed in: +" \textsf{word} +" or +" {\sffamily +" line +" } +" depending on character-wise or line-wise selection. +TexLet g:Tex_FontMaps = 1 +TexLet g:Tex_FontMenus = 1 + +" }}} +" Section Macros: {{{ +" Inserts LaTeX sections: +" \section +" etc. Just as in the case of environments and fonts, can be enclosed with a +" visual selection. The enclosing is not sensetive to character or line-wise +" selection. +" NOTE: In visual mode, you are supposed to select the name of the section +" etc, not the whole section. +" In the following case, select just the first line, not lines 1-3. +" 1 section name +" 2 some lines in this section +" 3 and some more lines +" Mnemonic: (make your own!) +" SPA for part +" SCH for chapter +" SSE for section +" SSS for subsection +" SS2 for subsubsection +" SPG for paragraph +" SSP for subparagraph +TexLet g:Tex_SectionMaps = 1 +TexLet g:Tex_SectionMenus = 1 + +" }}} +" Auctex Style Mappings: {{{ +" Auctex.vim has heavily inspired various portions of latex-suite providing +" various new ways of conviniently inserting environments. +" +" If you press <F5> in the insert mode while on an empty line, latex-suite +" prompts you with a list of environments you might want to insert. You can +" either choose one from the list or type in a new environment name. +" The variable below (which is a comma seperated list of environment names) +" decides the prompt which latex-suite generates. +" You can place as many items as you want here. If the environment name is a +" standard latex environment such as table or figure, then latex-suite will +" insert a template with additional fields, if not, just a bare bones +" \begin{env} +" <++> +" \end{env} +" is inserted. +" \[ and $$ are also recognized. +" NOTE: Setting this variable to the empty string is a way of leaving the +" <F5> key unmapped + +TexLet g:Tex_PromptedEnvironments = + \ 'eqnarray*,eqnarray,equation,equation*,\[,$$,align,align*' + +" Another quick way of inserting environments is to press one of the shifted +" function keys from <F1> through <F4>. +" Each environment in the following list is mapped to a corresponding shifted +" function key. +" NOTE: Setting this variable to the empty string is a way of leaving all the +" shifted function keys untouched by latex-suite. +" NOTE: Only the first 4 items of the list are used. The rest will be silently +" ignored. +" The number of items in this list decides how many shifted function keys are +" mapped. +TexLet g:Tex_HotKeyMappings = + \ 'eqnarray*,eqnarray,bmatrix' + +" Similar to above mechanisms works <F7> key. It prompts for command with list +" of commands from g:Tex_PromptedCommands. There are not HotKeys for commands. +" It works for commands of style \com{}. Changing of current command is done +" with <S-F7> + +TexLet g:Tex_PromptedCommands = + \ 'footnote,cite,pageref,label' + +" }}} +" Smart Key Mappings: {{{ +" Latex-suite shites with a number of 'smart' maps, where the behavior of +" standard keys is modified in a way which makes editing tex files easy. + +" Pressing <BS> in insert mode checks to see whether we are just after +" something like \'{a} and if so, deletes all of it. i.e, diacritics are +" treated as single characters for backspacing. +" Setting this to zero will leave the <BS> key unmapped. +" Default: 1 +TexLet g:Tex_SmartKeyBS = 1 +" The pattern used to detect whether the previous characters comprise a +" diacritic character. This default pattern detects the standard LaTeX +" diacritics +TexLet g:Tex_SmartBSPattern = + \ '\(' . + \ "\\\\[\"^'=v]{\\S}" . '\|' . + \ "\\\\[\"^'=]\\S" . '\|' . + \ '\\v \S' . '\|' . + \ "\\\\[\"^'=v]{\\\\[iI]}" . '\|' . + \ '\\v \\[iI]' . '\|' . + \ '\\q \S' . '\|' . + \ '\\-' . + \ '\)' . "$" + +" Pressing " (english double quote) will insert `` or '' by making an +" intelligent guess about whether we intended to open or close a quote. +" Default: 1 +TexLet g:Tex_SmartKeyQuote = 1 + +" Users of other languages might want to change the quote characters to suit +" their locale. These global values will be ignored if there are buffer-local +" versions, which may be set in the language-specific package files, such as +" ftplugin/latex-suite/packages/german +TexLet g:Tex_SmartQuoteOpen = "``" +TexLet g:Tex_SmartQuoteClose = "''" + +" Latex-suite maps the <space> key in such a way that $ characters are not +" broken across lines. +" NOTE: Setting this to 1 has the side-effect of making the 'tw' setting be 0. +" Default: +TexLet g:Tex_SmartKeySpace = 0 + +" Pressing ... (3 dots) results in \ldots outside math mode and \cdots in math +" mode. +" +" TODO: Make it more intelligent within math mode. For example +" $1+...+3$ should expand to $1+\cdots+n$, whereas $1,...,n$ should expand +" to $1,\ldots,n$. The amsmath package actually provides a command \dots +" which does this. Maybe use that if amsmath is detected? +" Default: 1 +TexLet g:Tex_SmartKeyDot = 1 + +" }}} +" Advanced Math: {{{ +" These mappings allow for fast inserting of math constructions +" brackets, better handling of space in math mode, unfortunately +" they use <M-> mappings which conflicts with some encodings. This is easy way +" of turning them off. +" +" <M-b> encloses the previous character in \mathbf{} +" <M-c> is polymorphic as follows: +" Insert mode: +" 1. If the previous character is a letter or number, then capitalize it and +" enclose it in \mathcal{} +" 2. otherwise insert \cite{} +" Visual Mode: +" 1. Enclose selection in \mathcal{} +" <M-l> is also polymorphic as follows: +" If the character before typing <M-l> is one of '([{|<q', then do the +" following: +" 1. (<M-l> \left(\right +" similarly for [, | +" {<M-l> \left\{\right\} +" 2. <<M-l> \langle\rangle +" 3. q<M-l> \lefteqn{} +" otherwise insert \label{} +" <M-i> inserts \item commands at the current cursor location depending on +" the surrounding environment. For example, inside itemize, it will +" insert a simple \item, but within a description, it will insert +" \item[<+label+>] etc. +" +" Default: 1 +TexLet g:Tex_AdvancedMath = 1 + +" }}} + +" }}} +" ============================================================================== +" TeX Completion: {{{ + +" Options for controlling the window sizes of the completion windows {{{ + +" The height of the window which contains the \label's (when completing a +" \ref) or bibtex entries (when completing a \cite). This option is used in +" the newer methods of completing \ref's and \cite's. +TexLet g:Tex_OutlineWindowHeight = 15 + +" Options for preview window for ref/cite completion. The next two options +" are used only when g:Tex_UseOutlineCompletion = 0 or +" g:Tex_UseCiteCompletionVer2 = 0, i.e, when we use a classic method of +" completing \refs and \cites. +" Height of cwindow +TexLet g:Tex_ViewerCwindowHeight = 5 +" Height of preview window +TexLet g:Tex_ViewerPreviewHeight = 10 + +" Options for explorer completion. +" Height of explorer window +TexLet g:Tex_ExplorerHeight = 10 + +" Directory for images. Read |latex-completion-explorer| before changing +TexLet g:Tex_ImageDir = '' + +" }}} +" Options for completing a \ref {{{ + +" Whether to use the "outline mode" for displaying the \label's while doing +" \ref completion. In this mode, each label is displayed within the +" document element it resides in. The entire thing is folded to ease +" navigation. Should be easier/faster than the classical mode. +TexLet g:Tex_UseOutlineCompletion = 1 + +" This option should be set via the .latexmain file. It should be a newline +" seperated list of files which make up all the "source" files in the +" current project. This enables latex-suite to skip the more complicated +" algorithm of finding the source files by recursively searching for +" \input'ed files from the |latex-master-file|. +" +" Only used when g:Tex_UseOutlineCompletion = 0. +TexLet g:Tex_ProjectSourceFiles = '' + +" Whether latex-suite simply searches for \\label's in all the .tex file +" found in the current directory or whether it will use a more complex +" algorithm. This is used only g:Tex_UseOutlineCompletion = 0 and +" g:Tex_ProjectSourceFiles = ''. +" See +" :help Tex_UseSimpleLabelSearch +" for more information +TexLet g:Tex_UseSimpleLabelSearch = 0 + +" }}} +" Options for completing a \cite'ation {{{ + +" If set to 1, then the newer way of presenting the bibtex entries is used. +" Instead of a |cwindow| showing just the keys and a synced |preview| +" window beneath, show a single window containing a nicely formatted list +" of bibtex entries. This should be faster and easier to use than the +" classic mode +TexLet g:Tex_UseCiteCompletionVer2 = 1 + +" This is a string which is displayed to the user when he wants to sort or +" filter the bibtex entries. This string also serves to define acronyms for +" the various fields of a bibtex entry. +TexLet g:Tex_BibFieldPrompt = + \ "Field acronyms: (`:let g:Tex_EchoBibFields = 0` to avoid this message)\n" . + \ " [t] title [a] author [b] booktitle \n" . + \ " [j] journal [y] year [p] bibtype \n" . + \ " (you can also enter the complete field name) \n" + +" Whether or not to display the string above to aid the user in choosing +" the field to filter/sort with. +TexLet g:Tex_EchoBibFields = 1 + +" A setting of this form defines the letter 'a' as standing for the field +" 'author'. Thus when the user types +" a ellington +" when asked to enter a filter, it is equivalent to the user specifying the +" filter +" author ellington +" TexLet g:Tex_BibAcronym_a = 'author' + +" Whether or not to use Jabref to complete citations +" See +" :help latex-suite-jabref +" for more infomration +TexLet g:Tex_UseJabref = 0 + +" whether or not searches for \cite's are cached. +TexLet g:Tex_RememberCiteSearch = 0 +" Paths to the bibliography files and custom packages. +TexLet g:Tex_BIBINPUTS = '' +TexLet g:Tex_TEXINPUTS = '' + +" }}} + +" }}} +" ============================================================================== +" Menus: set the kinds of menus which you would like to see. {{{ +" +" Setting this variable to zero will immediately disable _all_ menus. +" for finer control set this to 1 and then play with the other options. +" Default: 1 +TexLet g:Tex_Menus = 1 + +" The location of the main menu +TexLet g:Tex_MainMenuLocation = 80 + +" Math contains a large number of tex math elemets such as arrows, +" mathematical fonts (\mathrm), mathematical diacritics (\dot), binary +" relational operators etc. This menu compromises about 75% of the menus. +" Default: 1 +TexLet g:Tex_MathMenus = 1 + +" The following options control the "compactness" of the menus. +" +" Setting this option to 1 makes the Font, Counter and Dimensioning menus to +" be collected together into a single 'Tex-Elements' menu. Setting this to 0 +" creates seperate menus for each of them. +" Default: 1 +TexLet g:Tex_NestElementMenus = 1 + +" Sometimes when you are using a lot of packages with lots of options etc, +" then a lot of time might be spent at startup loading the menus. +" Setting the following variable to 0 will stop autoloading the packages menu. +" You can still goto TeX-Suite.Configure Menu and load this after startup. +" Default: 1 +TexLet g:Tex_PackagesMenu = 1 +" The following option will create the packages option within the TeX-Suite +" menu. +" Default: 1 +TexLet g:Tex_NestPackagesMenu = 1 + +" This is the prefix added to the menu names created by latex suite. Add a +" dot to the following option to nest the menus under the menu name before the +" dot. +" NOTE: With a '.' as the last character of the following setting, every +" single menu created by latex suite will be nested under the same menu. +" Default: 'TeX-' +TexLet g:Tex_MenuPrefix = 'TeX-' + +" Use utf-8 menus. There is plenty of math symbols in LaTeX. It is hard to +" remember them. You can display them with utf-8. Your system/GUI interface +" have to support utf-8. This addition is necessary for resetting 'encoding'. +TexLet g:Tex_UseUtfMenus = 0 + +if g:Tex_UseUtfMenus != 0 && has("gui_running") + set encoding=utf-8 +endif + +" }}} +" ============================================================================== +" Folding: latex-suite comes with 'fake' syntax folding. {{{ +" +" specifies whether the MakeTeXFolds() function will be defined. If this is +" set to zero, then esentially you have disabled all of latex-suite's folding +" functions. no maps for refreshing folds will be set up etc. +" NOTE: However, the function TexFoldTextFunction() is still avaiable +" and 'foldexpr' is set to point to it. This is so you can continue +" using another folding scheme but still use the fold text function. +TexLet g:Tex_Folding = 1 + +" specifies whether a latex file is automatically folded up when opened. +" Setting this to zero means that a file is not folded up as soon as its +" opened. +" NOTE: the MakeTeXFolds() function will still be available (unless disabled +" by g:Tex_Folding), so you can do <F6> or \rf to refresh/create folds. +TexLet g:Tex_AutoFolding = 1 + +" }}} +" ============================================================================== +" Taglist: Support for taglist.vim {{{ +" +" LaTeX-Suite offers now support for taglist.vim, the most popular Vim +" interface for ctags. You should use ctags version >= 5.0 and taglist >= 3.0. +TexLet g:Tex_TaglistSupport = 1 + +" This option turns on definition of tags for LaTeX. +" NOTE: In taglist window you may see duplicate entries for the same tag. It +" means some definitions are repeated somewhere else. You can turn off +" internal definitions or remove external (read ctags description +" where). +TexLet g:Tex_InternalTagsDefinitions = 1 + +" }}} +" ============================================================================== diff --git a/vimfiles.latex/ftplugin/latex-suite/texviewer.vim b/vimfiles.latex/ftplugin/latex-suite/texviewer.vim new file mode 100644 index 0000000..be3b821 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/texviewer.vim @@ -0,0 +1,1041 @@ +" ============================================================================ +" File: texviewer.vim +" Author: Mikolaj Machowski +" Created: Sun Jan 26 06:00 PM 2003 +" Description: make a viewer for various purposes: \cite{, \ref{ +" License: Vim Charityware License +" Part of vim-latexSuite: http://vim-latex.sourceforge.net +" CVS: $Id: texviewer.vim 999 2006-03-21 05:32:37Z srinathava $ +" ============================================================================ +" Tex_SetTexViewerMaps: sets maps for this ftplugin {{{ +function! Tex_SetTexViewerMaps() + inoremap <silent> <Plug>Tex_Completion <Esc>:call Tex_Complete("default","text")<CR> + if !hasmapto('<Plug>Tex_Completion', 'i') + if has('gui_running') + imap <buffer> <silent> <F9> <Plug>Tex_Completion + else + imap <buffer> <F9> <Plug>Tex_Completion + endif + endif +endfunction + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('texviewer.vim: Catching LatexSuiteFileType event', 'view') | + \ call Tex_SetTexViewerMaps() +augroup END + +command -nargs=1 TLook call Tex_Complete(<q-args>, 'tex') +command -nargs=1 TLookAll call Tex_Complete(<q-args>, 'all') +command -nargs=1 TLookBib call Tex_Complete(<q-args>, 'bib') + +" }}} + +" ============================================================================== +" Main completion function +" ============================================================================== +" Tex_Complete: main function {{{ +" Description: +function! Tex_Complete(what, where) + + " Get info about current window and position of cursor in file + let s:winnum = winnr() + + " Change to the directory of the file being edited before running all the + " :grep commands. We will change back to the original directory after we + " finish with the grep. + let s:origdir = getcwd() + cd %:p:h + + let s:pos = line('.').' | normal! '.virtcol('.').'|' + + unlet! s:type + unlet! s:typeoption + + if Tex_GetVarValue('Tex_WriteBeforeCompletion') == 1 + wall + endif + + if a:where == "text" + " What to do after <F9> depending on context + let s:curfile = expand("%:p") + let s:curline = strpart(getline('.'), 0, col('.')) + let s:prefix = matchstr(s:curline, '.*{\zs.\{-}\(}\|$\)') + " a command is of the type + " \psfig[option=value]{figure=} + " Thus + " s:curline = '\psfig[option=value]{figure=' + " (with possibly some junk before \psfig) + " from which we need to extract + " s:type = 'psfig' + " s:typeoption = '[option=value]' + let pattern = '.*\\\(\w\{-}\)\(\[.\{-}\]\)\?{\(\S\+\)\?$' + if s:curline =~ pattern + let s:type = substitute(s:curline, pattern, '\1', 'e') + let s:typeoption = substitute(s:curline, pattern, '\2', 'e') + call Tex_Debug('Tex_Complete: s:type = '.s:type.', typeoption = '.s:typeoption, 'view') + endif + + if exists("s:type") && s:type =~ 'ref' + if Tex_GetVarValue('Tex_UseOutlineCompletion') == 1 + call Tex_Debug("Tex_Complete: using outline search method", "view") + call Tex_StartOutlineCompletion() + + elseif Tex_GetVarValue('Tex_UseSimpleLabelSearch') == 1 + call Tex_Debug("Tex_Complete: searching for \\labels in all .tex files in the present directory", "view") + call Tex_Debug("Tex_Complete: silent! grep! ".Tex_EscapeForGrep('\\label{'.s:prefix)." *.tex", 'view') + call Tex_Grep('\\label{'.s:prefix, '*.tex') + call <SID>Tex_SetupCWindow() + + elseif Tex_GetVarValue('Tex_ProjectSourceFiles') != '' + call Tex_Debug('Tex_Complete: searching for \\labels in all Tex_ProjectSourceFiles', 'view') + call Tex_CD(Tex_GetMainFileName(':p:h')) + call Tex_Grep('\\label{'.s:prefix, Tex_GetVarValue('Tex_ProjectSourceFiles')) + call <SID>Tex_SetupCWindow() + + else + call Tex_Debug("Tex_Complete: calling Tex_GrepHelper", "view") + silent! grep! ____HIGHLY_IMPROBABLE___ % + call Tex_GrepHelper(s:prefix, 'label') + call <SID>Tex_SetupCWindow() + endif + + redraw! + + elseif exists("s:type") && s:type =~ 'cite' + + let s:prefix = matchstr(s:prefix, '\([^,]\+,\)*\zs\([^,]\+\)\ze$') + call Tex_Debug(":Tex_Complete: using s:prefix = ".s:prefix, "view") + + if has('python') && Tex_GetVarValue('Tex_UsePython') + \ && Tex_GetVarValue('Tex_UseCiteCompletionVer2') == 1 + + call Tex_CD(s:origdir) + silent! call Tex_StartCiteCompletion() + + elseif Tex_GetVarValue('Tex_UseJabref') == 1 + + call Tex_CD(s:origdir) + let g:Remote_WaitingForCite = 1 + let citation = input('Enter citation from jabref (<enter> to leave blank): ') + let g:Remote_WaitingForCite = 0 + call Tex_CompleteWord(citation) + + else + " grep! nothing % + " does _not_ clear the search history contrary to what the + " help-docs say. This was expected. So use something improbable. + " TODO: Is there a way to clear the search-history w/o making a + " useless, inefficient search? + silent! grep! ____HIGHLY_IMPROBABLE___ % + if g:Tex_RememberCiteSearch && exists('s:citeSearchHistory') + call <SID>Tex_SetupCWindow(s:citeSearchHistory) + else + call Tex_GrepHelper(s:prefix, 'bib') + redraw! + call <SID>Tex_SetupCWindow() + endif + if g:Tex_RememberCiteSearch && &ft == 'qf' + let _a = @a + silent! normal! ggVG"ay + let s:citeSearchHistory = @a + let @a = _a + endif + endif + + elseif exists("s:type") && (s:type =~ 'includegraphics' || s:type == 'psfig') + call Tex_SetupFileCompletion( + \ '', + \ '^\.\\|\.tex$\\|\.bib$\\|\.bbl$\\|\.zip$\\|\.gz$', + \ 'noext') + + elseif exists("s:type") && s:type == 'bibliography' + call Tex_SetupFileCompletion( + \ '\.b..$', + \ '', + \ 'noext') + + elseif exists("s:type") && s:type =~ 'include\(only\)\=' + call Tex_SetupFileCompletion( + \ '\.t..$', + \ '', + \ 'noext') + + elseif exists("s:type") && s:type == 'input' + call Tex_SetupFileCompletion( + \ '', + \ '', + \ 'ext') + + elseif exists('s:type') && exists("g:Tex_completion_".s:type) + call <SID>Tex_CompleteRefCiteCustom('plugin_'.s:type) + + else + let s:word = expand('<cword>') + if s:word == '' + if col('.') == strlen(getline('.')) + startinsert! + return + else + normal! l + startinsert + return + endif + endif + call Tex_Debug("silent! grep! ".Tex_EscapeForGrep('\<'.s:word.'\>')." *.tex", 'view') + call Tex_Grep('\<'.s:word.'\>', '*.tex') + + call <SID>Tex_SetupCWindow() + endif + + elseif a:where == 'tex' + " Process :TLook command + call Tex_Grep(a:what, "*.tex") + call <SID>Tex_SetupCWindow() + + elseif a:where == 'bib' + " Process :TLookBib command + call Tex_Grep(a:what, "*.bib") + call Tex_Grepadd(a:what, "*.bbl") + call <SID>Tex_SetupCWindow() + + elseif a:where == 'all' + " Process :TLookAll command + call Tex_Grep(a:what, "*") + call <SID>Tex_SetupCWindow() + endif + +endfunction +" }}} +" Tex_CompleteWord: inserts a word at the chosen location {{{ +" Description: This function is meant to be called when the user press +" ``<enter>`` in one of the [Error List] windows which shows the list of +" matches. completeword is the rest of the word which needs to be inserted. +function! Tex_CompleteWord(completeword) + exe s:pos + + " Complete word, check if add closing } + exe 'normal! a'.a:completeword."\<Esc>" + + if getline('.')[col('.')-1] !~ '{' && getline('.')[col('.')] !~ '}' + exe "normal! a}\<Esc>" + endif + + " Return to Insert mode + if col('.') == strlen(getline('.')) + startinsert! + else + normal! l + startinsert + endif +endfunction " }}} + +" ============================================================================== +" File name completion helper functons +" ============================================================================== +" Tex_SetupFileCompletion: {{{ +" Description: +function! Tex_SetupFileCompletion(accept, reject, ext) + call FB_SetVar('FB_AllowRegexp', a:accept) + call FB_SetVar('FB_RejectRegexp', a:reject) + call FB_SetVar('FB_CallBackFunction', 'Tex_CompleteFileName') + call FB_SetVar('FB_CallBackFunctionArgs', '"'.a:ext.'"') + + call FB_OpenFileBrowser('.') +endfunction " }}} +" Tex_CompleteFileName: {{{ +" Description: +function! Tex_CompleteFileName(filename, ext) + call Tex_Debug('+Tex_CompleteFileName: getting filename '.a:filename, 'view') + + if a:ext == 'noext' + let completeword = fnamemodify(a:filename, ':r') + endif + let completeword = Tex_RelPath(completeword, Tex_GetMainFileName(':p:h')) + + call Tex_Debug(":Tex_CompleteFileName: completing with ".completeword, "view") + call Tex_CompleteWord(completeword) +endfunction " }}} +" Tex_Common: common part of strings {{{ +function! s:Tex_Common(path1, path2) + " Assume the caller handles 'ignorecase' + if a:path1 == a:path2 + return a:path1 + endif + let n = 0 + while a:path1[n] == a:path2[n] + let n = n+1 + endwhile + return strpart(a:path1, 0, n) +endfunction " }}} +" Tex_NormalizePath: {{{ +" Description: +function! Tex_NormalizePath(path) + let retpath = a:path + if has("win32") || has("win16") || has("dos32") || has("dos16") + let retpath = substitute(retpath, '\\', '/', 'ge') + endif + if isdirectory(retpath) && retpath !~ '/$' + let retpath = retpath.'/' + endif + return retpath +endfunction " }}} +" Tex_RelPath: ultimate file name {{{ +function! Tex_RelPath(explfilename,texfilename) + let path1 = Tex_NormalizePath(a:explfilename) + let path2 = Tex_NormalizePath(a:texfilename) + + let n = matchend(<SID>Tex_Common(path1, path2), '.*/') + let path1 = strpart(path1, n) + let path2 = strpart(path2, n) + if path2 !~ '/' + let subrelpath = '' + else + let subrelpath = substitute(path2, '[^/]\{-}/', '../', 'ge') + let subrelpath = substitute(subrelpath, '[^/]*$', '', 'ge') + endif + let relpath = subrelpath.path1 + return escape(Tex_NormalizePath(relpath), ' ') +endfunction " }}} + +" ============================================================================== +" Helper functions for dealing with the 'quickfix' and 'preview' windows. +" ============================================================================== +" Tex_SetupCWindow: set maps and local settings for cwindow {{{ +" Description: Set local maps jkJKq<cr> for cwindow. Also size and basic +" settings +" +function! s:Tex_SetupCWindow(...) + call Tex_Debug('+Tex_SetupCWindow', 'view') + cclose + exe 'copen '. g:Tex_ViewerCwindowHeight + " If called with an argument, it means we want to re-use some search + " history from last time. Therefore, just paste it here and proceed. + if a:0 == 1 + set modifiable + % d _ + silent! 0put!=a:1 + $ d _ + endif + setlocal nonumber + setlocal nowrap + + let s:scrollOffVal = &scrolloff + call <SID>Tex_SyncPreviewWindow() + + " If everything went well, then we should be situated in the quickfix + " window. If there were problems, (no matches etc), then we will not be. + " Therefore return. + if &ft != 'qf' + call Tex_Debug('not in quickfix window, quitting', 'view') + return + endif + + nnoremap <buffer> <silent> j j:call <SID>Tex_SyncPreviewWindow()<CR> + nnoremap <buffer> <silent> k k:call <SID>Tex_SyncPreviewWindow()<CR> + nnoremap <buffer> <silent> <up> <up>:call <SID>Tex_SyncPreviewWindow()<CR> + nnoremap <buffer> <silent> <down> <down>:call <SID>Tex_SyncPreviewWindow()<CR> + + " Change behaviour of <cr> only for 'ref' and 'cite' context. + if exists("s:type") && s:type =~ 'ref\|cite' + exec 'nnoremap <buffer> <silent> <cr> ' + \ .':set scrolloff='.s:scrollOffVal.'<CR>' + \ .':cd '.s:origdir.'<CR>' + \ .':silent! call <SID>Tex_CompleteRefCiteCustom("'.s:type.'")<CR>' + + else + " In other contexts jump to place described in cwindow and close small + " windows + exec 'nnoremap <buffer> <silent> <cr> ' + \ .':set scrolloff='.s:scrollOffVal.'<CR>' + \ .':cd '.s:origdir.'<CR>' + \ .':call <SID>Tex_GoToLocation()<cr>' + + endif + + " Scroll the preview window while in the quickfix window + nnoremap <buffer> <silent> J :wincmd j<cr><c-e>:wincmd k<cr> + nnoremap <buffer> <silent> K :wincmd j<cr><c-y>:wincmd k<cr> + + " Exit the quickfix window without doing anything. + exe 'nnoremap <buffer> <silent> q ' + \ .':set scrolloff='.s:scrollOffVal.'<CR>' + \ .':cd '.s:origdir.'<CR>' + \ .':call Tex_CloseSmallWindows()<CR>' + +endfunction " }}} +" Tex_CompleteRefCiteCustom: complete/insert name for current item {{{ +" Description: handle completion of items depending on current context +" +function! s:Tex_CompleteRefCiteCustom(type) + + if a:type =~ 'cite' + if getline('.') =~ '\\bibitem{' + let bibkey = matchstr(getline('.'), '\\bibitem{\zs.\{-}\ze}') + else + let bibkey = matchstr(getline('.'), '{\zs.\{-}\ze\(,\|$\)') + endif + let completeword = strpart(bibkey, strlen(s:prefix)) + + elseif a:type =~ 'ref' + let label = matchstr(getline('.'), '\\label{\zs.\{-}\ze}') + let completeword = strpart(label, strlen(s:prefix)) + + elseif a:type =~ '^plugin_' + let type = substitute(a:type, '^plugin_', '', '') + let completeword = <SID>Tex_DoCompletion(type) + + endif + + call Tex_CloseSmallWindows() + call Tex_Debug(":Tex_CompleteRefCiteCustom: completing with ".completeword, "view") + call Tex_CompleteWord(completeword) +endfunction " }}} +" Tex_SyncPreviewWindow: synchronize quickfix and preview window {{{ +" Description: Usually quickfix engine takes care about most of these things +" but we discard it for better control of events. +" +function! s:Tex_SyncPreviewWindow() + call Tex_Debug('+Tex_SyncPreviewWindow', 'view') + + let viewfile = matchstr(getline('.'), '^\f*\ze|\d') + let viewline = matchstr(getline('.'), '|\zs\d\+\ze') + + " Hilight current line in cwindow + " Normally hightlighting is done with quickfix engine but we use something + " different and have to do it separately + syntax clear + runtime syntax/qf.vim + exe 'syn match vTodo /\%'. line('.') .'l.*/' + hi link vTodo Todo + + " Close preview window and open it again in new place + pclose + exe 'silent! bot pedit +'.viewline.' '.viewfile + + " Vanilla 6.1 has bug. This additional setting of cwindow height prevents + " resizing of this window + exe g:Tex_ViewerCwindowHeight.' wincmd _' + + " Handle situation if there is no item beginning with s:prefix. + " Unfortunately, because we know it late we have to close everything and + " return as in complete process + if v:errmsg =~ 'E32\>' + exe s:winnum.' wincmd w' + pclose! + cclose + if exists("s:prefix") + echomsg 'No bibkey, label or word beginning with "'.s:prefix.'"' + endif + if col('.') == strlen(getline('.')) + startinsert! + else + normal! l + startinsert + endif + let v:errmsg = '' + call Tex_Debug('Tex_SyncPreviewWindow: got error E32, no matches found, quitting', 'view') + return 0 + endif + + " Move to preview window. Really is it under cwindow? + wincmd j + + " Settings of preview window + exe g:Tex_ViewerPreviewHeight.' wincmd _' + setlocal nofoldenable + + if exists('s:type') && s:type =~ 'cite' + " In cite context place bibkey at the top of preview window. + setlocal scrolloff=0 + normal! zt + else + " In other contexts in the middle. Highlight this line? + setlocal scrolloff=100 + normal! z. + endif + + " Return to cwindow + wincmd p + +endfunction " }}} +" Tex_CloseSmallWindows: {{{ +" Description: +" +function! Tex_CloseSmallWindows() + exe s:winnum.' wincmd w' + pclose! + cclose + exe s:pos +endfunction " }}} +" Tex_GoToLocation: Go to chosen location {{{ +" Description: Get number of current line and go to this number +" +function! s:Tex_GoToLocation() + pclose! + let errmsg = v:errmsg + let v:errmsg = '' + exe 'silent! cc ' . line('.') + " If the current buffer is modified, then split + if v:errmsg =~ '^E37:' + split + exe 'silent! cc ' . line('.') + endif + cclose + let v:errmsg = errmsg +endfunction " }}} + +" ============================================================================== +" Functions for finding \\label's or \\bibitem's in the main file. +" ============================================================================== +" Tex_GrepHelper: grep main filename for \\bibitem's or \\label's {{{ +" Description: +function! Tex_GrepHelper(prefix, what) + let _path = &path + let _suffixesadd = &suffixesadd + let _hidden = &hidden + + let mainfname = Tex_GetMainFileName(':p') + " If we are already editing the file, then use :split without any + " arguments so it works even if the file is modified. + " FIXME: If mainfname is being presently edited in another window and + " is 'modified', then the second split statement will not work. + " We will need to travel to that window and back. + if mainfname == expand('%:p') + split + else + exec 'split '.Tex_EscapeSpaces(mainfname) + endif + + let pos = line('.').'| normal! '.virtcol('.').'|' + if a:what =~ 'bib' + call Tex_ScanFileForCite(a:prefix) + else + call Tex_ScanFileForLabels(a:prefix) + endif + exec pos + + q + let &path = _path + let &suffixesadd = _suffixesadd + +endfunction " }}} +" Tex_ScanFileForCite: search for \bibitem's in .bib or .bbl or tex files {{{ +" Description: +" Search for bibliographic entries in the presently edited file in the +" following manner: +" 1. First see if the file has a \bibliography command. +" If YES: +" 1. If a .bib file corresponding to the \bibliography command can be +" found, then search for '@.*'.a:prefix inside it. +" 2. Otherwise, if a .bbl file corresponding to the \bibliography command +" can be found, then search for '\bibitem'.a:prefix inside it. +" 2. Next see if the file has a \thebibliography environment +" If YES: +" 1. Search for '\bibitem'.a:prefix in this file. +" +" If neither a \bibliography or \begin{thebibliography} are found, then repeat +" steps 1 and 2 for every file \input'ed into this file. Abort any searching +" as soon as the first \bibliography or \begin{thebibliography} is found. +function! Tex_ScanFileForCite(prefix) + call Tex_Debug('+Tex_ScanFileForCite: searching for bibkeys in '.bufname('%').' (buffer #'.bufnr('%').')', 'view') + let presBufNum = bufnr('%') + + let foundCiteFile = 0 + " First find out if this file has a \bibliography command in it. If so, + " assume that this is the only file in the project which defines a + " bibliography. + if search('\\\(no\)\?bibliography{', 'w') + call Tex_Debug('Tex_ScanFileForCite: found bibliography command in '.bufname('%'), 'view') + " convey that we have found a bibliography command. we do not need to + " proceed any further. + let foundCiteFile = 1 + + " extract the bibliography filenames from the command. + let bibnames = matchstr(getline('.'), '\\\(no\)\?bibliography{\zs.\{-}\ze}') + let bibnames = substitute(bibnames, '\s', '', 'g') + + call Tex_Debug('trying to search through ['.bibnames.']', 'view') + + let &path = '.,'.g:Tex_BIBINPUTS + + let i = 1 + while 1 + let bibname = Tex_Strntok(bibnames, ',', i) + if bibname == '' + break + endif + + " first try to find if a .bib file exists. If so do not search in + " the corresponding .bbl file. (because the .bbl file will most + " probly be generated automatically from the .bib file with + " bibtex). + + let fname = Tex_FindFile(bibname, '.,'.g:Tex_BIBINPUTS, '.bib') + if fname != '' + call Tex_Debug('finding .bib file ['.bufname('%').']', 'view') + exec 'split '.Tex_EscapeSpaces(fname) + call Tex_Grepadd('@.*{'.a:prefix, "%") + q + else + let fname = Tex_FindFile(bibname, '.,'.g:Tex_BIBINPUTS, '.bbl') + if fname != '' + exec 'split '.Tex_EscapeSpaces(fname) + call Tex_Debug('finding .bbl file ['.bufname('.').']', 'view') + call Tex_Grepadd('\\bibitem{'.a:prefix, "%") + q + endif + endif + + let i = i + 1 + endwhile + + if foundCiteFile + return 1 + endif + endif + + " If we have a thebibliography environment, then again assume that this is + " the only file which defines the bib-keys. Aand convey this information + " upwards by returning 1. + if search('^\s*\\begin{thebibliography}', 'w') + call Tex_Debug('got a thebibliography environment in '.bufname('%'), 'view') + + let foundCiteFile = 1 + + split + lcd %:p:h + call Tex_Debug("silent! grepadd! ".Tex_EscapeForGrep('\\bibitem{'.a:prefix)." %", 'view') + call Tex_Grepadd('\\bibitem{'.a:prefix, "%") + q + + return 1 + endif + + " If we have not found any \bibliography or \thebibliography environment + " in this file, search for these environments in all the files which this + " file includes. + + exec 0 + let wrap = 'w' + while search('^\s*\\\(input\|include\)', wrap) + let wrap = 'W' + + let filename = matchstr(getline('.'), '\\\(input\|include\){\zs.\{-}\ze}') + + let foundfile = Tex_FindFile(filename, '.,'.g:Tex_TEXINPUTS, '.tex') + if foundfile != '' + exec 'split '.Tex_EscapeSpaces(foundfile) + call Tex_Debug('scanning recursively in ['.foundfile.']', 'view') + let foundCiteFile = Tex_ScanFileForCite(a:prefix) + q + endif + + if foundCiteFile + return 1 + endif + endwhile + + + return 0 +endfunction " }}} +" Tex_ScanFileForLabels: greps present file and included files for \\label's {{{ +" Description: +" Grep the presently edited file for \\label's. If the present file \include's +" or \input's other files, then recursively scan those as well, i.e we support +" arbitrary levels of \input'ed-ness. +function! Tex_ScanFileForLabels(prefix) + call Tex_Debug("+Tex_ScanFileForLabels: grepping in file [".bufname('%')."]", "view") + + lcd %:p:h + call Tex_Grepadd('\\label{'.a:prefix, "%") + + " Then recursively grep for all \include'd or \input'ed files. + exec 0 + let wrap = 'w' + while search('^\s*\\\(input\|include\)', wrap) + let wrap = 'W' + + let filename = matchstr(getline('.'), '\\\(input\|include\){\zs.\{-}\ze}') + let foundfile = Tex_FindFile(filename, '.,'.Tex_TEXINPUTS, '.tex') + if foundfile != '' + exec 'split '.Tex_EscapeSpaces(foundfile) + call Tex_Debug('Tex_ScanFileForLabels: scanning recursively in ['.foundfile.']', 'view') + call Tex_ScanFileForLabels(a:prefix) + q + endif + endwhile + +endfunction " }}} + +" ============================================================================== +" Functions for custom command completion +" ============================================================================== +" Tex_completion_{var}: similar variables can be set in package files {{{ +let g:Tex_completion_bibliographystyle = 'abbr,alpha,plain,unsrt' +let g:Tex_completion_addtocontents = 'lof}{,lot}{,toc}{' +let g:Tex_completion_addcontentsline = 'lof}{figure}{,lot}{table}{,toc}{chapter}{,toc}{part}{,'. + \ 'toc}{section}{,toc}{subsection}{,toc}{paragraph}{,'. + \ 'toc}{subparagraph}{' +" }}} +" Tex_PromptForCompletion: prompts for a completion {{{ +" Description: +function! s:Tex_PromptForCompletion(texcommand,ask) + + let common_completion_prompt = + \ Tex_CreatePrompt(g:Tex_completion_{a:texcommand}, 2, ',') . "\n" . + \ 'Enter number or completion: ' + + let inp = input(a:ask."\n".common_completion_prompt) + if inp =~ '^[0-9]\+$' + let completion = Tex_Strntok(g:Tex_completion_{a:texcommand}, ',', inp) + else + let completion = inp + endif + + return completion +endfunction " }}} +" Tex_DoCompletion: fast insertion of completion {{{ +" Description: +" +function! s:Tex_DoCompletion(texcommand) + let completion = <SID>Tex_PromptForCompletion(a:texcommand, 'Choose a completion to insert: ') + if completion != '' + return completion + else + return '' + endif +endfunction " }}} + +" ============================================================================== +" Functions for presenting an outlined version for completion +" ============================================================================== +" Tex_StartOutlineCompletion: sets up an outline window {{{ + +" get the place where this plugin resides for setting cpt and dict options. +" these lines need to be outside the function. +let s:path = expand('<sfile>:p:h') +if has('python') && Tex_GetVarValue('Tex_UsePython') + python import sys, re + exec "python sys.path += [r'". s:path . "']" + python import outline +endif + +function! Tex_StartOutlineCompletion() + let mainfname = Tex_GetMainFileName(':p') + + " open the buffer + let _report = &report + let _cmdheight=&cmdheight + let _lazyredraw = &lazyredraw + set report=1000 + set cmdheight=1 + set lazyredraw + + bot split __OUTLINE__ + exec Tex_GetVarValue('Tex_OutlineWindowHeight', 15).' wincmd _' + + setlocal modifiable + setlocal noswapfile + setlocal buftype=nowrite + setlocal bufhidden=delete + setlocal nowrap + setlocal foldmethod=marker + setlocal foldmarker=<<<,>>> + + " delete everything in it to the blackhole + % d _ + + if has('python') && Tex_GetVarValue('Tex_UsePython') + exec 'python retval = outline.main(' + \. 'r"' . fnamemodify(mainfname, ':p') . '", ' + \. 'r"' . s:prefix . '")' + + " transfer variable from python to a local variable. + python vim.command("""let retval = "%s" """ % re.sub(r'"|\\', r'\\\g<0>', retval)) + + 0put!=retval + else + exec '0r!'.s:path.'/outline.py '.mainfname.' '.s:prefix + endif + + 0 + + call Tex_SetupOutlineSyntax() + + exec 'nnoremap <buffer> <cr> ' + \ .':cd '.s:origdir.'<CR>' + \ .':call Tex_FinishOutlineCompletion()<CR>' + exec 'nnoremap <buffer> q ' + \ .':cd '.s:origdir.'<CR>' + \ .':close<CR>' + + " once the buffer is initialized, go back to the original settings. + setlocal nomodifiable + setlocal nomodified + let &report = _report + let &cmdheight = _cmdheight + let &lazyredraw = _lazyredraw + +endfunction " }}} +" Tex_SetupOutlineSyntax: sets up the syntax items for the outline {{{ +" Description: +function! Tex_SetupOutlineSyntax() + syn match outlineFileName "<\f\+>$" contained + syn match foldMarkers "<<<\d$" contained + syn match firstSemiColon '^:' contained + syn match firstAngle '^>' contained + + syn match sectionNames '\(\d\.\)\+ .*' contains=foldMarkers + syn match previousLine '^:.*' contains=firstSemiColon + syn match labelLine '^>.*' contains=firstAngle,outlineFileName + + hi def link outlineFileName Ignore + hi def link foldMarkers Ignore + hi def link firstSemiColon Ignore + hi def link firstAngle Ignore + + hi def link sectionNames Type + hi def link previousLine Special + hi def link labelLine Comment +endfunction " }}} +" Tex_FinishOutlineCompletion: inserts the reference back in the text {{{ +function! Tex_FinishOutlineCompletion() + if getline('.') !~ '^[>:]' + return + endif + + if getline('.') =~ '^>' + let ref_complete = matchstr(getline('.'), '^>\s\+\zs\S\+\ze') + elseif getline('.') =~ '^:' + let ref_complete = matchstr(getline(line('.')-1), '^>\s\+\zs\S\+\ze') + endif + + let ref_remaining = strpart(ref_complete, strlen(s:prefix)) + close + call Tex_CompleteWord(ref_remaining) +endfunction " }}} + +" ============================================================================== +" Functions for presenting a nicer list of bibtex entries +" ============================================================================== +" Tex_FindBibFiles: finds all .bib files used by the main file {{{ +" Description: +function! Tex_FindBibFiles() + + let mainfname = Tex_GetMainFileName(':p') + wincmd n + exec 'silent! e '.mainfname + + if search('\\\(no\)\?bibliography{', 'w') + + call Tex_Debug('Tex_FindBibFiles: found bibliography command in '.bufname('%'), 'view') + + " extract the bibliography filenames from the command. + let bibnames = matchstr(getline('.'), '\\\(no\)\?bibliography{\zs.\{-}\ze}') + let bibnames = substitute(bibnames, '\s', '', 'g') + + call Tex_Debug(':Tex_FindBibFiles: trying to search through ['.bibnames.']', 'view') + + let bibfiles = '' + let i = 1 + while 1 + let bibname = Tex_Strntok(bibnames, ',', i) + if bibname == '' + break + endif + let fname = Tex_FindFile(bibname, '.,'.g:Tex_BIBINPUTS, '.bib') + if fname != '' + let bibfiles = bibfiles.fname."\n" + endif + let i = i + 1 + endwhile + + call Tex_Debug(":Tex_FindBibFiles: returning [".bibfiles."]", "view") + q + return bibfiles + + else + q + return '' + endif + +endfunction " }}} +" Tex_StartBibtexOutline: sets up an outline window {{{ + +" get the place where this plugin resides for setting cpt and dict options. +" these lines need to be outside the function. +if has('python') && Tex_GetVarValue('Tex_UsePython') + python import sys, re + exec "python sys.path += [r'". s:path . "']" + python import bibtools +endif + +function! Tex_StartCiteCompletion() + let mainfname = Tex_GetMainFileName(':p') + let bibfiles = Tex_FindBibFiles() + + bot split __OUTLINE__ + exec Tex_GetVarValue('Tex_OutlineWindowHeight', 15).' wincmd _' + + exec 'python Tex_BibFile = bibtools.BibFile("""'.bibfiles.'""")' + exec 'python Tex_BibFile.addfilter("key ^'.s:prefix.'")' + call Tex_DisplayBibList() + + nnoremap <Plug>Tex_JumpToNextBibEntry :call search('^\S.*\]$', 'W')<CR>:call Tex_EchoBibShortcuts()<CR>z. + nnoremap <Plug>Tex_JumpToPrevBibEntry :call search('^\S.*\]$', 'bW')<CR>:call Tex_EchoBibShortcuts()<CR>z. + nnoremap <Plug>Tex_FilterBibEntries :call Tex_HandleBibShortcuts('filter')<CR> + nnoremap <Plug>Tex_RemoveBibFilters :call Tex_HandleBibShortcuts('remove_filters')<CR> + nnoremap <Plug>Tex_SortBibEntries :call Tex_HandleBibShortcuts('sort')<CR> + nnoremap <Plug>Tex_CompleteCiteEntry :call Tex_CompleteCiteEntry()<CR> + + nmap <buffer> <silent> n <Plug>Tex_JumpToNextBibEntry + nmap <buffer> <silent> p <Plug>Tex_JumpToPrevBibEntry + nmap <buffer> <silent> f <Plug>Tex_FilterBibEntries + nmap <buffer> <silent> s <Plug>Tex_SortBibEntries + nmap <buffer> <silent> a <Plug>Tex_RemoveBibFilters + nmap <buffer> <silent> q :close<CR> + nmap <buffer> <silent> <CR> <Plug>Tex_CompleteCiteEntry + +endfunction " }}} +" Tex_DisplayBibList: displays the list of bibtex entries {{{ +" Description: +function! Tex_DisplayBibList() + " open the buffer + let _report = &report + let _cmdheight=&cmdheight + let _lazyredraw = &lazyredraw + set report=1000 + set cmdheight=1 + set lazyredraw + + setlocal modifiable + setlocal noswapfile + setlocal buftype=nowrite + setlocal bufhidden=delete + setlocal nowrap + setlocal foldmethod=marker + setlocal foldmarker=<<<,>>> + + + " delete everything in it to the blackhole + % d _ + + exec 'python Tex_CurBuf = vim.current.buffer' + exec 'python Tex_CurBuf[:] = str(Tex_BibFile).splitlines()' + + call Tex_SetupBibSyntax() + + 0 + call Tex_EchoBibShortcuts() + + " once the buffer is initialized, go back to the original settings. + setlocal nomodifiable + setlocal nomodified + let &report = _report + let &cmdheight = _cmdheight + let &lazyredraw = _lazyredraw + +endfunction " }}} +" Tex_EchoBibShortcuts: echos all the shortcuts in the status line {{{ +" Description: +function! Tex_EchoBibShortcuts() + echomsg '(a) all (f) filter (s) sort (n) next (p) previous (q) quit (<CR>) choose' +endfunction " }}} +" Tex_SetupBibSyntax: sets up the syntax items for the outline {{{ +" Description: +function! Tex_SetupBibSyntax() + syn match BibTitleHeader "^TI" contained + syn match BibAuthorHeader "^AU" contained + syn match BibLocationHeader "^IN" contained + syn match BibMiscHeader "^MI" contained + + syn match BibKeyLine '^\S.*\]$' contains=BibKey + syn match BibTitle "^TI .*" contains=BibTitleHeader + syn match BibAuthor "^AU .*" contains=BibAuthorHeader + syn match BibLocation "^IN .*" contains=BibLocationHeader + syn match BibMisc "^MI .*" contains=BibMiscHeader + + hi def link BibTitleHeader Ignore + hi def link BibAuthorHeader Ignore + hi def link BibLocationHeader Ignore + hi def link BibMiscHeader Ignore + + hi def link BibKeyLine Visual + hi def link BibTitle Type + hi def link BibAuthor Special + hi def link BibLocation Comment + hi def link BibMisc Comment +endfunction " }}} +" Tex_HandleBibShortcuts: handles user keypresses {{{ +" Description: +function! Tex_HandleBibShortcuts(command) + + if a:command == 'filter' || a:command == 'sort' + + let fieldprompt = + \ "Field acronyms: (`:let g:Tex_EchoBibFields = 0` to avoid this message)\n" . + \ " [t] title [a] author [b] booktitle \n" . + \ " [j] journal [y] year [p] bibtype \n" . + \ " (you can also enter the complete field name) \n" + + let fieldprompt = Tex_GetVarValue('Tex_BibFieldPrompt', fieldprompt) + + if Tex_GetVarValue('Tex_EchoBibFields', 1) == 1 + echo fieldprompt + endif + + let inp = input('Enter '.a:command.' criterion [field<space>value]: ') + + if inp != '' + " If the field is specified as a single character, then replace + " it with the corresponding 'full form'. + if inp =~ '^[a-z]\>' + if Tex_GetVarValue('Tex_BibAcronym_'.inp[0]) != '' + let inp = substitute(inp, '.', Tex_GetVarValue('Tex_BibAcronym_'.inp[0]), '') + elseif fieldprompt =~ '\['.inp[0].'\]' + let full = matchstr(fieldprompt, '\['.inp[0].'\] \zs\w\+\ze') + let inp = substitute(inp, '.', full, '') + endif + endif + call Tex_Debug(":Tex_HandleBibShortcuts: using inp = [".inp."]", "view") + if a:command == 'filter' + exec 'python Tex_BibFile.addfilter("'.inp.'")' + elseif a:command == 'sort' + exec "python Tex_BibFile.addsortfield(\"".inp."\")" + exec 'python Tex_BibFile.sort()' + endif + call Tex_DisplayBibList() + endif + + elseif a:command == 'remove_filters' + + exec 'python Tex_BibFile.rmfilters()' + exec 'python Tex_BibFile.addfilter("key '.s:prefix.'")' + call Tex_DisplayBibList() + + endif + +endfunction " }}} +" Tex_CompleteCiteEntry: completes cite entry {{{ +" Description: +function! Tex_CompleteCiteEntry() + normal! 0 + call search('\[\S\+\]$', 'W') + if getline('.') !~ '\[\S\+\]$' + call search('\[\S\+\]$', 'bW') + endif + + if getline('.') !~ '\[\S\+\]$' + return + endif + + let ref = matchstr(getline('.'), '\[\zs\S\+\ze\]$') + close + call Tex_Debug(":Tex_CompleteCiteEntry: completing with ".ref, "view") + call Tex_CompleteWord(strpart(ref, strlen(s:prefix))) +endfunction " }}} + +com! -nargs=0 TClearCiteHist unlet! s:citeSearchHistory + +" vim:fdm=marker:nowrap:noet:ff=unix:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/latex-suite/version.vim b/vimfiles.latex/ftplugin/latex-suite/version.vim new file mode 100644 index 0000000..7c87c80 --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/version.vim @@ -0,0 +1,30 @@ +" Tex_Version: returns a string which gives the current version number of latex-suite +" Description: +" Each time a bug fix/addition is done in any source file in latex-suite, +" not just this file, the number below has to be incremented by the author. +" This will ensure that there is a single 'global' version number for all of +" latex-suite. +" +" If a change is done in the doc/ directory, i.e an addition/change in the +" documentation, then this number should NOT be incremented. +" +" Latex-suite will follow a 3-tier system of versioning just as Vim. A +" version number will be of the form: +" +" X.Y.ZZ +" +" 'X' will only be incremented for a major over-haul or feature addition. +" 'Y' will be incremented for significant changes which do not qualify +" as major. +" 'ZZ' will be incremented for bug-fixes and very trivial additions such +" as adding an option etc. Once ZZ reaches 50, then Y will be +" incremented and ZZ will be reset to 01. Each time we have a +" version number of the form X.Y.01, then we'll make a release on +" vim.sf.net and also create a cvs tag at that point. We'll try to +" "stabilize" that version by releasing a few pre-releases and then +" keep that as a stable point. +function! Tex_Version() + return "Latex-Suite: version 1.8.11" +endfunction + +com! -nargs=0 TVersion echo Tex_Version() diff --git a/vimfiles.latex/ftplugin/latex-suite/wizardfuncs.vim b/vimfiles.latex/ftplugin/latex-suite/wizardfuncs.vim new file mode 100644 index 0000000..113271c --- /dev/null +++ b/vimfiles.latex/ftplugin/latex-suite/wizardfuncs.vim @@ -0,0 +1,377 @@ +" File: wizardfuncs.vim +" Author: Mikolaj Machowski <mikmach@wp.pl> +" Description: +" +" Installation: +" History: pluginized by Srinath Avadhanula +"============================================================================= + +if exists('s:doneOnce') + finish +endif +let s:doneOnce = 1 + +let s:mapleader = exists('mapleader') ? mapleader : "\\" +" ============================================================================== +" Specialized functions for handling sections from command line +" ============================================================================== + +com! -nargs=? TSection call Tex_section(<f-args>) +com! -nargs=? TSectionAdvanced call Tex_section_adv(<f-args>) + +" Tex_VisSecAdv: handles visual selection for sections {{{ +function! Tex_VisSecAdv(section) + let shorttitle = input("Short title? ") + let toc = input("Include in table of contents [y]/n ? ") + let sstructure = "\\".a:section + if ( toc == "" || toc == "y" ) + let toc = "" + else + let toc = "*" + endif + if shorttitle != "" + let shorttitle = '['.shorttitle.']' + endif + exe "normal `>a}\<cr>\<esc>`<i".sstructure.toc.shorttitle."{" +endfunction + +" }}} +" Tex_InsSecAdv: section wizard in insert mode {{{ +function! Tex_InsSecAdv(structure) + let ttitle = input("Title? ") + let shorttitle = input("Short title? ") + let toc = input("Include in table of contents [y]/n ? ") + "Structure + let sstructure = "\\".a:structure + "TOC + if ( toc == "" || toc == "y" ) + let toc = "" + else + let toc = "*" + endif + "Shorttitle + if shorttitle != "" + let shorttitle = '['.shorttitle.']' + endif + "Title + let ttitle = '{'.ttitle.'}' + "Happy end? + return sstructure.toc.shorttitle.ttitle +endfunction + + +" }}} +function! Tex_section(...) "{{{ + silent let pos = line('.').' | normal! '.virtcol('.').'|' + silent let last_section_value = s:Tex_section_detection() + if a:0 == 0 + silent let last_section_name = s:Tex_section_name(last_section_value) + silent call s:Tex_section_call(last_section_name) + elseif a:1 =~ "[+=\-]" + silent let sec_arg = a:1 + silent let curr_section_value = s:Tex_section_curr_rel_value(sec_arg, last_section_value) + silent let curr_section_name = s:Tex_section_name(curr_section_value) + silent call s:Tex_section_call(curr_section_name) + elseif a:1 == "?" + echo s:last_section_line + else + silent let curr_section_value = s:Tex_section_curr_value(a:1) + silent let curr_section_name = s:Tex_section_name(curr_section_value) + silent call s:Tex_section_call(curr_section_name) + endif + silent exe pos +endfunction "}}} +function! Tex_section_adv(...) "{{{ + let pos = line('.').' | normal! '.virtcol('.').'|' + silent let last_section_value = s:Tex_section_detection() + if a:0 == 0 + silent let last_section_name = s:Tex_section_name(last_section_value) + let section = Tex_InsSecAdv(last_section_name) + elseif a:1 =~ "[+=\-]" + silent let sec_arg = a:1 + silent let curr_section_value = s:Tex_section_curr_rel_value(sec_arg, last_section_value) + silent let curr_section_name = s:Tex_section_name(curr_section_value) + let section = Tex_InsSecAdv(curr_section_name) + else + silent let curr_section_value = s:Tex_section_curr_value(a:1) + silent let curr_section_name = s:Tex_section_name(curr_section_value) + silent call s:Tex_section_call(curr_section_name) + let section = Tex_InsSecAdv(curr_section_name) + endif + exe "normal i".section + exe pos +endfunction "}}} +function! s:Tex_section_detection() "{{{ + let pos = line('.').' | normal! '.virtcol('.').'|' + let last_section1 = search("\\\\\subparagraph\\|\\\\paragraph\\|\\\\subsubsection\\|\\\\subsection\\|\\\\section\\|\\\\chapter\\|\\\part\)", "b") + exe pos + let last_section2 = search("\\\\\part\\|\\\\chapter\\|\\\\section\\|\\\\subsection\\|\\\\subsubsection\\|\\\\paragraph\\|\\\subparagraph\)", "b") + if last_section1 > last_section2 + let last_section = last_section1 + else + let last_section = last_section2 + endif + if last_section != 0 + exe last_section + if getline(".") =~ "\\\\part" + let last_section_value = 0 + elseif getline(".") =~ "\\\\chapter" + let last_section_value = 1 + elseif getline(".") =~ "\\\\section" + let last_section_value = 2 + elseif getline(".") =~ "\\\\subsection" + let last_section_value = 3 + elseif getline(".") =~ "\\\\subsubsection" + let last_section_value = 4 + elseif getline(".") =~ "\\\\paragraph" + let last_section_value = 5 + elseif getline(".") =~ "\\\\subparagraph" + let last_section_value = 6 + endif + let s:last_section_line = getline(".") + else + let last_section_value = 0 + endif + exe pos + return last_section_value +endfunction "}}} +function! s:Tex_section_curr_value(sec_arg) "{{{ + if a:sec_arg == "pa" || a:sec_arg == "0" || a:sec_arg == "part" + let curr_section_value = 0 + elseif a:sec_arg == "ch" || a:sec_arg == "1" || a:sec_arg == "chapter" + let curr_section_value = 1 + elseif a:sec_arg == "se" || a:sec_arg == "2" || a:sec_arg == "section" + let curr_section_value = 2 + elseif a:sec_arg == "ss" || a:sec_arg == "3" || a:sec_arg == "subsection" + let curr_section_value = 3 + elseif a:sec_arg == "s2" || a:sec_arg == "4" || a:sec_arg == "subsubsection" + let curr_section_value = 4 + elseif a:sec_arg == "pr" || a:sec_arg == "5" || a:sec_arg == "paragraph" + let curr_section_value = 5 + elseif a:sec_arg == "sp" || a:sec_arg == "6" || a:sec_arg == "subparagraph" + let curr_section_value = 6 + endif + return curr_section_value +endfunction "}}} +function! s:Tex_section_curr_rel_value(sec_arg, last_section_value) "{{{ + let last_section_value = a:last_section_value + if a:sec_arg == "+" || a:sec_arg == "+1" + let curr_section_value = last_section_value + 1 + elseif a:sec_arg == "++" || a:sec_arg == "+2" + let curr_section_value = last_section_value + 2 + elseif a:sec_arg == "-" || a:sec_arg == "-1" + let curr_section_value = last_section_value - 1 + elseif a:sec_arg == "--" || a:sec_arg == "-2" + let curr_section_value = last_section_value - 2 + elseif a:sec_arg == "=" + let curr_section_value = last_section_value + else + exe "let curr_section_value = last_section_value".a:sec_arg + endif + if curr_section_value < 0 + let curr_section_value = 0 + elseif curr_section_value > 6 + let curr_section_value = 6 + endif + return curr_section_value +endfunction "}}} +function! s:Tex_section_name(section_value) "{{{ + if a:section_value == 0 + let section_name = "part" + elseif a:section_value == 1 + let section_name = "chapter" + elseif a:section_value == 2 + let section_name = "section" + elseif a:section_value == 3 + let section_name = "subsection" + elseif a:section_value == 4 + let section_name = "subsubsection" + elseif a:section_value == 5 + let section_name = "paragraph" + elseif a:section_value == 6 + let section_name = "subparagraph" + endif + return section_name +endfunction "}}} +function! s:Tex_section_call(section_name) "{{{ + exe "normal! i\\".a:section_name."{<++>}<++>\<Esc>0\<C-j>" +" let ret_section = "\\".a:section_name."{<++>}<++>" +" exe "normal! i\<C-r>=IMAP_PutTextWithMovement(ret_section)\<CR>" +" normal f}i +endfunction "}}} + +" ============================================================================== +" Add looking help into latexhelp.txt +" ============================================================================== + +inoremap <silent> <Plug>Tex_Help <C-o>:call <SID>TexHelp()<CR> +nnoremap <silent> <Plug>Tex_Help :call <SID>TexHelp()<CR> +command! -nargs=0 THelp call <SID>TexHelp() +call Tex_MakeMap('<F1>', '<Plug>Tex_Help', 'i', '') +call Tex_MakeMap('<F1>', '<Plug>Tex_Help', 'n', '') + +" TexHelp: Cursor being on LaTeX item check if exists help tag about it " {{{ +function! s:TexHelp() + let syntax_item = synIDattr(synID(line('.'),col('.')-1,0),"name") + if syntax_item =~ '^tex' + setlocal isk+=\ + let curword = expand('<cword>') + setlocal isk-=\ + let v:errmsg = '' + if curword =~ "^\\" || syntax_item == 'texSectionName' + exe 'silent! help '.curword + if v:errmsg =~ '^E149:' + echohl ErrorMsg + exe "echomsg 'Sorry, no help for LaTeX: ".curword."'" + echohl None + let v:errmsg = '' + endif + else + help + endif + else + help + endif +endfunction " }}} + +" ============================================================================== +" Tables of shortcuts +" ============================================================================== +" +command! -nargs=? Tshortcuts call Tex_shortcuts(<f-args>)<CR> + +" Tex_shortcuts: Show shortcuts in terminal after : command {{{ +function! Tex_shortcuts(...) + if a:0 == 0 + let shorts = input(" Allowed arguments are:" + \."\n g General" + \."\n e Environments" + \."\n f Fonts" + \."\n s Sections" + \."\n m Math" + \."\n a All" + \."\n Enter your choice (<Enter> quits) : ") + call Tex_shortcuts(shorts) + elseif a:1 == 'g' + echo g:generalshortcuts + elseif a:1 == 'e' + echo g:environmentshortcuts + elseif a:1 == 'f' + echo g:fontshortcuts + elseif a:1 == 's' + echo g:sectionshortcuts + elseif a:1 == 'm' + echo g:mathshortcuts + elseif a:1 == 'a' + echo g:generalshortcuts + echo g:environmentshortcuts + echo g:fontshortcuts + echo g:sectionshortcuts + echo g:mathshortcuts + endif + +endfunction +" }}} + +" General shortcuts {{{ +let g:generalshortcuts = '' +\."\n General shortcuts" +\."\n <mapleader> is a value of <Leader>" +\."\n ".s:mapleader.'ll compile whole document' +\."\n ".s:mapleader.'lv view compiled document' +\."\n ".s:mapleader.'ls forward searching (if possible)' +\."\n ".s:mapleader.'rf refresh folds' +" }}} +" Environment shortcuts {{{ +let g:environmentshortcuts = '' +\."\n Environment shortcuts" +\."\n <mapleader> is a value of g:Tex_Leader2" +\."\n I v&V I v&V" +\."\n ELI ".g:Tex_Leader2."li list EQN ".g:Tex_Leader2."qn quotation" +\."\n EDE ".g:Tex_Leader2."de description ESB ".g:Tex_Leader2."sb sloppybar" +\."\n EEN ".g:Tex_Leader2."en enumerate ETI ".g:Tex_Leader2."ti theindex" +\."\n EIT ".g:Tex_Leader2."it itemize ETP ".g:Tex_Leader2."tp titlepage" +\."\n ETI ".g:Tex_Leader2."ti theindex EVM ".g:Tex_Leader2."vm verbatim" +\."\n ETL ".g:Tex_Leader2."tl trivlist EVE ".g:Tex_Leader2."ve verse" +\."\n ETE ".g:Tex_Leader2."te table ETB ".g:Tex_Leader2."tb thebibliography" +\."\n ETG ".g:Tex_Leader2."tg tabbing ENO ".g:Tex_Leader2."no note" +\."\n ETR ".g:Tex_Leader2."tr tabular EOV ".g:Tex_Leader2."ov overlay" +\."\n EAR ".g:Tex_Leader2."ar array ESL ".g:Tex_Leader2."sl slide" +\."\n EDM ".g:Tex_Leader2."dm displaymath EAB ".g:Tex_Leader2."ab abstract" +\."\n EEA ".g:Tex_Leader2."ea eqnarray EAP ".g:Tex_Leader2."ap appendix" +\."\n EEQ ".g:Tex_Leader2."eq equation ECE ".g:Tex_Leader2."ce center" +\."\n EDO ".g:Tex_Leader2."do document EFI ".g:Tex_Leader2."fi figure" +\."\n EFC ".g:Tex_Leader2."fc filecontents ELR ".g:Tex_Leader2."lr lrbox" +\."\n EFL ".g:Tex_Leader2."fl flushleft EMP ".g:Tex_Leader2."mp minipage" +\."\n EFR ".g:Tex_Leader2."fr flushright EPI ".g:Tex_Leader2."pi picture" +\."\n EMA ".g:Tex_Leader2."ma math EQE ".g:Tex_Leader2."qe quote" +" }}} +" Font shortcuts {{{ +let g:fontshortcuts = '' +\."\n Font shortcuts" +\."\n <mapleader> is a value of g:Tex_Leader" +\."\n Shortcuts Effects" +\."\n I v&V I&v V" +\."\n FBF ".g:Tex_Leader."bf \\textbf{} {\\bfseries }" +\."\n FMD ".g:Tex_Leader."md \\textmd{} {\\mdseries }" +\."\n" +\."\n FTT ".g:Tex_Leader."tt \\texttt{} {\\ttfamily }" +\."\n FSF ".g:Tex_Leader."sf \\textsf{} {\\sffamily }" +\."\n FRM ".g:Tex_Leader."rm \\textrm{} {\\rmfamily }" +\."\n" +\."\n FUP ".g:Tex_Leader."up \\textup{} {\\upshape }" +\."\n FSL ".g:Tex_Leader."sl \\textsl{} {\\slshape }" +\."\n FSC ".g:Tex_Leader."sc \\textsc{} {\\scshape }" +\."\n FIT ".g:Tex_Leader."it \\textit{} {\\itshape }" +" }}} +" Section shortcuts {{{ +let g:sectionshortcuts = '' +\."\n Section shortcuts" +\."\n <mapleader> is a value of g:Tex_Leader2" +\."\n I v&V" +\."\n SPA ".g:Tex_Leader2."pa part" +\."\n SCH ".g:Tex_Leader2."ch chapter" +\."\n SSE ".g:Tex_Leader2."se section" +\."\n SSS ".g:Tex_Leader2."ss subsection" +\."\n SS2 ".g:Tex_Leader2."s2 subsubsection" +\."\n SPG ".g:Tex_Leader2."pg paragraph" +\."\n SSP ".g:Tex_Leader2."sp subparagraph" +" }}} +" Math shortcuts {{{ +let g:mathshortcuts = '' +\."\n Math shortcuts - Insert mode" +\."\n `a \\alpha `b \\beta" +\."\n `g \\gamma `d \\delta" +\."\n `e \\varepsilon `z \\zeta" +\."\n `h \\eta `q \\theta" +\."\n `i \\iota `k \\kappa" +\."\n `l \\lambda `m \\mu" +\."\n `n \\nu `x \\xi" +\."\n `p \\pi `r \\rho" +\."\n `s \\sigma `v \\varsigma" +\."\n `t \\tau `u \\upsilon" +\."\n `f \\varphi `c \\chi" +\."\n `y \\psi `w \\omega" +\."\n `A \\Alpha `B \\Beta" +\."\n `G \\Gamma `D \\Delta" +\."\n `E \\Epsilon `Z \\mathrm{Z}" +\."\n `H \\Eta `K \\Kappa" +\."\n `L \\Lambda `M \\Mu" +\."\n `N \\Nu `X \\Xi" +\."\n `P \\Pi `R \\Rho" +\."\n `S \\Sigma `T \\Tau" +\."\n `U \\Upsilon `C \\Chi" +\."\n `Y \\Psi `W \\Omega" +\."\n `( \\subset `) \\Subset" +\."\n `= \\equiv =~ \\approx" +\."\n `- \\bigcap `+ \\bigcup" +\."\n `. \\cdot `* \\times" +\."\n `\\ \\setminus `@ \\circ" +\."\n `& \\wedge `, \\nonumber" +\."\n `8 \\infty `_ \\bar{}" +\."\n `: \\ddot{} `; \\dot{}" +\."\n `^ \\hat{} `~ \\tilde{}" +\."\n `6 \\partial" +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vimfiles.latex/ftplugin/tex_latexSuite.vim b/vimfiles.latex/ftplugin/tex_latexSuite.vim new file mode 100644 index 0000000..582d014 --- /dev/null +++ b/vimfiles.latex/ftplugin/tex_latexSuite.vim @@ -0,0 +1,13 @@ +" LaTeX filetype +" Language: LaTeX (ft=tex) +" Maintainer: Srinath Avadhanula +" Email: srinath@fastmail.fm + +if !exists('s:initLatexSuite') + let s:initLatexSuite = 1 + exec 'so '.expand('<sfile>:p:h').'/latex-suite/main.vim' + + silent! do LatexSuite User LatexSuiteInitPost +endif + +silent! do LatexSuite User LatexSuiteFileType diff --git a/vimfiles.latex/ftplugin/xml.vim b/vimfiles.latex/ftplugin/xml.vim new file mode 100644 index 0000000..1a19d73 --- /dev/null +++ b/vimfiles.latex/ftplugin/xml.vim @@ -0,0 +1,848 @@ +" Vim script file vim600:fdm=marker: +" FileType: XML +" Author: Devin Weaver <vim (at) tritarget.com> +" Maintainer: Devin Weaver <vim (at) tritarget.com> +" Last Change: $Date: 2005/05/12 18:12:58 $ +" Version: $Revision: 1.28 $ +" Location: http://www.vim.org/scripts/script.php?script_id=301 +" Licence: This program is free software; you can redistribute it +" and/or modify it under the terms of the GNU General Public +" License. See http://www.gnu.org/copyleft/gpl.txt +" Credits: Brad Phelan <bphelan (at) mathworks.co.uk> for completing +" tag matching and visual tag completion. +" Ma, Xiangjiang <Xiangjiang.Ma (at) broadvision.com> for +" pointing out VIM 6.0 map <buffer> feature. +" Luc Hermitte <hermitte (at) free.fr> for testing the self +" install documentation code and providing good bug fixes. +" Guo-Peng Wen for the self install documentation code. + +" This script provides some convenience when editing XML (and some SGML) +" formated documents. + +" Section: Documentation +" ---------------------- +" +" Documentation should be available by ":help xml-plugin" command, once the +" script has been copied in you .vim/plugin directory. +" +" You still can read the documentation at the end of this file. Locate it by +" searching the "xml-plugin" string (and set ft=help to have +" appropriate syntaxic coloration). + +" Note: If you used the 5.x version of this file (xmledit.vim) you'll need to +" comment out the section where you called it since it is no longer used in +" version 6.x. + +" TODO: Revamp ParseTag to pull appart a tag a rebuild it properly. +" a tag like: < test nowrap testatt=foo > +" should be fixed to: <test nowrap="nowrap" testatt="foo"></test> + +"============================================================================== + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +" WrapTag -> Places an XML tag around a visual selection. {{{1 +" Brad Phelan: Wrap the argument in an XML tag +" Added nice GUI support to the dialogs. +" Rewrote function to implement new algorythem that addresses several bugs. +if !exists("*s:WrapTag") +function s:WrapTag(text) + if (line(".") < line("'<")) + let insert_cmd = "o" + elseif (col(".") < col("'<")) + let insert_cmd = "a" + else + let insert_cmd = "i" + endif + if strlen(a:text) > 10 + let input_text = strpart(a:text, 0, 10) . '...' + else + let input_text = a:text + endif + let wraptag = inputdialog('Tag to wrap "' . input_text . '" : ') + if strlen(wraptag)==0 + if strlen(b:last_wrap_tag_used)==0 + undo + return + endif + let wraptag = b:last_wrap_tag_used + let atts = b:last_wrap_atts_used + else + let atts = inputdialog('Attributes in <' . wraptag . '> : ') + endif + if (visualmode() ==# 'V') + let text = strpart(a:text,0,strlen(a:text)-1) + if (insert_cmd ==# "o") + let eol_cmd = "" + else + let eol_cmd = "\<Cr>" + endif + else + let text = a:text + let eol_cmd = "" + endif + if strlen(atts)==0 + let text = "<".wraptag.">".text."</".wraptag.">" + let b:last_wrap_tag_used = wraptag + let b:last_wrap_atts_used = "" + else + let text = "<".wraptag." ".atts.">".text."</".wraptag.">" + let b:last_wrap_tag_used = wraptag + let b:last_wrap_atts_used = atts + endif + execute "normal! ".insert_cmd.text.eol_cmd +endfunction +endif + +" NewFileXML -> Inserts <?xml?> at top of new file. {{{1 +if !exists("*s:NewFileXML") +function s:NewFileXML( ) + " Where is g:did_xhtmlcf_inits defined? + if &filetype == 'xml' || (!exists ("g:did_xhtmlcf_inits") && exists ("g:xml_use_xhtml") && (&filetype == 'html' || &filetype == 'xhtml')) + if append (0, '<?xml version="1.0"?>') + normal! G + endif + endif +endfunction +endif + + +" Callback -> Checks for tag callbacks and executes them. {{{1 +if !exists("*s:Callback") +function s:Callback( xml_tag, isHtml ) + let text = 0 + if a:isHtml == 1 && exists ("*HtmlAttribCallback") + let text = HtmlAttribCallback (a:xml_tag) + elseif exists ("*XmlAttribCallback") + let text = XmlAttribCallback (a:xml_tag) + endif + if text != '0' + execute "normal! i " . text ."\<Esc>l" + endif +endfunction +endif + + +" IsParsableTag -> Check to see if the tag is a real tag. {{{1 +if !exists("*s:IsParsableTag") +function s:IsParsableTag( tag ) + " The "Should I parse?" flag. + let parse = 1 + + " make sure a:tag has a proper tag in it and is not a instruction or end tag. + if a:tag !~ '^<[[:alnum:]_:\-].*>$' + let parse = 0 + endif + + " make sure this tag isn't already closed. + if strpart (a:tag, strlen (a:tag) - 2, 1) == '/' + let parse = 0 + endif + + return parse +endfunction +endif + + +" ParseTag -> The major work hourse for tag completion. {{{1 +if !exists("*s:ParseTag") +function s:ParseTag( ) + " Save registers + let old_reg_save = @" + let old_save_x = @x + + if (!exists("g:xml_no_auto_nesting") && strpart (getline ("."), col (".") - 2, 2) == '>>') + let multi_line = 1 + execute "normal! \"xX" + else + let multi_line = 0 + endif + + let @" = "" + execute "normal! \"xy%%" + let ltag = @" + if (&filetype == 'html' || &filetype == 'xhtml') && (!exists ("g:xml_no_html")) + let html_mode = 1 + let ltag = substitute (ltag, '[^[:graph:]]\+', ' ', 'g') + let ltag = substitute (ltag, '<\s*\([^[:alnum:]_:\-[:blank:]]\=\)\s*\([[:alnum:]_:\-]\+\)\>', '<\1\2', '') + else + let html_mode = 0 + endif + + if <SID>IsParsableTag (ltag) + " find the break between tag name and atributes (or closing of tag) + " Too bad I can't just grab the position index of a pattern in a string. + let index = 1 + while index < strlen (ltag) && strpart (ltag, index, 1) =~ '[[:alnum:]_:\-]' + let index = index + 1 + endwhile + + let tag_name = strpart (ltag, 1, index - 1) + if strpart (ltag, index) =~ '[^/>[:blank:]]' + let has_attrib = 1 + else + let has_attrib = 0 + endif + + " That's (index - 1) + 2, 2 for the '</' and 1 for the extra character the + " while includes (the '>' is ignored because <Esc> puts the curser on top + " of the '>' + let index = index + 2 + + " print out the end tag and place the cursor back were it left off + if html_mode && tag_name =~? '^\(img\|input\|param\|frame\|br\|hr\|meta\|link\|base\|area\)$' + if has_attrib == 0 + call <SID>Callback (tag_name, html_mode) + endif + if exists ("g:xml_use_xhtml") + execute "normal! i /\<Esc>l" + endif + else + if multi_line + " Can't use \<Tab> because that indents 'tabstop' not 'shiftwidth' + " Also >> doesn't shift on an empty line hence the temporary char 'x' + let com_save = &comments + set comments-=n:> + execute "normal! a\<Cr>\<Cr>\<Esc>kAx\<Esc>>>$\"xx" + execute "set comments=" . com_save + + " restore registers + let @" = old_reg_save + let @x = old_save_x + + startinsert! + return "" + else + if has_attrib == 0 + call <SID>Callback (tag_name, html_mode) + endif + execute "normal! a</" . tag_name . ">\<Esc>" . index . "h" + endif + endif + endif + + " restore registers + let @" = old_reg_save + let @x = old_save_x + + if col (".") < strlen (getline (".")) + execute "normal! l" + startinsert + else + startinsert! + endif +endfunction +endif + + +" ParseTag2 -> Experimental function to replace ParseTag {{{1 +"if !exists("*s:ParseTag2") +"function s:ParseTag2( ) + " My thought is to pull the tag out and reformat it to a normalized tag + " and put it back. +"endfunction +"endif + + +" BuildTagName -> Grabs the tag's name for tag matching. {{{1 +if !exists("*s:BuildTagName") +function s:BuildTagName( ) + "First check to see if we Are allready on the end of the tag. The / search + "forwards command will jump to the next tag otherwise + + " Store contents of register x in a variable + let b:xreg = @x + + exec "normal! v\"xy" + if @x=='>' + " Don't do anything + else + exec "normal! />/\<Cr>" + endif + + " Now we head back to the < to reach the beginning. + exec "normal! ?<?\<Cr>" + + " Capture the tag (a > will be catured by the /$/ match) + exec "normal! v/\\s\\|$/\<Cr>\"xy" + + " We need to strip off any junk at the end. + let @x=strpart(@x, 0, match(@x, "[[:blank:]>\<C-J>]")) + + "remove <, > + let @x=substitute(@x,'^<\|>$','','') + + " remove spaces. + let @x=substitute(@x,'/\s*','/', '') + let @x=substitute(@x,'^\s*','', '') + + " Swap @x and b:xreg + let temp = @x + let @x = b:xreg + let b:xreg = temp +endfunction +endif + +" TagMatch1 -> First step in tag matching. {{{1 +" Brad Phelan: First step in tag matching. +if !exists("*s:TagMatch1") +function s:TagMatch1() + " Save registers + let old_reg_save = @" + + "Drop a marker here just in case we have a mismatched tag and + "wish to return (:mark looses column position) + normal! mz + + call <SID>BuildTagName() + + "Check to see if it is an end tag. If it is place a 1 in endtag + if match(b:xreg, '^/')==-1 + let endtag = 0 + else + let endtag = 1 + endif + + " Extract the tag from the whole tag block + " eg if the block = + " tag attrib1=blah attrib2=blah + " we will end up with + " tag + " with no trailing or leading spaces + let b:xreg=substitute(b:xreg,'^/','','g') + + " Make sure the tag is valid. + " Malformed tags could be <?xml ?>, <![CDATA[]]>, etc. + if match(b:xreg,'^[[:alnum:]_:\-]') != -1 + " Pass the tag to the matching + " routine + call <SID>TagMatch2(b:xreg, endtag) + endif + " Restore registers + let @" = old_reg_save +endfunction +endif + + +" TagMatch2 -> Second step in tag matching. {{{1 +" Brad Phelan: Second step in tag matching. +if !exists("*s:TagMatch2") +function s:TagMatch2(tag,endtag) + let match_type='' + + " Build the pattern for searching for XML tags based + " on the 'tag' type passed into the function. + " Note we search forwards for end tags and + " backwards for start tags + if a:endtag==0 + "let nextMatch='normal /\(<\s*' . a:tag . '\(\s\+.\{-}\)*>\)\|\(<\/' . a:tag . '\s*>\)' + let match_type = '/' + else + "let nextMatch='normal ?\(<\s*' . a:tag . '\(\s\+.\{-}\)*>\)\|\(<\/' . a:tag . '\s*>\)' + let match_type = '?' + endif + + if a:endtag==0 + let stk = 1 + else + let stk = 1 + end + + " wrapscan must be turned on. We'll recored the value and reset it afterward. + " We have it on because if we don't we'll get a nasty error if the search hits + " BOF or EOF. + let wrapval = &wrapscan + let &wrapscan = 1 + + "Get the current location of the cursor so we can + "detect if we wrap on ourselves + let lpos = line(".") + let cpos = col(".") + + if a:endtag==0 + " If we are trying to find a start tag + " then decrement when we find a start tag + let iter = 1 + else + " If we are trying to find an end tag + " then increment when we find a start tag + let iter = -1 + endif + + "Loop until stk == 0. + while 1 + " exec search. + " Make sure to avoid />$/ as well as /\s$/ and /$/. + exec "normal! " . match_type . '<\s*\/*\s*' . a:tag . '\([[:blank:]>]\|$\)' . "\<Cr>" + + " Check to see if our match makes sence. + if a:endtag == 0 + if line(".") < lpos + call <SID>MisMatchedTag (0, a:tag) + break + elseif line(".") == lpos && col(".") <= cpos + call <SID>MisMatchedTag (1, a:tag) + break + endif + else + if line(".") > lpos + call <SID>MisMatchedTag (2, '/'.a:tag) + break + elseif line(".") == lpos && col(".") >= cpos + call <SID>MisMatchedTag (3, '/'.a:tag) + break + endif + endif + + call <SID>BuildTagName() + + if match(b:xreg,'^/')==-1 + " Found start tag + let stk = stk + iter + else + " Found end tag + let stk = stk - iter + endif + + if stk == 0 + break + endif + endwhile + + let &wrapscan = wrapval +endfunction +endif + +" MisMatchedTag -> What to do if a tag is mismatched. {{{1 +if !exists("*s:MisMatchedTag") +function s:MisMatchedTag( id, tag ) + "Jump back to our formor spot + normal! `z + normal zz + echohl WarningMsg + " For debugging + "echo "Mismatched tag " . a:id . ": <" . a:tag . ">" + " For release + echo "Mismatched tag <" . a:tag . ">" + echohl None +endfunction +endif + +" DeleteTag -> Deletes surrounding tags from cursor. {{{1 +" Modifies mark z +if !exists("*s:DeleteTag") +function s:DeleteTag( ) + if strpart (getline ("."), col (".") - 1, 1) == "<" + normal! l + endif + if search ("<[^\/]", "bW") == 0 + return + endif + normal! mz + normal \5 + normal! d%`zd% +endfunction +endif + +" VisualTag -> Selects Tag body in a visual selection. {{{1 +" Modifies mark z +if !exists("*s:VisualTag") +function s:VisualTag( ) + if strpart (getline ("."), col (".") - 1, 1) == "<" + normal! l + endif + if search ("<[^\/]", "bW") == 0 + return + endif + normal! mz + normal \5 + normal! % + exe "normal! " . visualmode() + normal! `z +endfunction +endif + +" Section: Doc installation {{{1 +" Function: s:SpellInstallDocumentation(full_name, revision) {{{2 +" Install help documentation. +" Arguments: +" full_name: Full name of this vim plugin script, including path name. +" revision: Revision of the vim script. #version# mark in the document file +" will be replaced with this string with 'v' prefix. +" Return: +" 1 if new document installed, 0 otherwise. +" Note: Cleaned and generalized by guo-peng Wen +"''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +function! s:SpellInstallDocumentation(full_name, revision) + " Name of the document path based on the system we use: + if (has("unix")) + " On UNIX like system, using forward slash: + let l:slash_char = '/' + let l:mkdir_cmd = ':silent !mkdir -p ' + else + " On M$ system, use backslash. Also mkdir syntax is different. + " This should only work on W2K and up. + let l:slash_char = '\' + let l:mkdir_cmd = ':silent !mkdir ' + endif + + let l:doc_path = l:slash_char . 'doc' + "let l:doc_home = l:slash_char . '.vim' . l:slash_char . 'doc' + + " Figure out document path based on full name of this script: + let l:vim_plugin_path = fnamemodify(a:full_name, ':h') + "let l:vim_doc_path = fnamemodify(a:full_name, ':h:h') . l:doc_path + let l:vim_doc_path = matchstr(l:vim_plugin_path, + \ '.\{-}\ze\%(\%(ft\)\=plugin\|macros\)') . l:doc_path + if (!(filewritable(l:vim_doc_path) == 2)) + echomsg "Doc path: " . l:vim_doc_path + execute l:mkdir_cmd . l:vim_doc_path + if (!(filewritable(l:vim_doc_path) == 2)) + " Try a default configuration in user home: + "let l:vim_doc_path = expand("~") . l:doc_home + let l:vim_doc_path = matchstr(&rtp, + \ escape($HOME, '\') .'[/\\]\%(\.vim\|vimfiles\)') + if (!(filewritable(l:vim_doc_path) == 2)) + execute l:mkdir_cmd . l:vim_doc_path + if (!(filewritable(l:vim_doc_path) == 2)) + " Put a warning: + echomsg "Unable to open documentation directory" + echomsg " type :help add-local-help for more informations." + return 0 + endif + endif + endif + endif + + " Exit if we have problem to access the document directory: + if (!isdirectory(l:vim_plugin_path) + \ || !isdirectory(l:vim_doc_path) + \ || filewritable(l:vim_doc_path) != 2) + return 0 + endif + + " Full name of script and documentation file: + let l:script_name = 'xml.vim' + let l:doc_name = 'xml-plugin.txt' + let l:plugin_file = l:vim_plugin_path . l:slash_char . l:script_name + let l:doc_file = l:vim_doc_path . l:slash_char . l:doc_name + + " Bail out if document file is still up to date: + if (filereadable(l:doc_file) && + \ getftime(l:plugin_file) < getftime(l:doc_file)) + return 0 + endif + + " Prepare window position restoring command: + if (strlen(@%)) + let l:go_back = 'b ' . bufnr("%") + else + let l:go_back = 'enew!' + endif + + " Create a new buffer & read in the plugin file (me): + setl nomodeline + exe 'enew!' + exe 'r ' . l:plugin_file + + setl modeline + let l:buf = bufnr("%") + setl noswapfile modifiable + + norm zR + norm gg + + " Delete from first line to a line starts with + " === START_DOC + 1,/^=\{3,}\s\+START_DOC\C/ d + + " Delete from a line starts with + " === END_DOC + " to the end of the documents: + /^=\{3,}\s\+END_DOC\C/,$ d + + " Remove fold marks: + % s/{\{3}[1-9]/ / + + " Add modeline for help doc: the modeline string is mangled intentionally + " to avoid it be recognized by VIM: + call append(line('$'), '') + call append(line('$'), ' v' . 'im:tw=78:ts=8:ft=help:norl:') + + " Replace revision: + exe "normal :1,5s/#version#/ v" . a:revision . "/\<CR>" + + " Save the help document: + exe 'w! ' . l:doc_file + exe l:go_back + exe 'bw ' . l:buf + + " Build help tags: + exe 'helptags ' . l:vim_doc_path + + return 1 +endfunction +" }}}2 + +let s:revision= + \ substitute("$Revision: 1.28 $",'\$\S*: \([.0-9]\+\) \$','\1','') +silent! let s:install_status = + \ s:SpellInstallDocumentation(expand('<sfile>:p'), s:revision) +if (s:install_status == 1) + echom expand("<sfile>:t:r") . '-plugin v' . s:revision . + \ ': Help-documentation installed.' +endif + + +" Mappings and Settings. {{{1 +" This makes the '%' jump between the start and end of a single tag. +setlocal matchpairs+=<:> + +" Have this as an escape incase you want a literal '>' not to run the +" ParseTag function. +if !exists("g:xml_tag_completion_map") + inoremap <buffer> <LocalLeader>. > + inoremap <buffer> <LocalLeader>> > +endif + +" Jump between the beggining and end tags. +nnoremap <buffer> <LocalLeader>5 :call <SID>TagMatch1()<Cr> +nnoremap <buffer> <LocalLeader>% :call <SID>TagMatch1()<Cr> +vnoremap <buffer> <LocalLeader>5 <Esc>:call <SID>VisualTag()<Cr> +vnoremap <buffer> <LocalLeader>% <Esc>:call <SID>VisualTag()<Cr> + +" Wrap selection in XML tag +vnoremap <buffer> <LocalLeader>x "xx:call <SID>WrapTag(@x)<Cr> +nnoremap <buffer> <LocalLeader>d :call <SID>DeleteTag()<Cr> + +" Parse the tag after pressing the close '>'. +if !exists("g:xml_tag_completion_map") + inoremap <buffer> > ><Esc>:call <SID>ParseTag()<Cr> +else + execute "inoremap <buffer> " . g:xml_tag_completion_map . " ><Esc>:call <SID>ParseTag()<Cr>" +endif + +augroup xml + au! + au BufNewFile * call <SID>NewFileXML() +augroup END +"}}}1 +finish + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Section: Documentation content {{{1 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +=== START_DOC +*xml-plugin.txt* Help edit XML and SGML documents. #version# + + XML Edit {{{2 ~ + +A filetype plugin to help edit XML and SGML documents. + +This script provides some convenience when editing XML (and some SGML +including HTML) formated documents. It allows you to jump to the beginning +or end of the tag block your cursor is in. '%' will jump between '<' and '>' +within the tag your cursor is in. When in insert mode and you finish a tag +(pressing '>') the tag will be completed. If you press '>' twice it will +complete the tag and place the cursor in the middle of the tags on it's own +line (helps with nested tags). + +Usage: Place this file into your ftplugin directory. To add html support +Sym-link or copy this file to html.vim in your ftplugin directory. To activte +the script place 'filetype plugin on' in your |.vimrc| file. See |ftplugins| +for more information on this topic. + +If the file edited is of type "html" and "xml_use_html" is defined then the +following tags will not auto complete: +<img>, <input>, <param>, <frame>, <br>, <hr>, <meta>, <link>, <base>, <area> + +If the file edited is of type 'html' and 'xml_use_xhtml' is defined the above +tags will autocomplete the xml closing staying xhtml compatable. +ex. <hr> becomes <hr /> (see |xml-plugin-settings|) + +NOTE: If you used the VIM 5.x version of this file (xmledit.vim) you'll need +to comment out the section where you called it. It is no longer used in the +VIM 6.x version. + +Known Bugs {{{2 ~ + +- This script will modify registers ". and "x; register "" will be restored. +- < & > marks inside of a CDATA section are interpreted as actual XML tags + even if unmatched. +- Although the script can handle leading spaces such as < tag></ tag> it is + illegal XML syntax and considered very bad form. +- Placing a literal `>' in an attribute value will auto complete dispite that + the start tag isn't finished. This is poor XML anyway you should use + > instead. +- The matching algorithm can handle illegal tag characters where as the tag + completion algorithm can not. + +------------------------------------------------------------------------------ + *xml-plugin-mappings* +Mappings {{{2 ~ + +<LocalLeader> is a setting in VIM that depicts a prefix for scripts and +plugins to use. By default this is the backslash key `\'. See |mapleader| +for details. + +<LocalLeader>x + Visual - Place a custom XML tag to suround the selected text. You + need to have selected text in visual mode before you can use this + mapping. See |visual-mode| for details. + +<LocalLeader>. or <LocalLeader>> + Insert - Place a literal '>' without parsing tag. + +<LocalLeader>5 or <LocalLeader>% + Normal or Visual - Jump to the begining or end tag. + +<LocalLeader>d + Normal - Deletes the surrounding tags from the cursor. > + <tag1>outter <tag2>inner text</tag2> text</tag1> + ^ +< Turns to: > + outter <tag2>inner text</tag2> text + ^ +< + +------------------------------------------------------------------------------ + *xml-plugin-settings* +Options {{{2 ~ + +(All options must be placed in your |.vimrc| prior to the |ftplugin| +command.) + +xml_tag_completion_map + Use this setting to change the default mapping to auto complete a + tag. By default typing a literal `>' will cause the tag your editing + to auto complete; pressing twice will auto nest the tag. By using + this setting the `>' will be a literal `>' and you must use the new + mapping to perform auto completion and auto nesting. For example if + you wanted Control-L to perform auto completion inmstead of typing a + `>' place the following into your .vimrc: > + let xml_tag_completion_map = "<C-l>" +< +xml_no_auto_nesting + This turns off the auto nesting feature. After a completion is made + and another `>' is typed xml-edit automatically will break the tag + accross multiple lines and indent the curser to make creating nested + tqags easier. This feature turns it off. Enter the following in your + .vimrc: > + let xml_no_auto_nesting = 1 +< +xml_use_xhtml + When editing HTML this will auto close the short tags to make valid + XML like <hr /> and <br />. Enter the following in your vimrc to + turn this option on: > + let xml_use_xhtml = 1 +< +xml_no_html + This turns of the support for HTML specific tags. Place this in your + .vimrc: > + let xml_no_html = 1 +< +------------------------------------------------------------------------------ + *xml-plugin-callbacks* +Callback Functions {{{2 ~ + +A callback function is a function used to customize features on a per tag +basis. For example say you wish to have a default set of attributs when you +type an empty tag like this: + You type: <tag> + You get: <tag default="attributes"></tag> + +This is for any script programmers who wish to add xml-plugin support to +there own filetype plugins. + +Callback functions recive one attribute variable which is the tag name. The +all must return either a string or the number zero. If it returns a string +the plugin will place the string in the proper location. If it is a zero the +plugin will ignore and continue as if no callback existed. + +The following are implemented callback functions: + +HtmlAttribCallback + This is used to add default attributes to html tag. It is intended + for HTML files only. + +XmlAttribCallback + This is a generic callback for xml tags intended to add attributes. + + *xml-plugin-html* +Callback Example {{{2 ~ + +The following is an example of using XmlAttribCallback in your .vimrc +> + function XmlAttribCallback (xml_tag) + if a:xml_tag ==? "my-xml-tag" + return "attributes=\"my xml attributes\"" + else + return 0 + endif + endfunction +< +The following is a sample html.vim file type plugin you could use: +> + " Vim script file vim600:fdm=marker: + " FileType: HTML + " Maintainer: Devin Weaver <vim (at) tritarget.com> + " Location: http://www.vim.org/scripts/script.php?script_id=301 + + " This is a wrapper script to add extra html support to xml documents. + " Original script can be seen in xml-plugin documentation. + + " Only do this when not done yet for this buffer + if exists("b:did_ftplugin") + finish + endif + " Don't set 'b:did_ftplugin = 1' because that is xml.vim's responsability. + + let b:html_mode = 1 + + if !exists("*HtmlAttribCallback") + function HtmlAttribCallback( xml_tag ) + if a:xml_tag ==? "table" + return "cellpadding=\"0\" cellspacing=\"0\" border=\"0\"" + elseif a:xml_tag ==? "link" + return "href=\"/site.css\" rel=\"StyleSheet\" type=\"text/css\"" + elseif a:xml_tag ==? "body" + return "bgcolor=\"white\"" + elseif a:xml_tag ==? "frame" + return "name=\"NAME\" src=\"/\" scrolling=\"auto\" noresize" + elseif a:xml_tag ==? "frameset" + return "rows=\"0,*\" cols=\"*,0\" border=\"0\"" + elseif a:xml_tag ==? "img" + return "src=\"\" width=\"0\" height=\"0\" border=\"0\" alt=\"\"" + elseif a:xml_tag ==? "a" + if has("browse") + " Look up a file to fill the href. Used in local relative file + " links. typeing your own href before closing the tag with `>' + " will override this. + let cwd = getcwd() + let cwd = substitute (cwd, "\\", "/", "g") + let href = browse (0, "Link to href...", getcwd(), "") + let href = substitute (href, cwd . "/", "", "") + let href = substitute (href, " ", "%20", "g") + else + let href = "" + endif + return "href=\"" . href . "\"" + else + return 0 + endif + endfunction + endif + + " On to loading xml.vim + runtime ftplugin/xml.vim +< +=== END_DOC +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" v im:tw=78:ts=8:ft=help:norl: +" vim600: set foldmethod=marker tabstop=8 shiftwidth=2 softtabstop=2 smartindent smarttab : +"fileencoding=iso-8859-15 diff --git a/vimfiles.latex/indent/tex.vim b/vimfiles.latex/indent/tex.vim new file mode 100644 index 0000000..5823dae --- /dev/null +++ b/vimfiles.latex/indent/tex.vim @@ -0,0 +1,139 @@ +" Vim indent file +" Language: LaTeX +" Maintainer: Johannes Tanzler <jtanzler@yline.com> +" Created: Sat, 16 Feb 2002 16:50:19 +0100 +" Last Change: Sun, 17 Feb 2002 00:09:11 +0100 +" Last Update: 18th feb 2002, by LH : +" (*) better support for the option +" (*) use some regex instead of several '||'. +" Version: 0.02 +" URL: comming soon: http://www.unet.univie.ac.at/~a9925098/vim/indent/tex.vim + +" --> If you're a Vim guru & and you find something that could be done in a +" better (perhaps in a more Vim-ish or Vi-ish) way, please let me know! + +" Options: {{{ +" +" To set the following options (ok, currently it's just one), add a line like +" let g:tex_indent_items = 1 +" to your ~/.vimrc. +" +" * g:tex_indent_items +" +" If this variable is set, item-environments are indented like Emacs does +" it, i.e., continuation lines are indented with a shiftwidth. +" +" NOTE: I've already set the variable below; delete the corresponding line +" if you don't like this behaviour. +" +" Per default, it is unset. +" +" set unset +" ---------------------------------------------------------------- +" \begin{itemize} \begin{itemize} +" \item blablabla \item blablabla +" bla bla bla bla bla bla +" \item blablabla \item blablabla +" bla bla bla bla bla bla +" \end{itemize} \end{itemize} +" +" +" This option applies to itemize, description, enumerate, and +" thebibliography. +" +" }}} + +" Delete the next line to avoid the special indention of items +if !exists("g:tex_indent_items") + let g:tex_indent_items = 1 +endif + +if exists("b:did_indent") | finish +endif +let b:did_indent = 1 + + +setlocal indentexpr=GetTeXIndent() +setlocal nolisp +setlocal nosmartindent +setlocal autoindent +setlocal indentkeys+=},=\\item,=\\bibitem + + +" Only define the function once +if exists("*GetTeXIndent") | finish +endif + + + +function GetTeXIndent() + + " Find a non-blank line above the current line. + let lnum = prevnonblank(v:lnum - 1) + + " At the start of the file use zero indent. + if lnum == 0 | return 0 + endif + + let ind = indent(lnum) + let line = getline(lnum) " last line + let cline = getline(v:lnum) " current line + + " Do not change indentation of commented lines. + if line =~ '^\s*%' + return ind + endif + + " Add a 'shiftwidth' after beginning of environments. + " Don't add it for \begin{document} and \begin{verbatim} + ""if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim' + " LH modification : \begin does not always start a line + if line =~ '\\begin{\(.*\)}' && line !~ 'verbatim' + \ && line !~ 'document' + + let ind = ind + &sw + + if g:tex_indent_items == 1 + " Add another sw for item-environments + if line =~ 'itemize\|description\|enumerate\|thebibliography' + let ind = ind + &sw + endif + endif + endif + + + " Subtract a 'shiftwidth' when an environment ends + if cline =~ '^\s*\\end' && cline !~ 'verbatim' + \&& cline !~ 'document' + + if g:tex_indent_items == 1 + " Remove another sw for item-environments + if cline =~ 'itemize\|description\|enumerate\|thebibliography' + let ind = ind - &sw + endif + endif + + let ind = ind - &sw + endif + + + " Special treatment for 'item' + " ---------------------------- + + if g:tex_indent_items == 1 + + " '\item' or '\bibitem' itself: + if cline =~ '^\s*\\\(bib\)\=item' + let ind = ind - &sw + endif + + " lines following to '\item' are intented once again: + if line =~ '^\s*\\\(bib\)\=item' + let ind = ind + &sw + endif + + endif + + return ind +endfunction + diff --git a/vimfiles.latex/ltags b/vimfiles.latex/ltags new file mode 100644 index 0000000..bec7c56 --- /dev/null +++ b/vimfiles.latex/ltags @@ -0,0 +1,78 @@ +#!/usr/bin/perl +# Author: Dimitri Antoniou <dimitri@risc2.aecom.yu.edu> +# usage: ltags filename +# handles: \label and \cite{ } with one or more arguments +# fails if arguments of cite spread over more than one line +# also searches in files that are \include or \input in the main file + +# get main LaTeX source file from command line: +$mainfile = shift; + +# get names of included files and store them in an array +open MAIN, $mainfile or die "$!" ; +@mainfile=<MAIN>; +@allsrcfiles = map{ /^\\(?:input|include){(.*?)}/ } @mainfile; +unshift @allsrcfiles, $mainfile; + +# loop over all source files +for $srcfile (@allsrcfiles) { + # if \input{fname} append .tex to fname + unless ( $srcfile =~ m/\.tex/ ) { $srcfile = $srcfile . "\.tex" } + open SRC, $srcfile or die "$!" ; + # store contents of source file in array @texfile + @texfile=<SRC>; + + # store lines with \label and \cite (or \citeonline) in arrays + @labelList = grep{ /\\label{/ } @texfile; + @citeList = grep{ /\\(cite|citeonline){/ } @texfile; + + # see if we use an external database; if yes, store its name in $bibfile + ($dbase) = grep{ /^\\bibliography{/ } @texfile; + if ($dbase) { + $dbase =~ m/\\bibliography{(.*?)}/; + $bibfile = $1; + } + + # write \bibitem in tags file + @mrefs=(); + @refs=(); + @multirefs=(); + foreach (@citeList) { + while ( m/\\(?:cite|citeonline){(.*?)}/g ) { + $refs = $1; + # if \cite has more than one argument, split them: + if ($refs =~ /,/) { + @mrefs = split /,/, $refs; + # there might be more than one \cite in a line: + push (@multirefs, @mrefs); + } + else { + @refs = ($refs); + push (@multirefs, @refs); + } + } + # in BibTeX, format is @ARTICLE{Name, }; in source file, \bibitem{Name} + for $ref (@multirefs) { + if ( $dbase ) { + push @unsorttag, "$ref\t$bibfile\t/{$ref,/\n" + } + else { + push @unsorttag, "$ref\t$srcfile\t/bibitem{$ref}/\n" + } + } + } + + # write \label in tag file + foreach (@labelList) { + m/\\label{(.*?)}/; + push @unsorttag, "$1\t$srcfile\t/label{$1}/\n"; + } +} + +# sort tag file; then, eliminate duplicates +@sortedtag = sort @unsorttag; +%seen = (); +@uniqtag = grep { ! $seen{$_} ++ } @sortedtag; + +open(TAGS, "> tags"); +print TAGS @uniqtag; diff --git a/vimfiles.latex/plugin/SyntaxFolds.vim b/vimfiles.latex/plugin/SyntaxFolds.vim new file mode 100644 index 0000000..27c622c --- /dev/null +++ b/vimfiles.latex/plugin/SyntaxFolds.vim @@ -0,0 +1,323 @@ +" ============================================================================== +" File: syntaxFolds.vim +" Author: Srinath Avadhanula +" ( srinath@fastmail.fm ) +" Last Change: Sun Oct 27 01:00 AM 2002 PST +" Description: Emulation of the syntax folding capability of vim using manual +" folding +" +" This script provides an emulation of the syntax folding of vim using manual +" folding. Just as in syntax folding, the folds are defined by regions. Each +" region is specified by a call to FoldRegions() which accepts 4 parameters: +" +" call FoldRegions(startpat, endpat, startoff, endoff) +" +" startpat: a line matching this pattern defines the beginning of a fold. +" endpat : a line matching this pattern defines the end of a fold. +" startoff: this is the offset from the starting line at which folding will +" actually start +" endoff : like startoff, but gives the offset of the actual fold end from +" the line satisfying endpat. +" startoff and endoff are necessary when the folding region does +" not have a specific end pattern corresponding to a start +" pattern. for example in latex, +" \begin{section} +" defines the beginning of a section, but its not necessary to +" have a corresponding +" \end{section} +" the section is assumed to end 1 line _before_ another section +" starts. +" startskip: a pattern which defines the beginning of a "skipped" region. +" +" For example, suppose we define a \itemize fold as follows: +" startpat = '^\s*\\item', +" endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', +" startoff = 0, +" endoff = -1 +" +" This defines a fold which starts with a line beginning with an +" \item and ending one line before a line beginning with an +" \item or \end{enumerate} etc. +" +" Then, as long as \item's are not nested things are fine. +" However, once items begin to nest, the fold started by one +" \item can end because of an \item in an \itemize +" environment within this \item. i.e, the following can happen: +" +" \begin{itemize} +" \item Some text <------- fold will start here +" This item will contain a nested item +" \begin{itemize} <----- fold will end here because next line contains \item... +" \item Hello +" \end{itemize} <----- ... instead of here. +" \item Next item of the parent itemize +" \end{itemize} +" +" Therefore, in order to completely define a folding item which +" allows nesting, we need to also define a "skip" pattern. +" startskip and end skip do that. +" Leave '' when there is no nesting. +" endskip: the pattern which defines the end of the "skip" pattern for +" nested folds. +" +" Example: +" 1. A syntax fold region for a latex section is +" startpat = "\\section{" +" endpat = "\\section{" +" startoff = 0 +" endoff = -1 +" startskip = '' +" endskip = '' +" Note that the start and end patterns are thus the same and endoff has a +" negative value to capture the effect of a section ending one line before +" the next starts. +" 2. A syntax fold region for the \itemize environment is: +" startpat = '^\s*\\item', +" endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', +" startoff = 0, +" endoff = -1, +" startskip = '^\s*\\begin{\(enumerate\|itemize\|description\)}', +" endskip = '^\s*\\end{\(enumerate\|itemize\|description\)}' +" Note the use of startskip and endskip to allow nesting. +" +" +" Each time a call is made to FoldRegions(), all the regions (which might be +" disjoint, but not nested) are folded up. +" Nested folds can be created by successive calls to FoldRegions(). The first +" call defines the region which is deepest in the folding. See MakeTexFolds() +" for an idea of how this works for latex files. + +" Function: AddSyntaxFoldItem (start, end, startoff, endoff [, skipStart, skipEnd]) {{{ +function! AddSyntaxFoldItem(start, end, startoff, endoff, ...) + if a:0 > 0 + let skipStart = a:1 + let skipEnd = a:2 + else + let skipStart = '' + let skipEnd = '' + end + if !exists('b:numFoldItems') + let b:numFoldItems = 0 + end + let b:numFoldItems = b:numFoldItems + 1 + + exe 'let b:startPat_'.b:numFoldItems.' = a:start' + exe 'let b:endPat_'.b:numFoldItems.' = a:end' + exe 'let b:startOff_'.b:numFoldItems.' = a:startoff' + exe 'let b:endOff_'.b:numFoldItems.' = a:endoff' + exe 'let b:skipStartPat_'.b:numFoldItems.' = skipStart' + exe 'let b:skipEndPat_'.b:numFoldItems.' = skipEnd' +endfunction + + +" }}} +" Function: MakeSyntaxFolds (force) {{{ +" Description: This function calls FoldRegions() several times with the +" parameters specifying various regions resulting in a nested fold +" structure for the file. +function! MakeSyntaxFolds(force, ...) + if exists('b:doneFolding') && a:force == 0 + return + end + + let skipEndPattern = '' + if a:0 > 0 + let line1 = a:1 + let skipEndPattern = '\|'.a:2 + else + let line1 = 1 + let r = line('.') + let c = virtcol('.') + + setlocal fdm=manual + normal! zE + end + if !exists('b:numFoldItems') + b:numFoldItems = 1000000 + end + + let i = 1 + + let maxline = line('.') + + while exists('b:startPat_'.i) && i <= b:numFoldItems + exe 'let startPat = b:startPat_'.i + exe 'let endPat = b:endPat_'.i + exe 'let startOff = b:startOff_'.i + exe 'let endOff = b:endOff_'.i + + let skipStart = '' + let skipEnd = '' + if exists('b:skipStartPat_'.i) + exe 'let skipStart = b:skipStartPat_'.i + exe 'let skipEnd = b:skipEndPat_'.i + end + exe line1 + let lastLoc = line1 + + if skipStart != '' + call InitStack('BeginSkipArray') + call FoldRegionsWithSkip(startPat, endPat, startOff, endOff, skipStart, skipEnd, 1, line('$')) + " call PrintError('done folding ['.startPat.']') + else + call FoldRegionsWithNoSkip(startPat, endPat, startOff, endOff, 1, line('$'), '') + end + + let i = i + 1 + endwhile + + exe maxline + + if a:0 == 0 + exe r + exe "normal! ".c."|" + if foldlevel(r) > 1 + exe "normal! ".(foldlevel(r) - 1)."zo" + end + let b:doneFolding = 0 + end +endfunction + + +" }}} +" FoldRegionsWithSkip: folding things such as \item's which can be nested. {{{ +function! FoldRegionsWithSkip(startpat, endpat, startoff, endoff, startskip, endskip, line1, line2) + exe a:line1 + " count the regions which have been skipped as we go along. do not want to + " create a fold which with a beginning or end line in one of the skipped + " regions. + let skippedRegions = '' + + " start searching for either the starting pattern or the end pattern. + while search(a:startskip.'\|'.a:endskip, 'W') + + if getline('.') =~ a:endskip + + let lastBegin = Pop('BeginSkipArray') + " call PrintError('popping '.lastBegin.' from stack and folding till '.line('.')) + call FoldRegionsWithNoSkip(a:startpat, a:endpat, a:startoff, a:endoff, lastBegin, line('.'), skippedRegions) + let skippedRegions = skippedRegions.lastBegin.','.line('.').'|' + + + " if this is the beginning of a skip region, then, push this line as + " the beginning of a skipped region. + elseif getline('.') =~ a:startskip + + " call PrintError('pushing '.line('.').' ['.getline('.').'] into stack') + call Push('BeginSkipArray', line('.')) + + end + endwhile + + " call PrintError('with skip starting at '.a:line1.' returning at line# '.line('.')) +endfunction + +" }}} +" FoldRegionsWithNoSkip: folding things such as \sections which do not nest. {{{ +function! FoldRegionsWithNoSkip(startpat, endpat, startoff, endoff, line1, line2, skippedRegions) + exe a:line1 + + " call PrintError('line1 = '.a:line1.', searching from '.line('.').'... for ['.a:startpat.'') + let lineBegin = s:MySearch(a:startpat, 'in') + " call PrintError('... and finding it at '.lineBegin) + + while lineBegin <= a:line2 + if IsInSkippedRegion(lineBegin, a:skippedRegions) + let lineBegin = s:MySearch(a:startpat, 'out') + " call PrintError(lineBegin.' is being skipped') + continue + end + let lineEnd = s:MySearch(a:endpat, 'out') + while IsInSkippedRegion(lineEnd, a:skippedRegions) && lineEnd <= a:line2 + let lineEnd = s:MySearch(a:endpat, 'out') + endwhile + if lineEnd > a:line2 + exe (lineBegin + a:startoff).','.a:line2.' fold' + break + else + " call PrintError ('for ['.a:startpat.'] '.(lineBegin + a:startoff).','.(lineEnd + a:endoff).' fold') + exe (lineBegin + a:startoff).','.(lineEnd + a:endoff).' fold' + end + + " call PrintError('line1 = '.a:line1.', searching from '.line('.').'... for ['.a:startpat.'') + let lineBegin = s:MySearch(a:startpat, 'in') + " call PrintError('... and finding it at '.lineBegin) + endwhile + + exe a:line2 + return +endfunction + +" }}} +" InitStack: initialize a stack {{{ +function! InitStack(name) + exe 'let s:'.a:name.'_numElems = 0' +endfunction +" }}} +" Push: push element into stack {{{ +function! Push(name, elem) + exe 'let numElems = s:'.a:name.'_numElems' + let numElems = numElems + 1 + exe 'let s:'.a:name.'_Element_'.numElems.' = a:elem' + exe 'let s:'.a:name.'_numElems = numElems' +endfunction +" }}} +" Pop: pops element off stack {{{ +function! Pop(name) + exe 'let numElems = s:'.a:name.'_numElems' + if numElems == 0 + return '' + else + exe 'let ret = s:'.a:name.'_Element_'.numElems + let numElems = numElems - 1 + exe 'let s:'.a:name.'_numElems = numElems' + return ret + end +endfunction +" }}} +" MySearch: just like search(), but returns large number on failure {{{ +function! <SID>MySearch(pat, opt) + if a:opt == 'in' + if getline('.') =~ a:pat + let ret = line('.') + else + let ret = search(a:pat, 'W') + end + else + normal! $ + let ret = search(a:pat, 'W') + end + + if ret == 0 + let ret = line('$') + 1 + end + return ret +endfunction +" }}} +" Function: IsInSkippedRegion (lnum, regions) {{{ +" Description: finds whether a given line number is within one of the regions +" skipped. +function! IsInSkippedRegion(lnum, regions) + let i = 1 + let subset = s:Strntok(a:regions, '|', i) + while subset != '' + let n1 = s:Strntok(subset, ',', 1) + let n2 = s:Strntok(subset, ',', 2) + if a:lnum >= n1 && a:lnum <= n2 + return 1 + end + + let subset = s:Strntok(a:regions, '|', i) + let i = i + 1 + endwhile + + return 0 +endfunction " }}} +" Function: Strntok (string, tok, n) {{{ +" extract the n^th token from s seperated by tok. +" example: Strntok('1,23,3', ',', 2) = 23 +fun! <SID>Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun " }}} + +" vim600:fdm=marker diff --git a/vimfiles.latex/plugin/filebrowser.vim b/vimfiles.latex/plugin/filebrowser.vim new file mode 100644 index 0000000..e9de049 --- /dev/null +++ b/vimfiles.latex/plugin/filebrowser.vim @@ -0,0 +1,251 @@ +" filebrowser.vim: utility file for vim 6.2+ +" +" Copyright: Srinath Avadhanula <srinath AT fastmail DOT fm> +" Parts of this file are taken from explorer.vim which is a plugin file +" distributed with vim under the Vim charityware license. +" License: distributed under the Vim charityware license. +" +" Settings: +" FB_CallBackFunction: the function name which gets called when the user +" presses <cr> on a file-name in the file browser. +" FB_AllowRegexp: A filename has to match this regexp to be displayed. +" FB_RejectRegexp: If a filename matches this regexp, then its not displayed. +" (Both these regexps are '' by default which means no filtering is +" done). + +" line continuation used here. +let s:save_cpo = &cpo +set cpo&vim + +"====================================================================== +" Globally visible functions (API) +"====================================================================== +" FB_OpenFileBrowser: opens a new buffer and displays the file list {{{ +" Description: +function! FB_OpenFileBrowser(dir) + if !isdirectory(a:dir) + return + endif + if exists('s:FB_BufferNumber') + if bufwinnr(s:FB_BufferNumber) != -1 + execute bufwinnr(s:FB_BufferNumber).' wincmd w' + return + endif + execute 'aboveleft split #'.s:FB_BufferNumber + else + aboveleft split __Choose_File__ + let s:FB_BufferNumber = bufnr('%') + endif + call FB_DisplayFiles(a:dir) +endfunction " }}} +" FB_DisplayFiles: displays the files in a given directory {{{ +" Description: +" Call this function only when the cursor is in a temporary buffer +function! FB_DisplayFiles(dir) + if !isdirectory(a:dir) + return + endif + call s:FB_SetSilentSettings() + " make this a "scratch" buffer + call s:FB_SetScratchSettings() + + let allowRegexp = s:FB_GetVar('FB_AllowRegexp', '') + let rejectRegexp = s:FB_GetVar('FB_RejectRegexp', '') + + " change to the directory to make processing simpler. + execute "lcd ".a:dir + " delete everything in the buffer. + " IMPORTANT: we need to be in a scratch buffer + 0,$ d_ + + let allFilenames = glob('*') + let dispFiles = "" + let subDirs = "../\n" + + let i = 1 + while 1 + let filename = s:FB_Strntok(allFilenames, "\n", i) + if filename == '' + break + endif + if isdirectory(filename) + let subDirs = subDirs.filename."/\n" + else + if allowRegexp != '' && filename !~ allowRegexp + elseif rejectRegexp != '' && filename =~ rejectRegexp + else + let dispFiles = dispFiles.filename."\n" + endif + endif + let i = i + 1 + endwhile + 0put!=dispFiles + 0put!=subDirs + " delte the last empty line resulting from the put + $ d_ + + call s:FB_SetHighlighting() + call s:FB_DisplayHelp() + call s:FB_SetMaps() + + " goto the first file/directory + 0 + call search('^"=', 'w') + normal! j:<bs> + + set nomodified nomodifiable + + call s:FB_ResetSilentSettings() +endfunction " }}} +" FB_SetVar: sets script local variables from outside this script {{{ +" Description: +function! FB_SetVar(varname, value) + let s:{a:varname} = a:value +endfunction " }}} + +" FB_SetHighlighting: sets syntax highlighting for the buffer {{{ +" Description: +" Origin: from explorer.vim in vim +function! <SID>FB_SetHighlighting() + " Set up syntax highlighting + " Something wrong with the evaluation of the conditional though... + if has("syntax") && exists("g:syntax_on") && !has("syntax_items") + syn match browseSynopsis "^\"[ -].*" + syn match browseDirectory "[^\"].*/ " + syn match browseDirectory "[^\"].*/$" + syn match browseCurDir "^\"= .*$" + syn match browseSortBy "^\" Sorted by .*$" contains=browseSuffixInfo + syn match browseSuffixInfo "(.*)$" contained + syn match browseFilter "^\" Not Showing:.*$" + syn match browseFiletime "�\d\+$" + + "hi def link browseSynopsis PreProc + hi def link browseSynopsis Special + hi def link browseDirectory Directory + hi def link browseCurDir Statement + hi def link browseSortBy String + hi def link browseSuffixInfo Type + hi def link browseFilter String + hi def link browseFiletime Ignore + hi def link browseSuffixes Type + endif +endfunction " }}} +" FB_SetMaps: sets buffer local maps {{{ +" Description: +function! <SID>FB_SetMaps() + nnoremap <buffer> <silent> q :bdelete<cr> + nnoremap <buffer> <silent> C :call FB_DisplayFiles(getcwd())<CR> + nnoremap <buffer> <silent> <esc> :bdelete<cr> + nnoremap <buffer> <silent> <CR> :call <SID>FB_EditEntry()<CR> + nnoremap <buffer> <silent> ? :call <SID>FB_ToggleHelp()<CR> + + " lock the user in this window + nnoremap <buffer> <C-w> <nop> +endfunction " }}} +" FB_SetSilentSettings: some settings which make things silent {{{ +" Description: +" Origin: from explorer.vim distributed with vim. +function! <SID>FB_SetSilentSettings() + let s:save_report=&report + let s:save_showcmd = &sc + set report=10000 noshowcmd +endfunction +" FB_ResetSilentSettings: reset settings set by FB_SetSilentSettings +" Description: +function! <SID>FB_ResetSilentSettings() + let &report=s:save_report + let &showcmd = s:save_showcmd +endfunction " }}} +" FB_SetScratchSettings: makes the present buffer a scratch buffer {{{ +" Description: +function! <SID>FB_SetScratchSettings() + " Turn off the swapfile, set the buffer type so that it won't get + " written, and so that it will get deleted when it gets hidden. + setlocal noreadonly modifiable + setlocal noswapfile + setlocal buftype=nowrite + setlocal bufhidden=delete + " Don't wrap around long lines + setlocal nowrap +endfunction + +" }}} +" FB_ToggleHelp: toggles verbosity of help {{{ +" Description: +function! <SID>FB_ToggleHelp() + let s:FB_VerboseHelp = 1 - s:FB_GetVar('FB_VerboseHelp', 0) + + call FB_DisplayFiles('.') +endfunction " }}} +" FB_DisplayHelp: displays a helpful header {{{ +" Description: +function! <SID>FB_DisplayHelp() + let verboseHelp = s:FB_GetVar('FB_VerboseHelp', 0) + if verboseHelp + let txt = + \ "\" <cr>: on file, choose the file and quit\n" + \ ."\" on dir, enter directory\n" + \ ."\" q/<esc>: quit without choosing\n" + \ ."\" C: change directory to getcwd()\n" + \ ."\" ?: toggle help verbosity\n" + \ ."\"= ".getcwd() + else + let txt = "\" ?: toggle help verbosity\n" + \ ."\"= ".getcwd() + endif + 0put!=txt +endfunction " }}} + +" Handles various actions in the file-browser +" FB_EditEntry: handles the user pressing <enter> on a line {{{ +" Description: +function! <SID>FB_EditEntry() + let line = getline('.') + + if isdirectory(line) + call FB_DisplayFiles(line) + endif + + " If the user has a call back function defined on choosing a file, handle + " it. + let cbf = s:FB_GetVar('FB_CallBackFunction', '') + if cbf != '' && line !~ '^" ' && filereadable(line) + let fname = fnamemodify(line, ':p') + bdelete + + let arguments = s:FB_GetVar('FB_CallBackFunctionArgs', '') + if arguments != '' + let arguments = ','.arguments + endif + call Tex_Debug('arguments = '.arguments, 'fb') + call Tex_Debug("call ".cbf."('".fname."'".arguments.')', 'fb') + exec "call ".cbf."('".fname."'".arguments.')' + endif +endfunction " }}} + +" FB_Strntok (string, tok, n) {{{ +" extract the n^th token from s seperated by tok. +" example: FB_Strntok('1,23,3', ',', 2) = 23 +fun! <SID>FB_Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun " }}} +" FB_GetVar: gets the most local value of a variable {{{ +function! <SID>FB_GetVar(name, default) + if exists('s:'.a:name) + return s:{a:name} + elseif exists('w:'.a:name) + return w:{a:name} + elseif exists('b:'.a:name) + return b:{a:name} + elseif exists('g:'.a:name) + return g:{a:name} + else + return a:default + endif +endfunction + +" }}} + +let &cpo = s:save_cpo + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap diff --git a/vimfiles.latex/plugin/imaps.vim b/vimfiles.latex/plugin/imaps.vim new file mode 100644 index 0000000..d871aa1 --- /dev/null +++ b/vimfiles.latex/plugin/imaps.vim @@ -0,0 +1,831 @@ +" File: imaps.vim +" Authors: Srinath Avadhanula <srinath AT fastmail.fm> +" Benji Fisher <benji AT member.AMS.org> +" +" WWW: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/vimfiles/plugin/imaps.vim?only_with_tag=MAIN +" +" Description: insert mode template expander with cursor placement +" while preserving filetype indentation. +" +" $Id: imaps.vim 997 2006-03-20 09:45:45Z srinathava $ +" +" Documentation: {{{ +" +" Motivation: +" this script provides a way to generate insert mode mappings which do not +" suffer from some of the problem of mappings and abbreviations while allowing +" cursor placement after the expansion. It can alternatively be thought of as +" a template expander. +" +" Consider an example. If you do +" +" imap lhs something +" +" then a mapping is set up. However, there will be the following problems: +" 1. the 'ttimeout' option will generally limit how easily you can type the +" lhs. if you type the left hand side too slowly, then the mapping will not +" be activated. +" 2. if you mistype one of the letters of the lhs, then the mapping is +" deactivated as soon as you backspace to correct the mistake. +" +" If, in order to take care of the above problems, you do instead +" +" iab lhs something +" +" then the timeout problem is solved and so is the problem of mistyping. +" however, abbreviations are only expanded after typing a non-word character. +" which causes problems of cursor placement after the expansion and invariably +" spurious spaces are inserted. +" +" Usage Example: +" this script attempts to solve all these problems by providing an emulation +" of imaps wchich does not suffer from its attendant problems. Because maps +" are activated without having to press additional characters, therefore +" cursor placement is possible. furthermore, file-type specific indentation is +" preserved, because the rhs is expanded as if the rhs is typed in literally +" by the user. +" +" The script already provides some default mappings. each "mapping" is of the +" form: +" +" call IMAP (lhs, rhs, ft) +" +" Some characters in the RHS have special meaning which help in cursor +" placement. +" +" Example One: +" +" call IMAP ("bit`", "\\begin{itemize}\<cr>\\item <++>\<cr>\\end{itemize}<++>", "tex") +" +" This effectively sets up the map for "bit`" whenever you edit a latex file. +" When you type in this sequence of letters, the following text is inserted: +" +" \begin{itemize} +" \item * +" \end{itemize}<++> +" +" where * shows the cursor position. The cursor position after inserting the +" text is decided by the position of the first "place-holder". Place holders +" are special characters which decide cursor placement and movement. In the +" example above, the place holder characters are <+ and +>. After you have typed +" in the item, press <C-j> and you will be taken to the next set of <++>'s. +" Therefore by placing the <++> characters appropriately, you can minimize the +" use of movement keys. +" +" NOTE: Set g:Imap_UsePlaceHolders to 0 to disable placeholders altogether. +" Set +" g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd +" to something else if you want different place holder characters. +" Also, b:Imap_PlaceHolderStart and b:Imap_PlaceHolderEnd override the values +" of g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd respectively. This is +" useful for setting buffer specific place hoders. +" +" Example Two: +" You can use the <C-r> command to insert dynamic elements such as dates. +" call IMAP ('date`', "\<c-r>=strftime('%b %d %Y')\<cr>", '') +" +" sets up the map for date` to insert the current date. +" +"--------------------------------------%<-------------------------------------- +" Bonus: This script also provides a command Snip which puts tearoff strings, +" '----%<----' above and below the visually selected range of lines. The +" length of the string is chosen to be equal to the longest line in the range. +" Recommended Usage: +" '<,'>Snip +"--------------------------------------%<-------------------------------------- +" }}} + +" line continuation used here. +let s:save_cpo = &cpo +set cpo&vim + +" ============================================================================== +" Script Options / Variables +" ============================================================================== +" Options {{{ +if !exists('g:Imap_StickyPlaceHolders') + let g:Imap_StickyPlaceHolders = 1 +endif +if !exists('g:Imap_DeleteEmptyPlaceHolders') + let g:Imap_DeleteEmptyPlaceHolders = 1 +endif +" }}} +" Variables {{{ +" s:LHS_{ft}_{char} will be generated automatically. It will look like +" s:LHS_tex_o = 'fo\|foo\|boo' and contain all mapped sequences ending in "o". +" s:Map_{ft}_{lhs} will be generated automatically. It will look like +" s:Map_c_foo = 'for(<++>; <++>; <++>)', the mapping for "foo". +" +" }}} + +" ============================================================================== +" functions for easy insert mode mappings. +" ============================================================================== +" IMAP: Adds a "fake" insert mode mapping. {{{ +" For example, doing +" IMAP('abc', 'def' ft) +" will mean that if the letters abc are pressed in insert mode, then +" they will be replaced by def. If ft != '', then the "mapping" will be +" specific to the files of type ft. +" +" Using IMAP has a few advantages over simply doing: +" imap abc def +" 1. with imap, if you begin typing abc, the cursor will not advance and +" long as there is a possible completion, the letters a, b, c will be +" displayed on on top of the other. using this function avoids that. +" 2. with imap, if a backspace or arrow key is pressed before completing +" the word, then the mapping is lost. this function allows movement. +" (this ofcourse means that this function is only limited to +" left-hand-sides which do not have movement keys or unprintable +" characters) +" It works by only mapping the last character of the left-hand side. +" when this character is typed in, then a reverse lookup is done and if +" the previous characters consititute the left hand side of the mapping, +" the previously typed characters and erased and the right hand side is +" inserted + +" IMAP: set up a filetype specific mapping. +" Description: +" "maps" the lhs to rhs in files of type 'ft'. If supplied with 2 +" additional arguments, then those are assumed to be the placeholder +" characters in rhs. If unspecified, then the placeholder characters +" are assumed to be '<+' and '+>' These placeholder characters in +" a:rhs are replaced with the users setting of +" [bg]:Imap_PlaceHolderStart and [bg]:Imap_PlaceHolderEnd settings. +" +function! IMAP(lhs, rhs, ft, ...) + + " Find the place holders to save for IMAP_PutTextWithMovement() . + if a:0 < 2 + let phs = '<+' + let phe = '+>' + else + let phs = a:1 + let phe = a:2 + endif + + let hash = s:Hash(a:lhs) + let s:Map_{a:ft}_{hash} = a:rhs + let s:phs_{a:ft}_{hash} = phs + let s:phe_{a:ft}_{hash} = phe + + " Add a:lhs to the list of left-hand sides that end with lastLHSChar: + let lastLHSChar = a:lhs[strlen(a:lhs)-1] + let hash = s:Hash(lastLHSChar) + if !exists("s:LHS_" . a:ft . "_" . hash) + let s:LHS_{a:ft}_{hash} = escape(a:lhs, '\') + else + let s:LHS_{a:ft}_{hash} = escape(a:lhs, '\') .'\|'. s:LHS_{a:ft}_{hash} + endif + + " map only the last character of the left-hand side. + if lastLHSChar == ' ' + let lastLHSChar = '<space>' + end + exe 'inoremap <silent>' + \ escape(lastLHSChar, '|') + \ '<C-r>=<SID>LookupCharacter("' . + \ escape(lastLHSChar, '\|"') . + \ '")<CR>' +endfunction + +" }}} +" IMAP_list: list the rhs and place holders corresponding to a:lhs {{{ +" +" Added mainly for debugging purposes, but maybe worth keeping. +function! IMAP_list(lhs) + let char = a:lhs[strlen(a:lhs)-1] + let charHash = s:Hash(char) + if exists("s:LHS_" . &ft ."_". charHash) && a:lhs =~ s:LHS_{&ft}_{charHash} + let ft = &ft + elseif exists("s:LHS__" . charHash) && a:lhs =~ s:LHS__{charHash} + let ft = "" + else + return "" + endif + let hash = s:Hash(a:lhs) + return "rhs = " . s:Map_{ft}_{hash} . " place holders = " . + \ s:phs_{ft}_{hash} . " and " . s:phe_{ft}_{hash} +endfunction +" }}} +" LookupCharacter: inserts mapping corresponding to this character {{{ +" +" This function extracts from s:LHS_{&ft}_{a:char} or s:LHS__{a:char} +" the longest lhs matching the current text. Then it replaces lhs with the +" corresponding rhs saved in s:Map_{ft}_{lhs} . +" The place-holder variables are passed to IMAP_PutTextWithMovement() . +function! s:LookupCharacter(char) + if IMAP_GetVal('Imap_FreezeImap', 0) == 1 + return a:char + endif + let charHash = s:Hash(a:char) + + " The line so far, including the character that triggered this function: + let text = strpart(getline("."), 0, col(".")-1) . a:char + " Prefer a local map to a global one, even if the local map is shorter. + " Is this what we want? Do we care? + " Use '\V' (very no-magic) so that only '\' is special, and it was already + " escaped when building up s:LHS_{&ft}_{charHash} . + if exists("s:LHS_" . &ft . "_" . charHash) + \ && text =~ "\\C\\V\\(" . s:LHS_{&ft}_{charHash} . "\\)\\$" + let ft = &ft + elseif exists("s:LHS__" . charHash) + \ && text =~ "\\C\\V\\(" . s:LHS__{charHash} . "\\)\\$" + let ft = "" + else + " If this is a character which could have been used to trigger an + " abbreviation, check if an abbreviation exists. + if a:char !~ '\k' + let lastword = matchstr(getline('.'), '\k\+$', '') + call IMAP_Debug('getting lastword = ['.lastword.']', 'imap') + if lastword != '' + " An extremeley wierd way to get around the fact that vim + " doesn't have the equivalent of the :mapcheck() function for + " abbreviations. + let _a = @a + exec "redir @a | silent! iab ".lastword." | redir END" + let abbreviationRHS = matchstr(@a."\n", "\n".'i\s\+'.lastword.'\s\+@\?\zs.*\ze'."\n") + + call IMAP_Debug('getting abbreviationRHS = ['.abbreviationRHS.']', 'imap') + + if @a =~ "No abbreviation found" || abbreviationRHS == "" + let @a = _a + return a:char + endif + + let @a = _a + let abbreviationRHS = escape(abbreviationRHS, '\<"') + exec 'let abbreviationRHS = "'.abbreviationRHS.'"' + + let lhs = lastword.a:char + let rhs = abbreviationRHS.a:char + let phs = IMAP_GetPlaceHolderStart() + let phe = IMAP_GetPlaceHolderEnd() + else + return a:char + endif + else + return a:char + endif + endif + " Find the longest left-hand side that matches the line so far. + " matchstr() returns the match that starts first. This automatically + " ensures that the longest LHS is used for the mapping. + if !exists('lhs') || !exists('rhs') + let lhs = matchstr(text, "\\C\\V\\(" . s:LHS_{ft}_{charHash} . "\\)\\$") + let hash = s:Hash(lhs) + let rhs = s:Map_{ft}_{hash} + let phs = s:phs_{ft}_{hash} + let phe = s:phe_{ft}_{hash} + endif + + if strlen(lhs) == 0 + return a:char + endif + " enough back-spaces to erase the left-hand side; -1 for the last + " character typed: + let bs = substitute(strpart(lhs, 1), ".", "\<bs>", "g") + return bs . IMAP_PutTextWithMovement(rhs, phs, phe) +endfunction + +" }}} +" IMAP_PutTextWithMovement: returns the string with movement appended {{{ +" Description: +" If a:str contains "placeholders", then appends movement commands to +" str in a way that the user moves to the first placeholder and enters +" insert or select mode. If supplied with 2 additional arguments, then +" they are assumed to be the placeholder specs. Otherwise, they are +" assumed to be '<+' and '+>'. These placeholder chars are replaced +" with the users settings of [bg]:Imap_PlaceHolderStart and +" [bg]:Imap_PlaceHolderEnd. +function! IMAP_PutTextWithMovement(str, ...) + + " The placeholders used in the particular input string. These can be + " different from what the user wants to use. + if a:0 < 2 + let phs = '<+' + let phe = '+>' + else + let phs = escape(a:1, '\') + let phe = escape(a:2, '\') + endif + + let text = a:str + + " The user's placeholder settings. + let phsUser = IMAP_GetPlaceHolderStart() + let pheUser = IMAP_GetPlaceHolderEnd() + + " Problem: depending on the setting of the 'encoding' option, a character + " such as "\xab" may not match itself. We try to get around this by + " changing the encoding of all our strings. At the end, we have to + " convert text back. + let phsEnc = s:Iconv(phs, "encode") + let pheEnc = s:Iconv(phe, "encode") + let phsUserEnc = s:Iconv(phsUser, "encode") + let pheUserEnc = s:Iconv(pheUser, "encode") + let textEnc = s:Iconv(text, "encode") + if textEnc != text + let textEncoded = 1 + else + let textEncoded = 0 + endif + + let pattern = '\V\(\.\{-}\)' .phs. '\(\.\{-}\)' .phe. '\(\.\*\)' + " If there are no placeholders, just return the text. + if textEnc !~ pattern + call IMAP_Debug('Not getting '.phs.' and '.phe.' in '.textEnc, 'imap') + return text + endif + " Break text up into "initial <+template+> final"; any piece may be empty. + let initialEnc = substitute(textEnc, pattern, '\1', '') + let templateEnc = substitute(textEnc, pattern, '\2', '') + let finalEnc = substitute(textEnc, pattern, '\3', '') + + " If the user does not want to use placeholders, then remove all but the + " first placeholder. + " Otherwise, replace all occurences of the placeholders here with the + " user's choice of placeholder settings. + if exists('g:Imap_UsePlaceHolders') && !g:Imap_UsePlaceHolders + let finalEnc = substitute(finalEnc, '\V'.phs.'\.\{-}'.phe, '', 'g') + else + let finalEnc = substitute(finalEnc, '\V'.phs.'\(\.\{-}\)'.phe, + \ phsUserEnc.'\1'.pheUserEnc, 'g') + endif + + " The substitutions are done, so convert back, if necessary. + if textEncoded + let initial = s:Iconv(initialEnc, "decode") + let template = s:Iconv(templateEnc, "decode") + let final = s:Iconv(finalEnc, "decode") + else + let initial = initialEnc + let template = templateEnc + let final = finalEnc + endif + + " Build up the text to insert: + " 1. the initial text plus an extra character; + " 2. go to Normal mode with <C-\><C-N>, so it works even if 'insertmode' + " is set, and mark the position; + " 3. replace the extra character with tamplate and final; + " 4. back to Normal mode and restore the cursor position; + " 5. call IMAP_Jumpfunc(). + let template = phsUser . template . pheUser + " Old trick: insert and delete a character to get the same behavior at + " start, middle, or end of line and on empty lines. + let text = initial . "X\<C-\>\<C-N>:call IMAP_Mark('set')\<CR>\"_s" + let text = text . template . final + let text = text . "\<C-\>\<C-N>:call IMAP_Mark('go')\<CR>" + let text = text . "i\<C-r>=IMAP_Jumpfunc('', 1)\<CR>" + + call IMAP_Debug('IMAP_PutTextWithMovement: text = ['.text.']', 'imap') + return text +endfunction + +" }}} +" IMAP_Jumpfunc: takes user to next <+place-holder+> {{{ +" Author: Luc Hermitte +" Arguments: +" direction: flag for the search() function. If set to '', search forwards, +" if 'b', then search backwards. See the {flags} argument of the +" |search()| function for valid values. +" inclusive: In vim, the search() function is 'exclusive', i.e we always goto +" next cursor match even if there is a match starting from the +" current cursor position. Setting this argument to 1 makes +" IMAP_Jumpfunc() also respect a match at the current cursor +" position. 'inclusive'ness is necessary for IMAP() because a +" placeholder string can occur at the very beginning of a map which +" we want to select. +" We use a non-zero value only in special conditions. Most mappings +" should use a zero value. +function! IMAP_Jumpfunc(direction, inclusive) + + " The user's placeholder settings. + let phsUser = IMAP_GetPlaceHolderStart() + let pheUser = IMAP_GetPlaceHolderEnd() + + let searchString = '' + " If this is not an inclusive search or if it is inclusive, but the + " current cursor position does not contain a placeholder character, then + " search for the placeholder characters. + if !a:inclusive || strpart(getline('.'), col('.')-1) !~ '\V\^'.phsUser + let searchString = '\V'.phsUser.'\_.\{-}'.pheUser + endif + + " If we didn't find any placeholders return quietly. + if searchString != '' && !search(searchString, a:direction) + return '' + endif + + " Open any closed folds and make this part of the text visible. + silent! foldopen! + + " Calculate if we have an empty placeholder or if it contains some + " description. + let template = + \ matchstr(strpart(getline('.'), col('.')-1), + \ '\V\^'.phsUser.'\zs\.\{-}\ze\('.pheUser.'\|\$\)') + let placeHolderEmpty = !strlen(template) + + " If we are selecting in exclusive mode, then we need to move one step to + " the right + let extramove = '' + if &selection == 'exclusive' + let extramove = 'l' + endif + + " Select till the end placeholder character. + let movement = "\<C-o>v/\\V".pheUser."/e\<CR>".extramove + + " First remember what the search pattern was. s:RemoveLastHistoryItem will + " reset @/ to this pattern so we do not create new highlighting. + let g:Tex_LastSearchPattern = @/ + + " Now either goto insert mode or select mode. + if placeHolderEmpty && g:Imap_DeleteEmptyPlaceHolders + " delete the empty placeholder into the blackhole. + return movement."\"_c\<C-o>:".s:RemoveLastHistoryItem."\<CR>" + else + return movement."\<C-\>\<C-N>:".s:RemoveLastHistoryItem."\<CR>gv\<C-g>" + endif + +endfunction + +" }}} +" Maps for IMAP_Jumpfunc {{{ +" +" These mappings use <Plug> and thus provide for easy user customization. When +" the user wants to map some other key to jump forward, he can do for +" instance: +" nmap ,f <plug>IMAP_JumpForward +" etc. + +" jumping forward and back in insert mode. +imap <silent> <Plug>IMAP_JumpForward <c-r>=IMAP_Jumpfunc('', 0)<CR> +imap <silent> <Plug>IMAP_JumpBack <c-r>=IMAP_Jumpfunc('b', 0)<CR> + +" jumping in normal mode +nmap <silent> <Plug>IMAP_JumpForward i<c-r>=IMAP_Jumpfunc('', 0)<CR> +nmap <silent> <Plug>IMAP_JumpBack i<c-r>=IMAP_Jumpfunc('b', 0)<CR> + +" deleting the present selection and then jumping forward. +vmap <silent> <Plug>IMAP_DeleteAndJumpForward "_<Del>i<c-r>=IMAP_Jumpfunc('', 0)<CR> +vmap <silent> <Plug>IMAP_DeleteAndJumpBack "_<Del>i<c-r>=IMAP_Jumpfunc('b', 0)<CR> + +" jumping forward without deleting present selection. +vmap <silent> <Plug>IMAP_JumpForward <C-\><C-N>i<c-r>=IMAP_Jumpfunc('', 0)<CR> +vmap <silent> <Plug>IMAP_JumpBack <C-\><C-N>`<i<c-r>=IMAP_Jumpfunc('b', 0)<CR> + +" }}} +" Default maps for IMAP_Jumpfunc {{{ +" map only if there is no mapping already. allows for user customization. +" NOTE: Default mappings for jumping to the previous placeholder are not +" provided. It is assumed that if the user will create such mappings +" hself if e so desires. +if !hasmapto('<Plug>IMAP_JumpForward', 'i') + imap <C-J> <Plug>IMAP_JumpForward +endif +if !hasmapto('<Plug>IMAP_JumpForward', 'n') + nmap <C-J> <Plug>IMAP_JumpForward +endif +if exists('g:Imap_StickyPlaceHolders') && g:Imap_StickyPlaceHolders + if !hasmapto('<Plug>IMAP_JumpForward', 'v') + vmap <C-J> <Plug>IMAP_JumpForward + endif +else + if !hasmapto('<Plug>IMAP_DeleteAndJumpForward', 'v') + vmap <C-J> <Plug>IMAP_DeleteAndJumpForward + endif +endif +" }}} + +nmap <silent> <script> <plug><+SelectRegion+> `<v`> + +" ============================================================================== +" enclosing selected region. +" ============================================================================== +" VEnclose: encloses the visually selected region with given arguments {{{ +" Description: allows for differing action based on visual line wise +" selection or visual characterwise selection. preserves the +" marks and search history. +function! VEnclose(vstart, vend, VStart, VEnd) + + " its characterwise if + " 1. characterwise selection and valid values for vstart and vend. + " OR + " 2. linewise selection and invalid values for VStart and VEnd + if (visualmode() == 'v' && (a:vstart != '' || a:vend != '')) || (a:VStart == '' && a:VEnd == '') + + let newline = "" + let _r = @r + + let normcmd = "normal! \<C-\>\<C-n>`<v`>\"_s" + + exe "normal! \<C-\>\<C-n>`<v`>\"ry" + if @r =~ "\n$" + let newline = "\n" + let @r = substitute(@r, "\n$", '', '') + endif + + " In exclusive selection, we need to select an extra character. + if &selection == 'exclusive' + let movement = 8 + else + let movement = 7 + endif + let normcmd = normcmd. + \ a:vstart."!!mark!!".a:vend.newline. + \ "\<C-\>\<C-N>?!!mark!!\<CR>v".movement."l\"_s\<C-r>r\<C-\>\<C-n>" + + " this little if statement is because till very recently, vim used to + " report col("'>") > length of selected line when `> is $. on some + " systems it reports a -ve number. + if col("'>") < 0 || col("'>") > strlen(getline("'>")) + let lastcol = strlen(getline("'>")) + else + let lastcol = col("'>") + endif + if lastcol - col("'<") != 0 + let len = lastcol - col("'<") + else + let len = '' + endif + + " the next normal! is for restoring the marks. + let normcmd = normcmd."`<v".len."l\<C-\>\<C-N>" + + " First remember what the search pattern was. s:RemoveLastHistoryItem + " will reset @/ to this pattern so we do not create new highlighting. + let g:Tex_LastSearchPattern = @/ + + silent! exe normcmd + " this is to restore the r register. + let @r = _r + " and finally, this is to restore the search history. + execute s:RemoveLastHistoryItem + + else + + exec 'normal! `<O'.a:VStart."\<C-\>\<C-n>" + exec 'normal! `>o'.a:VEnd."\<C-\>\<C-n>" + if &indentexpr != '' + silent! normal! `<kV`>j= + endif + silent! normal! `> + endif +endfunction + +" }}} +" ExecMap: adds the ability to correct an normal/visual mode mapping. {{{ +" Author: Hari Krishna Dara <hari_vim@yahoo.com> +" Reads a normal mode mapping at the command line and executes it with the +" given prefix. Press <BS> to correct and <Esc> to cancel. +function! ExecMap(prefix, mode) + " Temporarily remove the mapping, otherwise it will interfere with the + " mapcheck call below: + let myMap = maparg(a:prefix, a:mode) + exec a:mode."unmap ".a:prefix + + " Generate a line with spaces to clear the previous message. + let i = 1 + let clearLine = "\r" + while i < &columns + let clearLine = clearLine . ' ' + let i = i + 1 + endwhile + + let mapCmd = a:prefix + let foundMap = 0 + let breakLoop = 0 + echon "\rEnter Map: " . mapCmd + while !breakLoop + let char = getchar() + if char !~ '^\d\+$' + if char == "\<BS>" + let mapCmd = strpart(mapCmd, 0, strlen(mapCmd) - 1) + endif + else " It is the ascii code. + let char = nr2char(char) + if char == "\<Esc>" + let breakLoop = 1 + else + let mapCmd = mapCmd . char + if maparg(mapCmd, a:mode) != "" + let foundMap = 1 + let breakLoop = 1 + elseif mapcheck(mapCmd, a:mode) == "" + let mapCmd = strpart(mapCmd, 0, strlen(mapCmd) - 1) + endif + endif + endif + echon clearLine + echon "\rEnter Map: " . mapCmd + endwhile + if foundMap + if a:mode == 'v' + " use a plug to select the region instead of using something like + " `<v`> to avoid problems caused by some of the characters in + " '`<v`>' being mapped. + let gotoc = "\<plug><+SelectRegion+>" + else + let gotoc = '' + endif + exec "normal ".gotoc.mapCmd + endif + exec a:mode.'noremap '.a:prefix.' '.myMap +endfunction + +" }}} + +" ============================================================================== +" helper functions +" ============================================================================== +" Strntok: extract the n^th token from a list {{{ +" example: Strntok('1,23,3', ',', 2) = 23 +fun! <SID>Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun + +" }}} +" s:RemoveLastHistoryItem: removes last search item from search history {{{ +" Description: Execute this string to clean up the search history. +let s:RemoveLastHistoryItem = ':call histdel("/", -1)|let @/=g:Tex_LastSearchPattern' + +" }}} +" s:Hash: Return a version of a string that can be used as part of a variable" {{{ +" name. +" Converts every non alphanumeric character into _{ascii}_ where {ascii} is +" the ASCII code for that character... +fun! s:Hash(text) + return substitute(a:text, '\([^[:alnum:]]\)', + \ '\="_".char2nr(submatch(1))."_"', 'g') +endfun +"" }}} +" IMAP_GetPlaceHolderStart and IMAP_GetPlaceHolderEnd: "{{{ +" return the buffer local placeholder variables, or the global one, or the default. +function! IMAP_GetPlaceHolderStart() + if exists("b:Imap_PlaceHolderStart") && strlen(b:Imap_PlaceHolderEnd) + return b:Imap_PlaceHolderStart + elseif exists("g:Imap_PlaceHolderStart") && strlen(g:Imap_PlaceHolderEnd) + return g:Imap_PlaceHolderStart + else + return "<+" +endfun +function! IMAP_GetPlaceHolderEnd() + if exists("b:Imap_PlaceHolderEnd") && strlen(b:Imap_PlaceHolderEnd) + return b:Imap_PlaceHolderEnd + elseif exists("g:Imap_PlaceHolderEnd") && strlen(g:Imap_PlaceHolderEnd) + return g:Imap_PlaceHolderEnd + else + return "+>" +endfun +" }}} +" s:Iconv: a wrapper for iconv()" {{{ +" Problem: after +" let text = "\xab" +" (or using the raw 8-bit ASCII character in a file with 'fenc' set to +" "latin1") if 'encoding' is set to utf-8, then text does not match itself: +" echo text =~ text +" returns 0. +" Solution: When this happens, a re-encoded version of text does match text: +" echo iconv(text, "latin1", "utf8") =~ text +" returns 1. In this case, convert text to utf-8 with iconv(). +" TODO: Is it better to use &encoding instead of "utf8"? Internally, vim +" uses utf-8, and can convert between latin1 and utf-8 even when compiled with +" -iconv, so let's try using utf-8. +" Arguments: +" a:text = text to be encoded or decoded +" a:mode = "encode" (latin1 to utf8) or "decode" (utf8 to latin1) +" Caution: do not encode and then decode without checking whether the text +" has changed, becuase of the :if clause in encoding! +function! s:Iconv(text, mode) + if a:mode == "decode" + return iconv(a:text, "utf8", "latin1") + endif + if a:text =~ '\V\^' . escape(a:text, '\') . '\$' + return a:text + endif + let textEnc = iconv(a:text, "latin1", "utf8") + if textEnc !~ '\V\^' . escape(a:text, '\') . '\$' + call IMAP_Debug('Encoding problems with text '.a:text.' ', 'imap') + endif + return textEnc +endfun +"" }}} +" IMAP_Debug: interface to Tex_Debug if available, otherwise emulate it {{{ +" Description: +" Do not want a memory leak! Set this to zero so that imaps always +" starts out in a non-debugging mode. +if !exists('g:Imap_Debug') + let g:Imap_Debug = 0 +endif +function! IMAP_Debug(string, pattern) + if !g:Imap_Debug + return + endif + if exists('*Tex_Debug') + call Tex_Debug(a:string, a:pattern) + else + if !exists('s:debug_'.a:pattern) + let s:debug_{a:pattern} = a:string + else + let s:debug_{a:pattern} = s:debug_{a:pattern}.a:string + endif + endif +endfunction " }}} +" IMAP_DebugClear: interface to Tex_DebugClear if avaialable, otherwise emulate it {{{ +" Description: +function! IMAP_DebugClear(pattern) + if exists('*Tex_DebugClear') + call Tex_DebugClear(a:pattern) + else + let s:debug_{a:pattern} = '' + endif +endfunction " }}} +" IMAP_PrintDebug: interface to Tex_DebugPrint if avaialable, otherwise emulate it {{{ +" Description: +function! IMAP_PrintDebug(pattern) + if exists('*Tex_PrintDebug') + call Tex_PrintDebug(a:pattern) + else + if exists('s:debug_'.a:pattern) + echo s:debug_{a:pattern} + endif + endif +endfunction " }}} +" IMAP_Mark: Save the cursor position (if a:action == 'set') in a" {{{ +" script-local variable; restore this position if a:action == 'go'. +let s:Mark = "(0,0)" +let s:initBlanks = '' +function! IMAP_Mark(action) + if a:action == 'set' + let s:Mark = "(" . line(".") . "," . col(".") . ")" + let s:initBlanks = matchstr(getline('.'), '^\s*') + elseif a:action == 'go' + execute "call cursor" s:Mark + let blanksNow = matchstr(getline('.'), '^\s*') + if strlen(blanksNow) > strlen(s:initBlanks) + execute 'silent! normal! '.(strlen(blanksNow) - strlen(s:initBlanks)).'l' + elseif strlen(blanksNow) < strlen(s:initBlanks) + execute 'silent! normal! '.(strlen(s:initBlanks) - strlen(blanksNow)).'h' + endif + endif +endfunction "" }}} +" IMAP_GetVal: gets the value of a variable {{{ +" Description: first checks window local, then buffer local etc. +function! IMAP_GetVal(name, ...) + if a:0 > 0 + let default = a:1 + else + let default = '' + endif + if exists('w:'.a:name) + return w:{a:name} + elseif exists('b:'.a:name) + return b:{a:name} + elseif exists('g:'.a:name) + return g:{a:name} + else + return default + endif +endfunction " }}} + +" ============================================================================== +" A bonus function: Snip() +" ============================================================================== +" Snip: puts a scissor string above and below block of text {{{ +" Desciption: +"-------------------------------------%<------------------------------------- +" this puts a the string "--------%<---------" above and below the visually +" selected block of lines. the length of the 'tearoff' string depends on the +" maximum string length in the selected range. this is an aesthetically more +" pleasing alternative instead of hardcoding a length. +"-------------------------------------%<------------------------------------- +function! <SID>Snip() range + let i = a:firstline + let maxlen = -2 + " find out the maximum virtual length of each line. + while i <= a:lastline + exe i + let length = virtcol('$') + let maxlen = (length > maxlen ? length : maxlen) + let i = i + 1 + endwhile + let maxlen = (maxlen > &tw && &tw != 0 ? &tw : maxlen) + let half = maxlen/2 + exe a:lastline + " put a string below + exe "norm! o\<esc>".(half - 1)."a-\<esc>A%<\<esc>".(half - 1)."a-" + " and above. its necessary to put the string below the block of lines + " first because that way the first line number doesnt change... + exe a:firstline + exe "norm! O\<esc>".(half - 1)."a-\<esc>A%<\<esc>".(half - 1)."a-" +endfunction + +com! -nargs=0 -range Snip :<line1>,<line2>call <SID>Snip() +" }}} + +let &cpo = s:save_cpo + +" vim:ft=vim:ts=4:sw=4:noet:fdm=marker:commentstring=\"\ %s:nowrap diff --git a/vimfiles.latex/plugin/libList.vim b/vimfiles.latex/plugin/libList.vim new file mode 100644 index 0000000..7d72c3e --- /dev/null +++ b/vimfiles.latex/plugin/libList.vim @@ -0,0 +1,249 @@ +" File: libList.vim +" Last Change: 2001 Dec 10 +" Maintainer: Gontran BAERTS <gbcreation@free.fr> +" Version: 0.1 +" +" Please don't hesitate to correct my english :) +" Send corrections to <gbcreation@free.fr> +" +"----------------------------------------------------------------------------- +" Description: libList.vim is a set of functions to work with lists or one +" level arrays. +" +"----------------------------------------------------------------------------- +" To Enable: Normally, this file will reside in your plugins directory and be +" automatically sourced. +" +"----------------------------------------------------------------------------- +" Usage: Lists are strings variable with values separated by g:listSep +" character (comma" by default). You may redefine g:listSep variable as you +" wish. +" +" Here are available functions : +" +" - AddListItem( array, newItem, index ) : +" Add item "newItem" to array "array" at "index" position +" - GetListItem( array, index ) : +" Return item at "index" position in array "array" +" - GetListMatchItem( array, pattern ) : +" Return item matching "pattern" in array "array" +" - GetListCount( array ) : +" Return the number of items in array "array" +" - RemoveListItem( array, index ) : +" Remove item at "index" position from array "array" +" - ReplaceListItem( array, index, item ) : +" Remove item at "index" position by "item" in array "array" +" - ExchangeListItems( array, item1Index, item2Index ) : +" Exchange item "item1Index" with item "item2Index" in array "array" +" - QuickSortList( array, beg, end ) : +" Return array "array" with items between "beg" and "end" sorted +" +" Example: +" let mylist="" +" echo GetListCount( mylist ) " --> 0 +" let mylist = AddListItem( mylist, "One", 0 ) " mylist == "One" +" let mylist = AddListItem( mylist, "Three", 1 ) " mylist == "One,Three" +" let mylist = AddListItem( mylist, "Two", 1 ) " mylist == "One,Two,Three" +" echo GetListCount( mylist ) " --> 3 +" echo GetListItem( mylist, 2 ) " --> Three +" echo GetListMatchItem( mylist, "w" ) " --> two +" echo GetListMatchItem( mylist, "e" ) " --> One +" let mylist = RemoveListItem( mylist, 2 ) " mylist == "One,Two" +" echo GetListCount( mylist ) " --> 2 +" let mylist = ReplaceListItem( mylist, 0, "Three" ) " mylist == "Three,Two" +" let mylist = ExchangeListItems( mylist, 0, 1 ) " mylist == "Two,Three" +" let mylist = AddListItem( mylist, "One", 0 ) " mylist == "One,Two,Three" +" let mylist = QuickSortList( mylist, 0, GetListCount(mylist)-1 ) +" " mylist == "One,Three,Two" +" +"----------------------------------------------------------------------------- +" Updates: +" in version 0.1 +" - First version + +" Has this already been loaded ? +if exists("loaded_libList") + finish +endif +let loaded_libList=1 + +"** +" Separator: +" You may change the separator character et any time. +"** +let g:listSep = "," + +"** +"AddListItem: +" Add new item at given position. +" First item index is 0 (zero). +"Parameters: +" - array : Array/List (string of values) which receives the new item. +" - newItem : String containing the item value to add. +" - index : Integer indicating the position at which the new item is added. +" It must be greater than or equals to 0 (zero). +"Return: +"String containing array values, including newItem. +"** +function AddListItem( array, newItem, index ) + if a:index == 0 + if a:array == "" + return a:newItem + endif + return a:newItem . g:listSep . a:array + endif + return substitute( a:array, '\(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}', '\0' . g:listSep . a:newItem , "" ) +endfunction + +"** +"GetListItem: +" Get item at given position. +"Parameters: +" - array : Array/List (string of values). +" - index : Integer indicating the position of item to return. +" It must be greater than or equals to 0 (zero). +"Return: +"String representing the item. +"** +function GetListItem( array, index ) + if a:index == 0 + return matchstr( a:array, '^[^' . g:listSep . ']\+' ) + else + return matchstr( a:array, "[^" . g:listSep . "]\\+", matchend( a:array, '\(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}' . g:listSep ) ) + endif +endfunction + +"** +"GetListMatchItem: +" Get the first item matching given pattern. +"Parameters: +" - array : Array/List (string of values). +" - pattern : Regular expression to match with items. +" Avoid to use ^, $ and listSep characters in pattern, unless you +" know what you do. +"Return: +"String representing the first item that matches the pattern. +"** +function GetListMatchItem( array, pattern ) + return matchstr( a:array, '[^' . g:listSep . ']*' . a:pattern . '[^' . g:listSep . ']*' ) +endfunction + +"** +"ReplaceListItem: +" Replace item at given position by a new one. +"Parameters: +" - array : Array/List (string of values). +" - index : Integer indicating the position of item to replace. +" It must be greater than or equals to 0 (zero). +" - item : String containing the new value of the replaced item. +"Return: +"String containing array values. +"** +function ReplaceListItem( array, index, item ) + if a:index == 0 + return substitute( a:array, '^[^' .g:listSep. ']\+', a:item, "" ) + else + return substitute( a:array, '\(\%(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}\)' . g:listSep . '[^' . g:listSep . ']\+', '\1' . g:listSep . a:item , "" ) + endif +endfunction + +"** +"RemoveListItem: +" Remove item at given position. +"Parameters: +" - array : Array/List (string of values) from which remove an item. +" - index : Integer indicating the position of item to remove. +" It must be greater than or equals to 0 (zero). +"Return: +"String containing array values, except the removed one. +"** +function RemoveListItem( array, index ) + if a:index == 0 + return substitute( a:array, '^[^' .g:listSep. ']\+\(' . g:listSep . '\|$\)', "", "" ) + else + return substitute( a:array, '\(\%(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}\)' . g:listSep . '[^' . g:listSep . ']\+', '\1', "" ) + endif +endfunction + +"** +"ExchangeListItems: +" Exchange item at position item1Index with item at position item2Index. +"Parameters: +" - array : Array/List (string of values). +" - item1index : Integer indicating the position of the first item to exchange. +" It must be greater than or equals to 0 (zero). +" - item2index : Integer indicating the position of the second item to +" exchange. It must be greater than or equals to 0 (zero). +"Return: +"String containing array values. +"** +function ExchangeListItems( array, item1Index, item2Index ) + let item1 = GetListItem( a:array, a:item1Index ) + let array = ReplaceListItem( a:array, a:item1Index, GetListItem( a:array, a:item2Index ) ) + return ReplaceListItem( array, a:item2Index, item1 ) +endfunction + +"** +"GetListCount: +" Number of items in array. +"Parameters: +" - array : Array/List (string of values). +"Return: +"Integer representing the number of items in array. +"Index of last item is GetListCount(array)-1. +"** +function GetListCount( array ) + if a:array == "" | return 0 | endif + let pos = 0 + let cnt = 0 + while pos != -1 + let pos = matchend( a:array, g:listSep, pos ) + let cnt = cnt + 1 + endwhile + return cnt +endfunction + +"** +"QuickSortList: +" Sort array. +"Parameters: +" - array : Array/List (string of values). +" - beg : Min index of the range of items to sort. +" - end : Max index of the range of items to sort. +"Return: +"String containing array values with indicated range of items sorted. +"** +function QuickSortList( array, beg, end ) + let array = a:array + let pivot = GetListItem( array, a:beg ) + let l = a:beg + let r = a:end + while l < r + while GetListItem( array, r ) > pivot + let r = r - 1 + endwhile + if l != r + let array = ReplaceListItem( array, l, GetListItem( array, r ) ) + let array = ReplaceListItem( array, r, pivot ) + let l = l + 1 + endif + + while GetListItem( array, l ) < pivot + let l = l + 1 + endwhile + if l != r + let array = ReplaceListItem( array, r, GetListItem( array, l ) ) + let array = ReplaceListItem( array, l, pivot ) + let r = r - 1 + endif + endwhile + if a:beg < l-1 + let array = QuickSortList( array, a:beg, l-1 ) + endif + if a:end > l+1 + let array = QuickSortList( array, l+1, a:end ) + endif + return array +endfunction + + diff --git a/vimfiles.latex/plugin/remoteOpen.vim b/vimfiles.latex/plugin/remoteOpen.vim new file mode 100644 index 0000000..cb550ff --- /dev/null +++ b/vimfiles.latex/plugin/remoteOpen.vim @@ -0,0 +1,163 @@ +" File: remoteOpen.vim +" Author: Srinath Avadhanula <srinath AT fastmail DOT fm> +" $Id: remoteOpen.vim 997 2006-03-20 09:45:45Z srinathava $ +" +" Description: +" Often times, an external program needs to open a file in gvim from the +" command line. However, it will not know if the file is already opened in a +" previous vim session. It is not sufficient to simply specify +" +" gvim --remote-silent <filename> +" +" because this simply opens up <filename> in the first remote gvim session it +" sees. This script provides a command RemoteOpen which is meant to be used +" from the command line as follows: +" +" gvim -c ":RemoteOpen +<lnum> <filename>" +" +" where <lnum> is the line-number you wish <filename> to open to. What will +" happen is that a new gvim will start up and enquire from all previous +" sessions if <filename> is already open in any of them. If it is, then it +" will edit the file in that session and bring it to the foreground and itself +" quit. Otherwise, it will not quit and instead open up the file for editing +" at <lnum>. +" +" This was mainly created to be used with Yap (the dvi previewer in miktex), +" so you can specify the program for "inverse search" as specified above. +" This ensures that the inverse search uses the correct gvim each time. +" +" Ofcourse, this requires vim with +clientserver. If not, then RemoteOpen just +" opens in the present session. + +" Enclose <args> in single quotes so it can be passed as a function argument. +com -nargs=1 RemoteOpen :call RemoteOpen('<args>') +com -nargs=? RemoteInsert :call RemoteInsert('<args>') + +" RemoteOpen: open a file remotely (if possible) {{{ +" Description: checks all open vim windows to see if this file has been opened +" anywhere and if so, opens it there instead of in this session. +function! RemoteOpen(arglist) + + " First construct line number and filename from argument. a:arglist is of + " the form: + " +10 c:\path\to\file + " or just + " c:\path\to\file + if a:arglist =~ '^\s*+\d\+' + let linenum = matchstr(a:arglist, '^\s*+\zs\d\+\ze') + let filename = matchstr(a:arglist, '^\s*+\d\+\s*\zs.*\ze') + else + let linenum = 1 + let filename = matchstr(a:arglist, '^\s*\zs.*\ze') + endif + let filename = escape(filename, ' ') + call Tex_Debug("linenum = ".linenum.', filename = '.filename, "ropen") + + " If there is no clientserver functionality, then just open in the present + " session and return + if !has('clientserver') + call Tex_Debug("-clientserver, opening locally and returning", "ropen") + exec "e ".filename + exec linenum + normal! zv + return + endif + + " Otherwise, loop through all available servers + let servers = serverlist() + " If there are no servers, open file locally. + if servers == '' + call Tex_Debug("no open servers, opening locally", "ropen") + exec "e ".filename + exec linenum + let g:Remote_Server = 1 + normal! zv + return + endif + + let i = 1 + let server = s:Strntok(servers, "\n", i) + let targetServer = v:servername + + while server != '' + " Find out if there was any server which was used by remoteOpen before + " this. If a new gvim session was ever started via remoteOpen, then + " g:Remote_Server will be set. + if remote_expr(server, 'exists("g:Remote_Server")') + let targetServer = server + endif + + " Ask each server if that file is being edited by them. + let bufnum = remote_expr(server, "bufnr('".filename."')") + " If it is... + if bufnum != -1 + " ask the server to edit that file and come to the foreground. + " set a variable g:Remote_Server to indicate that this server + " session has at least one file opened via RemoteOpen + let targetServer = server + break + end + + let i = i + 1 + let server = s:Strntok(servers, "\n", i) + endwhile + + " If none of the servers have the file open, then open this file in the + " first server. This has the advantage if yap tries to make vim open + " multiple vims, then at least they will all be opened by the same gvim + " server. + call remote_send(targetServer, + \ "\<C-\>\<C-n>". + \ ":let g:Remote_Server = 1\<CR>". + \ ":drop ".filename."\<CR>". + \ ":".linenum."\<CR>zv" + \ ) + call remote_foreground(targetServer) + " quit this vim session + if v:servername != targetServer + q + endif +endfunction " }}} +" RemoteInsert: inserts a \cite'ation remotely (if possible) {{{ +" Description: +function! RemoteInsert(...) + + let citation = matchstr(argv(0), "\\[InsText('.cite{\\zs.\\{-}\\ze}');\\]") + if citation == "" + q + endif + + " Otherwise, loop through all available servers + let servers = serverlist() + + let i = 1 + let server = s:Strntok(servers, "\n", i) + let targetServer = v:servername + + while server != '' + if remote_expr(server, 'exists("g:Remote_WaitingForCite")') + call remote_send(server, citation . "\<CR>") + call remote_foreground(server) + if v:servername != server + q + else + return + endif + endif + + let i = i + 1 + let server = s:Strntok(servers, "\n", i) + endwhile + + q + +endfunction " }}} +" Strntok: extract the n^th token from a list {{{ +" example: Strntok('1,23,3', ',', 2) = 23 +fun! <SID>Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun + +" }}} + +" vim:ft=vim:ts=4:sw=4:noet:fdm=marker:commentstring=\"\ %s:nowrap diff --git a/vimfiles.stefan/_vimrc.example b/vimfiles.stefan/_vimrc.example new file mode 100644 index 0000000..fe5a7d7 --- /dev/null +++ b/vimfiles.stefan/_vimrc.example @@ -0,0 +1,14 @@ +set nocompatible +" Verzeichnis, die dem die vimfiles-Verzeichnisse liegen: +let g:vimsuite = expand($VIM . '/vimsuite') +"let g:vimsuite = expand($VIM . '/vimfiles.current') + +" Verzeichnis, in dem die vimfiles von Stefan liegen +let g:vimfiles = expand(g:vimsuite . '/vimfiles.stefan') + +" Einstellungen laden +execute 'source ' . expand(g:vimfiles . '/vimrc') + +" Falls weitere Einstellungen geladen werden sollen, so kann dies hier +" geschehen +" source ... diff --git a/vimfiles.stefan/colors/Carsten.vim b/vimfiles.stefan/colors/Carsten.vim new file mode 100644 index 0000000..ae7d30c --- /dev/null +++ b/vimfiles.stefan/colors/Carsten.vim @@ -0,0 +1,57 @@ +" local syntax file - set colors on a per-machine basis: +" vim: tw=0 ts=4 sw=4 +" Vim color file +" Maintainer: Ron Aaron <ronaharon@yahoo.com> +" Last Change: 2003 May 02 + +set background=light +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name = "Carsten" + +hi Comment term=bold ctermfg=darkgreen guifg=darkgreen +hi Normal guifg=black guibg=white +hi Constant term=underline ctermfg=Magenta guifg=Magenta +hi Special term=bold ctermfg=Magenta guifg=Magenta +hi Identifier term=underline ctermfg=Blue guifg=Blue +hi Statement term=bold ctermfg=DarkRed gui=NONE guifg=Brown +hi PreProc term=underline ctermfg=Magenta guifg=Purple +hi Type term=underline ctermfg=blue gui=NONE guifg=blue +hi Visual term=reverse ctermfg=Yellow ctermbg=Red gui=NONE guifg=Black guibg=Yellow +hi Search term=reverse ctermfg=Black ctermbg=Cyan gui=NONE guifg=Black guibg=Cyan +hi Tag term=bold ctermfg=DarkGreen guifg=DarkGreen +hi Error term=reverse ctermfg=15 ctermbg=9 guibg=Red guifg=White +hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow +hi NonText term=bold ctermfg=black guifg=#C7C7C7 +hi StatusLine term=bold,reverse cterm=NONE ctermfg=Yellow ctermbg=DarkGray gui=NONE guifg=Yellow guibg=DarkGray +hi! link MoreMsg Comment +hi! link ErrorMsg Visual +hi! link WarningMsg ErrorMsg +hi! link Question Comment +hi! link SpecialKey NonText +hi link String Constant +hi link Character Constant +hi link Number Constant +hi link Boolean Constant +hi link Float Number +hi link Function Identifier +hi link Conditional Statement +hi link Repeat Statement +hi link Label Statement +hi link Operator Statement +hi link Keyword Statement +hi link Exception Statement +hi link Include PreProc +hi link Define PreProc +hi link Macro PreProc +hi link PreCondit PreProc +hi link StorageClass Type +hi link Structure Type +hi link Typedef Type +hi link SpecialChar Special +hi link Delimiter Special +hi link SpecialComment Special +hi link Debug Special +hi link SpecialKey NonText diff --git a/vimfiles.stefan/colors/Stefan.vim b/vimfiles.stefan/colors/Stefan.vim new file mode 100644 index 0000000..6a8b9ec --- /dev/null +++ b/vimfiles.stefan/colors/Stefan.vim @@ -0,0 +1,95 @@ +" Vim color file +" Author: Stefan Liebl +" Last Change: 2005 Jan 23 + +" First remove all existing highlighting. +hi clear +if exists("syntax_on") + syntax reset +endif + +let colors_name = "Stefan" + +" Farben einstellen: +" - Cursor auf Text plazieren +" - :SyntaxShowGroup +" gibt die syntax GRUPPE aus +" - :highlight GRUPPE +" gibt entweder eine weitere syntax GRUPPE2 aus, dann Befehl mit dieser Gruppe wiederholen +" oder gibt das Farbschema der Gruppe aus. Dieses sollte sich dann in dieser Datei wiederfinden lassen +" - Farbschema in dieser Datei ändern +" term für Konsole ohne Farbe (gibt's eigentlich nirgends) +" cterm für Konsole mit Farbe +" gui für kvim, gvim +" +" Farben für cterm: +" 0 Black +" 1 Red (is bold) +" DarkRed (not bold) +" 2 Green (is bold) +" DarkGreen (not bold) +" 3 Yellow (is bold) +" DarkYellow (not bold) +" 4 Blue (is bold) +" DarkBlue (not bold) +" 5 Magenta (is bold) +" DarkMagenta (not bold) +" 6 Cyan (is bold) +" DarkCyan (not bold) +" 7 Grey (not bold) (==White not bold) +" DarkGrey (bold) +" White (is bold) + +hi Normal ctermfg=Grey ctermbg=Black guifg=White guibg=SeaGreen + +hi SpecialKey term=bold ctermfg=DarkBlue guifg=DarkBlue +hi NonText term=NONE cterm=NONE ctermfg=DarkBlue gui=NONE guifg=DarkBlue +hi Directory term=bold ctermfg=DarkBlue guifg=Blue +hi ErrorMsg term=standout cterm=bold ctermfg=Grey ctermbg=Red gui=bold guifg=White guibg=LightRed +hi IncSearch term=reverse cterm=reverse gui=reverse +hi Search term=reverse ctermbg=Brown guifg=Black guibg=LightGreen +hi MoreMsg term=bold ctermfg=Grey gui=bold guifg=White +hi ModeMsg term=bold cterm=bold gui=bold guifg=Black +hi LineNr term=underline ctermfg=Yellow guifg=Orange guibg=SeaGreen +hi Question term=standout ctermfg=Grey gui=bold guifg=White +hi StatusLine term=bold,reverse cterm=bold,reverse gui=bold guifg=White guibg=Black +hi StatusLineNC term=reverse cterm=reverse gui=bold guifg=PeachPuff guibg=Gray45 +hi VertSplit term=reverse cterm=reverse gui=bold guifg=White guibg=Gray45 +hi Title term=bold ctermfg=Magenta gui=bold guifg=LightRed +hi Visual term=reverse cterm=reverse gui=reverse guibg=Black +hi VisualNOS term=bold,underline cterm=bold,underline gui=bold,underline +hi WarningMsg term=standout ctermfg=Red gui=bold guifg=Red guibg=LightGreen +hi WildMenu term=standout ctermfg=Black ctermbg=Brown guifg=Black guibg=Yellow +hi Folded term=standout ctermfg=Black ctermbg=DarkGreen guifg=Black guibg=DarkGreen +hi FoldColumn term=standout ctermfg=DarkBlue ctermbg=Grey guifg=DarkBlue guibg=Gray80 +hi DiffAdd term=bold ctermbg=Red guibg=Red +hi DiffChange term=bold ctermbg=Magenta guibg=DarkGreen +hi DiffDelete term=bold cterm=bold ctermfg=DarkBlue ctermbg=White gui=bold guifg=LightBlue guibg=White +hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red +hi Cursor guifg=bg guibg=fg +hi lCursor guifg=bg guibg=fg + +" Colors for syntax highlighting +hi Comment term=bold ctermfg=DarkYellow gui=NONE guifg=Yellow +hi Constant term=underline ctermfg=DarkMagenta guifg=Black +hi Special term=bold ctermfg=DarkBlue guifg=Blue +hi Identifier term=underline ctermfg=DarkCyan guifg=Cyan +hi Statement term=bold ctermfg=DarkCyan gui=bold guifg=Cyan +hi PreProc term=underline ctermfg=DarkRed guifg=LightRed +hi Type term=underline ctermfg=DarkCyan gui=bold guifg=Cyan +hi Ignore cterm=bold ctermfg=White guifg=bg +hi Error term=reverse cterm=bold ctermfg=White ctermbg=LightRed gui=bold guifg=White guibg=LightRed +hi Todo term=standout ctermfg=DarkBlue ctermbg=Yellow guifg=Blue guibg=Yellow +hi Function term=bold ctermfg=DarkGreen gui=bold guifg=Green +hi Label term=bold ctermfg=DarkBlue gui=bold guifg=Blue +hi Underlined term=underline cterm=underline ctermfg=DarkBlue gui=underline guifg=Blue +hi MatchParen term=reverse guibg=Blue + +hi StdFunction gui=bold guifg=LightGreen +hi Operator gui=NONE guifg=Black +hi OperatorBold gui=bold guifg=Magenta +hi StdName gui=bold guifg=Magenta +hi Name gui=NONE guifg=LightGray +hi BlockBraces gui=bold guifg=DarkRed +hi MicroController gui=bold guifg=Magenta +hi PreCondit gui=NONE guifg=LightRed diff --git a/vimfiles.stefan/colors/Tina.vim b/vimfiles.stefan/colors/Tina.vim new file mode 100644 index 0000000..bc60f28 --- /dev/null +++ b/vimfiles.stefan/colors/Tina.vim @@ -0,0 +1,86 @@ +" Vim color file +" Author: Stefan Liebl +" Last Change: 2005 Jan 23 + +" First remove all existing highlighting. +hi clear +if exists("syntax_on") + syntax reset +endif + +let colors_name = "Tina" + +" Farben einstellen: +" - Cursor auf Text plazieren +" - :SyntaxShowGroup +" gibt die syntax GRUPPE aus +" - :highlight GRUPPE +" gibt entweder eine weitere syntax GRUPPE2 aus, dann Befehl mit dieser Gruppe wiederholen +" oder gibt das Farbschema der Gruppe aus. Dieses sollte sich dann in dieser Datei wiederfinden lassen +" - Farbschema in dieser Datei ändern +" term für Konsole ohne Farbe (gibt's eigentlich nirgends) +" cterm für Konsole mit Farbe +" gui für kvim, gvim +" +" Farben für cterm: +" 0 Black +" 1 Red (is bold) +" DarkRed (not bold) +" 2 Green (is bold) +" DarkGreen (not bold) +" 3 Yellow (is bold) +" DarkYellow (not bold) +" 4 Blue (is bold) +" DarkBlue (not bold) +" 5 Magenta (is bold) +" DarkMagenta (not bold) +" 6 Cyan (is bold) +" DarkCyan (not bold) +" 7 Grey (not bold) (==White not bold) +" DarkGrey (bold) +" White (is bold) +" +hi Normal ctermfg=Grey ctermbg=Black guifg=White guibg=SeaGreen + +hi SpecialKey term=bold ctermfg=DarkBlue guifg=DarkBlue +hi NonText term=NONE cterm=NONE ctermfg=DarkBlue gui=NONE guifg=DarkBlue +hi Directory term=bold ctermfg=DarkBlue guifg=Blue +hi ErrorMsg term=standout cterm=bold ctermfg=Grey ctermbg=Red gui=bold guifg=White guibg=LightRed +hi IncSearch term=reverse cterm=reverse gui=reverse +hi Search term=reverse ctermbg=Brown guifg=Black guibg=LightGreen +hi MoreMsg term=bold ctermfg=Grey gui=bold guifg=White +hi ModeMsg term=bold cterm=bold gui=bold guifg=Black +hi LineNr term=underline ctermfg=Yellow guifg=Orange guibg=SeaGreen +hi Question term=standout ctermfg=Grey gui=bold guifg=White +hi StatusLine term=bold,reverse cterm=bold,reverse gui=bold guifg=White guibg=Black +hi StatusLineNC term=reverse cterm=reverse gui=bold guifg=PeachPuff guibg=Gray45 +hi VertSplit term=reverse cterm=reverse gui=bold guifg=White guibg=Gray45 +hi Title term=bold ctermfg=Magenta gui=bold guifg=LightRed +hi Visual term=reverse cterm=reverse gui=reverse guibg=Black +hi VisualNOS term=bold,underline cterm=bold,underline gui=bold,underline +hi WarningMsg term=standout ctermfg=Red gui=bold guifg=Red guibg=LightGreen +hi WildMenu term=standout ctermfg=Black ctermbg=Brown guifg=Black guibg=Yellow +hi Folded term=standout ctermfg=Black ctermbg=DarkGreen guifg=Black guibg=DarkGreen +hi FoldColumn term=standout ctermfg=DarkBlue ctermbg=Grey guifg=DarkBlue guibg=Gray80 +hi DiffAdd term=bold ctermbg=Red guibg=Red +hi DiffChange term=bold ctermbg=Magenta guibg=DarkGreen +hi DiffDelete term=bold cterm=bold ctermfg=DarkBlue ctermbg=White gui=bold guifg=LightBlue guibg=White +hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red +hi Cursor guifg=bg guibg=fg +hi lCursor guifg=bg guibg=fg + +" Colors for syntax highlighting +hi Comment term=bold ctermfg=DarkYellow gui=NONE guifg=Yellow +hi Constant term=underline ctermfg=DarkMagenta guifg=Black +hi Special term=bold ctermfg=DarkBlue guifg=Blue +hi Identifier term=underline ctermfg=DarkCyan guifg=Cyan +hi Statement term=bold ctermfg=DarkCyan gui=bold guifg=Cyan +hi PreProc term=underline ctermfg=DarkRed guifg=LightRed +hi Type term=underline ctermfg=DarkCyan gui=bold guifg=Cyan +hi Ignore cterm=bold ctermfg=White guifg=bg +hi Error term=reverse cterm=bold ctermfg=White ctermbg=LightRed gui=bold guifg=White guibg=LightRed +hi Todo term=standout ctermfg=DarkBlue ctermbg=Yellow guifg=Blue guibg=Yellow +hi Function term=bold ctermfg=DarkGreen gui=bold guifg=Green +hi Label term=bold ctermfg=DarkBlue gui=bold guifg=Blue +hi Underlined term=underline cterm=underline ctermfg=DarkBlue gui=underline guifg=Blue + diff --git a/vimfiles.stefan/compiler/bmsk.vim b/vimfiles.stefan/compiler/bmsk.vim new file mode 100644 index 0000000..6ccf800 --- /dev/null +++ b/vimfiles.stefan/compiler/bmsk.vim @@ -0,0 +1,205 @@ +" Vim compiler file +" Compiler: diab data 4.4 +" Maintainer: Stefan Liebl +" Last Change: 13.06.2002 + +"if exists('current_compiler') +" finish +"endif +"let current_compiler = 'bcc' + +set errorformat= +" tex-errorformat laden +let b:forceRedoTexCompiler = 'yes' +let g:Tex_ShowallLines = 1 +"execute 'source ' . expand(g:vimfiles . '/compiler/tex.vim') + +let g:makeprg = simplify(GetBmskDir() . '/make_fsw.bat') +let &makeprg = g:makeprg . ' $*' + +if exists('g:make_log') + let &shellpipe = '| ' . g:tee . PathNormpath(make_log) . ' | ' . g:tee +else + let &shellpipe = '| ' . g:tee +endif +set makeef= + +" ------------------------------------- +" Diab-Data-Compiler, Assembler, Linker +" ------------------------------------- +" dcc_info, dcc_warning, dcc_error, dcc_fatal +setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t%.%#\ \(dcc:%n\):%m +" dcc_fatal +setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %tatal\ error\ \(dcc:%n\):%m +setlocal errorformat+=%tatal\ error\ \(dcc:%n\):%m +" das_error +setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t[a-z]:%m +" dld_error +setlocal errorformat+=d%td:%m +setlocal errorformat+=d%td.EXE:%m +" ------- +" PC-Lint +" ------- +setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t%.%#\ \(pclint:%n\):%m +setlocal errorformat+=%t%.%#\ \(pclint:%n\):%m +" ------- +" SP-Lint +" ------- +"setlocal errorformat+=%f\(%l,%c\):\ %m +setlocal errorformat+=%A%f\(%l\):\ %m +setlocal errorformat+=%A%f\(%l\): +setlocal errorformat+=%A%f\(%l\\,%c\):\ %m +setlocal errorformat+=%A%f\(%l\\,%c\): +setlocal errorformat+=%C\ \ \ \ %m +" -------- +" GNU-Make +" -------- +setlocal errorformat+=%f:%l:\ %m +setlocal errorformat+=%f:%l:%t%.%#:\ %m +setlocal errorformat+=%+G%.%#make.exe:\ %m +setlocal errorformat+=%+G%.%#make%.%#.sh:\ %m +setlocal errorformat+=%+G%.%#mkdir.exe:\ %m +setlocal errorformat+=%+G%.%#cp.exe:\ %m +setlocal errorformat+=%+G%.%#rm.exe:\ %m +" --------- +" BMSK make +" --------- +setlocal errorformat+=bmsk:\ %m +" ------------ +" python error +" ------------ +setlocal errorformat+=%+G%.%#python.exe:\ %m +"setlocal errorformat+=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m +" ----- +" DAMOS +" ----- +" Damos error +setlocal errorformat +=%PDAM-S-INPUTFILEOPENED\ %f%*\\s +setlocal errorformat +=%PDAM-S-OUTPUTFILEOPENED\ %f%*\\s +setlocal errorformat +=%QDAM-S-FILECLOSED\ %f%*\\s +"setlocal errorformat +=%PDAM-S-OSP-OPENING-SEQ-OSP\ %f%*\\s +setlocal errorformat +=%QDAM-S-OSP-CLOSE\ %f%*\\s +" ignore 'DAM-W-KONS-SW-IGNORED' +setlocal errorformat+=%-O%.%#DAM-W-KONS-SW-IGNORED +" Damos Info-Feld +"setlocal errorformat +=%-I\|\ DAM-I-%m, +" \%-Z+-%# +" Damos Warning- oder Error-Feld +" DAM-W-... +setlocal errorformat +=%A\ %#\|\ DAM-%t-%m, + \%C\ %#\|\%*\\sZeile\ %l%m, + \%C\ %#\|\%*\\sZeile\ %f:\ %l%m, + \%C\ %#\|\ %#%m, + \%-Z\ %#+-%# +" Damos: Kenngr��en, die in mehr als einer SG-Funktion definiert sind: +" Kgs: ... Fkt: ... +setlocal errorformat +=%+WKenngr��en%m +setlocal errorformat +=%+WKgs:%m +" Damos: Ram-Gr��en, die in einer SG-Funktion enthalten sind, +" aber nicht im OSp existieren: +" Ram: ... Fkt: ... +setlocal errorformat +=%+WRam-Gr��en%m, + \%+Zaber%m +" Damos: Lokale Ram-Gr��en, die referenziert werden: +" Ram: ... Fkt: ... +setlocal errorformat +=%+WLokale\ Ram-Gr��en%m +setlocal errorformat +=%+WRam:%m +" +setlocal errorformat +=%W%\\%#%#DAM-S-KGR-PLS-EXCEEDED%m:%*\\s, + \%CDAM-S-KGR-PLS-EXCEEDED%m, + \%-Z+-%# +" ignore uninterresting lines +" --------------------------- +" ignore 'ignoring option ...' +setlocal errorformat+=%-Oignoring\ option%.%# +" ignore 'file: 123: #error ...' +setlocal errorformat+=%-O%*\\S\ %*\\d:\ #%.%# + +" make options +let g:makeopts = '' +if (g:Motor != '') + let g:makeopts = g:makeopts . ' Motor=' . g:Motor +endif +if (g:Muster != '') + let g:makeopts = g:makeopts . ' Muster=' . Muster +endif +if (g:Egas != '') + let g:makeopts = g:makeopts . ' Egas=' . g:Egas +endif +if (Xlint != '') + let g:makeopts = g:makeopts . ' DIAB_LINT_OPTION=' . Xlint +endif +if (g:SW_Stand != '') + let g:makeopts = g:makeopts . ' Stand=' . g:SW_Stand +endif + +" user commands +command! -nargs=* Make execute(':make! <args> ' . g:makeopts) +command! -nargs=0 Clean call Clean() +command! -nargs=0 CleanAll call CleanAll() +command! Compile call Compile_File() +command! PreCompile call PreCompile_File() + +" Clean function +function! Clean() + Make clean +endfunction +function! CleanAll() + cscope kill -1 + Make cleanall +endfunction + +" reformat i-file +command! ReformatIFile call Reformat_IFile() +function! Reformat_IFile() abort + let cName = expand('%:t:r') . '.c' + let CR = '\<CR>' + DelAllMultipleEmptyLines + " do not wrap over end of file + setlocal nowrapscan + " go to top of file + execute 'normal gg' + " do unil error + while 1 + " delete until line of c-file + execute 'normal d/\c^# \d\+ ".*\(' . cName . '\)' . CR + " go to line of include-file + execute 'normal /\c^# \d\+ ".*\(' . cName . '\)\@<!"' . CR + endwhile +endfunction + +function! GetMakeVar(varName) + let var = GetMakeVars([a:varName]) + if has_key(var, a:varName) + let varValue = var[a:varName] + else + let varValue = '' + endif + return varValue +endfunction + +function! GetMakeVars(varNameList) + let varlist = {} + try + let vars = join(a:varNameList, ' ') + let command = g:makeprg . g:makeopts . ' getvar name="' . vars . '"' + let output = system(command) + let lines = split(output, "\n") + if len(lines) == 1 + " make < make-43 (Antwort nur VALUE) + let RE = '\(.*\)' + let SU = "let varlist['" . vars . "']='\\1'" + else + " make >= make-43 (Antwort: NAME=VALUE + let RE = '^\(\w\+\)=\(.*\)\s*' + let SU = "let varlist['\\1']='\\2'" + endif + for line in lines + if match(line, RE) >= 0 + execute substitute(line, RE, SU, '') + endif + endfor + endtry + return varlist +endfunction + diff --git a/vimfiles.stefan/compiler/gcc.vim b/vimfiles.stefan/compiler/gcc.vim new file mode 100644 index 0000000..974212d --- /dev/null +++ b/vimfiles.stefan/compiler/gcc.vim @@ -0,0 +1,41 @@ +" defaults for gcc +unlet current_compiler +execute('source ' . $VIMRUNTIME . '/compiler/gcc.vim') + +" add german text +"set errorformat+=%D%*\\a[%*\\d]:\ Wechsel\ in\ das\ Verzeichnis\ �%f� +"set errorformat+=%X%*\\a[%*\\d]:\ Verlassen\ des\ Verzeichnisses\ �%f� + +" defaults for python +"let s:shellpipe_save = &shellpipe +"let s:makeprg_save = &makeprg +"unlet current_compiler +"execute('source ' . g:vimsuite . '/vimfiles.stefan/compiler/python.vim') +"let &shellpipe = s:shellpipe_save +"let &makeprg = s:makeprg_save +"unlet s:shellpipe_save +"unlet s:makeprg_save + +" ------- +" PC-Lint +" ------- +"setlocal errorformat+=\"%f\"\\,\ line\ %l:\ %t%.%#\ \(pclint:%n\):%m +"setlocal errorformat+=%t%.%#\ \(pclint:%n\):%m +" ------- +" SP-Lint +" ------- +setlocal errorformat+=%A%f\(%l\):\ %m +setlocal errorformat+=%A%f\(%l\): +setlocal errorformat+=%A%f\(%l\\,%c\):\ %m +setlocal errorformat+=%A%f\(%l\\,%c\): +setlocal errorformat+=%C\ \ \ \ %m + +" ----- +" Tools +" ----- +setlocal errorformat+=%+G%.%#.exe:\ %m + +" Error format from other programs: ...: ... +"setlocal errorformat+=%+G%f:\ %m + +let current_compiler = 'gcc-special' diff --git a/vimfiles.stefan/compiler/java.vim b/vimfiles.stefan/compiler/java.vim new file mode 100644 index 0000000..044b62e --- /dev/null +++ b/vimfiles.stefan/compiler/java.vim @@ -0,0 +1,21 @@ + +if exists("current_compiler") + finish +endif +let current_compiler = "java" + + +"let &makeprg = "/usr/java/current/bin/javac %:p" +"setlocal shellpipe=2> + +"set errorformat+=%E%\\s%#File\ \"%f\"\\,\ line\ %l\\,\ %m +"set errorformat+=%C%m +"set errorformat+=%Z%.%#Error:\ %m + +command! Make cd %:p:h | make +command! Clean cd %:p:h | make clean +command! Build cd %:p:h | make build +command! Run cd %:p:h | make run +command! Compile !/usr/java/current/bin/javac %:p +command! RunObject !%:p:r + diff --git a/vimfiles.stefan/compiler/lint.vim b/vimfiles.stefan/compiler/lint.vim new file mode 100644 index 0000000..68f4dcf --- /dev/null +++ b/vimfiles.stefan/compiler/lint.vim @@ -0,0 +1,41 @@ +" Vim compiler file +" Compiler: lint +" Maintainer: Stefan Liebl +" Last Change: 13.06.2002 + +"if exists('current_compiler') +" finish +"endif +"let current_compiler = 'bcc' + + +let &makeprg = PathJoin(GetBmskDir() . ', lint_bmsk.bat') . ' ' . GetDfilesDir() . ' $*' +"set shellpipe=> +"let &shellpipe = '| e:\\tools\\gnu\\shutils\\bin\\tee.exe' +"let &shellpipe = '| e:\\tools\\gnu\\shutils\\bin\\tee.exe ' . make_log . ' | e:\\tools\\gnu\\shutils\\bin\\tee.exe' +set shellpipe= +let &makeef = PathJoin(GetBmskDir() . ', lint_bmsk.txt') + +set errorformat= +set errorformat+=%f\ %l:\ %trror\ %n\ %m +set errorformat+=%f\ %l:\ %tarning\ %n\ %m +set errorformat+=%f\ %l:\ %tnfo\ %n\ %m +set errorformat+=%f\ %l:\ %tote\ %n\ %m + +let biosdirs = '' +let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', adc') +let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', dio') +"let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', edc16lib') +let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', pm') +"let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', stflprg') +let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', target') +let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', tio') +"let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', tpu_bms') +let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', tpu_lib_export') +let biosdirs = biosdirs . ' ' . PathJoin(bmsk_bios . ', uhwe') +" user functions +"command! -nargs=* Compile execute ':wa | cd ' . GetBmskDir() . ' | make! %:p' +command! -nargs=* Compile wa | execute('cd ' . GetBmskDir()) | make! <args> %:p +command! -nargs=* Make wa | execute('cd ' . GetBmskDir()) | make! <args> %:p:h +command! -nargs=* MakeBios execute ':wa | cd ' . GetBmskDir() . ' | make! <args> ' . biosdirs + diff --git a/vimfiles.stefan/compiler/pascal.vim b/vimfiles.stefan/compiler/pascal.vim new file mode 100644 index 0000000..e2fa9b8 --- /dev/null +++ b/vimfiles.stefan/compiler/pascal.vim @@ -0,0 +1,26 @@ +" Vim compiler file +" Compiler: gnu pascal compiler gpc +" Maintainer: Stefan Liebl +" Last Change: 01.09.2002 + +if exists("current_compiler") + finish +endif +let current_compiler = "pascal" + + +"let &makeprg = "\\tools\\python\\v2.1a2\\python %:p" +"setlocal shellpipe=2> + +"set errorformat+=%E%\\s%#File\ \"%f\"\\,\ line\ %l\\,\ %m +"set errorformat+=%C%m +"set errorformat+=%Z%.%#Error:\ %m + +command! Make cd %:p:h | make +command! Clean cd %:p:h | make clean +command! Build cd %:p:h | make build +command! Run cd %:p:h | make run +"command! Compile !gpc --borland-pascal -Wall -W %:p -o %:p:r +command! Compile !ppc386 -Sp -vwnh -o%:p:r %:p +command! RunObject !%:p:r + diff --git a/vimfiles.stefan/compiler/python.vim b/vimfiles.stefan/compiler/python.vim new file mode 100644 index 0000000..9b59816 --- /dev/null +++ b/vimfiles.stefan/compiler/python.vim @@ -0,0 +1,27 @@ +" Vim compiler file +" Compiler: python +" Maintainer: Stefan Liebl +" Last Change: 13.06.2002 + +if exists("current_compiler") + finish +endif +let current_compiler = "python" + + +"let &makeprg = g:python . ' -c "import py_compile,sys; sys.stderr=sys.stdout; py_compile.compile(%:p)\"' +"let &makeprg = g:python . ' -c "import py_compile; py_compile.compile(r\'%\')"' +set makeprg=python\ -c\ \"import\ py_compile;\ py_compile.compile('%')\" +"let &makeprg = g:python . ' -c "print \"hallo welt\"; print \"ende\""' + +setlocal shellpipe=2> + +set errorformat+=%E%\\s%#File\ \"%f\"\\,\ line\ %l\\,\ %m +set errorformat+=%C%m +set errorformat+=%Z%.%#Error:\ %m + +set errorformat+=%E%\\s%#File\ \"<string>\"\\,\ line\ %l +set errorformat+=%C%m +set errorformat+=%-C\ %p^ +set errorformat+=%Z%.%#Error:\ %m + diff --git a/vimfiles.stefan/compiler/python22.vim b/vimfiles.stefan/compiler/python22.vim new file mode 100644 index 0000000..fbd1b36 --- /dev/null +++ b/vimfiles.stefan/compiler/python22.vim @@ -0,0 +1,37 @@ +" Vim compiler file +" Compiler: python +" Maintainer: Stefan Liebl +" Last Change: 13.06.2002 + +if exists('current_compiler') + finish +endif +let current_compiler = 'python' + + + +let &makeprg = 'python %:p' +"setlocal shellpipe=> +setlocal shellpipe=2> +"let &shellpipe = '|' PathNormpath('e:/tools/gnu/shutils/bin/tee.exe') +"let &shellpipe = '|' PathNormpath('e:/tools/gnu/shutils/bin/tee.exe') +" \ PathNormpath(make_log) '|' PathNormpath('e:/tools/gnu/shutils/bin/tee.exe') + +" set errorformat to default-value +set errorformat& +"set errorformat= + +"set errorformat=%ATraceback%.%# +"set errorformat+=%C%\\s%#File\ \"%f\"\\,\ line\ %l\\,\ %m +"set errorformat+=%C%m +"set errorformat+=Z%.%#Error:\ %m + +set errorformat+=%E%\\s%#File\ \"%f\"\\,\ line\ %l\\,\ %m +set errorformat+=%C%m +set errorformat+=%Z%.%#Error:\ %m + +set errorformat+=%E%\\s%#File\ \"<string>\"\\,\ line\ %l +set errorformat+=%C%m +set errorformat+=%-C\ %p^ +set errorformat+=%Z%.%#Error:\ %m + diff --git a/vimfiles.stefan/compiler/turbo_c.vim b/vimfiles.stefan/compiler/turbo_c.vim new file mode 100644 index 0000000..eece0e1 --- /dev/null +++ b/vimfiles.stefan/compiler/turbo_c.vim @@ -0,0 +1,24 @@ +" Vim compiler file +" Compiler: borland turbo C compiler +" Maintainer: Stefan Liebl +" Last Change: 08.07.2003 + +"if exists('current_compiler') +" finish +"endif +"let current_compiler = 'tc' + + +let &l:makeprg = 'u:\daten\priv\c_files\tcc.bat $*' +setlocal shellpipe=> +"let &makeef = bmskdir . '\lint_bmsk.txt' + +setlocal errorformat= +setlocal errorformat+=%trror\ %f\ %l:\ %m +setlocal errorformat+=%tarning\ %f\ %l:\ %m + +" user functions +"command! -nargs=0 Compile execute ':wa | make! %:p' +command! -nargs=0 Make execute 'wa | make %:p' +command! -nargs=0 Run execute '!c:\temp\turbo-c\' . expand('%:t:r') . '.exe' + diff --git a/vimfiles.stefan/doc/bmsk.txt b/vimfiles.stefan/doc/bmsk.txt new file mode 100644 index 0000000..240a34d --- /dev/null +++ b/vimfiles.stefan/doc/bmsk.txt @@ -0,0 +1,213 @@ +*bmsk.txt* Funktinen fuer das Arbeiten mit BMSK-Projekten + + +|BMSK.1| Ausw�hlen des Projektes +|BMSK.2| Einstellungen +|BMSK.3| Compilieren +|BMSK.4| Arbeiten mit Files +|BMSK.5| Tags +|BMSK.6| Grep +|BMSK.7| DAMOS-Tools + +============================================================================== +*BMSK.1* Ausw�hlen des Projektes *Projekt* *Project* *BMSK* + +Ein BMSK-Projekt bezieht sich nicht auf eine VIM-Session, sondern nur auf den +Build-Prozess des BMSK-Projektes. Mit dem Ausw�hlen eines Projektes werden nur +die Pfade f�r|:Bmsk|,|:checkpath|,|:find|,|gf|... gesetzt. +Das Verwenden von Sessions empfielt sich zus�tzlich (siehe|VimSuite|). + + *:SetBmskProject* +:SetBmskProject [Pfad] Setzen der Einstellungen f�r ein BMSK-Projekt + +Mit dem Befehl|:SetBmskProject|k�nnen alle Einstellungen f�r ein +BMSK-Projekt vorgenommen werden. Es wird in das Verzeichnis .../bmsk +gewechselt und alle Tools werden mit dem neuen Pfad ausgef�hrt. Ausserdem wird +das passende Tag-File und die richtige|cscope|-Datenbasis verwendet. + +Als Pfad muss das Verzeichnis angegeben werden, in dem das make_fsw.bat liegt. +Wenn der Pfad weggelassen wird, so kommt ein Datei-Auswahl-Dialog. + +Mit der Tab-Erweiterung (siehe|cmdline-completion|) werden alle Projekte im +aktuellen|bmskWA|-Pfad angezeigt, sowie alle Projekte, die in|projects.txt| +angegeben sind. + + *projects.txt* +In der Datei|projects.txt|im Verzeichnis .../vim k�nnen die Pfade von +Projekten angegeben werden, die bei dem Befehl|:SetBmskProject|mit der +Tab-Erweiterung oder im Men� ausgew�hlt werden k�nnen. Dabei ist in jeder +Zeile der Datei das Verzeichnis des Makefiles anzugeben. + + *:SetBmskWA* *bmskWA* +:SetBmskWA {Pfad} Setzen des Pfades, in dem die BMSK-Projekte liegen + +Mit dem Befehl|:SetBmskWA|wird der Pfad gesetzt, in dem die +Tab-Erweiterung des Befehls|:SetBmskProject|nach Projekten sucht. + +============================================================================== +*BMSK.2* Einstellungen + *:SetMuster* +:SetMuster [Muster] Einstellen des Hardware-Standes + +F�r Muster k�nnen alle Mustervarianten angegeben werden + + *:SetEgas* +:SetEgas [Variante] Einstellen der Egas-Variante + +F�r Variante k�nnen alle Egas-Varianten angegeben werden + + *:SetMotorvariante* +:SetMotorvariante [Variante] Einstellen der Motorvariante + +F�r Variante kann K25, K40, K46 oder K71 angegeben werden + + *:SetSWStand* +:SetSWStand [Stand] Einstellen des Software-Stands + +F�r Stand kann Test, Entwickler oder Serie angegeben werden. + + *:SetXlint* +:SetXlint [Hexwert] Einstellen der Bmsk-Lint-Options + +F�r Hexwert kann z.B. 0x115 angegeben werden. Siehe dazu die +HTML-Dokumentation + +============================================================================== +*BMSK.3* Compilieren + *:Bmsk* +:Bmsk Compilieren des BMSK-Projektes + +Alle g�ngigen Optionen k�nnen �ber die Tab-Erweiterung ausgew�hlt werden. + + *:Lint* +:Lint �berpr�fen der Software mit FlexLint + +Dieser Befehl kann auch �ber 'Bmsk lint file=%:p' erreicht werden + + *:BmskDoku* +:BmskDoku Erzeugen einer Doku im BMSK-Projekt + +Es wird|Bmsk|ein der Fehlerparser aus der|LaTeX-Suite|verwendet. Dadurch sind +auch normale LaTeX-Warnings zu sehen. Diese m�ssen jedoch nicht alle beseitigt +werden. +Alle g�ngigen Optionen k�nnen �ber die Tab-Erweiterung ausgew�hlt werden. +Wird der Befehl ohne Parameter aufgerufen, so wird die Funktion interaktiv +abgefragt. + +============================================================================== +*BMSK.4* Arbeiten mit Files + +Um Files schnell zu finden sind alle relevanten Pfade in die Variable|'path'| +eingetragen. Dadurch kann mit: + + |:find|{filename} + +ein File ge�ffnet werden, ohne den Pfad anzugeben. + +Wenn sich der Cursor auf einem Filenamen befindet (z.B. #include "module.c") +so kann man mit + + |gf| + +direkt in das File springen. + +Jedes File, das schon einmal geladen war ist in der|buffer-list|enthalten. +Es kann �ber das Men� oder mit + + |:b|{filename} + +ge�ffnet werden. Dabei ist ausserdem die Tab-Erweiterung aktiv. + + + *:BuffersUpdate* *Buffers* +:BuffersUpdate Aktualisieren aller Dateien eines BMSK-Projekts + +Mit dem Befehl|:BuffersUpdate|werden alle Dateien eines BMSK-Projekts als +Buffer in Vim geladen. Diese k�nnen dann z.B. mit einer Session gespeichert +werden. + +Mit dem integrierten File-Explorer kann auch gearbeitet werden:|:Explore| + + *:COPYoutput* +:COPYoutput Product-Files auf Austauschlaufwerk kopieren + +Mit diesem Befehl werden die Files im Product-Verzeichnis auf das +Austauschlaufwerk kopiert. Das Ziel ist in der Variablen Austausch und +myAustausch gespeichert. Diese m�ssen im File _vimrc richtig gesetzt werden. + + *:RENAMEoutput* +:RENAMEoutput Product-Files umbenennen + +Mit diesem Befehl werden die Files im Product-Verzeichnis umbenannt. Die als +Argument �bergebene Erweiterung wird nach dem Programmstandsnamen vor dem +Punkt eingef�gt. +Beispiel: > + + :RENAMEoutput _test01 + +Dadurch werden die Files folgendermassen umbenannt: +115BXXXX.daf -> 115BXXXX_test01.daf +770115XE.a2l -> 770115XE_test01.a2l +770115XE.dcm -> 770115XE_test01.dcm +770115XE.elf -> 770115XE_test01.elf +770115XE.map -> 770115XE_test01.map +770115XE.paf -> 770115XE_test01.paf +770115XE.s19 -> 770115XE_test01.s19 + + *:CopyProgrammstand* +:CopyProgrammstand alle Product-Files auf Server ausliefern + +Mit diesem Befehl werden die Files in allen Product-Verzeichnissen in die +Auslieferstrucktur in einem Verzeichnis kopiert, das �ber einen +File-Open-Dialog gew�hlt werden kann. + +============================================================================== +*BMSK.5* Tags + +Die BMS-K arbeitet mit zwei unterschiedlichen Datenbanken: +|ctags| und |cscope|. + + *:BMSK-ctags* +Die Datenbank von ctags erfasst alle Tags in DAMOS und Python-Files. Sie +werden mit > + + Bmsk ctags + +und > + + Bmsk ptags + +erzeugt. Zu einem Tag kann mit der Taste <TAB> gesprungen werden. Zur�ck kommt +man mit <BS>. Zu den DAMOS-Files geh�ren kgs- und osp-Files, d.h. es kann auch +zu Umrechnungsformeln, Codesyntaxen, usw. gesprungen werden. + + *:BMSK-cscope* +Die Datenbank von cscope erfasst alle Tags in c-, h- und d-Files. Sie werden +mit > + + Bmsk cscope + +erzeugt. Zu einem Tag kann mit der Taste <CR> gesprungen werden. Zur�ck kommt +man mit <BS>.|Cscope|bietet viele weitere M�glichkeiten. + +============================================================================== +*BMSK.6* Grep + +Die Funktion zur Suche mit einem externen|grepprg|wird zugunsten der internen +Variante|:vimgrep|nicht unterst�tzt. In der Regel kann der einfache Befehl + *:GrepBmsk* +:GrepBmsk [pattern] + +verwendet werden. Es unterst�tzt Regular expressions und findet mehrere +Treffer in einer Zeile, die mit <CTRL-n> durchlaufen werden k�nnen. Gesucht +wird in allen c-, h- und kgs-Files unterhalb von bmsk/sw + +Alternativ gibt es den Befehl|:Grep|aus der|VimSuite|. + +============================================================================== +*BMSK.7* DAMOS-Tools + +Siehe eigene Dokumentation zu|damos| + +============================================================================== +vim:tw=78:ts=8:ft=help:norl: diff --git a/vimfiles.stefan/doc/ccm.txt b/vimfiles.stefan/doc/ccm.txt new file mode 100644 index 0000000..e2d4099 --- /dev/null +++ b/vimfiles.stefan/doc/ccm.txt @@ -0,0 +1,28 @@ +*ccm.txt* Funktinen fuer das Arbeiten mit Synergy/CM + + +Um mit dem Konfigurations-Management-Tool Synergy/CM (CCM) zu arbeiten muss +das Tool gestartet und die richtige Default-Task ausgew�hlt sein. Dann k�nnen +die folgenden Befehle aus einem Buffer heraus ausgef�hrt werden: + +============================================================================== + *ccm* *CCM* *Synergy* *Synergy/CM* *CM/Synergy* + + *:CCMcheckout* +:CCMcheckout [comment] Auschecken eines Files in CCM + + *:CCMcheckpoint* +:CCMcheckpoint [comment] Einchecken eines Files als checkpoint + + *:CCMchangeable* +:CCMchangeable Zeigt an, ob der user ein working objekt vom aktuellen File hat + + *:CCMdiff* +:CCMdiff Zeigt die �nderungen gegen�ber der Vorg�nger-Version + + *:CCMobject* +:CCMobject Gibt den kompletten objectname aus + + *:CCMhistory* +:CCMhistory �ffnet den History-View f�r das aktuelle File + diff --git a/vimfiles.stefan/doc/svn.txt b/vimfiles.stefan/doc/svn.txt new file mode 100644 index 0000000..a0318ef --- /dev/null +++ b/vimfiles.stefan/doc/svn.txt @@ -0,0 +1,33 @@ +*svn.txt* Funktinen fuer das Arbeiten mit Subversion + + +SVNstudio bietet Funktionen zum Arbeiten mit Subversion und eine Oberfl�che, +die das committen erleichtert. + +============================================================================== + *svn* *SVN* *SVNstudio* *Subversion* + + *:SVNcommit* +:SVNcommit [comment] Einchecken aller Files im aktuellen Verzeichnis +Falls comment angegeben wird, so wird dieser verwendet. Andernfalls wird der +Kommentar interaktiv erfragt. + + *:SVNdiff* +:SVNdiff [version] Zeigt die �nderungen gegen�ber der Vorg�nger-Version +Wenn version angegeben wird, so wird diese mit der aktuellen verglichen + + *:SVNstatus* +:SVNstatus Zeigt die �nderungen gegen�ber der Datenbank an. + + *:SVNupdate* +:SVNupdate Aktualisiert das aktuelle Verzeichnis mit dem Datenbank-Inhalt + + *:SVNlog* +:SVNlog Zeigt die Versions-Historie an. + + *:SVNadd* +:SVNadd F�gt das aktuelle File in die Versionsverwaltung ein. + + *:SVNstudio* +:SVNstudio �ffnet eine Oberfl�che, um einen commit durchzuf�hren + diff --git a/vimfiles.stefan/doc/tags b/vimfiles.stefan/doc/tags new file mode 100644 index 0000000..26e99b7 --- /dev/null +++ b/vimfiles.stefan/doc/tags @@ -0,0 +1,95 @@ +:BMSK-cscope bmsk.txt /*:BMSK-cscope* +:BMSK-ctags bmsk.txt /*:BMSK-ctags* +:Bmsk bmsk.txt /*:Bmsk* +:BmskDoku bmsk.txt /*:BmskDoku* +:BuffersUpdate bmsk.txt /*:BuffersUpdate* +:CCMchangeable ccm.txt /*:CCMchangeable* +:CCMcheckout ccm.txt /*:CCMcheckout* +:CCMcheckpoint ccm.txt /*:CCMcheckpoint* +:CCMdiff ccm.txt /*:CCMdiff* +:CCMhistory ccm.txt /*:CCMhistory* +:CCMobject ccm.txt /*:CCMobject* +:COPYoutput bmsk.txt /*:COPYoutput* +:CopyProgrammstand bmsk.txt /*:CopyProgrammstand* +:DiffClose vimsuite.txt /*:DiffClose* +:DiffOff vimsuite.txt /*:DiffOff* +:Grep vimsuite.txt /*:Grep* +:GrepBmsk bmsk.txt /*:GrepBmsk* +:InsertCHeader vimsuite.txt /*:InsertCHeader* +:Lint bmsk.txt /*:Lint* +:MarkLongLines vimsuite.txt /*:MarkLongLines* +:MarkLongLinesOff vimsuite.txt /*:MarkLongLinesOff* +:RENAMEoutput bmsk.txt /*:RENAMEoutput* +:SVNadd svn.txt /*:SVNadd* +:SVNcommit svn.txt /*:SVNcommit* +:SVNdiff svn.txt /*:SVNdiff* +:SVNlog svn.txt /*:SVNlog* +:SVNstatus svn.txt /*:SVNstatus* +:SVNstudio svn.txt /*:SVNstudio* +:SVNupdate svn.txt /*:SVNupdate* +:SessionLoad vimsuite.txt /*:SessionLoad* +:SessionSave vimsuite.txt /*:SessionSave* +:SetBmskProject bmsk.txt /*:SetBmskProject* +:SetBmskWA bmsk.txt /*:SetBmskWA* +:SetEgas bmsk.txt /*:SetEgas* +:SetMotorvariante bmsk.txt /*:SetMotorvariante* +:SetMuster bmsk.txt /*:SetMuster* +:SetSWStand bmsk.txt /*:SetSWStand* +:SetXlint bmsk.txt /*:SetXlint* +:SyntaxShowGroup vimsuite.txt /*:SyntaxShowGroup* +BMSK bmsk.txt /*BMSK* +BMSK.1 bmsk.txt /*BMSK.1* +BMSK.2 bmsk.txt /*BMSK.2* +BMSK.3 bmsk.txt /*BMSK.3* +BMSK.4 bmsk.txt /*BMSK.4* +BMSK.5 bmsk.txt /*BMSK.5* +BMSK.6 bmsk.txt /*BMSK.6* +BMSK.7 bmsk.txt /*BMSK.7* +Bestandteile vimsuite.txt /*Bestandteile* +Buffers bmsk.txt /*Buffers* +CCM ccm.txt /*CCM* +CM/Synergy ccm.txt /*CM\/Synergy* +CTRL-K vimsuite.txt /*CTRL-K* +CTRL-N vimsuite.txt /*CTRL-N* +CTRL-k vimsuite.txt /*CTRL-k* +CTRL-n vimsuite.txt /*CTRL-n* +Comment vimsuite.txt /*Comment* +CommentInOut vimsuite.txt /*CommentInOut* +DelAllMultipleEmptyLines vimsuite.txt /*DelAllMultipleEmptyLines* +DelAllMultipleSameLines vimsuite.txt /*DelAllMultipleSameLines* +DelAllTrailingWhitespace vimsuite.txt /*DelAllTrailingWhitespace* +DirDiff vimsuite.txt /*DirDiff* +GrepDir vimsuite.txt /*GrepDir* +GrepFiles vimsuite.txt /*GrepFiles* +Project bmsk.txt /*Project* +Projekt bmsk.txt /*Projekt* +Reformat vimsuite.txt /*Reformat* +SVN svn.txt /*SVN* +SVNstudio svn.txt /*SVNstudio* +Subversion svn.txt /*Subversion* +Synergy ccm.txt /*Synergy* +Synergy/CM ccm.txt /*Synergy\/CM* +VimSuite vimsuite.txt /*VimSuite* +VimSuiteEinstellungen vimsuite.txt /*VimSuiteEinstellungen* +VimSuiteInstallation vimsuite.txt /*VimSuiteInstallation* +VimSuiteTools vimsuite.txt /*VimSuiteTools* +b:GrepDir vimsuite.txt /*b:GrepDir* +b:GrepFiles vimsuite.txt /*b:GrepFiles* +b:commentstring vimsuite.txt /*b:commentstring* +bmsk.txt bmsk.txt /*bmsk.txt* +bmskWA bmsk.txt /*bmskWA* +ccm ccm.txt /*ccm* +ccm.txt ccm.txt /*ccm.txt* +cscope_macros vimsuite.txt /*cscope_macros* +g:GrepDir vimsuite.txt /*g:GrepDir* +g:GrepFiles vimsuite.txt /*g:GrepFiles* +projects.txt bmsk.txt /*projects.txt* +svn svn.txt /*svn* +svn.txt svn.txt /*svn.txt* +vi-hints.txt vi-hints.txt /*vi-hints.txt* +vimsuite vimsuite.txt /*vimsuite* +vimsuite.1 vimsuite.txt /*vimsuite.1* +vimsuite.2 vimsuite.txt /*vimsuite.2* +vimsuite.3 vimsuite.txt /*vimsuite.3* +vimsuite.4 vimsuite.txt /*vimsuite.4* +vimsuite.txt vimsuite.txt /*vimsuite.txt* diff --git a/vimfiles.stefan/doc/vi-hints.txt b/vimfiles.stefan/doc/vi-hints.txt new file mode 100644 index 0000000..2600ea2 --- /dev/null +++ b/vimfiles.stefan/doc/vi-hints.txt @@ -0,0 +1,208 @@ +*vi-hints.txt* For Vim version 7 + + +Vim usage hints from Stefan Liebl + +moving: +---------------- +w next word +b previous word +e next end of word +ge prev end of word +^ first non white-space in line +0 beginning of line +fx find x +tx to x +% match paren +H top of page +M middle of page +L end of page +G end of file +gg top of file +<CTRL-U> up a half page +<CTRL-D> down a half page +<CTRL-F> forward a page +<CTRL-B> backward a page +'' jump back +50% jump to 50% of the file +<CTRL-O> jump to older position +<CTRL-I> jump to newer position +:set virtualedit=all allow moving over end of line + +visual mode: +---------------- +v start visual mode +V start visual line mode +<CTRL-V> start visual rectangle mode in UNIX +<CTRL-Q> start visual rectangle mode in WINDOWS +o select the other edge +O select the other corner +p insert register 0 +P insert register " +:I standard: insert text at start of each line + in VimSuite: Increase Numbers (see|visincr|) +:A append text to end of each line +c change to text in each line +U make upper case +u make lower case +r fill block with character +> shift block right +< shift block left +J join lines +gq format text + +searching: +---------------- +/ find (command line) +/.../e move cursor to end of match +/xxx\zsyyy/ find xxxyyy but jump to yyy (see|\zs|) +? find backwards +* find word under cursor +# find word under cursor backwards +/\< find beginning of word +/\> find end of word +[i find first occurence of word under cursor from beginning of file +]i find first occurence of word under cursor form cursor +[d find makro definion +:nohls highlight off +fx find next x in line +gd go to definition +gf go to file +:find find file and edit + +registers: +---------------- +:register display contents of all registers +**yy copy to clipboard in UNIX +<CTRL-C> copy to clipboard in WINDOWS +**p paste from clipboard in UNIX +<CTRL-V> paste from clipboard in WINDOWS +"ap put content of register a +"ay$ copy content of line to register a + +macro-recording: +---------------- +qa start recording macro a +qA append to macro a +a stop recording macro a +@a execute macro a + +marks: +---------------- +mx set named mark x +mX set global named mark X +`x goto mark +'x goto mark (beginning of the line) +'' position before jump +'" position when leaving the file +'. position of last change +'[ beginning of last change +'] end of last change +:marks list all marks + +tags: +---------------- +:tag xxx find a tag +<TAB> find ctag under cursor (only for VimSuite) +<CR> find cscope-tag under cursor (only for VimSuite) +<S-TAB> return to previous location (only for VimSuite) +<BB> return to previous location (only for VimSuite) + +changing: +---------------- +. repeat last change +u undo +<CTRL-R> redo +**yy copy to clipboard +**p paste from clipboard +- change case +g~w change case for a word +gUw make word uppercase +guw make word lowercase +:s/pattern/text replace pattern with text +:global/pat/cmd search pattern and execute command +<CTRL-P> complete word to match before cursor +<CTRL-N> complete word to match after cursor +<CTRL-Y> insert character above cursor +<CTRL-R>a insert register a +<CTRL-O>cmd execute normal mode command +>> indent current line +<CTRL-T> indent current line +>> unindent current line +<CTRL-D> unindent current line + +formatting: +---------------- +:set textwith= set length of lines +gq{motion} format text (wokts also visable) +== format actual line +:retab 4 change tabstop to 4 and change text to look the same + +display: +---------------- +<CTRL-L> refresh display +:zf fold create +:zm fold more +:zr fold reduce +:zo fold open +:zc fold close +:gui start gui from terminal + +differences: +---------------- +:vertical diffsplit file +]c next change +[c last change +:diffupdate update highliting +dp diff put +do diff obtain + +make and grep: +---------------- +:ccn goto error n +:cl list errors +:cn goto next error +:cp goto previous error +:colder switch to older error-list +:cnewer switch to newer error-list +:cfile <name> read file as error-file + +file-operations: +---------------- +:edit file (re)load a file +:b file switch buffer to file +<CTRL-^> jump to last file +:args list arguments (files in buffer) +vim -r file recover from a crash +:edit . open file explorer +gf go to file under cursor +<CTRL-O> jump back +:find find file in path +:sfind open file in new window + +commandranges: +---------------- +:1,5s/... execute command s for lines 1 to 5 +:5s/... execute command s in line 5 +:.,$s/... execute command s from actual line to the end of the file +:'a,'bs/... execute command s from mark a to mark b +:5:s/... execute command s for 5 lines +:%s/... execute command for all lines + +command line editing: +---------------- +<TAB> complete match +<CTRL-D> list all matches +<CTRL-R><CTRL-W> insert word under cursor +%:p actual complete file-name + +hints and help: +---------------- +:checkpath check include-files +:options give a list of all options +:command list all user-commands +:function list all functions +:autocommand list all autocommands +ga ascii value of character under cursor + +vim:tw=78:ts=8:ft=help:norl: diff --git a/vimfiles.stefan/doc/vimsuite.txt b/vimfiles.stefan/doc/vimsuite.txt new file mode 100644 index 0000000..1212f03 --- /dev/null +++ b/vimfiles.stefan/doc/vimsuite.txt @@ -0,0 +1,209 @@ +*vimsuite.txt* Eine Sammlung von vimscripts f�r Software Entwickler + + +|vimsuite.1| Bestandteile +|vimsuite.2| Installation +|vimsuite.3| Einstellungen +|vimsuite.4| VimSuiteTools + +============================================================================== +*vimsuite.1* Bestandteile der VimSuite *VimSuite* *vimsuite* *Bestandteile* + +Die VimSuite besteht aus vimscripts von http://www.vim.org und eigenen +Scripten von Stefan Liebl. Folgende wichtige Scripts sind enthalten: + +|VimSuiteTools|Tools zum Programmieren von Stefan Liebl +|LaTeX| Suite Tools zum bearbeiten von LaTeX Quelltexten +|crefvim| Referenz zur Programmiersprache C (Anleitung in|crefvimdoc|) +|visincr| Inkrementieren von Nummern in Spalten +|cscope_macros|Anwenden der Datenbank f�r Label in C +|DirDiff| Vergleichen von kompletten Verzeichnissen +|tComment.txt| Erzeugen von Kommentaren in vielen Sprachen +|SVNstudio| Arbeiten mit Subversion +|CCM| Arbeiten mit CM/Synergy +|BMSK| Makros zum Arbeiten mit BMS-K/BMS-KP Quellcode + +============================================================================== +*vimsuite.2* Installation *VimSuiteInstallation* + +Zun�chst muss die aktuelle Release 7.0 von Vim (http://www.vim.org) in einem +Pfad ohne Sonderzeichen (auch ohne Leerzeichen) installierts sein. Die +VimSuite kann in einem beliebigen Verzeichnis abgelegt werden. + +Anschlie�end kann die Datei vimsuite/vimfiles.stefan/_vimrc.example nach +vim/_vimrc kopiert werden (unter Linux nach ~/.vimrc). In dieser Datei k�nnen +die pers�nlichen Einstellungen vorgenommen werden, z.B. in dem weitere +vimrc-files geladen werden. Falls die VimSuite nicht im Verzeichnis vim liegt, +muss nat�rlich noch der Pfad angepasst werden. + +Bei einem Update der VimSuite sollte die alte VimSuite gel�scht (oder +verschoben) werden, da sich die Verzeichnis-Struktur �ndern kann. Die +pers�nlichen Einstellungen in vim/_vimrc werden nicht �berschrieben. Es ist +aber empfehlenswert, die Datei mit der neuen +vim/vimsuite/vimfiles.stefan/_vimrc.example zu vergleichen. + +============================================================================== +*vimsuite.3* Einstellungen *VimSuiteEinstellungen* + +Einstellungen f�r die VimSuite k�nnen direkt im File _vimrc (bzw. ~/.vimrc) +gemacht werden. Alternativ kann dort ein eigenes vimrc-File mit|source|geladen +werden. + + *b:GrepFiles* *g:GrepFiles* *GrepFiles* +Die Variable b:GrepFiles kann z.B. in einem|filetype-plugin|gesetzt werden. +g:GrepFiles ist normalerweise *. F�r C-Projekte kann die Variable z.B. > + let b:GrepFiles='*.c *.h' +gesetzt werden. + + *b:GrepDir* *g:GrepDir* *GrepDir* +Die Variable b:GrepDir kann z.B. in einem|filetype-plugin|gesetzt werden. +g:GrepDir ist normalerweise das Verzeichnis, in dem vim ge�ffnet wurde. + +Die Funktion zur Suche mit einem externen|grepprg|wird zugunsten der internen +Variante|:vimgrep|nicht unterst�tzt. + + *b:commentstring* +Diese Variable wird verwendet, um Code auszukommentieren. Sie sollte in einem +|filetype-plugin|gesetzt werden. + +============================================================================== +*vimsuite.4* VimSuiteTools *VimSuiteTools* + + *:SessionLoad* +:SessionLoad [Name] Laden der Session mit dem Namen Name. + +Ruft|:source|Name auf. Falls kein Name angegeben wird, �ffnet sich ein +File-Browse Dialog. + + *:SessionSave* +:SessionSave [Name] Speichern der Session unter dem Namen Name. + +Ruft|:mksession|auf. Falls kein Name angegeben wird, �ffnet sich ein +File-Browse Dialog. + + *:Grep* +:Grep [pattern] Suchen nach pattern in mehreren Files + +Unterst�tzt Regular expressions und findet mehrere Treffer in einer Zeile, die +mit <CTRL-n> durchlaufen werden k�nnen. Gesucht wird in allen|b:GrepFiles|bzw. +falls nicht vorhanden in|g:GrepFiles|, die unterhalb von|b:GrepDir|bzw. falls +nicht vorhanden|g:GrepDir|liegen. + + *CTRL-n* *CTRL-N* +Mit <CTRL-n> wird das Command|:cn|ausgef�hrt. Es ist darauf zu achten, dass +der n�chste eintrag in der|Quickfix|Liste angezeigt wird. Steht die Liste +also auf dem ersten Eintrag, dieser wurde aber nicht angezeigt (make!, +vimgrep!) dann wird zum zweiten Eintrag gesprungen. + + *Reformat* +:Reformat Formatieren eines Quelltextes + +Dieser Befehl funktioniert f�r die meisten Programmiersprachen. In C werden +haupts�chlich alle Einr�ckungen korrigiert und alle Tabs zu Spaces +konvertiert. Der Befehl funktioniert aber auch einigerma�en f�r kgs-Files. +Es kann auch eine|range|angebeben werden (auch|visual|). + + *CommentInOut* *Comment* *CTRL-k* *CTRL-K* +:CommentInOut Aus- bzw. Ein-Kommentieren von Quellcode + +Die Funktion wird �blicherweise �ber die Tastenkombination <CTRL-K> +aufgerufen. Falls der Code auf der aktuellen Zeile nicht auskommentiert wird, +so wird er auskommentiert. Falls er schon auskommentiert ist, so wird der +Kommentar entfernt. Anschlie�end springt der Cursor in die n�chste Zeile, so +dass gro�e Bereiche sehr einfach aus- oder einkommentiert werden k�nnen. Als +Kommentarzeichen wird|b:commentstring|verwendet. Um eine Zeile als +auskommentiert zu erkennen muss der Kommentar in der ersten Spalte stehen. +Echte Kommentare k�nnen in einer andreren Spalte stehen und werden dann +doppelt auskommentiert. + + *:MarkLongLines* +:MarkLongLines Hebt zu lange Zeilen hervor +Alle Zeilen, die l�nger als|textwidth|sind, werden rot markiert. + + *:MarkLongLinesOff* +:MarkLongLinesOff Schaltet die Markierung wieder aus + + *:SyntaxShowGroup* +:SyntaxShowGroup Zeigt die Syntax|highlight-groups|an + + *:DiffOff* +:DiffOff Schaltet die Diff-Anzeige aus + + *:DiffClose* +:DiffClose Schlie�t das aktuelle Fenster und schaltet die Diff-Anzeige aus + + *DelAllTrailingWhitespace* +:DelAllTrailingWhitespace L�scht alle Leerzeichen an allen Zeilenenden + + *DelAllMultipleEmptyLines* +:DelAllMultipleEmptyLines L�scht alle mehrfachen leeren Zeilen + + *DelAllMultipleSameLines* +:DelAllMultipleSameLines + L�scht alle identischen Zeilen, die direkt hinterenander stehen + + *:InsertCHeader* +:InsertCHeader F�gt das Template ... ein + +============================================================================== + *cscope_macros* + +Folgende Mappings sind definiert: +<C-CR>s symbol: find all references to the token under cursor +<C-CR>g global: find global definition(s) of the token under cursor +<C-CR>c calls: find all calls to the function name under cursor +<C-CR>t text: find all instances of the text under cursor +<C-CR>e egrep: egrep search for the word under cursor +<C-CR>f file: open the filename under cursor +<C-CR>i includes: find files that include the current file +<C-CR>d called: find functions that function under cursor calls + +============================================================================== + *DirDiff* + +Doing the following will generate a diff window. + + :DirDiff <A:Src Directory> <B:Src Directory> +e.g. + :DirDiff ../something/dir1 /usr/bin/somethingelse/dir2 + +The following commands can be used inside the diff window: +'Enter','o' - Diff open: open the diff file(s) where your cursor is at +'s' - Synchronize the current diff. You can also select + a range (through visual) and press 's' to synchronize differences + across a range. + + - There are 6 Options you can choose when you hit 's': + 1. A -> B + Copy A to overwrite B + If A's file actually points to a directory, it'll copy it to B + recursively. + 2. B -> A + Copy B to overwrite A + If B's file actually points to a directory, it'll copy it to A + recursively. + 3. Always A + For the rest of the items that you've selected, + synchronize like (1). + 4. Always B + For the rest of the items that you've selected, + synchronize like (2). + 5. Skip + Skip this diff entry. + 6. Cancel + Quit the loop and exit. + +'u' - Diff update: update the diff window +'x' - Sets the exclude pattern, separated by ',' +'i' - Sets the ignore pattern, separated by ',' +'a' - Sets additional arguments for diff, eg. -w to ignore white space, + etc. +'q' - Quit DirDiff + +The following comamnds can be used in the Vim diff mode +\dg - Diff get: maps to :diffget<CR> +\dp - Diff put: maps to :diffput<CR> +\dj - Diff next: (think j for down) +\dk - Diff previous: (think k for up) + + diff --git a/vimfiles.stefan/ftdetect/a2l.vim b/vimfiles.stefan/ftdetect/a2l.vim new file mode 100644 index 0000000..75d8719 --- /dev/null +++ b/vimfiles.stefan/ftdetect/a2l.vim @@ -0,0 +1,2 @@ +autocmd BufRead,BufNewFile *.a2l set filetype=a2l +autocmd BufRead,BufNewFile *.x2l set filetype=a2l diff --git a/vimfiles.stefan/ftdetect/c.vim b/vimfiles.stefan/ftdetect/c.vim new file mode 100644 index 0000000..5dd5e08 --- /dev/null +++ b/vimfiles.stefan/ftdetect/c.vim @@ -0,0 +1,4 @@ +autocmd BufRead,BufNewFile /usr/include/*/* set filetype=c +autocmd BufRead,BufNewFile *.d set filetype=c +autocmd BufRead,BufNewFile *.dat set filetype=c +autocmd BufRead,BufNewFile *.i set filetype=c diff --git a/vimfiles.stefan/ftdetect/paf.vim b/vimfiles.stefan/ftdetect/paf.vim new file mode 100644 index 0000000..340ab9f --- /dev/null +++ b/vimfiles.stefan/ftdetect/paf.vim @@ -0,0 +1,4 @@ +autocmd BufRead,BufNewFile *.paf set filetype=paf +autocmd BufRead,BufNewFile *.daf set filetype=paf +autocmd BufRead,BufNewFile *.0pa set filetype=paf +autocmd BufRead,BufNewFile *.0da set filetype=paf diff --git a/vimfiles.stefan/ftdetect/scons.vim b/vimfiles.stefan/ftdetect/scons.vim new file mode 100644 index 0000000..7afb970 --- /dev/null +++ b/vimfiles.stefan/ftdetect/scons.vim @@ -0,0 +1,3 @@ +autocmd BufRead,BufNewFile SConstruct set filetype=scons +autocmd BufRead,BufNewFile SConscript set filetype=scons +autocmd BufRead,BufNewFile *.SConscript set filetype=scons diff --git a/vimfiles.stefan/ftdetect/tex.vim b/vimfiles.stefan/ftdetect/tex.vim new file mode 100644 index 0000000..488bd30 --- /dev/null +++ b/vimfiles.stefan/ftdetect/tex.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.tex set filetype=tex diff --git a/vimfiles.stefan/ftdetect/trace.vim b/vimfiles.stefan/ftdetect/trace.vim new file mode 100644 index 0000000..ae38fcf --- /dev/null +++ b/vimfiles.stefan/ftdetect/trace.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.cmm set filetype=trace diff --git a/vimfiles.stefan/ftdetect/uc.vim b/vimfiles.stefan/ftdetect/uc.vim new file mode 100644 index 0000000..3d3679d --- /dev/null +++ b/vimfiles.stefan/ftdetect/uc.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.uc set filetype=uc diff --git a/vimfiles.stefan/ftplugin/a2l.vim b/vimfiles.stefan/ftplugin/a2l.vim new file mode 100644 index 0000000..b0654e7 --- /dev/null +++ b/vimfiles.stefan/ftplugin/a2l.vim @@ -0,0 +1,13 @@ +" Stefans a2l-file plugin + +" don't use spaces for tabs +setlocal expandtab +setlocal tabstop=4 +setlocal shiftwidth=4 +setlocal formatoptions=croq + +" commenting +let b:commentstring = '//' + +" Grep options +"let b:GrepFiles = '*.py' diff --git a/vimfiles.stefan/ftplugin/c.vim b/vimfiles.stefan/ftplugin/c.vim new file mode 100644 index 0000000..e990c9e --- /dev/null +++ b/vimfiles.stefan/ftplugin/c.vim @@ -0,0 +1,99 @@ +" Stefans c-file plugin for bmsk + +" abbreviations +"iabbrev if if ()<left> + +" ---- +" TABS +" ---- +" tab width +let s:tabwidth = 4 +let &l:tabstop = s:tabwidth +" spaces for tabs +"let &softtabstop = s:tabwidth +" smart indent tabs (use spaces for indent else tabs) +"set smarttab +" use spaces for tabs +setlocal expandtab + +" autoindent +" indent mode - one of autoindent, smartindent or cindent +" set autoindent +" set smartindent +setlocal cindent +setlocal cinoptions=*200,)100,(s,w1,W4 +let &l:shiftwidth = s:tabwidth +"setlocal formatoptions=croqwl + +if (g:os == 'linux') + setlocal tags+=/usr/include/tags + setlocal tags+=/usr/X11/include/tags + setlocal tags+=/usr/src/include/linux/tags + + " filesearching + setlocal path=.,/usr/include/** +endif +setlocal suffixesadd=.h + +" commenting +" ---------- +let b:commentstring = "\/\/" + +" Set 'comments' to format dashed lists in comments. +"setlocal comments=sO:*\ -,mO:\ \ \ ,exO:*/,s1:/*,mb:\ ,ex:*/ +setlocal cpoptions-=C + + +" Grep options +let b:GrepFiles = '*.c *.h' + +" Adding spaces where needed +" -------------------------- +let s:nonOperator = '[^=!+-\*/<>]' +let s:nonOperatorNonSpace = '[^ =!+-\*/<>]' +let s:noSpaceNoEol = '.' +let s:noWord = '.' +function! AddSpaceBeforeOperator(pattern) + execute '%substitute@' . + \ '\(' . s:nonOperatorNonSpace . '\)' . + \ '\(' . a:pattern . '\)' . + \ '\(' . s:nonOperator . '\)' . + \ '@\1 \2\3@ec' +endfunction +function! AddSpaceAfterOperator(pattern) + execute '%substitute@' . + \ '\(' . s:nonOperator . '\)' . + \ '\(' . a:pattern . '\)' . + \ '\(' . s:nonOperatorNonSpace . '\)' + \ '@\1\2 \3@c' +endfunction +function! AddSpaceAroundOperator(pattern) + call AddSpaceBeforeOperator(a:pattern) + call AddSpaceAfterOperator(a:pattern) +endfunction + +function! AddSpaceAfter(pattern) + execute '%substitute@' . + \ '\(' . s:noWord . '\)' + \ '\(' . a:pattern . '\)' . + \ '\(' . s:noSpaceNoEol . '\)' + \ '@\1\2 \3@c' +endfunction + +command! ReformatCSpaces call ReformatCSpaces() +function! ReformatCSpaces() +" call AddSpaceAroundOperator('=') +" call AddSpaceAroundOperator('+') +" call AddSpaceAroundOperator('-') +" call AddSpaceAroundOperator('\*') +" call AddSpaceAroundOperator('/') +" call AddSpaceAroundOperator('==') +" call AddSpaceAroundOperator('!=') +" call AddSpaceAroundOperator('+=') +" call AddSpaceAroundOperator('-=') +" call AddSpaceAroundOperator('\*=') +" call AddSpaceAroundOperator('/=') +" call AddSpaceAroundOperator('<=') +" call AddSpaceAroundOperator('>=') + call AddSpaceAfter('if') +endfunction diff --git a/vimfiles.stefan/ftplugin/dosbatch.vim b/vimfiles.stefan/ftplugin/dosbatch.vim new file mode 100644 index 0000000..637fc64 --- /dev/null +++ b/vimfiles.stefan/ftplugin/dosbatch.vim @@ -0,0 +1,4 @@ +" Stefans DOS-Batch-file plugin + +" commenting +let b:commentstring = ":: " diff --git a/vimfiles.stefan/ftplugin/html.vim b/vimfiles.stefan/ftplugin/html.vim new file mode 100644 index 0000000..a511aaf --- /dev/null +++ b/vimfiles.stefan/ftplugin/html.vim @@ -0,0 +1,47 @@ +" Stefans vim-file plugin + +" ---- +" TABS +" ---- +setlocal noexpandtab +setlocal shiftwidth=4 +setlocal tabstop=4 + +setlocal formatoptions=tcroq + +command! -nargs=1 -range HtmlAddTag call HtmlAddTag("<args>", <line1>, <line2>) +function! HtmlAddTag(tag, line1, line2) + let s:visualStart = '`<' + let s:visualEnd = '`>' + " f�r Endtag nur das erste Wort verwenden: + let l:endtag = substitute(a:tag, '\s*\(\w\+\).*', '\1', '') + execute('normal ' . s:visualStart . '"vd' + \ . s:visualEnd . 'i<' . a:tag . ">\<C-R>v</" . l:endtag . '>') +endfunction + +" Tag Select/Wrapper +" These mappings and TagSelection function will allow you to place +" an XML tag around either the current word, or the current selected +" text +"nmap _t viw_t +"vnoremap _t <Esc>:call TagSelection()<CR> +" +"nmap _t viw_t +"vnoremap _t <Esc>:call TagSelection()<CR> +" +"function! TagSelection() +" let l:tag = input("Tag name? ") +" " exec "normal `>a</" . l:tag . ">\e" +" " Strip off all but the first work in the tag for the end tag +" exec "normal `>a</" . +" \ substitute( l:tag, '[ \t"]*\(\<\w*\>\).*', '\1>\e', "" ) +" exec "normal `<i" +" \ substitute( l:tag, '[ \t"]*\(\<.*\)', '<\1>\e', "" ) +"endfunction + + +" commenting +"let b:commentstring = '"' + +" Grep options +let b:GrepFiles = '*.html *.htm' diff --git a/vimfiles.stefan/ftplugin/java.vim b/vimfiles.stefan/ftplugin/java.vim new file mode 100644 index 0000000..f691ae5 --- /dev/null +++ b/vimfiles.stefan/ftplugin/java.vim @@ -0,0 +1,13 @@ +" java filetype plugin +" +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal expandtab +setlocal tabstop=8 + +"set autoindent + +compiler java + +" commenting +let b:commentstring = "\/\/" diff --git a/vimfiles.stefan/ftplugin/make.vim b/vimfiles.stefan/ftplugin/make.vim new file mode 100644 index 0000000..1c8e1af --- /dev/null +++ b/vimfiles.stefan/ftplugin/make.vim @@ -0,0 +1,16 @@ +" Stefans vim-file plugin + +" ---- +" TABS +" ---- +setlocal noexpandtab +setlocal shiftwidth=4 + +setlocal formatoptions=croq + +" commenting +let b:commentstring = '#' + +" Grep options +let b:GrepFiles = '*.mak *.mkinc' + diff --git a/vimfiles.stefan/ftplugin/paf.vim b/vimfiles.stefan/ftplugin/paf.vim new file mode 100644 index 0000000..1799c97 --- /dev/null +++ b/vimfiles.stefan/ftplugin/paf.vim @@ -0,0 +1,20 @@ + +" Adresse der aktuellen Zeile berechnen und in der Statusline anzeigen +command PafGetAddress! call PafGetAddress() +function! PafGetAddress() + let RE = ':\x\{2}\x\{4}02\(\x\{4}\)\x\{2}' + let line = search(RE, 'bcnW') + let ELAR = substitute(getline(line), RE, '0x\10', '') + let RE = ':\x\{2}\x\{4}04\(\x\{4}\)\x\{2}' + let line = search(RE, 'bcnW') + let ESAR = substitute(getline(line), RE, '0x\10000', '') + let RE = ':\x\{2}\(\x\{4}\)00\x\+' + let line = line('.') + let LA = substitute(getline(line), RE, '0x\1', '') + let address = eval(ELAR + ESAR + LA) + return printf('0x%08x', address) +endfunction + +setlocal statusline=%{PafGetAddress()} +setlocal laststatus=2 + diff --git a/vimfiles.stefan/ftplugin/pascal.vim b/vimfiles.stefan/ftplugin/pascal.vim new file mode 100644 index 0000000..61710d7 --- /dev/null +++ b/vimfiles.stefan/ftplugin/pascal.vim @@ -0,0 +1,16 @@ +" Stefans c-file plugin for bmsk + +" set syntax highlighting +setlocal syntax=pascal + +" set compiler +compiler pascal + +" use spaces for tabs +"setlocal expandtab + +" set autoindent +setlocal autoindent + +" abbreviations +"iabbrev if if ()<left> diff --git a/vimfiles.stefan/ftplugin/python.vim b/vimfiles.stefan/ftplugin/python.vim new file mode 100644 index 0000000..a330dd1 --- /dev/null +++ b/vimfiles.stefan/ftplugin/python.vim @@ -0,0 +1,14 @@ +" Stefans python-file plugin + +" don't use spaces for tabs +setlocal noexpandtab +setlocal tabstop=4 +setlocal shiftwidth=4 +setlocal formatoptions=croq + +setlocal tags+=/usr/lib/python/tags +" commenting +let b:commentstring = '#' + +" Grep options +let b:GrepFiles = '*.py' diff --git a/vimfiles.stefan/ftplugin/scons.vim b/vimfiles.stefan/ftplugin/scons.vim new file mode 100644 index 0000000..7335034 --- /dev/null +++ b/vimfiles.stefan/ftplugin/scons.vim @@ -0,0 +1,13 @@ +" Stefans scons-file plugin + +" don't use spaces for tabs +setlocal expandtab +setlocal tabstop=4 +setlocal shiftwidth=4 +setlocal formatoptions=croq + +" commenting +let b:commentstring = '#' + +" Grep options +"let b:GrepFiles = '*.py' diff --git a/vimfiles.stefan/ftplugin/tex.vim b/vimfiles.stefan/ftplugin/tex.vim new file mode 100644 index 0000000..542a466 --- /dev/null +++ b/vimfiles.stefan/ftplugin/tex.vim @@ -0,0 +1,55 @@ +" Stefans vim-file plugin + +" Add Menu-Bar +set guioptions+=m + +" benutze Makefile +let g:Tex_UseMakefile = 1 +let g:Tex_CompileRule_dvi = 'make $*' + +" ---- +" TABS +" ---- +setlocal noexpandtab +setlocal shiftwidth=4 +setlocal expandtab +setlocal tabstop=4 + +" formatting +setlocal formatoptions=tcroq + +" folding +setlocal nofoldenable + +" spell check +setlocal spell + +" commenting +let b:commentstring = '%' + +" Grep options +let b:GrepFiles = '*.tex' + +" Umlaute +command! Tex2Ascii call Tex2Ascii() +command! Ascii2Tex call Ascii2Tex() + +function! Tex2Ascii() + silent! execute '%s/"a/�' + silent! execute '%s/"o/�' + silent! execute '%s/"u/�' + silent! execute '%s/"A/�' + silent! execute '%s/"O/�' + silent! execute '%s/"U/�' + silent! execute '%s/"s/�' +endfunction + +function! Ascii2Tex() + silent! execute '%s/�/"a' + silent! execute '%s/�/"o' + silent! execute '%s/�/"u' + silent! execute '%s/�/"A' + silent! execute '%s/�/"O' + silent! execute '%s/�/"U' + silent! execute '%s/�/"s' +endfunction diff --git a/vimfiles.stefan/ftplugin/trace.vim b/vimfiles.stefan/ftplugin/trace.vim new file mode 100644 index 0000000..ea5cdb3 --- /dev/null +++ b/vimfiles.stefan/ftplugin/trace.vim @@ -0,0 +1,25 @@ +" Vim filetype plugin file +" Language: TPU-Micro-Code for Motorola-Processor +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" Last Change: 22003 Apr 8 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +" ---- +" TABS +" ---- +setlocal expandtab +setlocal shiftwidth=4 + +setlocal formatoptions=croq + +" commenting +let b:commentstring = ';' + +setlocal syntax=trace diff --git a/vimfiles.stefan/ftplugin/uc.vim b/vimfiles.stefan/ftplugin/uc.vim new file mode 100644 index 0000000..f10bba8 --- /dev/null +++ b/vimfiles.stefan/ftplugin/uc.vim @@ -0,0 +1,29 @@ +" Vim filetype plugin file +" Language: TPU-Micro-Code for Motorola-Processor +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" Last Change: 22003 Apr 8 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +"setlocal cindent + + +" Set 'formatoptions' to break comment lines but not other lines, +" and insert the comment leader when hitting <CR> or using "o". +setlocal fo-=t fo+=croql + +" Set 'comments' to format dashed lists in comments. +"setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// + +setlocal syntax=uc + +setlocal tabstop=8 + +" Grep options +let b:GrepFiles = '*.uc' diff --git a/vimfiles.stefan/ftplugin/vim.vim b/vimfiles.stefan/ftplugin/vim.vim new file mode 100644 index 0000000..1cd0a40 --- /dev/null +++ b/vimfiles.stefan/ftplugin/vim.vim @@ -0,0 +1,19 @@ +" Stefans vim-file plugin + +" ---- +" TABS +" ---- +setlocal expandtab +setlocal shiftwidth=4 +setlocal softtabstop=4 + +setlocal formatoptions=croq + +" vimfiles sollen immer im unix-Format gespeichert werden +setlocal fileformat=unix + +" commenting +let b:commentstring = '"' + +" Grep options +let b:GrepFiles = '*.vim' diff --git a/vimfiles.stefan/indent/a2l.vim b/vimfiles.stefan/indent/a2l.vim new file mode 100644 index 0000000..3c5c62c --- /dev/null +++ b/vimfiles.stefan/indent/a2l.vim @@ -0,0 +1,62 @@ +" Vim indent file +" Language: a2l +" Maintainer: Stefan Liebl + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetA2LIndent() +setlocal nolisp +setlocal nosmartindent +setlocal autoindent +setlocal indentkeys+=},=/end + +" Only define the function once +if exists("*GetA2LIndent") + finish +endif + +function GetA2LIndent() + + " Do not change indentation of commented lines. + if exists("b:commentstring") + if getline(v:lnum) =~ '^' . b:commentstring . '.*' + return 0 + endif + endif + + " Find a non-blank line above the current line, that's not a comment + let lnum = prevnonblank(v:lnum - 1) + if exists("b:commentstring") + while getline(lnum) =~ '^' . b:commentstring + let lnum = prevnonblank(lnum - 1) + if lnum == 0 + break + endif + endwhile + endif + + " At the start of the file use zero indent. + if lnum == 0 | return 0 + endif + + let ind = indent(lnum) + let line = getline(lnum) " last line + let cline = getline(v:lnum) " current line + + " Add a 'shiftwidth' after beginning of environments. + " Don't add it for /begin ... /end + if line =~ '/begin' && line !~ '/end' + let ind = ind + &sw + endif + + " Subtract a 'shiftwidth' when an environment ends + if cline =~ '^\s*/end' + let ind = ind - &sw + endif + + return ind +endfunction + diff --git a/vimfiles.stefan/plugin/basics.vim b/vimfiles.stefan/plugin/basics.vim new file mode 100644 index 0000000..a1e88a9 --- /dev/null +++ b/vimfiles.stefan/plugin/basics.vim @@ -0,0 +1,163 @@ +" =========================================================================== +" File: basics.vim +" Author: Stefan Liebl (S.Liebl@gmx.de) +" Description: some usefull standard functions +" +" Must be first file in this directory +" =========================================================================== + +if (v:version < 700) + echo 'update your vim' +endif + +" ---------------- +" useful functions +" ---------------- +function GetLine() + let line_nr = line('.') + let line = getline(line_nr) + return line +endfunction + +function PrintLine(text) + let line_nr = line('.') + let line = GetLine() + echo a:text . line_nr . ' ' . line +endfunction + +command -nargs=1 EchoDebug call EchoDebug(<args>) +function EchoDebug(text) + if exists('g:debug') + if (g:debug > 0) + execute 'echo "' . a:text . '"' + endif + endif +endfunction + +"command -nargs=1 PathNormpath call PathNormpath('<fargs>') +"function PathNormpath(string) +" if (v:version > 602) +" try +"python <<EOF +"import vim +"import os +"string = vim.eval('a:string') +"if string is '': +" path = '' +"else: +" path = os.path.normpath(string) +" path = os.path.normcase(path) +"vim.command("let result = '" + path + "'") +"EOF +" catch /^Vim\%((\a\+)\)\=:E370/ " python not available +" " normalize / +" let result = expand(a:string) +" " delete multiple \ +" let result = substitute(result, '\([^\\]\)\\\+', '\1\\', 'g') +" endtry +" else +" " normalize / +" let result = expand(a:string) +" " delete multiple \ +" let result = substitute(result, '\([^\\]\)\\\+', '\1\\', 'g') +" endif +" return result +"endfunction + +function Single_quote(text) + let output = "'" . a:text . "'" + return output +endfunction + +function Double_quote(text) + let output = '"' . a:text . '"' + return output +endfunction + +function Eval(expression) + if (v:version > 602) + try +python <<EOF +import vim +result = str(eval(vim.eval('a:expression'))) +#print 'result:', result +vim.command('let result = \"' + result + '\"') +EOF + catch /^Vim\%((\a\+)\)\=:E370/ " python not available + throw 'Eval needs python' + let result = a:expression + endtry + else + echoerr 'Eval needs python' + let result = a:expression + endif + return result +endfunction + +function ToInt(expression) + if (v:version > 602) + try + let expression = substitute(a:expression, '\.\d\+', '', '') +python <<EOF +import vim +result = str(int(vim.eval('expression'))) +#print 'result: ', result +vim.command('let result = \"' + result + '\"') +EOF + catch /^Vim\%((\a\+)\)\=:E370/ " python not available + throw 'ToInt needs python' + let result = a:expression + endtry + else + echoerr 'ToInt needs python' + let result = a:expression + endif + return result +endfunction + +function ToHex(expression, bits) + if (v:version > 602) + try + let expression = substitute(a:expression, 'L', '', '') +python <<EOF +import vim +result = hex(long(int(vim.eval('expression')))) +#print 'result: ', result +vim.command('let result = \"' + result + '\"') +EOF + if (a:bits != 0) + let digits = a:bits / 4 + let result = substitute(result, '\(0x\)\x*\(\x\{' . digits . '}\>\)', '\1\2', '') + "echo 'result:'.result.':'. a:bits digits + endif + catch /^Vim\%((\a\+)\)\=:E370/ " python not available + throw 'ToHex needs python' + let result = a:expression + endtry + else + echoerr 'ToHex needs python' + let result = a:expression + endif + return result +endfunction + +" get date +function GetDate() + let l:full_date = system('date /T') + let l:day = matchstr(l:full_date,'\a\+') + let l:date = matchstr(l:full_date,'[0-9.]\+') + return l:date +endfunction + +"function Wait(seconds) +" let starttime = localtime() +" while ((localtime() - starttime) < a:seconds) +" endwhile +"endfunction + +function ReversePatch() + silent execute '!patch -R -o' v:fname_out v:fname_in '<' v:fname_diff +endfunction + +EchoDebug 'loaded _stefan.vim' + diff --git a/vimfiles.stefan/plugin/bmsk.vim b/vimfiles.stefan/plugin/bmsk.vim new file mode 100644 index 0000000..ba5e5f3 --- /dev/null +++ b/vimfiles.stefan/plugin/bmsk.vim @@ -0,0 +1,1031 @@ +if exists('nobmsk') + finish +endif + +if !exists('g:Austausch') + let g:Austausch = fnamemodify('//smuc1805/ee-org/Austausch/ea-92', ':p') +endif +if !exists('g:myAustausch') + let g:myAustausch = fnamemodify(g:Austausch . '/Liebl', ':p') +endif + +" ---- +" Menu +" ---- +let s:BmskMenuLocation = 90 +let s:BMSKmenuname = '&BMSK.' + +" ----------- +" Set Project +" ----------- +command -complete=dir -nargs=1 SetBmskWA let g:bmskWA = '<args>' +command -complete=custom,GetAllBmskProjects -nargs=? SetBmskProject + \ call s:SetBmskProject('<args>') + +function s:SetBmskProject(basedir) + if ((a:basedir == '') && has('browse')) + " Browse for makefile + if exists('g:bmskWA') + let l:bmskWA = g:bmskWA + else + let l:bmskWA = '' + endif + + if exists('b:browsefilter') + let l:browsefilter = b:browsefilter + endif + let b:browsefilter = + \ 'Makefiles (make_fsw.bat)\tmake_fsw.bat\n' . + \ 'Makefiles (makefile*)\tmakefile*\n' . + \ 'All Files (*.*)\t*.*' + let makefile = browse(0, 'Select makefile', l:bmskWA, '') + if exists('l:browsefilter') + let b:browsefilter = l:browsefilter + endif + let basedir = fnamemodify(makefile, ':p:h') + let makefile = fnamemodify(makefile, ':t') + if ((makefile == 'make_fsw.bat') || (makefile == 'makefile.mak') || (makefile == 'makefile')) + call s:SetBmskDirs(basedir) + else + echo 'No makefile:' makefile + endif + else + " set Workarea and basedir + if (isdirectory(a:basedir)) + let basedir = a:basedir + let makefile = fnamemodify(a:basedir . '/make_fsw.bat', ':p') + if !filereadable(makefile) + let makefile = glob(a:basedir . '/*/make_fsw.bat') + let basedir = fnamemodify(makefile, ':p:h') + endif + if (filereadable(makefile)) + call s:SetBmskDirs(basedir) + else + echo 'No makefile' makefile + endif + else + echo 'No directory:' a:basedir + endif + endif +endfunction + +function GetAllBmskProjects(ArgLead, CmdLine, CursorPos) + let projects_txt = fnamemodify($VIMRUNTIME . '/../projects.txt', ':p') + let projects = '' +" if exists('g:bmskWA') +" let projects = projects . GlobLong(g:bmskWA . '/bmsk*') +" endif + if filereadable(projects_txt) + let projects = projects . system('more ' . projects_txt) + endif +" if (a:CursorPos > strlen('SetBmskProject e:')) +" let path = substitute(a:CmdLine, '.*SetBmskProject\s\+\(\f*\)', '\1', '') +" let projects = projects . GlobLong(path) +" endif + return projects +endfunction + +function s:AddAllKnownProjectsToMenu() + let projREGEX = '\(\f\+\)' . "\n" . '\(.*\)' + let projects = GetAllBmskProjects(0, '', 0) + while strlen(projects) > 0 + let project = substitute(projects, projREGEX, '\1', '') + call s:AddBmskProjectToMenu(project) + let projects = substitute(projects, projREGEX, '\2', '') + endwhile +endfunction + +function s:AddBmskProjectToMenu(projectPath) + if isdirectory(a:projectPath) + let projectName = fnamemodify(a:projectPath, ':p:h:t') + exec 'anoremenu ..30 '.s:BMSKmenuname.'&Project.' + \ . escape(projectName, '.') . '<tab>' + \ . ' :SetBmskProject ' . a:projectPath . '<CR>' + endif +endfunction + +function s:DelBmskProjects() + exec 'silent! aunmenu '.s:BMSKmenuname.'&Project' + exec 'anoremenu '.s:BmskMenuLocation.'.10.10 '.s:BMSKmenuname. + \'&Project.&Browse\ for\ makefile<tab>:SetBmskProject'. + \' :SetBmskProject<CR>' + exec 'anoremenu ..25 '. s:BMSKmenuname. + \'&Project.-sep1- :' +endfunction + +function s:BmskRedrawProjectMenu() + call s:DelBmskProjects() + call s:AddAllKnownProjectsToMenu() +endfunction + +function s:BmskRedrawMenu() +" exec 'anoremenu '.s:BmskMenuLocation.'.25 '. s:BMSKmenuname.'-sepsuite0- :' + " Project + call s:BmskRedrawProjectMenu() + if exists('g:bmskdir') + exec 'anoremenu ..20 '.s:BMSKmenuname. + \'&Project.&Update\ Buffers<tab>:BuffersUpdate'. + \' :BuffersUpdate<CR>' + " Settings + exec 'anoremenu .20.10 '.s:BMSKmenuname. + \'&Settings.&Motorvariante<tab>:SetMotorvariante'. + \' :SetMotorvariante<CR>' + exec 'anoremenu ..20 '.s:BMSKmenuname. + \'&Settings.Hardware-&Muster<tab>:SetMuster'. + \' :SetMuster<CR>' + exec 'anoremenu ..30 '.s:BMSKmenuname. + \'&Settings.&Egas<tab>:SetEgas'. + \' :SetEgas<CR>' + exec 'anoremenu ..40 '.s:BMSKmenuname. + \'&Settings.Software-&Stand<tab>:SetSWStand'. + \' :SetSWStand<CR>' + " Compile + exec 'anoremenu .30.10 '.s:BMSKmenuname. + \'&Compile.&Build<tab>:Bmsk'. + \' :Bmsk<CR>' + exec 'anoremenu ..20 '.s:BMSKmenuname. + \'&Compile.&Alle\ Testst�nde<tab>:BmskAll\ Test'. + \' :BmskAll Test<CR>' + exec 'anoremenu ..30 '.s:BMSKmenuname. + \'&Compile.&Lint<tab>:Lint'. + \' :Lint<CR>' + exec 'anoremenu ..35 '.s:BMSKmenuname. + \'&Compile.&Doku\ erstellen<tab>:Bmsk\ doku'. + \' :Bmsk doku<CR>' + exec 'anoremenu ..36 '.s:BMSKmenuname. + \'&Compile.&Einzeldoku\ erstellen<tab>:BmskDoku\ doku\ funktionen="\.\.\."'. + \' :BmskDoku<CR>' + exec 'anoremenu ..40 '.s:BMSKmenuname. + \'&Compile.&Clean<tab>:Bmsk\ clean'. + \' :Bmsk clean<CR>' + exec 'anoremenu ..45 '.s:BMSKmenuname. + \'&Compile.&Clean\ all<tab>:Bmsk\ distclean'. + \' :Bmsk distclean<CR>' + exec 'anoremenu ..50 '. s:BMSKmenuname. + \'&Compile.-sep- :' + exec 'anoremenu ..60 '.s:BMSKmenuname. + \'&Compile.&Show\ Errors<tab>:cl'. + \' :cl<CR>' + exec 'anoremenu ..70 '.s:BMSKmenuname. + \'&Compile.&Open\ Error\ Window<tab>:copen'. + \' :copen<CR>' + exec 'anoremenu ..75 '.s:BMSKmenuname. + \'&Compile.&Parse\ make\.log<tab>:cfile\ out/make\.log'. + \' :cfile out/make.log<CR>' + exec 'anoremenu ..80 '.s:BMSKmenuname. + \'&Compile.Goto\ &Error<tab>:cc'. + \' :cc<CR>' + exec 'anoremenu ..90 '.s:BMSKmenuname. + \'&Compile.Goto\ &next\ Error<tab>:cn'. + \' :cn<CR>' + exec 'anoremenu ..100 '. s:BMSKmenuname. + \'&Compile.-sep1- :' + exec 'anoremenu ..110 '.s:BMSKmenuname. + \'&Compile.&A2L-Patch<tab>:A2L'. + \' :A2L<CR>' + exec 'anoremenu ..120 '.s:BMSKmenuname. + \'&Compile.Copy\ output\ to\ &Austausch<tab>:COPYoutput'. + \' :COPYoutput<CR>' + exec 'anoremenu ..130 '.s:BMSKmenuname. + \'&Compile.&Rename\ output<tab>:RENAMEoutput'. + \' :RENAMEoutput<CR>' + " Tools + exec 'anoremenu .40.10 '.s:BMSKmenuname. + \'&Tools.&A2L-Patch<tab>:A2L'. + \' :A2L<CR>' + exec 'anoremenu ..20 '.s:BMSKmenuname. + \'&Tools.Copy\ output\ to\ &Austausch<tab>:COPYoutput'. + \' :COPYoutput<CR>' + exec 'anoremenu ..30 '.s:BMSKmenuname. + \'&Tools.&Rename\ output<tab>:RENAMEoutput'. + \' :RENAMEoutput<CR>' + exec 'anoremenu ..40 '. s:BMSKmenuname. + \'&Tools.-sep1- :' + exec 'anoremenu ..50 '.s:BMSKmenuname. + \'&Tools.&Check\ A2L\ Types<tab>:BmskCheckA2l'. + \' :BmskCheckA2l<CR>' + " Search + exec 'anoremenu .50.10 '.s:BMSKmenuname. + \'&Search.&Grep<tab>:GrepBmsk'. + \' :GrepBmsk<CR>' + exec 'anoremenu ..20 '.s:BMSKmenuname. + \'&Search.Goto\ &Cscope-Tag<tab>:cscope'. + \' :cscope find i <C-R><C-W><CR>' + exec 'anoremenu ..30 '.s:BMSKmenuname. + \'&Search.Goto\ &CTag<tab>:tag'. + \' :tag <C-R><C-W><CR>' + exec 'anoremenu ..40 '.s:BMSKmenuname. + \'&Search.List\ &CTags<tab>:tselect'. + \' :tselect /<C-R><C-W><CR>' + exec 'anoremenu ..50 '.s:BMSKmenuname. + \'&Search.Update\ c&tags<tab>:Bmsk\ ctags'. + \' :Bmsk ctags<CR>' + exec 'anoremenu ..60 '.s:BMSKmenuname. + \'&Search.Update\ C&scope<tab>:Bmsk\ cscope'. + \' :Bmsk cscope<CR>' + exec 'anoremenu ..70 '.s:BMSKmenuname. + \'&Search.Disconnect\ C&scope<tab>:cscope\ kill\ -1'. + \' :cscope kill -1<CR>' + " BuildManager + exec 'anoremenu .60.10 '.s:BMSKmenuname. + \'&BuildManager.&Entwicklerstand<tab>:BmskAll\ Entwickler'. + \' :BmskAll Entwickler<CR>' + exec 'anoremenu ..20 '.s:BMSKmenuname. + \'&BuildManager.&Serienstand<tab>:BmskAll\ Serie'. + \' :BmskAll Serie<CR>' + exec 'anoremenu ..30 '.s:BMSKmenuname. + \'&BuildManager.&Deliver\ Products<tab>:CopyProgrammstand'. + \' :CopyProgrammstand<CR>' + exec 'anoremenu ..40 '.s:BMSKmenuname. + \'&BuildManager.&Task\ Report<tab>:TaskReport'. + \' :TaskReport<CR>' + endif +endfunction + +" ----------------- +" Men� BMSK anlegen +" ----------------- +if !exists('nobmskmenu') + call s:BmskRedrawMenu() + exec 'anoremenu .42 Hilfe.-BMSK- :' + exec 'anoremenu .43 Hilfe.BMSK<tab> :help bmsk<CR>' +endif + +" ----------------------- +" Alle Buffer neu anlegen +" ----------------------- +command BuffersUpdate call BuffersUpdate() +function BuffersUpdate() + " alle Buffer l�schen + let last_buffer = bufnr('$') + execute '1,' . last_buffer . 'bdelete' + + " load all bmsk-files as buffers + try +python <<EOF +import vim +import os +basedir = vim.eval('GetBmskDir()') +parsedirs = ['sw', 'config', 'make', 'fremd'] +bufferExtentions = ['.c', '.h', '.kgs', '.dat', '.osp', '.mak', '.mkink'] +specialFiles = ['makefile'] +def AddAllFiles(basedir, path, files): + print path + #print 'Extentions:', bufferExtentions + for file in files: + bufferExtention = os.path.splitext(file)[1] + #print 'BufExt:', bufferExtention + if ((bufferExtention in bufferExtentions) or (file in specialFiles)): + buffername = os.path.join(path, file).replace(basedir + '//','') + #print buffername + vim.command('badd ' + buffername) +# start adding buffers +for dir in parsedirs: + parsedir = os.path.join(basedir, dir) + os.path.walk(parsedir, AddAllFiles, basedir) +EOF + catch /^Vim\%((\a\+)\)\=:E370/ " python not available + echo 'BuffersUpdate needs python' + endtry +endfunction + +" ----------- +" bmsk Muster +" ----------- +command -nargs=? SetMuster call SetMuster('<args>') +function SetMuster(Muster) + if (a:Muster == '') + let l:Muster = confirm('Muster:', "&default\nC&0\nC&1\nC&2\nC&5", 1, 'Question') + if l:Muster == 1 + let g:Muster = '' + elseif l:Muster == 2 + let g:Muster = 'C0' + elseif l:Muster == 3 + let g:Muster = 'C1' + elseif l:Muster == 4 + let g:Muster = 'C2' + elseif l:Muster == 5 + let g:Muster = 'C5' + else + echo 'Abbruch' + return + endif + else + let g:Muster = a:Muster + endif + call s:SetBmskDirs(g:bmskdir) +endfunction + +" ----------- +" bmsk Egas +" ----------- +command -nargs=? SetEgas call SetEgas('<args>') +function SetEgas(Egas) + if (a:Egas == '') + let l:Egas = confirm('Egas:', "&default\n&0\n&1\n&2", 1, 'Question') + if l:Egas == 1 + let g:Egas = '' + elseif l:Egas == 2 + let g:Egas = '0' + elseif l:Egas == 3 + let g:Egas = '1' + elseif l:Egas == 4 + let g:Egas = '2' + else + echo 'Abbruch' + return + endif + else + let g:Egas = a:Egas + endif + call s:SetBmskDirs(g:bmskdir) +endfunction + +" ------------- +" bmsk Baureihe +" ------------- +command -nargs=? SetMotorvariante call s:SetMotorvariante('<args>') +function s:SetMotorvariante(Motor) + if a:Motor == '' + let l:Motor = confirm('Motor:', "&default\nK&25\nK&40\nK&46\nK&71", 1, 'Question') + if l:Motor == 1 + let g:Motor = '' + elseif l:Motor == 2 + let g:Motor = 'K25' + elseif l:Motor == 3 + let g:Motor = 'K40' + elseif l:Motor == 4 + let g:Motor = 'K46' + let g:Egas = '1' + elseif l:Motor == 5 + let g:Motor = 'K71' + else + echo 'Abbruch' + return + endif + else + let g:Motor = a:Motor + endif + call s:SetBmskDirs(g:bmskdir) +endfunction + +" ------------- +" bmsk SW_Stand +" ------------- +command -nargs=? SetSWStand call SetSWStand('<args>') +function SetSWStand(SW_Stand) + if (a:SW_Stand == '') + let l:SW_Stand = confirm('SW_Stand:', "&default\n&Test\n&Entwickler\n&Serie", 1, 'Question') + if l:SW_Stand == 1 + let g:SW_Stand = '' + elseif l:SW_Stand == 2 + let g:SW_Stand = 'Test' + elseif l:SW_Stand == 3 + let g:SW_Stand = 'Entwickler' + elseif l:SW_Stand == 4 + let g:SW_Stand = 'Serie' + else + echo 'Abbruch' + return + endif + else + let g:SW_Stand = a:SW_Stand + endif + call s:SetBmskDirs(g:bmskdir) +endfunction + +" ---------- +" bmsk Xlint +" ---------- +command -nargs=? SetXlint call SetXlint('<args>') +function SetXlint(Xlint) + if (a:Xlint == '') + let l:Xlint = inputdialog('Xlint:', g:Xlint, 'cancel') + if l:Xlint == 'cancel' + return + else + g:Xlint = l:Xlint + endif + else + let g:Xlint = a:Xlint + endif + call s:SetBmskDirs(g:bmskdir) +endfunction + + +" ----------- +" Directories +" ----------- + +function s:SetBmskDirs(bmskdir) + " R�cksetzen der Make-Variablen + unlet! g:OutDir + unlet! g:ProductDir + unlet! g:DfilesDir + unlet! g:CscopeFile + unlet! g:CTagsFile + unlet! g:PTagsFile + unlet! g:Goals + unlet! g:Programname + unlet! g:OutDirVariante + unlet! g:bmsk_stand + + " Variablen erzeugen, damit GetMakeVar funktioniert + if !exists('g:Muster') + let g:Muster = '' + endif + if !exists('g:Egas') + let g:Egas = '' + endif + if !exists('g:Motor') + let g:Motor = '' + endif + if !exists('g:SW_Stand') + let g:SW_Stand = '' + endif + if !exists('g:Xlint') + let g:Xlint = '' + endif + + " bmsk dirs + let g:bmskdir = substitute(fnamemodify(a:bmskdir, ':p'), '\\', '/', 'g') + + " cd to bmskdir + execute 'cd ' . g:bmskdir + compiler bmsk + + " Default-Werte aus Make �bernehmen + call GetAllMakeVars() + + if g:Muster == '' + let g:Muster = GetMakeVar('Muster') + endif + if g:Egas == '' + let g:Egas = GetMakeVar('Egas') + endif + if g:Motor == '' + let g:Motor = GetMakeVar('Motor') + endif + if g:SW_Stand == '' + let g:SW_Stand = GetMakeVar('Stand') + endif + if g:Xlint == '' + let g:Xlint = GetMakeVar('DIAB_LINT_OPTION') + endif + + " bmsk dirs + let g:bmskWA = fnamemodify(g:bmskdir, ':h:h') + let g:bmskProject = fnamemodify(g:bmskdir, ':h:h:t') + let g:bmsk_sw = fnamemodify(g:bmskdir . '/sw', ':p') + let g:bmsk_bios = fnamemodify(g:bmskdir . '/sw/bios', ':p') + let g:bmsk_d = GetDfilesDir() + let g:bmsk_stand = GetStandDir() + let g:OutDir = GetOutDir() + let g:OutDirVariante = GetOutDirVariante() + let g:bmsk_ext = '*.c *.h *.kgs *.d *.dat *.mak *.inv' + + " cd path + let &cdpath = g:bmskdir + " browse-dir + set browsedir=buffer + " search path + set path& + let &path = &path . ',' . g:bmskdir.'' + let &path = &path . ',' . g:bmskdir.'config/**' + let &path = &path . ',' . g:bmskdir.'diagnose/**' + let &path = &path . ',' . g:bmskdir.'doku/**' + let &path = &path . ',' . g:bmskdir.'fremd/**' + let &path = &path . ',' . g:bmskdir.'make/**' + let &path = &path . ',' . g:OutDir + let &path = &path . ',' . g:OutDir.'defndep/**' + let &path = &path . ',' . g:OutDir.'doku/**' + let &path = &path . ',' . g:OutDirVariante.'**' + let &path = &path . ',' . g:bmskdir.'product/**' + let &path = &path . ',' . g:bmskdir.'sw/**' + let &path = &path . ',' . g:bmskdir.'tools/**' + let &path = substitute(&path, '\\', '/', 'g') + " files for tags (may not start with './', since . is the path of the + " current file + let &tags = substitute(GetCTagsFile(), '^\..', '', '') . ',' . substitute(GetPTagsFile() , '^\..', '', '') + + " Grep Dir and Extentions + let g:GrepDir = g:bmsk_sw + let g:GrepFiles = '*.c *.h *.kgs' + + " cscope + let &cscopeprg = GetCscopePrg() + cscope kill -1 + let reffile = GetCscopeFile() + if (filereadable(reffile)) + execute 'cscope add' reffile + endif + + call s:BmskRedrawMenu() + call GetGoals() + + " Python + let g:python = fnamemodify(g:bmskdir . '/tools/python/v2.1a2/python.exe', ':p') + + " Titel-Leiste + set titlelen=100 + let &titlestring = '%t - (%-F) - %=BMSK: %{g:bmskProject}' + \ . ' Motor: %{g:Motor} Muster: %{g:Muster} Egas: %{g:Egas} SW-Stand: %{g:SW_Stand}' + +endfunction + +" make backups +set backup " keep a backup file +set backupext=~ + +"------------------------- +function GetAllMakeVars() +"------------------------- + let varnames = {} + let varnames['Muster'] = 'Muster' + let varnames['Egas'] = 'Egas' + let varnames['Motor'] = 'Motor' + let varnames['SW_Stand'] = 'Stand' + let varnames['Xlint'] = 'DIAB_LINT_OPTION' + let varnames['OutDir'] = 'OUTDIR' + let varnames['ProductDir'] = 'OUTDIR_PRODUCTS' + let varnames['DfilesDir'] = 'OUTDIR_D_FILES' + let varnames['bmsk_stand'] = 'OUTDIR_STAND' + let varnames['OutDirVariante'] = 'OUTDIR_VARIANTE' + let varnames['CscopePrg'] = 'CSCOPE' + let varnames['CscopeFile'] = 'CSCOPEFILE' + let varnames['CTagsFile'] = 'CTAGFILE' + let varnames['PTagsFile'] = 'PTAGFILE' + let varnames['Goals'] = 'GOALS' + let varnames['Programname'] = 'PROGRAMNAME' + let varlist = GetMakeVars(values(varnames)) + for var in items(varnames) + if has_key(varlist, var[1]) + let g:{var[0]} = varlist[var[1]] + endif + endfor +endfunction + +" ------------------- +function GetBmskDir() +" ------------------- + if !exists('g:bmskdir') + echo 'Bitte erst Projekt w�hlen' + SetBmskProject + endif + return g:bmskdir +endfunction + +" --------------------- +function GetBmskSwDir() +" --------------------- + if !exists('g:bmskdir') + echo 'Bitte erst Projekt w�hlen' + SetBmskProject + endif + return g:bmsk_sw +endfunction + +" ------------------ +function GetOutDir() +" ------------------ + if !exists('g:OutDir') + let g:OutDir = GetMakeVar('OUTDIR') + endif + if (g:OutDir != '') + let g:OutDir = fnamemodify(g:OutDir, ':p') + endif + return g:OutDir +endfunction + +" ---------------------- +function GetProductDir() +" ---------------------- + if !exists('g:ProductDir') + let g:ProductDir = GetMakeVar('DELIVERY_PATH') + if (g:ProductDir == '') + let g:ProductDir = GetMakeVar('OUTDIR_PRODUCTS') + endif + endif + if (g:ProductDir != '') + let g:ProductDir = fnamemodify(g:ProductDir, ':p') + endif + return g:ProductDir +endfunction + +" --------------------- +function GetDfilesDir() +" --------------------- + if !exists('g:DfilesDir') + let g:DfilesDir = GetMakeVar('D_FILES_DIR') + if (g:DfilesDir == '') + let g:DfilesDir = GetMakeVar('OUTDIR_D_FILES') + endif + if (g:DfilesDir != '') + let g:DfilesDir = fnamemodify(g:DfilesDir, ':p') + endif + endif + return g:DfilesDir +endfunction + +" -------------------- +function GetStandDir() +" -------------------- + if !exists('g:bmsk_stand') + let g:bmsk_stand = GetMakeVar('OUTDIR_STAND') + endif + if (g:bmsk_stand != '') + let g:bmsk_stand = fnamemodify(g:bmsk_stand, ':p') + endif + return g:bmsk_stand +endfunction + +" -------------------------- +function GetOutDirVariante() +" -------------------------- + if !exists('g:OutDirVariante') + let g:OutDirVariante = GetMakeVar('OUTDIR_VARIANTE') + endif + if (g:OutDirVariante != '') + let g:OutDirVariante = fnamemodify(g:OutDirVariante, ':p') + endif + return g:OutDirVariante +endfunction + +" ---------------------- +function GetCscopePrg() +" ---------------------- + if !exists('g:CscopePrg') + let g:CscopePrg = GetMakeVar('CSCOPE') + endif + if (g:CscopePrg != '') + let g:CscopePrg = fnamemodify(g:CscopePrg, ':p') + endif + return g:CscopePrg +endfunction + +" ---------------------- +function GetCscopeFile() +" ---------------------- + if !exists('g:CscopeFile') + let g:CscopeFile = GetMakeVar('CSCOPEFILE') + endif + if (g:CscopeFile != '') + let g:CscopeFile = fnamemodify(g:CscopeFile, ':p') + endif + return g:CscopeFile +endfunction + +" --------------------- +function GetCTagsFile() +" --------------------- + if !exists('g:CTagsFile') + let g:CTagsFile = GetMakeVar('CTAGFILE') + endif + if (g:CTagsFile != '') + let g:CTagsFile = fnamemodify(g:CTagsFile, ':p') + endif + return g:CTagsFile +endfunction + +" --------------------- +function GetPTagsFile() +" --------------------- + if !exists('g:PTagsFile') + let g:PTagsFile = GetMakeVar('PTAGFILE') + endif + if (g:PTagsFile != '') + let g:PTagsFile = fnamemodify(g:PTagsFile, ':p') + endif + return g:PTagsFile +endfunction + +" ----------------- +function GetGoals() +" ----------------- + if !exists('g:Goals') + let g:Goals = GetMakeVar('GOALS') + endif + return g:Goals +endfunction + +" ----------------------- +function GetProgramname() +" ----------------------- + if !exists('g:Programname') + let g:Programname = GetMakeVar('PROGRAMNAME') + endif + return g:Programname +endfunction + +" define and include +"set define=^#\s*define +"set include=^#\s*include +"set includeexpr='' + +"command CleanSRCfile %s/\.L\d{3,4\}/.L0000/ce +"command CleanSRCfile %s/^#\tr\d\{1,2\}\t\t\$\$\d\{2,3\}\n//ce +command CleanSRCfile %s/^#\t\(\(r\d\{1,2\}\t\)\|\(not allocated\)\)\t\(\(\$\$\d\{1,3\}\)\|\([xyz]\)\)\n//ce + +"function s:GetA2Lfile() +" let a2lfile = glob(GetProductDir() . '/*.a2l') +" return a2lfile +"endfunction + +" ---- +" tags +" ---- + +command CscopeConnect call s:CscopeConnect() +function s:CscopeConnect() + let reffile = GetCscopeFile() + if (filereadable(reffile)) + execute 'cscope add' reffile + endif +endfunction + +" significant characters in tags +set taglength=0 +set notagrelative + +" ------------ +" grep program +" ------------ +command -nargs=? GrepBmsk call GrepFull(GetBmskSwDir(), '*.c *.h *.kgs', '<args>') + +" ---------------- +" Make and compile +" ---------------- +command -complete=custom,GetAllBmskTargets -nargs=* Bmsk call s:Bmsk('<args>') +command -complete=custom,GetAllBmskTargets -nargs=* BmskDoku call s:BmskDoku('<args>') +command -nargs=* Clean compiler bmsk | Clean <args> +command -nargs=* CleanAll compiler bmsk | CleanAll <args> +command -nargs=* LintOld Bmsk <args> lint file=%:p +command -nargs=* Lint Bmsk <args> %:t:r.lint +command -complete=customlist,GetAllBmskSWStand -nargs=1 BmskAll call s:BmskAll('<args>') + +" Programmstand compilieren +function s:Bmsk(args) + echo a:args + cscope kill -1 + compiler bmsk + execute 'Make ' . a:args + CscopeConnect + clist +endfunction + +" Dokumentation erzeugen (Verwenden des LaTeX errorparsers) +function s:BmskDoku(args) + echo a:args + let command = 'Make ' . a:args . ' ' + if match(a:args, '\(^\|\s\)\w\+\($\|\s\+\)') < 0 + " kein Target angegeben, doku verwenden + let command = command . 'doku ' + endif + if match(a:args, '\<funktionen\>') < 0 + " keine Funktionen angegeben + if &filetype == 'tex' + let funktionen = expand('%:t:r') + else + let funktionen = '' + endif + let funktionen = inputdialog('funktionen:', funktionen, 'cancel') + if funktionen == 'cancel' + return + endif + let command = command . 'funktionen="' . funktionen . '"' + endif + + cscope kill -1 + compiler tex + let &makeprg = g:makeprg . ' $*' + let latexflags = '-interaction=nonstopmode' + execute command . ' LATEXFLAGS=' . latexflags + CscopeConnect + clist +endfunction + +" Erzeugen aller Programmst�nde +function s:BmskAll(Stand) + " Software Stand gegebenenfalls einstellen + if (a:Stand != '') && (g:SW_Stand != a:Stand) + call SetSWStand(a:Stand) + endif + execute 'Bmsk all' . g:SW_Stand +endfunction + +" Alle Software-St�nde als VimList +function GetAllBmskSWStand(ArgLead, CmdLine, CursorPos) + let StandList = ['Test', 'Entwickler', 'Serie'] + return StandList +endfunction + +" Alle Make-Targets als Text Liste +function GetAllBmskTargets(ArgLead, CmdLine, CursorPos) + let goals = GetGoals() + if goals == '' + let targets = 'Programmstand' + let targets = targets . "\n" . 'clean' + let targets = targets . "\n" . 'cleanall' + let targets = targets . "\n" . 'cleanProducts' + let targets = targets . "\n" . 'allTest' + let targets = targets . "\n" . 'allEntwickler' + let targets = targets . "\n" . 'allSerie' + let targets = targets . "\n" . 'patch_a2l' + let targets = targets . "\n" . 'check_memory' + let targets = targets . "\n" . 'create_csv' + let targets = targets . "\n" . 'create_arcus_csv' + let targets = targets . "\n" . 'import_arcus_csv' + let targets = targets . "\n" . 'boschsig' + let targets = targets . "\n" . 'archivate' + let targets = targets . "\n" . 'lint file=' . expand('%:p') + let targets = targets . "\n" . 'tags' + let targets = targets . "\n" . 'ctags' + let targets = targets . "\n" . 'ptags' + let targets = targets . "\n" . 'cscope' + let targets = targets . "\n" . 'ccm_products_checkout CCM=' . g:ccm + let targets = targets . "\n" . 'help' + else + let targets = substitute(goals, '\s\+', '\n', 'g') + let targets = targets . "\n" . expand('%:t:r') . '.obj' + let targets = targets . "\n" . expand('%:t:r') . '.i' + let targets = targets . "\n" . expand('%:t:r') . '.src' + let targets = targets . "\n" . expand('%:t:r') . '.lint' + let targets = targets . "\n" . 'FORCE_PROGID=no' + let targets = targets . "\n" . 'MAKE_DBG=2' + let targets = targets . "\n" . 'EXTRA_C_FLAGS=' + let targets = targets . "\n" . 'DIAB_OPTIMIZE=' + let targets = targets . "\n" . 'MAIN_MAKEFILES=' + let targets = targets . "\n" . 'ALL_EXIT=' + endif + return targets +endfunction + +" ----------------------------------- +" include extra-variables to a2l-file +" ----------------------------------- +command PatchA2L call s:A2L_EXTENTION() +function s:A2L_EXTENTION() + execute 'compiler bmsk' + execute '!start make_fsw.bat patch_a2l ' . g:makeopts . ' & pause' +endfunction + +" ------------------------------------- +" Compilierte Files auf Server copieren +" ------------------------------------- +command COPYoutput call s:CopyOutputFilesToAustausch() +function s:CopyOutputFilesToAustausch() + let destination = fnamemodify(g:myAustausch . '/' . g:Motor . g:Muster . g:Egas, ':p') + echo destination + if isdirectory(g:myAustausch)==0 + echo 'mkdir Liebl' + call system(g:mkdir . g:myAustausch) + endif + if isdirectory(destination)==0 + echo 'mkdir' destination + call system(g:mkdir . destination) + endif + call system(g:rm_f . destination . '\*.*') + let sourceDir = GetProductDir() + call s:CopyOutputFiles(sourceDir, destination) +endfunction + +command CopyProgrammstand call s:CopyProgrammstand() +function s:CopyProgrammstand() + let pstDir = browsedir('Verzeichnis des Programmstands', 'c:') + let Variants = s:GetOutputVariants() + for variante in Variants + let varianteOrig = fnamemodify(GetOutDirVariante(), ':h:t') + let sourceDir = substitute(GetProductDir(), varianteOrig, variante, '') + let destDir = expand(pstDir . '/' . strpart(variante, 0, 2) . 'x' . '/' . variante) + if !isdirectory(destDir) + echo destDir . ' is not a directory' + else + call system(g:cp . sourceDir . '\\*.* ' . destDir) + endif + endfor +endfunction + +function! s:GetOutputVariants() + let Variants = split(system('dir /B out\\K*'), "\n") + return Variants +endfunction + +function s:CopyOutputFiles(sourceDir, destination) + let destination = fnamemodify(a:destination, ':p') + let ProgID = GetProgramname() + let files = fnamemodify(a:sourceDir . '/' . ProgID, ':p') . '*.*' + let command = g:cp . files . ' ' . destination + echo command + call system(command) + let files = fnamemodify(a:sourceDir . '/' . strpart(ProgID, 3, 3) . '*.daf', ':p') + let command = g:cp . files . ' ' . destination + echo command + call system(command) +endfunction + +" ---------------------------- +" Compilierte Files umbenennen +" ---------------------------- +command -nargs=? RENAMEoutput call s:RENAMEoutput('<args>') +function s:RENAMEoutput(pattern) + if (a:pattern == '') + let l:pattern = inputdialog('pattern:', '_test01', '') + else + let l:pattern = a:pattern + endif + let product_path = GetProductDir() + let ProgID = GetProgramname() + call s:RenameFile(fnamemodify(product_path . '/' . ProgID . '.DCM', ':p'), l:pattern) + call s:RenameFile(fnamemodify(product_path . '/' . ProgID . '.ELF', ':p'), l:pattern) + call s:RenameFile(fnamemodify(product_path . '/' . ProgID . '.a2l', ':p'), l:pattern) + call s:RenameFile(fnamemodify(product_path . '/' . ProgID . '_patch.a2l', ':p'), l:pattern) + call s:RenameFile(fnamemodify(product_path . '/' . ProgID . '.map', ':p'), l:pattern) + call s:RenameFile(fnamemodify(product_path . '/' . ProgID . '.paf', ':p'), l:pattern) + call s:RenameFile(fnamemodify(product_path . '/' . ProgID . '.s19', ':p'), l:pattern) + call s:RenameFile(fnamemodify(product_path . '/' . ProgID . '_BOSCH.s19', ':p'), l:pattern) + call s:RenameFile(fnamemodify(product_path . '/' . strpart(ProgID, 3, 3) . 'BXXXX.daf', ':p'), l:pattern) +endfunction + +function s:RenameFile(File, Pattern) + if (filereadable(a:File)) + let newfile = fnamemodify(a:File, ':p:r') . a:Pattern . '.' + \ . fnamemodify(a:File, ':e') + call rename(a:File, newfile) + endif +endfunction + +"--------------------- +" Task Report erzeugen +"--------------------- +command TaskReport call s:TaskReport() +function s:TaskReport() + let b:browsefilter = 'Textfiles \t*.txt\n' + let file = browse(1, 'Select File for Task Report', 'c:', g:bmskProject . '.txt') + execute 'Bmsk ccm_task_report file=' . fnamemodify(file, ':p') +endfunction + +" ------------------------------------------ +" �berpr�fen der File-Inodes der EEEmulation +" ------------------------------------------ +command FindEEEmuFile call s:FindEEEmuFile() +function s:FindEEEmuFile() + + let typeFile = '0000F1DE' + let address = 'S325\x\{8}' + let linebreak = '\(\x\{2}\n' . address . '\)\?' + let longword = '\x\{8}' + let stateValid = 'BABABABA' + let fileNames = '\(000005FB\|000000FC\|000000E5\|000000BB\|00000B55\|00005B55\|00000CCB\|00EEEF15\)' + + let fileNameValid = typeFile + \ . linebreak + \ . fileNames + let fileName = typeFile + \ . linebreak + \ . longword + let fileStateValid = typeFile + \ . linebreak + \ . longword + \ . linebreak + \ . longword + \ . linebreak + \ . stateValid + let fileState = typeFile + \ . linebreak + \ . longword + \ . linebreak + \ . longword + \ . linebreak + \ . longword + let fileInode = typeFile + \ . linebreak + \ . longword + \ . linebreak + \ . longword + \ . linebreak + \ . longword + + execute 'syntax match fileInode "' . fileInode + \.'" contains=address,fileState,fileStateValid' + execute 'syntax match fileState "' . fileState + \.'"hs=e-7 contained contains=address,fileName,fileNameValid' + execute 'syntax match fileStateValid "' . fileStateValid + \.'"hs=e-7 contained contains=address,fileName,fileNameValid' + execute 'syntax match fileName "' . fileName + \.'"hs=e-7 contained contains=address' + execute 'syntax match fileNameValid "' . fileNameValid + \.'"hs=e-7 contained contains=address' + execute 'syntax match address "' . address + \.'" contained contains=fileName,fileNameValid' + + hi def link fileInode Constant + hi def link fileState PreCondit + hi def link fileStateValid Label + hi def link fileName PreCondit + hi def link fileNameValid Identifier + hi def link address Constant + + " damit mit n weitergesprungen werden kann + let @/ = typeFile + setlocal nohlsearch +endfunction diff --git a/vimfiles.stefan/plugin/ccm.vim b/vimfiles.stefan/plugin/ccm.vim new file mode 100644 index 0000000..0a5c0eb --- /dev/null +++ b/vimfiles.stefan/plugin/ccm.vim @@ -0,0 +1,531 @@ +" =========================================================================== +" File: ccm.vim +" Author: Stefan Liebl (S.Liebl@gmx.de) +" Description: handles version controlling with Continuus +" =========================================================================== + +if exists('g:noccm') + finish +endif + +" -------------------------- +" config datei f�r Continuus +" -------------------------- +if !exists('g:ccm') + let g:ccm = 'ccm ' +endif + + +" -------- +" commands +" -------- +command -nargs=0 CCMconnect call s:CCMconnect() +command -nargs=? CCMcheckout call s:CCMcheckout(expand('%:p'), '<args>') +command -nargs=? CCMcheckpoint call s:CCMcheckpoint(expand('%:p'), '<args>') +command -nargs=0 CCMchangeable call s:CCMchangeable('qx13468') +command -nargs=0 CCMdiff call s:CCMdiff(expand('%:p')) +command -nargs=0 CCMobject call s:CCM_get_object(expand('%:p')) +command -nargs=0 CCMhistory call s:CCMhistory(expand('%:p')) + +" ---- +" Menu +" ---- +let s:CCMMenuLocation = 100 +let s:CCMmenuname = '&CCM.' + +"------------------------- +function s:CCMRedrawMenu() +"------------------------- + exec 'anoremenu '.s:CCMMenuLocation.'.40 '.s:CCMmenuname. + \'check\ &out<tab>:CCMcheckout'. + \' :CCMcheckout<CR>' + exec 'anoremenu '.s:CCMMenuLocation.'.40 '.s:CCMmenuname. + \'check&point<tab>:CCMcheckpoint'. + \' :CCMcheckpoint ""<CR>' + exec 'anoremenu '.s:CCMMenuLocation.'.40 '.s:CCMmenuname. + \'&diff<tab>:CCMdiff'. + \' :CCMdiff<CR>' + exec 'anoremenu '.s:CCMMenuLocation.'.40 '.s:CCMmenuname. + \'show\ &history<tab>:CCMhistory'. + \' :CCMhistory<CR>' +endfunction + +if !exists('noccmmenu') + call s:CCMRedrawMenu() +endif + +" ------------------- +" Regular Expressions +" ------------------- +let s:any = '.*' +let s:word = '\(\w\+\)' +let s:noPathSeparator = '\([^/\\]\+\)' + +"----------------------------- +function s:CCM_run_silent(cmd) +"----------------------------- + let expression = g:ccm .' '. a:cmd + echo expression + let output = system(expression) + return split(output, "\n") +endfunction + +"---------------------- +function s:CCM_run(cmd) +"---------------------- + call s:CCMconnect() + let output = s:CCM_run_silent(a:cmd) + for line in output + echo line + endfor + echo '---' + return output +endfunction + +let s:connected = 0 +"------------------------- +function s:CCMconnected() +"------------------------- + let output = s:CCM_run_silent('status') + if (match(output, "Current project:") >= 0) + let s:connected = 1 + endif + return s:connected +endfunction + +"----------------------- +function s:CCMconnect() +"----------------------- + if !s:connected + if !s:CCMconnected() + let output = s:CCM_run_silent('start') + let s:connected = 1 + endif + endif +endfunction + +"--------------------------- +function s:Set_compare_cmd() +"--------------------------- + let vimdiff = g:gvim + let commands = ' -c ' . '\"winsize 201 60\" -c \"set winwidth=100\"' + let options = ' -d' . ' %file1 %file2' . ' --servername DIFF' + let compare_cmd = Double_quote(vimdiff . commands . options) + let output = s:CCM_run('set cli_compare_cmd ' . compare_cmd) + "let output = s:CCM_run('set compare_cmd') +endfunction + +"--------------------------- +function s:CCM_query(string) +"--------------------------- + let query_string = 'query ' . a:string + let query_format = ' /nf /no_sort /u /f ' . '"%objectname"' + let output = s:CCM_run(query_string . query_format) + return output +endfunction + +"------------------------------- +function s:CCM_get_owner(object) +"------------------------------- + let query_string = 'properties ' . a:object['objectname'] + let query_format = ' /f ' . '"%owner"' + let output = s:CCM_run(query_string . query_format) + return output +endfunction + +"-------------------------------- +function s:CCM_long_query(string) +"-------------------------------- + let query_string = 'query ' . a:string + let query_format = ' /u /f ' . '"%objectname %status %owner %task"' + let output = s:CCM_run(query_string . query_format) + return output +endfunction + +"------------------------------------ +function s:CCM_get_project(filename) +"------------------------------------ + " in Verzeichnis des Files wechseln + let dirname = fnamemodify(a:filename, ':p:h') + let cwd_old = getcwd() + execute 'cd ' . dirname + " project ermitteln + let query_string = 'work_area -show ' + let output = s:CCM_run(query_string) + for line in output + let projectname = substitute(line, '\(\S\+\).*', '\1', '') + endfor + if projectname == '' + echo 'No project found for ' . a:filename + echo '==============================' + echo ' ' + endif + " Verzeichnis zur�cksetzen + execute 'cd ' . cwd_old + + let project = s:CCM_split_object(projectname) + return project +endfunction + +"----------------------------------- +function s:CCM_get_object(filename) +"----------------------------------- + let basename = fnamemodify(a:filename, ':t') + let dirname = fnamemodify(a:filename, ':p:h') + + let object = {} + let project = s:CCM_get_project(a:filename) + if project != {} + let query_string = '"' + \ . 'name=' . Single_quote(basename) + \ . ' and is_member_of(' . Single_quote(project['displayname']) . ')"' + let objectnames = s:CCM_query(query_string) + let object = s:CCM_choose_object(a:filename, objectnames, project) + if object == {} + echo 'no object found for ' . a:filename + else + echo object['objectname'] + endif + else + echo 'No Project' + endif + return object +endfunction + +"------------------------------------------------------------ +function s:CCM_choose_object(filename, objectnames, project) +"------------------------------------------------------------ + let result = {} + for line in a:objectnames + let object = s:CCM_split_object(line) + let objectpath = s:CCM_get_path(object, a:project) + let object['path'] = objectpath + if object['path'] == a:filename + let result = object + endif + endfor + return result +endfunction + +"--------------------------------------- +function s:CCM_split_object(objectname) +"--------------------------------------- + let object = {} + let reName = '\([^-]\+\)' + let reVersion = '\([^:]\+\)' + let reType = '\([^:]\+\)' + let reInstance = '\(\d\+\)' + let regexp = reName.'-'.reVersion + let regexp = regexp.'\%('.':'.reType.':'.reInstance + let regexp = regexp.'\)\?' + let object['name'] = substitute(a:objectname, regexp, '\1', '') + let object['version'] = substitute(a:objectname, regexp, '\2', '') + let object['type'] = substitute(a:objectname, regexp, '\3', '') + let object['instance'] = substitute(a:objectname, regexp, '\4', '') + let object['displayname'] = object['name'].'-'.object['version'] + let object['objectname'] = object['displayname'].':'.object['type'].':'.object['instance'] + return object +endfunction + +"---------------------------------------- +function s:CCM_get_path(object, project) +"---------------------------------------- + let query_string = 'finduse' + \ .' /n "'.a:object['name'].'"' + \ .' /v "'.a:object['version'].'"' + \ .' /t "'.a:object['type'].'"' + \ .' /i "'.a:object['instance'].'"' + \ .' /working_proj' + let lines = s:CCM_run(query_string) + for line in lines + let regexp = '.*\s\(\S*' . a:object['name'] . '\)-'.a:object['version'].'@' . a:project['displayname'] + let relpath = substitute(line, regexp, '\1', '') + let foundpath = findfile(relpath) + if foundpath == '' + let relpath = substitute(relpath, '[^/\\]\+[/\\]\(.*\)', '\1', '') + let foundpath = findfile(relpath) + endif + if foundpath != '' + let path = fnamemodify(foundpath, ':p') + return path + endif + endfor + return '' +endfunction + +"----------------------------------- +function s:CCM_get_successor(object) +"----------------------------------- + let query_string = 'is_successor_of(' . Single_quote(a:object['objectname']) . ')' + let predecessor = s:CCM_query(query_string) + if predecessor == '' + echo 'no successor found for ' . a:object['objectname'] + else + " delete <CR> + let predecessor = matchstr(predecessor, '\p\+') + endif + return predecessor +endfunction + +"------------------------------------- +function s:CCM_get_predecessor(object) +"------------------------------------- + let query_string = 'is_predecessor_of(' . Single_quote(a:object['objectname']) . ')' + let query_answer = s:CCM_query(query_string) + let predecessor = {} + if query_answer[0] == '' + echo 'no predecessor found for ' . a:object['objectname'] + else + let predecessorname = matchstr(query_answer, '\p\+') + let predecessor = s:CCM_split_object(predecessorname) + endif + return predecessor +endfunction + +"----------------------------------- +function s:CCM_get_hist_root(object) +"----------------------------------- + let query_string = '"' + \ . 'name=' . Single_quote(a:object['name']) + \ . ' and instance=' . Single_quote(a:object['instance']) + \ . ' and is_hist_root()"' + let hist_root = s:CCM_query(query_string) + if hist_root == '' + echo 'no hist_root found for ' . a:object['objectname'] + else + let hist_root = matchstr(hist_root, '\p\+') + endif + return hist_root +endfunction + +"-------------------------------- +function s:CCM_get_default_task() +"-------------------------------- + let output = s:CCM_run('task /default') + if match(output[0], '\d\+') >= 0 + let task = matchstr(output[0], '\d\+') + else + let task = 'none' + endif + return task +endfunction + +"-------------------------------------------------- +function s:CCM_check_out(object, project, comment) +"-------------------------------------------------- + let default_task = s:CCM_get_default_task() + if default_task == 'none' + echo 'no default task!' + else + let comment = '/comment "' . a:comment . '"' + let task = '/task ' . default_task + let project = '/project ' . a:project['displayname'] + let object = a:object['objectname'] + let expression = 'checkout ' . comment .' '. task . ' '. object + " cd to directory + let objectpath = s:CCM_get_path(a:object, a:project) + let old_cwd = getcwd() + execute 'cd ' . fnamemodify(objectpath, ':p:h') + let output = s:CCM_run(expression) + " go back + execute 'cd ' . old_cwd + endif +endfunction + +"---------------------------------------------- +function s:CCM_check_in(object, state, comment) +"---------------------------------------------- + let comment = '/comment "' . a:comment . '" ' + let state = '/state ' . a:state . ' ' + let expression = 'checkin ' . comment . state . a:object['objectname'] + echo 'comment:' . comment + echo 'state:' . state + echo 'expression:' . expression + echo 'execute' + let output = s:CCM_run(expression) +endfunction + +"---------------------------------------- +function s:CCMcheckout(filename, comment) +"---------------------------------------- + let object = s:CCM_get_object(a:filename) + let project = s:CCM_get_project(a:filename) + if object != {} + let output = s:CCM_check_out(object, project, a:comment) + endif +endfunction + +"------------------------------------------ +function s:CCMcheckpoint(filename, comment) +"------------------------------------------ + let object = s:CCM_get_object(a:filename) + if object != {} + if (a:comment == '') + if has('gui') + let l:comment = inputdialog('comment:') + else + echo 'enter a comment' + return + endif + else + let l:comment = a:comment + endif + let state = 'checkpoint' + let output = s:CCM_check_in(object, state, l:comment) + endif +endfunction + +"------------------------------ +function s:CCMchangeable(owner) +"------------------------------ + let object = '' + if project == '?' + let owner = 'owner=' . Single_quote(a:owner) + let project = ' and project=' . Single_quote('bmsk') + let released = ' and status!=' . Single_quote('released') + let integrate = ' and status!=' . Single_quote('integrate') + let rejected = ' and status!=' . Single_quote('rejected') + let status = released . integrate . rejected + let query_string = '"' . owner . project . status . '"' + let object = s:CCM_long_query(query_string) + endif + if object == '' + echo 'no working objects found for ' . a:owner + endif + return object +endfunction + +"--------------------------- +function s:CCMdiff(filename) +"--------------------------- + let object = s:CCM_get_object(a:filename) + if object != {} + let predecessor = s:CCM_get_predecessor(object) + if predecessor != {} + let output = s:CCM_run_silent('diff /g ' . predecessor['objectname'] . ' ' . a:filename) + endif + endif +endfunction + +"--------------------------------- +function s:CCM_view_object(object) +"--------------------------------- + let file_content = s:CCM_run_silent('type ' . a:object['objectname']) + return file_content +endfunction + +"------------------------------ +function s:CCMhistory(filename) +"------------------------------ + let object = s:CCM_get_object(a:filename) + if object != {} + let expression = 'history /g ' . object['objectname'] + let output = s:CCM_run(expression) + endif +endfunction + +"----------------------- +function s:Wait(seconds) +"----------------------- + let starttime = localtime() + while ((localtime() - starttime) < a:seconds) + endwhile +endfunction + +"------------------------------ +" Funktionen f�r Change Synergy +"------------------------------ + +"command ChangeSynergyBeautify call s:ChangeSynergyBeautify() +command ChangeSynergyCreateCRTaskList call s:ChangeSynergyCreateCRTaskList() +command ChangeSynergyCreateCRList call s:ChangeSynergyCreateCRList() +command ChangeSynergyCreateTaskList call s:ChangeSynergyCreateTaskList() + +let s:CR_text = 'CR ' +let s:Task_text = 'Task ' + +" Umformatieren der CR-Liste aus dem ChangeSynergy Bericht +function s:ChangeSynergyBeautify() + DelAllMultipleEmptyLines + call s:ChangeSynergyDeleteRejected() + call s:ChangeSynergyFormatTasks() + call s:ChangeSynergyFormatCRs() +endfunction + +" Liste mit allen CRs incl. Tasks aus Bericht +function s:ChangeSynergyCreateCRTaskList() + call s:ChangeSynergyBeautify() + let RE = '^\(' . s:CR_text . '.*\)' + execute ':%s/' . RE . '/\r\1/e' + normal ggdddw +endfunction + +" Liste mit allen CRs aus Bericht +function s:ChangeSynergyCreateCRList() + call s:ChangeSynergyBeautify() + let RE = '^' . s:Task_text . '.*\n' + execute ':%s/' . RE . '//e' + execute ':3,$sort' +endfunction + +" Liste mit allen Tasks aus Bericht +function s:ChangeSynergyCreateTaskList() + call s:ChangeSynergyBeautify() + let RE = '^' . s:CR_text . '.*\n' + execute ':%s/' . RE . '//e' + execute ':3,$sort' +endfunction + +" L�schen der CRs mit Status 'rejected' +function s:ChangeSynergyDeleteRejected() + let RE = s:ComposeCrTaskRE('rejected') + execute ':%s/' . RE . '//e' +endfunction + +" Task umfomatieren +function s:ChangeSynergyFormatTasks() + let RE = '\%(' + \ . 'Task Number:\s\+\(\d\+\)' + \ . '\s\+' + \ . 'Resolver:\s\+\(.\+\)' + \ . '\s\+' + \ . 'Status:\s\+\(\w\+\)' + \ . '\n' + \ . 'Synopsis:\s\+\(.*\)' + \ . '\n' + \ . '\)' +" execute '%:s/' . RE . '/' . s:Task_text . '\1\t\2:\t\4/e' + execute '%:s/' . RE . '/\=printf("%s%4s %-32s: %s", s:Task_text, submatch(1), submatch(2), submatch(4))/e' +endfunction + +" CR umfomatieren +function s:ChangeSynergyFormatCRs() + let RE = '\%(' + \ . 'CR ID:\s\+\(\d\+\)' + \ . '\s\+' + \ . 'Resolver:\s\+\(.\+\)' + \ . '\s\+' + \ . 'Status:\s\+\(\w\+\)' + \ . '\n' + \ . 'Synopsis:\s\+\(.*\)' + \ . '\n' + \ . '\)' +" execute '%:s/' . RE . '/' . s:CR_text . '\1\t\2:\t\4/e' + execute '%:s/' . RE . '/\=printf("%s %4s %-32s: %s", s:CR_text, submatch(1), submatch(2), submatch(4))/e' +endfunction + +" Zusammensetzen der Regular Expression f�r ChangeRequests aus dem Bericht +" Open PST + CR + Task +function s:ComposeCrTaskRE(CRstatus) + if a:CRstatus == '' + let CRstatus = '\w\+' + else + let CRstatus = a:CRstatus + endif + let taskRE = '\(Task Number:.*\nSynopsis:.*\n\n\)' + let crRE = 'CR ID:.*Status:\s\+\(' . CRstatus . '\)\nSynopsis:.*\n\%(\s*\n\)*' . taskRE . '*' + return crRE +endfunction + +EchoDebug 'loaded ccm.vim' + diff --git a/vimfiles.stefan/plugin/changelog.vim b/vimfiles.stefan/plugin/changelog.vim new file mode 100644 index 0000000..361b8f4 --- /dev/null +++ b/vimfiles.stefan/plugin/changelog.vim @@ -0,0 +1,154 @@ +" =========================================================================== +" File: changelog.vim +" Author: Stefan Liebl (S.Liebl@gmx.de) +" Description: changelog for vimfiles in subversion +" Revision: $LastChangedRevision$ +" =========================================================================== + +" get Revision from subversion +let g:VimFilesRevision = substitute("$Rev$",'\$Rev:\s*\(\d\+\)\s*\$','\1','g') +let &titlestring = '%t - (%-F) - %=vimfiles Rev: ' . g:VimFilesRevision + +if exists('nochangelog') + finish +endif + +function s:ReportRev(Rev) + if a:Rev >= '129' + echo 'Neu seit Rev: 129' + echo 'Tags f�r BMS-X' + echo 'Doxygen Toolkit' + echo 'Update VimScripts' + elseif a:Rev >= '128' + echo 'Neu seit Rev: 128' + echo 'Vimsuite f�r BMS-X verbessert' + elseif a:Rev >= '123' + echo 'Neu seit Rev: 120' + echo 'Task Report' + echo 'damos als eigenes Package' + echo 'a2l indent verbessert' + echo '+scons' + echo '+Merge f�r Synergy/CM' + elseif a:Rev >= '120' + echo 'Neu seit Rev: 119' + echo 'Verbindung zu Projekt deutlich beschleunigt, da mehrere Variablen auf einmal gelesen werden k�nnen' + echo '+ftplugin paf.vim: Anzeiger der aktuellen Adresse in der Statuszeile' + echo 'ccm.vim: Umformatierungen f�r ChangeSynergy Reports' + echo 'BmskDoku im Men� und interaktiv' + echo 'Cscope Verbindung kann per Men� geschlossen werden' + echo 'Altes make.log kann per Men� geparsed werden' + elseif a:Rev >= '119' + echo 'Neu seit Rev: 118' + echo 'Befehl "Bmsk distclean" im Men� erg�nzt' + elseif a:Rev >= '116' + echo 'Neu seit Rev: 116' + echo 'Einstelldialoge und Titelleiste f�r BMS-K verbessert' + echo 'Men�s f�r BMS-K verbessert' + elseif a:Rev >= '114' + echo 'Neu seit Rev: 114' + echo 'Continuus Anbindung verbessert' + echo 'Bmsk Argumen EXTRA_C_FLAGS' + elseif a:Rev >= '111' + echo 'Neu seit Rev: 111' + echo 'GetMakeVar verbessert, ccm64, +FindEEEmuFile' + elseif a:Rev >= '111' + echo 'Neu seit Rev: 100' + echo 'Befehl BmskDoku zum besseren parsen von LaTeX Fehlern' + echo 'Grep, GrepBmsk aktiviert' + echo 'CCM kann jetzt auch Subprojekte' + echo 'GetOsp... repariert' + echo 'SVNstudio verbessert' + echo 'SVNdiff auch mit Revision' + echo 'diff f�r unix verbessert' + echo 'MyTools heissen jetzt VimSuite' + echo 'K46 erg�nzt' + echo 'Dokumentation �berarbeitet' + elseif a:Rev >= '100' + echo 'Neu seit Rev: 90' + echo 'vimfiles in Unterverzeichnisse' + elseif a:Rev >= '90' + echo 'Neu seit Rev: 89' + echo 'compiler/bmsk.vim: leere Makeoptionen unterst�tzen, tex mit includieren' + echo 'ftplugin/latex-suite: Update von vim.org' + echo 'plugin/bmsk.vim: Makeoptionen erst leer lassen' + echo 'plugin/basics.vim: PathNormpath verbessert' + echo 'plugin/tools.vim: $VIMRUNTIME -> g:vimfiles' + echo 'plugin/visincr.vim: Update von vim.org' + echo 'after/syntax/python.vim: Update von vim.org' + elseif a:Rev >= '89' + echo 'Neu seit Rev: 79' + echo 'after/syntax/kgs.vim: + test_wert_text' + echo 'compiler/bmsk.vim : Xlint weglassen wenn leer' + echo 'doc/bmsk.txt : kleine Aktualisierungen' + echo 'tools/ctags.exe : Version ohne cygwin' + echo 'plugin/bmsk.vim : header-Verzeichnisse verbessert' + echo ' ' + echo 'checkpath sollte jetzt komplett funktionierien.' + echo 'Siehe :help :checkpath' + elseif a:Rev >= '79' + echo 'Neu seit Rev: 78' + echo 'angepasst auf make-12' + echo 'ftplugins verbessert (setlocal)' + echo 'Formatierung verbessert' + echo 'Angepasst f�r vim 6.4' + echo 'Python-dlls integriert' + elseif a:Rev >= '78' + echo 'Neu seit Rev: 76' + echo 'Bmsk: UpdateBuffers verbessert' + echo 'cscope: find files including this file ge�ndert' + echo '+ xml.vim' + echo '+ indent/a2l.vim' + echo 'compiler/bmsk.vim: alte Python-Meldung auskommentiert' + echo 'svn.vim: SVNtool verbessert' + elseif a:Rev >= '76' + echo 'Neu seit Rev: 72' + echo 'syntax-File f�r paf,daf,0pa,0da' + echo 'Diff-Tools im Men� MyTools' + echo 'Subversion-Men�' + echo 'Subversion Command SVN' + echo 'compiler/bmsk.vim unabh�ngig von Pfaden' + elseif a:Rev >= '72' + echo 'Neu seit Rev: 71' + echo 'cscopeprg wird mit Pfad gesetzt' + echo 'grep.exe V 2.5.1 in funktionierender Version' + echo 'neue Suchpfade f�r linux' + echo 'FindFile funktioniert wieder' + elseif a:Rev >= '71' + echo 'Neu seit Rev: 71' + echo 'grep.exe V 2.5.1' + echo 'basics.vim: Verbesserungen f�r GetOspTestValues' + echo 'syntax/c.vim: c.vim aufgenommen (hatte ich bei Rev 67 vergessen)' + elseif a:Rev >= '70' + echo 'Neu seit Rev: 70' + echo 'Make-Targets erg�nzt' + echo 'Produkte in Continuus auschecken' + elseif a:Rev >= '66' + echo 'Neu seit Rev: 66' + echo 'ftplugin- und syntax-files nach after/...,' + echo ' damit sie nach den files in vim63 geladen werden' + echo 'syntax/c.vim: Verbessertes Syntax-Highliting' + echo 'colors/Stefan.vim: Neue Syntax-Groups f�r neues c.vim' + echo '-----------------------------------------------------' + echo 'Ich empfehle die �nderungen aus colors/Stefan.vim' + echo ' in das eigene Colorscheme zu �bertragen' + elseif a:Rev == '66' + echo 'Neu in Rev: ' . g:VimFilesRevision + echo 'doc/bmsk.vim: Doku aktualisiert' + echo 'plugin/changelog.vim: neu, gibt die �nderungen beim ersten Start aus' + echo 'plugin/tComment.vim: neu, gute Kommentierfunktion, :help tComment' + echo 'plugin/visincr.vim: neu, inkrementieren von Spalten, :help visincr' + echo 'plugin/matrix.vim: neu, Bildschirmschoner, :Matrix' + echo 'ftplugin/python_fold.vim: neu, Faltungen f�r Python' + endif +endfunction + +" uncomment next line to get changelog for the last version +execute 'call s:ReportRev(' . g:VimFilesRevision . ')' + +" comment changelog after first usage +silent! new <sfile> +silent! set modifiable +silent! %substitute/^execute 'call/"execute 'call/ +silent! wq! +bdelete changelog.vim + diff --git a/vimfiles.stefan/plugin/cvs.vim b/vimfiles.stefan/plugin/cvs.vim new file mode 100644 index 0000000..22ae142 --- /dev/null +++ b/vimfiles.stefan/plugin/cvs.vim @@ -0,0 +1,77 @@ +" =========================================================================== +" File: cvs.vim +" Author: Stefan Liebl (S.Liebl@gmx.de) +" Description: handles version controlling with CVS +" =========================================================================== + +" -------------------- +" config datei f�r CVS +" -------------------- +if !exists('g:cvs') + let g:cvs = 'cvs ' +endif + + +" -------- +" commands +" -------- +"command -nargs=0 CHANGEABLE call GetChangeable('qx13468') +command -nargs=0 CVSdiff call s:CVSshowDifferences(expand('%:t')) +command -nargs=0 CVSedit call s:CVSedit(expand('%:t')) +command -nargs=0 CVSunedit call s:CVSunedit(expand('%:t')) +command -nargs=0 CVScommit call s:CVScommit(expand('%:t')) +command -nargs=0 CVSstatus call s:CVSstatus(expand('%:t')) + +"--------------------------- +function s:CVSedit(filename) +"--------------------------- + let expression = g:cvs . ' edit ' . a:filename + let output = system(expression) + execute(':edit') + echo output +endfunction + +"----------------------------- +function s:CVSunedit(filename) +"----------------------------- + let expression = g:cvs . ' unedit ' . a:filename + let output = system(expression) + execute(':edit') + echo output +endfunction + +"----------------------------- +function s:CVScommit(filename) +"----------------------------- + let expression = g:cvs . ' commit ' . a:filename + let output = system(expression) + execute(':edit') + echo output +endfunction + +"----------------------------- +function s:CVSstatus(filename) +"----------------------------- + let expression = g:cvs . ' status ' . a:filename + let output = system(expression) + execute(':edit') + echo output +endfunction + +"-------------------------------------- +function s:CVSdiff(filename, patchfile) +"-------------------------------------- + silent execute '!' . g:cvs ' diff -u ' . a:filename . ' > ' . a:patchfile +endfunction + +"-------------------------------------- +function s:CVSshowDifferences(filename) +"-------------------------------------- + let patchfile = tempname() + echo 'patchfile: ' . patchfile + call s:CVSdiff(a:filename, patchfile) + set patchexpr=ReversePatch() + execute 'vertical diffpatch ' . patchfile +endfunction + +EchoDebug 'loaded cvs.vim' diff --git a/vimfiles.stefan/plugin/dos.vim b/vimfiles.stefan/plugin/dos.vim new file mode 100644 index 0000000..c9d584a --- /dev/null +++ b/vimfiles.stefan/plugin/dos.vim @@ -0,0 +1,11 @@ +" =========================================================================== +" File: dos.vim +" Author: Stefan Liebl (S.Liebl@gmx.de) +" Description: sources mswin.vim if the os is mswin +" =========================================================================== + +if (g:os == 'dos') + runtime mswin.vim + behave mswin +endif + diff --git a/vimfiles.stefan/plugin/python.vim b/vimfiles.stefan/plugin/python.vim new file mode 100644 index 0000000..8684dab --- /dev/null +++ b/vimfiles.stefan/plugin/python.vim @@ -0,0 +1,77 @@ +" =========================================================================== +" File: python.vim +" Author: Stefan Liebl (S.Liebl@gmx.de) +" Description: options for python-vim +" =========================================================================== + +if !has('win32') + finish +endif + +if !has('python') + " noch keine python.dll gefunden + " tools zum Suchpfad hinzuf�gen + if (match($PATH, '\c' . escape(g:vimtools, '\')) >= 0) + " ist schon drin, abbrechen + echo 'keine python.dll in g:vimtools=' . g:vimtools . ' gefunden' + finish + else + " bei Bedarf ';' an PATH anh�ngen + if (match($PATH, ';$') < 0) + let $PATH = $PATH . ';' + endif + let $PATH = $PATH . g:vimtools . ';' + "echo 'Python = ' . g:vimtools + endif +endif + +if !has('python') + " immer noch keine python.dll gefunden + if !isdirectory(g:pythonPath) + echo 'g:pythonPath=' . g:pythonPath . ' nicht gefunden' + finish + else + " pythonPath zum Suchpfad hinzuf�gen + if (match($PATH, '\c' . escape(g:pythonPath, '\')) >= 0) + " ist schon drin, abbrechen + echo 'kein python.exe in g:pythonPath=' . g:pythonPath . ' gefunden' + finish + else + " bei Bedarf ';' an PATH anh�ngen + if (match($PATH, ';$') < 0) + let $PATH = $PATH . ';' + endif + let $PATH = $PATH . g:pythonPath . ';' + "echo 'Python = ' . g:pythonPath + endif + endif +endif + +" Jetzt sollte es eigentlich gehen +if !has('python') + echo 'kein Python-Modul f�r vim' + finish +endif + +let s:pythonLibPath = expand(g:pythonPath . '/lib') +let s:pythonDllPath = expand(g:pythonPath . '/dlls') + +try +python <<EOF +import sys +#print sys.version +import vim +sys.path.append(vim.eval('s:pythonLibPath')) +sys.path.append(vim.eval('s:pythonDllPath')) +EOF +catch /^Vim\%((\a\+)\)\=:E370/ " python not available + echo 'python not found' + echo 'add python to your path-variable' + echo 'otherwise some features from MyTools are not available' +catch /^Vim\%((\a\+)\)\=:E263/ " python not available + echo 'python not found 2' +catch + echo 'python.vim: irgendwas geht nicht' +endtry + +EchoDebug 'loaded python.vim' diff --git a/vimfiles.stefan/plugin/svn.vim b/vimfiles.stefan/plugin/svn.vim new file mode 100644 index 0000000..2c1756a --- /dev/null +++ b/vimfiles.stefan/plugin/svn.vim @@ -0,0 +1,234 @@ +" =========================================================================== +" File: svn.vim +" Author: Stefan Liebl (S.Liebl@gmx.de) +" Description: handles version controlling with subversion +" =========================================================================== + +if !exists('g:svn') + let g:svn = 'svn ' +endif + +let g:SVNlogfile = fnamemodify(tempname(),':h') . '/SVNmessage.log' + +" -------- +" commands +" -------- +command -nargs=? SVNdiff silent call s:SVNdiff('<args>') +command -nargs=? SVNcommit call s:SVNcommit('<args>') +command -nargs=0 SVNstatus call s:SVNstatus() +command -nargs=0 SVNupdate call s:SVNupdate() +command -nargs=0 SVNlog call s:SVNlog() +command -nargs=? SVNadd call s:SVNadd('<args>') +command -nargs=0 SVNstudio call s:SVNstudio() + +" ---- +" Menu +" ---- +let s:SVNMenuLocation = 100 +let s:SVNmenuname = '&SVN.' + +"------------------------- +function s:SVNRedrawMenu() +"------------------------- + exec 'anoremenu '.s:SVNMenuLocation.'.5 '.s:SVNmenuname. + \'&SVNstudio<tab>:SVNstudio'. + \' :SVNstudio<CR>' + exec 'anoremenu '.s:SVNMenuLocation.'.10 '.s:SVNmenuname. + \'&status<tab>:SVNstatus'. + \' :SVNstatus<CR>' + exec 'anoremenu '.s:SVNMenuLocation.'.15 '.s:SVNmenuname. + \'&update<tab>:SVNupdate'. + \' :SVNupdate<CR>' + exec 'anoremenu '.s:SVNMenuLocation.'.20 '.s:SVNmenuname. + \'&diff<tab>:SVNdiff'. + \' :SVNdiff<CR>' + exec 'anoremenu '.s:SVNMenuLocation.'.30 '.s:SVNmenuname. + \'&commit<tab>:SVNcommit'. + \' :SVNcommit<CR>' + exec 'anoremenu '.s:SVNMenuLocation.'.40 '.s:SVNmenuname. + \'&log<tab>:SVNlog'. + \' :SVNlog<CR>' + exec 'anoremenu '.s:SVNMenuLocation.'.50 '.s:SVNmenuname. + \'&add<tab>:SVNadd'. + \' :SVNadd<CR>' +endfunction + +if !exists('nosvnmenu') + call s:SVNRedrawMenu() +endif + +"---------------------------- +function s:SVNcommit(logfile) +"---------------------------- + if filereadable(a:logfile) + let options = '--file ' . a:logfile + elseif a:logfile == '' + let options = '' + else + echoerr 'Messagefile for SVNcommit not found: ' . a:logfile + return + endif + + " save all files + wa + + let expression = g:svn . ' commit ' . options + echo expression + let output = system(expression) + echo output + let expression = g:svn . ' update' + let output = system(expression) + echo output + + if filereadable(a:logfile) + call delete(a:logfile) + endif +endfunction + +"--------------------- +function s:SVNupdate() +"--------------------- + let expression = g:svn . ' update' + let output = system(expression) + echo output +endfunction + +"--------------------- +function s:SVNstatus() +"--------------------- + let expression = g:svn . ' status' + let output = system(expression) + echo output +endfunction + +"--------------------- +function s:SVNlog() +"--------------------- + let expression = g:svn . ' log' + let output = system(expression) + echo output +endfunction + +"------------------------ +function s:SVNdiff(input) +"------------------------ + " default + let revision = '' + if a:input == '' + " ohne Argument einfach aktuelles File mit Headrevision vergleichen + let filename = expand('%:p') + else + if filereadable(a:input) + " mit Filenamen einfach File mit Headrevision vergleichen + let filename = a:input + elseif str2nr(a:input) == a:input + " Argument ist die Revision, mit der verglichen werden soll + let revision = '-r '.a:input.' ' + let filename = expand('%:p') + else + echo 'Falsches Argument: '.a:input + exit + endif + endif + + if filereadable(filename) + " goto upper right window + wincmd k + wincmd l + execute 'edit ' . filename + " store filetype + let filetype = &filetype + " open headrevision + let headrevision = tempname() + let command = '!' . g:svn . 'cat ' . revision . filename . ' > ' . headrevision + silent execute command + if winnr()==1 + execute 'vsplit ' . headrevision + else + wincmd h + execute 'view ' . headrevision + endif + " set filetype + let &filetype=filetype + diffthis + wincmd l + diffthis + elseif isdirectory(filename) + echo filename . ' is a directory' + else + echoerr 'file ' . filename . ' not found' + endif +endfunction + +"-------------------------- +function s:SVNadd(filename) +"-------------------------- + if a:filename == '' + let filename = expand('%:p') + else + let filename = a:filename + endif + + let expression = g:svn . ' add ' . filename + echo expression + let output = system(expression) + echo output +endfunction +" + +"--------------------- +function s:SVNstudio() +"--------------------- + " Log-Message unten �ffnen + setlocal splitbelow + silent execute '20split' g:SVNlogfile + w + + " Status-Meldung in Temp-File umleiten + let tempfile = tempname() + " File anzeigen + silent execute 'vsplit' tempfile + call SVNwriteWindow(tempfile) + + " Show differences + nmap <buffer> <CR> :execute 'SVNdiff' SVNstudioGetFilename(getline("."))<CR> + nmap <buffer> <C-l> :silent execute '!' . g:svn . 'status > ' . g:SVNlogfile<CR> + nmap <buffer> <C-c> :execute 'SVNcommit' g:SVNlogfile<CR> + nmap <buffer> <C-a> :execute 'SVNadd' g:SVNlogfile<CR> + nmap <buffer> <C-s> :call SVNwriteWindow(expand('%:p'))<CR> +endfunction + +"---------------------------- +function SVNwriteWindow(file) +"---------------------------- + normal ggdG + normal oSVN studio + normal ostatus message is displayed in this window + normal oenter log message in right hand window + normal o + normal o<CR> show differences of file under cursor + normal o<C-l> copy status-info to log-window + normal o<C-c> commit changes with logmessage in right window + normal o<C-a> add file under cursor to repository + normal o<C-s> update status window + normal o + normal o------------------- + normal o + w + + let command = '!' . g:svn . 'status >> ' . a:file + "echo command + silent execute command + e +endfunction + +"--------------------------------- +function SVNstudioGetFilename(line) +"--------------------------------- + let filename = substitute(a:line, '.\s\+\(.\+\)', '\1', '') + return filename +endfunction + + +EchoDebug 'loaded svn.vim' + diff --git a/vimfiles.stefan/plugin/tools.vim b/vimfiles.stefan/plugin/tools.vim new file mode 100644 index 0000000..a1522a6 --- /dev/null +++ b/vimfiles.stefan/plugin/tools.vim @@ -0,0 +1,895 @@ +" =========================================================================== +" File: tools.vim +" Author: Stefan Liebl (S.Liebl@gmx.de) +" Description: some usefull tools +" Revision: $LastChangedRevision: 60 $ +" =========================================================================== + +" ---------------- +" Project settings +" ---------------- +if !exists("basedir") + let g:basedir = getcwd() +endif + +let s:makefileNames = [ + \ 'makefile', + \ 'Makefile', + \ 'makefile.mak', + \ 'Makefile.mak', + \ 'make.bat', + \ 'make_fsw.bat'] +let g:projectFile = fnamemodify($VIMRUNTIME . '/../projects.txt', ':p') + +" ---------- +" SetProject +" ---------- +if (v:version > 602) + command -complete=customlist,GetAllMakefiles -nargs=? SetProject call s:SetProject('<args>') +else + command -nargs=1 SetProject call SetProject('<args>') +endif +"function GetAllMakefiles(ArgLead, CmdLine, CursorPos) +function GetAllMakefiles(...) + let makefilePaths = [] + + " Get Makefiles from g:WA or ArgLead + let path = g:WA + if a:0 == 3 + let ArgLead = a:1 + let CmdLine = a:2 + let CursorPos = a:3 + if ArgLead != '' + let path = expand(ArgLead) + endif + endif + let makefilePaths += s:GetAllMakefilesInPath(path) + + if makefilePaths == [] + " Get Projects from project.txt + let projectPaths = s:GetProjectPaths(g:projectFile) + for projectPath in projectPaths + let makefilePaths += s:GetAllMakefilesInPath(projectPath) + endfor + endif + + return makefilePaths +endfunction + +" Get all Makefiles defined in s:makefileNames contained in path +function s:GetAllMakefilesInPath(path) + let files = [] + if isdirectory(a:path) + let path = a:path + else + let path = a:path . '*' + endif + for makefileName in s:makefileNames + let pathlist = path . ',' . path . '/*,' . path . '/*/*' + let newfiles = split(globpath(pathlist, makefileName)) + let files += newfiles +" echo files + endfor + return files +endfunction + +" Get Project-Paths from project.txt +function s:GetProjectPaths(projectFile) + let paths = [] + if filereadable(a:projectFile) + let paths = split(system('more ' . a:projectFile)) + endif + return paths +endfunction + +" Find makefile and set some options +" ---------------------------------- +function s:SetProject(makefile) + if ((a:makefile == '') && has('browse')) + " Browse for makefile + if exists('g:WA') + let l:WA = g:WA + else + let l:WA = '' + endif + + let makefilePath = fnamemodify(browse(0, 'Select makefile', l:WA, ''), ':p') + else + " set Workarea and basedir + if filereadable(a:makefile) + let makefilePath = fnamemodify(a:makefile, ':p') + else + echoerr 'No makefile' a:makefile + return + endif + endif + + " split file name and path + let g:basedir = fnamemodify(makefilePath, ':p:h') + let g:makefileName = fnamemodify(makefilePath, ':t') + + " test if makefile is a batch-script + let ext = fnamemodify(g:makefileName, ':e') + if ext == 'bat' + let &makeprg = makefilePath . ' $*' + endif + + " set directories + execute 'cd ' . g:basedir + " cd path + let &cdpath = g:basedir + " browse-dir + set browsedir=buffer + + " search path + set path& + + call s:SetProjectVariables() + +endfunction + +" Set Project Specific Variables +function s:SetProjectVariables() + let varnames = [ + \ 'VIM_COMPILER', + \ 'VIM_PATH', + \ 'VIM_TAGS', + \ 'VIM_CSCOPEPRG', + \ 'VIM_CSCOPEFILE', + \ 'GOALS', + \] + let s:Variables = s:GetMakeVars(varnames) + + echo 'Reading variables from makefile' + echo '-------------------------------' + for varname in keys(s:Variables) + echo printf('%-15s = %s', varname, s:Variables[varname]) + endfor + echo '-------------------------------' + echo '' + + try + " evaluate path variable + if s:Variables['VIM_PATH'] != '' + try + execute 'set path=' . s:Variables['VIM_PATH'] + catch + echoerr 'cant set path to ' . s:Variables['VIM_PATH'] + echoerr 'check the make variable VIM_PATH' + endtry + else + echomsg 'set the make-variable VIM_PATH to what you want to be set to path' + endif + + " evaluate tags + if s:Variables['VIM_TAGS'] != '' + try + execute 'set tags=' . s:Variables['VIM_TAGS'] + catch + echoerr 'cant set tags to ' . s:Variables['VIM_TAGS'] + echoerr 'check the make variable VIM_TAGS' + endtry + else + echomsg 'set the make-variable VIM_TAGS to what you want to be set to tags' + endif + + " evaluate cscope + if s:Variables['VIM_CSCOPEPRG'] != '' + try + execute 'set cscopeprg=' . s:Variables['VIM_CSCOPEPRG'] + catch + echoerr 'cant set cscopeprg to ' . s:Variables['VIM_CSCOPEPRG'] + echoerr 'check the make variable VIM_CSCOPEPRG' + endtry + else + echomsg 'set the make-variable VIM_CSCOPEPRG to what you want to be set to cscopeprg' + endif + if s:Variables['VIM_CSCOPEFILE'] != '' + try + cscope kill -1 + execute 'cscope add ' . s:Variables['VIM_CSCOPEFILE'] + catch + echomsg 'cant add cscope-file ' . s:Variables['VIM_CSCOPEFILE'] + echomsg 'check the make variable VIM_CSCOPEFILE and if file exists' + endtry + else + echomsg 'set the make-variable VIM_CSCOPEFILE if you want to add a cscope-database' + endif + + " evaluate compiler + if s:Variables['VIM_COMPILER'] != '' + try + execute 'compiler ' . s:Variables['VIM_COMPILER'] + catch + echoerr 'cant set compiler to ' . s:Variables['VIM_COMPILER'] + echoerr 'check the make variable VIM_COMPILER' + endtry + else + echomsg 'set the make-variable VIM_COMPILER to the compiler plugin you want to use' + endif + + catch + echoerr 'Could not read variables from makefile (vim-script-error)' + endtry + +endfunction + +" Get values for a list of variables as dictionary +function! s:GetMakeVars(varNameList) + let varlist = {} + try + let vars = join(a:varNameList, ' ') + let command = g:makefileName . ' getvar name="' . vars . '"' + let output = system(command) + let lines = split(output, "\n") + let RE = '^\(\w\+\)=\(.*\)\s*' + let SU = "let varlist['\\1']='\\2'" + "echo 'getvars:' + for line in lines + " echo line + if match(line, RE) >= 0 + execute substitute(line, RE, SU, '') + endif + endfor + "echo '' + catch + echoerr 'Could not read make variables' + endtry + + if varlist == {} + echoerr 'Could not read any variables from makefile' + echo 'Command:' command + echo 'Make output is:' + for line in lines + echo line + endfor + echo '---' + endif + return varlist +endfunction + +" ------------------------------------------ +" special make-command for target-completion +" ------------------------------------------ +command -complete=customlist,GetAllMakeGoals -nargs=* Make call s:Make('<args>') +function GetAllMakeGoals(...) + " evaluate make-goals + if s:Variables['GOALS'] != '' + try + let goals = split(s:Variables['GOALS']) + return goals + catch + echoerr 'cant set goals to ' . s:Variables['GOALS'] + echoerr 'check the make variable GOALS' + endtry + else + echomsg 'set the make-variable VIM_COMPILER to the compiler plugin you want to use' + endif +endfunction +function s:Make(args) + cscope kill -1 + execute ':make ' . a:args + try + execute 'cscope add ' . s:Variables['VIM_CSCOPEFILE'] + endtry +endfunction + + +" ------------------ +" Draw Vimsuite-Menu +" ------------------ +let s:VimSuiteMenuLocation = 70 +let s:VimSuiteMenuName = '&VimSuite.' + +function s:AddMakefileToProjectMenu(makefilePath) + exec 'anoremenu '.s:VimSuiteMenuLocation.'.10 '.s:VimSuiteMenuName.'&Project.' + \ . escape(a:makefilePath, '.\') . '<tab>'. + \' :SetProject ' . a:makefilePath . '<CR>' +endfunction +" +function s:AddAllKnownProjectsToMenu() + " Projects in project.txt + exec 'anoremenu '. s:VimSuiteMenuName. + \'&Project.-sep2- :' + let projectPaths = s:GetProjectPaths(g:projectFile) + let makefilePaths = [] + for projectPath in projectPaths + let makefilePaths += s:GetAllMakefilesInPath(projectPath) + endfor + for makefilePath in makefilePaths + call s:AddMakefileToProjectMenu(makefilePath) + endfor + + " Projects in g:WA + exec 'anoremenu '. s:VimSuiteMenuName. + \'&Project.-sep3- :' + for makefilePath in s:GetAllMakefilesInPath(g:WA) + call s:AddMakefileToProjectMenu(makefilePath) + endfor +endfunction +" +function s:InitProjectMenu() + exec 'silent! aunmenu '.s:VimSuiteMenuName.'&Project' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.10 '.s:VimSuiteMenuName. + \'&Project.&Browse\ for\ makefile<tab>:SetProject'. + \' :SetProject<CR>' + exec 'anoremenu ..25 '. s:VimSuiteMenuName. + \'&Project.-sep1- :' +endfunction +" +function s:RedrawProjectMenu() + call s:InitProjectMenu() + call s:AddAllKnownProjectsToMenu() +endfunction + +" ------- +" Session +" ------- +if (v:version > 602) + command -complete=custom,GetAllSessions -nargs=? SessionLoad call s:SessionLoad('<args>') +else + command -nargs=? SessionLoad call s:SessionLoad('<args>') +endif +function s:SessionLoad(SessionFile) + if ((a:SessionFile == '') && has('browse')) + " Browse for session-file + if exists('b:browsefilter') + let l:browsefilter = b:browsefilter + endif + let b:browsefilter = "Vim Sessions (*.vim)\t*.vim\nAll Files (*.*)\t*.*" + let SessionFile = browse(0, 'Select Session', $VIMRUNTIME . '/..', '') + if exists('l:browsefilter') + let b:browsefilter = l:browsefilter + endif + else + let SessionFile = a:SessionFile + endif + if filereadable(SessionFile) + execute('source ' . SessionFile) + else + echo 'No such File:' SessionFile + endif +endfunction + +command -nargs=? SessionSave call s:SessionSave('<args>') +command -nargs=? Exit SessionSave <args>|exit +function s:SessionSave(SessionName) + if (a:SessionName == '') + if ((v:this_session == '') && has('browse')) + " Browse for session-file + if exists('b:browsefilter') + let l:browsefilter = b:browsefilter + endif + let b:browsefilter = "Vim Sessions (*.vim)\t*.vim\nAll Files (*.*)\t*.*" + let SessionName = browse(1, 'Select Session File', $VIMRUNTIME . '/..', 'Session.vim') + if exists('l:browsefilter') + let b:browsefilter = l:browsefilter + endif + else + let SessionName = v:this_session + endif + else + let SessionName = a:SessionName + endif + execute('mksession! ' . SessionName) +endfunction + +function GetAllSessions(ArgLead, CmdLine, CursorPos) + let sessions_txt = $VIMRUNTIME . '/../sessions.txt' + let sessions = '' + let sessions = sessions . GlobLong($VIMRUNTIME . '/../*.vim') + if filereadable(sessions_txt) + let sessions = sessions . system("cat " . sessions_txt) + endif + return sessions +endfunction + + +function s:DelSessions() + exec 'silent! aunmenu '.s:VimSuiteMenuName.'&Session' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.10 '.s:VimSuiteMenuName. + \'&Session.&Browse\ for\ Sessionfile<tab>:SessionLoad'. + \' :SessionLoad<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.20 '.s:VimSuiteMenuName. + \'&Session.&Save<tab>:SessionSave'. + \' :SessionSave<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.20 '.s:VimSuiteMenuName. + \'&Session.Save\ &As<tab>:SessionSave'. + \' :let v:this_session = ""<CR>:SessionSave<CR>' +endfunction + +function s:RedrawSessionMenu() + call s:DelSessions() +" call s:AddAllKnownSessionsToMenu() +endfunction + +function s:RedrawMenu() + " Project + call s:RedrawProjectMenu() + " Session + call s:RedrawSessionMenu() + " Compile + exec 'anoremenu '.s:VimSuiteMenuLocation.'.30 '.s:VimSuiteMenuName. + \'&Compile.&Build<tab>:make'. + \' :make<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.30 '.s:VimSuiteMenuName. + \'&Compile.&Lint<tab>:make\ lint'. + \' :make lint<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.30 '.s:VimSuiteMenuName. + \'&Compile.&Clean<tab>:make\ clean'. + \' :make clean<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.30 '.s:VimSuiteMenuName. + \'&Compile.&Run<tab>:make\ run'. + \' :make run<CR>' +" exec 'anoremenu '.s:VimSuiteMenuLocation.'.30 '. s:VimSuiteMenuName. +" \'&Compile.-sep- :' + " Search + exec 'anoremenu '.s:VimSuiteMenuLocation.'.40 '.s:VimSuiteMenuName. + \'&Search.&Grep<tab>:Grep'. + \' :Grep<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.40 '.s:VimSuiteMenuName. + \'&Search.&File<tab>:find\ <name>'. + \' :call FindFile()<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.40 '. s:VimSuiteMenuName. + \'&Search.-sep- :' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.40 '.s:VimSuiteMenuName. + \'&Search.Goto\ &Cscope-Tag<tab>:cscope'. + \' :cscope find i <C-R><C-W><CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.40 '.s:VimSuiteMenuName. + \'&Search.Goto\ &CTag<tab>:tag'. + \' :tag <C-R><C-W><CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.40 '.s:VimSuiteMenuName. + \'&Search.List\ &CTags<tab>:tselect'. + \' :tselect /<C-R><C-W><CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.40 '.s:VimSuiteMenuName. + \'&Search.Update\ c&tags<tab>:make\ tags'. + \' :make tags<CR>' + " Edit + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.&Comment\ out/in<tab>^k'. + \' :CommentInOut<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Mark\ &long\ lines<tab>:MarkLongLines'. + \' :MarkLongLines<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.&Reformat\ File<tab>:Reformat'. + \' :Reformat<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Reformat\ &Tabs<tab>:ReformatTabs'. + \' :ReformatTabs<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Reformat\ &Indent<tab>:ReformatIndent'. + \' :ReformatIndent<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Delete\ trailing\ spaces<tab>:DelAllTrailWhitespace'. + \' :DelAllTrailWhitespace<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Delete\ multiple\ &empty\ lines<tab>:DelAllMultipleEmptyLines'. + \' :DelAllMultipleEmptyLines<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Delete\ multiple\ &same\ lines<tab>:DelAllMultipleSameLines'. + \' :DelAllMultipleSameLines<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '. s:VimSuiteMenuName. + \'&Edit.-sep- :' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Insert\ &Function\ Header<tab>:InsertFHeader'. + \' :InsertFHeader<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Insert\ &C-File\ Header<tab>:InsertCHeader'. + \' :InsertCHeader<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Insert\ &H-File\ Header<tab>:InsertHHeader'. + \' :InsertHHeader<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.50 '.s:VimSuiteMenuName. + \'&Edit.Insert\ H&TML-File\ Header<tab>:InsertHTMLHeader'. + \' :InsertHTMLHeader<CR>' + " Diff + exec 'anoremenu '.s:VimSuiteMenuLocation.'.60 '.s:VimSuiteMenuName. + \'&Diff.&show\ diffs<tab>:diffthis'. + \' :diffthis<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.60 '.s:VimSuiteMenuName. + \'&Diff.&end\ diffs<tab>:DiffOff'. + \' :DiffOff<CR>' + exec 'anoremenu '.s:VimSuiteMenuLocation.'.60 '.s:VimSuiteMenuName. + \'&Diff.&close\ diff<tab>:DiffClose'. + \' :DiffClose<CR>' +endfunction +call s:RedrawMenu() + +" search functions +" ---------------- + +" Search for file +function FindFile() + let basename = inputdialog('Filename:') + echo 'basename:' basename + " do it + execute ':find ' basename +endfunction + +" don't use :grep +let &grepprg='echo extern grep is not supported. Use vimgrep' + +" defaults +let g:GrepDir = getcwd() +let g:GrepFiles = '*.*' + +command -nargs=* Grep call Grep('<args>') +function Grep(input) + if (a:input == '') + let pattern = inputdialog('Pattern:') + else + let pattern = a:input + endif + + " Use Buffer-Variables, if exists + if exists('b:GrepDir') + let GrepDir = b:GrepDir + else + let GrepDir = g:GrepDir + endif + if exists('b:GrepFiles') + let GrepFiles = b:GrepFiles + else + let GrepFiles = g:GrepFiles + endif + + call GrepFull(GrepDir, GrepFiles, pattern) +endfunction + +function GrepFull(GrepDir, GrepFiles, Pattern) + " Normpath + let GrepDir = substitute(a:GrepDir, '\\', '/', 'g') + " add GrepDir to each GrepFiles + let Files = substitute(a:GrepFiles, '\(\S\+\)', GrepDir.'/**/\0', 'g') + " get pattern if empty + if (a:Pattern == '') + let Pattern = inputdialog('Pattern:') + else + let Pattern = a:Pattern + endif + + + " do it + let command = 'vimgrep /'.Pattern.'/gj '.Files + echo command + silent execute command + " list results + execute 'cl' +endfunction + +" Formatting Functions +" -------------------- + +" delete all multiple empty lines +command -range=% DelAllMultipleEmptyLines call DelAllMultipleEmptyLines(<line1>,<line2>) +function DelAllMultipleEmptyLines(fromline, toline) + let cursorLine = line(".") + let cursorCol = col(".") + execute a:fromline . ',' . a:toline . 's/\s\+$//e' + execute a:fromline . ',' . a:toline . 's/^\s*\(\n\s*$\)\+//e' + call cursor(cursorLine, cursorCol) +endfunction + +" delete all trailling whitespace +command -range=% DelAllTrailWhitespace call DelAllTrailWhitespace(<line1>,<line2>) +function DelAllTrailWhitespace(fromline, toline) + let cursorLine = line(".") + let cursorCol = col(".") + execute a:fromline . ',' . a:toline . 's/\s\+$//e' + call cursor(cursorLine, cursorCol) +endfunction + +" delete all multiple same lines +command -range=% DelAllMultipleSameLines call DelAllMultipleSameLines(<line1>,<line2>) +function DelAllMultipleSameLines(fromline, toline) + let cursorLine = line(".") + let cursorCol = col(".") + execute a:fromline . ',' . a:toline . 's/^\(.*\)\(\n^\1$\)\+/\1/e' + call cursor(cursorLine, cursorCol) +endfunction + +" reformat +command -range=% Reformat call ReformatFile(<line1>,<line2>) +function ReformatFile (fromline,toline) + call ReformatText(a:fromline,a:toline) + if (&filetype == 'kgs') + call ReformatKGS() + endif +endfunction + +"command -range=% Reformat call ReformatText(<line1>,<line2>) +function ReformatText (fromline,toline) +" execute a:fromline . ',' . a:toline . 'DelAllTrailWhitespace' + call DelAllTrailWhitespace(a:fromline,a:toline) + call ReformatTabs(a:fromline,a:toline) + call ReformatIndent(a:fromline,a:toline) +endfunction + +command -range=% ReformatIndent call ReformatIndent(<line1>,<line2>) +function ReformatIndent (fromline,toline) + " mark actual position + let cursorLine = line(".") + let cursorCol = col(".") + " mark all commented lines + let line_nr = a:fromline + while (line_nr <= a:toline) + let line = getline(line_nr) + if (match(line,'^' . b:commentstring)>=0) + let line = '@' . line +" echo line + call setline(line_nr, line) + endif + let line_nr = line_nr + 1 + endwhile + " indent all lines + execute 'normal ' . a:fromline . 'G=' . a:toline . 'G' + " reindent commented lines + let substCmd = 's?^\s*@' . b:commentstring . '?' . b:commentstring . '?' + silent! execute a:fromline . ',' . a:toline . substCmd + " go back to mark + call cursor(cursorLine, cursorCol) +endfunction + +command -range=% ReformatTabs call ReformatTabs(<line1>,<line2>) +function ReformatTabs (fromline,toline) + let cursorLine = line(".") + let cursorCol = col(".") + if (a:fromline > 1) + call cursor(a:fromline-1, 255) + else + call cursor(a:fromline, 1) + endif + let found = search('\t', 'W') + while ((found > 0) && (found <= a:toline)) + execute "normal r\t" + let found = search('\t', 'W') + endwhile + call cursor(cursorLine, cursorCol) +endfunction + +" convert UTF-8 to LATIN1 +command ConvertUTF8 call ConvertUTF8() +function ConvertUTF8() + silent! %s/ä/\ä/ " ä + silent! %s/ö/\ö/ " ö + silent! %s/ü/\ü/ " ü + silent! %s/Ä/\Ä/ " Ä +" silent! %s/Ã&#xxx;/\Ö/ " Ö + silent! %s/Ü/\Ü/ " Ü + silent! %s/ß/\ß/ " ß + silent! %s/€/€/ " € +endfunction + +" insert history comment +command HistoryComment call HistComment() +function HistComment() + let l:date = GetDate() + execute 'normal O' . l:date . ' IST_LIEBL' + execute 'normal o' + execute 'normal k$' +endfunction + +" find all non-extern functions in h-files +function FindDeclaration() + let bmsk_sw = g:bmsk_sw + let bmsk_header = g:bmsk_header + let bios_header = g:bios_header + let id = '(\\ *[a-zA-Z0-9_]+\\ *)' + let not_extern = '([^x]*\\ +)' + let start = not_extern . '*' + let type = '(' . id . '\\ +)' + let declarator = '(' . id . ')' + let parameter = '(' . id . ')(\\ +' . id .',?\\ *)?' + let parlist = '(' . parameter . '+)' + let bracket = '(\\(' . parlist . '\\))' + let definition = '(\\ *({.*)?)' + let declaration = '(\\ *;.*)' + let end = definition + "let end = definition . declaration . '?' + execute ':Hgrep -x '' . start . type . declarator . bracket . end . ''' +endfunction + +" indent a wordNum to position +function IndentWordNum(wordNum, pos) + " store cursor postion + let cursorLine = line(".") + let cursorCol = col(".") +" echo 'IndentWordNum' cursorLine cursorCol a:wordNum a:pos getline(line(".")) + " go to word at pos + execute 'normal 0' . a:wordNum . 'w' + if (line(".") == cursorLine) + if (virtcol('.') > a:pos) + " word has to be undented + " go to end of previous word + execute 'normal ge' + if (virtcol('.') < a:pos-1) + " ok, only whitespace to delete + " echo 'undent' col(".") + execute 'normal ' . a:pos . '|dw' + else + " delete as much as possible + " echo 'remove' col(".") + execute 'normal ldwi ' + endif + else + " word has to be indented + " echo 'indent' col(".") + execute 'normal h' + while (virtcol('.') < a:pos-1) + " indent word + execute "normal a\<TAB>\<ESC>" + endwhile + endif + else +" echo 'kein' a:wordNum '. Wort in Zeile' cursorLine + endif + " restore cursor position + call cursor(cursorLine, cursorCol) +endfunction + +" ---------------- +" Comment In / Out +" ---------------- +nnoremap <C-K> :call CommentInOut(b:commentstring)<CR>j +command CommentInOut call CommentInOut(b:commentstring) +function CommentInOut(commentstring) + let leadingWhitespace = '^\s\*' + let noLeadingWhitespace = '^' + let ignoreCase = '\c' + let CommentedString = ignoreCase . noLeadingWhitespace . a:commentstring + let line = GetLine() + let line_nr = line('.') + let found = match(line, CommentedString) + "echo l:found + if (found == -1) + "echo 'nicht gefunden' + let line = substitute(line, '^', a:commentstring, '') + else + "echo 'gefunden' + let line = substitute(line, a:commentstring, '', '') + endif + call setline(line_nr, line) +endfunction + +" mark lines longer as textwidth +command MarkLongLines call MarkLongLines('on') +command MarkLongLinesOff call MarkLongLines('off') +function MarkLongLines(onoff) +" echo a:onoff + if (a:onoff=='on') + let markline = &textwidth + 1 + let longline='"\%' . markline . 'v.*"' +" execute('let @/ = ' . longline) + execute 'syntax match toLong ' . longline . ' containedin=ALL' + highlight toLong guibg=red + else +" execute 'normal :nohlsearch<CR>' + syntax clear toLong + highlight clear toLong + endif +endfunction + +command SynaxShowGroup execute('echo synIDattr(synID(line("."), col("."), 1), "name")') + +" diff options +set diffexpr=FileDiff() +set diffopt=filler,iwhite +function FileDiff(...) + let opt = '-a --binary ' + if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif + if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif + if a:0 == 3 + let arg1 = a:1 + let arg2 = a:2 + let arg3 = a:3 + else + let arg1 = v:fname_in + let arg2 = v:fname_new + let arg3 = v:fname_out + endif + + if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif + if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif + if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif + let eq = '' + if $VIMRUNTIME =~ ' ' + if &sh =~ '\<cmd' + let cmd = '""' . $VIMRUNTIME . '\diff"' + let eq = '"' + else + let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"' + endif + else + let cmd = $VIMRUNTIME . '\diff' + endif + if !executable(cmd) + let cmd = 'diff' + endif + silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq +endfunction + + +" turn diff off +command DiffClose call DiffClose() +function DiffClose() + :quit + call DiffOff() +endfunction + +command DiffOff call DiffOff() +function DiffOff() + set nodiff + set noscrollbind + set foldcolumn=0 + set foldmethod=syntax +endfunction + +" options for DirDiff +let g:DirDiffCommand = expand($VIMRUNTIME . '/diff') +let g:DirDiffExcludes = '*.log,*.pyc,.svn,_ccmwaid.inf,.static_wa,out,tags,cscope.out' +"let g:DirDiffDynamicDiffText = 1 + +" options for Vimball +let g:vimball_home = expand(g:vimsuite . '/vimfiles') + +" merge +command -nargs=+ Merge call Merge(<args>) +function Merge(...) + let args = a:0 + if a:0 != 4 + echo 'usage: Merge first,second,root,out' + else + let first = fnamemodify(bufname(a:1), ':p:8') + let second = fnamemodify(bufname(a:2), ':p:8') + let root = fnamemodify(bufname(a:3), ':p:8') + let out = fnamemodify(bufname(a:4), ':p:8') + echo 'root-buffer :' root + echo 'first-buffer :' first + echo 'second-buffer:' second + echo 'output-buffer:' out + + execute '!'. g:diff . ' ' . root . ' '. first . ' | ' . g:patch . ' --force ' . second . ' --output="' . out + execute bufwinnr(4) . 'wincmd w' + execute 'edit' + execute 'wincmd =' + endif +endfunction + +" ------------- +" abbreviations +" ------------- +"iabbreviate li !IST_LIEBL: */<Left><Left><Left> + + +" ------ +" python +" ------ +command Batch echo system(expand('%:p:r.bat')) +command -nargs=* Python execute(':wa | cd ' . GetBmskDir()) | echo system(g:python . ' ' . expand('%:p') . ' <args>') + +" --------- +" templates +" --------- +command InsertCHeader call Insert_Header('file_c.tpl') +command InsertHHeader call Insert_Header('file_h.tpl') +command InsertFHeader call Insert_Header('funct.tpl') +command InsertHTMLHeader call Insert_Header('html.tpl') +function Insert_Header(file) + let file = g:vimfiles . '/templates/' . a:file + execute ':read ' . file + let l:filename = expand('%:t') + execute ':%s/%filename/' . l:filename . '/e' + let l:basename = substitute(expand('%:t:r'), '.*', '\U\0', '') + execute ':%s/%basename/' . l:basename . '/e' + let l:author = 'IST_LIEBL' + execute ':%s/%author/' . l:author . '/e' + while search('%date', '') > 0 + "execute 'normal /%date' + execute ':d' + execute ':HistoryComment' + execute 'normal jdd' + endwhile +endfunction + +EchoDebug 'loaded tools.vim' diff --git a/vimfiles.stefan/plugin/uc.vim b/vimfiles.stefan/plugin/uc.vim new file mode 100644 index 0000000..f10bba8 --- /dev/null +++ b/vimfiles.stefan/plugin/uc.vim @@ -0,0 +1,29 @@ +" Vim filetype plugin file +" Language: TPU-Micro-Code for Motorola-Processor +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" Last Change: 22003 Apr 8 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +"setlocal cindent + + +" Set 'formatoptions' to break comment lines but not other lines, +" and insert the comment leader when hitting <CR> or using "o". +setlocal fo-=t fo+=croql + +" Set 'comments' to format dashed lists in comments. +"setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// + +setlocal syntax=uc + +setlocal tabstop=8 + +" Grep options +let b:GrepFiles = '*.uc' diff --git a/vimfiles.stefan/projects_example.txt b/vimfiles.stefan/projects_example.txt new file mode 100644 index 0000000..531cadc --- /dev/null +++ b/vimfiles.stefan/projects_example.txt @@ -0,0 +1,3 @@ +e:\wa\bmsk-qx13468 +e:\wa\bmsk-k25 +e:\wa\bmsk-k40 diff --git a/vimfiles.stefan/spell/bmsk.add b/vimfiles.stefan/spell/bmsk.add new file mode 100644 index 0000000..c1663c6 --- /dev/null +++ b/vimfiles.stefan/spell/bmsk.add @@ -0,0 +1,325 @@ +NV +Programmstand +gemappt +Versions +Mapfile +Labelnamen +Labeladdresse +Labelanzahl +Sections +Damos +Adressierschema +CCP +Kodierdaten +Emulations +Applikationshinweise +Powerfail +Testhinweise +Testlabel +Adaptionswerte +KL15 +soll +Inode +Partitiontable +Flashpages +Sectioninfo +Kodiervorg�ngen +Group +Embedded +Tailoring +Modulentwurf +Betriebsebene +Funktionsplaner +UX +EA +C +Portierbarkeit +Testbarkeit +Debug +eingeschwungen +if +for +while +Defines +static +Inline +schon +Lint +BMS +enum +typdef +struct +Postfixes +const +define +Built +Libraries +endif +ASCET +Warnings +header +geschwindigkeitskritischen +d +h +Busse +Source +Includes +ERCOS +Dokumentationsablauf +Funktionssoftware +Synergy +Programmstandsarten +X +z +B +Entwicklerst�nde +Programmstandstyp +Teststanderzeugung +Serienstanderzeugung +CW +KL +KF +Simulink +c +kgs +mak +hex +s19 +obj +dep +a2l +dcm +map +paf +daf +0pa +readonly +int +WinProF +WinKFP +Object +Dependency +PED +INCA +kon +Entwicklerstand +Programmst�nden +Zif +V +ProF +make +Entwicklerst�nden +SEED +DarWin +Programmstands +prep +projects +project +distclean +Role +build +mgr +Actions +Edit +Programmstandsnamen +Purpose +Use +Testing +Value +Current +Platform +Reconfigure +Using +reconfigure +Sync +Properties +folder +BMSK +task +Add +released +Conflicts +product +config +logistik +xls +Auslierferungs +ExportLogisikMak +allEntwickler +allSerie +Entwicklerdaten +Programmiertests +OBD +Expertenmodus +Prog +K +test +easerv +Schonert +Kupske +K2x +K4x +K7x +Sell +Andr� +EDIABAS +ident +Serienauslieferung +K25 +Auslieferungsstand +Ausgabeverzeichnis +s19boschsig +bosch +sig +flash +signatur +pruefen +ERROR +SUPPORTED +SIGNATURE +ekp +kwp +Keyword +funktionen +n +t +mot +Motorsteuerungsfunktionen +Variablenbezeichnungen +Applikations +Funktionsdokumentation +Funktionsidee +u +a +Funktionsentwicklung +Funktionssoftwareentwicklung +p +e +s +l +ChangeSynergy +WorkArea +Working +CR +resolved +assigend +closed +Entwicklerstands +zw +Einzelanforderungen +IEC61508 +VDA +Q +Projektunabh�ngige +Unternehmensqualit�t +Managementhandbuch +Projektabh�ngige +CS +Motorsteuerungsprojekte +Request +synergy5 +cs +erreichbar +TSS +Funktionsentwicklungs +Validierungsprozesses +Validierungsprozess +Wiki +https +tgmwiki +Anforderungs +netzwerks +bmskp +working +Tested +completed +developer +Schnittstellendokument +�nderungsdokumentation +�nderungsdokument +Informationsschutzbestimmungen +Arbeits +Doell +R +entwicklung +�berarbeitungen +SOP +Projektgrenzen +Hardwareentwicklung +Rahmenentwicklungsvertrags +Projektgespr�chen +Leistungsschnittstellenvereinbahrung +Budgetverantwortlichen +Rahmenentwicklungsvertrag +Teammeetings +OPL +Protokollf�hrung +Mindestteilnehmer +Teamleitung +Projektlaufwerk +Sourcen +Continuus +Systembilder +Schaltplandaten +Bauteillisten +Protel +Visula +planung +steuerung +Burkhardt +Gesamtrojektleitung +Funktionsplanung +Ressourcenplanung +Budgetverantwortlicher +Ortner +Schnittstellenverantwortung +Liebl +ZL +Buhl +Gesamtprojektleitung +mailto +bmw +Versionierung +SB +HW +EGAS +Ellwanger +Programmstandserstellung +SL +partner +CB +Breuerl +Ulbricht +MU +Entscheidungs +Eskalationswege +Eskalationsweg +Dokumentablage +Besprechungsdokumente +Programmst�nde +Ordnerstruktur +Projektlaufwerkes +Projektablage +Practices +RPLAN +Testabsicherung +SG +Analyser +MISRA +Integrate +Signalsimulatoren +Applikationssystem +HIL +Implementierungsfehler +Spezifikationsfehler +Funktionsentwickler +TA +�nderungsumfang +bedaten +Gesamtfunktionalit�t +Pr�fstandsl�ufe +Dokumentenkontrolle +disk +false +true +copy_FCMTabEntryType diff --git a/vimfiles.stefan/spell/bmsk.add.spl b/vimfiles.stefan/spell/bmsk.add.spl new file mode 100644 index 0000000..c22d5a6 Binary files /dev/null and b/vimfiles.stefan/spell/bmsk.add.spl differ diff --git a/vimfiles.stefan/spell/de.latin1.spl b/vimfiles.stefan/spell/de.latin1.spl new file mode 100644 index 0000000..5f4e7e8 Binary files /dev/null and b/vimfiles.stefan/spell/de.latin1.spl differ diff --git a/vimfiles.stefan/syntax/c.vim b/vimfiles.stefan/syntax/c.vim new file mode 100644 index 0000000..572096a --- /dev/null +++ b/vimfiles.stefan/syntax/c.vim @@ -0,0 +1,49 @@ + +" special keywords +syntax keyword cType uint8 sint8 uint16 sint16 uint32 sint32 uint64 sint64 +syntax keyword cType tuint8 tsint8 tuint16 tsint16 tuint32 tsint32 tuint64 tsint64 +syntax keyword cType DfpType SfpType SfpErrorType LWrd LInt +syntax keyword cType TickType +syntax keyword Special ATOMIC BEGIN_ATOMIC END_ATOMIC +"syntax match cTodo "!\s*IST_LIEBL.*[^*/]" +syntax match cTodo "\(!\s*IST_LIEBL.*\>\)\ze\s*\*/" +syntax match cTodo "\(debug\)" +syntax keyword cConstant TRUE FALSE + +syntax region myFold start="{" end="}" transparent fold +syntax region if0Fold start="^\s*#\s*if\s\+0\+\>" end="^\s*#\s*endif" fold containedin=cPreCondit +let c_no_if0 = 1 +syntax sync fromstart +set foldmethod=syntax +set nofoldenable + +" Folds for #ifdef +command! -nargs=0 FoldDefine call FoldDefine(<args>) +function! FoldDefine () + execute 'normal mx' + let startline = line('.') +" execute 'normal %k' + execute 'normal 0%' + if match(GetLine(), 'endif') < 0 + execute 'normal k' + endif + let endline = line('.') +" echo 'start: ' . startline . ' end: ' . endline + let foldname = 'FoldDefine' . startline + let start='"\%' . startline . 'l.*"' + let end='"\%' . endline . 'l.*"' + let command = 'syntax region ' . foldname . ' start=' . start . ' end=' . end . ' fold containedin=cPreCondit' +" echo command + execute command + execute 'highlight def link ' . foldname . ' Comment' + syntax sync fromstart + set foldmethod=syntax + execute 'normal `x' +endfunction + +command! -nargs=0 UnFoldDefine call UnFoldDefine(<args>) +function! UnFoldDefine () + let foldname = 'FoldDefine' . line('.') + execute "syntax clear " . foldname +endfunction + diff --git a/vimfiles.stefan/syntax/java.vim b/vimfiles.stefan/syntax/java.vim new file mode 100644 index 0000000..baed75d --- /dev/null +++ b/vimfiles.stefan/syntax/java.vim @@ -0,0 +1,4 @@ +syntax region myFold start="{" end="}" transparent fold +syntax sync fromstart +set foldmethod=syntax + diff --git a/vimfiles.stefan/syntax/paf.vim b/vimfiles.stefan/syntax/paf.vim new file mode 100644 index 0000000..8824acf --- /dev/null +++ b/vimfiles.stefan/syntax/paf.vim @@ -0,0 +1,58 @@ +" Vim syntax file +" Language: Motorola S record +" Maintainer: slimzhao <vim2004@21cn.com> +" Last Change: 2004 May 31 +" License: This file is placed in the public domain. + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn case ignore + +" storage types + +syn match srecChecksum /\x\{2}\r\?$/ contained +syn match LineType /^:\x\{2}/ contained +syn match Addr /\%4c\x\{4}/ contained +syn match AddrOffset /\%10c\x\{4}/ contained +syn match RecordType /\%8c\x\{2}/ contained +syn match NormalRecord /^:10\x\{40}/ contained contains=LineType,Addr,RecordType,srecChecksum +syn match ExtendedRecord /^:02\x\{12}/ contained contains=LineType,RecordType,AddrOffset,srecChecksum +syn match OtherRecord /^:\x\{15,39}$/ contained contains=LineType,Addr,RecordType,srecChecksum +syn match Record /^:\x\+/ contains=NormalRecord,ExtendedRecord,OtherRecord + +syn case match + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_srec_syntax_inits") + if version < 508 + let did_srec_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink Record Normal + HiLink NormalRecord Normal + HiLink ExtendedRecord Normal + HiLink RecordType Special + HiLink Addr Constant + HiLink AddrOffset Constant + "Checksum + HiLink srecChecksum Search + "Record type + HiLink LineType Comment + + delcommand HiLink +endif + +let b:current_syntax = "paf" + +" vim: ts=8 diff --git a/vimfiles.stefan/syntax/trace.vim b/vimfiles.stefan/syntax/trace.vim new file mode 100644 index 0000000..1bcf2c7 --- /dev/null +++ b/vimfiles.stefan/syntax/trace.vim @@ -0,0 +1,189 @@ +" Vim syntax file +" Language: Trace32 script +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" URL: +" Credits: Based on the java.vim syntax file by Claudio Fleiner +" Last change: 2004 Mar 03 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" we define it here so that included files can test for it +if !exists("main_syntax") + let main_syntax='trace' +endif + +" ignore case +syn case ignore + +" keyword definitions +syn keyword traceConditional if then +syn keyword traceRepeat repeat + +" trace commands +syn match traceCommand '\<\w\+\(\.\w\+\)*\>' transparent contains=traceFlashCommand,traceDataCommand,traceGlobalCommand,traceWinpageCommand,traceAreaCommand,tracePrintCommand,traceEntryCommand,traceWaitCommand,traceChdirCommand,traceEnddoCommand,traceOsCommand,traceDoCommand,traceStringCommand,traceGotoCommand,traceSystemCommand,traceRegisterCommand + +" trace commands +syn match traceFlashCommand '\<\(flash\|f\)\>\.' contained nextgroup=traceFlashResetCommand,traceFlashCreateCommand,traceFlashTargetCommand,traceFlashEraseCommand,traceFlashProgramCommand +hi link traceFlashCommand traceCommand +syn match traceDataCommand '\<\(data\|d\)\>\.' contained nextgroup=traceDataLoadCommand,traceDataSetCommand +hi link traceDataCommand traceCommand +syn match traceGlobalCommand '\<\(global\)\>' contained +hi link traceGlobalCommand traceCommand +syn match traceWinpageCommand '\<\(winpage\)\>\.' contained nextgroup=traceWinpageResetCommand,traceWinpageCreateCommand,traceWinpageSelectCommand +hi link traceWinpageCommand traceCommand +syn match traceAreaCommand '\<\(area\)\>\.' contained nextgroup=traceAreaResetCommand,traceAreaCreateCommand,traceAreaSelectCommand,traceAreaViewCommand +hi link traceAreaCommand traceCommand +syn match tracePrintCommand '\<\(print\)\>' contained +hi link tracePrintCommand traceCommand +syn match traceEntryCommand '\<\(entry\)\>' contained +hi link traceEntryCommand traceCommand +syn match traceWaitCommand '\<\(wait\)\>' contained +hi link traceWaitCommand traceCommand +syn match traceChdirCommand '\<\(chdir\)\.\?\>' contained nextgroup=traceChdirDoCommand +hi link traceChdirCommand traceCommand +syn match traceEnddoCommand '\<\(enddo\)\>' contained +hi link traceEnddoCommand traceCommand +syn match traceOsCommand '\<\(os\)\>\.' contained nextgroup=traceOsPsdCommand,traceOsPtdCommand,traceOsEnvCommand,traceOsFileCommand +hi link traceOsCommand traceCommand +syn match traceDoCommand '\<\(do\)\>' contained +hi link traceDoCommand traceCommand +syn match traceStringCommand '\<\(string\)\>\.' contained nextgroup=traceStringCutCommand,traceStringScanCommand +hi link traceStringCommand traceCommand +syn match traceGotoCommand '\<\(goto\)\>' contained +hi link traceGotoCommand traceCommand +syn match traceSystemCommand '\<\(system\|sys\)\>\.' contained nextgroup=traceSystemCpuCommand,traceSystemBdmclockCommand,traceSystemUpCommand +hi link traceSystemCommand traceCommand +syn match traceRegisterCommand '\<\(register\)\>\.' contained nextgroup=traceRegisterSetCommand +hi link traceRegisterCommand traceCommand + +" second commands +syn match traceDataLoadCommand '\(load\.\?\)' contained nextgroup=traceDataLoadBinaryCommand,traceDataLoadElfCommand +hi link traceDataLoadCommand traceCommand +syn match traceDataSetCommand '\(set\)' contained +hi link traceDataSetCommand traceCommand +syn match traceFlashResetCommand '\(reset\)' contained +hi link traceFlashResetCommand traceCommand +syn match traceFlashEraseCommand '\(erase\.\?\)' contained nextgroup=traceFlashEraseAllCommand +hi link traceFlashEraseCommand traceCommand +syn match traceFlashProgramCommand '\(program\.\?\)' contained nextgroup=traceFlashProgramAllCommand,traceFlashProgramOffCommand +hi link traceFlashProgramCommand traceCommand +syn match traceFlashCreateCommand '\(create\)' contained +hi link traceFlashCreateCommand traceCommand +syn match traceFlashTargetCommand '\(target\)' contained +hi link traceFlashTargetCommand traceCommand +syn match traceChdirDoCommand '\(do\)' contained +hi link traceChdirDoCommand traceCommand +syn match traceWinpageResetCommand '\(reset\)' contained +hi link traceWinpageResetCommand traceCommand +syn match traceWinpageCreateCommand '\(create\)' contained +hi link traceWinpageCreateCommand traceCommand +syn match traceWinpageSelectCommand '\(select\)' contained +hi link traceWinpageSelectCommand traceCommand +syn match traceAreaResetCommand '\(reset\)' contained +hi link traceAreaResetCommand traceCommand +syn match traceAreaCreateCommand '\(create\)' contained +hi link traceAreaCreateCommand traceCommand +syn match traceAreaSelectCommand '\(select\)' contained +hi link traceAreaSelectCommand traceCommand +syn match traceAreaViewCommand '\(view\)' contained +hi link traceAreaViewCommand traceCommand +syn match traceOsPsdCommand '\(psd()\)' contained +hi link traceOsPsdCommand traceCommand +syn match traceOsPtdCommand '\(ptd()\)' contained +hi link traceOsPtdCommand traceCommand +syn match traceOsEnvCommand '\(env\)' contained +hi link traceOsEnvCommand traceCommand +syn match traceOsFileCommand '\(file\)' contained +hi link traceOsFileCommand traceCommand +syn match traceStringCutCommand '\(cut\)' contained +hi link traceStringCutCommand traceCommand +syn match traceStringScanCommand '\(scan\)' contained +hi link traceStringScanCommand traceCommand +syn match traceSystemCpuCommand '\(cpu\)' contained +hi link traceSystemCpuCommand traceCommand +syn match traceSystemBdmclockCommand '\(bdmclock\)' contained +hi link traceSystemBdmclockCommand traceCommand +syn match traceSystemUpCommand '\(up\)' contained +hi link traceSystemUpCommand traceCommand +syn match traceRegisterSetCommand '\(set\)' contained +hi link traceRegisterSetCommand traceCommand + +" third commands +syn match traceDataLoadBinaryCommand '\(binary\|b\)' contained +hi link traceDataLoadBinaryCommand traceCommand +syn match traceDataLoadElfCommand '\(elf\)' contained +hi link traceDataLoadElfCommand traceCommand +syn match traceFlashEraseAllCommand '\(all\)' contained +hi link traceFlashEraseAllCommand traceCommand +syn match traceFlashProgramAllCommand '\(all\)' contained +hi link traceFlashProgramAllCommand traceCommand +syn match traceFlashProgramOffCommand '\(off\)' contained +hi link traceFlashProgramOffCommand traceCommand + +syn match traceFunction '\<cpufamily\s*(.*)' +"syn keyword traceBranch goto call + +syn match traceOperator "\(:=\)\|\(=\)\|\(<-\)\|\(->\)\|\(>>\)\|[+-]" +"syn match traceEOS "[.,;:]\(\s\|\n\)" +syn match traceSeperator "[.,;:]" + +" Comments +syn keyword traceTodo contained TODO FIXME XXX +" string inside comments +syn region traceCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=traceSpecial,traceCommentStar,traceSpecialChar +syn region traceComment2String contained start=+"+ end=+$\|"+ contains=traceSpecial,traceSpecialChar +syn match traceCommentCharacter contained "'\\[^']\{1,6\}'" contains=traceSpecialChar +syn match traceCommentCharacter contained "'\\''" contains=traceSpecialChar +syn match traceCommentCharacter contained "'[^\\]'" +"syn region traceComment start="(\*" end="\*)" contains=traceCommentString,traceCommentCharacter,traceNumber,traceTodo +"syn match traceCommentStar contained "^\s*\*[^/]"me=e-1 +"syn match traceCommentStar contained "^\s*\*$" +syn match traceLineComment ";.*" contains=traceComment2String,traceCommentCharacter,traceNumber,traceTodo +hi link traceLineComment traceComment +hi link traceCommentString traceString +hi link traceComment2String traceString +"hi link traceCommentCharacter traceCharacter + +" Strings and constants +syn region traceString start=+"+ end=+"+ contains=ucSpecialChar,ucSpecialError +"syn match traceNumber "#\?\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" +"syn match traceNumber "#\?$\?\<\x\+\>" + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_trace_syntax_inits") + if version < 508 + let did_trace_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink traceConditional Conditional + HiLink traceRepeat Repeat + HiLink traceNumber Number + HiLink traceComment Comment + HiLink traceString String + HiLink traceBranch Statement + HiLink traceOperator String + HiLink traceEOS String + HiLink traceSeperator String + HiLink traceLabel Label + HiLink traceCommand Statement + HiLink traceFunction Function + + delcommand HiLink +endif + +let b:current_syntax = "trace" + +if main_syntax == 'trace' + unlet main_syntax +endif + +" vim: ts=8 diff --git a/vimfiles.stefan/syntax/uc.vim b/vimfiles.stefan/syntax/uc.vim new file mode 100644 index 0000000..e72c08a --- /dev/null +++ b/vimfiles.stefan/syntax/uc.vim @@ -0,0 +1,120 @@ +" Vim syntax file +" Language: Motorola TPU Microcode +" Maintainer: Stefan Liebl <S.Liebl@gmx.de> +" URL: ftp://ftp. +" Credits: Based on the java.vim syntax file by Claudio Fleiner +" Last change: 2003 Apr 8 + +" Please check :help uc.vim for comments on some of the options available. + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" we define it here so that included files can test for it +if !exists("main_syntax") + let main_syntax='tpu' +endif + +" keyword definitions +syn keyword tpuConditional if then +syn keyword tpuRepeat repeat +"syn keyword tpuMacro macro +syn keyword tpuEntryDef start_address name cond end disable_match return +syn keyword tpuHsr hsr0 hsr1 +syn keyword tpuRegs tsr lsr tbs p pac pin ccl C Z P A N SR ERT DIOB P_High P_Low P_high P_low TCR1 +syn keyword tpuFlags flag1 flag2 Flag0 Flag1 Flag2 +syn keyword tpuBranch goto call +syn keyword tpuChan chan +syn keyword tpuSetValue set clear high low Low High max nil no_change +syn keyword tpuSet write_mer enable_mtsr neg_mrl neg_lsl neg_tdl out_m1_c1 match_gte +syn keyword tpuSetExpr ram au shift no_flush flush +syn keyword tpuIsr cir + +syn match tpuOperator "\(:=\)\|\(=\)\|\(<-\)\|\(->\)\|\(>>\)\|[+-]" +syn match tpuEOS "[.,;:]\(\s\|\n\)" +syn match tpuSeperator "[.,;:]" + +syn cluster tpuRegister contains=tpuFlags,tpuRegs +hi link tpuRegs tpuRegister +hi link tpuFlags tpuRegister +hi link tpuSetValue tpuSet +hi link tpuSetExpr tpuSet + +" %entry ... +syn region tpuEntry start="^\s*%entry" end="\." contains=tpuEntryDef,tpuOperator,tpuSeparator,tpuNumber +syn match tpuLabel "^\w\+:" + +" marco definitions +syn region tpuMacroDef start="^\s*%\s*macro\>" skip="\\$" end="\." contains=ALLBUT,tpuMarcoDef +syn region tpuMacroUse start="@\w*" end="\>" + +" Comments +syn keyword tpuTodo contained TODO FIXME XXX +" string inside comments +syn region tpuCommentString contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=tpuSpecial,tpuCommentStar,tpuSpecialChar +syn region tpuComment2String contained start=+"+ end=+$\|"+ contains=tpuSpecial,tpuSpecialChar +syn match tpuCommentCharacter contained "'\\[^']\{1,6\}'" contains=tpuSpecialChar +syn match tpuCommentCharacter contained "'\\''" contains=tpuSpecialChar +syn match tpuCommentCharacter contained "'[^\\]'" +syn region tpuComment start="(\*" end="\*)" contains=tpuCommentString,tpuCommentCharacter,tpuNumber,tpuTodo +syn match tpuCommentStar contained "^\s*\*[^/]"me=e-1 +syn match tpuCommentStar contained "^\s*\*$" +"syn match tpuLineComment "//.*" contains=tpuComment2String,tpuCommentCharacter,tpuNumber,tpuTodo +hi link tpuCommentString tpuString +hi link tpuComment2String tpuString +"hi link tpuCommentCharacter tpuCharacter + +" match the special comment (**) +"syn match tpuComment "(\*\*)" + +" Strings and constants +syn region tpuString start=+'+ end=+'+ contains=ucSpecialChar,ucSpecialError +syn match tpuNumber "#\?\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" +syn match tpuNumber "#\?$\?\<\x\+\>" + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_tpu_syntax_inits") + if version < 508 + let did_tpu_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink tpuConditional Conditional + HiLink tpuRepeat Repeat + HiLink tpuNumber Number + HiLink tpuComment Comment + HiLink tpuMacroDef PreProc + HiLink tpuMacroUse PreProc + HiLink tpuEntry Function + HiLink tpuEntryDef Statement + HiLink tpuString String + HiLink tpuRegister Identifier + HiLink tpuBranch Statement + HiLink tpuChan Statement + HiLink tpuSet Statement + HiLink tpuIsr Special + HiLink tpuHsr Special + HiLink tpuOperator String + HiLink tpuEOS String + HiLink tpuSeperator String + HiLink tpuLabel Label + + delcommand HiLink +endif + +let b:current_syntax = "tpu" + +if main_syntax == 'tpu' + unlet main_syntax +endif + +" vim: ts=8 diff --git a/vimfiles.stefan/templates/file.tps b/vimfiles.stefan/templates/file.tps new file mode 100644 index 0000000..369d1fd --- /dev/null +++ b/vimfiles.stefan/templates/file.tps @@ -0,0 +1,52 @@ +/***************************************************************************** + * + * FILENAME: %-r%-e + * + * AUTHOR: IST_LIEBL + * + * DESCRIPTION: + * + * + * + * HISTORY: + * + * %date IST_LIEBL + * created file + * + ****************************************************************************/ + +/*---------------------------------------------------------------------------- + * includes + *--------------------------------------------------------------------------*/ +#include "stdtype.h" /* uint8, ... */ + +/*---------------------------------------------------------------------------- + * defines + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * constants + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * variables + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * public function prototypes + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * privat function prototypes + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * public functions + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * privat functions + *--------------------------------------------------------------------------*/ + +/* end of file: %-r%-e */ +%line9%col5 diff --git a/vimfiles.stefan/templates/file_c.tpl b/vimfiles.stefan/templates/file_c.tpl new file mode 100644 index 0000000..ad32e44 --- /dev/null +++ b/vimfiles.stefan/templates/file_c.tpl @@ -0,0 +1,36 @@ +/***************************************************************************** + * + * FILENAME: %filename + * + * AUTHOR: %author + * + * DESCRIPTION: + * + * + * + * HISTORY: + * + * %date %author + * created file + * + ****************************************************************************/ + +/*---------------------------------------------------------------------------- + * includes + *--------------------------------------------------------------------------*/ +#include "std_type.h" /* uint8, ... */ + +/*---------------------------------------------------------------------------- + * function prototypes + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * public functions + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * privat functions + *--------------------------------------------------------------------------*/ + +/* end of file: %filename */ + diff --git a/vimfiles.stefan/templates/file_h.tpl b/vimfiles.stefan/templates/file_h.tpl new file mode 100644 index 0000000..c6d52e0 --- /dev/null +++ b/vimfiles.stefan/templates/file_h.tpl @@ -0,0 +1,48 @@ +/***************************************************************************** + * + * FILENAME: %filename + * + * AUTHOR: %author + * + * DESCRIPTION: + * + * + * + * HISTORY: + * + * %date %author + * created file + * + ****************************************************************************/ + +#ifndef _%basename_H +#define _%basename_H + +/*---------------------------------------------------------------------------- + * includes + *--------------------------------------------------------------------------*/ +#include "std_type.h" /* uint8, ... */ + +/*---------------------------------------------------------------------------- + * defines + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * typedefs + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * constants + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * variables + *--------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- + * public functions + *--------------------------------------------------------------------------*/ + +#endif /* _%basename_H */ +/* end of file: %filename */ + diff --git a/vimfiles.stefan/templates/funct.tpl b/vimfiles.stefan/templates/funct.tpl new file mode 100644 index 0000000..68d6b46 --- /dev/null +++ b/vimfiles.stefan/templates/funct.tpl @@ -0,0 +1,10 @@ + /************************************************************************* + * FUNCTION: + * + * PARAMETERS: + * + * DESCRIPTION: + * + * RETURNS: + * + ************************************************************************/ diff --git a/vimfiles.stefan/templates/html.tpl b/vimfiles.stefan/templates/html.tpl new file mode 100644 index 0000000..e6a511d --- /dev/null +++ b/vimfiles.stefan/templates/html.tpl @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE></TITLE> +</HEAD> +<BODY> + +</BODY> +</HTML> diff --git a/vimfiles.stefan/tools/cscope.exe b/vimfiles.stefan/tools/cscope.exe new file mode 100644 index 0000000..a7f70d1 Binary files /dev/null and b/vimfiles.stefan/tools/cscope.exe differ diff --git a/vimfiles.stefan/tools/ctags.exe b/vimfiles.stefan/tools/ctags.exe new file mode 100644 index 0000000..c17d76a Binary files /dev/null and b/vimfiles.stefan/tools/ctags.exe differ diff --git a/vimfiles.stefan/tools/patch.exe b/vimfiles.stefan/tools/patch.exe new file mode 100644 index 0000000..cc0bdb0 Binary files /dev/null and b/vimfiles.stefan/tools/patch.exe differ diff --git a/vimfiles.stefan/tools/python23.dll b/vimfiles.stefan/tools/python23.dll new file mode 100644 index 0000000..f6ad008 Binary files /dev/null and b/vimfiles.stefan/tools/python23.dll differ diff --git a/vimfiles.stefan/tools/python24.dll b/vimfiles.stefan/tools/python24.dll new file mode 100644 index 0000000..825ae2f Binary files /dev/null and b/vimfiles.stefan/tools/python24.dll differ diff --git a/vimfiles.stefan/tools/tee.exe b/vimfiles.stefan/tools/tee.exe new file mode 100644 index 0000000..7b32b2a Binary files /dev/null and b/vimfiles.stefan/tools/tee.exe differ diff --git a/vimfiles.stefan/tools/untee.bat b/vimfiles.stefan/tools/untee.bat new file mode 100644 index 0000000..0216078 --- /dev/null +++ b/vimfiles.stefan/tools/untee.bat @@ -0,0 +1,2 @@ +@rem redirect stderr to stdout +@%* 2>&1 diff --git a/vimfiles.stefan/vimrc b/vimfiles.stefan/vimrc new file mode 100644 index 0000000..2e41449 --- /dev/null +++ b/vimfiles.stefan/vimrc @@ -0,0 +1,222 @@ +" Setzen des Runtimepath, in dem die Vimfiles gesucht werden: +let &runtimepath = $VIMRUNTIME +let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles' +let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles.latex' +let &runtimepath = &runtimepath . ',' . g:vimsuite . '/HTML' +let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles.damos' +let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles.cvim' +let &runtimepath = &runtimepath . ',' . g:vimsuite . '/vimfiles.vjde' +let &runtimepath = &runtimepath . ',' . g:vimfiles + +" Laden weiterer Einstellungen: +if has("win32") + let g:os ='dos' + execute 'source ' . expand(g:vimfiles . '/vimrc.dos') +else + let g:os = 'linux' + execute 'source ' . expand(g:vimfiles . '/vimrc.linux') +endif + +if !exists('nobmsk') + execute 'source ' . expand(g:vimfiles . '/vimrc.bmsk') +endif + +" global settings +" --------------- +" Use Vim settings, rather then Vi settings (much better!). +" This must be first, because it changes other options as a side effect. +set nocompatible +set nobackup " keep no backup file +set history=50 " keep 50 lines of command line history +set ruler " show the cursor position all the time +set showcmd " display incomplete commands + +" filetype detection +filetype on +filetype plugin on +filetype plugin indent on +"syntax highlighing +"syntax on +syntax enable + +" no syntax highliting when printing +set printoptions+=syntax:n + +"highlite search +set incsearch +set hlsearch + +" set global option for substitute +set gdefault +" case sensitive search +set noignorecase + +" set very intelligent formatting +set formatoptions=croqwan2 + +" swap and backup directory +let &directory = g:swapdir +if !(isdirectory(g:swapdir)) + try + call mkdir(g:swapdir, 'p') + echo 'swapdir ' . g:swapdir . ' wurde erzeugt' + catch + echo 'swapdir ' . g:swapdir . ' existiert nicht und konnte nicht erzeugt werden' + echo 'bitte erzeugen oder in ' . $VIMRUNTIME . '/../_vimrc �ndern' + echo '---' + set directory& + endtry +endif +let &backupdir = g:backupdir +if !(isdirectory(g:backupdir)) + try + call mkdir(g:backupdir, 'p') + echo 'backupdir ' . g:backupdir . ' wurde erzeugt' + catch + echo 'backupdir ' . g:backupdir . ' existiert nicht und konnte nicht erzeugt werden' + echo 'bitte erzeugen oder in ' . $VIMRUNTIME . '/../_vimrc �ndern' + echo '---' + set backupdir& + endtry +endif + +" -------- +" Changing +" -------- +" Don't use Ex mode, use Q for formatting +"map Q gq + +" overwrite selected text +vnoremap p s<C-R>0<ESC> +vnoremap P s<C-R>0<ESC> + +" list tags +inoremap <C-T> <ESC>:tselect /^<C-R><C-W><CR> + +" search for visual block +vnoremap <silent> g/ y/\V<C-R>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR> +vnoremap <silent> g? y?\V<C-R>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR> + +" ------- +" Display +" ------- +" switchbuffer: use open window, split if new +"set switchbuf=useopen,split +set switchbuf=useopen +" wrap long lines +set wrap +" show line-numbers +set number +" show title +set title +" show matching bracket +set showmatch +" matchtime in 1/10 seconds +set matchtime=5 +" show wrapped line +set showbreak=--> +" show position of cursor +set ruler +" show incomplete command +set showcmd +" match braces +"nnoremap g4 /[\(\{\[]<CR>:nohls<CR>v%o +"vnoremap g4 vg4 + +" set textwidth to 78 +set textwidth=78 + +" special characters +" list special characters +set list +" special characters: +set listchars=eol:$,tab:>\ ,trail:_,extends:�,precedes:� +" special characters for keywords +" set iskeyword+= + +" horizontal scrollbar in diff-mode +if &diff + set guioptions+=b +endif + +" ------ +" Moving +" ------ +" scrollwith at ^U and ^D +set scroll=5 +" lines around the cursor +set scrolloff=10 +" wrap line at (b=<BS>, s=<space>, h, l, <, >, [, ]) +set whichwrap= +" backspace deletes: (indent,eol,start) +set backspace=indent,start +" find word under cursor +nnoremap + /<C-R><C-W><CR> +" mark word under cursor +nnoremap gm :let @/ = "<C-R><C-W>"<CR>:set hlsearch<CR> +" go to tag under cursor +nnoremap <TAB> g<C-]> +"nnoremap <CR> g<C-]> +nnoremap <CR> :tag <C-R><C-W><CR> +" return to previous position +nnoremap <S-TAB> <C-T> +nnoremap <BS> <C-T> +nnoremap <S-CR> <C-T> +" find next error +nnoremap <C-N> :cn<CR> +" go back to previous edited file +nnoremap gb :edit #<CR> + +" ----------- +" come and go +" ----------- +set sessionoptions=blank,buffers,curdir,globals,winsize +" open window size +autocmd GUIEnter * winsize 100 60 +" read and write files automatically +set autoread +set autowrite +set autowriteall +" keep original files for these filetypes +set patchmode= +" jump to '" when reading a file +"autocmd BufEnter * +"autocmd BufReadPost * +" \ if line("'\"") > 0 && line("'\"") <= line("$") | +" \ execute "normal g'\"" | +" \ endif + +" set nomodifiable on writeprotected files +autocmd BufReadPost * + \ if &readonly == 1 | + \ execute ':set nomodifiable' | + \ else | + \ execute ':set modifiable' | + \ endif +" read all files on got of focus +" autocmd FocusGained * execute +" save all files on loss of focus +autocmd FocusLost * execute ':wa' + +" ----------- +" spell check +" ----------- +set spelllang=de +set spellfile=$VIM/myspell.add +let &spellfile=&spellfile . ',' . g:vimfiles . '/spell/bmsk.add' + +" ------------- +" other Plugins +" ------------- + +" GetLatestVimScripts +let $http_proxy='http://qx13468:tinaist1@proxy.muc:8080' +let g:GetLatestVimScripts_wget= "c:/tools/wget/wget.exe" +let g:GetLatestVimScripts_mv= "move" +"let $HOME=g:vimsuite + +if exists('g:debug') + if (g:debug > 0) + echo 'loaded vimrc' + endif +endif diff --git a/vimfiles.stefan/vimrc.bmsk b/vimfiles.stefan/vimrc.bmsk new file mode 100644 index 0000000..d16448c --- /dev/null +++ b/vimfiles.stefan/vimrc.bmsk @@ -0,0 +1,6 @@ +let g:Austausch = expand('//easerv.muc/Organisation/ea-41/Austausch') +let g:myAustausch = expand(g:Austausch . '/Liebl') +let g:bmskWA = expand('c:/wa') +let g:WA = expand('c:/wa') +let g:ccm = expand('c:/ec-apps/cmsynergy/ccm64/bin/ccm.exe') + diff --git a/vimfiles.stefan/vimrc.dos b/vimfiles.stefan/vimrc.dos new file mode 100644 index 0000000..2e55bcc --- /dev/null +++ b/vimfiles.stefan/vimrc.dos @@ -0,0 +1,47 @@ + +"let g:debug = 1 + +let g:backupdir = expand($TEMP . '/vi') +let g:swapdir = expand($TEMP . '/vi') + +let g:gvim = expand($VIMRUNTIME . '/gvim.exe ') +let g:pythonPath = expand('c:/wa/tools/python/2.4.1') +let g:diff = expand($VIMRUNTIME . '/diff ') +let g:svn = expand('svn ') +let g:cvs = expand('cvs ') +let g:cp = expand('copy ') +let g:rm = expand('del ') +let g:rm_f = expand('del ') . '/Q ' +let g:mkdir = expand('mkdir ') + +" unix-tools +let g:vimtools = expand(g:vimfiles . '/tools') +let g:patch = expand(g:vimtools . '/patch.exe ') +let g:ctags = expand(g:vimtools . '/ctags.exe ') +let g:cscope = expand(g:vimtools . '/cscope.exe ') +let g:tee = expand(g:vimtools . '/tee.exe ') +let g:untee = expand(g:vimtools . '/untee.bat ') + +"let g:nobmsk = 1 +"let g:nobmskmenu = 1 +"let g:noccm = 1 +"let g:noccmmenu = 1 + +if has('gui') + + " set Font +" set guifont=Lucida_Console:h7 + set guifont=Terminal:h6 + "set guifontwide= + + " Set standards for GUI + set guioptions=arL + "set menu + set guioptions+=m + "set tearoff-feature + set guioptions+=t + " add toolbar +" set guioptions+=T + + colorscheme Stefan +endif diff --git a/vimfiles.stefan/vimrc.linux b/vimfiles.stefan/vimrc.linux new file mode 100644 index 0000000..208dd6a --- /dev/null +++ b/vimfiles.stefan/vimrc.linux @@ -0,0 +1,44 @@ +"let g:debug = 1 + +let g:backupdir = expand('/tmp') +let g:swapdir = expand('/tmp') + +let g:gvim = expand('gvim ') +let g:python = expand('python ') +let g:diff = expand('diff ') +let g:svn = expand('svn ') +let g:cvs = expand('cvs ') +let g:cp = expand('cp ') +let g:rm = expand('rm ') +let g:rm_f = expand('rm -rf ') +let g:mkdir = expand('mkdir ') + +" unix-tools +let g:patch = expand('patch ') +let g:cscope = expand('cscope ') + +set printexpr=system('kprinter\ '.v:fname_in).delete(v:fname_in)+v:shell_error + +let g:nobmsk = 1 +let g:nobmskmenu = 1 +let g:noccm = 1 +let g:noccmmenu = 1 + +if has('gui') + + " set Font + "set guifont=Fixedsys + "set guifont=Terminal:h6 + "set guifontwide= + + " Set standards for GUI + set guioptions=arL + "set menu + set guioptions+=m + "set tearoff-feature + set guioptions+=t + " add toolbar +" set guioptions+=T + + colorscheme Stefan +endif diff --git a/vimfiles/GetLatest/GetLatestVimScripts.dat b/vimfiles/GetLatest/GetLatestVimScripts.dat new file mode 100644 index 0000000..789b89a --- /dev/null +++ b/vimfiles/GetLatest/GetLatestVimScripts.dat @@ -0,0 +1,20 @@ +ScriptID SourceID Filename +-------------------------- +642 6945 GetLatestVimScripts.vim +1075 6895 netrw.vim +1502 6578 vimball.vim +1008 3118 srec.vim (ftplugin) +1009 3119 srec.vim (syntax file) +475 2535 latex-suite (install in vimfiles.latex) +614 3666 C-Referenz +670 6208 visincr.vim (Visual Increment) +862 2635 cscope_quickfix.vim +51 171 cscope_macros.vim +102 5306 DirDiff.vim +1189 6533 matrix.vim +1173 5475 tcomment +948 2878 Scons Compiler plugin +1709 6421 Scons Syntax file +1772 6973 DAMOS.zip DAMOS tools (von Stefan) +987 6809 DoxygenToolkit.vim +1397 6887 xml.vim diff --git a/vimfiles/after/syntax/help.vim b/vimfiles/after/syntax/help.vim new file mode 100644 index 0000000..bd7a073 --- /dev/null +++ b/vimfiles/after/syntax/help.vim @@ -0,0 +1,114 @@ +"***************************************************************************** +"** Name: help.vim - extend standard syntax highlighting for help ** +"** ** +"** Type: syntax file ** +"** ** +"** Author: Christian Habermann ** +"** christian (at) habermann-net (point) de ** +"** ** +"** Copyright: (c) 2002-2004 by Christian Habermann ** +"** ** +"** License: GNU General Public License 2 (GPL 2) or later ** +"** ** +"** This program is free software; you can redistribute it ** +"** and/or modify it under the terms of the GNU General Public ** +"** License as published by the Free Software Foundation; either ** +"** version 2 of the License, or (at your option) any later ** +"** version. ** +"** ** +"** This program is distributed in the hope that it will be ** +"** useful, but WITHOUT ANY WARRANTY; without even the implied ** +"** warrenty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ** +"** PURPOSE. ** +"** See the GNU General Public License for more details. ** +"** ** +"** Version: 1.0.1 ** +"** tested under Linux and Win32, VIM and GVIM 6.2 ** +"** ** +"** History: 0.1.0 12. Dec. 2002 - 21. Feb. 2003 ** +"** initial version, not released ** +"** 1.0.0 6. Apr. 2003 ** +"** no changes, first release ** +"** 1.0.1 3. Mar. 2004 ** +"** marker changed from 0xa7 to $ in order to avoid problems ** +"** with fonts that use codes > 0x7f as multibyte characters ** +"** (e.g. Chinese, Korean, Japanese... fonts) ** +"** ** +"** ** +"***************************************************************************** +"** Description: ** +"** This syntax file extends the standard syntax highlighting for help ** +"** files. This is needed in order to view the C-reference manual ** +"** of the project CRefVim correctly. ** +"** This syntax file is only active for the help file named ** +"** "crefvim.txt". For other help files no extention on syntax ** +"** highlighting is applied. ** +"** ** +"** For futher information see crefvimdoc.txt or do :help crefvimdoc ** +"** ** +"** Happy viming... ** +"***************************************************************************** + + +" extend syntax-highlighting for "crefvim.txt" only (not case-sensitive) + +if tolower(expand("%:t"))=="crefvim.txt" + syn match helpCRVSubStatement "statement[0-9Ns]*" contained + syn match helpCRVSubCondition "condition[0-9]*" contained + syn match helpCRVSubExpression "expression[0-9]*" contained + syn match helpCRVSubExpr "expr[0-9N]" contained + syn match helpCRVSubType "type-name" contained + syn match helpCRVSubIdent "identifier" contained + syn match helpCRVSubIdentList "identifier-list" contained + syn match helpCRVSubOperand "operand[0-9]*" contained + syn match helpCRVSubConstExpr "constant-expression[1-9Ns]*" contained + syn match helpCRVSubClassSpec "storage-class-specifier" contained + syn match helpCRVSubTypeSpec "type-specifier" contained + syn match helpCRVSubEnumList "enumerator-list" contained + syn match helpCRVSubDecl "declarator" contained + syn match helpCRVSubRetType "return-type" contained + syn match helpCRVSubFuncName "function-name" contained + syn match helpCRVSubParamList "parameter-list" contained + syn match helpCRVSubReplList "replacement-list" contained + syn match helpCRVSubNewLine "newline" contained + syn match helpCRVSubMessage "message" contained + syn match helpCRVSubFilename "filename" contained + syn match helpCRVSubDigitSeq "digit-sequence" contained + syn match helpCRVSubMacroNames "macro-name[s]*" contained + syn match helpCRVSubDirective "directive" contained + + + syn match helpCRVignore "\$[a-zA-Z0-9\\\*/\._=()\-+%<>&\^|!~\?:,\[\];{}#\'\" ]\+\$" contains=helpCRVstate + syn match helpCRVstate "[a-zA-Z0-9\\\*/\._=()\-+%<>&\^|!~\?:,\[\];{}#\'\" ]\+" contained contains=helpCRVSub.* + + + hi helpCRVitalic term=italic cterm=italic gui=italic + + hi def link helpCRVstate Comment + hi def link helpCRVSubStatement helpCRVitalic + hi def link helpCRVSubCondition helpCRVitalic + hi def link helpCRVSubExpression helpCRVitalic + hi def link helpCRVSubExpr helpCRVitalic + hi def link helpCRVSubOperand helpCRVitalic + hi def link helpCRVSubType helpCRVitalic + hi def link helpCRVSubIdent helpCRVitalic + hi def link helpCRVSubIdentList helpCRVitalic + hi def link helpCRVSubConstExpr helpCRVitalic + hi def link helpCRVSubClassSpec helpCRVitalic + hi def link helpCRVSubTypeSpec helpCRVitalic + hi def link helpCRVSubEnumList helpCRVitalic + hi def link helpCRVSubDecl helpCRVitalic + hi def link helpCRVSubRetType helpCRVitalic + hi def link helpCRVSubFuncName helpCRVitalic + hi def link helpCRVSubParamList helpCRVitalic + hi def link helpCRVSubReplList helpCRVitalic + hi def link helpCRVSubNewLine helpCRVitalic + hi def link helpCRVSubMessage helpCRVitalic + hi def link helpCRVSubFilename helpCRVitalic + hi def link helpCRVSubDigitSeq helpCRVitalic + hi def link helpCRVSubMacroNames helpCRVitalic + hi def link helpCRVSubDirective helpCRVitalic + hi def link helpCRVignore Ignore +endif + +" vim: ts=8 sw=2 diff --git a/vimfiles/autoload/getscript.vim b/vimfiles/autoload/getscript.vim new file mode 100644 index 0000000..62b09bb --- /dev/null +++ b/vimfiles/autoload/getscript.vim @@ -0,0 +1,501 @@ +" --------------------------------------------------------------------- +" getscript.vim +" Author: Charles E. Campbell, Jr. +" Date: Nov 27, 2006 +" Version: 23 +" Installing: :help glvs-install +" Usage: :help glvs +" +" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim +" --------------------------------------------------------------------- +" Initialization: {{{1 +" if you're sourcing this file, surely you can't be +" expecting vim to be in its vi-compatible mode +if &cp + echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" + finish +endif +let s:keepfo = &fo +let s:keepcpo = &cpo +set cpo&vim + +if exists("g:loaded_getscript") + finish +endif +let g:loaded_getscript= "v23" + +" --------------------------------------------------------------------- +" Global Variables: {{{1 +" allow user to change the command for obtaining scripts (does fetch work?) +if !exists("g:GetLatestVimScripts_wget") + if executable("wget") + let g:GetLatestVimScripts_wget= "wget" + elseif executable("curl") + let g:GetLatestVimScripts_wget= "curl" + else + let g:GetLatestVimScripts_wget = 'echo "GetLatestVimScripts needs wget or curl"' + let g:GetLatestVimScripts_options = "" + endif +endif + +" options that wget and curl require: +if !exists("g:GetLatestVimScripts_options") + if g:GetLatestVimScripts_wget == "wget" + let g:GetLatestVimScripts_options= "-q -O" + elseif g:GetLatestVimScripts_wget == "curl" + let g:GetLatestVimScripts_options= "-s -O" + else + let g:GetLatestVimScripts_options= "" + endif +endif + +" by default, allow autoinstall lines to work +if !exists("g:GetLatestVimScripts_allowautoinstall") + let g:GetLatestVimScripts_allowautoinstall= 1 +endif + +"" For debugging: +"let g:GetLatestVimScripts_wget = "echo" +"let g:GetLatestVimScripts_options = "options" + +" --------------------------------------------------------------------- +" Check If AutoInstall Capable: {{{1 +let s:autoinstall= "" +if g:GetLatestVimScripts_allowautoinstall + + if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash" + " windows (but not cygwin/bash) + let s:dotvim= "vimfiles" + if !exists("g:GetLatestVimScripts_mv") + let g:GetLatestVimScripts_mv= "ren" + endif + + else + " unix + let s:dotvim= ".vim" + if !exists("g:GetLatestVimScripts_mv") + let g:GetLatestVimScripts_mv= "mv" + endif + endif + + if exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim) + let s:autoinstall= $HOME."/".s:dotvim + endif +" call Decho("s:autoinstall<".s:autoinstall.">") +"else "Decho +" call Decho("g:GetLatestVimScripts_allowautoinstall=".g:GetLatestVimScripts_allowautoinstall.": :AutoInstall: disabled") +endif + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts() +com! -nargs=0 GetScript call getscript#GetLatestVimScripts() +silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts() + +" --------------------------------------------------------------------- +" GetOneScript: (Get Latest Vim Script) this function operates {{{1 +" on the current line, interpreting two numbers and text as +" ScriptID, SourceID, and Filename. +" It downloads any scripts that have newer versions from vim.sf.net. +fun! s:GetOneScript(...) +" call Dfunc("GetOneScript()") + + " set options to allow progress to be shown on screen + let t_ti= &t_ti + let t_te= &t_te + let rs = &rs + set t_ti= t_te= nors + + " put current line on top-of-screen and interpret it into + " a script identifer : used to obtain webpage + " source identifier : used to identify current version + " and an associated comment: used to report on what's being considered + if a:0 >= 3 + let scriptid = a:1 + let srcid = a:2 + let fname = a:3 + let cmmnt = "" +" call Decho("scriptid<".scriptid.">") +" call Decho("srcid <".srcid.">") +" call Decho("fname <".fname.">") + else + let curline = getline(".") + if curline =~ '^\s*#' +" call Dret("GetOneScript : skipping a pure comment line") + return + endif + let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(.\{-}\)\(\s*#.*\)\=$' + try + let scriptid = substitute(curline,parsepat,'\1','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let scriptid= 0 + endtry + try + let srcid = substitute(curline,parsepat,'\2','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let srcid= 0 + endtry + try + let fname= substitute(curline,parsepat,'\3','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let fname= "" + endtry + try + let cmmnt= substitute(curline,parsepat,'\4','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let cmmnt= "" + endtry +" call Decho("curline <".curline.">") +" call Decho("parsepat<".parsepat.">") +" call Decho("scriptid<".scriptid.">") +" call Decho("srcid <".srcid.">") +" call Decho("fname <".fname.">") + endif + + if scriptid == 0 || srcid == 0 + " When looking for :AutoInstall: lines, skip scripts that + " have 0 0 scriptname +" call Dret("GetOneScript : skipping a scriptid==srcid==0 line") + return + endif + + let doautoinstall= 0 + if fname =~ ":AutoInstall:" +" call Decho("fname<".fname."> has :AutoInstall:...") + let aicmmnt= substitute(fname,'\s\+:AutoInstall:\s\+',' ','') +" call Decho("aicmmnt<".aicmmnt."> s:autoinstall=".s:autoinstall) + if s:autoinstall != "" + let doautoinstall = g:GetLatestVimScripts_allowautoinstall + endif + else + let aicmmnt= fname + endif +" call Decho("aicmmnt<".aicmmnt.">: doautoinstall=".doautoinstall) + + exe "norm z\<CR>" + redraw! +" call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid) + echomsg 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid + + " grab a copy of the plugin's vim.sf.net webpage + let scriptaddr = 'http://vim.sf.net/script.php?script_id='.scriptid + let tmpfile = tempname() + let v:errmsg = "" + + " make three tries at downloading the description + let itry= 1 + while itry <= 3 +" call Decho("try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr) + if has("win32") || has("win16") || has("win95") +" call Decho("silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".tmpfile.' "'.scriptaddr.'"') + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".tmpfile.' "'.scriptaddr.'"' + else +" call Decho("silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".tmpfile." '".scriptaddr."'") + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".tmpfile." '".scriptaddr."'" + endif + if itry == 1 + exe "silent vsplit ".tmpfile + else + silent! e % + endif + + " find the latest source-id in the plugin's webpage + silent! 1 + let findpkg= search('Click on the package to download','W') + if findpkg > 0 + break + endif + let itry= itry + 1 + endwhile +" call Decho(" --- end downloading tries while loop --- itry=".itry) + + " testing: did finding /Click on the package.../ fail? + if findpkg == 0 || itry >= 4 + silent q! + call delete(tmpfile) + " restore options + let &t_ti = t_ti + let &t_te = t_te + let &rs = rs + let s:downerrors = s:downerrors + 1 +" call Decho("***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">") + echomsg "***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">" +" call Dret("GetOneScript : srch for /Click on the package/ failed") + return + endif +" call Decho('found "Click on the package to download"') + + let findsrcid= search('src_id=','W') + if findsrcid == 0 + silent q! + call delete(tmpfile) + " restore options + let &t_ti = t_ti + let &t_te = t_te + let &rs = rs + let s:downerrors = s:downerrors + 1 +" call Decho("***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">") + echomsg "***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">" +" call Dret("GetOneScript : srch for /src_id/ failed") + return + endif +" call Decho('found "src_id=" in description page') + + let srcidpat = '^\s*<td class.*src_id=\(\d\+\)">\([^<]\+\)<.*$' + let latestsrcid= substitute(getline("."),srcidpat,'\1','') + let fname = substitute(getline("."),srcidpat,'\2','') +" call Decho("srcidpat<".srcidpat."> latestsrcid<".latestsrcid."> fname<".fname.">") + silent q! + call delete(tmpfile) + + " convert the strings-of-numbers into numbers + let srcid = srcid + 0 + let latestsrcid = latestsrcid + 0 +" call Decho("srcid=".srcid." latestsrcid=".latestsrcid." fname<".fname.">") + + " has the plugin's most-recent srcid increased, which indicates + " that it has been updated + if latestsrcid > srcid + let s:downloads= s:downloads + 1 + if fname == bufname("%") + " GetLatestVimScript has to be careful about downloading itself + let fname= "NEW_".fname + endif + + " the plugin has been updated since we last obtained it, so download a new copy +" call Decho("...downloading new <".fname.">") + echomsg "...downloading new <".fname.">" + if has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95") +" call Decho("windows: silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".fname.' "'.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.'"') + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".fname.' "'.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.'"' + else +" call Decho("unix: silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".fname." '".'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid."'") + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".fname." '".'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid."'" + endif + + " AutoInstall: only if doautoinstall is so indicating + if doautoinstall +" call Decho("attempting to do autoinstall: getcwd<".getcwd()."> filereadable(".fname.")=".filereadable(fname)) + if filereadable(fname) +" call Decho("move <".fname."> to ".s:autoinstall) +" call Decho("DISABLED for testing") + exe "silent !".g:GetLatestVimScripts_mv." ".fname." ".s:autoinstall + let curdir= escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #") + exe "cd ".s:autoinstall + if fname =~ '\.bz2$' +" call Decho("attempt to bunzip2 ".fname) + exe "silent !bunzip2 ".fname + let fname= substitute(fname,'\.bz2$','','') + elseif fname =~ '\.gz$' +" call Decho("attempt to gunzip ".fname) + exe "silent !gunzip ".fname + let fname= substitute(fname,'\.gz$','','') + endif + if fname =~ '\.zip$' +" call Decho("attempt to unzip ".fname) + exe "silent !unzip -o".fname + elseif fname =~ '\.tar$' +" call Decho("attempt to untar ".fname) + exe "silent !tar -xvf ".fname + elseif fname =~ '\.vba$' +" call Decho("attempt to handle a vimball: ".fname) + 1split + exe "e ".fname + so % + q + endif + if fname =~ '.vim$' +" call Decho("attempt to simply move ".fname." to plugin") + exe "silent !".g:GetLatestVimScripts_mv." ".fname." plugin" + endif + let docdir= substitute(&rtp,',.*','','e')."/doc" +" call Decho("helptags docdir<".docdir.">") + exe "helptags ".docdir + exe "cd ".curdir + endif + endif + + " update the data in the <GetLatestVimScripts.dat> file + let modline=scriptid." ".latestsrcid." ".fname.cmmnt + call setline(line("."),modline) +" call Decho("modline<".modline."> (updated GetLatestVimScripts.dat file)") + endif + + " restore options + let &t_ti= t_ti + let &t_te= t_te + let &rs = rs + +" call Dret("GetOneScript") +endfun + +" --------------------------------------------------------------------- +" GetLatestVimScripts: this function gets the latest versions of {{{1 +" scripts based on the list in +" (first dir in runtimepath)/GetLatest/GetLatestVimScripts.dat +fun! getscript#GetLatestVimScripts() +" call Dfunc("GetLatestVimScripts() autoinstall<".s:autoinstall.">") + +" insure that wget is executable + if executable(g:GetLatestVimScripts_wget) != 1 + echoerr "GetLatestVimScripts needs ".g:GetLatestVimScripts_wget." which apparently is not available on your system" +" call Dret("GetLatestVimScripts : wget not executable/availble") + return + endif + + " Find the .../GetLatest subdirectory under the runtimepath + for datadir in split(&rtp,',') + [''] + if isdirectory(datadir."/GetLatest") +" call Decho("found directory<".datadir.">") + let datadir= datadir . "/GetLatest" + break + endif + if filereadable(datadir."GetLatestVimScripts.dat") +" call Decho("found ".datadir."/GetLatestVimScripts.dat") + break + endif + endfor + " Sanity checks: readability and writability + if datadir == "" + echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install' +" call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory") + return + endif + + if filewritable(datadir) != 2 + echoerr "(getLatestVimScripts) Your ".datadir." isn't writable" +" call Dret("GetLatestVimScripts : non-writable directory<".datadir.">") + return + endif + let datafile= datadir."/GetLatestVimScripts.dat" + if !filereadable(datafile) + echoerr "Your data file<".datafile."> isn't readable" +" call Dret("GetLatestVimScripts : non-readable datafile<".datafile.">") + return + endif + if !filewritable(datafile) + echoerr "Your data file<".datafile."> isn't writable" +" call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">") + return + endif +" call Decho("datadir <".datadir.">") +" call Decho("datafile <".datafile.">") + + " don't let any events interfere (like winmanager's, taglist's, etc) + let eikeep= &ei + set ei=all + + " record current directory, change to datadir, open split window with + " datafile + let origdir= getcwd() + exe "cd ".escape(substitute(datadir,'\','/','ge'),"|[]*'\" #") + split + exe "e ".escape(substitute(datafile,'\','/','ge'),"|[]*'\" #") + res 1000 + let s:downloads = 0 + let s:downerrors= 0 + + " Check on dependencies mentioned in plugins +" call Decho(" ") +" call Decho("searching plugins for GetLatestVimScripts dependencies") + let lastline = line("$") + let plugins = globpath(&rtp,"plugin/*.vim") + let foundscript = 0 + +" call Decho("plugins<".plugins."> lastline#".lastline) + while plugins != "" + let plugin = substitute(plugins,'\n.*$','','e') + let plugins= (plugins =~ '\n')? substitute(plugins,'^.\{-}\n\(.*\)$','\1','e') : "" + $ +" call Decho(".dependency checking<".plugin."> line$=".line("$")) + exe "silent r ".plugin + while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0 + let newscript= substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e') + let llp1 = lastline+1 + + if newscript !~ '^"' + " found a "GetLatestVimScripts: # #" line in the script; check if its already in the datafile + let curline = line(".") + let noai_script = substitute(newscript,'\s*:AutoInstall:\s*','','e') + exe llp1 + let srchline = search('\<'.noai_script.'\>','bW') +" call Decho("..newscript<".newscript."> noai_script<".noai_script."> srch=".srchline." lastline=".lastline) + + if srchline == 0 + " found a new script to permanently include in the datafile + let keep_rega = @a + let @a = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','') + exe lastline."put a" + echomsg "Appending <".@a."> to ".datafile." for ".newscript +" call Decho("..APPEND (".noai_script.")<".@a."> to GetLatestVimScripts.dat") + let @a = keep_rega + let lastline = llp1 + let curline = curline + 1 + let foundscript = foundscript + 1 +" else " Decho +" call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")") + endif + + let curline = curline + 1 + exe curline + endif + + endwhile + let llp1= lastline + 1 +" call Decho(".deleting lines: ".llp1.",$d") + exe "silent! ".llp1.",$d" + endwhile + + if foundscript == 0 + set nomod + endif + + " Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat + set lz +" call Decho(" --- end of dependency checking loop --- ") +" call Decho("call GetOneScript on lines at end of datafile<".datafile.">") + 1 + /^-----/,$g/^\s*\d/call <SID>GetOneScript() + + " Final report (an echomsg) + try + silent! ?^-------? + catch /^Vim\%((\a\+)\)\=:E114/ +" call Dret("GetLatestVimScripts : nothing done!") + return + endtry + exe "norm! kz\<CR>" + redraw! + let s:msg = "" + if s:downloads == 1 + let s:msg = "Downloaded one updated script to <".datadir.">" + elseif s:downloads == 2 + let s:msg= "Downloaded two updated scripts to <".datadir.">" + elseif s:downloads > 1 + let s:msg= "Downloaded ".s:downloads." updated scripts to <".datadir.">" + else + let s:msg= "Everything was already current" + endif + if s:downerrors > 0 + let s:msg= s:msg." (".s:downerrors." downloading errors)" + endif + echomsg s:msg + " save the file + if &mod + silent! w! + endif + q + + " restore events and current directory + exe "cd ".escape(substitute(origdir,'\','/','ge'),"|[]*'\" #") + let &ei= eikeep + set nolz +" call Dret("GetLatestVimScripts : did ".s:downloads." downloads") +endfun +" --------------------------------------------------------------------- + +" Restore Options: {{{1 +let &fo = s:keepfo +let &cpo= s:keepcpo + +" vim: ts=8 sts=2 fdm=marker nowrap diff --git a/vimfiles/autoload/netrw.vim b/vimfiles/autoload/netrw.vim new file mode 100644 index 0000000..d2c5110 --- /dev/null +++ b/vimfiles/autoload/netrw.vim @@ -0,0 +1,5303 @@ +" netrw.vim: Handles file transfer and remote directory listing across +" AUTOLOAD SECTION +" Date: Mar 21, 2007 +" Version: 108 +" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> +" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim +" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided +" *as is* and comes with no warranty of any kind, either +" expressed or implied. By using this plugin, you agree that +" in no event will the copyright holder be liable for any damages +" resulting from the use of this software. +" of this software. +" COMBAK: worked with tmpfile s:GetTempname() in NetRead() NetWrite() +" !!NEEDS DEBUGGING && TESTING!!! +"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore() +" +" But be doers of the Word, and not only hearers, deluding your own selves {{{1 +" (James 1:22 RSV) +" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +" Load Once: {{{1 +if &cp || exists("g:loaded_netrw") + finish +endif +if !exists("s:NOTE") + let s:NOTE = 0 + let s:WARNING = 1 + let s:ERROR = 2 +endif +let g:loaded_netrw = "v108" +if v:version < 700 + call netrw#ErrorMsg(s:WARNING,"you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw",1) + finish +endif +let s:keepcpo= &cpo +setlocal cpo&vim +"DechoTabOn +"call Decho("doing autoload/netrw.vim version ".g:loaded_netrw) + +" ====================== +" Netrw Variables: {{{1 +" ====================== + +" --------------------------------------------------------------------- +" Netrw Constants: {{{2 +if !exists("g:NETRW_BOOKMARKMAX") + let g:NETRW_BOOKMARKMAX= 0 +endif +if !exists("g:NETRW_DIRHIST_CNT") + let g:NETRW_DIRHIST_CNT= 0 +endif +if !exists("s:LONGLIST") + let s:THINLIST = 0 + let s:LONGLIST = 1 + let s:WIDELIST = 2 + let s:TREELIST = 3 + let s:MAXLIST = 4 +endif + +" --------------------------------------------------------------------- +" Default values for netrw's global protocol variables {{{2 +if !exists("g:netrw_dav_cmd") + let g:netrw_dav_cmd = "cadaver" +endif +if !exists("g:netrw_fetch_cmd") + if executable("fetch") + let g:netrw_fetch_cmd = "fetch -o" + else + let g:netrw_fetch_cmd = "" + endif +endif +if !exists("g:netrw_ftp_cmd") + let g:netrw_ftp_cmd = "ftp" +endif +if !exists("g:netrw_http_cmd") + if executable("curl") + let g:netrw_http_cmd = "curl -o" + elseif executable("wget") + let g:netrw_http_cmd = "wget -q -O" + elseif executable("fetch") + let g:netrw_http_cmd = "fetch -o" + else + let g:netrw_http_cmd = "" + endif +endif +if !exists("g:netrw_rcp_cmd") + let g:netrw_rcp_cmd = "rcp" +endif +if !exists("g:netrw_rsync_cmd") + let g:netrw_rsync_cmd = "rsync" +endif +if !exists("g:netrw_scp_cmd") + let g:netrw_scp_cmd = "scp -q" +endif +if !exists("g:netrw_sftp_cmd") + let g:netrw_sftp_cmd = "sftp" +endif +if !exists("g:netrw_ssh_cmd") + let g:netrw_ssh_cmd= "ssh" +endif + +if (has("win32") || has("win95") || has("win64") || has("win16")) + \ && exists("g:netrw_use_nt_rcp") + \ && g:netrw_use_nt_rcp + \ && executable( $SystemRoot .'/system32/rcp.exe') + let s:netrw_has_nt_rcp = 1 + let s:netrw_rcpmode = '-b' +else + let s:netrw_has_nt_rcp = 0 + let s:netrw_rcpmode = '' +endif + +" --------------------------------------------------------------------- +" Default values for netrw's global variables {{{2 +" Default values - a-c ---------- {{{3 +if !exists("g:netrw_alto") + let g:netrw_alto= &sb +endif +if !exists("g:netrw_altv") + let g:netrw_altv= &spr +endif +if !exists("g:netrw_browse_split") + let g:netrw_browse_split= 0 +endif +if !exists("g:netrw_chgwin") + let g:netrw_chgwin = -1 +endif +if !exists("g:netrw_cygwin") + if has("win32") || has("win95") || has("win64") || has("win16") + if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$' + let g:netrw_cygwin= 1 + else + let g:netrw_cygwin= 0 + endif + else + let g:netrw_cygwin= 0 + endif +else + let g:netrw_cygwin= 0 +endif +" Default values - d-f ---------- {{{3 +if !exists("g:NETRW_DIRHIST_CNT") + let g:NETRW_DIRHIST_CNT= 0 +endif +if !exists("g:netrw_dirhistmax") + let g:netrw_dirhistmax= 10 +endif +if !exists("g:netrw_ftp_browse_reject") + let g:netrw_ftp_browse_reject='^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$' +endif +if !exists("g:netrw_ftp_list_cmd") + if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) + let g:netrw_ftp_list_cmd = "ls -lF" + let g:netrw_ftp_timelist_cmd = "ls -tlF" + let g:netrw_ftp_sizelist_cmd = "ls -slF" + else + let g:netrw_ftp_list_cmd = "dir" + let g:netrw_ftp_timelist_cmd = "dir" + let g:netrw_ftp_sizelist_cmd = "dir" + endif +endif +if !exists("g:netrw_ftpmode") + let g:netrw_ftpmode= "binary" +endif +" Default values - h-lh ---------- {{{3 +if !exists("g:netrw_hide") + let g:netrw_hide= 1 +endif +if !exists("g:netrw_ignorenetrc") + if &shell =~ '\c\<\%(cmd\|4nt\)\.exe$' + let g:netrw_ignorenetrc= 1 + else + let g:netrw_ignorenetrc= 0 + endif +endif +if !exists("g:netrw_keepdir") + let g:netrw_keepdir= 1 +endif +if !exists("g:netrw_list_cmd") + if g:netrw_scp_cmd =~ '^pscp' && executable("pscp") + " provide a 'pscp' listing command + if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable("c:\\private.ppk") + let g:netrw_scp_cmd ="pscp -i C:\\private.ppk" + endif + let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:" + elseif executable(g:netrw_ssh_cmd) + " provide a default listing command + let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" + else +" call Decho(g:netrw_ssh_cmd." is not executable") + let g:netrw_list_cmd= "" + endif +endif +if !exists("g:netrw_list_hide") + let g:netrw_list_hide= "" +endif +" Default values - lh-lz ---------- {{{3 +if !exists("g:netrw_local_mkdir") + let g:netrw_local_mkdir= "mkdir" +endif +if !exists("g:netrw_local_rmdir") + let g:netrw_local_rmdir= "rmdir" +endif +if !exists("g:netrw_liststyle") + let g:netrw_liststyle= s:THINLIST +endif +if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST + " sanity check + let g:netrw_liststyle= s:THINLIST +endif +if g:netrw_liststyle == s:LONGLIST && g:netrw_scp_cmd !~ '^pscp' + let g:netrw_list_cmd= g:netrw_list_cmd." -l" +endif +" Default values - m-r ---------- {{{3 +if !exists("g:netrw_maxfilenamelen") + let g:netrw_maxfilenamelen= 32 +endif +if !exists("g:netrw_menu") + let g:netrw_menu= 1 +endif +if !exists("g:netrw_mkdir_cmd") + let g:netrw_mkdir_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir" +endif +if !exists("g:netrw_rename_cmd") + let g:netrw_rename_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mv" +endif +if !exists("g:netrw_rm_cmd") + let g:netrw_rm_cmd = g:netrw_ssh_cmd." USEPORT HOSTNAME rm" +endif +if !exists("g:netrw_rmdir_cmd") + let g:netrw_rmdir_cmd = g:netrw_ssh_cmd." USEPORT HOSTNAME rmdir" +endif +if !exists("g:netrw_rmf_cmd") + let g:netrw_rmf_cmd = g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f" +endif +" Default values - s ---------- {{{3 +if exists("g:netrw_silent") && g:netrw_silent != 0 + let g:netrw_silentxfer= "silent " +else + let g:netrw_silentxfer= "" +endif +if !exists("g:netrw_fastbrowse") + let g:netrw_fastbrowse= 1 +endif +if !exists("g:netrw_shq") + if exists("&shq") && &shq != "" + let g:netrw_shq= &shq + elseif has("win32") || has("win95") || has("win64") || has("win16") + if g:netrw_cygwin + let g:netrw_shq= "'" + else + let g:netrw_shq= '"' + endif + else + let g:netrw_shq= "'" + endif +" call Decho("g:netrw_shq<".g:netrw_shq.">") +endif +if !exists("g:netrw_sort_by") + " alternatives: date size + let g:netrw_sort_by= "name" +endif +if !exists("g:netrw_sort_direction") + " alternative: reverse (z y x ...) + let g:netrw_sort_direction= "normal" +endif +if !exists("g:netrw_sort_sequence") + let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,\.[a-np-z]$,*,\.info$,\.swp$,\.o$\.obj$,\.bak$' +endif +if !exists("g:netrw_ssh_browse_reject") + let g:netrw_ssh_browse_reject='^total\s\+\d\+$' +endif +if !has("patch192") + if !exists("g:netrw_use_noswf") + let g:netrw_use_noswf= 1 + endif +else + let g:netrw_use_noswf= 0 +endif +" Default values - t-w ---------- {{{3 +if !exists("g:netrw_timefmt") + let g:netrw_timefmt= "%c" +endif +if !exists("g:NetrwTopLvlMenu") + let g:NetrwTopLvlMenu= "Netrw." +endif +if !exists("g:netrw_win95ftp") + let g:netrw_win95ftp= 1 +endif +if !exists("g:netrw_winsize") + let g:netrw_winsize= "" +endif +" --------------------------------------------------------------------- +" Default values for netrw's script variables: {{{2 +if !exists("s:netrw_cd_escape") + let s:netrw_cd_escape="[]#*$%'\" ?`!&();<>\\" +endif +if !exists("g:netrw_fname_escape") + let g:netrw_fname_escape= ' ?&;' +endif +if !exists("g:netrw_tmpfile_escape") + let g:netrw_tmpfile_escape= ' ?&;' +endif +if !exists("s:netrw_glob_escape") + let s:netrw_glob_escape= '[]*?`{~$' +endif + +" BufEnter event ignored by decho when following variable is true +" Has a side effect that doau BufReadPost doesn't work, so +" files read by network transfer aren't appropriately highlighted. +"let g:decho_bufenter = 1 "Decho + +" ============================== +" Netrw Utility Functions: {{{1 +" ============================== + +" ------------------------------------------------------------------------ +" NetSavePosn: saves position of cursor on screen {{{2 +fun! netrw#NetSavePosn() +" call Dfunc("netrw#NetSavePosn()") + " Save current line and column + let w:netrw_winnr= winnr() + let w:netrw_line = line(".") + let w:netrw_col = virtcol(".") + + " Save top-of-screen line + norm! H0 + let w:netrw_hline= line(".") + + call netrw#NetRestorePosn() +" call Dret("netrw#NetSavePosn : winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline) +endfun + +" ------------------------------------------------------------------------ +" NetRestorePosn: restores the cursor and file position as saved by NetSavePosn() {{{2 +fun! netrw#NetRestorePosn() +" call Dfunc("netrw#NetRestorePosn() winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : -1)." line=".(exists("w:netrw_line")? w:netrw_line : -1)." col=".(exists("w:netrw_col")? w:netrw_col : -1)." hline=".(exists("w:netrw_hline")? w:netrw_hline : -1)) + let eikeep= &ei + set ei=all + if expand("%") == "NetrwMessage" + exe s:winBeforeErr."wincmd w" + endif + + " restore window + if exists("w:netrw_winnr") +" call Decho("restore window: exe silent! ".w:netrw_winnr."wincmd w") + exe "silent! ".w:netrw_winnr."wincmd w" + endif + if v:shell_error == 0 + " as suggested by Bram M: redraw on no error + " allows protocol error messages to remain visible + redraw! + endif + + " restore top-of-screen line + if exists("w:netrw_hline") +" call Decho("restore topofscreen: exe norm! ".w:netrw_hline."G0z") + exe "norm! ".w:netrw_hline."G0z\<CR>" + endif + + " restore position + if exists("w:netrw_line") && exists("w:netrw_col") +" call Decho("restore posn: exe norm! ".w:netrw_line."G0".w:netrw_col."|") + exe "norm! ".w:netrw_line."G0".w:netrw_col."\<bar>" + endif + + let &ei= eikeep +" call Dret("netrw#NetRestorePosn") +endfun + +" =============================== +" NetOptionSave: save options and set to "standard" form {{{2 +fun! s:NetOptionSave() +" call Dfunc("s:NetOptionSave()") + if !exists("w:netrw_optionsave") + let w:netrw_optionsave= 1 + else +" call Dret("s:NetOptionSave : netoptionsave=".w:netrw_optionsave) + return + endif + + " Save current settings and current directory + let s:yykeep = @@ + if exists("&l:acd") + let w:netrw_acdkeep = &l:acd + endif + let w:netrw_aikeep = &l:ai + let w:netrw_awkeep = &l:aw + let w:netrw_cikeep = &l:ci + let w:netrw_cinkeep = &l:cin + let w:netrw_cinokeep = &l:cino + let w:netrw_comkeep = &l:com + let w:netrw_cpokeep = &l:cpo + if g:netrw_keepdir + let w:netrw_dirkeep = getcwd() + endif + let w:netrw_fokeep = &l:fo " formatoptions + let w:netrw_gdkeep = &l:gd " gdefault + let w:netrw_hidkeep = &l:hidden + let w:netrw_magickeep = &l:magic + let w:netrw_repkeep = &l:report + let w:netrw_spellkeep = &l:spell + let w:netrw_twkeep = &l:tw " textwidth + let w:netrw_wigkeep = &l:wig " wildignore + if has("win32") && !has("win95") + let w:netrw_swfkeep= &l:swf " swapfile + endif + call s:NetrwSafeOptions() + if &go =~ 'a' | silent! let w:netrw_regstar = @* | endif + silent! let w:netrw_regslash= @/ + +" call Dret("s:NetOptionSave") +endfun + +" ------------------------------------------------------------------------ +" NetOptionRestore: restore options {{{2 +fun! s:NetOptionRestore() +" call Dfunc("s:NetOptionRestore()") + if !exists("w:netrw_optionsave") +" call Dret("s:NetOptionRestore : w:netrw_optionsave doesn't exist") + return + endif + unlet w:netrw_optionsave + + if exists("&acd") + if exists("w:netrw_acdkeep") |let &l:acd = w:netrw_acdkeep |unlet w:netrw_acdkeep |endif + endif + if exists("w:netrw_aikeep") |let &l:ai = w:netrw_aikeep |unlet w:netrw_aikeep |endif + if exists("w:netrw_awkeep") |let &l:aw = w:netrw_awkeep |unlet w:netrw_awkeep |endif + if exists("w:netrw_cikeep") |let &l:ci = w:netrw_cikeep |unlet w:netrw_cikeep |endif + if exists("w:netrw_cinkeep") |let &l:cin = w:netrw_cinkeep |unlet w:netrw_cinkeep |endif + if exists("w:netrw_cinokeep") |let &l:cino = w:netrw_cinokeep |unlet w:netrw_cinokeep |endif + if exists("w:netrw_comkeep") |let &l:com = w:netrw_comkeep |unlet w:netrw_comkeep |endif + if exists("w:netrw_cpokeep") |let &l:cpo = w:netrw_cpokeep |unlet w:netrw_cpokeep |endif + if exists("w:netrw_dirkeep") |exe "lcd ".w:netrw_dirkeep |unlet w:netrw_dirkeep |endif + if exists("w:netrw_fokeep") |let &l:fo = w:netrw_fokeep |unlet w:netrw_fokeep |endif + if exists("w:netrw_gdkeep") |let &l:gd = w:netrw_gdkeep |unlet w:netrw_gdkeep |endif + if exists("w:netrw_hidkeep") |let &l:hidden = w:netrw_hidkeep |unlet w:netrw_hidkeep |endif + if exists("w:netrw_magic") |let &l:magic = w:netrw_magic |unlet w:netrw_magic |endif + if exists("w:netrw_repkeep") |let &l:report = w:netrw_repkeep |unlet w:netrw_repkeep |endif + if exists("w:netrw_spellkeep")|let &l:spell = w:netrw_spellkeep |unlet w:netrw_spellkeep|endif + if exists("w:netrw_twkeep") |let &l:tw = w:netrw_twkeep |unlet w:netrw_twkeep |endif + if exists("w:netrw_wigkeep") |let &l:wig = w:netrw_wigkeep |unlet w:netrw_wigkeep |endif + if exists("s:yykeep") |let @@ = s:yykeep |unlet s:yykeep |endif + if exists("w:netrw_swfkeep") + if &directory == "" + " user hasn't specified a swapfile directory; + " netrw will temporarily set the swapfile directory + " to the current directory as returned by getcwd(). + let &l:directory = getcwd() + silent! let &l:swf = w:netrw_swfkeep + setlocal directory= + unlet w:netrw_swfkeep + elseif &l:swf != w:netrw_swfkeep + " following line causes a Press ENTER in windows -- can't seem to work around it!!! (COMBAK) + silent! let &l:swf= w:netrw_swfkeep + unlet w:netrw_swfkeep + endif + endif + if exists("w:netrw_regstar") |silent! let @*= w:netrw_regstar |unlet w:netrw_regstar |endif + if exists("w:netrw_regslash")|silent! let @/= w:netrw_regslash|unlet w:netrw_regslash|endif + +" call Dret("s:NetOptionRestore : restored user options") +endfun + +" --------------------------------------------------------------------- +" NetrwSafeOptions: sets options to help netrw do its job {{{2 +fun! s:NetrwSafeOptions() +" call Dfunc("s:NetrwSafeOptions()") + setlocal cino= + setlocal com= + setlocal cpo-=aA + if exists("&acd") + setlocal noacd nocin noai noci magic nospell nohid wig= noaw + setlocal fo=nroql2 + else + setlocal nocin noai noci magic nospell nohid wig= noaw + setlocal fo=nroql2 + endif + setlocal tw=0 + setlocal report=10000 + if g:netrw_use_noswf && has("win32") && !has("win95") + setlocal noswf + endif +" call Dret("s:NetrwSafeOptions") +endfun + +" ------------------------------------------------------------------------ +" Netrw Transfer Functions: {{{1 +" =============================== + +" ------------------------------------------------------------------------ +" NetRead: responsible for reading a file over the net {{{2 +" mode: =0 read remote file and insert before current line +" =1 read remote file and insert after current line +" =2 replace with remote file +" =3 obtain file, but leave in temporary format +fun! netrw#NetRead(mode,...) +" call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw) + + " save options {{{3 + call s:NetOptionSave() + + " interpret mode into a readcmd {{{3 + if a:mode == 0 " read remote file before current line + let readcmd = "0r" + elseif a:mode == 1 " read file after current line + let readcmd = "r" + elseif a:mode == 2 " replace with remote file + let readcmd = "%r" + elseif a:mode == 3 " skip read of file (leave as temporary) + let readcmd = "t" + else + exe a:mode + let readcmd = "r" + endif + let ichoice = (a:0 == 0)? 0 : 1 +" call Decho("readcmd<".readcmd."> ichoice=".ichoice) + + " Get Temporary Filename {{{3 + let tmpfile= s:GetTempfile("") + if tmpfile == "" +" call Dret("netrw#NetRead : unable to get a tempfile!") + return + endif + + while ichoice <= a:0 + + " attempt to repeat with previous host-file-etc + if exists("b:netrw_lastfile") && a:0 == 0 +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") + let choice = b:netrw_lastfile + let ichoice= ichoice + 1 + + else + exe "let choice= a:" . ichoice +" call Decho("no lastfile: choice<" . choice . ">") + + if match(choice,"?") == 0 + " give help + echomsg 'NetRead Usage:' + echomsg ':Nread machine:path uses rcp' + echomsg ':Nread "machine path" uses ftp with <.netrc>' + echomsg ':Nread "machine id password path" uses ftp' + echomsg ':Nread dav://machine[:port]/path uses cadaver' + echomsg ':Nread fetch://machine/path uses fetch' + echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' + echomsg ':Nread http://[user@]machine/path uses http wget' + echomsg ':Nread rcp://[user@]machine/path uses rcp' + echomsg ':Nread rsync://machine[:port]/path uses rsync' + echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp' + echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp' + sleep 4 + break + + elseif match(choice,'^"') != -1 + " Reconstruct Choice if choice starts with '"' +" call Decho("reconstructing choice") + if match(choice,'"$') != -1 + " case "..." + let choice=strpart(choice,1,strlen(choice)-2) + else + " case "... ... ..." + let choice = strpart(choice,1,strlen(choice)-1) + let wholechoice = "" + + while match(choice,'"$') == -1 + let wholechoice = wholechoice . " " . choice + let ichoice = ichoice + 1 + if ichoice > a:0 + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3) + endif +" call Dret("netrw#NetRead :2 getcwd<".getcwd().">") + return + endif + let choice= a:{ichoice} + endwhile + let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1) + endif + endif + endif + +" call Decho("choice<" . choice . ">") + let ichoice= ichoice + 1 + + " Determine method of read (ftp, rcp, etc) {{{3 + call s:NetMethod(choice) + let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix + + " Check if NetBrowse() should be handling this request +" call Decho("checking if NetBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") + if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^http://' +" call Decho("yes, choice matches '^.*[\/]$'") + keepjumps call s:NetBrowse(0,choice) +" call Dret("netrw#NetRead :3 getcwd<".getcwd().">") + return + endif + + " ============ + " Perform Protocol-Based Read {{{3 + " =========================== + if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 + echo "(netrw) Processing your read request..." + endif + + "......................................... + " rcp: NetRead Method #1 {{{3 + if b:netrw_method == 1 " read with rcp +" call Decho("read via rcp (method #1)") + " ER: nothing done with g:netrw_uid yet? + " ER: on Win2K" rcp machine[.user]:file tmpfile + " ER: if machine contains '.' adding .user is required (use $USERNAME) + " ER: the tmpfile is full path: rcp sees C:\... as host C + if s:netrw_has_nt_rcp == 1 + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_machine .'.'. g:netrw_uid + else + " Any way needed it machine contains a '.' + let uid_machine = g:netrw_machine .'.'. $USERNAME + endif + else + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_uid .'@'. g:netrw_machine + else + let uid_machine = g:netrw_machine + endif + endif +" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " ftp + <.netrc>: NetRead Method #2 {{{3 + elseif b:netrw_method == 2 " read with ftp + <.netrc> +" call Decho("read via ftp+.netrc (method #2)") + let netrw_fname= b:netrw_fname + new + setlocal ff=unix + exe "put ='".g:netrw_ftpmode."'" +" call Decho("filter input: ".getline(".")) + if exists("g:netrw_ftpextracmd") + exe "put ='".g:netrw_ftpextracmd."'" +" call Decho("filter input: ".getline(".")) + endif + exe "put ='".'get \"'.netrw_fname.'\" '.tmpfile."'" +" call Decho("filter input: ".getline(".")) + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port + else +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine + endif + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' + let debugkeep= &debug + setlocal debug=msg + call netrw#ErrorMsg(s:ERROR,getline(1),4) + let &debug= debugkeep + endif + bd! + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " ftp + machine,id,passwd,filename: NetRead Method #3 {{{3 + elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname + " Construct execution string (four lines) which will be passed through filter +" call Decho("read via ftp+mipf (method #3)") + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + new + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho("filter input: ".getline(".")) + else + put ='open '.g:netrw_machine +" call Decho("filter input: ".getline(".")) + endif + + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + put =g:netrw_uid +" call Decho("filter input: ".getline(".")) + put ='\"'.g:netrw_passwd.'\"' +" call Decho("filter input: ".getline(".")) + else + put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"' +" call Decho("filter input: ".getline(".")) + endif + + if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" + put =g:netrw_ftpmode +" call Decho("filter input: ".getline(".")) + endif + if exists("g:netrw_ftpextracmd") + exe "put ='".g:netrw_ftpextracmd."'" +" call Decho("filter input: ".getline(".")) + endif + put ='get \"'.netrw_fname.'\" '.tmpfile +" call Decho("filter input: ".getline(".")) + + " perform ftp: + " -i : turns off interactive prompting from ftp + " -n unix : DON'T use <.netrc>, even though it exists + " -n win32: quit being obnoxious about password + norm! 1Gdd +" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" +" call Decho("error<".getline(1).">") + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,getline(1),5) + endif + endif + bd! + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " scp: NetRead Method #4 {{{3 + elseif b:netrw_method == 4 " read with scp +" call Decho("read via scp (method #4)") + if exists("g:netrw_port") && g:netrw_port != "" + let useport= " -P ".g:netrw_port + else + let useport= "" + endif +" call Decho("executing: !".g:netrw_scp_cmd.useport." '".g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape)."' ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_shq.g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape).g:netrw_shq." ".tmpfile + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " http: NetRead Method #5 (wget) {{{3 + elseif b:netrw_method == 5 +" call Decho("read via http (method #5)") + if g:netrw_http_cmd == "" + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"neither the wget nor the fetch command is available",6) + endif +" call Dret("netrw#NetRead :4 getcwd<".getcwd().">") + return + endif + + if match(b:netrw_fname,"#") == -1 + " simple wget + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) +" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_fname) + exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_fname + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + + else + " wget plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) + let netrw_html= substitute(netrw_fname,"#.*$","","") + let netrw_tag = substitute(netrw_fname,"^.*#","","") +" call Decho("netrw_html<".netrw_html.">") +" call Decho("netrw_tag <".netrw_tag.">") +" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html) + exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) +" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') + exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>" + endif + let b:netrw_lastfile = choice + setlocal ro + + "......................................... + " cadaver: NetRead Method #6 {{{3 + elseif b:netrw_method == 6 +" call Decho("read via cadaver (method #6)") + + " Construct execution string (four lines) which will be passed through filter + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + new + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port + else + put ='open '.g:netrw_machine + endif + put ='user '.g:netrw_uid.' '.g:netrw_passwd + put ='get '.netrw_fname.' '.tmpfile + put ='quit' + + " perform cadaver operation: + norm! 1Gdd +" call Decho("executing: %!".g:netrw_dav_cmd) + exe g:netrw_silentxfer."%!".g:netrw_dav_cmd + bd! + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " rsync: NetRead Method #7 {{{3 + elseif b:netrw_method == 7 +" call Decho("read via rsync (method #7)") + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) +" call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile + let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " fetch: NetRead Method #8 {{{3 + " fetch://[user@]host[:http]/path + elseif b:netrw_method == 8 +" call Decho("read via fetch (method #8)") + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + if g:netrw_fetch_cmd == "" + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) + endif +" call Dret("NetRead") + endif + if exists("g:netrw_option") && g:netrw_option == ":http" + let netrw_option= "http" + else + let netrw_option= "ftp" + endif +" call Decho("read via fetch for ".netrw_option) + + if exists("g:netrw_uid") && g:netrw_uid != "" && exists("g:netrw_passwd") && g:netrw_passwd != "" +" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname) + exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname + else +" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".netrw_fname) + exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".netrw_fname + endif + + let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + setlocal ro + + "......................................... + " sftp: NetRead Method #9 {{{3 + elseif b:netrw_method == 9 +" call Decho("read via sftp (method #9)") + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) +" call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " Complain {{{3 + else + call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",8) + endif + endwhile + + " cleanup {{{3 + if exists("b:netrw_method") +" call Decho("cleanup b:netrw_method and b:netrw_fname") + unlet b:netrw_method + unlet b:netrw_fname + endif + if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' +" call Decho("cleanup by deleting tmpfile<".tmpfile.">") + call s:System("delete",tmpfile) + endif + call s:NetOptionRestore() + +" call Dret("netrw#NetRead :5 getcwd<".getcwd().">") +endfun + +" ------------------------------------------------------------------------ +" NetWrite: responsible for writing a file over the net {{{2 +fun! netrw#NetWrite(...) range +" call Dfunc("netrw#NetWrite(a:0=".a:0.") ".g:loaded_netrw) + + " option handling + let mod= 0 + call s:NetOptionSave() + + " Get Temporary Filename {{{3 + let tmpfile= s:GetTempfile("") + if tmpfile == "" +" call Dret("netrw#NetWrite : unable to get a tempfile!") + return + endif + + if a:0 == 0 + let ichoice = 0 + else + let ichoice = 1 + endif + + let curbufname= expand("%") +" call Decho("curbufname<".curbufname.">") + if &binary + " For binary writes, always write entire file. + " (line numbers don't really make sense for that). + " Also supports the writing of tar and zip files. +" call Decho("(write entire file) silent exe w! ".v:cmdarg." ".tmpfile) + silent exe "w! ".v:cmdarg." ".tmpfile + elseif g:netrw_cygwin + " write (selected portion of) file to temporary + let cygtmpfile= substitute(tmpfile,'/cygdrive/\(.\)','\1:','') +" call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".v:cmdarg." ".cygtmpfile) + silent exe a:firstline."," . a:lastline . "w! ".v:cmdarg." ".cygtmpfile + else + " write (selected portion of) file to temporary +" call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile) + silent exe a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile + endif + + if curbufname == "" + " if the file is [No Name], and one attempts to Nwrite it, the buffer takes + " on the temporary file's name. Deletion of the temporary file during + " cleanup then causes an error message. + 0file! + endif + + " While choice loop: {{{3 + while ichoice <= a:0 + + " Process arguments: {{{4 + " attempt to repeat with previous host-file-etc + if exists("b:netrw_lastfile") && a:0 == 0 +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") + let choice = b:netrw_lastfile + let ichoice= ichoice + 1 + else + exe "let choice= a:" . ichoice + + " Reconstruct Choice if choice starts with '"' + if match(choice,"?") == 0 + echomsg 'NetWrite Usage:"' + echomsg ':Nwrite machine:path uses rcp' + echomsg ':Nwrite "machine path" uses ftp with <.netrc>' + echomsg ':Nwrite "machine id password path" uses ftp' + echomsg ':Nwrite dav://[user@]machine/path uses cadaver' + echomsg ':Nwrite fetch://[user@]machine/path uses fetch' + echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)' + echomsg ':Nwrite rcp://machine/path uses rcp' + echomsg ':Nwrite rsync://[user@]machine/path uses rsync' + echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp' + echomsg ':Nwrite sftp://[user@]machine/path uses sftp' + sleep 4 + break + + elseif match(choice,"^\"") != -1 + if match(choice,"\"$") != -1 + " case "..." + let choice=strpart(choice,1,strlen(choice)-2) + else + " case "... ... ..." + let choice = strpart(choice,1,strlen(choice)-1) + let wholechoice = "" + + while match(choice,"\"$") == -1 + let wholechoice= wholechoice . " " . choice + let ichoice = ichoice + 1 + if choice > a:0 + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13) + endif +" call Dret("netrw#NetWrite") + return + endif + let choice= a:{ichoice} + endwhile + let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1) + endif + endif + endif + let ichoice= ichoice + 1 +" call Decho("choice<" . choice . "> ichoice=".ichoice) + + " Determine method of write (ftp, rcp, etc) {{{4 + call s:NetMethod(choice) + + " ============= + " Perform Protocol-Based Write {{{4 + " ============================ + if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 + echo "(netrw) Processing your write request..." + endif + + "......................................... + " rcp: NetWrite Method #1 {{{4 + if b:netrw_method == 1 +" call Decho("write via rcp (method #1)") + if s:netrw_has_nt_rcp == 1 + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_machine .'.'. g:netrw_uid + else + let uid_machine = g:netrw_machine .'.'. $USERNAME + endif + else + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_uid .'@'. g:netrw_machine + else + let uid_machine = g:netrw_machine + endif + endif + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) +" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".g:netrw_shq.tmpfile.g:netrw_shq." ".uid_machine.":".netrw_fname) + exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".g:netrw_shq.tmpfile.g:netrw_shq." ".uid_machine.":".netrw_fname + let b:netrw_lastfile = choice + + "......................................... + " ftp + <.netrc>: NetWrite Method #2 {{{4 + elseif b:netrw_method == 2 +" call Decho("write via ftp+.netrc (method #2)") + let netrw_fname= b:netrw_fname + new + setlocal ff=unix + exe "put ='".g:netrw_ftpmode."'" +" call Decho(" filter input: ".getline(".")) + if exists("g:netrw_ftpextracmd") + exe "put ='".g:netrw_ftpextracmd."'" +" call Decho("filter input: ".getline(".")) + endif + exe "put ='".'put \"'.tmpfile.'\" \"'.netrw_fname.'\"'."'" +" call Decho(" filter input: ".getline(".")) + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port + else +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine + endif + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,getline(1),14) + endif + let mod=1 + endif + bd! + let b:netrw_lastfile = choice + + "......................................... + " ftp + machine, id, passwd, filename: NetWrite Method #3 {{{4 + elseif b:netrw_method == 3 + " Construct execution string (four lines) which will be passed through filter +" call Decho("read via ftp+mipf (method #3)") + let netrw_fname= b:netrw_fname + new + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho("filter input: ".getline(".")) + else + put ='open '.g:netrw_machine +" call Decho("filter input: ".getline(".")) + endif + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + put =g:netrw_uid +" call Decho("filter input: ".getline(".")) + put ='\"'.g:netrw_passwd.'\"' +" call Decho("filter input: ".getline(".")) + else + put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"' +" call Decho("filter input: ".getline(".")) + endif + put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' +" call Decho("filter input: ".getline(".")) + " save choice/id/password for future use + let b:netrw_lastfile = choice + + " perform ftp: + " -i : turns off interactive prompting from ftp + " -n unix : DON'T use <.netrc>, even though it exists + " -n win32: quit being obnoxious about password + norm! 1Gdd +" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,getline(1),15) + endif + let mod=1 + endif + bd! + + "......................................... + " scp: NetWrite Method #4 {{{4 + elseif b:netrw_method == 4 +" call Decho("write via scp (method #4)") + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + if exists("g:netrw_port") && g:netrw_port != "" + let useport= " -P ".g:netrw_port + else + let useport= "" + endif +" call Decho("exe ".g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_shq.tmpfile.g:netrw_shq." ".g:netrw_shq.g:netrw_machine.":".netrw_fname.g:netrw_shq) + exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_shq.tmpfile.g:netrw_shq." ".g:netrw_shq.g:netrw_machine.":".netrw_fname.g:netrw_shq + let b:netrw_lastfile = choice + + "......................................... + " http: NetWrite Method #5 {{{4 + elseif b:netrw_method == 5 +" call Decho("write via http (method #5)") + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"currently <netrw.vim> does not support writing using http:",16) + endif + + "......................................... + " dav: NetWrite Method #6 (cadaver) {{{4 + elseif b:netrw_method == 6 +" call Decho("write via cadaver (method #6)") + + " Construct execution string (four lines) which will be passed through filter + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + new + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port + else + put ='open '.g:netrw_machine + endif + put ='user '.g:netrw_uid.' '.g:netrw_passwd + put ='put '.tmpfile.' '.netrw_fname + + " perform cadaver operation: + norm! 1Gdd +" call Decho("executing: %!".g:netrw_dav_cmd) + exe g:netrw_silentxfer."%!".g:netrw_dav_cmd + bd! + let b:netrw_lastfile = choice + + "......................................... + " rsync: NetWrite Method #7 {{{4 + elseif b:netrw_method == 7 +" call Decho("write via rsync (method #7)") + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) +" call Decho("executing: !".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".netrw_fname) + exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".netrw_fname + let b:netrw_lastfile = choice + + "......................................... + " sftp: NetWrite Method #9 {{{4 + elseif b:netrw_method == 9 +" call Decho("read via sftp (method #9)") + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_uid .'@'. g:netrw_machine + else + let uid_machine = g:netrw_machine + endif + new + setlocal ff=unix + put ='put \"'.escape(tmpfile,'\').'\" '.netrw_fname +" call Decho("filter input: ".getline(".")) + norm! 1Gdd +" call Decho("executing: %!".g:netrw_sftp_cmd.' '.uid_machine) + exe g:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.uid_machine + bd! + let b:netrw_lastfile= choice + + "......................................... + " Complain {{{4 + else + call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",17) + endif + endwhile + + " Cleanup: {{{3 +" call Decho("cleanup") + if s:FileReadable(tmpfile) +" call Decho("tmpfile<".tmpfile."> readable, will now delete it") + call s:System("delete",tmpfile) + endif + call s:NetOptionRestore() + + if a:firstline == 1 && a:lastline == line("$") + " restore modifiability; usually equivalent to set nomod + let &mod= mod + endif + +" call Dret("netrw#NetWrite") +endfun + +" --------------------------------------------------------------------- +" NetSource: source a remotely hosted vim script {{{2 +" uses NetRead to get a copy of the file into a temporarily file, +" then sources that file, +" then removes that file. +fun! netrw#NetSource(...) +" call Dfunc("netrw#NetSource() a:0=".a:0) + if a:0 > 0 && a:1 == '?' + " give help + echomsg 'NetSource Usage:' + echomsg ':Nsource dav://machine[:port]/path uses cadaver' + echomsg ':Nsource fetch://machine/path uses fetch' + echomsg ':Nsource ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' + echomsg ':Nsource http://[user@]machine/path uses http wget' + echomsg ':Nsource rcp://[user@]machine/path uses rcp' + echomsg ':Nsource rsync://machine[:port]/path uses rsync' + echomsg ':Nsource scp://[user@]machine[[:#]port]/path uses scp' + echomsg ':Nsource sftp://[user@]machine[[:#]port]/path uses sftp' + sleep 4 + else + let i= 1 + while i <= a:0 + call netrw#NetRead(3,a:{i}) +" call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">") + if s:FileReadable(s:netrw_tmpfile) +" call Decho("exe so ".s:netrw_tmpfile) + exe "so ".s:netrw_tmpfile + call delete(s:netrw_tmpfile) + unlet s:netrw_tmpfile + else + call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48) + endif + let i= i + 1 + endwhile + endif +" call Dret("netrw#NetSource") +endfun + +" =========================================== +" NetGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2 +" readcmd == %r : replace buffer with newly read file +" == 0r : read file at top of buffer +" == r : read file after current line +" == t : leave file in temporary form (ie. don't read into buffer) +fun! s:NetGetFile(readcmd, tfile, method) +" call Dfunc("NetGetFile(readcmd<".a:readcmd.">,tfile<".a:tfile."> method<".a:method.">)") + + " readcmd=='t': simply do nothing + if a:readcmd == 't' +" call Dret("NetGetFile : skip read of <".a:tfile.">") + return + endif + + " get name of remote filename (ie. url and all) + let rfile= bufname("%") +" call Decho("rfile<".rfile.">") + + if exists("*NetReadFixup") + " for the use of NetReadFixup (not otherwise used internally) + let line2= line("$") + endif + + if a:readcmd[0] == '%' + " get file into buffer +" call Decho("get file into buffer") + + " rename the current buffer to the temp file (ie. tfile) + if g:netrw_cygwin + let tfile= substitute(a:tfile,'/cygdrive/\(.\)','\1:','') + else + let tfile= a:tfile + endif +" call Decho("keepalt exe file ".tfile) + keepalt exe "silent! keepalt file ".tfile + + " edit temporary file (ie. read the temporary file in) + if rfile =~ '\.zip$' +" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)") + call zip#Browse(tfile) + elseif rfile =~ '\.tar$' +" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)") + call tar#Browse(tfile) + elseif rfile =~ '\.tar\.gz' +" call Decho("handling remote gzip-compressed tar file") + call tar#Browse(tfile) + elseif rfile =~ '\.tar\.bz2' +" call Decho("handling remote bz2-compressed tar file") + call tar#Browse(tfile) + else +" call Decho("edit temporary file") + e! + endif + + " rename buffer back to remote filename + exe "silent! keepalt file ".escape(rfile,' ') + filetype detect +" call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") + let line1 = 1 + let line2 = line("$") + + elseif s:FileReadable(a:tfile) + " read file after current line +" call Decho("read file<".a:tfile."> after current line") + let curline = line(".") + let lastline= line("$") +" call Decho("exe<".a:readcmd." ".v:cmdarg." ".a:tfile."> line#".curline) + exe a:readcmd." ".v:cmdarg." ".a:tfile + let line1= curline + 1 + let line2= line("$") - lastline + 1 + + else + " not readable +" call Decho("tfile<".a:tfile."> not readable") + call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) +" call Dret("NetGetFile : tfile<".a:tfile."> not readable") + return + endif + + " User-provided (ie. optional) fix-it-up command + if exists("*NetReadFixup") +" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") + call NetReadFixup(a:method, line1, line2) +" else " Decho +" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")") + endif + + " update the Buffers menu + if has("gui") && has("gui_running") + silent! emenu Buffers.Refresh\ menu + endif + +" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile)) + + " make sure file is being displayed + redraw! +" call Dret("NetGetFile") +endfun + +" ------------------------------------------------------------------------ +" NetMethod: determine method of transfer {{{2 +" method == 1: rcp +" 2: ftp + <.netrc> +" 3: ftp + machine, id, password, and [path]filename +" 4: scp +" 5: http (wget) +" 6: cadaver +" 7: rsync +" 8: fetch +" 9: sftp +fun! s:NetMethod(choice) " globals: method machine id passwd fname +" call Dfunc("NetMethod(a:choice<".a:choice.">)") + + " initialization + let b:netrw_method = 0 + let g:netrw_machine = "" + let b:netrw_fname = "" + let g:netrw_port = "" + let g:netrw_choice = a:choice + + " Patterns: + " mipf : a:machine a:id password filename Use ftp + " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd + " ftpurm : ftp://[user@]host[[#:]port]/filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd + " rcpurm : rcp://[user@]host/filename Use rcp + " rcphf : [user@]host:filename Use rcp + " scpurm : scp://[user@]host[[#:]port]/filename Use scp + " httpurm : http://[user@]host/filename Use wget + " davurm : [s]dav://host[:port]/path Use cadaver + " rsyncurm : rsync://host[:port]/path Use rsync + " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) + " sftpurm : sftp://[user@]host/filename Use scp + let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$' + let mf = '^\(\S\+\)\s\+\(\S\+\)$' + let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' + let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$' + let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' + let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$' + let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$' + let davurm = '^s\=dav://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$' + let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$' + let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' + let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' + +" call Decho("determine method:") + " Determine Method + " rcp://user@hostname/...path-to-file + if match(a:choice,rcpurm) == 0 +" call Decho("rcp://...") + let b:netrw_method = 1 + let userid = substitute(a:choice,rcpurm,'\1',"") + let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"") + let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"") + if userid != "" + let g:netrw_uid= userid + endif + + " scp://user@hostname/...path-to-file + elseif match(a:choice,scpurm) == 0 +" call Decho("scp://...") + let b:netrw_method = 4 + let g:netrw_machine = substitute(a:choice,scpurm,'\1',"") + let g:netrw_port = substitute(a:choice,scpurm,'\2',"") + let b:netrw_fname = substitute(a:choice,scpurm,'\3',"") + + " http://user@hostname/...path-to-file + elseif match(a:choice,httpurm) == 0 +" call Decho("http://...") + let b:netrw_method = 5 + let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") + let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") + + " dav://hostname[:port]/..path-to-file.. + elseif match(a:choice,davurm) == 0 +" call Decho("dav://...") + let b:netrw_method= 6 + if a:choice =~ '^s' + let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") + else + let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"") + endif + let b:netrw_fname = substitute(a:choice,davurm,'\3',"") + + " rsync://user@hostname/...path-to-file + elseif match(a:choice,rsyncurm) == 0 +" call Decho("rsync://...") + let b:netrw_method = 7 + let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") + let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") + + " ftp://[user@]hostname[[:#]port]/...path-to-file + elseif match(a:choice,ftpurm) == 0 +" call Decho("ftp://...") + let userid = substitute(a:choice,ftpurm,'\2',"") + let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") + let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") + let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") + if userid != "" + let g:netrw_uid= userid + endif + if exists("g:netrw_uid") && exists("g:netrw_passwd") + let b:netrw_method = 3 + else + if s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc + let b:netrw_method= 2 + else + if !exists("g:netrw_uid") || g:netrw_uid == "" + call NetUserPass() + elseif !exists("g:netrw_passwd") || g:netrw_passwd == "" + call NetUserPass(g:netrw_uid) + " else just use current g:netrw_uid and g:netrw_passwd + endif + let b:netrw_method= 3 + endif + endif + + elseif match(a:choice,fetchurm) == 0 +" call Decho("fetch://...") + let b:netrw_method = 8 + let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") + let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") + let b:netrw_option = substitute(a:choice,fetchurm,'\4',"") + let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"") + + " Issue an ftp : "machine id password [path/]filename" + elseif match(a:choice,mipf) == 0 +" call Decho("(ftp) host id pass file") + let b:netrw_method = 3 + let g:netrw_machine = substitute(a:choice,mipf,'\1',"") + let g:netrw_uid = substitute(a:choice,mipf,'\2',"") + let g:netrw_passwd = substitute(a:choice,mipf,'\3',"") + let b:netrw_fname = substitute(a:choice,mipf,'\4',"") + + " Issue an ftp: "hostname [path/]filename" + elseif match(a:choice,mf) == 0 +" call Decho("(ftp) host file") + if exists("g:netrw_uid") && exists("g:netrw_passwd") + let b:netrw_method = 3 + let g:netrw_machine = substitute(a:choice,mf,'\1',"") + let b:netrw_fname = substitute(a:choice,mf,'\2',"") + + elseif s:FileReadable(expand("$HOME/.netrc")) + let b:netrw_method = 2 + let g:netrw_machine = substitute(a:choice,mf,'\1',"") + let b:netrw_fname = substitute(a:choice,mf,'\2',"") + endif + + " sftp://user@hostname/...path-to-file + elseif match(a:choice,sftpurm) == 0 +" call Decho("sftp://...") + let b:netrw_method = 9 + let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") + let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") + + " Issue an rcp: hostname:filename" (this one should be last) + elseif match(a:choice,rcphf) == 0 +" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") + let b:netrw_method = 1 + let userid = substitute(a:choice,rcphf,'\2',"") + let g:netrw_machine= substitute(a:choice,rcphf,'\3',"") + let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") +" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") +" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") +" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") +" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") + if userid != "" + let g:netrw_uid= userid + endif + + else + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:WARNING,"cannot determine method",45) + endif + let b:netrw_method = -1 + endif + + " remove any leading [:#] from port number + if g:netrw_port != "" + let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','') + endif + +" call Decho("a:choice <".a:choice.">") +" call Decho("b:netrw_method <".b:netrw_method.">") +" call Decho("g:netrw_machine<".g:netrw_machine.">") +" call Decho("g:netrw_port <".g:netrw_port.">") +" if exists("g:netrw_uid") "Decho +" call Decho("g:netrw_uid <".g:netrw_uid.">") +" endif "Decho +" if exists("g:netrw_passwd") "Decho +" call Decho("g:netrw_passwd <".g:netrw_passwd.">") +" endif "Decho +" call Decho("b:netrw_fname <".b:netrw_fname.">") +" call Dret("NetMethod : b:netrw_method=".b:netrw_method) +endfun + +" ------------------------------------------------------------------------ +" NetReadFixup: this sort of function is typically written by the user {{{2 +" to handle extra junk that their system's ftp dumps +" into the transfer. This function is provided as an +" example and as a fix for a Windows 95 problem: in my +" experience, win95's ftp always dumped four blank lines +" at the end of the transfer. +if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp + fun! NetReadFixup(method, line1, line2) +" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") + if method == 3 " ftp (no <.netrc>) + let fourblanklines= line2 - 3 + silent fourblanklines.",".line2."g/^\s*/d" + endif +" call Dret("NetReadFixup") + endfun +endif + +" --------------------------------------------------------------------- +" NetUserPass: set username and password for subsequent ftp transfer {{{2 +" Usage: :call NetUserPass() -- will prompt for userid and password +" :call NetUserPass("uid") -- will prompt for password +" :call NetUserPass("uid","password") -- sets global userid and password +fun! NetUserPass(...) + + " get/set userid + if a:0 == 0 +" call Dfunc("NetUserPass(a:0<".a:0.">)") + if !exists("g:netrw_uid") || g:netrw_uid == "" + " via prompt + let g:netrw_uid= input('Enter username: ') + endif + else " from command line +" call Dfunc("NetUserPass(a:1<".a:1.">) {") + let g:netrw_uid= a:1 + endif + + " get password + if a:0 <= 1 " via prompt +" call Decho("a:0=".a:0." case <=1:") + let g:netrw_passwd= inputsecret("Enter Password: ") + else " from command line +" call Decho("a:0=".a:0." case >1: a:2<".a:2.">") + let g:netrw_passwd=a:2 + endif + +" call Dret("NetUserPass") +endfun + +" =========================================== +" Shared Browsing Support: {{{1 +" =========================================== + +" --------------------------------------------------------------------- +" s:BrowserMaps: {{{2 +fun! s:BrowserMaps(islocal) +" call Dfunc("s:BrowserMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") + if a:islocal + nnoremap <buffer> <silent> <cr> :call netrw#LocalBrowseCheck(<SID>NetBrowseChgDir(1,<SID>NetGetWord()))<cr> + nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call netrw#LocalBrowseCheck(<SID>NetBrowseChgDir(1,<SID>NetGetWord()))<cr> + nnoremap <buffer> <silent> <c-l> :call <SID>NetRefresh(1,<SID>NetBrowseChgDir(1,'./'))<cr> + nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call netrw#LocalBrowseCheck(<SID>NetBrowseChgDir(1,'../'))<cr> + nnoremap <buffer> <silent> a :call <SID>NetHide(1)<cr> + nnoremap <buffer> <silent> mb :<c-u>call <SID>NetBookmarkDir(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> gb :<c-u>call <SID>NetBookmarkDir(1,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> c :exe "cd ".b:netrw_curdir<cr> + nnoremap <buffer> <silent> C :let g:netrw_chgwin= winnr()<cr> + nnoremap <buffer> <silent> d :call <SID>NetMakeDir("")<cr> + nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(1)<cr> + nnoremap <buffer> <silent> i :call <SID>NetListStyle(1)<cr> + nnoremap <buffer> <silent> o :call <SID>NetSplit(3)<cr> + nnoremap <buffer> <silent> O :call <SID>LocalObtain()<cr> + nnoremap <buffer> <silent> p :call <SID>NetPreview(<SID>NetBrowseChgDir(1,<SID>NetGetWord(),1))<cr> + nnoremap <buffer> <silent> P :call <SID>NetPrevWinOpen(1)<cr> + nnoremap <buffer> <silent> q :<c-u>call <SID>NetBookmarkDir(2,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetRefresh(1,<SID>NetBrowseChgDir(1,'./'))<cr> + nnoremap <buffer> <silent> s :call <SID>NetSortStyle(1)<cr> + nnoremap <buffer> <silent> S :call <SID>NetSortSequence(1)<cr> + nnoremap <buffer> <silent> t :call <SID>NetSplit(4)<cr> + nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,expand("%"))<cr> + nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr> + nnoremap <buffer> <silent> v :call <SID>NetSplit(5)<cr> + nnoremap <buffer> <silent> x :call netrw#NetBrowseX(<SID>NetBrowseChgDir(1,<SID>NetGetWord(),0),0)"<cr> + if s:didstarstar || !mapcheck("<s-down>","n") + nnoremap <buffer> <silent> <s-down> :Nexplore<cr> + endif + if s:didstarstar || !mapcheck("<s-up>","n") + nnoremap <buffer> <silent> <s-up> :Pexplore<cr> + endif + exe 'nnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>' + exe 'vnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>' + exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>' + exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>' + exe 'nnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>' + exe 'vnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>' + exe 'nnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>' + exe 'vnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>' + exe 'nnoremap <buffer> <silent> <Leader>m :call <SID>NetMakeDir("")<cr>' + nnoremap <buffer> <F1> :he netrw-dir<cr> + + else " remote + call s:RemotePathAnalysis(b:netrw_curdir) + nnoremap <buffer> <silent> <cr> :call <SID>NetBrowse(0,<SID>NetBrowseChgDir(0,<SID>NetGetWord()))<cr> + nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call <SID>NetBrowse(0,<SID>NetBrowseChgDir(0,<SID>NetGetWord()))<cr> + nnoremap <buffer> <silent> <c-l> :call <SID>NetRefresh(0,<SID>NetBrowseChgDir(0,'./'))<cr> + nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>NetBrowse(0,<SID>NetBrowseChgDir(0,'../'))<cr> + nnoremap <buffer> <silent> a :call <SID>NetHide(0)<cr> + nnoremap <buffer> <silent> mb :<c-u>call <SID>NetBookmarkDir(0,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> gb :<c-u>call <SID>NetBookmarkDir(1,b:netrw_cur)<cr> + nnoremap <buffer> <silent> C :let g:netrw_chgwin= winnr()<cr> + nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(0)<cr> + nnoremap <buffer> <silent> i :call <SID>NetListStyle(0)<cr> + nnoremap <buffer> <silent> o :call <SID>NetSplit(0)<cr> + nnoremap <buffer> <silent> O :call netrw#NetObtain(0)<cr> + vnoremap <buffer> <silent> O :call netrw#NetObtain(1)<cr> + nnoremap <buffer> <silent> p :call <SID>NetPreview(<SID>NetBrowseChgDir(1,<SID>NetGetWord(),1))<cr> + nnoremap <buffer> <silent> P :call <SID>NetPrevWinOpen(0)<cr> + nnoremap <buffer> <silent> q :<c-u>call <SID>NetBookmarkDir(2,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetBrowse(0,<SID>NetBrowseChgDir(0,'./'))<cr> + nnoremap <buffer> <silent> s :call <SID>NetSortStyle(0)<cr> + nnoremap <buffer> <silent> S :call <SID>NetSortSequence(0)<cr> + nnoremap <buffer> <silent> t :call <SID>NetSplit(1)<cr> + nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> v :call <SID>NetSplit(2)<cr> + nnoremap <buffer> <silent> x :call netrw#NetBrowseX(<SID>NetBrowseChgDir(0,<SID>NetGetWord()),1)<cr> + exe 'nnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.s:user.s:machine.'","'.s:path.'")<cr>' + exe 'vnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.s:user.s:machine.'","'.s:path.'")<cr>' + exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetBrowseRm("'.s:user.s:machine.'","'.s:path.'")<cr>' + exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetBrowseRm("'.s:user.s:machine.'","'.s:path.'")<cr>' + exe 'nnoremap <buffer> <silent> d :call <SID>NetMakeDir("'.s:user.s:machine.'")<cr>' + exe 'nnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.s:user.s:machine.'","'.s:path.'")<cr>' + exe 'vnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.s:user.s:machine.'","'.s:path.'")<cr>' + exe 'nnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.s:user.s:machine.'","'.s:path.'")<cr>' + exe 'vnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.s:user.s:machine.'","'.s:path.'")<cr>' + nnoremap <buffer> <F1> :he netrw-browse-cmds<cr> + endif +" call Dret("s:BrowserMaps") +endfun + +" --------------------------------------------------------------------- +" s:NetBrowse: This function uses the command in g:netrw_list_cmd to get a list {{{2 +" of the contents of a remote directory. It is assumed that the +" g:netrw_list_cmd has a string, USEPORT HOSTNAME, that needs to be substituted +" with the requested remote hostname first. +fun! s:NetBrowse(islocal,dirname) + if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif +" call Dfunc("NetBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")) +" call Dredir("ls!") + + if exists("s:netrw_skipbrowse") + unlet s:netrw_skipbrowse +" call Dret("NetBrowse : s:netrw_skipbrowse=".s:netrw_skipbrowse) + return + endif + + call s:NetOptionSave() + + if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep +" call Decho("handle w:netrw_acdkeep:") +" call Decho("cd ".escape(a:dirname,s:netrw_cd_escape)." (due to 'acd')") + exe 'cd '.escape(a:dirname,s:netrw_cd_escape) +" call Decho("getcwd<".getcwd().">") + + elseif !a:islocal && a:dirname !~ '[\/]$' && a:dirname !~ '^"' + " looks like a regular file, attempt transfer +" call Decho("attempt transfer as regular file<".a:dirname.">") + + " remove any filetype indicator from end of dirname, except for the {{{3 + " "this is a directory" indicator (/). + " There shouldn't be one of those here, anyway. + let path= substitute(a:dirname,'[*=@|]\r\=$','','e') +" call Decho("new path<".path.">") + call s:RemotePathAnalysis(a:dirname) + + " remote-read the requested file into current buffer {{{3 + mark ' + call s:NetrwEnew(a:dirname) + let b:netrw_curdir= a:dirname + call s:NetrwSafeOptions() + setlocal ma noro +" call Decho("exe silent! keepalt file ".s:method."://".s:user.s:machine."/".escape(s:path,s:netrw_cd_escape)." (bt=".&bt.")") + exe "silent! keepalt file ".s:method."://".s:user.s:machine."/".escape(s:path,s:netrw_cd_escape) + exe "silent keepalt doau BufReadPre ".s:fname + silent call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path) + exe "silent keepalt doau BufReadPost ".s:fname + + " save certain window-oriented variables into buffer-oriented variables {{{3 + call s:SetBufWinVars() + call s:NetOptionRestore() + setlocal nomod nowrap + +" call Dret("NetBrowse : file<".s:fname.">") + return + endif + + " use buffer-oriented WinVars if buffer ones exist but window ones don't {{{3 + call s:UseBufWinVars() + + " set up some variables {{{3 + let b:netrw_browser_active = 1 + let dirname = a:dirname + let s:last_sort_by = g:netrw_sort_by + + call s:NetMenu(1) " set up menu {{{3 + if s:NetGetBuffer(a:islocal,dirname) " set up buffer {{{3 +" call Dret("NetBrowse : re-using buffer") + return + endif + + " set b:netrw_curdir to the new directory name {{{3 +" call Decho("set b:netrw_curdir to the new directory name:") + let b:netrw_curdir= dirname + if b:netrw_curdir =~ '[/\\]$' + let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') + endif + if b:netrw_curdir == '' + if has("amiga") + " On the Amiga, the empty string connotes the current directory + let b:netrw_curdir= getcwd() + else + " under unix, when the root directory is encountered, the result + " from the preceding substitute is an empty string. + let b:netrw_curdir= '/' + endif + endif + if !a:islocal && b:netrw_curdir !~ '/$' + let b:netrw_curdir= b:netrw_curdir.'/' + endif +" call Decho("b:netrw_curdir<".b:netrw_curdir.">") + + " ------------ + " (local only) {{{3 + " ------------ + if a:islocal +" call Decho("local only:") + + " Set up ShellCmdPost handling. Append current buffer to browselist + call s:LocalFastBrowser() + + " handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3 + if !g:netrw_keepdir +" call Decho("handle keepdir:") +" call Decho('exe cd '.escape(b:netrw_curdir,s:netrw_cd_escape)) + try + exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape) + catch /^Vim\%((\a\+)\)\=:E472/ + call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".b:netrw_curdir."> (permissions?)",33) + if exists("w:netrw_prvdir") + let b:netrw_curdir= w:netrw_prvdir + else + call s:NetOptionRestore() + let b:netrw_curdir= dirname +" call Dret("NetBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") + return + endif + endtry + endif + + " -------------------------------- + " remote handling: {{{3 + " -------------------------------- + else +" call Decho("remote only:") + + " analyze a:dirname and g:netrw_list_cmd {{{4 +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> a:dirname<".a:dirname.">") + if a:dirname == "NetrwTreeListing" + let dirname= b:netrw_curdir +" call Decho("(dirname was NetrwTreeListing) dirname<".dirname.">") + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") + let dirname= substitute(b:netrw_curdir,'\\','/','g') + if dirname !~ '/$' + let dirname= dirname.'/' + endif + let b:netrw_curdir = dirname +" call Decho("(liststyle is TREELIST) dirname<".dirname.">") + else + let dirname = substitute(a:dirname,'\\','/','g') +" call Decho("(normal) dirname<".dirname.">") + endif + + let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' + if dirname !~ dirpat + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) + endif + call s:NetOptionRestore() +" call Dret("NetBrowse : badly formatted dirname<".dirname.">") + return + endif + let b:netrw_curdir= dirname +" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)") + endif " (additional remote handling) + + " ----------------------- + " Directory Listing: {{{3 + " ----------------------- + setlocal noro ma + call s:BrowserMaps(a:islocal) + call s:PerformListing(a:islocal) + +" call Dret("NetBrowse") + return +endfun + +" --------------------------------------------------------------------- +" s:NetGetBuffer: {{{2 +" returns 0=cleared buffer +" 1=re-used buffer +fun! s:NetGetBuffer(islocal,dirname) +" call Dfunc("s:NetGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">)") + + " re-use buffer if possible {{{3 + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + " find NetrwTreeList buffer if there is one + let dirname= "NetrwTreeListing" + let bufnum = bufnr('\<NetrwTreeListing\>') + if bufnum != -1 +" call Dret("s:NetGetBuffer : bufnum#".bufnum."<NetrwTreeListing>") + return + endif + + else + " find buffer number of buffer named precisely the same as dirname {{{3 + let dirname= a:dirname +" call Decho("find buffer<".dirname.">'s number ") + let bufnum= bufnr(escape(dirname,'\')) +" call Decho("findbuf: bufnum=bufnr('".escape(dirname,'\')."')=".bufnum." (initial)") + let ibuf= 1 + if bufnum > 0 && bufname(bufnum) != dirname + let buflast = bufnr("$") +" call Decho("findbuf: buflast=".buflast) + while ibuf <= buflast + let bname= bufname(ibuf) +" call Decho("findbuf: ibuf=".ibuf. " bufname<".bufname(ibuf)."> dirname<".dirname.">") + if bname != '' && bname !~ '/' && dirname =~ '/'.bname.'$' | break | endif + if bname =~ '^'.dirname.'\=$' | break | endif + let ibuf= ibuf + 1 + endwhile + if ibuf > buflast + let bufnum= -1 + else + let bufnum= ibuf + endif +" call Decho("findbuf: bufnum=".bufnum." (final)") + endif + endif + + " get enew buffer and name it -or- re-use buffer {{{3 + mark ' + if bufnum < 0 || !bufexists(bufnum) +" call Decho("get enew buffer") + call s:NetrwEnew(dirname) + call s:NetrwSafeOptions() + " name the buffer + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + silent! keepalt file NetrwTreeListing + else + exe 'silent! keepalt file '.escape(dirname,s:netrw_cd_escape) + endif +" call Decho("named enew buffer<".expand("%").">") + + else " Re-use the buffer + +" call Decho("re-use buffer:") + let eikeep= &ei + set ei=all + if getline(2) =~ '^" Netrw Directory Listing' +" call Decho("re-use buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: keepalt b ".bufnum) + exe "keepalt b ".bufnum + else +" call Decho("reusing buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: b ".bufnum) + exe "b ".bufnum + endif + let &ei= eikeep + if line("$") <= 1 + call s:NetrwListSettings(a:islocal) +" call Dret("s:NetGetBuffer 0 : re-using buffer#".bufnr("%").", but its empty, so refresh it") + return 0 + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST +" call Decho("clear buffer<".expand("%")."> with :%d") + silent %d + call s:NetrwListSettings(a:islocal) +" call Dret("s:NetGetBuffer 0 : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") + return 0 + else +" call Dret("s:NetGetBuffer 1 : buf#".bufnr("%")) + return 1 + endif + endif + + " do netrw settings: make this buffer not-a-file, modifiable, not line-numbered, etc {{{3 + " fastbrowse Local Remote Hiding a buffer implies it may be re-used (fast) + " slow 0 D D Deleting a buffer implies it will not be re-used (slow) + " med 1 D H + " fast 2 H H + let fname= expand("%") + call s:NetrwListSettings(a:islocal) + exe "file ".escape(fname,' ') + + " delete all lines from buffer {{{3 +" call Decho("clear buffer<".expand("%")."> with :%d") + keepalt silent! %d + +" call Dret("s:NetGetBuffer 0 : buf#".bufnr("%")) + return 0 +endfun + +" --------------------------------------------------------------------- +" s:NetrwListSettings: {{{2 +fun! s:NetrwListSettings(islocal) +" call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")") + let fname= bufname("%") + setlocal bt=nofile nobl ma nonu nowrap noro + exe "file ".escape(fname,' ') + if g:netrw_use_noswf + setlocal noswf + endif +"call Dredir("ls!") +" call Decho("exe setlocal ts=".g:netrw_maxfilenamelen) + exe "setlocal ts=".g:netrw_maxfilenamelen + if g:netrw_fastbrowse > a:islocal + setlocal bh=hide + else + setlocal bh=delete + endif +" call Dret("s:NetrwListSettings") +endfun + +" --------------------------------------------------------------------- +" s:PerformListing: {{{2 +fun! s:PerformListing(islocal) +" call Dfunc("s:PerformListing(islocal=".a:islocal.")") + +" if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho +" call Decho("(netrw) Processing your browsing request...") +" endif " Decho + +" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") + " force a refresh for tree listings +" call Decho("clear buffer<".expand("%")."> with :%d") + setlocal ma noro + keepjumps %d + endif + + " save current directory on directory history list + call s:NetBookmarkDir(3,b:netrw_curdir) + + " Set up the banner {{{3 +" call Decho("set up banner") + keepjumps put ='\" ============================================================================' + keepjumps put ='\" Netrw Directory Listing (netrw '.g:loaded_netrw.')' + keepjumps put ='\" '.b:netrw_curdir + keepjumps 1d + let w:netrw_bannercnt= 3 + exe w:netrw_bannercnt + + let sortby= g:netrw_sort_by + if g:netrw_sort_direction =~ "^r" + let sortby= sortby." reversed" + endif + + " Sorted by... {{{3 +" call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">") + if g:netrw_sort_by =~ "^n" +" call Decho("directories will be sorted by name") + " sorted by name + keepjumps put ='\" Sorted by '.sortby + keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence + let w:netrw_bannercnt= w:netrw_bannercnt + 2 + else +" call Decho("directories will be sorted by size or time") + " sorted by size or date + keepjumps put ='\" Sorted by '.sortby + let w:netrw_bannercnt= w:netrw_bannercnt + 1 + endif + exe w:netrw_bannercnt + + " Hiding... -or- Showing... {{{3 +" call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") + if g:netrw_list_hide != "" && g:netrw_hide + if g:netrw_hide == 1 + keepjumps put ='\" Hiding: '.g:netrw_list_hide + else + keepjumps put ='\" Showing: '.g:netrw_list_hide + endif + let w:netrw_bannercnt= w:netrw_bannercnt + 1 + endif + exe w:netrw_bannercnt + keepjumps put ='\" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec' + keepjumps put ='\" ============================================================================' + let w:netrw_bannercnt= w:netrw_bannercnt + 2 + + " bannercnt should index the line just after the banner + let w:netrw_bannercnt= w:netrw_bannercnt + 1 + exe w:netrw_bannercnt +" call Decho("bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) + + " set up syntax highlighting {{{3 +" call Decho("set up syntax highlighting") + if has("syntax") + setlocal ft=netrw + if !exists("g:syntax_on") || !g:syntax_on + setlocal ft= + endif + endif + + " get list of files + if a:islocal + call s:LocalListing() + else " remote + call s:RemoteListing() + endif +" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") + + " manipulate the directory listing (hide, sort) {{{3 + if line("$") >= w:netrw_bannercnt +" call Decho("manipulate directory listing (hide)") +" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") + if g:netrw_hide && g:netrw_list_hide != "" + call s:NetListHide() + endif + if line("$") >= w:netrw_bannercnt +" call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">") + + if g:netrw_sort_by =~ "^n" + " sort by name + call s:SetSort() + + if w:netrw_bannercnt < line("$") +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")") + if g:netrw_sort_direction =~ 'n' + " normal direction sorting + exe 'silent keepjumps '.w:netrw_bannercnt.',$sort' + else + " reverse direction sorting + exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!' + endif + endif + " remove priority pattern prefix +" call Decho("remove priority pattern prefix") + exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e' + + elseif a:islocal + if w:netrw_bannercnt < line("$") +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction) + if g:netrw_sort_direction =~ 'n' +" call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort') + exe 'silent keepjumps '.w:netrw_bannercnt.',$sort' + else +" call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort!') + exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!' + endif + endif + exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e' + endif + + elseif g:netrw_sort_direction =~ 'r' +" call Decho('reverse the sorted listing') + exe 'silent keepjumps '.w:netrw_bannercnt.'g/^/m '.w:netrw_bannercnt + endif + endif + + " convert to wide/tree listing {{{3 +" call Decho("modify display if wide/tree listing style") + call s:NetWideListing() + call s:NetTreeListing(b:netrw_curdir) + + if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt + " place cursor on the top-left corner of the file listing +" call Decho("place cursor on top-left corner of file listing") + exe 'silent '.w:netrw_bannercnt + norm! 0 + endif + + " record previous current directory + let w:netrw_prvdir= b:netrw_curdir +" call Decho("record netrw_prvdir<".w:netrw_prvdir.">") + + " save certain window-oriented variables into buffer-oriented variables {{{3 + call s:SetBufWinVars() + call s:NetOptionRestore() + + " set display to netrw display settings +" call Decho("set display to netrw display settings (noma nomod etc)") + setlocal noma nomod nonu nobl nowrap ro + if exists("s:treecurpos") + call setpos('.',s:treecurpos) + unlet s:treecurpos + endif + +" call Dret("s:PerformListing : curpos<".string(getpos(".")).">") +endfun + +" --------------------------------------------------------------------- +" s:NetBrowseChgDir: constructs a new directory based on the current {{{2 +" directory and a new directory name +fun! s:NetBrowseChgDir(islocal,newdir,...) +" call Dfunc("s:NetBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">") + + if !exists("b:netrw_curdir") +" call Decho("(NetBrowseChgDir) b:netrw_curdir doesn't exist!") + echoerr "(NetBrowseChgDir) b:netrw_curdir doesn't exist!" +" call Dret("s:NetBrowseChgDir") + return + endif + + call netrw#NetSavePosn() + let nbcd_curpos = getpos('.') + let dirname = substitute(b:netrw_curdir,'\\','/','ge') + let newdir = a:newdir + + " set up o/s-dependent directory recognition pattern + if has("amiga") + let dirpat= '[\/:]$' + else + let dirpat= '[\/]$' + endif +" call Decho("dirname<".dirname."> dirpat<".dirpat.">") + + if dirname !~ dirpat + " apparently vim is "recognizing" that it is in a directory and + " is removing the trailing "/". Bad idea, so I have to put it back. + let dirname= dirname.'/' +" call Decho("adjusting dirname<".dirname.">") + endif + + if newdir !~ dirpat + " handling a file +" call Decho('case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' + let dirname= s:NetTreeDir().newdir +" call Decho("tree listing") + elseif newdir =~ '^\(/\|\a:\)' + let dirname= newdir + else + let dirname= s:ComposePath(dirname,newdir) + endif +" call Decho("handling a file: dirname<".dirname."> (a:0=".a:0.")") + " this lets NetBrowseX avoid the edit + if a:0 < 1 +" call Decho("dirname<".dirname."> netrw_cd_escape<".s:netrw_cd_escape."> browse_split=".g:netrw_browse_split) +" call Decho("about to edit<".escape(dirname,s:netrw_cd_escape)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) + if !exists("s:didsplit") + if g:netrw_browse_split == 1 + new + wincmd _ + elseif g:netrw_browse_split == 2 + rightb vert new + wincmd | + elseif g:netrw_browse_split == 3 + tabnew + else + " handling a file, didn't split, so remove menu +" call Decho("handling a file+didn't split, so remove menu") + call s:NetMenu(0) + " optional change to window + if g:netrw_chgwin >= 1 + exe g:netrw_chgwin."wincmd w" + endif + endif + endif + " edit the file + " its local only: LocalBrowseCheck() doesn't edit a file, but NetBrowse() will + if a:islocal +" call Decho("edit file: exe e! ".escape(dirname,s:netrw_cd_escape)) + exe "e! ".escape(dirname,s:netrw_cd_escape) + endif + setlocal ma nomod noro + endif + + elseif newdir =~ '^/' + " just go to the new directory spec +" call Decho('case "just go to new directory spec": newdir<'.newdir.'>') + let dirname= newdir + + elseif newdir == './' + " refresh the directory list +" call Decho('case "refresh directory listing": newdir == "./"') + + elseif newdir == '../' + " go up one directory +" call Decho('case "go up one directory": newdir == "../"') + + if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") + " force a refresh +" call Decho("clear buffer<".expand("%")."> with :%d") + setlocal noro ma + keepjumps %d + endif + + if has("amiga") + " amiga +" call Decho('case "go up one directory": newdir == "../" and amiga') + if a:islocal + let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','') + let dirname= substitute(dirname,'/$','','') + else + let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','') + endif +" call Decho("amiga: dirname<".dirname."> (go up one dir)") + + else + " unix or cygwin +" call Decho('case "go up one directory": newdir == "../" and unix or cygwin') + if a:islocal + let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') + if dirname == "" + let dirname= '/' + endif + else + let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') + endif +" call Decho("unix: dirname<".dirname."> (go up one dir)") + endif + + elseif w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") +" call Decho('case liststyle is TREELIST and w:netrw_treedict exists') + " force a refresh (for TREELIST, wait for NetTreeDir() to force the refresh) + setlocal noro ma + if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) +" call Decho("clear buffer<".expand("%")."> with :%d") + keepjumps %d + endif + let treedir = s:NetTreeDir() + let s:treecurpos = nbcd_curpos + let haskey= 0 +" call Decho("w:netrw_treedict<".string(w:netrw_treedict).">") + + " search treedict for tree dir as-is + if has_key(w:netrw_treedict,treedir) +" call Decho('....searched for treedir<'.treedir.'> : found it!') + let haskey= 1 + else +" call Decho('....searched for treedir<'.treedir.'> : not found') + endif + + " search treedict for treedir with a / appended + if !haskey && treedir !~ '/$' + if has_key(w:netrw_treedict,treedir."/") + let treedir= treedir."/" +" call Decho('....searched.for treedir<'.treedir.'> found it!') + let haskey = 1 + else +" call Decho('....searched for treedir<'.treedir.'/> : not found') + endif + endif + + " search treedict for treedir with any trailing / elided + if !haskey && treedir =~ '/$' + let treedir= substitute(treedir,'/$','','') + if has_key(w:netrw_treedict,treedir) +" call Decho('....searched.for treedir<'.treedir.'> found it!') + let haskey = 1 + else +" call Decho('....searched for treedir<'.treedir.'> : not found') + endif + endif + + if haskey + " close tree listing for selected subdirectory +" call Decho("closing selected subdirectory<".dirname.">") + call remove(w:netrw_treedict,treedir) +" call Decho("removed entry<".dirname."> from treedict") +" call Decho("yielding treedict<".string(w:netrw_treedict).">") + let dirname= w:netrw_treetop + else + " go down one directory + let dirname= substitute(treedir,'/*$','/','') +" call Decho("go down one dir: treedir<".treedir.">") + endif + + else + " go down one directory + let dirname= s:ComposePath(dirname,newdir) +" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") + endif + +" call Dret("s:NetBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") + return dirname +endfun + +" --------------------------------------------------------------------- +" s:NetHide: this function is invoked by the "a" map for browsing {{{2 +" and switches the hiding mode +fun! s:NetHide(islocal) +" call Dfunc("NetHide(islocal=".a:islocal.")") + let g:netrw_hide=(g:netrw_hide+1)%3 + exe "norm! 0" + if g:netrw_hide && g:netrw_list_hide == "" + call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49) +" call Dret("NetHide") + return + endif + call netrw#NetSavePosn() + call s:NetRefresh(a:islocal,s:NetBrowseChgDir(a:islocal,'./')) +" call Dret("NetHide") +endfun + +" --------------------------------------------------------------------- + +" =========================================== +" s:NetPreview: {{{2 +fun! s:NetPreview(path) range +" call Dfunc("NetPreview(path<".a:path.">)") + if has("quickfix") + if !isdirectory(a:path) + exe "pedit ".escape(a:path,g:netrw_fname_escape) + elseif !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38) + endif + elseif !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) + endif +" call Dret("NetPreview") +endfun + +" --------------------------------------------------------------------- +" s:NetSortStyle: change sorting style (name - time - size) and refresh display {{{2 +fun! s:NetSortStyle(islocal) +" call Dfunc("s:NetSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">") + call s:NetSaveWordPosn() + + let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name' + norm! 0 + call netrw#NetSavePosn() + call s:NetRefresh(a:islocal,s:NetBrowseChgDir(a:islocal,'./')) + +" call Dret("s:NetSortStyle : netrw_sort_by<".g:netrw_sort_by.">") +endfun + +" --------------------------------------------------------------------- +" Remote Directory Browsing Support: {{{1 +" =========================================== + +" --------------------------------------------------------------------- +" s:RemoteListing: {{{2 +fun! s:RemoteListing() +" call Dfunc("s:RemoteListing() b:netrw_curdir<".b:netrw_curdir.">)") + + call s:RemotePathAnalysis(b:netrw_curdir) + + " sanity check: + if exists("b:netrw_method") && b:netrw_method =~ '[235]' +" call Decho("b:netrw_method=".b:netrw_method) + if !executable("ftp") + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ftp",18) + endif + call s:NetOptionRestore() +" call Dret("s:RemoteListing") + return + endif + + elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' + if !exists("g:netrw_quiet") + if g:netrw_list_cmd == "" + call netrw#ErrorMsg(s:ERROR,g:netrw_ssh_cmd." is not executable on your system",47) + else + call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19) + endif + endif + + call s:NetOptionRestore() +" call Dret("s:RemoteListing") + return + endif " (remote handling sanity check) + + if exists("b:netrw_method") +" call Decho("setting w:netrw_method<".b:netrw_method.">") + let w:netrw_method= b:netrw_method + endif + + if s:method == "ftp" + " use ftp to get remote file listing +" call Decho("use ftp to get remote file listing") + let s:method = "ftp" + let listcmd = g:netrw_ftp_list_cmd + if g:netrw_sort_by =~ '^t' + let listcmd= g:netrw_ftp_timelist_cmd + elseif g:netrw_sort_by =~ '^s' + let listcmd= g:netrw_ftp_sizelist_cmd + endif +" call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)") + call s:NetBrowseFtpCmd(s:path,listcmd) +" exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."))' + + if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST + " shorten the listing +" call Decho("generate short listing") + exe "keepjumps ".w:netrw_bannercnt + + " cleanup + if g:netrw_ftp_browse_reject != "" + exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d" + endif + silent! keepjumps %s/\r$//e + + " if there's no ../ listed, then put ./ and ../ in + let line1= line(".") + exe "keepjumps ".w:netrw_bannercnt + let line2= search('^\.\.\/\%(\s\|$\)','cnW') + if line2 == 0 +" call Decho("netrw is putting ./ and ../ into listing") + keepjumps put='../' + keepjumps put='./' + endif + exe "keepjumps ".line1 + keepjumps norm! 0 + +" call Decho("line1=".line1." line2=".line2." line(.)=".line(".")) + if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup +" call Decho("M$ ftp cleanup") + exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+//' + else " normal ftp cleanup +" call Decho("normal ftp cleanup") + exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' + exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' + exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' + endif + endif + + else + " use ssh to get remote file listing {{{3 +" call Decho("use ssh to get remote file listing: s:netrw_shq<".g:netrw_shq."> s:path<".s:path."> s:netrw_cd_escape<".s:netrw_cd_escape.">") + let listcmd= s:MakeSshCmd(g:netrw_list_cmd) +" call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)") + if g:netrw_scp_cmd =~ '^pscp' +" call Decho("1: exe silent r! ".listcmd.g:netrw_shq.s:path.g:netrw_shq) + exe "silent r! ".listcmd.g:netrw_shq.s:path.g:netrw_shq + " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like + g/^Listing directory/d + g/^d[-rwx][-rwx][-rwx]/s+$+/+e + silent g/^l[-rwx][-rwx][-rwx]/s+$+@+e + if g:netrw_liststyle != s:LONGLIST + g/^[dlsp-][-rwx][-rwx][-rwx]/s/^.*\s\(\S\+\)$/\1/e + endif + else + if s:path == "" +" call Decho("2: exe silent r! ".listcmd) + exe "silent r! ".listcmd + else +" call Decho("3: exe silent r! ".listcmd." ".g:netrw_shq.s:path.g:netrw_shq) + exe "silent r! ".listcmd." ".g:netrw_shq.s:path.g:netrw_shq + endif + endif + + " cleanup + if g:netrw_ftp_browse_reject != "" +" call Decho("(cleanup) exe silent! g/".g:netrw_ssh_browse_reject."/keepjumps d") + exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d" + endif + endif + + if w:netrw_liststyle == s:LONGLIST + " do a long listing; these substitutions need to be done prior to sorting {{{3 +" call Decho("fix long listing:") + + if s:method == "ftp" + " cleanup + exe "keepjumps ".w:netrw_bannercnt + while getline(".") =~ g:netrw_ftp_browse_reject + keepjumps d + endwhile + " if there's no ../ listed, then put ./ and ../ in + let line1= line(".") + keepjumps 1 + silent keepjumps call search('^\.\.\/\%(\s\|$\)','W') + let line2= line(".") + if line2 == 0 + exe 'keepjumps '.w:netrw_bannercnt."put='./'" + if b:netrw_curdir != '/' + exe 'keepjumps '.w:netrw_bannercnt."put='../'" + endif + endif + exe "keepjumps ".line1 + keepjumps norm! 0 + endif + + if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup +" call Decho("M$ ftp site listing cleanup") + exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/' + elseif exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") +" call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$")) + exe 'silent keepjumps '.w:netrw_bannercnt.',$s/ -> .*$//e' + exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e' + exe 'silent keepjumps '.w:netrw_bannercnt + endif + endif + +" if exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " Decho +" exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."))' +" endif " Decho +" call Dret("s:RemoteListing") +endfun + +" --------------------------------------------------------------------- +" NetGetWord: it gets the directory named under the cursor {{{2 +fun! s:NetGetWord() +" call Dfunc("NetGetWord() line#".line(".")." liststyle=".g:netrw_liststyle." virtcol=".virtcol(".")) + call s:UseBufWinVars() + + " insure that w:netrw_liststyle is set up + if !exists("w:netrw_liststyle") + if exists("g:netrw_liststyle") + let w:netrw_liststyle= g:netrw_liststyle + else + let w:netrw_liststyle= s:THINLIST + endif +" call Decho("w:netrw_liststyle=".w:netrw_liststyle) + endif + + if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt + " Active Banner support +" call Decho("active banner handling") + norm! 0 + let dirname= "./" + let curline= getline(".") + + if curline =~ '"\s*Sorted by\s' + norm s + let s:netrw_skipbrowse= 1 + echo 'Pressing "s" also works' + + elseif curline =~ '"\s*Sort sequence:' + let s:netrw_skipbrowse= 1 + echo 'Press "S" to edit sorting sequence' + + elseif curline =~ '"\s*Quick Help:' + norm ? + let s:netrw_skipbrowse= 1 + echo 'Pressing "?" also works' + + elseif curline =~ '"\s*\%(Hiding\|Showing\):' + norm a + let s:netrw_skipbrowse= 1 + echo 'Pressing "a" also works' + + elseif line("$") > w:netrw_bannercnt + exe 'silent keepjumps '.w:netrw_bannercnt + endif + + elseif w:netrw_liststyle == s:THINLIST +" call Decho("thin column handling") + norm! 0 + let dirname= getline(".") + + elseif w:netrw_liststyle == s:LONGLIST +" call Decho("long column handling") + norm! 0 + let dirname= substitute(getline("."),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e') + + elseif w:netrw_liststyle == s:TREELIST +" call Decho("treelist handling") + let dirname= substitute(getline("."),'^\(| \)*','','e') + + else +" call Decho("obtain word from wide listing") + let dirname= getline(".") + + if !exists("b:netrw_cpf") + let b:netrw_cpf= 0 + exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' +" call Decho("computed cpf") + endif + +" call Decho("buf#".bufnr("%")."<".bufname("%").">") + let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf +" call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt) +" call Decho("1: dirname<".dirname.">") + if filestart > 0|let dirname= substitute(dirname,'^.\{'.filestart.'}','','')|endif +" call Decho("2: dirname<".dirname.">") + let dirname = substitute(dirname,'^\(.\{'.b:netrw_cpf.'}\).*$','\1','e') +" call Decho("3: dirname<".dirname.">") + let dirname = substitute(dirname,'\s\+$','','e') +" call Decho("4: dirname<".dirname.">") + endif + +" call Dret("NetGetWord <".dirname.">") + return dirname +endfun + +" --------------------------------------------------------------------- +" NetBrowseRm: remove/delete a remote file or directory {{{2 +fun! s:NetBrowseRm(usrhost,path) range +" call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol(".")) +" call Decho("firstline=".a:firstline." lastline=".a:lastline) + + " preparation for removing multiple files/directories + let ctr= a:firstline + let all= 0 + + " remove multiple files and directories + while ctr <= a:lastline + exe ctr + + let rmfile= s:NetGetWord() +" call Decho("rmfile<".rmfile.">") + + if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') + " attempt to remove file +" call Decho("attempt to remove file") + if !all + echohl Statement + call inputsave() + let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") + call inputrestore() + echohl NONE + if ok == "" + let ok="no" + endif + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') + if ok =~ 'a\%[ll]' + let all= 1 + endif + endif + + if all || ok =~ 'y\%[es]' || ok == "" + if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) + silent! keepjumps .,$d + call s:NetBrowseFtpCmd(a:path,"delete ".rmfile) + else + let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd) +" call Decho("attempt to remove file: system(".netrw_rm_cmd.")") + let ret= s:System("system",netrw_rm_cmd) +" call Decho("returned=".ret." errcode=".v:shell_error) + endif + elseif ok =~ 'q\%[uit]' + break + endif + + else + " attempt to remove directory +" call Decho("attempt to remove directory") + if !all + call inputsave() + let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") + call inputrestore() + if ok == "" + let ok="no" + endif + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') + if ok =~ 'a\%[ll]' + let all= 1 + endif + endif + + if all || ok =~ 'y\%[es]' || ok == "" + if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) + call s:NetBrowseFtpCmd(a:path,"rmdir ".rmfile) + else + let rmfile = substitute(a:path.rmfile,'/$','','') + let netrw_rmdir_cmd = s:MakeSshCmd(g:netrw_rmdir_cmd).' '.rmfile +" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")") + let ret= s:System("system",netrw_rmdir_cmd) +" call Decho("returned=".ret." errcode=".v:shell_error) + + if v:shell_error != 0 +" call Decho("v:shell_error not 0") + let netrw_rmf_cmd= s:MakeSshCmd(g:netrw_rmf_cmd).' '.substitute(rmfile,'[\/]$','','e') +" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")") + let ret= s:System("system",netrw_rmf_cmd) +" call Decho("returned=".ret." errcode=".v:shell_error) + + if v:shell_error != 0 && !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) + endif + endif + endif + + elseif ok =~ 'q\%[uit]' + break + endif + endif + + let ctr= ctr + 1 + endwhile + + " refresh the (remote) directory listing +" call Decho("refresh remote directory listing") + call netrw#NetSavePosn() + call s:NetRefresh(0,s:NetBrowseChgDir(0,'./')) + +" call Dret("NetBrowseRm") +endfun + +" --------------------------------------------------------------------- +" NetBrowseRename: rename a remote file or directory {{{2 +fun! s:NetBrowseRename(usrhost,path) range +" call Dfunc("NetBrowseRename(usrhost<".a:usrhost."> path<".a:path.">)") + + " preparation for removing multiple files/directories + let ctr = a:firstline + let rename_cmd = s:MakeSshCmd(g:netrw_rename_cmd) + + " attempt to rename files/directories + while ctr <= a:lastline + exe "keepjumps ".ctr + + norm! 0 + let oldname= s:NetGetWord() +" call Decho("oldname<".oldname.">") + + call inputsave() + let newname= input("Moving ".oldname." to : ",oldname) + call inputrestore() + + if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) + call s:NetBrowseFtpCmd(a:path,"rename ".oldname." ".newname) + else + let oldname= a:path.oldname + let newname= a:path.newname +" call Decho("system(rename_cmd".' "'.escape(oldname," ").'" "'.escape(newname,s:netrw_cd_escape).'"') + let ret= s:System("system",rename_cmd.' "'.escape(oldname,s:netrw_cd_escape).'" "'.escape(newname,s:netrw_cd_escape).'"') + endif + + let ctr= ctr + 1 + endwhile + + " refresh the directory + let curline= line(".") + call s:NetBrowse(0,s:NetBrowseChgDir(0,'./')) + exe "keepjumps ".curline +" call Dret("NetBrowseRename") +endfun + +" --------------------------------------------------------------------- +" NetRefresh: {{{2 +fun! s:NetRefresh(islocal,dirname) +" call Dfunc("NetRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction) + " at the current time (Mar 19, 2007) all calls to NetRefresh() call NetBrowseChgDir() first. + " NetBrowseChgDir() may clear the display; hence a NetSavePosn() may not work if its placed here. + " Also, NetBrowseChgDir() now does a NetSavePosn() itself. + setlocal ma noro +" call Decho("clear buffer<".expand("%")."> with :%d") + %d + if a:islocal + call netrw#LocalBrowseCheck(a:dirname) + else + call s:NetBrowse(a:islocal,a:dirname) + endif + call netrw#NetRestorePosn() + redraw! +" call Dret("NetRefresh") +endfun + +" --------------------------------------------------------------------- +" NetSplit: mode {{{2 +" =0 : net and o +" =1 : net and t +" =2 : net and v +" =3 : local and o +" =4 : local and t +" =5 : local and v +fun! s:NetSplit(mode) +" call Dfunc("NetSplit(mode=".a:mode.") alto=".g:netrw_alto." altv=".g:netrw_altv) + + call s:SaveWinVars() + + if a:mode == 0 + " remote and o + exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" + let s:didsplit= 1 + call s:RestoreWinVars() + call s:NetBrowse(0,s:NetBrowseChgDir(0,s:NetGetWord())) + unlet s:didsplit + + elseif a:mode == 1 + " remote and t + let cursorword = s:NetGetWord() + tabnew + let s:didsplit= 1 + call s:RestoreWinVars() + call s:NetBrowse(0,s:NetBrowseChgDir(0,cursorword)) + unlet s:didsplit + + elseif a:mode == 2 + " remote and v + exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v" + let s:didsplit= 1 + call s:RestoreWinVars() + call s:NetBrowse(0,s:NetBrowseChgDir(0,s:NetGetWord())) + unlet s:didsplit + + elseif a:mode == 3 + " local and o + exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" + let s:didsplit= 1 + call s:RestoreWinVars() + call netrw#LocalBrowseCheck(s:NetBrowseChgDir(1,s:NetGetWord())) + unlet s:didsplit + + elseif a:mode == 4 + " local and t + let netrw_curdir= b:netrw_curdir + let cursorword = s:NetGetWord() + tabnew + let b:netrw_curdir= netrw_curdir + let s:didsplit= 1 + call s:RestoreWinVars() + call netrw#LocalBrowseCheck(s:NetBrowseChgDir(1,cursorword)) + unlet s:didsplit + + elseif a:mode == 5 + " local and v + exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v" + let s:didsplit= 1 + call s:RestoreWinVars() + call netrw#LocalBrowseCheck(s:NetBrowseChgDir(1,s:NetGetWord())) + unlet s:didsplit + + else + call netrw#ErrorMsg(s:ERROR,"(NetSplit) unsupported mode=".a:mode,45) + endif + +" call Dret("NetSplit") +endfun + +" --------------------------------------------------------------------- +" NetBrowseX: allows users to write custom functions to operate on {{{2 +" files given their extension. Passes 0=local, 1=remote +fun! netrw#NetBrowseX(fname,remote) +" call Dfunc("NetBrowseX(fname<".a:fname."> remote=".a:remote.")") + + " set up the filename + " (lower case the extension, make a local copy of a remote file) + let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e') + if has("win32") || has("win95") || has("win64") || has("win16") + let exten= substitute(exten,'^.*$','\L&\E','') + endif + let fname= escape(a:fname,"%#") +" call Decho("fname<".fname."> after escape()") + + " seems kde systems often have gnome-open due to dependencies, even though + " gnome-open's subsidiary display tools are largely absent. Kde systems + " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) + if !exists("s:haskdeinit") + if has("unix") + let s:haskdeinit= s:System("system",'ps -e') =~ 'kdeinit' + if v:shell_error + let s:haskdeinit = 0 + endif + else + let s:haskdeinit= 0 + endif +" call Decho("setting s:haskdeinit=".s:haskdeinit) + endif + + if a:remote == 1 + " create a local copy + let fname= fnamemodify(tempname(),":t:r").".".exten +" call Decho("a:remote=".a:remote.": create a local copy of <".a:fname."> as <".fname.">") + exe "silent keepjumps bot 1new ".a:fname + setlocal bh=delete +" call Decho("exe w! ".fname) + exe "w! ".fname + q + endif +" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten)) + + " set up redirection + if &srr =~ "%s" + let redir= substitute(&srr,"%s","/dev/null","") + else + let redir= &srr . "/dev/null" + endif +" call Decho("redir{".redir."} srr{".&srr."}") + + " execute the file handler + if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-' +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") + let ret= netrwFileHandlers#Invoke(exten,fname) + + elseif exists("g:netrw_browsex_viewer") && executable(g:netrw_browsex_viewer) +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") +" call Decho("exe silent !".g:netrw_browsex_viewer." '".escape(fname,'%#')."' ".redir) + exe "silent !".g:netrw_browsex_viewer." '".escape(fname,'%#')."'".redir + let ret= v:shell_error + + elseif has("win32") || has("win64") +" call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"') + exe 'silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"' + call inputsave()|call input("Press <cr> to continue")|call inputrestore() + let ret= v:shell_error + + elseif has("unix") && executable("gnome-open") && !s:haskdeinit +" call Decho("exe silent !gnome-open '".escape(fname,'%#')."' ".redir) + exe "silent !gnome-open '".escape(fname,'%#')."'".redir + let ret= v:shell_error + + elseif has("unix") && executable("kfmclient") && s:haskdeinit +" call Decho("exe silent !kfmclient exec '".escape(fname,'%#')."' ".redir) + exe "silent !kfmclient exec '".escape(fname,'%#')."' ".redir + let ret= v:shell_error + + else + " netrwFileHandlers#Invoke() always returns 0 + let ret= netrwFileHandlers#Invoke(exten,fname) + endif + + " if unsuccessful, attempt netrwFileHandlers#Invoke() + if ret + let ret= netrwFileHandlers#Invoke(exten,fname) + endif + + redraw! + + " cleanup: remove temporary file, + " delete current buffer if success with handler, + " return to prior buffer (directory listing) + if a:remote == 1 && fname != a:fname +" call Decho("deleting temporary file<".fname.">") + call s:System("delete",fname) + endif + + if a:remote == 1 + setlocal bh=delete bt=nofile + if g:netrw_use_noswf + setlocal noswf + endif + exe "norm! \<c-o>" + redraw! + endif + +" call Dret("NetBrowseX") +endfun + +" --------------------------------------------------------------------- +" NetBrowseFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2 +" This function assumes that a long listing will be received. Size, time, +" and reverse sorts will be requested of the server but not otherwise +" enforced here. +fun! s:NetBrowseFtpCmd(path,listcmd) +" call Dfunc("NetBrowseFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) netrw_method=".w:netrw_method) +" call Decho("line($)=".line("$")." bannercnt=".w:netrw_bannercnt) + + " because WinXX ftp uses unix style input + let ffkeep= &ff + setlocal ma ff=unix noro + + " clear off any older non-banner lines + " note that w:netrw_bannercnt indexes the line after the banner +" call Decho('exe silent! keepjumps '.w:netrw_bannercnt.",$d (clear off old non-banner lines)") + exe "silent! keepjumps ".w:netrw_bannercnt.",$d" + + "......................................... + if w:netrw_method == 2 || w:netrw_method == 5 + " ftp + <.netrc>: Method #2 + if a:path != "" + put ='cd \"'.a:path.'\"' + endif + if exists("g:netrw_ftpextracmd") + exe "put ='".g:netrw_ftpextracmd."'" +" call Decho("filter input: ".getline(".")) + endif + exe "put ='".a:listcmd."'" +" exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("exe ".g:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) + exe g:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port + else +" call Decho("exe ".g:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine) + exe g:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine + endif + + "......................................... + elseif w:netrw_method == 3 + " ftp + machine,id,passwd,filename: Method #3 + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port + else + put ='open '.g:netrw_machine + endif + + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + put =g:netrw_uid + put ='\"'.g:netrw_passwd.'\"' + else + put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"' + endif + + if a:path != "" + put ='cd \"'.a:path.'\"' + endif + if exists("g:netrw_ftpextracmd") + exe "put ='".g:netrw_ftpextracmd."'" +" call Decho("filter input: ".getline(".")) + endif + exe "put ='".a:listcmd."'" + + " perform ftp: + " -i : turns off interactive prompting from ftp + " -n unix : DON'T use <.netrc>, even though it exists + " -n win32: quit being obnoxious about password +" exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' +" call Decho("exe ".g:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i -n") + exe g:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i -n" + + "......................................... + else + call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",23) + endif + + " cleanup for Windows + if has("win32") || has("win95") || has("win64") || has("win16") + silent! keepjumps %s/\r$//e + endif + if a:listcmd == "dir" + " infer directory/link based on the file permission string + silent! keepjumps g/d\%([-r][-w][-x]\)\{3}/s@$@/@ + silent! keepjumps g/l\%([-r][-w][-x]\)\{3}/s/$/@/ + if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST + exe "silent! keepjumps ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e' + endif + endif + + " ftp's listing doesn't seem to include ./ or ../ + if !search('^\.\/$\|\s\.\/$','wn') + exe 'keepjumps '.w:netrw_bannercnt + put ='./' + endif + if !search('^\.\.\/$\|\s\.\.\/$','wn') + exe 'keepjumps '.w:netrw_bannercnt + put ='../' + endif + + " restore settings + let &ff= ffkeep +" call Dret("NetBrowseFtpCmd") +endfun + +" --------------------------------------------------------------------- +" NetListHide: uses [range]g~...~d to delete files that match comma {{{2 +" separated patterns given in g:netrw_list_hide +fun! s:NetListHide() +" call Dfunc("NetListHide() hide=".g:netrw_hide." listhide<".g:netrw_list_hide.">") + + " find a character not in the "hide" string to use as a separator for :g and :v commands + " How-it-works: take the hiding command, convert it into a range. Duplicate + " characters don't matter. Remove all such characters from the '/~...90' + " string. Use the first character left as a separator character. + let listhide= g:netrw_list_hide + let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1) +" call Decho("sep=".sep) + + while listhide != "" + if listhide =~ ',' + let hide = substitute(listhide,',.*$','','e') + let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e') + else + let hide = listhide + let listhide= "" + endif + + " Prune the list by hiding any files which match + if g:netrw_hide == 1 +" call Decho("hiding<".hide."> listhide<".listhide.">") + exe 'silent keepjumps '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' + elseif g:netrw_hide == 2 +" call Decho("showing<".hide."> listhide<".listhide.">") + exe 'silent keepjumps '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' + endif + endwhile + if g:netrw_hide == 2 + exe 'silent keepjumps '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' + exe 'silent keepjumps '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' + endif + +" call Dret("NetListHide") +endfun + +" --------------------------------------------------------------------- +" NetHideEdit: allows user to edit the file/directory hiding list +fun! s:NetHideEdit(islocal) +" call Dfunc("NetHideEdit(islocal=".a:islocal.")") + + " save current cursor position + let s:nhe_curpos= getpos(".") + + " get new hiding list from user + call inputsave() + let newhide= input("Edit Hiding List: ",g:netrw_list_hide) + call inputrestore() + let g:netrw_list_hide= newhide +" call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">") + + " refresh the listing + silent call s:NetRefresh(a:islocal,s:NetBrowseChgDir(a:islocal,"./")) + + " restore cursor position + call setpos('.',s:nhe_curpos) + unlet s:nhe_curpos + +" call Dret("NetHideEdit") +endfun + +" --------------------------------------------------------------------- +" NetSortSequence: allows user to edit the sorting sequence +fun! s:NetSortSequence(islocal) +" call Dfunc("NetSortSequence(islocal=".a:islocal.")") + + call inputsave() + let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) + call inputrestore() + + " refresh the listing + let g:netrw_sort_sequence= newsortseq + call netrw#NetSavePosn() + call s:NetRefresh(a:islocal,s:NetBrowseChgDir(a:islocal,'./')) + +" call Dret("NetSortSequence") +endfun + +" --------------------------------------------------------------------- +" NetListStyle: {{{2 +" islocal=0: remote browsing +" =1: local browsing +fun! s:NetListStyle(islocal) +" call Dfunc("NetListStyle(islocal=".a:islocal.") w:netrw_liststyle=".w:netrw_liststyle) + let fname = s:NetGetWord() + if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif + let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST +" call Decho("fname<".fname.">") +" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle) +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">") + + if w:netrw_liststyle == s:THINLIST + " use one column listing +" call Decho("use one column list") + let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') + + elseif w:netrw_liststyle == s:LONGLIST + " use long list +" call Decho("use long list") + let g:netrw_list_cmd = g:netrw_list_cmd." -l" + + elseif w:netrw_liststyle == s:WIDELIST + " give wide list +" call Decho("use wide list") + let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') + + elseif w:netrw_liststyle == s:TREELIST +" call Decho("use tree list") + let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') + + else + call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46) + let g:netrw_liststyle = s:THINLIST + let w:netrw_liststyle = g:netrw_liststyle + let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') + endif + setlocal ma noro + + " clear buffer - this will cause NetBrowse/LocalBrowseCheck to do a refresh +" call Decho("clear buffer<".expand("%")."> with :%d") + %d + + " refresh the listing + call netrw#NetSavePosn() + call s:NetRefresh(a:islocal,s:NetBrowseChgDir(a:islocal,'./')) + + " keep cursor on the filename + silent keepjumps $ + let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') +" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) + if result <= 0 && exists("w:netrw_bannercnt") + exe w:netrw_bannercnt + endif + +" call Dret("NetListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : "")) +endfun + +" --------------------------------------------------------------------- +" NetWideListing: {{{2 +fun! s:NetWideListing() + + if w:netrw_liststyle == s:WIDELIST +" call Dfunc("NetWideListing() w:netrw_liststyle=".w:netrw_liststyle.' fo='.&fo.' l:fo='.&l:fo) + " look for longest filename (cpf=characters per filename) + " cpf: characters per file + " fpl: files per line + " fpc: files per column + setlocal ma noro + let b:netrw_cpf= 0 + if line("$") >= w:netrw_bannercnt + exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' + else +" call Dret("NetWideListing") + return + endif +" call Decho("max file strlen+1=".b:netrw_cpf) + let b:netrw_cpf= b:netrw_cpf + 1 + + " determine qty files per line (fpl) + let w:netrw_fpl= winwidth(0)/b:netrw_cpf + if w:netrw_fpl <= 0 + let w:netrw_fpl= 1 + endif +" call Decho("fpl= ".winwidth(0)."/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl) + + " make wide display + exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/' + let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl + let newcolstart = w:netrw_bannercnt + fpc + let newcolend = newcolstart + fpc - 1 +" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]") + silent! let keepregstar = @* + while line("$") >= newcolstart + if newcolend > line("$") | let newcolend= line("$") | endif + let newcolqty= newcolend - newcolstart + exe newcolstart + if newcolqty == 0 + exe "silent keepjumps norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p" + else + exe "silent keepjumps norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p' + endif + exe "silent keepjumps ".newcolstart.','.newcolend.'d' + exe 'silent keepjumps '.w:netrw_bannercnt + endwhile + silent! let @*= keepregstar + exe "silent keepjumps ".w:netrw_bannercnt.',$s/\s\+$//e' + setlocal noma nomod ro +" call Dret("NetWideListing") + endif + +endfun + +" --------------------------------------------------------------------- +" NetTreeDir: determine tree directory given current cursor position {{{2 +" (full path directory with trailing slash returned) +fun! s:NetTreeDir() +" call Dfunc("NetTreeDir() curline#".line(".")."<".getline(".")."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")) + + let treedir= b:netrw_curdir +" call Decho("set initial treedir<".treedir.">") + let s:treecurpos= getpos(".") + + if w:netrw_liststyle == s:TREELIST +" call Decho("w:netrrw_liststyle is TREELIST:") +" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") + if getline('.') =~ '/$' + let treedir= substitute(getline('.'),'^\%(| \)*\([^|].\{-}\)$','\1','e') + else + let treedir= "" + endif + +" call Decho("treedir<".treedir.">") + + " detect user attempting to close treeroot + if getline('.') !~ '|' && getline('.') != '..' +" call Decho("user attempted to close treeroot") + " now force a refresh +" call Decho("clear buffer<".expand("%")."> with :%d") + keepjumps %d +" call Dret("NetTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") + return b:netrw_curdir + endif + + " elide all non-depth information + let depth = substitute(getline('.'),'^\(\%(| \)*\)[^|].\{-}$','\1','e') +" call Decho("depth<".depth."> 1st subst") + + " elide first depth + let depth = substitute(depth,'^| ','','') +" call Decho("depth<".depth."> 2nd subst") + + " construct treedir by searching backwards at correct depth +" call Decho("constructing treedir<".treedir."> depth<".depth.">") + while depth != "" && search('^'.depth.'[^|].\{-}/$','bW') + let dirname= substitute(getline("."),'^\(| \)*','','e') + let treedir= dirname.treedir + let depth = substitute(depth,'^| ','','') +" call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">") + endwhile + if w:netrw_treetop =~ '/$' + let treedir= w:netrw_treetop.treedir + else + let treedir= w:netrw_treetop.'/'.treedir + endif +" call Decho("bufnr(.)=".bufnr(".")." line($)=".line("$")." line(.)=".line(".")) + endif + let treedir= substitute(treedir,'//$','/','') + +" " now force a refresh +" call Decho("clear buffer<".expand("%")."> with :%d") +" setlocal ma noro +" keepjumps %d + +" call Dret("NetTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") + return treedir +endfun + +" --------------------------------------------------------------------- +" NetTreeDisplay: recursive tree display {{{2 +fun! s:NetTreeDisplay(dir,depth) +" call Dfunc("NetTreeDisplay(dir<".a:dir."> depth<".a:depth.">)") + + " insure that there are no folds + setlocal nofen + + " install ../ and shortdir + if a:depth == "" + call setline(line("$")+1,'../') +" call Decho("setline#".line("$")." ../ (depth is zero)") + endif + if a:dir =~ '^\a\+://' + if a:dir == w:netrw_treetop + let shortdir= a:dir + else + let shortdir= substitute(a:dir,'^.*/\([^/]\+\)/$','\1/','e') + endif + call setline(line("$")+1,a:depth.shortdir) + else + let shortdir= substitute(a:dir,'^.*/','','e') + call setline(line("$")+1,a:depth.shortdir.'/') + endif +" call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">") + + " append a / to dir if its missing one + let dir= a:dir + if dir !~ '/$' + let dir= dir.'/' + endif + + " display subtrees (if any) + let depth= "| ".a:depth +" call Decho("display subtrees with depth<".depth."> and current leaves") + for entry in w:netrw_treedict[a:dir] + let direntry= substitute(dir.entry,'/$','','e') +" call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">") + if entry =~ '/$' && has_key(w:netrw_treedict,direntry) +" call Decho("<".direntry."> is a key in treedict - display subtree for it") + call s:NetTreeDisplay(direntry,depth) + elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') +" call Decho("<".direntry."/> is a key in treedict - display subtree for it") + call s:NetTreeDisplay(direntry.'/',depth) + else +" call Decho("<".entry."> is not a key in treedict (no subtree)") + call setline(line("$")+1,depth.entry) + endif + endfor +" call Dret("NetTreeDisplay") +endfun + +" --------------------------------------------------------------------- +" NetTreeListing: displays tree listing from treetop on down, using NetTreeDisplay() {{{2 +fun! s:NetTreeListing(dirname) + if w:netrw_liststyle == s:TREELIST +" call Dfunc("NetTreeListing() bufname<".expand("%").">") +" call Decho("curdir<".a:dirname.">") + + " update the treetop +" call Decho("update the treetop") + if !exists("w:netrw_treetop") + let w:netrw_treetop= a:dirname +" call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)") + elseif (w:netrw_treetop =~ ('^'.a:dirname) && strlen(a:dirname) < strlen(w:netrw_treetop)) || a:dirname !~ ('^'.w:netrw_treetop) + let w:netrw_treetop= a:dirname +" call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)") + endif + + " insure that we have at least an empty treedict + if !exists("w:netrw_treedict") + let w:netrw_treedict= {} + endif + + " update the directory listing for the current directory +" call Decho("updating dictionary with ".a:dirname.":[..directory listing..]") +" call Decho("bannercnt=".w:netrw_bannercnt." line($)=".line("$")) + exe "silent! keepjumps ".w:netrw_bannercnt.',$g@^\.\.\=/$@d' + let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$")) +" call Decho("treedict=".string(w:netrw_treedict)) + exe "silent! keepjumps ".w:netrw_bannercnt.",$d" + + " if past banner, record word + if exists("w:netrw_bannercnt") && line(".") > w:netrw_bannercnt + let fname= expand("<cword>") + else + let fname= "" + endif + + " display from treetop on down + call s:NetTreeDisplay(w:netrw_treetop,"") + + " place cursor + if !exists("s:nbcd_curpos") + if fname != "" +" call Decho("(NetTreeListing) place cursor <".fname.">") + call search('\<'.fname.'\>','cw') + elseif exists("w:netrw_bannercnt") + exe (w:netrw_bannercnt+1) +" call Decho("(NetTreeListing) place cursor line#".(w:netrw_bannercnt+1)) + endif + endif + +" call Dret("NetTreeListing : bufname<".expand("%").">") + endif +endfun + +" --------------------------------------------------------------------- +" NetSaveWordPosn: used by the "s" command in both remote and local {{{2 +" browsing. Along with NetRestoreWordPosn(), it keeps the cursor on +" the same word even though the sorting has changed its order of appearance. +fun! s:NetSaveWordPosn() +" call Dfunc("NetSaveWordPosn()") + let s:netrw_saveword= '^'.escape(getline("."),s:netrw_cd_escape).'$' +" call Dret("NetSaveWordPosn : saveword<".s:netrw_saveword.">") +endfun + +" --------------------------------------------------------------------- +" NetRestoreWordPosn: used by the "s" command; see NetSaveWordPosn() above {{{2 +fun! s:NetRestoreWordPosn() +" call Dfunc("NetRestoreWordPosn()") + silent! call search(s:netrw_saveword,'w') +" call Dret("NetRestoreWordPosn") +endfun + +" --------------------------------------------------------------------- +" NetMakeDir: this function makes a directory (both local and remote) {{{2 +fun! s:NetMakeDir(usrhost) +" call Dfunc("NetMakeDir(usrhost<".a:usrhost.">)") + + " get name of new directory from user. A bare <CR> will skip. + " if its currently a directory, also request will be skipped, but with + " a message. + call inputsave() + let newdirname= input("Please give directory name: ") + call inputrestore() +" call Decho("newdirname<".newdirname.">") + + if newdirname == "" +" call Dret("NetMakeDir : user aborted with bare <cr>") + return + endif + + if a:usrhost == "" + + " Local mkdir: + " sanity checks + let fullnewdir= b:netrw_curdir.'/'.newdirname +" call Decho("fullnewdir<".fullnewdir.">") + if isdirectory(fullnewdir) + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) + endif +" call Dret("NetMakeDir : directory<".newdirname."> exists previously") + return + endif + if s:FileReadable(fullnewdir) + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25) + endif +" call Dret("NetMakeDir : file<".newdirname."> exists previously") + return + endif + + " requested new local directory is neither a pre-existing file or + " directory, so make it! + if exists("*mkdir") + call mkdir(fullnewdir,"p") + else + let netrw_origdir= s:NetGetcwd(1) + exe 'keepjumps cd '.b:netrw_curdir +" call Decho("netrw_origdir<".netrw_origdir.">: cd b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("exe silent! !".g:netrw_local_mkdir.' '.g:netrw_shq.newdirname.g:netrw_shq) + exe "silent! !".g:netrw_local_mkdir.' '.g:netrw_shq.newdirname.g:netrw_shq + if !g:netrw_keepdir | exe 'keepjumps cd '.netrw_origdir | endif + if !g:netrw_keepdir + exe 'keepjumps cd '.netrw_origdir +" call Decho("netrw_keepdir=".g:netrw_keepdir.": cd ".netrw_origdir) + endif + endif + + if v:shell_error == 0 + " refresh listing +" call Decho("refresh listing") + call netrw#NetSavePosn() + call s:NetRefresh(1,s:NetBrowseChgDir(1,'./')) + elseif !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",26) + endif + redraw! + + else + " Remote mkdir: + let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd) + let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname +" call Decho("exe silent! !".mkdircmd." ".g:netrw_shq.newdirname.g:netrw_shq) + exe "silent! !".mkdircmd." ".g:netrw_shq.newdirname.g:netrw_shq + if v:shell_error == 0 + " refresh listing + call netrw#NetSavePosn() + call s:NetRefresh(0,s:NetBrowseChgDir(0,'./')) + elseif !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27) + endif + redraw! + endif + +" call Dret("NetMakeDir") +endfun + +" --------------------------------------------------------------------- +" NetBookmarkDir: {{{2 +" 0: (user: <b>) bookmark current directory +" 1: (user: <B>) change to the bookmarked directory +" 2: (user: <q>) list bookmarks +" 3: (browsing) record current directory history +" 4: (user: <u>) go up (previous) bookmark +" 5: (user: <U>) go down (next) bookmark +fun! s:NetBookmarkDir(chg,curdir) +" call Dfunc("NetBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." bookmarkcnt=".g:NETRW_BOOKMARKMAX." histcnt=".g:NETRW_DIRHIST_CNT." bookmax=".g:NETRW_BOOKMARKMAX." histmax=".g:netrw_dirhistmax) + + if a:chg == 0 + " bookmark the current directory +" call Decho("(user: <b>) bookmark the current directory") + if v:count > 0 + " handle bookmark# specified via the count + let g:NETRW_BOOKMARKDIR_{v:count}= a:curdir + if !exists("g:NETRW_BOOKMARKMAX") + let g:NETRW_BOOKMARKMAX= v:count + elseif v:count > g:NETRW_BOOKMARKMAX + let g:NETRW_BOOKMARKMAX= v:count + endif + else + " handle no count specified + let g:NETRW_BOOKMARKMAX = g:NETRW_BOOKMARKMAX + 1 + let g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX} = a:curdir + endif + echo "bookmarked the current directory" + + elseif a:chg == 1 + " change to the bookmarked directory +" call Decho("(user: <B>) change to the bookmarked directory") + if exists("g:NETRW_BOOKMARKDIR_{v:count}") + exe "e ".g:NETRW_BOOKMARKDIR_{v:count} + else + echomsg "Sorry, bookmark#".v:count." doesn't exist!" + endif + + elseif a:chg == 2 + redraw! + let didwork= 0 + " list user's bookmarks +" call Decho("(user: <q>) list user's bookmarks") + if exists("g:NETRW_BOOKMARKMAX") +" call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]") + let cnt= 0 + while cnt <= g:NETRW_BOOKMARKMAX + if exists("g:NETRW_BOOKMARKDIR_{cnt}") +" call Decho("Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt}) + echo "Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt} + let didwork= 1 + endif + let cnt= cnt + 1 + endwhile + endif + + " list directory history + let cnt = g:NETRW_DIRHIST_CNT + let first = 1 + let histcnt = 0 + while ( first || cnt != g:NETRW_DIRHIST_CNT ) +" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:NETRW_DIRHIST_CNT) + let histcnt= histcnt + 1 + if exists("g:NETRW_DIRHIST_{cnt}") +" call Decho("Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt}) + echo "Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt} + let didwork= 1 + endif + let first = 0 + let cnt = ( cnt - 1 ) % g:netrw_dirhistmax + if cnt < 0 + let cnt= cnt + g:netrw_dirhistmax + endif + endwhile + if didwork + call inputsave()|call input("Press <cr> to continue")|call inputrestore() + endif + + elseif a:chg == 3 + " saves most recently visited directories (when they differ) +" call Decho("(browsing) record curdir history") + if !exists("g:NETRW_DIRHIST_0") || g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} != a:curdir + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax +" let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= substitute(a:curdir,'[/\\]$','','e') + let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= a:curdir +" call Decho("save dirhist#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") + endif + + elseif a:chg == 4 + " u: change to the previous directory stored on the history list +" call Decho("(user: <u>) chg to prev dir from history") + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax + if g:NETRW_DIRHIST_CNT < 0 + let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax + endif + if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}") +" call Decho("changedir u#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") + setlocal ma noro + %d + setlocal nomod + endif +" call Decho("exe e! ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}) + exe "e! ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} + else + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax + echo "Sorry, no predecessor directory exists yet" + endif + + elseif a:chg == 5 + " U: change to the subsequent directory stored on the history list +" call Decho("(user: <U>) chg to next dir from history") + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax + if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}") +" call Decho("changedir U#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") + setlocal ma noro + %d + setlocal nomod + endif +" call Decho("exe e! ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}) + exe "e! ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} + else + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax + if g:NETRW_DIRHIST_CNT < 0 + let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax + endif + echo "Sorry, no successor directory exists yet" + endif + endif + call s:NetBookmarkMenu() +" call Dret("NetBookmarkDir") +endfun + +" --------------------------------------------------------------------- +" NetBookmarkMenu: {{{2 +fun! s:NetBookmarkMenu() + if !exists("s:netrw_menucnt") + return + endif +" call Dfunc("NetBookmarkMenu() bookmarkcnt=".g:NETRW_BOOKMARKMAX." histcnt=".g:NETRW_DIRHIST_CNT." menucnt=".s:netrw_menucnt) + if has("menu") && has("gui_running") && &go =~ 'm' + if exists("g:NetrwTopLvlMenu") + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmark' + endif + + " show bookmarked places + let cnt = 0 + while cnt <= g:NETRW_BOOKMARKMAX + if exists("g:NETRW_BOOKMARKDIR_{cnt}") + let bmdir= escape(g:NETRW_BOOKMARKDIR_{cnt},'.') +" call Decho('silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmdir.' :e '.g:NETRW_BOOKMARKDIR_{cnt}) + exe 'silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmdir.' :e '.g:NETRW_BOOKMARKDIR_{cnt}."\<cr>" + endif + let cnt= cnt + 1 + endwhile + + " show directory browsing history + let cnt = g:NETRW_DIRHIST_CNT + let first = 1 + let histcnt = 0 + while ( first || cnt != g:NETRW_DIRHIST_CNT ) + let histcnt = histcnt + 1 + let priority = g:NETRW_DIRHIST_CNT + histcnt + if exists("g:NETRW_DIRHIST_{cnt}") + let bmdir= escape(g:NETRW_DIRHIST_{cnt},'.') +" call Decho('silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.bmdir.' :e '.g:NETRW_DIRHIST_{cnt}) + exe 'silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.bmdir.' :e '.g:NETRW_DIRHIST_{cnt}."\<cr>" + endif + let first = 0 + let cnt = ( cnt - 1 ) % g:netrw_dirhistmax + if cnt < 0 + let cnt= cnt + g:netrw_dirhistmax + endif + endwhile + endif +" call Dret("NetBookmarkMenu") +endfun + +" --------------------------------------------------------------------- +" NetObtain: obtain file under cursor (for remote browsing support) {{{2 +fun! netrw#NetObtain(vismode,...) range +" call Dfunc("NetObtain(vismode=".a:vismode.") a:0=".a:0) + + if a:vismode == 0 + " normal mode + let fname= expand("<cWORD>") +" call Decho("no arguments, use <".fname.">") + elseif a:vismode == 1 + " visual mode + let keeprega = @a + norm! gv"ay + if g:netrw_liststyle == s:THINLIST + " thin listing + let filelist= split(@a,'\n') + elseif g:netrw_liststyle == s:LONGLIST + " long listing + let filelist= split(substitute(@a,'\t.\{-}\n','\n','g'),'\n') + else + " wide listing + let filelist = split(substitute(@a,'\s\{2,}','\n','g'),'\n') + let filelist = map(filelist,'substitute(v:val,"^\\s\\+","","")') + let filelist = map(filelist,'substitute(v:val,"\\s\\+$","","")') + endif +" call Decho("filelist<".string(filelist).">") + let @a= keeprega + for f in filelist + if f != "" + call netrw#NetObtain(2,f) + endif + endfor +" call Dret("NetObtain : visual mode handler") + return + elseif a:vismode == 2 + " multiple file mode + let fname= a:1 +" call Decho("visual mode handling: <".fname.">") + endif + + " NetrwStatusLine support - for obtaining support + call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.fname) + + if exists("w:netrw_method") && w:netrw_method =~ '[235]' +" call Decho("method=".w:netrw_method) + if executable("ftp") +" call Decho("ftp is executable, method=".w:netrw_method) + let curdir = b:netrw_curdir + let path = substitute(curdir,'ftp://[^/]\+/','','e') + let curline= line(".") + let endline= line("$")+1 + setlocal ma noro + keepjumps $ +" call Decho("getcwd<".getcwd().">") +" call Decho("curdir<".curdir.">") +" call Decho("path<".path.">") +" call Decho("curline=".curline) +" call Decho("endline=".endline) + + "......................................... + if w:netrw_method == 2 + " ftp + <.netrc>: Method #2 + setlocal ff=unix + if path != "" + put ='cd '.path +" call Decho("ftp: cd ".path) + endif + put ='get '.fname +" call Decho("ftp: get ".fname) + put ='quit' +" call Decho("ftp: quit") + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) + exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port + else +" call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine) + exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine + endif + + "......................................... + elseif w:netrw_method == 3 + " ftp + machine,id,passwd,filename: Method #3 + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho('ftp: open '.g:netrw_machine.' '.g:netrw_port) + else + put ='open '.g:netrw_machine +" call Decho('ftp: open '.g:netrw_machine) + endif + + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + put =g:netrw_uid + put ='\"'.g:netrw_passwd.'\"' +" call Decho('ftp: g:netrw_uid') +" call Decho('ftp: g:netrw_passwd') + else + put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"' +" call Decho('user '.g:netrw_uid.' '.g:netrw_passwd) + endif + + if path != "" + put ='cd '.path +" call Decho('cd '.a:path) + endif + put ='get '.fname +" call Decho("ftp: get ".fname) + put ='quit' +" call Decho("ftp: quit") + + " perform ftp: + " -i : turns off interactive prompting from ftp + " -n unix : DON'T use <.netrc>, even though it exists + " -n win32: quit being obnoxious about password +" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n") + exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i -n" + + "......................................... + else + call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",28) + endif + " restore + exe "silent! ".endline.",$d" + exe "keepjumps ".curline + setlocal noma nomod ro + else +" call Decho("ftp not executable") + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"this system doesn't support ftp",29) + endif + " restore status line + let &stl = s:netrw_users_stl + let &laststatus = s:netrw_users_ls + " restore NetMethod + if exists("keep_netrw_method") + call s:NetMethod(keep_netrw_choice) + let w:netrw_method = keep_netrw_wmethod + endif +" call Dret("NetObtain") + return + endif + + "......................................... + else + " scp: Method#4 +" call Decho("using scp") + let curdir = b:netrw_curdir + let path = substitute(curdir,'scp://[^/]\+/','','e') +" call Decho("path<".path.">") + if exists("g:netrw_port") && g:netrw_port != "" + let useport= " -P ".g:netrw_port + else + let useport= "" + endif +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." .") + exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." ." + endif + endif + + " restore status line + let &stl = s:netrw_users_stl + let &laststatus = s:netrw_users_ls + redraw! + + " restore NetMethod + if exists("keep_netrw_method") + call s:NetMethod(keep_netrw_choice) + let w:netrw_method = keep_netrw_wmethod + endif + +" call Dret("NetObtain") +endfun + +" --------------------------------------------------------------------- +" NetPrevWinOpen: open file/directory in previous window. {{{2 +" If there's only one window, then the window will first be split. +fun! s:NetPrevWinOpen(islocal) +" call Dfunc("NetPrevWinOpen(islocal=".a:islocal.")") + + " get last window number and the word currently under the cursor + let lastwinnr = winnr("$") + let curword = s:NetGetWord() +" call Decho("lastwinnr=".lastwinnr." curword<".curword.">") + + let didsplit = 0 + if lastwinnr == 1 + " if only one window, open a new one first +" call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")") + exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" + let didsplit = 1 + + else + wincmd p + " if the previous window's buffer has been changed (is modified), + " and it doesn't appear in any other extant window, then ask the + " user if s/he wants to abandon modifications therein. + let bnr = winbufnr(0) + let bnrcnt = 0 + if &mod + windo if winbufnr(0) == bnr | let bnrcnt=bnrcnt+1 | endif +" call Decho("bnr=".bnr." bnrcnt=".bnrcnt) + if bnrcnt == 1 + let bufname= bufname(winbufnr(winnr())) + let choice= confirm("Save modified file<".bufname.">?","&Yes\n&No\n&Cancel") + + if choice == 1 + " Yes -- write file & then browse + let v:errmsg= "" + silent w + if v:errmsg != "" + call netrw#ErrorMsg(s:ERROR,"unable to write <".bufname.">!",30) + if didsplit + q + else + wincmd p + endif +" call Dret("NetPrevWinOpen : unable to write <".bufname.">") + return + endif + + elseif choice == 2 + " No -- don't worry about changed file, just browse anyway + setlocal nomod + call netrw#ErrorMsg(s:WARNING,bufname." changes abandoned",31) + + else + " Cancel -- don't do this + if didsplit + q + else + wincmd p + endif +" call Dret("NetPrevWinOpen : cancelled") + return + endif + endif + endif + endif + + if a:islocal + call netrw#LocalBrowseCheck(s:NetBrowseChgDir(a:islocal,curword)) + else + call s:NetBrowse(a:islocal,s:NetBrowseChgDir(a:islocal,curword)) + endif +" call Dret("NetPrevWinOpen") +endfun + +" --------------------------------------------------------------------- +" NetMenu: generates the menu for gvim and netrw {{{2 +fun! s:NetMenu(domenu) + + if !exists("g:NetrwMenuPriority") + let g:NetrwMenuPriority= 80 + endif + + if has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu +" call Dfunc("NetMenu(domenu=".a:domenu.")") + + if !exists("s:netrw_menu_enabled") && a:domenu +" call Decho("initialize menu") + let s:netrw_menu_enabled= 1 + exe 'silent! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>' + call s:NetBookmarkMenu() " provide some history! + exe 'silent! menu '.g:NetrwMenuPriority.'.4 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory<tab>- -' + exe 'silent! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer<tab>x x' + exe 'silent! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Bookmark\ Current\ Directory<tab>mb mb' + exe 'silent! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Goto\ Bookmarked\ Directory<tab>gb gb' + exe 'silent! menu '.g:NetrwMenuPriority.'.8 '.g:NetrwTopLvlMenu.'Change\ To\ Recently\ Used\ Directory<tab>u u' + exe 'silent! menu '.g:NetrwMenuPriority.'.9 '.g:NetrwTopLvlMenu.'Change\ To\ Subsequently\ Used\ Directory<tab>U U' + exe 'silent! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/Directory<tab>D D' + exe 'silent! menu '.g:NetrwMenuPriority.'.11 '.g:NetrwTopLvlMenu.'Edit\ File\ Hiding\ List<tab>'."<ctrl-h> \<c-h>" + exe 'silent! menu '.g:NetrwMenuPriority.'.12 '.g:NetrwTopLvlMenu.'Edit\ File/Directory<tab><cr> '."\<cr>" + exe 'silent! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Window<tab>o o' + exe 'silent! menu '.g:NetrwMenuPriority.'.14 '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Vertical\ Window<tab>v v' + exe 'silent! menu '.g:NetrwMenuPriority.'.15 '.g:NetrwTopLvlMenu.'List\ Bookmarks\ and\ History<tab>q q' + exe 'silent! menu '.g:NetrwMenuPriority.'.16 '.g:NetrwTopLvlMenu.'Listing\ Style\ (thin-long-wide)<tab>i i' + exe 'silent! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Make\ Subdirectory<tab>d d' + exe 'silent! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Normal-Hide-Show<tab>a a' + exe 'silent! menu '.g:NetrwMenuPriority.'.19 '.g:NetrwTopLvlMenu.'Obtain\ File<tab>O O' + exe 'silent! menu '.g:NetrwMenuPriority.'.20 '.g:NetrwTopLvlMenu.'Preview\ File/Directory<tab>p p' + exe 'silent! menu '.g:NetrwMenuPriority.'.21 '.g:NetrwTopLvlMenu.'Previous\ Window\ Browser<tab>P P' + exe 'silent! menu '.g:NetrwMenuPriority.'.22 '.g:NetrwTopLvlMenu.'Refresh\ Listing<tab>'."<ctrl-l> \<c-l>" + exe 'silent! menu '.g:NetrwMenuPriority.'.23 '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R' + exe 'silent! menu '.g:NetrwMenuPriority.'.24 '.g:NetrwTopLvlMenu.'Reverse\ Sorting\ Order<tab>'."r r" + exe 'silent! menu '.g:NetrwMenuPriority.'.25 '.g:NetrwTopLvlMenu.'Select\ Sorting\ Style<tab>s s' + exe 'silent! menu '.g:NetrwMenuPriority.'.26 '.g:NetrwTopLvlMenu.'Sorting\ Sequence\ Edit<tab>S S' + exe 'silent! menu '.g:NetrwMenuPriority.'.27 '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c c' + exe 'silent! menu '.g:NetrwMenuPriority.'.28 '.g:NetrwTopLvlMenu.'Settings/Options<tab>:NetrwSettings '.":NetrwSettings\<cr>" + let s:netrw_menucnt= 28 + + elseif !a:domenu + let s:netrwcnt = 0 + let curwin = winnr() + windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif + exe curwin."wincmd w" + + if s:netrwcnt <= 1 +" call Decho("clear menus") + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Help' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmark\ Current\ Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Go\ Up\ Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Goto\ Bookmarked\ Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Change\ To\ Recently\ Used\ Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Change\ To\ Subsequently\ Used\ Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Delete\ File/Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File/Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Window' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Vertical\ Window' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File\ Hiding\ List' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Enter\ File/Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Enter\ File/Directory\ (vertical\ split)' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'List\ Bookmarks\ and\ History' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Listing\ Style\ (thin-long-wide)' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Make\ Subdirectory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Normal-Hide-Show' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Obtain\ File' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Preview\ File/Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Previous\ Window\ Browser' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Refresh\ Listing' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Rename\ File/Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Reverse\ Sorting\ Order' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Select\ Sorting\ Style' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Sorting\ Sequence\ Edit' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Set\ Current\ Directory' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Settings/Options' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmarks' + silent! unlet s:netrw_menu_enabled + endif + endif +" call Dret("NetMenu") + endif + +endfun + +" ========================================== +" Local Directory Browsing Support: {{{1 +" ========================================== + +" --------------------------------------------------------------------- +" LocalBrowseCheck: {{{2 +fun! netrw#LocalBrowseCheck(dirname) + " unfortunate interaction -- split window debugging can't be +" " used here, must use DechoRemOn or DechoTabOn -- the BufEnter + " event triggers another call to LocalBrowseCheck() when attempts + " to write to the DBG buffer are made. +" call Dfunc("LocalBrowseCheck(dirname<".a:dirname.">") + if isdirectory(a:dirname) + silent! call s:NetBrowse(1,a:dirname) + endif +" call Dret("LocalBrowseCheck") + " not a directory, ignore it +endfun + +" --------------------------------------------------------------------- +" LocalListing: does the job of "ls" for local directories {{{2 +fun! s:LocalListing() +" call Dfunc("LocalListing() &ma=".&ma." &mod=".&mod." &ro=".&ro) +" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist") |endif +" if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist")|endif + + " get the list of files contained in the current directory + let dirname = escape(b:netrw_curdir,s:netrw_glob_escape) + let dirnamelen = strlen(b:netrw_curdir) + let filelist = glob(s:ComposePath(dirname,"*")) +" call Decho("glob(dirname<".dirname."/*>)=".filelist) + if filelist != "" + let filelist= filelist."\n" + endif + let filelist= filelist.glob(s:ComposePath(dirname,".*")) +" call Decho("glob(dirname<".dirname."/.*>)=".glob(dirname.".*")) + + " if the directory name includes a "$", and possibly other characters, + " the glob() doesn't include "." and ".." entries. + if filelist !~ '[\\/]\.[\\/]\=\(\n\|$\)' +" call Decho("forcibly tacking on .") + if filelist == "" + let filelist= s:ComposePath(dirname,"./") + else + let filelist= filelist."\n".s:ComposePath(b:netrw_curdir,"./") + endif +" call Decho("filelist<".filelist.">") + endif + if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)' +" call Decho("forcibly tacking on ..") + let filelist= filelist."\n".s:ComposePath(b:netrw_curdir,"../") +" call Decho("filelist<".filelist.">") + endif + if b:netrw_curdir == '/' + " remove .. from filelist when current directory is root directory + let filelist= substitute(filelist,'/\.\.\n','','') +" call Decho("remove .. from filelist") + endif + let filelist= substitute(filelist,'\n\{2,}','\n','ge') + if (has("win32") || has("win95") || has("win64") || has("win16")) + let filelist= substitute(filelist,'\','/','ge') + else + let filelist= substitute(filelist,'\','\\','ge') + endif + +" call Decho("dirname<".dirname.">") +" call Decho("dirnamelen<".dirnamelen.">") +" call Decho("filelist<".filelist.">") + + while filelist != "" + if filelist =~ '\n' + let filename = substitute(filelist,'\n.*$','','e') + let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e') + else + let filename = filelist + let filelist = "" + endif + let pfile= filename + if isdirectory(filename) + let pfile= filename."/" + endif + if pfile =~ '//$' + let pfile= substitute(pfile,'//$','/','e') + endif + let pfile= strpart(pfile,dirnamelen) + let pfile= substitute(pfile,'^[/\\]','','e') +" call Decho(" ") +" call Decho("filename<".filename.">") +" call Decho("pfile <".pfile.">") + + if w:netrw_liststyle == s:LONGLIST + let sz = getfsize(filename) + let fsz = strpart(" ",1,15-strlen(sz)).sz + let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) +" call Decho("sz=".sz." fsz=".fsz) + endif + + if g:netrw_sort_by =~ "^t" + " sort by time (handles time up to 1 quintillion seconds, US) +" call Decho("getftime(".filename.")=".getftime(filename)) + let t = getftime(filename) + let ft = strpart("000000000000000000",1,18-strlen(t)).t +" call Decho("exe keepjumps put ='".ft.'/'.filename."'") + let ftpfile= ft.'/'.pfile + keepjumps silent! put=ftpfile + + elseif g:netrw_sort_by =~ "^s" + " sort by size (handles file sizes up to 1 quintillion bytes, US) +" call Decho("getfsize(".filename.")=".getfsize(filename)) + let sz = getfsize(filename) + let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz +" call Decho("exe keepjumps put ='".fsz.'/'.filename."'") + let fszpfile= fsz.'/'.pfile + keepjumps silent! put =fszpfile + + else + " sort by name +" call Decho("exe keepjumps put ='".pfile."'") + keepjumps silent! put=pfile + endif + endwhile + + " cleanup any windows mess at end-of-line + silent! keepjumps %s/\r$//e + setlocal ts=32 +" call Decho("setlocal ts=32") + +" call Dret("LocalListing") +endfun + +" --------------------------------------------------------------------- +" LocalBrowseShellCmdRefresh: this function is called after a user has {{{2 +" performed any shell command. The idea is to cause all local-browsing +" buffers to be refreshed after a user has executed some shell command, +" on the chance that s/he removed/created a file/directory with it. +fun! s:LocalBrowseShellCmdRefresh() +" call Dfunc("LocalBrowseShellCmdRefresh() browselist=".string(s:netrw_browselist)) + " determine which buffers currently reside in a tab + let itab = 1 + let buftablist = [] + while itab <= tabpagenr("$") + let buftablist= buftablist + tabpagebuflist() + let itab= itab + 1 + tabn + endwhile +" call Decho("buftablist".string(buftablist)) + " GO through all buffers on netrw_browselist (ie. just local-netrw buffers): + " | refresh any netrw window + " | wipe out any non-displaying netrw buffer + let curwin = winnr() + let ibl = 0 + for ibuf in s:netrw_browselist +" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf)) + if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1 +" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">") + exe "silent! bw ".ibuf + call remove(s:netrw_browselist,ibl) +" call Decho("browselist=".string(s:netrw_browselist)) + continue + elseif index(tabpagebuflist(),ibuf) != -1 +" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) + exe bufwinnr(ibuf)."wincmd w" + call s:NetRefresh(1,s:NetBrowseChgDir(1,'./')) + endif + let ibl= ibl + 1 + endfor + exe curwin."wincmd w" + +" call Dret("LocalBrowseShellCmdRefresh") +endfun + +" --------------------------------------------------------------------- +" LocalBrowseRm: {{{2 +fun! s:LocalBrowseRm(path) range +" call Dfunc("LocalBrowseRm(path<".a:path.">)") +" call Decho("firstline=".a:firstline." lastline=".a:lastline) + + " preparation for removing multiple files/directories + let ctr = a:firstline + let ret = 0 + let all= 0 + + " remove multiple files and directories + while ctr <= a:lastline + exe "keepjumps ".ctr + + " sanity checks + if line(".") < w:netrw_bannercnt + let ctr= ctr + 1 + continue + endif + let curword= s:NetGetWord() + if curword == "./" || curword == "../" + let ctr= ctr + 1 + continue + endif + + norm! 0 + let rmfile= s:ComposePath(a:path,curword) +" call Decho("rmfile<".rmfile.">") + + if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') + " attempt to remove file + if !all + echohl Statement + call inputsave() + let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") + call inputrestore() + echohl NONE + if ok == "" + let ok="no" + endif +" call Decho("response: ok<".ok.">") + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') +" call Decho("response: ok<".ok."> (after sub)") + if ok =~ 'a\%[ll]' + let all= 1 + endif + endif + + if all || ok =~ 'y\%[es]' || ok == "" + let ret= s:System("delete",rmfile) +" call Decho("errcode=".v:shell_error." ret=".ret) + elseif ok =~ 'q\%[uit]' + break + endif + + else + " attempt to remove directory + if !all + echohl Statement + call inputsave() + let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") + call inputrestore() + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') + if ok == "" + let ok="no" + endif + if ok =~ 'a\%[ll]' + let all= 1 + endif + endif + let rmfile= substitute(rmfile,'[\/]$','','e') + + if all || ok =~ 'y\%[es]' || ok == "" +" call Decho("1st attempt: system(".g:netrw_local_rmdir.' "'.rmfile.'")') + call s:System("system",g:netrw_local_rmdir.' "'.rmfile.'"') +" call Decho("v:shell_error=".v:shell_error) + + if v:shell_error != 0 +" call Decho("2nd attempt to remove directory<".rmfile.">") + let errcode= s:System("delete",rmfile) +" call Decho("errcode=".errcode) + + if errcode != 0 + if has("unix") +" call Decho("3rd attempt to remove directory<".rmfile.">") + call s:System("system","rm ".rmfile) + if v:shell_error != 0 && !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34) +endif + elseif !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35) + endif + endif + endif + + elseif ok =~ 'q\%[uit]' + break + endif + endif + + let ctr= ctr + 1 + endwhile + + " refresh the directory + let curline= line(".") +" call Decho("refresh the directory") + call s:NetRefresh(1,s:NetBrowseChgDir(1,'./')) + exe curline + +" call Dret("LocalBrowseRm") +endfun + +" --------------------------------------------------------------------- +" LocalBrowseRename: rename a remote file or directory {{{2 +fun! s:LocalBrowseRename(path) range +" call Dfunc("LocalBrowseRename(path<".a:path.">)") + + " preparation for removing multiple files/directories + let ctr= a:firstline + + " attempt to rename files/directories + while ctr <= a:lastline + exe "keepjumps ".ctr + + " sanity checks + if line(".") < w:netrw_bannercnt + let ctr= ctr + 1 + continue + endif + let curword= s:NetGetWord() + if curword == "./" || curword == "../" + let ctr= ctr + 1 + continue + endif + + norm! 0 + let oldname= s:ComposePath(a:path,curword) +" call Decho("oldname<".oldname.">") + + call inputsave() + let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) + call inputrestore() + + let ret= rename(oldname,newname) +" call Decho("renaming <".oldname."> to <".newname.">") + + let ctr= ctr + 1 + endwhile + + " refresh the directory +" call Decho("refresh the directory listing") + call netrw#NetSavePosn() + call s:NetRefresh(1,s:NetBrowseChgDir(1,'./')) +" call Dret("LocalBrowseRename") +endfun + +" --------------------------------------------------------------------- +" LocalFastBrowser: handles setting up/taking down fast browsing for the {{{2 +" local browser +" fastbrowse Local Remote Hiding a buffer implies it may be re-used (fast) +" slow 0 D D Deleting a buffer implies it will not be re-used (slow) +" med 1 D H +" fast 2 H H +fun! s:LocalFastBrowser() +" call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse) + + " initialize browselist, a list of buffer numbers that the local browser has used + if !exists("s:netrw_browselist") +" call Decho("initialize s:netrw_browselist") + let s:netrw_browselist= [] + endif + + " append current buffer to fastbrowse list + if g:netrw_fastbrowse <= 1 && (empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1]) +" call Decho("appendng current buffer to browselist") + call add(s:netrw_browselist,bufnr("%")) +" call Decho("browselist=".string(s:netrw_browselist)) + endif + + " enable autocmd events to handle refreshing/removing local browser buffers + " If local browse buffer is currently showing: refresh it + " If local browse buffer is currently hidden : wipe it + if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1 +" call Decho("setting up local-browser shell command refresh") + let s:netrw_browser_shellcmd= 1 + augroup AuNetrwShellCmd + au! + if (has("win32") || has("win95") || has("win64") || has("win16")) + au ShellCmdPost * call s:LocalBrowseShellCmdRefresh() + else + au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh() + endif + augroup END + endif + + " user must have changed fastbrowse to its fast setting, so remove + " the associated autocmd events + if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd") +" call Decho("remove AuNetrwShellCmd autcmd group") + unlet s:netrw_browser_shellcmd + augroup AuNetrwShellCmd + au! + augroup END + augroup! AuNetrwShellCmd + endif + +" call Dret("LocalFastBrowser") +endfun + +" --------------------------------------------------------------------- +" LocalObtain: copy selected file to current working directory {{{2 +fun! s:LocalObtain() +" call Dfunc("LocalObtain()") + if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir + let fname= expand("<cWORD>") + let fcopy= readfile(b:netrw_curdir."/".fname,"b") + call writefile(fcopy,getcwd()."/".fname,"b") + elseif !exists("b:netrw_curdir") + call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36) + else + call netrw#ErrorMsg(s:ERROR,"local browsing directory and current directory are identical",37) + endif +" call Dret("LocalObtain") +endfun + +" --------------------------------------------------------------------- +" netrw#Explore: launch the local browser in the directory of the current file {{{2 +" dosplit==0: the window will be split iff the current file has +" been modified +" dosplit==1: the window will be split before running the local +" browser +fun! netrw#Explore(indx,dosplit,style,...) +" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified) + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + let curfile = b:netrw_curdir +" call Decho("curfile<".curfile.">") + + " save registers + silent! let keepregstar = @* + silent! let keepregplus = @+ + silent! let keepregslash= @/ + + " if dosplit or file has been modified + if a:dosplit || &modified || a:style == 6 +" call Decho("case: dosplit=".a:dosplit." modified=".&modified." a:style=".a:style) + call s:SaveWinVars() + + if a:style == 0 " Explore, Sexplore +" call Decho("style=0: Explore or Sexplore") + exe g:netrw_winsize."wincmd s" + + elseif a:style == 1 "Explore!, Sexplore! +" call Decho("style=1: Explore! or Sexplore!") + exe g:netrw_winsize."wincmd v" + + elseif a:style == 2 " Hexplore +" call Decho("style=2: Hexplore") + exe "bel ".g:netrw_winsize."wincmd s" + + elseif a:style == 3 " Hexplore! +" call Decho("style=3: Hexplore!") + exe "abo ".g:netrw_winsize."wincmd s" + + elseif a:style == 4 " Vexplore +" call Decho("style=4: Vexplore") + exe "lefta ".g:netrw_winsize."wincmd v" + + elseif a:style == 5 " Vexplore! +" call Decho("style=5: Vexplore!") + exe "rightb ".g:netrw_winsize."wincmd v" + + elseif a:style == 6 " Texplore + call s:SaveBufVars() +" call Decho("style = 6: Texplore") + tabnew + call s:RestoreBufVars() + endif + call s:RestoreWinVars() + endif + norm! 0 + +" call Decho("a:1<".a:1.">") + if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)) + let dirname= substitute(a:1,'\~',expand("$HOME"),'') +" call Decho("using dirname<".dirname."> (case: ~ && unix||cygwin)") + elseif a:1 == '.' + let dirname= exists("b:netrw_curdir")? b:netrw_curdir : getcwd() + if dirname !~ '/$' + let dirname= dirname."/" + endif +" call Decho("using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")") + else + let dirname= a:1 +" call Decho("using dirname<".dirname.">") + endif + + if dirname =~ '^\*/' + " Explore */pattern +" call Decho("case Explore */pattern") + let pattern= substitute(dirname,'^\*/\(.*\)$','\1','') +" call Decho("Explore */pat: dirname<".dirname."> -> pattern<".pattern.">") + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif + elseif dirname =~ '^\*\*//' + " Explore **//pattern +" call Decho("case Explore **//pattern") + let pattern = substitute(dirname,'^\*\*//','','') + let starstarpat = 1 +" call Decho("Explore **//pat: dirname<".dirname."> -> pattern<".pattern.">") + endif + + if dirname == "" && a:indx >= 0 + " Explore Hexplore Vexplore Sexplore +" call Decho("case Explore Hexplore Vexplore Sexplore") + let newdir= substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') + if newdir =~ '^scp:' || newdir =~ '^ftp:' +" call Decho("calling NetBrowse(0,newdir<".newdir.">)") + call s:NetBrowse(0,newdir) + else + if newdir == ""|let newdir= getcwd()|endif +" call Decho("calling LocalBrowseCheck(newdir<".newdir.">)") + call netrw#LocalBrowseCheck(newdir) + endif + call search('\<'.substitute(curfile,'^.*/','','e').'\>','cW') + + elseif dirname =~ '^\*\*/' || a:indx < 0 || dirname =~ '^\*/' + " Nexplore, Pexplore, Explore **/... , or Explore */pattern +" call Decho("case Nexplore, Pexplore, <s-down>, <s-up>, Explore dirname<".dirname.">") + if !mapcheck("<s-up>","n") && !mapcheck("<s-down>","n") && exists("b:netrw_curdir") +" call Decho("set up <s-up> and <s-down> maps") + let s:didstarstar= 1 + nnoremap <buffer> <silent> <s-up> :Pexplore<cr> + nnoremap <buffer> <silent> <s-down> :Nexplore<cr> + endif + + if has("path_extra") +" call Decho("has path_extra") + if !exists("w:netrw_explore_indx") + let w:netrw_explore_indx= 0 + endif + let indx = a:indx +" call Decho("set indx= [a:indx=".indx."]") +" + if indx == -1 + "Nexplore +" call Decho("case Nexplore: (indx=".indx.")") + if !exists("w:netrw_explore_list") " sanity check + call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) + silent! let @* = keepregstar + silent! let @+ = keepregstar + silent! let @/ = keepregslash +" call Dret("netrw#Explore") + return + endif + let indx= w:netrw_explore_indx + if indx < 0 | let indx= 0 | endif + if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif + let curfile= w:netrw_explore_list[indx] +" call Decho("indx=".indx." curfile<".curfile.">") + while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] + let indx= indx + 1 +" call Decho("indx=".indx." (Nexplore while loop)") + endwhile + if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif +" call Decho("Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) + + elseif indx == -2 + "Pexplore +" call Decho("case Pexplore: (indx=".indx.")") + if !exists("w:netrw_explore_list") " sanity check + call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) + silent! let @* = keepregstar + silent! let @+ = keepregstar + silent! let @/ = keepregslash +" call Dret("netrw#Explore") + return + endif + let indx= w:netrw_explore_indx + if indx < 0 | let indx= 0 | endif + if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif + let curfile= w:netrw_explore_list[indx] +" call Decho("indx=".indx." curfile<".curfile.">") + while indx >= 0 && curfile == w:netrw_explore_list[indx] + let indx= indx - 1 +" call Decho("indx=".indx." (Pexplore while loop)") + endwhile + if indx < 0 | let indx= 0 | endif +" call Decho("Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) + + else + " Explore -- initialize + " build list of files to Explore with Nexplore/Pexplore +" call Decho("case Explore: initialize (indx=".indx.")") + let w:netrw_explore_indx= 0 + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif +" call Decho("b:netrw_curdir<".b:netrw_curdir.">") + + if exists("pattern") +" call Decho("pattern exists: building list pattern<".pattern."> cwd<".getcwd().">") + if exists("starstarpat") +" call Decho("starstarpat<".starstarpat.">") + try + exe "silent vimgrep /".pattern."/gj "."**/*" + catch /^Vim\%((\a\+)\)\=:E480/ + call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif + silent! let @* = keepregstar + silent! let @+ = keepregstar + silent! let @/ = keepregslash +" call Dret("netrw#Explore : no files matched pattern") + return + endtry + let s:netrw_curdir = b:netrw_curdir + let w:netrw_explore_list = getqflist() + let w:netrw_explore_list = map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)') + else +" call Decho("no starstarpat") + exe "vimgrep /".pattern."/gj ".b:netrw_curdir."/*" + let w:netrw_explore_list = map(getqflist(),'bufname(v:val.bufnr)') + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif + endif + else +" call Decho("no pattern: building list based on ".b:netrw_curdir."/".dirname) + let w:netrw_explore_list= split(expand(b:netrw_curdir."/".dirname),'\n') + if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif + endif + + let w:netrw_explore_listlen = len(w:netrw_explore_list) +" call Decho("w:netrw_explore_list<".string(w:netrw_explore_list)."> listlen=".w:netrw_explore_listlen) + + if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') + call netrw#ErrorMsg(s:WARNING,"no files matched",42) + silent! let @* = keepregstar + silent! let @+ = keepregstar + silent! let @/ = keepregslash +" call Dret("netrw#Explore : no files matched") + return + endif + endif + + " NetrwStatusLine support - for exploring support + let w:netrw_explore_indx= indx +" call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) + + " wrap the indx around, but issue a note + if indx >= w:netrw_explore_listlen || indx < 0 +" call Decho("wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")") + let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 + let w:netrw_explore_indx= indx + call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) + sleep 1 + endif + + exe "let dirfile= w:netrw_explore_list[".indx."]" +" call Decho("dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">") + let newdir= substitute(dirfile,'/[^/]*$','','e') +" call Decho("newdir<".newdir.">") + +" call Decho("calling LocalBrowseCheck(newdir<".newdir.">)") + call netrw#LocalBrowseCheck(newdir) + if !exists("w:netrw_liststyle") + let w:netrw_liststyle= g:netrw_liststyle + endif + if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST + call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") + else + call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") + endif + let w:netrw_explore_mtchcnt = indx + 1 + let w:netrw_explore_bufnr = bufnr("%") + let w:netrw_explore_line = line(".") + call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') +" call Decho("explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) + + else +" call Decho("vim does not have path_extra") + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) + endif + silent! let @* = keepregstar + silent! let @+ = keepregstar + silent! let @/ = keepregslash +" call Dret("netrw#Explore : missing +path_extra") + return + endif + + else +" call Decho("case Explore newdir<".dirname.">") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' + silent! unlet w:netrw_treedict + silent! unlet w:netrw_treetop + endif + let newdir= dirname + if !exists("b:netrw_curdir") + call netrw#LocalBrowseCheck(getcwd()) + else + call netrw#LocalBrowseCheck(s:NetBrowseChgDir(1,newdir)) + endif + endif + + silent! let @* = keepregstar + silent! let @+ = keepregstar + silent! let @/ = keepregslash +" call Dret("netrw#Explore : @/<".@/.">") +endfun + +" --------------------------------------------------------------------- +" s:ExplorePatHls: converts an Explore pattern into a regular expression search pattern {{{2 +fun! s:ExplorePatHls(pattern) +" call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)") + let repat= substitute(a:pattern,'^**/\{1,2}','','') +" call Decho("repat<".repat.">") + let repat= escape(repat,'][.\') +" call Decho("repat<".repat.">") + let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>' +" call Dret("s:ExplorePatHls repat<".repat.">") + return repat +endfun + +" --------------------------------------------------------------------- +" SetupNetrwStatusLine: {{{2 +fun! s:SetupNetrwStatusLine(statline) +" call Dfunc("SetupNetrwStatusLine(statline<".a:statline.">)") + + if !exists("s:netrw_setup_statline") + let s:netrw_setup_statline= 1 +" call Decho("do first-time status line setup") + + if !exists("s:netrw_users_stl") + let s:netrw_users_stl= &stl + endif + if !exists("s:netrw_users_ls") + let s:netrw_users_ls= &laststatus + endif + + " set up User9 highlighting as needed + let keepa= @a + redir @a + try + hi User9 + catch /^Vim\%((\a\+)\)\=:E411/ + if &bg == "dark" + hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue + else + hi User9 ctermbg=yellow ctermfg=blue guibg=yellow guifg=blue + endif + endtry + redir END + let @a= keepa + endif + + " set up status line (may use User9 highlighting) + " insure that windows have a statusline + " make sure statusline is displayed + let &stl=a:statline + setlocal laststatus=2 +" call Decho("stl=".&stl) + redraw! + +" call Dret("SetupNetrwStatusLine : stl=".&stl) +endfun + +" --------------------------------------------------------------------- +" NetrwStatusLine: {{{2 +fun! NetrwStatusLine() + +" vvv NetrwStatusLine() debugging vvv +" let g:stlmsg="" +" if !exists("w:netrw_explore_bufnr") +" let g:stlmsg="!X<explore_bufnr>" +" elseif w:netrw_explore_bufnr != bufnr("%") +" let g:stlmsg="explore_bufnr!=".bufnr("%") +" endif +" if !exists("w:netrw_explore_line") +" let g:stlmsg=" !X<explore_line>" +" elseif w:netrw_explore_line != line(".") +" let g:stlmsg=" explore_line!={line(.)<".line(".").">" +" endif +" if !exists("w:netrw_explore_list") +" let g:stlmsg=" !X<explore_list>" +" endif +" ^^^ NetrwStatusLine() debugging ^^^ + + if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") + " restore user's status line + let &stl = s:netrw_users_stl + let &laststatus = s:netrw_users_ls + if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif + if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif + return "" + else + return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen + endif +endfun + +" --------------------------------------------------------------------- +" NetGetcwd: get the current directory. {{{2 +" Change backslashes to forward slashes, if any. +" If doesc is true, escape certain troublesome characters +fun! s:NetGetcwd(doesc) +" call Dfunc("NetGetcwd(doesc=".a:doesc.")") + let curdir= substitute(getcwd(),'\\','/','ge') + if curdir !~ '[\/]$' + let curdir= curdir.'/' + endif + if a:doesc + let curdir= escape(curdir,s:netrw_cd_escape) + endif +" call Dret("NetGetcwd <".curdir.">") + return curdir +endfun + +" --------------------------------------------------------------------- +" SetSort: sets up the sort based on the g:netrw_sort_sequence {{{2 +" What this function does is to compute a priority for the patterns +" in the g:netrw_sort_sequence. It applies a substitute to any +" "files" that satisfy each pattern, putting the priority / in +" front. An "*" pattern handles the default priority. +fun! s:SetSort() +" call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt) + if w:netrw_liststyle == s:LONGLIST + let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge') + else + let seqlist = g:netrw_sort_sequence + endif + " sanity check -- insure that * appears somewhere + if seqlist == "" + let seqlist= '*' + elseif seqlist !~ '\*' + let seqlist= seqlist.',*' + endif + let priority = 1 + while seqlist != "" + if seqlist =~ ',' + let seq = substitute(seqlist,',.*$','','e') + let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e') + else + let seq = seqlist + let seqlist = "" + endif + let eseq= escape(seq,'/') + if priority < 10 + let spriority= "00".priority.'\/' + elseif priority < 100 + let spriority= "0".priority.'\/' + else + let spriority= priority.'\/' + endif +" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">") + + " sanity check + if w:netrw_bannercnt > line("$") + " apparently no files were left after a Hiding pattern was used +" call Dret("SetSort : no files left after hiding") + return + endif + if seq == '*' + exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/' + else + exe 'silent keepjumps '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/' + endif + let priority = priority + 1 + endwhile + + " Following line associated with priority -- items that satisfy a priority + " pattern get prefixed by ###/ which permits easy sorting by priority. + " Sometimes files can satisfy multiple priority patterns -- only the latest + " priority pattern needs to be retained. So, at this point, these excess + " priority prefixes need to be removed, but not directories that happen to + " be just digits themselves. + exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+\ze./\1/e' + +" call Dret("SetSort") +endfun + +" ===================================================================== +" Support Functions: {{{1 + +" --------------------------------------------------------------------- +" ComposePath: Appends a new part to a path taking different systems into consideration {{{2 +fun! s:ComposePath(base,subdir) +" call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)") + if(has("amiga")) + let ec = a:base[strlen(a:base)-1] + if ec != '/' && ec != ':' + let ret = a:base . "/" . a:subdir + else + let ret = a:base . a:subdir + endif + elseif a:base =~ '^\a\+://' + let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','') + let curpath = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\2','') + let ret = urlbase.curpath.a:subdir +" call Decho("urlbase<".urlbase.">") +" call Decho("curpath<".curpath.">") +" call Decho("ret<".ret.">") + else + let ret = substitute(a:base."/".a:subdir,"//","/","g") + endif +" call Dret("s:ComposePath ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" netrw#ErrorMsg: {{{2 +" 0=note = s:NOTE +" 1=warning = s:WARNING +" 2=error = s:ERROR +" Mar 19, 2007 : max errnum currently is 49 +fun! netrw#ErrorMsg(level,msg,errnum) +" call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.")") + + " record current window number for NetRestorePosn()'s benefit + let s:winBeforeErr= winnr() + + " getting messages out reliably is just plain difficult! + " This attempt splits the current window, creating a one line window. + let errbufnum= bufnr("NetrwMessage") + + bo 1split + enew + setlocal bt=nofile + file NetrwMessage + + put ='***netrw*** '.a:msg + if &fo !~ '[ta]' + syn clear + syn match netrwMesg "^\*\*\*netrw\*\*\*" + if a:level == s:WARNING + hi link netrwMesg WarningMsg + elseif a:level == s:ERROR + hi link netrwMesg Error + endif + endif + 1d + setlocal noma ro bh=wipe + +" call Dret("netrw#ErrorMsg") +endfun + +" --------------------------------------------------------------------- +" netrw#RFC2396: converts %xx into characters {{{2 +fun! netrw#RFC2396(fname) +" call Dfunc("netrw#RFC2396(fname<".a:fname.">)") + let fname = escape(substitute(a:fname,'%\(\x\x\)','\=nr2char("0x".submatch(1))','ge')," \t") +" call Dret("netrw#RFC2396 ".fname) + return fname +endfun + +" --------------------------------------------------------------------- +" s:FileReadable: o/s independent filereadable {{{2 +fun! s:FileReadable(fname) +" call Dfunc("s:FileReadable(fname<".a:fname.">)") + + if g:netrw_cygwin + let ret= filereadable(substitute(a:fname,'/cygdrive/\(.\)','\1:/','')) + else + let ret= filereadable(a:fname) + endif + +" call Dret("s:FileReadable ".ret) + return ret +endfun + +" --------------------------------------------------------------------- +" s:GetTempfile: gets a tempname that'll work for various o/s's {{{2 +" Places correct suffix on end of temporary filename, +" using the suffix provided with fname +fun! s:GetTempfile(fname) +" call Dfunc("s:GetTempfile(fname<".a:fname.">)") + + if !exists("b:netrw_tmpfile") + " get a brand new temporary filename + let tmpfile= tempname() +" call Decho("tmpfile<".tmpfile."> : from tempname()") + + let tmpfile= escape(substitute(tmpfile,'\','/','ge'),g:netrw_tmpfile_escape) +" call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /") + + " sanity check -- does the temporary file's directory exist? + if !isdirectory(substitute(tmpfile,'[^/]\+$','','e')) + call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) +" call Dret("s:GetTempfile getcwd<".getcwd().">") + return "" + endif + + " let netrw#NetSource() know about the tmpfile + let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() +" call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">") + + " o/s dependencies + if g:netrw_cygwin == 1 + let tmpfile = substitute(tmpfile,'^\(\a\):','/cygdrive/\1','e') + elseif has("win32") || has("win95") || has("win64") || has("win16") + let tmpfile = substitute(tmpfile,'/','\\','g') + else + let tmpfile = tmpfile + endif + let b:netrw_tmpfile= tmpfile +" call Decho("o/s dependent fixed tempname<".tmpfile.">") + else + " re-use temporary filename + let tmpfile= b:netrw_tmpfile +" call Decho("tmpfile<".tmpfile."> re-using") + endif + + " use fname's suffix for the temporary file + if a:fname != "" + if a:fname =~ '\.[^./]\+$' +" call Decho("using fname<".a:fname.">'s suffix") + if a:fname =~ '.tar.gz' || a:fname =~ '.tar.bz2' + let suffix = ".tar".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') + else + let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') + endif + let suffix = escape(suffix,g:netrw_tmpfile_escape) +" call Decho("suffix<".suffix.">") + let tmpfile= substitute(tmpfile,'\.tmp$','','e') +" call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)") + let tmpfile .= suffix +" call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">") + let s:netrw_tmpfile= tmpfile " supports netrw#NetSource() + endif + endif + +" call Dret("s:GetTempfile <".tmpfile.">") + return tmpfile +endfun + +" --------------------------------------------------------------------- +" s:MakeSshCmd: transforms input command using USEPORT HOSTNAME into {{{2 +" a correct command +fun! s:MakeSshCmd(sshcmd) +" call Dfunc("s:MakeSshCmd(sshcmd<".a:sshcmd.">)") + let sshcmd = substitute(a:sshcmd,'\<HOSTNAME\>',s:user.s:machine,'') + if exists("g:netrw_port") && g:netrw_port != "" + let sshcmd= substitute(sshcmd,"USEPORT",'-P '.g:netrw_port,'') + elseif exists("s:port") && s:port != "" + let sshcmd= substitute(sshcmd,"USEPORT",'-P '.s:port,'') + else + let sshcmd= substitute(sshcmd,"USEPORT ",'','') + endif +" call Dret("s:MakeSshCmd <".sshcmd.">") + return sshcmd +endfun + +" --------------------------------------------------------------------- +" s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2 +fun! s:NetrwEnew(curdir) +" call Dfunc("s:NetrwEnew(curdir<".a:curdir.">) expand(%)<".expand("%").">") + + " grab a function-local copy of buffer variables + if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif + if exists("b:netrw_browser_active") |let netrw_browser_active = b:netrw_browser_active |endif + if exists("b:netrw_cpf") |let netrw_cpf = b:netrw_cpf |endif + if exists("b:netrw_curdir") |let netrw_curdir = b:netrw_curdir |endif + if exists("b:netrw_explore_bufnr") |let netrw_explore_bufnr = b:netrw_explore_bufnr |endif + if exists("b:netrw_explore_indx") |let netrw_explore_indx = b:netrw_explore_indx |endif + if exists("b:netrw_explore_line") |let netrw_explore_line = b:netrw_explore_line |endif + if exists("b:netrw_explore_list") |let netrw_explore_list = b:netrw_explore_list |endif + if exists("b:netrw_explore_listlen")|let netrw_explore_listlen = b:netrw_explore_listlen|endif + if exists("b:netrw_explore_mtchcnt")|let netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif + if exists("b:netrw_fname") |let netrw_fname = b:netrw_fname |endif + if exists("b:netrw_lastfile") |let netrw_lastfile = b:netrw_lastfile |endif + if exists("b:netrw_liststyle") |let netrw_liststyle = b:netrw_liststyle |endif + if exists("b:netrw_method") |let netrw_method = b:netrw_method |endif + if exists("b:netrw_option") |let netrw_option = b:netrw_option |endif + if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif + + if getline(2) =~ '^" Netrw Directory Listing' +" call Decho("generate a buffer with keepjumps keepalt enew! (1)") + keepjumps keepalt enew! + else +" call Decho("generate a buffer with keepjumps enew! (2)") + keepjumps enew! + endif + + " copy function-local variables to buffer variable equivalents + if exists("netrw_bannercnt") |let b:netrw_bannercnt = netrw_bannercnt |endif + if exists("netrw_browser_active") |let b:netrw_browser_active = netrw_browser_active |endif + if exists("netrw_cpf") |let b:netrw_cpf = netrw_cpf |endif + if exists("netrw_curdir") |let b:netrw_curdir = netrw_curdir |endif + if exists("netrw_explore_bufnr") |let b:netrw_explore_bufnr = netrw_explore_bufnr |endif + if exists("netrw_explore_indx") |let b:netrw_explore_indx = netrw_explore_indx |endif + if exists("netrw_explore_line") |let b:netrw_explore_line = netrw_explore_line |endif + if exists("netrw_explore_list") |let b:netrw_explore_list = netrw_explore_list |endif + if exists("netrw_explore_listlen")|let b:netrw_explore_listlen = netrw_explore_listlen|endif + if exists("netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt = netrw_explore_mtchcnt|endif + if exists("netrw_fname") |let b:netrw_fname = netrw_fname |endif + if exists("netrw_lastfile") |let b:netrw_lastfile = netrw_lastfile |endif + if exists("netrw_liststyle") |let b:netrw_liststyle = netrw_liststyle |endif + if exists("netrw_method") |let b:netrw_method = netrw_method |endif + if exists("netrw_option") |let b:netrw_option = netrw_option |endif + if exists("netrw_prvdir") |let b:netrw_prvdir = netrw_prvdir |endif + + let b:netrw_curdir= a:curdir + if b:netrw_curdir =~ '/$' + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + file NetrwTreeListing + else + exe "silent! file ".b:netrw_curdir + endif + endif + +" call Dret("s:NetrwEnew : buf#".bufnr("%")) +endfun + +" ------------------------------------------------------------------------ +" s:RemotePathAnalysis: {{{2 +fun! s:RemotePathAnalysis(dirname) +" call Dfunc("s:RemotePathAnalysis()") + + let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/:#]\+\)\%([:#]\(\d\+\)\)\=/\(.*\)$' + let s:method = substitute(a:dirname,dirpat,'\1','') + let s:user = substitute(a:dirname,dirpat,'\2','') + let s:machine = substitute(a:dirname,dirpat,'\3','') + let s:port = substitute(a:dirname,dirpat,'\4','') + let s:path = substitute(a:dirname,dirpat,'\5','') + let s:fname = substitute(a:dirname,'^.*/\ze.','','') + +" call Decho("set up s:method <".s:method .">") +" call Decho("set up s:user <".s:user .">") +" call Decho("set up s:machine<".s:machine.">") +" call Decho("set up s:port <".s:port.">") +" call Decho("set up s:path <".s:path .">") +" call Decho("set up s:fname <".s:fname .">") + +" call Dret("s:RemotePathAnalysis") +endfun + +" --------------------------------------------------------------------- +" s:RestoreBufVars: {{{2 +fun! s:RestoreBufVars() +" call Dfunc("s:RestoreBufVars()") + + if exists("s:netrw_curdir") |let b:netrw_curdir = s:netrw_curdir |endif + if exists("s:netrw_lastfile") |let b:netrw_lastfile = s:netrw_lastfile |endif + if exists("s:netrw_method") |let b:netrw_method = s:netrw_method |endif + if exists("s:netrw_fname") |let b:netrw_fname = s:netrw_fname |endif + if exists("s:netrw_machine") |let b:netrw_machine = s:netrw_machine |endif + if exists("s:netrw_browser_active")|let b:netrw_browser_active = s:netrw_browser_active|endif + +" call Dret("s:RestoreBufVars") +endfun + +" --------------------------------------------------------------------- +" s:RestoreWinVars: (used by Explore() and NetSplit()) {{{2 +fun! s:RestoreWinVars() +" call Dfunc("s:RestoreWinVars()") + if exists("s:bannercnt") |let w:netrw_bannercnt = s:bannercnt |unlet s:bannercnt |endif + if exists("s:col") |let w:netrw_col = s:col |unlet s:col |endif + if exists("s:curdir") |let w:netrw_curdir = s:curdir |unlet s:curdir |endif + if exists("s:explore_bufnr") |let w:netrw_explore_bufnr = s:explore_bufnr |unlet s:explore_bufnr |endif + if exists("s:explore_indx") |let w:netrw_explore_indx = s:explore_indx |unlet s:explore_indx |endif + if exists("s:explore_line") |let w:netrw_explore_line = s:explore_line |unlet s:explore_line |endif + if exists("s:explore_listlen")|let w:netrw_explore_listlen = s:explore_listlen|unlet s:explore_listlen|endif + if exists("s:explore_list") |let w:netrw_explore_list = s:explore_list |unlet s:explore_list |endif + if exists("s:explore_mtchcnt")|let w:netrw_explore_mtchcnt = s:explore_mtchcnt|unlet s:explore_mtchcnt|endif + if exists("s:fpl") |let w:netrw_fpl = s:fpl |unlet s:fpl |endif + if exists("s:hline") |let w:netrw_hline = s:hline |unlet s:hline |endif + if exists("s:line") |let w:netrw_line = s:line |unlet s:line |endif + if exists("s:liststyle") |let w:netrw_liststyle = s:liststyle |unlet s:liststyle |endif + if exists("s:method") |let w:netrw_method = s:method |unlet s:method |endif + if exists("s:prvdir") |let w:netrw_prvdir = s:prvdir |unlet s:prvdir |endif + if exists("s:treedict") |let w:netrw_treedict = s:treedict |unlet s:treedict |endif + if exists("s:treetop") |let w:netrw_treetop = s:treetop |unlet s:treetop |endif + if exists("s:winnr") |let w:netrw_winnr = s:winnr |unlet s:winnr |endif +" call Dret("s:RestoreWinVars") +endfun + +" --------------------------------------------------------------------- +" s:SaveBufVars: {{{2 +fun! s:SaveBufVars() +" call Dfunc("s:SaveBufVars()") + + if exists("b:netrw_curdir") |let s:netrw_curdir = b:netrw_curdir |endif + if exists("b:netrw_lastfile") |let s:netrw_lastfile = b:netrw_lastfile |endif + if exists("b:netrw_method") |let s:netrw_method = b:netrw_method |endif + if exists("b:netrw_fname") |let s:netrw_fname = b:netrw_fname |endif + if exists("b:netrw_machine") |let s:netrw_machine = b:netrw_machine |endif + if exists("b:netrw_browser_active")|let s:netrw_browser_active = b:netrw_browser_active|endif + +" call Dret("s:SaveBufVars") +endfun + +" --------------------------------------------------------------------- +" s:SaveWinVars: (used by Explore() and NetSplit()) {{{2 +fun! s:SaveWinVars() +" call Dfunc("s:SaveWinVars()") + if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif + if exists("w:netrw_col") |let s:col = w:netrw_col |endif + if exists("w:netrw_curdir") |let s:curdir = w:netrw_curdir |endif + if exists("w:netrw_explore_bufnr") |let s:explore_bufnr = w:netrw_explore_bufnr |endif + if exists("w:netrw_explore_indx") |let s:explore_indx = w:netrw_explore_indx |endif + if exists("w:netrw_explore_line") |let s:explore_line = w:netrw_explore_line |endif + if exists("w:netrw_explore_listlen")|let s:explore_listlen = w:netrw_explore_listlen|endif + if exists("w:netrw_explore_list") |let s:explore_list = w:netrw_explore_list |endif + if exists("w:netrw_explore_mtchcnt")|let s:explore_mtchcnt = w:netrw_explore_mtchcnt|endif + if exists("w:netrw_fpl") |let s:fpl = w:netrw_fpl |endif + if exists("w:netrw_hline") |let s:hline = w:netrw_hline |endif + if exists("w:netrw_line") |let s:line = w:netrw_line |endif + if exists("w:netrw_liststyle") |let s:liststyle = w:netrw_liststyle |endif + if exists("w:netrw_method") |let s:method = w:netrw_method |endif + if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif + if exists("w:netrw_treedict") |let s:treedict = w:netrw_treedict |endif + if exists("w:netrw_treetop") |let s:treetop = w:netrw_treetop |endif + if exists("w:netrw_winnr") |let s:winnr = w:netrw_winnr |endif +" call Dret("s:SaveWinVars") +endfun + +" --------------------------------------------------------------------- +" s:SetBufWinVars: (used by NetBrowse() and LocalBrowseCheck()) {{{2 +" To allow separate windows to have their own activities, such as +" Explore **/pattern, several variables have been made window-oriented. +" However, when the user splits a browser window (ex: ctrl-w s), these +" variables are not inherited by the new window. SetBufWinVars() and +" UseBufWinVars() get around that. +fun! s:SetBufWinVars() +" call Dfunc("s:SetBufWinVars()") + if exists("w:netrw_liststyle") |let b:netrw_liststyle = w:netrw_liststyle |endif + if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif + if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif + if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif + if exists("w:netrw_explore_indx") |let b:netrw_explore_indx = w:netrw_explore_indx |endif + if exists("w:netrw_explore_listlen")|let b:netrw_explore_listlen= w:netrw_explore_listlen|endif + if exists("w:netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt= w:netrw_explore_mtchcnt|endif + if exists("w:netrw_explore_bufnr") |let b:netrw_explore_bufnr = w:netrw_explore_bufnr |endif + if exists("w:netrw_explore_line") |let b:netrw_explore_line = w:netrw_explore_line |endif + if exists("w:netrw_explore_list") |let b:netrw_explore_list = w:netrw_explore_list |endif +" call Dret("s:SetBufWinVars") +endfun + +" --------------------------------------------------------------------- +" s:System: using Steve Hall's idea to insure that Windows paths stay {{{2 +" acceptable. No effect on Unix paths. +" Examples of use: let result= s:System("system",path) +" let result= s:System("delete",path) +fun! s:System(cmd,path) +" call Dfunc("s:System(cmd<".a:cmd."> path<".a:path.">)") + + let path = a:path + if (has("win32") || has("win95") || has("win64") || has("win16")) + " system call prep + " remove trailing slash (Win95) + let path = substitute(path, '\(\\\|/\)$', '', 'g') + " remove escaped spaces + let path = substitute(path, '\ ', ' ', 'g') + " convert slashes to backslashes + let path = substitute(path, '/', '\', 'g') + if exists("+shellslash") + let sskeep= &shellslash + setlocal noshellslash + exe "let result= ".a:cmd."('".path."')" + let &shellslash = sskeep + else + exe "let result= ".a:cmd."(".g:netrw_shq.path.g:netrw_shq.")" + endif + else + exe "let result= ".a:cmd."('".path."')" + endif + +" call Decho("result<".result.">") +" call Dret("s:System") + return result +endfun + +" --------------------------------------------------------------------- +" s:UseBufWinVars: (used by NetBrowse() and LocalBrowseCheck() {{{2 +" Matching function to BufferWinVars() +fun! s:UseBufWinVars() +" call Dfunc("s:UseBufWinVars()") + if exists("b:netrw_liststyle") && !exists("w:netrw_liststyle") |let w:netrw_liststyle = b:netrw_liststyle |endif + if exists("b:netrw_bannercnt") && !exists("w:netrw_bannercnt") |let w:netrw_bannercnt = b:netrw_bannercnt |endif + if exists("b:netrw_method") && !exists("w:netrw_method") |let w:netrw_method = b:netrw_method |endif + if exists("b:netrw_prvdir") && !exists("w:netrw_prvdir") |let w:netrw_prvdir = b:netrw_prvdir |endif + if exists("b:netrw_explore_indx") && !exists("w:netrw_explore_indx") |let w:netrw_explore_indx = b:netrw_explore_indx |endif + if exists("b:netrw_explore_listlen") && !exists("w:netrw_explore_listlen")|let w:netrw_explore_listlen = b:netrw_explore_listlen|endif + if exists("b:netrw_explore_mtchcnt") && !exists("w:netrw_explore_mtchcnt")|let w:netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif + if exists("b:netrw_explore_bufnr") && !exists("w:netrw_explore_bufnr") |let w:netrw_explore_bufnr = b:netrw_explore_bufnr |endif + if exists("b:netrw_explore_line") && !exists("w:netrw_explore_line") |let w:netrw_explore_line = b:netrw_explore_line |endif + if exists("b:netrw_explore_list") && !exists("w:netrw_explore_list") |let w:netrw_explore_list = b:netrw_explore_list |endif +" call Dret("s:UseBufWinVars") +endfun + +" --------------------------------------------------------------------- +" Settings Restoration: {{{2 +let &cpo= s:keepcpo +unlet s:keepcpo + +" ------------------------------------------------------------------------ +" Modelines: {{{1 +" vim:ts=8 fdm=marker diff --git a/vimfiles/autoload/netrwFileHandlers.vim b/vimfiles/autoload/netrwFileHandlers.vim new file mode 100644 index 0000000..97c4837 --- /dev/null +++ b/vimfiles/autoload/netrwFileHandlers.vim @@ -0,0 +1,355 @@ +" netrwFileHandlers: contains various extension-based file handlers for +" netrw's browsers' x command ("eXecute launcher") +" Author: Charles E. Campbell, Jr. +" Date: May 30, 2006 +" Version: 9 +" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" netrwFileHandlers.vim is provided *as is* and comes with no +" warranty of any kind, either expressed or implied. In no +" event will the copyright holder be liable for any damages +" resulting from the use of this software. +" +" Rom 6:23 (WEB) For the wages of sin is death, but the free gift of God {{{1 +" is eternal life in Christ Jesus our Lord. + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if exists("g:loaded_netrwFileHandlers") || &cp + finish +endif +let s:keepcpo= &cpo +set cpo&vim +let g:loaded_netrwFileHandlers= "v9" + +" --------------------------------------------------------------------- +" netrwFileHandlers#Invoke: {{{1 +fun! netrwFileHandlers#Invoke(exten,fname) +" call Dfunc("netrwFileHandlers#Invoke(exten<".a:exten."> fname<".a:fname.">)") + let fname= a:fname + " list of supported special characters. Consider rcs,v --- that can be + " supported with a NFH_rcsCOMMAv() handler + if a:fname =~ '[@:,$!=\-+%?;~]' + let specials= { +\ '@' : 'AT', +\ ':' : 'COLON', +\ ',' : 'COMMA', +\ '$' : 'DOLLAR', +\ '!' : 'EXCLAMATION', +\ '=' : 'EQUAL', +\ '-' : 'MINUS', +\ '+' : 'PLUS', +\ '%' : 'PERCENT', +\ '?' : 'QUESTION', +\ ';' : 'SEMICOLON', +\ '~' : 'TILDE'} + let fname= substitute(a:fname,'[@:,$!=\-+%?;~]','\=specials[submatch(0)]','ge') +" call Decho('fname<'.fname.'> done with dictionary') + endif + + if a:exten != "" && exists("*NFH_".a:exten) + " support user NFH_*() functions +" call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")') + exe "let ret= NFH_".a:exten.'("'.fname.'")' + elseif a:exten != "" && exists("*s:NFH_".a:exten) + " use builtin-NFH_*() functions +" call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")') + exe "let ret= s:NFH_".a:exten.'("'.fname.'")' + endif + +" call Dret("netrwFileHandlers#Invoke 0 : ret=".ret) + return 0 +endfun + +" --------------------------------------------------------------------- +" s:NFH_html: handles html when the user hits "x" when the {{{1 +" cursor is atop a *.html file +fun! s:NFH_html(pagefile) +" call Dfunc("s:NFH_html(".a:pagefile.")") + + let page= substitute(a:pagefile,'^','file://','') + + if executable("mozilla") +" call Decho("executing !mozilla ".page) + exe "!mozilla ".g:netrw_shq.page.g:netrw_shq + elseif executable("netscape") +" call Decho("executing !netscape ".page) + exe "!netscape ".g:netrw_shq..page.g:netrw_shq + else +" call Dret("s:NFH_html 0") + return 0 + endif + +" call Dret("s:NFH_html 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_htm: handles html when the user hits "x" when the {{{1 +" cursor is atop a *.htm file +fun! s:NFH_htm(pagefile) +" call Dfunc("s:NFH_htm(".a:pagefile.")") + + let page= substitute(a:pagefile,'^','file://','') + + if executable("mozilla") +" call Decho("executing !mozilla ".page) + exe "!mozilla ".g:netrw_shq.page.g:netrw_shq + elseif executable("netscape") +" call Decho("executing !netscape ".page) + exe "!netscape ".g:netrw_shq.page.g:netrw_shq + else +" call Dret("s:NFH_htm 0") + return 0 + endif + +" call Dret("s:NFH_htm 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_jpg: {{{1 +fun! s:NFH_jpg(jpgfile) +" call Dfunc("s:NFH_jpg(jpgfile<".a:jpgfile.">)") + + if executable("gimp") + exe "silent! !gimp -s ".g:netrw_shq.a:jpgfile.g:netrw_shq + elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") +" call Decho("silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".escape(a:jpgfile," []|'")) + exe "!".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:jpgfile.g:netrw_shq + else +" call Dret("s:NFH_jpg 0") + return 0 + endif + +" call Dret("s:NFH_jpg 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_gif: {{{1 +fun! s:NFH_gif(giffile) +" call Dfunc("s:NFH_gif(giffile<".a:giffile.">)") + + if executable("gimp") + exe "silent! !gimp -s ".g:netrw_shq.a:giffile.g:netrw_shq + elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") + exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:giffile.g:netrw_shq + else +" call Dret("s:NFH_gif 0") + return 0 + endif + +" call Dret("s:NFH_gif 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_png: {{{1 +fun! s:NFH_png(pngfile) +" call Dfunc("s:NFH_png(pngfile<".a:pngfile.">)") + + if executable("gimp") + exe "silent! !gimp -s ".g:netrw_shq.a:pngfile.g:netrw_shq + elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") + exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:pngfile.g:netrw_shq + else +" call Dret("s:NFH_png 0") + return 0 + endif + +" call Dret("s:NFH_png 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_pnm: {{{1 +fun! s:NFH_pnm(pnmfile) +" call Dfunc("s:NFH_pnm(pnmfile<".a:pnmfile.">)") + + if executable("gimp") + exe "silent! !gimp -s ".g:netrw_shq.a:pnmfile.g:netrw_shq + elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") + exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:pnmfile.g:netrw_shq + else +" call Dret("s:NFH_pnm 0") + return 0 + endif + +" call Dret("s:NFH_pnm 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_bmp: visualize bmp files {{{1 +fun! s:NFH_bmp(bmpfile) +" call Dfunc("s:NFH_bmp(bmpfile<".a:bmpfile.">)") + + if executable("gimp") + exe "silent! !gimp -s ".a:bmpfile + elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") + exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:bmpfile.g:netrw_shq + else +" call Dret("s:NFH_bmp 0") + return 0 + endif + +" call Dret("s:NFH_bmp 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_pdf: visualize pdf files {{{1 +fun! s:NFH_pdf(pdf) +" call Dfunc("s:NFH_pdf(pdf<".a:pdf.">)") + if executable("gs") + exe 'silent! !gs '.g:netrw_shq.a:pdf.g:netrw_shq + elseif executable("pdftotext") + exe 'silent! pdftotext -nopgbrk '.g:netrw_shq.a:pdf.g:netrw_shq + else +" call Dret("s:NFH_pdf 0") + return 0 + endif + +" call Dret("s:NFH_pdf 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_doc: visualize doc files {{{1 +fun! s:NFH_doc(doc) +" call Dfunc("s:NFH_doc(doc<".a:doc.">)") + + if executable("oowriter") + exe 'silent! !oowriter '.g:netrw_shq.a:doc.g:netrw_shq + redraw! + else +" call Dret("s:NFH_doc 0") + return 0 + endif + +" call Dret("s:NFH_doc 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_sxw: visualize sxw files {{{1 +fun! s:NFH_sxw(sxw) +" call Dfunc("s:NFH_sxw(sxw<".a:sxw.">)") + + if executable("oowriter") + exe 'silent! !oowriter '.g:netrw_shq.a:sxw.g:netrw_shq + redraw! + else +" call Dret("s:NFH_sxw 0") + return 0 + endif + +" call Dret("s:NFH_sxw 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_xls: visualize xls files {{{1 +fun! s:NFH_xls(xls) +" call Dfunc("s:NFH_xls(xls<".a:xls.">)") + + if executable("oocalc") + exe 'silent! !oocalc '.g:netrw_shq.a:xls.g:netrw_shq + redraw! + else +" call Dret("s:NFH_xls 0") + return 0 + endif + +" call Dret("s:NFH_xls 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_ps: handles PostScript files {{{1 +fun! s:NFH_ps(ps) +" call Dfunc("s:NFH_ps(ps<".a:ps.">)") + if executable("gs") +" call Decho("exe silent! !gs ".a:ps) + exe "silent! !gs ".g:netrw_shq.a:ps.g:netrw_shq + redraw! + elseif executable("ghostscript") +" call Decho("exe silent! !ghostscript ".a:ps) + exe "silent! !ghostscript ".g:netrw_shq.a:ps.g:netrw_shq + redraw! + elseif executable("gswin32") +" call Decho("exe silent! !gswin32 ".g:netrw_shq.a:ps.g:netrw_shq) + exe "silent! !gswin32 ".g:netrw_shq.a:ps.g:netrw_shq + redraw! + else +" call Dret("s:NFH_ps 0") + return 0 + endif + +" call Dret("s:NFH_ps 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_eps: handles encapsulated PostScript files {{{1 +fun! s:NFH_eps(eps) +" call Dfunc("s:NFH_eps()") + if executable("gs") + exe "silent! !gs ".g:netrw_shq.a:eps.g:netrw_shq + redraw! + elseif executable("ghostscript") + exe "silent! !ghostscript ".g:netrw_shq.a:eps.g:netrw_shq + redraw! + elseif executable("ghostscript") + exe "silent! !ghostscript ".g:netrw_shq.a:eps.g:netrw_shq + redraw! + elseif executable("gswin32") + exe "silent! !gswin32 ".g:netrw_shq.a:eps.g:netrw_shq + redraw! + else +" call Dret("s:NFH_eps 0") + return 0 + endif +" call Dret("s:NFH_eps 0") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_fig: handles xfig files {{{1 +fun! s:NFH_fig(fig) +" call Dfunc("s:NFH_fig()") + if executable("xfig") + exe "silent! !xfig ".a:fig + redraw! + else +" call Dret("s:NFH_fig 0") + return 0 + endif + +" call Dret("s:NFH_fig 1") + return 1 +endfun + +" --------------------------------------------------------------------- +" s:NFH_obj: handles tgif's obj files {{{1 +fun! s:NFH_obj(obj) +" call Dfunc("s:NFH_obj()") + if has("unix") && executable("tgif") + exe "silent! !tgif ".a:obj + redraw! + else +" call Dret("s:NFH_obj 0") + return 0 + endif + +" call Dret("s:NFH_obj 1") + return 1 +endfun + +let &cpo= s:keepcpo +" --------------------------------------------------------------------- +" Modelines: {{{1 +" vim: fdm=marker diff --git a/vimfiles/autoload/netrwSettings.vim b/vimfiles/autoload/netrwSettings.vim new file mode 100644 index 0000000..7d8587a --- /dev/null +++ b/vimfiles/autoload/netrwSettings.vim @@ -0,0 +1,183 @@ +" netrwSettings.vim: makes netrw settings simpler +" Date: Jan 05, 2007 +" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz> +" Version: 9b ASTRO-ONLY +" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" netrwSettings.vim is provided *as is* and comes with no +" warranty of any kind, either expressed or implied. By using +" this plugin, you agree that in no event will the copyright +" holder be liable for any damages resulting from the use +" of this software. +" +" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1 +" synagogues, preaching the gospel of the kingdom, and healing +" every disease and every sickness among the people. +" Load Once: {{{1 +if exists("g:loaded_netrwSettings") || &cp + finish +endif +let g:loaded_netrwSettings = "v9b" + +" --------------------------------------------------------------------- +" NetrwSettings: {{{1 +fun! netrwSettings#NetrwSettings() + " this call is here largely just to insure that netrw has been loaded + call netrw#NetSavePosn() + if !exists("g:loaded_netrw") + echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None + return + endif + + above wincmd s + enew + setlocal noswapfile bh=wipe + set ft=vim + file Netrw\ Settings + + " these variables have the following default effects when they don't + " exist (ie. have not been set by the user in his/her .vimrc) + if !exists("g:netrw_liststyle") + let g:netrw_liststyle= 0 + let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa" + endif + if !exists("g:netrw_silent") + let g:netrw_silent= 0 + endif + if !exists("g:netrw_use_nt_rcp") + let g:netrw_use_nt_rcp= 0 + endif + if !exists("g:netrw_ftp") + let g:netrw_ftp= 0 + endif + if !exists("g:netrw_ignorenetrc") + let g:netrw_ignorenetrc= 0 + endif + + put ='+ ---------------------------------------------' + put ='+ NetrwSettings: by Charles E. Campbell, Jr.' + put ='+ Press <F1> with cursor atop any line for help' + put ='+ ---------------------------------------------' + let s:netrw_settings_stop= line(".") + + put ='' + put ='+ Netrw Protocol Commands' + put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd + put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd + put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd + put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd + put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd + put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd + put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd + put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd + put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd + let s:netrw_protocol_stop= line(".") + put = '' + + put ='+Netrw Transfer Control' + put = 'let g:netrw_cygwin = '.g:netrw_cygwin + put = 'let g:netrw_ftp = '.g:netrw_ftp + put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode + put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc + let shqline= line("$") + put = 'let g:netrw_shq...' + put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp + put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp + let s:netrw_xfer_stop= line(".") + + put = '' + put ='+ Netrw Browser Control' + put = 'let g:netrw_alto = '.g:netrw_alto + put = 'let g:netrw_altv = '.g:netrw_altv + put = 'let g:netrw_browse_split = '.g:netrw_browse_split + if exists("g:netrw_browsex_viewer") + put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer + else + put = 'let g:netrw_browsex_viewer = (not defined)' + endif + put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax + put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse + put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject + put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd + put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd + put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd + put = 'let g:netrw_hide = '.g:netrw_hide + put = 'let g:netrw_keepdir = '.g:netrw_keepdir + put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd + put = 'let g:netrw_list_hide = '.g:netrw_list_hide + put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir + put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir + put = 'let g:netrw_liststyle = '.g:netrw_liststyle + put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen + put = 'let g:netrw_menu = '.g:netrw_menu + put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd + put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd + put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd + put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd + put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd + put = 'let g:netrw_silent = '.g:netrw_silent + put = 'let g:netrw_sort_by = '.g:netrw_sort_by + put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction + put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence + put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject + put = 'let g:netrw_timefmt = '.g:netrw_timefmt + put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf + put = 'let g:netrw_winsize = '.g:netrw_winsize + + put ='' + put ='+ For help, place cursor on line and press ?' + + 1d + silent %s/^+/"/e + res 99 + silent %s/= \([^0-9].*\)$/= '\1'/e + silent %s/= $/= ''/e + 1 + + " Put in shq setting. + " (deferred so as to avoid the quote manipulation just preceding) + if g:netrw_shq == "'" + call setline(shqline,'let g:netrw_shq = "'.g:netrw_shq.'"') + else + call setline(shqline,"let g:netrw_shq = '".g:netrw_shq."'") + endif + + set nomod + + nmap <buffer> <silent> <F1> :call NetrwSettingHelp()<cr> + nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call NetrwSettingHelp()<cr> + let tmpfile= tempname() + exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod' +endfun + +" --------------------------------------------------------------------- +" NetrwSettingHelp: {{{2 +fun! NetrwSettingHelp() +" call Dfunc("NetrwSettingHelp()") + let curline = getline(".") + if curline =~ '=' + let varhelp = substitute(curline,'^\s*let ','','e') + let varhelp = substitute(varhelp,'\s*=.*$','','e') +" call Decho("trying help ".varhelp) + try + exe "he ".varhelp + catch /^Vim\%((\a\+)\)\=:E149/ + echo "***sorry*** no help available for <".varhelp.">" + endtry + elseif line(".") < s:netrw_settings_stop + he netrw-settings + elseif line(".") < s:netrw_protocol_stop + he netrw-externapp + elseif line(".") < s:netrw_xfer_stop + he netrw-variables + else + he netrw-browse-var + endif +" call Dret("NetrwSettingHelp") +endfun + +" --------------------------------------------------------------------- +" Modelines: {{{1 +" vim:ts=8 fdm=marker diff --git a/vimfiles/autoload/vimball.vim b/vimfiles/autoload/vimball.vim new file mode 100644 index 0000000..d4a27fd --- /dev/null +++ b/vimfiles/autoload/vimball.vim @@ -0,0 +1,628 @@ +" vimball.vim : construct a file containing both paths and files +" Author: Charles E. Campbell, Jr. +" Date: Jan 03, 2007 +" Version: 21 +" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim +" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. +" The VIM LICENSE applies to Vimball.vim, and Vimball.txt +" (see |copyright|) except use "Vimball" instead of "Vim". +" No warranty, express or implied. +" *** *** Use At-Your-Own-Risk! *** *** + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_vimball") || v:version < 700 + finish +endif +let s:keepcpo = &cpo +let g:loaded_vimball = "v21" +set cpo&vim + +" ===================================================================== +" Constants: {{{1 +if !exists("s:USAGE") + let s:USAGE = 0 + let s:WARNING = 1 + let s:ERROR = 2 +endif + +" ===================================================================== +" Functions: {{{1 + +" --------------------------------------------------------------------- +" vimball#MkVimball: creates a vimball given a list of paths to files {{{2 +" Vimball Format: +" path +" filesize +" [file] +" path +" filesize +" [file] +fun! vimball#MkVimball(line1,line2,writelevel,...) range +" call Dfunc("MkVimball(line1=".a:line1." line2=".a:line2." writelevel=".a:writelevel." vimballname<".a:1.">) a:0=".a:0) + if a:1 =~ '.vim' || a:1 =~ '.txt' + let vbname= substitute(a:1,'\.\a\{3}$','.vba','') + else + let vbname= a:1 + endif + if vbname !~ '\.vba$' + let vbname= vbname.'.vba' + endif +" call Decho("vbname<".vbname.">") + if a:1 =~ '[\/]' + call vimball#ShowMesg(s:ERROR,"(MkVimball) vimball name<".a:1."> should not include slashes") +" call Dret("MkVimball : vimball name<".a:1."> should not include slashes") + return + endif + if !a:writelevel && filereadable(vbname) + call vimball#ShowMesg(s:ERROR,"(MkVimball) file<".vbname."> exists; use ! to insist") +" call Dret("MkVimball : file<".vbname."> already exists; use ! to insist") + return + endif + + " user option bypass + call s:SaveSettings() + + if a:0 >= 2 + " allow user to specify where to get the files + let home= expand(a:2) + else + " use first existing directory from rtp + let home= s:VimballHome() + endif + + " save current directory + let curdir = getcwd() + call s:ChgDir(home) + + " record current tab, initialize while loop index + let curtabnr = tabpagenr() + let linenr = a:line1 +" call Decho("curtabnr=".curtabnr) + + while linenr <= a:line2 + let svfile = getline(linenr) +" call Decho("svfile<".svfile.">") + + if !filereadable(svfile) + call vimball#ShowMesg(s:ERROR,"unable to read file<".svfile.">") + call s:ChgDir(curdir) + call s:RestoreSettings() +" call Dret("MkVimball") + return + endif + + " create/switch to mkvimball tab + if !exists("vbtabnr") + tabnew + silent! file Vimball + let vbtabnr= tabpagenr() + else + exe "tabn ".vbtabnr + endif + + let lastline= line("$") + 1 + if lastline == 2 && getline("$") == "" + call setline(1,'" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.') + call setline(2,'UseVimball') + call setline(3,'finish') + let lastline= line("$") + 1 + endif + call setline(lastline ,substitute(svfile,'$',' [[[1','')) + call setline(lastline+1,0) + + " write the file from the tab + let svfilepath= s:Path(svfile,'') +" call Decho("exe $r ".svfilepath) + exe "$r ".svfilepath + + call setline(lastline+1,line("$") - lastline - 1) +" call Decho("lastline=".lastline." line$=".line("$")) + + " restore to normal tab + exe "tabn ".curtabnr + let linenr= linenr + 1 + endwhile + + " write the vimball + exe "tabn ".vbtabnr + call s:ChgDir(curdir) + if a:writelevel + let vbnamepath= s:Path(vbname,'') +" call Decho("exe w! ".vbnamepath) + exe "w! ".vbnamepath + else + let vbnamepath= s:Path(vbname,'') +" call Decho("exe w ".vbnamepath) + exe "w ".vbnamepath + endif +" call Decho("Vimball<".vbname."> created") + echo "Vimball<".vbname."> created" + + " remove the evidence + setlocal nomod bh=wipe + exe "tabn ".curtabnr + exe "tabc ".vbtabnr + + " restore options + call s:RestoreSettings() + +" call Dret("MkVimball") +endfun + +" --------------------------------------------------------------------- +" vimball#Vimball: extract and distribute contents from a vimball {{{2 +fun! vimball#Vimball(really,...) +" call Dfunc("vimball#Vimball(really=".a:really.") a:0=".a:0) + + if getline(1) !~ '^" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.$' + echoerr "(Vimball) The current file does not appear to be a Vimball!" +" call Dret("vimball#Vimball") + return + endif + + " set up standard settings + call s:SaveSettings() + let curtabnr = tabpagenr() + + " set up vimball tab +" call Decho("setting up vimball tab") + tabnew + silent! file Vimball + let vbtabnr= tabpagenr() + let didhelp= "" + + " go to vim plugin home + if a:0 > 0 + let home= expand(a:1) + else + let home= s:VimballHome() + endif +" call Decho("home<".home.">") + + " save current directory and remove older same-named vimball, if any + let curdir = getcwd() +" call Decho("home<".home.">") +" call Decho("curdir<".curdir.">") + + call s:ChgDir(home) + call vimball#RmVimball() + + let linenr = 4 + let filecnt = 0 + + " give title to listing of (extracted) files from Vimball Archive + if a:really + echohl Title | echomsg "Vimball Archive" | echohl None + else + echohl Title | echomsg "Vimball Archive Listing" | echohl None + echohl Statement | echomsg "files would be placed under: ".home | echohl None + endif + + " apportion vimball contents to various files +" call Decho("exe tabn ".curtabnr) + exe "tabn ".curtabnr +" call Decho("linenr=".linenr." line$=".line("$")) + while 1 < linenr && linenr < line("$") + let fname = substitute(getline(linenr),'\t\[\[\[1$','','') + let fname = substitute(fname,'\\','/','g') + let fsize = getline(linenr+1) + let filecnt = filecnt + 1 +" call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt) + + if a:really + echomsg "extracted <".fname.">: ".fsize." lines" + else + echomsg "would extract <".fname.">: ".fsize." lines" + endif +" call Decho("using L#".linenr.": will extract file<".fname.">") +" call Decho("using L#".(linenr+1).": fsize=".fsize) + + " Allow AsNeeded/ directory to take place of plugin/ directory + " when AsNeeded/filename is filereadable + if fname =~ '\<plugin/' + let anfname= substitute(fname,'\<plugin/','AsNeeded/','') + if filereadable(anfname) +" call Decho("using anfname<".anfname."> instead of <".fname.">") + let fname= anfname + endif + endif + + " make directories if they don't exist yet + if a:really +" call Decho("making directories if they don't exist yet (fname<".fname.">)") + let fnamebuf= substitute(fname,'\\','/','g') + let dirpath = substitute(home,'\\','/','g') + while fnamebuf =~ '/' + let dirname = dirpath."/".substitute(fnamebuf,'/.*$','','') + let dirpath = dirname + let fnamebuf = substitute(fnamebuf,'^.\{-}/\(.*\)$','\1','') +" call Decho("dirname<".dirname.">") + if !isdirectory(dirname) +" call Decho("making <".dirname.">") + call mkdir(dirname) + call s:RecordInVar(home,"rmdir('".dirname."')") + endif + endwhile + endif + call s:ChgDir(home) + + " grab specified qty of lines and place into "a" buffer + " (skip over path/filename and qty-lines) + let linenr = linenr + 2 + let lastline = linenr + fsize - 1 +" call Decho("exe ".linenr.",".lastline."yank a") + exe "silent ".linenr.",".lastline."yank a" + + " copy "a" buffer into tab +" call Decho('copy "a buffer into tab#'.vbtabnr) + exe "tabn ".vbtabnr + silent! %d + silent put a + 1 + silent d + + " write tab to file + if a:really + let fnamepath= s:Path(home."/".fname,'') +" call Decho("exe w! ".fnamepath) + exe "silent w! ".fnamepath + echo "wrote ".fnamepath + call s:RecordInVar(home,"call delete('".fnamepath."')") + endif + + " return to tab with vimball +" call Decho("exe tabn ".curtabnr) + exe "tabn ".curtabnr + + " set up help if its a doc/*.txt file +" call Decho("didhelp<".didhelp."> fname<".fname.">") + if a:really && didhelp == "" && fname =~ 'doc/[^/]\+\.txt$' + let didhelp= substitute(fname,'^\(.*\<doc\)[/\\][^.]*\.txt$','\1','') +" call Decho("didhelp<".didhelp.">") + endif + + " update for next file +" let oldlinenr = linenr " Decho + let linenr = linenr + fsize +" call Decho("update linenr= [linenr=".oldlinenr."] + [fsize=".fsize."] = ".linenr) + endwhile + + " set up help +" call Decho("about to set up help: didhelp<".didhelp.">") + if didhelp != "" + let htpath= escape(substitute(s:Path(home."/".didhelp,'"'),'"','','g'),' ') +" call Decho("exe helptags ".htpath) + exe "helptags ".htpath + echo "did helptags" + endif + + " make sure a "Press ENTER..." prompt appears to keep the messages showing! + while filecnt <= &ch + echomsg " " + let filecnt= filecnt + 1 + endwhile + + " record actions in <.VimballRecord> + call s:RecordInFile(home) + + " restore events, delete tab and buffer + exe "tabn ".vbtabnr + setlocal nomod bh=wipe + exe "tabn ".curtabnr + exe "tabc ".vbtabnr + call s:RestoreSettings() + call s:ChgDir(curdir) + +" call Dret("vimball#Vimball") +endfun + +" --------------------------------------------------------------------- +" vimball#RmVimball: remove any files, remove any directories made by any {{{2 +" previous vimball extraction based on a file of the current +" name. +" Usage: RmVimball (assume current file is a vimball; remove) +" RmVimball vimballname +fun! vimball#RmVimball(...) +" call Dfunc("vimball#RmVimball() a:0=".a:0) + if exists("g:vimball_norecord") +" call Dret("vimball#RmVimball : (g:vimball_norecord)") + return + endif + let eikeep= &ei + set ei=all +" call Decho("turned off all events") + + if a:0 == 0 + let curfile= '^'.expand("%:tr") + else + if a:1 =~ '[\/]' + call vimball#ShowMesg(s:USAGE,"RmVimball vimballname [path]") +" call Dret("vimball#RmVimball : suspect a:1<".a:1.">") + return + endif + let curfile= a:1 + endif + if curfile !~ '.vba$' + let curfile= curfile.".vba: " + else + let curfile= curfile.": " + endif + if a:0 >= 2 + let home= expand(a:2) + else + let home= s:VimballHome() + endif + let curdir = getcwd() +" call Decho("home <".home.">") +" call Decho("curfile<".curfile.">") +" call Decho("curdir <".curdir.">") + + call s:ChgDir(home) + if filereadable(".VimballRecord") +" call Decho(".VimballRecord is readable") +" call Decho("curfile<".curfile.">") + keepalt keepjumps 1split + silent! keepalt keepjumps e .VimballRecord + let keepsrch= @/ + if search(curfile,'cw') + let exestring= substitute(getline("."),curfile,'','') +" call Decho("exe ".exestring) + silent! keepalt keepjumps exe exestring + silent! keepalt keepjumps d + else +" call Decho("unable to find <".curfile."> in .VimballRecord") + endif + silent! keepalt keepjumps g/^\s*$/d + silent! keepalt keepjumps wq! + let @/= keepsrch + endif + call s:ChgDir(curdir) + + " restoring events +" call Decho("restoring events") + let &ei= eikeep + +" call Dret("vimball#RmVimball") +endfun + +" --------------------------------------------------------------------- +" vimball#Decompress: attempts to automatically decompress vimballs {{{2 +fun! vimball#Decompress(fname) +" call Dfunc("Decompress(fname<".a:fname.">)") + + " decompression: + if expand("%") =~ '.*\.gz' && executable("gunzip") + exe "!gunzip ".a:fname + let fname= substitute(a:fname,'\.gz$','','') + exe "e ".escape(fname,' \') + call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") + elseif expand("%") =~ '.*\.bz2' && executable("bunzip2") + exe "!bunzip2 ".a:fname + let fname= substitute(a:fname,'\.bz2$','','') + exe "e ".escape(fname,' \') + call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") + elseif expand("%") =~ '.*\.zip' && executable("unzip") + exe "!unzip ".a:fname + let fname= substitute(a:fname,'\.zip$','','') + exe "e ".escape(fname,' \') + call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") + endif + set noma bt=nofile fmr=[[[,]]] fdm=marker + +" call Dret("Decompress") +endfun + +" --------------------------------------------------------------------- +" vimball#ShowMesg: {{{2 +fun! vimball#ShowMesg(level,msg) +" call Dfunc("vimball#ShowMesg(level=".a:level." msg<".a:msg.">)") + let rulerkeep = &ruler + let showcmdkeep = &showcmd + set noruler noshowcmd + redraw! + + if &fo =~ '[ta]' + echomsg "***vimball*** " a:msg + else + if a:level == s:WARNING || a:level == s:USAGE + echohl WarningMsg + elseif a:level == s:ERROR + echohl Error + endif + echomsg "***vimball*** " a:msg + echohl None + endif + + if a:level != s:USAGE + call inputsave()|let ok= input("Press <cr> to continue")|call inputrestore() + endif + + let &ruler = rulerkeep + let &showcmd = showcmdkeep + +" call Dret("vimball#ShowMesg") +endfun + +" --------------------------------------------------------------------- +let &cpo= s:keepcpo +unlet s:keepcpo +" ===================================================================== +" s:ChgDir: change directory (in spite of Windoze) {{{2 +fun! s:ChgDir(newdir) +" call Dfunc("ChgDir(newdir<".a:newdir.">)") + if (has("win32") || has("win95") || has("win64") || has("win16")) + exe 'silent cd '.escape(substitute(a:newdir,'/','\\','g'),' ') + else + exe 'silent cd '.escape(a:newdir,' ') + endif +" call Dret("ChgDir") +endfun + +" --------------------------------------------------------------------- +" s:Path: prepend and append quotes, do escaping, as necessary {{{2 +fun! s:Path(cmd,quote) +" call Dfunc("Path(cmd<".a:cmd."> quote<".a:quote.">)") + if (has("win32") || has("win95") || has("win64") || has("win16")) + let cmdpath= a:quote.substitute(a:cmd,'/','\\','g').a:quote + else + let cmdpath= a:quote.a:cmd.a:quote + endif + if a:quote == "" + let cmdpath= escape(cmdpath,' ') + endif +" call Dret("Path <".cmdpath.">") + return cmdpath +endfun + +" --------------------------------------------------------------------- +" s:RecordInVar: record a un-vimball command in the .VimballRecord file {{{2 +fun! s:RecordInVar(home,cmd) +" call Dfunc("RecordInVar(home<".a:home."> cmd<".a:cmd.">)") + if a:cmd =~ '^rmdir' +" if !exists("s:recorddir") +" let s:recorddir= substitute(a:cmd,'^rmdir',"call s:Rmdir",'') +" else +" let s:recorddir= s:recorddir."|".substitute(a:cmd,'^rmdir',"call s:Rmdir",'') +" endif +" call Decho("recorddir=".s:recorddir) + elseif !exists("s:recordfile") + let s:recordfile= a:cmd +" call Decho("recordfile=".s:recordfile) + else + let s:recordfile= s:recordfile."|".a:cmd +" call Decho("recordfile=".s:recordfile) + endif +" call Dret("RecordInVar") +endfun + +" --------------------------------------------------------------------- +" s:RecordInFile: {{{2 +fun! s:RecordInFile(home) +" call Dfunc("RecordInFile()") + if exists("g:vimball_norecord") +" call Dret("RecordInFile : (g:vimball_norecord)") + return + endif + + if exists("s:recordfile") || exists("s:recorddir") + let curdir= getcwd() + call s:ChgDir(a:home) + keepalt keepjumps 1split + let cmd= expand("%:tr").": " + silent! keepalt keepjumps e .VimballRecord + $ + if exists("s:recordfile") && exists("s:recorddir") + let cmd= cmd.s:recordfile."|".s:recorddir + elseif exists("s:recorddir") + let cmd= cmd.s:recorddir + elseif exists("s:recordfile") + let cmd= cmd.s:recordfile + else +" call Dret("RecordInFile") + return + endif + keepalt keepjumps put=cmd + silent! keepalt keepjumps g/^\s*$/d + silent! keepalt keepjumps wq! + call s:ChgDir(curdir) + if exists("s:recorddir") |unlet s:recorddir |endif + if exists("s:recordfile")|unlet s:recordfile|endif + else +" call Decho("s:record[file|dir] doesn't exist") + endif + +" call Dret("RecordInFile") +endfun + +" --------------------------------------------------------------------- +" s:Rmdir: {{{2 +"fun! s:Rmdir(dirname) +"" call Dfunc("s:Rmdir(dirname<".a:dirname.">)") +" if (has("win32") || has("win95") || has("win64") || has("win16")) && &shell !~? 'sh$' +" call system("del ".a:dirname) +" else +" call system("rmdir ".a:dirname) +" endif +"" call Dret("s:Rmdir") +"endfun + +" --------------------------------------------------------------------- +" s:VimballHome: determine/get home directory path (usually from rtp) {{{2 +fun! s:VimballHome() +" call Dfunc("VimballHome()") + if exists("g:vimball_home") + let home= g:vimball_home + else + " go to vim plugin home + for home in split(&rtp,',') + [''] + if isdirectory(home) && filewritable(home) | break | endif + endfor + if home == "" + " just pick the first directory + let home= substitute(&rtp,',.*$','','') + endif + if (has("win32") || has("win95") || has("win64") || has("win16")) + let home= substitute(home,'/','\\','g') + endif + endif +" call Dret("VimballHome <".home.">") + return home +endfun + +" --------------------------------------------------------------------- +" s:SaveSettings: {{{2 +fun! s:SaveSettings() +" call Dfunc("SaveSettings()") + let s:makeep = getpos("'a") + let s:regakeep= @a + if exists("&acd") + let s:acdkeep = &acd + endif + let s:eikeep = &ei + let s:fenkeep = &fen + let s:hidkeep = &hidden + let s:ickeep = &ic + let s:repkeep = &report + let s:vekeep = &ve + let s:lzkeep = &lz + if exists("&acd") + set ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz + else + set ei=all ve=all nofen noic report=999 nohid bt= ma lz + endif +" call Dret("SaveSettings") +endfun + +" --------------------------------------------------------------------- +" s:RestoreSettings: {{{2 +fun! s:RestoreSettings() +" call Dfunc("RestoreSettings()") + let @a = s:regakeep + if exists("&acd") + let &acd = s:acdkeep + endif + let &fen = s:fenkeep + let &hidden = s:hidkeep + let &ic = s:ickeep + let &lz = s:lzkeep + let &report = s:repkeep + let &ve = s:vekeep + let &ei = s:eikeep + if s:makeep[0] != 0 + " restore mark a +" call Decho("restore mark-a: makeep=".string(makeep)) + call setpos("'a",s:makeep) + endif + if exists("&acd") + unlet s:regakeep s:acdkeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep + else + unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep + endif + set bt=nofile noma +" call Dret("RestoreSettings") +endfun + +" --------------------------------------------------------------------- +" Modelines: {{{1 +" vim: fdm=marker diff --git a/vimfiles/autoload/visincr.vim b/vimfiles/autoload/visincr.vim new file mode 100644 index 0000000..8361e42 --- /dev/null +++ b/vimfiles/autoload/visincr.vim @@ -0,0 +1,864 @@ +" visincr.vim: Visual-block incremented lists +" Author: Charles E. Campbell, Jr. Ph.D. +" Date: Sep 19, 2006 +" Version: 17 +" +" Visincr assumes that a block of numbers selected by a +" ctrl-v (visual block) has been selected for incrementing. +" This function will transform that block of numbers into +" an incrementing column starting from that topmost number +" in the visual block. Also handles dates, daynames, and +" monthnames. +" +" Fancy Stuff: +" * If the visual block is ragged right (as can happen when "$" +" is used to select the right hand side), the block will have +" spaces appended to straighten it out +" * If the strlen of the count exceeds the visual-block +" allotment of spaces, then additional spaces will be inserted +" * Handles leading tabs by using virtual column calculations +" GetLatestVimScripts: 670 1 :AutoInstall: visincr.vim +" 1Cor 16:14 : Let all that you do be done in love. {{{1 + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_visincr") + finish +endif +let s:keepcpo = &cpo +let g:loaded_visincr = "v17" +set cpo&vim + +" --------------------------------------------------------------------- +" Methods: {{{1 +let s:I = 0 +let s:II = 1 +let s:IMDY = 2 +let s:IYMD = 3 +let s:IDMY = 4 +let s:ID = 5 +let s:IM = 6 +let s:IA = 7 +let s:IX = 8 +let s:IIX = 9 +let s:IO = 10 +let s:IIO = 11 +let s:IR = 12 +let s:IIR = 13 +let s:RI = 14 +let s:RII = 15 +let s:RIMDY = 16 +let s:RIYMD = 17 +let s:RIDMY = 18 +let s:RID = 19 +let s:RIM = 20 + +" ------------------------------------------------------------------------------ +" Options: {{{1 +if !exists("g:visincr_leaddate") + " choose between dates such as 11/ 5/04 and 11/05/04 + let g:visincr_leaddate = '0' +endif +if !exists("g:visincr_datedivset") + let g:visincr_datedivset= '[-./]' +endif + +" ============================================================================== +" Functions: {{{1 + +" ------------------------------------------------------------------------------ +" VisBlockIncr: {{{2 +fun! visincr#VisBlockIncr(method,...) +" call Dfunc("VisBlockIncr(method<".a:method.">) a:0=".a:0) + + " avoid problems with user options {{{3 + call s:SaveUserOptions() + + " visblockincr only uses visual-block! {{{3 +" call Decho("visualmode<".visualmode().">") + if visualmode() != "\<c-v>" + echoerr "Please use visual-block mode (ctrl-v)!" + call s:RestoreUserOptions() +" call Dret("VisBlockIncr") + return + endif + + " save boundary line numbers and set up method {{{3 + let y1 = line("'<") + let y2 = line("'>") + let method = (a:method >= s:RI)? a:method - s:RI : a:method + let leaddate= g:visincr_leaddate + + " get increment (default=1) {{{3 + if a:0 > 0 + let incr= a:1 + if a:method == s:IX || a:method == s:IIX + let incr= s:Hex2Dec(incr) + elseif a:method == s:IO || a:method == s:IIO + let incr= s:Oct2Dec(incr) + endif + else + let incr= 1 + endif +" call Decho("incr=".incr) + + " set up restriction pattern {{{3 + let leftcol = virtcol("'<") + let rghtcol = virtcol("'>") + if leftcol > rghtcol + let leftcol = virtcol("'>") + let rghtcol = virtcol("'<") + endif + let width= rghtcol - leftcol + 1 +" call Decho("width= [rghtcol=".rghtcol."]-[leftcol=".leftcol."]+1=".width) + + if a:method == s:RI + let restrict= '\%'.col(".").'c\d' +" call Decho(":I restricted<".restrict.">") + + elseif a:method == s:RII + let restrict= '\%'.col(".").'c\s\{,'.width.'}\d' +" call Decho(":II restricted<".restrict.">") + + elseif a:method == s:RIMDY + let restrict= '\%'.col(".").'c\d\{1,2}'.g:visincr_datedivset.'\d\{1,2}'.g:visincr_datedivset.'\d\{2,4}' +" call Decho(":IMDY restricted<".restrict.">") + + elseif a:method == s:RIYMD + let restrict= '\%'.col(".").'c\d\{2,4}'.g:visincr_datedivset.'\d\{1,2}'.g:visincr_datedivset.'\d\{1,2}' +" call Decho(":IYMD restricted<".restrict.">") + + elseif a:method == s:RIDMY + let restrict= '\%'.col(".").'c\d\{1,2}'.g:visincr_datedivset.'\d\{1,2}'.g:visincr_datedivset.'\d\{2,4}' +" call Decho(":IDMY restricted<".restrict.">") + + elseif a:method == s:RID + if exists("g:visincr_dow") + let dowlist = substitute(g:visincr_dow,'\(\a\{1,3}\)[^,]*\%(,\|$\)','\1\\|','ge') + let dowlist = substitute(dowlist,'\\|$','','e') + let restrict= '\c\%'.col(".").'c\('.substitute(dowlist,',','\\|','ge').'\)' +" call Decho("restrict<".restrict.">") + else + let restrict= '\c\%'.col(".").'c\(mon\|tue\|wed\|thu\|fri\|sat\|sun\)' + endif +" call Decho(":ID restricted<".restrict.">") + + elseif a:method == s:RIM + if exists("g:visincr_month") + let monlist = substitute(g:visincr_month,'\(\a\{1,3}\)[^,]*\%(,\|$\)','\1\\|','ge') + let monlist = substitute(monlist,'\\|$','','e') + let restrict= '\c\%'.col(".").'c\('.substitute(monlist,',','\\|','ge').'\)' +" call Decho("restrict<".restrict.">") + else + let restrict= '\c\%'.col(".").'c\(jan\|feb\|mar\|apr\|may\|jun\|jul\|aug\|sep\|oct\|nov\|dec\)' + endif +" call Decho(":IM restricted<".restrict.">") + endif + + " determine zfill {{{3 +" call Decho("a:0=".a:0." method=".method) + if a:0 > 1 && ((s:IMDY <= method && method <= s:IDMY) || (s:RIMDY <= method && method <= s:RIDMY)) + let leaddate= a:2 +" call Decho("set leaddate<".leaddate.">") + elseif a:0 > 1 && method + let zfill= a:2 + if zfill == "''" || zfill == '""' + let zfill="" + endif +" call Decho("set zfill<".zfill.">") + else + " default zfill (a single space) + let zfill= ' ' +" call Decho("set default zfill<".zfill.">") + endif + + " IMDY IYMD IDMY ID IM IA: {{{3 + if s:IMDY <= method && method <= s:IA + let rghtcol = rghtcol + 1 + let curline = getline("'<") + + " ID: {{{3 + if method == s:ID + let pat = '^.*\%'.leftcol.'v\(\a\+\)\%'.rghtcol.'v.*$' + let dow = substitute(substitute(curline,pat,'\1','e'),' ','','ge') + let dowlen = strlen(dow) +" call Decho("pat<".pat."> dow<".dow."> dowlen=".dowlen) + + " set up long daynames + if exists("g:visincr_dow") + let dow_0= substitute(g:visincr_dow,'^\([^,]*\),.*$', '\1','') + let dow_1= substitute(g:visincr_dow,'^\%([^,]*,\)\{1}\([^,]*\),.*$','\1','') + let dow_2= substitute(g:visincr_dow,'^\%([^,]*,\)\{2}\([^,]*\),.*$','\1','') + let dow_3= substitute(g:visincr_dow,'^\%([^,]*,\)\{3}\([^,]*\),.*$','\1','') + let dow_4= substitute(g:visincr_dow,'^\%([^,]*,\)\{4}\([^,]*\),.*$','\1','') + let dow_5= substitute(g:visincr_dow,'^\%([^,]*,\)\{5}\([^,]*\),.*$','\1','') + let dow_6= substitute(g:visincr_dow,'^\%([^,]*,\)\{6}\([^,]*\)$', '\1','') + else + let dow_0= "Monday" + let dow_1= "Tuesday" + let dow_2= "Wednesday" + let dow_3= "Thursday" + let dow_4= "Friday" + let dow_5= "Saturday" + let dow_6= "Sunday" + endif + + " if the daynames under the cursor is <= 3, transform + " long daynames to short daynames + if strlen(dow) <= 3 +" call Decho("transform long daynames to short daynames") + let dow_0= strpart(dow_0,0,3) + let dow_1= strpart(dow_1,0,3) + let dow_2= strpart(dow_2,0,3) + let dow_3= strpart(dow_3,0,3) + let dow_4= strpart(dow_4,0,3) + let dow_5= strpart(dow_5,0,3) + let dow_6= strpart(dow_6,0,3) + endif + + " identify day-of-week under cursor + let idow= 0 + while idow < 7 +" call Decho("dow<".dow."> dow_".idow."<".dow_{idow}.">") + if dow =~ '\c\<'.strpart(dow_{idow},0,3) + break + endif + let idow= idow + 1 + endwhile + if idow >= 7 + echoerr "***error*** misspelled day-of-week <".dow.">" + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : unable to identify day-of-week") + return + endif + + " generate incremented dayname list + norm! `< + norm! gUl + norm! `< + let l = y1 + while l < y2 + norm! j +" call Decho("while [l=".l."] < [y2=".y2."]: line=".line(".")." col[".leftcol.",".rghtcol."] width=".width) + if exists("restrict") && getline(".") !~ restrict + let l= l + 1 + continue + endif + let idow= (idow + incr)%7 + exe 's/\%'.leftcol.'v.\{'.width.'\}/'.dow_{idow}.'/e' + let l= l + 1 + endw + " return from ID + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : ID") + return + endif + + " IM: {{{3 + if method == s:IM + let pat = '^.*\%'.leftcol.'v\(\a\+\)\%'.rghtcol.'v.*$' + let mon = substitute(substitute(curline,pat,'\1','e'),' ','','ge') + let monlen = strlen(mon) + if exists("g:visincr_month") + let mon_0 = substitute(g:visincr_month,'^\([^,]*\),.*$', '\1','') + let mon_1 = substitute(g:visincr_month,'^\%([^,]*,\)\{1}\([^,]*\),.*$', '\1','') + let mon_2 = substitute(g:visincr_month,'^\%([^,]*,\)\{2}\([^,]*\),.*$', '\1','') + let mon_3 = substitute(g:visincr_month,'^\%([^,]*,\)\{3}\([^,]*\),.*$', '\1','') + let mon_4 = substitute(g:visincr_month,'^\%([^,]*,\)\{4}\([^,]*\),.*$', '\1','') + let mon_5 = substitute(g:visincr_month,'^\%([^,]*,\)\{5}\([^,]*\),.*$', '\1','') + let mon_6 = substitute(g:visincr_month,'^\%([^,]*,\)\{6}\([^,]*\),.*$', '\1','') + let mon_7 = substitute(g:visincr_month,'^\%([^,]*,\)\{7}\([^,]*\),.*$', '\1','') + let mon_8 = substitute(g:visincr_month,'^\%([^,]*,\)\{8}\([^,]*\),.*$', '\1','') + let mon_9 = substitute(g:visincr_month,'^\%([^,]*,\)\{9}\([^,]*\),.*$', '\1','') + let mon_10= substitute(g:visincr_month,'^\%([^,]*,\)\{10}\([^,]*\),.*$','\1','') + let mon_11= substitute(g:visincr_month,'^\%([^,]*,\)\{11}\([^,]*\)$', '\1','') + else + let mon_0 = "January" + let mon_1 = "February" + let mon_2 = "March" + let mon_3 = "April" + let mon_4 = "May" + let mon_5 = "June" + let mon_6 = "July" + let mon_7 = "August" + let mon_8 = "September" + let mon_9 = "October" + let mon_10= "November" + let mon_11= "December" + endif + + " identify month under cursor + let imon= 0 + while imon < 12 + if mon =~ '\c\<'.strpart(mon_{imon},0,3) + break + endif + let imon= imon + 1 + endwhile + if imon >= 12 + echoerr "***error*** misspelled month <".mon.">" + call s:RestoreUserOptions() +" call Dret("VisBlockIncr") + return + endif + + " if monthname is three or fewer characters long, + " transform monthnames to three character versions + if strlen(mon) <= 3 +" call Decho("transform monthnames to short versions") + let jmon= 0 + while jmon < 12 + let mon_{jmon} = strpart(mon_{jmon},0,3) + let jmon = jmon + 1 + endwhile + endif + + " generate incremented monthname list + norm! `< + norm! gUl + norm! `< + let l = y1 + while l < y2 + norm! j + if exists("restrict") && getline(".") !~ restrict + let l= l + 1 + continue + endif + let imon= (imon + incr)%12 + exe 's/\%'.leftcol.'v.\{'.width.'\}/'.mon_{imon}.'/e' + let l= l + 1 + endw + " return from IM + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : IM") + return + endif + + " IA: {{{3 + if method == s:IA + let pat = '^.*\%'.leftcol.'v\(\a\).*$' + let letter = substitute(curline,pat,'\1','e') + if letter !~ '\a' + let letter= 'A' + endif + if letter =~ '[a-z]' + let alphabet='abcdefghijklmnopqrstuvwxyz' + else + let alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ' + endif + let ilet= stridx(alphabet,letter) + + norm! `< + let l = y1 + while l <= y2 +" call Decho("letter<".letter."> l=".l." ilet=".ilet) + exe 's/\%'.leftcol.'v.*\%'.rghtcol.'v/'.letter.'/e' + let ilet = (ilet + incr)%26 + let letter = strpart(alphabet,ilet,1) + if l < y2 + silent norm! j + endif + let l= l + 1 + endw + " return from IA + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : IA") + return + endif + + let pat = '^.*\%'.leftcol.'v\( \=[0-9]\{1,4}\)'.g:visincr_datedivset.'\( \=[0-9]\{1,2}\)'.g:visincr_datedivset.'\( \=[0-9]\{1,4}\)\%'.rghtcol.'v.*$' + let datediv= substitute(curline,'^.*\%'.leftcol.'v\%( \=[0-9]\{1,4}\)\('.g:visincr_datedivset.'\).*$','\1','') +" call Decho("datediv<".datediv.">") + + " IMDY: {{{3 + if method == s:IMDY + let m = substitute(substitute(curline,pat,'\1',''),' ','','ge')+0 + let d = substitute(substitute(curline,pat,'\2',''),' ','','ge')+0 + let y = substitute(substitute(curline,pat,'\3',''),' ','','ge')+0 + let type = 2 +" call Decho("IMDY: y=".y." m=".m." d=".d." leftcol=".leftcol." rghtcol=".rghtcol) + + " IYMD: {{{3 + elseif method == s:IYMD + let y = substitute(substitute(curline,pat,'\1',''),' ','','ge')+0 + let m = substitute(substitute(curline,pat,'\2',''),' ','','ge')+0 + let d = substitute(substitute(curline,pat,'\3',''),' ','','ge')+0 + let type = 1 +" call Decho("IYMD: y=".y." m=".m." d=".d." leftcol=".leftcol." rghtcol=".rghtcol) + + " IDMY: {{{3 + elseif method == s:IDMY + let d = substitute(substitute(curline,pat,'\1',''),' ','','ge')+0 + let m = substitute(substitute(curline,pat,'\2',''),' ','','ge')+0 + let y = substitute(substitute(curline,pat,'\3',''),' ','','ge')+0 + let type = 3 +" call Decho("IDMY: y=".y." m=".m." d=".d." leftcol=".leftcol." rghtcol=".rghtcol) + else + echoerr "***error*** in <visincr.vim> script" +" call Dret("VisBlockIncr -- method#".method." not supported") + return + endif + + " Julian day/Calendar day calculations {{{3 + try + let julday= calutil#Cal2Jul(y,m,d) + catch /^Vim\%((\a\+)\)\=:E/ + echoerr "***error*** you need calutil.vim! (:help visincr-calutil)" +" call Dret("VisBlockIncr") + return + endtry + norm! `< + let l = y1 + while l <= y2 + if exists("restrict") && getline(".") !~ restrict + norm! j + let l= l + 1 + continue + endif + let doy = calutil#Jul2Cal(julday,type) + + " IYMD: {{{3 + if type == 1 + let doy = substitute(doy,'^\d/',leaddate.'&','e') + let doy = substitute(doy,'/\(\d/\)','/'.leaddate.'\1','e') + let doy = substitute(doy,'/\(\d\)$','/'.leaddate.'\1','e') + + " IMDY IDMY: {{{3 + else + let doy = substitute(doy,'^\d/',' &','e') + let doy = substitute(doy,'/\(\d/\)','/'.leaddate.'\1','e') + let doy = substitute(doy,'/\(\d\)$','/'.leaddate.'\1','e') + endif + + " use user's date divider + if datediv != '/' + let doy= substitute(doy,'/',datediv,'g') + else + let doy= escape(doy,'/') + endif +" call Decho("doy<".doy.">") + + if leaddate != ' ' + let doy= substitute(doy,' ',leaddate,'ge') + endif +" call Decho('exe s/\%'.leftcol.'v.*\%'.rghtcol.'v/'.doy.'/e') + exe 's/\%'.leftcol.'v.*\%'.rghtcol.'v/'.doy.'/e' + let l = l + 1 + let julday= julday + incr + if l <= y2 + norm! j + endif + endw + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : IMDY IYMD IDMY ID IM") + return + endif " IMDY IYMD IDMY ID IM + + " I II IX IIX IO IIO IR IIR: {{{3 + " construct a line from the first line that only has the number in it + let rml = rghtcol - leftcol + let rmlp1 = rml + 1 + let lm1 = leftcol - 1 +" call Decho("rmlp1=[rghtcol=".rghtcol."]-[leftcol=".leftcol."]+1=".rmlp1) +" call Decho("lm1 =[leftcol=".leftcol."]-1=".lm1) + + if lm1 <= 0 + " region beginning at far left +" call Decho("handle visblock at far left") + let lm1 = 1 + let pat = '^\([0-9 \t]\{1,'.rmlp1.'}\).*$' + if method == s:IX || method == s:IIX + let pat = '^\([0-9a-fA-F \t]\{1,'.rmlp1.'}\).*$' + elseif method == s:IR || method == s:IIR + if getline(".") =~ '^\(.\{-}\)\%'.leftcol.'v\([0-9 \t]\{1,'.rmlp1.'}\).*$' + " need to convert arabic notation to roman numeral + let pat = '^\([0-9IVXCLM) \t]\{1,'.rmlp1.'}\).*$' + else + let pat = '^\([IVXCLM) \t]\{1,'.rmlp1.'}\).*$' + endif + else + let pat = '^\([0-9 \t]\{1,'.rmlp1.'}\).*$' + endif + let cnt = substitute(getline("'<"),pat,'\1',"") + + else + " region not beginning at far left +" call Decho("handle visblock not at far left") + if method == s:IX || method == s:IIX + let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-9a-fA-F \t]\{1,'.rmlp1.'}\).*$' + elseif method == s:IO || method == s:IIO + let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-7 \t]\{1,'.rmlp1.'}\).*$' + elseif method == s:IR || method == s:IIR +" call Decho('test: ^\(.\{-}\)\%'.leftcol.'v\([0-9 \t]\{1,'.rmlp1.'}\).*$') + if getline(".") =~ '^\(.\{-}\)\%'.leftcol.'v\([0-9 \t]\{1,'.rmlp1.'}\).*$' + " need to convert arabic notation to roman numeral + let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-9IVXCLM \t]\{1,'.rmlp1.'}\).*$' + else + let pat = '^\(.\{-}\)\%'.leftcol.'v\([IVXCLM \t]\{1,'.rmlp1.'}\).*$' + endif + else + let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-9 \t]\{1,'.rmlp1.'}\).*$' + endif +" call Decho("pat<".pat.">") + let cnt = substitute(getline("'<"),pat,'\2',"") + endif + + let cntlen = strlen(cnt) + let cnt = substitute(cnt,'\s','',"ge") + let ocnt = cnt +" call Decho("cntlen=".cntlen." cnt=".cnt." ocnt=".ocnt." (before I*[XOR] subs)") + + if method == s:IX || method == s:IIX + let cnt= substitute(cnt,'^0*\([1-9a-fA-F]\|0$\)','\1',"ge") + elseif method == s:IO || method == s:IIO + let cnt= substitute(cnt,'^0*\([1-7]\|0$\)','\1',"ge") + elseif method == s:IR || method == s:IIR + let cnt= substitute(cnt,'^\([IVXCLM]$\)','\1',"ge") + else + let cnt= substitute(cnt,'^0*\([1-9]\|0$\)','\1',"ge") + endif +" call Decho("cnt<".cnt."> pat<".pat.">") + + " left-method with zeros {{{3 + " IF top number is zero-mode + " AND we're justified right + " AND increment is positive + " AND user didn't specify a modeding character + if a:0 < 2 && ( method == s:II || method == s:IIX || method == s:IIO) && cnt != ocnt && incr > 0 + let zfill= '0' + endif + + " determine how much incrementing is needed {{{3 + if method == s:IX || method == s:IIX + let maxcnt= s:Dec2Hex(s:Hex2Dec(cnt) + incr*(y2 - y1)) + elseif method == s:IO || method == s:IIO + let maxcnt= s:Dec2Oct(s:Oct2Dec(cnt) + incr*(y2 - y1)) + elseif method == s:IR || method == s:IIR + if cnt =~ '^\d\+$' + let maxcnt= s:Dec2Rom(cnt + incr*(y2 - y1)) + else + let maxcnt= s:Dec2Rom(s:Rom2Dec(cnt) + incr*(y2 - y1)) + endif + else + let maxcnt= printf("%d",cnt + incr*(y2 - y1)) + endif + let maxcntlen= strlen(maxcnt) + if cntlen > maxcntlen + let maxcntlen= cntlen + endif + if method == s:IIR + let maxcntlen= maxcntlen + 2 + endif +" call Decho("maxcnt=".maxcnt." maxcntlen=".maxcntlen) + + " go through visual block incrementing numbers based {{{3 + " on first number (saved in cnt), taking care to + " avoid inadvertently issuing "0h" commands. + " l == current line number, over range [y1,y2] + norm! `< + let l = y1 + if (method == s:IR || method == s:IIR) && cnt =~ '^\d\+$' + let cnt= s:Dec2Rom(cnt) + endif + while l <= y2 +" call Decho("----- while [l=".l."] <= [y2=".y2."]: cnt=".cnt) + if exists("restrict") && getline(".") !~ restrict +" call Decho("skipping <".getline(".")."> (restrict)") + norm! j + let l= l + 1 + continue + endif + let cntlen= strlen(cnt) + + " Straighten out ragged-right visual-block selection {{{3 + " by appending spaces as needed + norm! $ + while virtcol("$") <= rghtcol + exe "norm! A \<Esc>" + endwhile + norm! 0 + + " convert visual block line to all spaces {{{3 + if virtcol(".") != leftcol + exe 'norm! /\%'.leftcol."v\<Esc>" + endif + exe "norm! " . rmlp1 . "r " + + " cnt has gotten bigger than the visually-selected {{{3 + " area allows. Will insert spaces to accommodate it. + if maxcntlen > 0 + let ins= maxcntlen - rmlp1 + else + let ins= strlen(cnt) - rmlp1 + endif + while ins > 0 + exe "norm! i \<Esc>" + let ins= ins - 1 + endwhile + + " back up to left-of-block (plus optional left-hand-side modeling) {{{3 + norm! 0 + if method == s:I || method == s:IO || method == s:IX || method == s:IR + let bkup= leftcol +" call Decho("bkup= [leftcol=".leftcol."] (due to method)") + elseif maxcntlen > 0 + let bkup= leftcol + maxcntlen - cntlen +" call Decho("bkup= [leftcol=".leftcol."]+[maxcntlen=".maxcntlen."]-[cntlen=".cntlen."]=".bkup) + else + let bkup= leftcol +" call Decho("bkup= [leftcol=".leftcol."] ([maxcntlen=".maxcntlen."]<=0)") + endif + if virtcol(".") != bkup + if bkup == 0 + norm! 0 + else + exe 'norm! /\%'.bkup."v\<Esc>" + endif + endif + + " replace with count {{{3 +" call Decho("exe norm! R" . cnt . "\<Esc>") + exe "norm! R" . cnt . "\<Esc>" + if cntlen > 1 + let cntlenm1= cntlen - 1 + exe "norm! " . cntlenm1 . "h" + endif + if zfill != " " + silent! exe 's/\%'.leftcol.'v\( \+\)/\=substitute(submatch(1)," ","'.zfill.'","ge")/e' + endif + + " set up for next line {{{3 + if l != y2 + norm! j + endif + if method == s:IX || method == s:IIX + let cnt= s:Dec2Hex(s:Hex2Dec(cnt) + incr) + elseif method == s:IO || method == s:IIO + let cnt= s:Dec2Oct(s:Oct2Dec(cnt) + incr) + elseif method == s:IR || method == s:IIR + let cnt= s:Dec2Rom(s:Rom2Dec(cnt) + incr) + else + let cnt= cnt + incr + endif + let l = l + 1 + endw + + " restore options: {{{3 + call s:RestoreUserOptions() +" call Dret("VisBlockIncr") +endfun + +" --------------------------------------------------------------------- +" Hex2Dec: convert hexadecimal to decimal {{{2 +fun! s:Hex2Dec(hex) +" call Dfunc("Hex2Dec(hex=".a:hex.")") + let hex= substitute(string(a:hex),"'","","ge") +" call Decho("hex<".hex.">") + if hex =~ '^-' + let n = strpart(hex,1) + let neg = 1 + else + let n = hex + let neg = 0 + endif +" call Decho("n<".n."> neg=".neg) + + let b10 = 0 + while n != "" + let hexdigit= strpart(n,0,1) + if hexdigit =~ '\d' + let hexdigit= char2nr(hexdigit) - char2nr('0') +" call Decho("0-9: hexdigit=".hexdigit) + elseif hexdigit =~ '[a-f]' + let hexdigit= char2nr(hexdigit) - char2nr('a') + 10 +" call Decho("a-f: hexdigit=".hexdigit) + else + let hexdigit= char2nr(hexdigit) - char2nr('A') + 10 +" call Decho("A-F: hexdigit=".hexdigit) + endif + let b10= 16*b10 + hexdigit + let n = strpart(n,1) + endwhile + + if neg + let b10= -b10 + endif +" call Dret("Hex2Dec ".b10) + return b10 +endfun + +" --------------------------------------------------------------------- +" Dec2Hex: convert decimal to hexadecimal {{{2 +fun! s:Dec2Hex(b10) +" call Dfunc("Dec2Hex(b10=".a:b10.")") + if a:b10 >= 0 + let b10 = a:b10 + let neg = 0 + else + let b10 = -a:b10 + let neg = 1 + endif +" call Decho('b10<'.b10.'> neg='.neg) + if v:version >= 700 + let hex= printf("%x",b10) + else + let hex = "" + while b10 + let hex = '0123456789abcdef'[b10 % 16] . hex + let b10 = b10 / 16 + endwhile + endif + if neg + let hex= "-".hex + endif +" call Dret("Dec2Hex ".hex) + return hex +endfun + +" --------------------------------------------------------------------- +" Oct2Dec: convert octal to decimal {{{2 +fun! s:Oct2Dec(oct) +" call Dfunc("Oct2Dec(oct=".a:oct.")") + if a:oct >= 0 + let n = a:oct + let neg= 0 + else + let n = strpart(a:oct,1) + let neg = 1 + endif + + let b10 = 0 + while n != "" + let octdigit= strpart(n,0,1) + if octdigit =~ '[0-7]' + let octdigit= char2nr(octdigit) - char2nr('0') +" call Decho("octdigit=".octdigit) + else + break + endif + let b10= 8*b10 + octdigit + let n = strpart(n,1) + endwhile + + if neg + let b10= -b10 + endif +" call Dret("Oct2Dec ".b10) + return b10 +endfun + +" --------------------------------------------------------------------- +" Dec2Oct: convert decimal to octal {{{2 +fun! s:Dec2Oct(b10) +" call Dfunc("Dec2Oct(b10=".a:b10.")") + if a:b10 >= 0 + let b10 = a:b10 + let neg = 0 + else + let b10 = -a:b10 + let neg = 1 + endif + + if v:version >= 700 + let oct= printf("%o",b10) + else + let oct = "" + while b10 + let oct = '01234567'[b10 % 8] . oct + let b10 = b10 / 8 + endwhile + endif + + if neg + let oct= "-".oct + endif +" call Dret("Dec2Oct ".oct) + return oct +endfun + +" ------------------------------------------------------------------------------ +" Roman Numeral Support: {{{2 +let s:d2r= [ [ 1000000 , 'M)' ],[900000 , 'CM)' ], [500000 , 'D)' ], [400000 , 'CD)' ], [100000 , 'C)' ], [90000 , 'XC)' ], [50000 , 'L)' ], [40000 , 'XL)' ], [10000 , 'X)' ], [9000 , 'IX)'], [5000 , 'V)'], [1000 , 'M' ], [900 , 'CM'], [500 , 'D'], [400 , 'CD'], [100 , 'C'], [90 , 'XC'], [50 , 'L'], [40 , 'XL'], [10 , 'X'], [9 , 'IX'], [5 , 'V'], [4 , 'IV'], [1 , 'I'] ] + +" --------------------------------------------------------------------- +" Rom2Dec: convert roman numerals to a decimal number {{{2 +fun! s:Rom2Dec(roman) +" call Dfunc("Rom2Dec(".a:roman.")") + let roman = substitute(a:roman,'.','\U&','ge') + let dec = 0 + + while roman != '' + for item in s:d2r + let pat= '^'.item[1] + if roman =~ pat + let dec= dec + item[0] + if strlen(item[1]) > 1 + let roman= strpart(roman,strlen(item[1])-1) + endif + break + endif + endfor + let roman= strpart(roman,1) + endwhile + +" call Dret("Rom2Dec ".dec) + return dec +endfun + +" --------------------------------------------------------------------- +" Dec2Rom: convert a decimal number to roman numerals {{{2 +" Note that since there is no zero or negative integers +" using Roman numerals, attempts to convert such will always +" result in "I". +fun! s:Dec2Rom(dec) +" call Dfunc("Dec2Rom(".a:dec.")") + if a:dec > 0 + let roman = "" + let dec = a:dec + let i = 0 + while dec > 0 + while dec >= s:d2r[i][0] + let dec = dec - s:d2r[i][0] + let roman = roman . s:d2r[i][1] + endwhile + let i= i + 1 + endwhile + else + let roman= "I" + endif +" call Dret("Dec2Rom ".roman) + return roman +endfun + +" --------------------------------------------------------------------- +" SaveUserOptions: {{{2 +fun! s:SaveUserOptions() +" call Dfunc("SaveUserOptions()") + let s:fokeep = &fo + let s:gdkeep = &gd + let s:ickeep = &ic + let s:magickeep = &magic + let s:reportkeep= &report + set fo=tcq magic report=9999 noic nogd +" call Dret("SaveUserOptions") +endfun + +" --------------------------------------------------------------------- +" RestoreUserOptions: {{{2 +fun! s:RestoreUserOptions() +" call Dfunc("RestoreUserOptions()") + let &fo = s:fokeep + let &gd = s:gdkeep + let &ic = s:ickeep + let &magic = s:magickeep + let &report= s:reportkeep +" call Dret("RestoreUserOptions") +endfun + +" --------------------------------------------------------------------- +" Restoration: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo +" ------------------------------------------------------------------------------ +" Modelines: {{{1 +" vim: ts=4 fdm=marker diff --git a/vimfiles/compiler/scons.vim b/vimfiles/compiler/scons.vim new file mode 100644 index 0000000..89f9efc --- /dev/null +++ b/vimfiles/compiler/scons.vim @@ -0,0 +1,8 @@ +if(exists("current_compiler")) + finish +endif +let current_compiler = "scons" + +"set errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%*\d]: Leaving directory `%f',%DMaking %*\a in %f + +set makeprg=scons\ -u\ \. diff --git a/vimfiles/doc/GetLatestVimScripts.txt b/vimfiles/doc/GetLatestVimScripts.txt new file mode 100644 index 0000000..b9e3082 --- /dev/null +++ b/vimfiles/doc/GetLatestVimScripts.txt @@ -0,0 +1,328 @@ +*getlatestvimscripts.txt* Get the Latest VimScripts Dec 23, 2005 + +Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz> + (remove NOSPAM from the email address) + *GetLatestVimScripts-copyright* +Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. + The VIM LICENSE applies to GetLatestVimScripts.vim and + GetLatestVimScripts.txt (see |copyright|) except use + "GetLatestVimScripts" instead of "Vim". + No warranty, express or implied. Use At-Your-Own-Risk. + + +============================================================================== +1. Contents *glvs-contents* + + 1. Contents...........................................: |glvs-contents| + 2. GetLatestVimScripts -- Getting Started.............: |glvs-install| + 3. GetLatestVimScripts Usage..........................: |glvs| + 4. GetLatestVimScripts Data File......................: |glvs-data| + 5. GetLatestVimScripts Plugins........................: |glvs-plugins| + 6. GetLatestVimScripts AutoInstall....................: |glvs-autoinstall| + 7. GetLatestVimScripts Algorithm......................: |glvs-alg| + 8. GetLatestVimScripts History........................: |glvs-hist| + + +============================================================================== +2. GetLatestVimScripts -- Getting Started *getlatestvimscripts-start* + *getlatestvimscripst-install* *glvs-install* + + The last step, that of renaming/moving the GetLatestVimScripts.dist + file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 + for the first time. The GetLatestVimScripts.dist file serves as an + example and a template for your own personal list. Feel free to remove + all the scripts mentioned within it; the "important" part of it is the + first two lines. + + Your computer needs to have wget for GetLatestVimScripts to do its work. + + 1. Unix: + cd $HOME/.vim + bunzip2 GetLatestVimScripts.tar.bz2 + tar -oxvf GetLatestVimScripts.tar + cd GetLatest + mv GetLatestVimScripts.dist GetLatestVimScripts.dat + vi + :helptags ~/.vim/doc + + 2. Windows: + cd + cd vimfiles + bunzip2 GetLatestVimScripts.tar.bz2 + tar -oxvf GetLatestVimScripts.tar + cd GetLatest + ren GetLatestVimScripts.dist GetLatestVimScripts.dat + vi + :helptags ~/vimfiles/doc + + +============================================================================== +3. GetLatestVimScripts Usage *getlatestvimscripts* *glvs* + + While in vim, type +> + :GetLatestVimScripts +< + Unless its been defined elsewhere, +> + :GLVS +< + will also work. + + The script will attempt to update and, if so directed, automatically + install scripts from http://vim.sourceforge.net/. To do so it will + peruse a file, [.vim|vimfiles]/GetLatest/GetLatestVimScripts.dat + (see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin + directory (see |glvs-plugin|). + + Scripts which have been downloaded will appear in the .../GetLatest + subdirectory. + + The <GetLatestVimScripts.dat> file will be automatically be updated to + reflect the latest version of script(s) so downloaded. + + +============================================================================== +4. GetLatestVimScripts Data File *getlatestvimscripts-data* *glvs-data* + + The Data file has a header which should appear as: +> + ScriptID SourceID Filename + -------------------------- +< + Below that are three columns; the first two are numeric followed by a + text column. + + The first number on each line gives the script's ScriptID. When you're + about to use a web browser to look at scripts on http://vim.sf.net/, just + before you click on the script's link, you'll see a line resembling + + http://vim.sourceforge.net/scripts/script.php?script_id=40 + + The "40" happens to be a ScriptID that GetLatestVimScripts needs to + download the associated page. + + The second number on each line gives the script's SourceID. The SourceID + records the count of uploaded scripts as determined by vim.sf.net; hence + it serves to indicate "when" a script was uploaded. Setting the SourceID + to 1 insures that GetLatestVimScripts will assume that the script it has + is out-of-date. + + The SourceID is extracted by GetLatestVimScripts from the script's page on + vim.sf.net; whenever its greater than the one stored in the + GetLatestVimScripts.dat file, the script will be downloaded. + + If your script's author has included a special comment line in his/her + plugin, the plugin itself will be used by GetLatestVimScripts to build + your <GetLatestVimScripts.dat> file, including any dependencies on + other scripts it may have. + + If your comment field begins with :AutoInstall:, GetLatestVimScripts will + attempt to automatically install the script. Thus, GetLatestVimScripts + thus provides a comprehensive ability to keep your plugins up-to-date! + +============================================================================== +5. GetLatestVimScripts Plugins *getlatestvimscripts-plugins* *glvs-plugins* + + + If a plugin author includes the following comment anywhere in their + plugin, GetLatestVimScripts will find it and use it to build user's + GetLatestVimScripts.dat files: +> + src_id + v + " GetLatestVimScripts: ### ### yourscriptname + ^ + scriptid +< + As an author, you should include such a line in to refer to your own + script plus any additional lines describing any plugin dependencies it + may have. Same format, of course! + + If your command is auto-installable (see |glvs-autoinstall|), and most + scripts are, then you may include :AutoInstall: at the start of + "yourscriptname". + + GetLatestVimScript commands for those scripts are then appended, if not + already present, to the user's GetLatest/GetLatestVimScripts.dat file. + Its a relatively painless way to automate the acquisition of any scripts + your plugins depend upon. + + Now, as an author, you probably don't want GetLatestVimScripts to download + your own scripts for you yourself, thereby overwriting your + not-yet-released hard work. GetLatestVimScripts provides a solution for + this: put +> + 0 0 yourscriptname +< + into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will + skip examining the "yourscriptname" scripts for those GetLatestVimScript + comment lines. As a result, those lines won't be inadvertently installed + into your <GetLatestVimScripts.dat> file and subsequently used to download + your own scripts. This is especially important to do if you've included + the :AutoInstall: option. + + Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line + as you've used in your GetLatestVimScript comment! + + +============================================================================== +6. GetLatestVimScripts AutoInstall *getlatestvimscripts-autoinstall* + *glvs-autoinstall* + + GetLatestVimScripts now supports "AutoInstall". Not all scripts are + supportive of auto-install, as they may have special things you need to do + to install them (please refer to the script's "install" directions). On + the other hand, most scripts will be auto-installable. + + To let GetLatestVimScripts do an autoinstall, the data file's comment + field should begin with (surrounding blanks are ignored): + + :AutoInstall: + + Both colons are needed, and it should begin the comment (yourscriptname) + field. + + One may prevent any autoinstalling by putting the following line + in your <.vimrc>: +> + let g:GetLatestVimScripts_allowautoinstall= 0 +< + + With :AutoInstall: enabled, as it is by default, files which end with + + ---.tar.bz2 : decompressed and untarred in [.vim|vimfiles] directory + ---.tar.gz : decompressed and untarred in [.vim|vimfiles] directory + ---.vim.bz2 : decompressed and moved to the .vim/plugin directory + ---.vim.gz : decompressed and moved to the .vim/plugin directory + ---.zip : unzipped in [.vim|vimfiles] directory + ---.vim : moved to [.vim|vimfiles]/plugin directory + + and which merely need to have their components placed by the untar/gunzip + or move-to-plugin-directory process should be auto-installable. + + When is a script not auto-installable? Let me give an example: +> + [.vim|vimfiles]/after/syntax/blockhl.vim +< + The <blockhl.vim> script provides block highlighting for C/C++ programs; + it is available at: +> + http://vim.sourceforge.net/scripts/script.php?script_id=104 +< + Currently, vim's after/syntax only supports by-filetype scripts (in + blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would + possibly overwrite the current user's after/syntax/c.vim file. + + In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to + allow a after/syntax/c/ directory: +> + http://vim.sourceforge.net/scripts/script.php?script_id=1023 +< + The script allows multiple syntax files to exist separately in the + after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build + an appropriate tarball for auto-install because of the potential for the + after/syntax/c.vim contained in it to overwrite a user's c.vim. + + +============================================================================== +7. GetLatestVimScripts Algorithm *getlatestvimscripts-algorithm* *glvs-alg* + + The Vim sourceforge page dynamically creates a page by keying off of the + so-called script-id. Within the webpage of + + http://vim.sourceforge.net/scripts/script.php?script_id=40 + + is a line specifying the latest source-id (src_id). The source identifier + numbers are always increasing, hence if the src_id is greater than the one + recorded for the script in GetLatestVimScripts then its time to download a + newer copy of that script. + + GetLatestVimScripts will then download the script and update its internal + database of script ids, source ids, and scriptnames. + + The AutoInstall process will: + + Move the file from GetLatest/ to the following directory + Unix : $HOME/.vim + Windows: $HOME\vimfiles + + if the downloaded file ends with ".bz2" + bunzip2 it + else if the downloaded file ends with ".gz" + gunzip it + if the resulting file ends with ".zip" + unzip it + else if the resulting file ends with ".tar" + tar -oxvf it + else if the resulting file ends with ".vim" + move it to the plugin subdirectory + + +============================================================================== +8. GetLatestVimScripts History *getlatestvimscripts-history* *glvs-hist* + + v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use; + unzip needs the -o flag to overwrite. + v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong + script! Fixed. + v18 Mar 21, 2005 : * bugfix to automatic database construction + * bugfix - nowrapscan caused an error + (tnx to David Green for the fix) + Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in + :AutoInstall:s, even though its o/s is windows + Apr 01, 2005 * when downloading errors occurred, GLVS was + terminating early. It now just goes on to trying + the next script (after trying three times to + download a script description page) + Apr 20, 2005 * bugfix - when a failure to download occurred, + GetLatestVimScripts would stop early and claim that + everything was current. Fixed. + v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which + defaults to 1, can be used to prevent all + :AutoInstall: + v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent + * fixed bug with :AutoInstall: use of helptags + v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't + always preventing downloads (just usually). Fixed. + v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than + s:dotvim. Fixed. + v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid + is zero. Useful for script authors; that way their + own GetLatestVimScripts activity won't overwrite + their scripts. + v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that + was intended only for testing. Removed, now works. + * :AutoInstall: implemented + v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin: + * :GetLatestVimScripts command + * (runtimepath)/GetLatest/GetLatestVimScripts.dat + now holds scripts that need updating + v10 Apr 19, 2004 : * moved history from script to doc + v9 Jan 23, 2004 : windows (win32/win16/win95) will use + double quotes ("") whereas other systems will use + single quotes ('') around the urls in calls via wget + v8 Dec 01, 2003 : makes three tries at downloading + v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id=" + not found in downloaded webpage + Uses t_ti, t_te, and rs to make progress visible + v6 Aug 06, 2003 : final status messages now display summary of work + ( "Downloaded someqty scripts" or + "Everything was current") + Now GetLatestVimScripts is careful about downloading + GetLatestVimScripts.vim itself! + (goes to <NEW_GetLatestVimScripts.vim>) + v5 Aug 04, 2003 : missing an endif near bottom + v4 Jun 17, 2003 : redraw! just before each "considering" message + v3 May 27, 2003 : Protects downloaded files from errant shell + expansions with single quotes: '...' + v2 May 14, 2003 : extracts name of item to be obtained from the + script file. Uses it instead of comment field + for output filename; comment is used in the + "considering..." line and is now just a comment! + * Fixed a bug: a string-of-numbers is not the + same as a number, so I added zero to them + and they became numbers. Fixes comparison. + +============================================================================== +vim:tw=78:ts=8:ft=help diff --git a/vimfiles/doc/crefvim.txt b/vimfiles/doc/crefvim.txt new file mode 100644 index 0000000..8fea502 --- /dev/null +++ b/vimfiles/doc/crefvim.txt @@ -0,0 +1,14112 @@ +*crefvim.txt* C-Reference Manual for Vim + Vim version 6.0 + + + *crefvim* *C-Reference* + C-Reference for Vim + ====================== + Version 1.0.3 + 27. Nov. 2004 + + (c) 2002-2004 by Christian Habermann + christian (at) habermann-net (point) de + + + "The GNU C Library Reference Manual" is + copyright (c) 1993 - 2002 by the + Free Software Foundation, Inc. + + + See |crefvimdoc| for further information on the project CRefVim. + See |crvdoc-copyright| for copyright and licenses. + + + Table of C o n t e n t s: + + Introduction..................|crv-intro| + + Chapter I LANGUAGE......................|crv-language| + I.1 Characters..................|crv-lngChar| + I.1.1 Allowed Characters........|crv-lngAllowedChar| + I.1.2 Comment...................|crv-lngComment| + I.1.3 Escape-Sequences..........|crv-lngEscSeq| + + I.2 Keywords....................|crv-keywords| + + I.3 Operators...................|crv-operators| + I.3.1 Overview..................|crv-opOverview| + I.3.2 Arithmetic................|crv-opArithmetic| + I.3.3 Logical...................|crv-opLogical| + I.3.4 Relational................|crv-opRelational| + I.3.5 Bitwise...................|crv-opBitwise| + I.3.6 Assignments...............|crv-opAssigns| + I.3.7 Others....................|crv-opOthers| + I.3.7.1 Size of.................|crv-opSizeOf| + I.3.7.2 Address of..............|crv-opAddress| + I.3.7.3 Contents of.............|crv-opContents| + I.3.7.4 Conditional.............|crv-opConditional| + I.3.7.5 Series..................|crv-opSeries| + I.3.7.6 Type Cast...............|crv-opTypeCast| + I.3.7.7 Struct/Union Selectors..|crv-opStructUnionSel| + I.3.7.8 Array Selector..........|crv-opArraySel| + I.3.7.9 Parentheses.............|crv-opParenth| + I.3.8 Precedence................|crv-opPrecedence| + + I.4 Punctuators.................|crv-punctuators| + + I.5 Datatypes...................|crv-datatypes| + I.5.1 Overview..................|crv-dtOverview| + I.5.1.1 Type Specifiers.........|crv-dtTypeSpecifiers| + I.5.1.2 Type Grouping...........|crv-dtTypeGrouping| + I.5.2 Sizes and Ranges..........|crv-dtSizeRange| + I.5.2 Formats...................|crv-dtFormats| + I.5.2.1 Integer.................|crv-dtFormatsInt| + I.5.2.2 Floating-Point..........|crv-dtFormatsFloat| + I.5.2.2.1 Basics................|crv-dtFormatsFPBasics| + I.5.2.2.2 Types.................|crv-dtFormatsFPTypes| + I.5.3 void Type.................|crv-dtVoid| + I.5.4 Arrays....................|crv-dtArrays| + I.5.5 Structures................|crv-dtStructurs| + I.5.6 Unions....................|crv-dtUnions| + I.5.7 Bit-Fields................|crv-dtBitFields| + I.5.8 Enumerated Tags...........|crv-dtEnumerate| + I.5.9 Strings...................|crv-dtStrings| + I.5.10 Type Definitions..........|crv-dtTypeDef| + I.5.11 Storage Classes...........|crv-dtStorageClasses| + I.5.12 Qualifiers................|crv-dtQualifiers| + I.5.13 Pointers..................|crv-dtPointers| + I.5.13.1 Variables...............|crv-dtPtrVars| + I.5.13.2 Functions...............|crv-dtPtrFuncs| + I.5.13.3 Arithmetics.............|crv-dtPtrArithmetics| + I.5.14 Type Cast.................|crv-dtTypeCast| + I.5.14.1 Explicit................|crv-dtTypeCastExpl| + I.5.14.2 Implicit................|crv-dtTypeCastImpl| + I.5.15 Constants.................|crv-dtConstants| + I.5.15.1 Integer.................|crv-dtConstInt| + I.5.15.2 Floating-Point..........|crv-dtConstFloat| + I.5.15.3 Character...............|crv-dtConstChar| + + I.6 Statements..................|crv-statements| + I.6.1 if-else...................|crv-stIfElse| + I.6.2 switch....................|crv-stSwitch| + I.6.3 while Loop................|crv-stWhile| + I.6.4 do-while Loop.............|crv-stDoWhile| + I.6.5 for Loop..................|crv-stFor| + I.6.6 break.....................|crv-stBreak| + I.6.7 continue..................|crv-stContinue| + I.6.8 goto......................|crv-stGoto| + I.6.9 return....................|crv-stReturn| + I.6.10 Null Statement............|crv-stNull| + + I.7 Functions...................|crv-functions| + I.7.1 Definition................|crv-fuDefinition| + I.7.2 Protoype..................|crv-fuPrototype| + I.7.3 Conversion................|crv-fuConversion| + I.7.4 Storage Classes...........|crv-fuStorageClasses| + I.7.5 Specifier.................|crv-fuSpecifier| + I.7.6 main()....................|crv-fuMain| + + I.8 Preprocessor................|crv-preprocessor| + I.8.1 Macros....................|crv-preMacros| + I.8.1.1 Definition #define......|crv-preMacDef| + I.8.1.2 Cancellation #undef.....|crv-preMacCancel| + I.8.1.3 # Operator..............|crv-preMac#Operator| + I.8.1.4 ## Operator.............|crv-preMac##Operator| + I.8.1.5 Predefined Macros.......|crv-preMacPredefined| + I.8.2 Conditional Compilation...|crv-preConditional| + I.8.2.1 defined Operator........|crv-preCondDefined| + I.8.2.2 #if Directive...........|crv-preCondIf| + I.8.2.3 #ifdef Directive........|crv-preCondIfdef| + I.8.2.4 #ifndef Directive.......|crv-preCondIfndef| + I.8.2.5 #else Directive.........|crv-preCondElse| + I.8.2.6 #elif Directive.........|crv-preCondElif| + I.8.2.7 #endif Directive........|crv-preCondEndif| + I.8.3 File Inclusion #include...|crv-preSourceInc| + I.8.4 Line Control #line........|crv-preLine| + I.8.5 Error Directive #error....|crv-preError| + I.8.6 Pragma Directive #pragma..|crv-prePragma| + I.8.7 Null Directive #..........|crv-preNull| + + + Chapter II STANDARD C LIBRARY............|crv-stdCLib| + II.1 Standard Headers............|crv-libHeaders| + + II.2 <assert.h> Diagnostics......|crv-libAssertH| + + II.3 <complex.h> Complex Math....|crv-libComplexH| + II.3.1 Macros....................|crv-libCHMac| + II.3.2 Pragmas...................|crv-libCHPrag| + II.3.3 Trigonometric.............|crv-libCHTrig| + II.3.4 Hyperbolic................|crv-libCHHyper| + II.3.5 Exponential & Logarithmic.|crv-libCHExpLog| + II.3.6 Power & Absolute..........|crv-libCHPower| + II.3.7 Manipulating..............|crv-libCHMani| + + II.4 <ctype.h> Character.........|crv-libCtypeH| + II.4.1 Character Handling........|crv-libCharHandling| + II.4.2 Character Mapping.........|crv-libCharMapping| + + II.5 <errno.h> Error Codes.......|crv-libErrnoH| + + II.6 <fenv.h> FPU Status.........|crv-libFenvH| + II.6.1 Pragmas...................|crv-libFHPrag| + II.6.2 Exceptions................|crv-libFHExceptions| + II.6.3 Rounding..................|crv-libFHRounding| + II.6.4 Environment...............|crv-libFHEnv| + + II.7 <float.h> Floating Point....|crv-libFloatH| + + II.8 <inttypes.h> Absolute Value.|crv-libInttypesH| + + II.9 <iso646.h> Alternatives.....|crv-libIso646H| + + II.10 <limits.h> Limits of Int....|crv-libLimitsH| + II.10.1 Range of Integer Types....|crv-libLHRange| + II.10.2 Width of Type.............|crv-libLHWidth| + II.10.3 Conversion and Properties.|crv-libLHConv| + + II.11 <local.h> Localization......|crv-libLocalH| + II.11.1 Categories................|crv-libLocHCat| + II.11.2 Standard Locales..........|crv-libLocHLoc| + II.11.3 Information Structure.....|crv-libLocHInfo| + II.11.4 Functions.................|crv-libLocHFunc| + + II.12 <math.h> Mathematics........|crv-libMathH| + II.12.1 Error Conditions..........|crv-libMHErr| + II.12.2 Classification Macros.....|crv-libMHClass| + II.12.3 Comparison Macros.........|crv-libMHCmp| + II.12.4 Trigonometric.............|crv-libMHTrig| + II.12.5 Hyperbolic................|crv-libMHHyper| + II.12.6 Exponential & Logarithmic.|crv-libMHExpLog| + II.12.7 Power & Absolute..........|crv-libMHPower| + II.12.8 Error & Gamma.............|crv-libMHErrGam| + II.12.9 Nearest Integer...........|crv-libMHNear| + II.12.10 Remainder.................|crv-libMHRem| + II.12.11 Manipulating..............|crv-libMHMani| + II.12.12 Miscellaneous.............|crv-libMHMisc| + + II.13 <setjmp.h> Nonlocal Jumps...|crv-libSetjmpH| + + II.14 <signal.h> Signal Handling..|crv-libSignalH| + II.14.1 Types.....................|crv-libSHTyp| + II.14.2 Signals...................|crv-libSHSig| + II.14.3 Functions.................|crv-libSHFunc| + + II.15 <stdarg.h> Arguments........|crv-libStdargH| + + II.16 <stdbool.h> Boolean Type....|crv-libStdboolH| + + II.17 <stddef.h> Definitions......|crv-libStddefH| + + II.18 <stdint.h> Integer Type.....|crv-libStdintH| + II.18.1 Integer Types.............|crv-libSdHType| + II.18.1.1 Exact-Width.............|crv-libSdHTExact| + II.18.1.2 Minimum-Width...........|crv-libSdHTMin| + II.18.1.3 Fastest Minimum-Width...|crv-libSdHTFast| + II.18.1.4 Greatest-Width..........|crv-libSdHTGreat| + II.18.1.5 Hold Pointer............|crv-libSdHTPtr| + II.18.2 Limits....................|crv-libSdHTLim| + II.18.2.1 Exact-Width.............|crv-libSdHLExact| + II.18.2.2 Minimum-Width...........|crv-libSdHLMin| + II.18.2.3 Fastest Minimum-Width...|crv-libSdHLFast| + II.18.2.4 Greatest-Width..........|crv-libSdHLGreat| + II.18.2.5 Others..................|crv-libSdHLOther| + II.18.2.6 Hold Pointer............|crv-libSdHLPtr| + II.18.3 Macros....................|crv-libSdHMac| + + II.19 <stdio.h> Input/Output......|crv-libStdioH| + II.19.1 Types.....................|crv-libSIOHType| + II.19.2 Macros....................|crv-libSIOHMac| + II.19.3 Streams and Files.........|crv-libSIOHStrmFile| + II.19.4 File Operations...........|crv-libSIOHFOp| + II.19.5 File Access...............|crv-libSIOHFAcc| + II.19.6 Formatted Input/Output....|crv-libSIOHIO| + II.19.6.1 Format Control..........|crv-libSIOHIOFormat| + II.19.6.1.1 Output, printf()......|crv-libSIOHIOFout| + II.19.6.1.2 Input, scanf()........|crv-libSIOHIOFin| + II.19.6.2 Functions...............|crv-libSIOHIOFunc| + II.19.7 Character Input/Output....|crv-libSIOHCIO| + II.19.8 Direct Input/Output.......|crv-libSIOHDIO| + II.19.9 File Positioning..........|crv-libSIOHFPos| + II.19.10 Error Handling............|crv-libSIOHErr| + + II.20 <stdlib.h> Utilities........|crv-libStdlibH| + II.20.1 Types.....................|crv-libSLHType| + II.20.2 Macros....................|crv-libSLHMac| + II.20.3 Numeric Conversion........|crv-libSLHnum| + II.20.4 Pseudo-Random.............|crv-libSLHrand| + II.20.5 Memory Management.........|crv-libSLHmem| + II.20.6 Communication.............|crv-libSLHcom| + II.20.7 Searching and Sorting.....|crv-libSLHsearch| + II.20.8 Integer Arithmetic........|crv-libSLHintarith| + II.20.9 Multibyte/Wide Character..|crv-libSLHmulchar| + II.20.10 Multibyte/Wide String.....|crv-libSLHmulstrng| + + II.21 <string.h> String...........|crv-libStringH| + II.21.1 Types.....................|crv-libSRHType| + II.21.2 Macros....................|crv-libSRHMac| + II.21.3 Copying...................|crv-libSRHCopy| + II.21.4 Concatenation.............|crv-libSRHConcat| + II.21.5 Comparison................|crv-libSRHCmp| + II.21.6 Search....................|crv-libSRHSearch| + II.21.7 Miscellaneous.............|crv-libSRHMisc| + + II.22 <tgmath.h> Type-Generic.....|crv-libTgmathH| + + II.23 <time.h> Date and Time......|crv-libTimeH| + II.23.1 Types.....................|crv-libTHType| + II.23.2 Macros....................|crv-libTHMac| + II.23.3 Time Manipulation.........|crv-libTHMani| + II.23.4 Time Conversion...........|crv-libTHConv| + + II.24 <wchar.h> Wide Utilities....|crv-libWcharH| + II.24.1 Types.....................|crv-libWCHType| + II.24.2 Macros....................|crv-libWCHMac| + II.24.3 Formatted Input/Output....|crv-libWCHIO| + II.24.4 Character Input/Output....|crv-libWCHCIO| + II.24.5 String Utilities..........|crv-libWCHStrng| + II.24.5.1 Numeric Conversions.....|crv-libWCHNum| + II.24.5.2 Copying.................|crv-libWCHCopy| + II.24.5.3 Concatenation...........|crv-libWCHConcat| + II.24.5.4 Comparison..............|crv-libWCHCmp| + II.24.5.5 Search..................|crv-libWCHSearch| + II.24.5.6 Miscellaneous...........|crv-libWCHMisc| + II.24.6 Time Conversions..........|crv-libWCHTimeConv| + II.24.7 Character Conversions.....|crv-libWCHCharConv| + + II.25 <wctype.h> Wide Character...|crv-libWctypeH| + II.25.1 Types.....................|crv-libWTHType| + II.25.2 Macros....................|crv-libWTHMac| + II.25.3 Classification............|crv-libWTHClass| + II.25.3.1 Wide Character..........|crv-libWTHCwide| + II.25.3.2 Extensible Wide Char....|crv-libWTHCextens| + II.25.4 Mapping...................|crv-libWTHMap| + II.25.4.1 Wide Character..........|crv-libWTHMwide| + II.25.4.2 Extensible Wide Char....|crv-libWTHMextens| + + + Appendix A GLOSSARY............................|crv-glossary| + B BIBLIOGRAPHY........................|crv-bibliography| + C COPYRIGHT & LICENSES................|crvdoc-copyright| + C.1 GNU General Public License........|crvdoc-licGPL| + C.2 GNU Free Documentation License....|crvdoc-licFDL| + C.3 GNU Lesser General Public License.|crvdoc-licLGPL| + C.4 Free Software Needs Free + Documentation.....................|crvdoc-licFreeDoc| + D AUTHOR..............................|crvdoc-author| + E CREDITS.............................|crvdoc-credits| + F HISTORY.............................|crvdoc-history| + + +Happy viming... + + +============================================================================== +Introduction *crv-intro* +============================================================================== + + +This document is a C-reference manual. It is NOT a tutorial on how to write +C programs. It is simply a quick reference to the standard C programming +language and its standard library functions. +The language description is based on the standard ISO/IEC 9899:1999(E), second +edition. But this reference does not contain all information from this +standard, it tries to reflect only the most important information. + +DISCLAIMER: All efforts have been taken to make sure that all information + in this document is correct, but no guarantee is implied or + intended. + +This C-reference manual is designed to be best viewed with Vim and syntax- +highlighting enabled. Furthermore when using Vim it's possible to navigate +through this document by tags. Vim is a very powerful text-editor available +for close to all platforms. + +This C-reference is divided into two chapters and an appendix. The first +chapter deals mainly with the language. The second chapter shows the +functions of the standard C library. The appendix includes a glossary and +other items of interest. + + + + + +============================================================================== +Chapter I LANGUAGE *crv-language* +============================================================================== + + + +============================================================================== +I.1 Characters *crv-lngChar* + + +------------------------------------------------------------------------------ +I.1.1 Allowed Characters *crv-lngAllowedChar* + +In a C source code the following characters are allowed: + + Digits: 0...9 + Letters: a-z A-Z + Others: ! " # & ' + - * / % , . : ; < = > ? \ ^ _ | ~ + parentheses ( ) + brackets [ ] + braces { } + space, tabulator, form feed + + Trigraphs: ??= # ??) ] ??! | *crv-trigraph* + ??( [ ??' ^ ??> } + ??/ \ ??< { ??- ~ + If a trigraph sequence is found in the source code it is + replaced with the corresponding single character. This allows + to enter some special symbols on platforms not providing these + symbols. + + +------------------------------------------------------------------------------ +I.1.2 Comment *crv-lngComment* + +There are two types of comments: + - block comment $/*...*/$ + - line comment $//$ + +Block Comment: *crv-lngBlockComment* + A block comment starts with $/*$ and ends with $*/$. All characters between + start and end are treated as comment. Nesting is not allowed. + +Line Comment: *crv-lngLineComment* + A line comment starts with $//$ and ends at the next new-line character + (new-line character is not included). + + + +------------------------------------------------------------------------------ +I.1.3 Escape-Sequences *crv-lngEscSeq* + + + Escape Sequence | Name | Meaning + ----------------+-----------------+------------------------------------------ + \' | | single quote ' + \" | | double quote " + \? | | question mark ? + \\ | | backslash \ + | | + \a | Alert | produces an audible or visible alert + \b | Backspace | moves cursor back one position + \f | Form Feed | moves cursor to start of next page + \n | New Line | moves cursor to start of next line + \r | Carriage Return | moves cursor to start of current line + \t | horiz. tabulator| moves cursor to next horiz. tab. position + \v | vert. tabulator | moves cursor to next vert. tab. position + | | + \0octal-digits | | octal character + \xhex-digits | | hexadecimal character + | | + \0 | null character | character with the value 0 + | | + \<cr> | | concatenates actual line with next one + | | (backslash immediately followed by a + | | new-line) + + + +============================================================================== +I.2 Keywords *crv-keywords* + +Keywords are words with a special meaning in C. They must not be used for any +other purposes. Keywords are case sensitive. + + + Keyword | Description + ---------------+---------------------------- + $ auto $| storage-class specifier + $ break $| statement + $ case $| label + $ char $| type + $ const $| type qualifier + $ continue $| statement + $ default $| label + $ do $| statement + $ double $| type + $ else $| statement + $ enum $| type + $ extern $| storage-class specifier + $ float $| type + $ for $| statement + $ goto $| statement + $ if $| statement + $ inline $| function specifier + $ int $| type + $ long $| type + $ register $| storage-class specifier + $ restrict $| type qualifier + $ return $| statement + $ short $| type + $ signed $| type + $ sizeof $| operator + $ static $| storage-class specifier + $ struct $| specifier + $ switch $| statement + $ typedef $| declaration + $ union $| specifier + $ unsigned $| type + $ void $| type + $ volatile $| type qualifier + $ while $| statement + $ _Bool $| type + $ _Complex $| type + $ _Imaginary $| type + + + + +============================================================================== +I.3 Operators *crv-operators* + + +------------------------------------------------------------------------------ +I.3.1 Overview *crv-opOverview* + + + Operator | Usage | Description + --------------+-----------------+------------------------------------------- + | | + |crv-opArithmetic| +Arithmetic~ +$ +$[unary] |$+operand $| positive sign, same like$operand$ +$ -$[unary] |$-operand $| negation of$operand$ + | | +$ +$[binary] |$expr1 + expr2 $| addition +$ -$[binary] |$expr1 - expr2 $| substraction +$ / $ |$expr1 / expr2 $| division +$ * $ |$expr1 * expr2 $| multiplication +$ % $ |$expr1 % expr2 $| modulo +$ --$[postfix] |$operand-- $|$operand$before decrementing by 1 +$ --$[prefix] |$--operand $|$operand$after decrementing by 1 +$ ++$[postfix] |$operand++ $|$operand$before incrementing by 1 +$ ++$[prefix] |$++operand $|$operand$after incrementing by 1 + | | + |crv-opLogical| +Logical~ +$ && $ |$expr1 && expr2 $| logical AND +$ || $ |$expr1 || expr2 $| logical OR +$ ! $ |$!expr1 $| logical NOT + | | + |crv-opRelational| +Relational~ +$ ==$ |$expr1 == expr2 $| compare for equal +$ !=$ |$expr1 != expr2 $| compare for not equal +$ > $ |$expr1 > expr2 $| compare for "greater than" +$ < $ |$expr1 < expr2 $| compare for "less than" +$ >=$ |$expr1 >= expr2 $| compare for "greater than or equal" +$ <=$ |$expr1 <= expr2 $| compare for "less than or equal" + | | + |crv-opBitwise| +Bitwise~ +$ & $ |$expr1 & expr2 $| bitwise AND +$ | $ |$expr1 | expr2 $| bitwise OR +$ ^ $ |$expr1 ^ expr2 $| bitwise XOR +$ << $ |$expr1 << expr2 $| shift bits to left +$ >> $ |$expr1 >> expr2 $| shift bits to right +$ ~ $ |$~expr1 $| one's complement + | | + |crv-opAssigns| +Assignment~ +$ = $ |$expr1 = expr2 $| assignment +$ *= $ |$expr1 *= expr2 $|$expr1 = expr1 * expr2 $ +$ /= $ |$expr1 /= expr2 $|$expr1 = expr1 / expr2 $ +$ %= $ |$expr1 %= expr2 $|$expr1 = expr1 % expr2 $ +$ += $ |$expr1 += expr2 $|$expr1 = expr1 + expr2 $ +$ -= $ |$expr1 -= expr2 $|$expr1 = expr1 - expr2 $ +$ <<=$ |$expr1 <<= expr2$|$expr1 = expr1 << expr2 $ +$ >>=$ |$expr1 >>= expr2$|$expr1 = expr1 >> expr2 $ +$ &= $ |$expr1 &= expr2 $|$expr1 = expr1 & expr2 $ +$ ^= $ |$expr1 ^= expr2 $|$expr1 = expr1 ^ expr2 $ +$ |= $ |$expr1 |= expr2 $|$expr1 = expr1 | expr2 $ + | | + |crv-opOthers| +Others~ +$ sizeof $ |$sizeof a $| size of element$a$in bytes +$ & $ |$&expr1 $| address of$expr1$ +$ * $ |$*expr1 $| contents of$expr1$, $expr1$is a pointer +$ ?: $ |$a?expr1:expr2 $| conditional operator$a!=0:expr1 else expr2$ +$ , $ |$expr1,expr2 $| comma operator +$(type-name)$ |$(float)expr1 $| explicit type cast +$ . $ |$a.b $| struct/union selector,$a$is struct/union +$ -> $ |$a->b $| struct/union selector,$a$is pointer to + | | struct/union +$ [] $ |$a[0] $| array selector +$ () $ |$(a + b) * c $| group operators or + |$func() $| declare functions + | | + --------------+-----------------+------------------------------------------- + + +The sections below give further information on operators. + + +------------------------------------------------------------------------------ +I.3.2 Arithmetic *crv-opArithmetic* + +$+operand$ *crv-opPosSign* +---------- +positive sign + +Examples: > + a = +15; + a = +b; + func(3.12E+3); + + +$-operand$ *crv-opNegSign* +---------- +negative sign, negation + +Examples: > + a = -15; + a = -a; + + +$expr1 + expr2$ *crv-opAdd* +--------------- +This adds the two expressions. + +Examples: > + a = b + c; + a = b + 42; + a = func(b + c); + + +$expr1 - expr2$ *crv-opSub* +--------------- +Substract$expr2$from$expr1$. + +Examples: > + a = b - c; + a = b - 42; + a = func(b - c); + + +$expr1 / expr2$ *crv-opDivide* +--------------- +Divide$expr1$by$expr2$. +If$expr2$is 0, behavior is undefined. + +Examples: > + a = b / c; + a = b / 42; + a = func(c / 3); + + +$expr1 * expr2$ *crv-opMultiply* +--------------- +Multiply$expr1$by$expr2$. + +Examples: > + a = b * c; + a = b * 42; + a = func(c * 3); + + +$expr1 % expr2$ *crv-opModulo* +--------------- +Modulo operator. The result is the value of the remainder after +dividing$expr1$by$expr2$. +Both expressions must be integer types (char, short, int, long..., +signed or unsigned). +If$expr2$is 0, behavior is undefined. + +Examples: > + a = 0 % 3; // result = 0 + a = 1 % 3; // result = 1 + a = 2 % 3; // result = 2 + a = 3 % 3; // result = 0 + a = 4 % 3; // result = 1 + a = 5 % 3; // result = 2 + a = 6 % 3; // result = 0 + a = 7 % 3; // result = 1 + a = 7 % (-3); // result = 1 + a = (-7) % 3; // result = -1 + a = (-7) % (-3); // result = -1 + + a = b % c; + func(a % c); + + +$operand--$ *crv-opPostDec* +----------- +This is a postfix operation (unary operator after operand). +$operand$will be decremented by 1 AFTER the expression is +evaluated. +The value 1 of the appropriate type is subtracted. +So e.g. integer and float can be used as$operand$. + +Example: > + int nA; + float fA; + + nA = 3; + printf("%d", nA--); // output 3 + printf("%d", nA); // output 2 + + fA = 3.2f; + fA--; + printf("%f", fA); // output 2.2 + + +$--operand$ *crv-opPreDec* +----------- +This is a prefix operation (unary operator before operand). +$operand$will be decremented by 1 BEFORE the expression is +evaluated. +The value 1 of the appropriate type is subtracted. +So e.g. integer and float can be used as$operand$. + +Example: > + int nA; + float fA; + + nA = 3; + printf("%d", --nA); // output 2 + printf("%d", nA); // output 2 + + fA = 3.2f; + --fA; + printf("%f", fA); // output 2.2 + + +$operand++$ *crv-opPostInc* +----------- +This is a postfix operation (unary operator after operand). +$operand$will be incremented by 1 AFTER the expression is +evaluated. +The value 1 of the appropriate type is added. So e.g. +integer and float can be used as$operand$. + +Example: > + int nA; + float fA; + + nA = 3; + printf("%d", nA++); // output 3 + printf("%d", nA); // output 4 + + fA = 3.2f; + fA++; + printf("%f", fA); // output 4.2 + + +$++operand$ *crv-PreInc* +----------- +This is a prefix operation (unary operator before operand). +$operand$will be incremented by 1 BEFORE the expression is +evaluated. +The value 1 of the appropriate type is added. So e.g. +integer and float can be used as$operand$. + +Example: > + int nA; + float fA; + + nA = 3; + printf("%d", ++nA); // output 4 + printf("%d", nA); // output 4 + + fA = 3.2f; + ++fA; + printf("%f", fA); // output 4.2 + + + +------------------------------------------------------------------------------ +I.3.3 Logical *crv-opLogical* + +An expression is FALSE if its value is 0, else it is TRUE. + +ATTENTION: This means TRUE is defined as unequal to 0. So never assume any +value for TRUE, TRUE's value depends on implementation. + + +$expr1 && expr2$ *crv-opLogAnd* +---------------- +This is the logical AND. +The expression is TRUE if both$expr1$AND$expr2$are TRUE - else it is FALSE. +If$expr1$is equal 0,$expr2$is not evaluated. +The result has type$int$. + + $expr1$|$expr2$ || result + --------+--------++-------- + 0 | 0 || 0 + 0 | >=1 || 0 + >=1 | 0 || 0 + >=1 | >=1 || >=1 + + +$expr1 || expr2$ *crv-opLogOr* +---------------- +This is the logical OR. +The expression is TRUE if either$expr1$OR$expr2$is TRUE - else it is FALSE. +If$expr1$is unequal 0,$expr2$is not evaluated. +The result has type$int$. + + $expr1$|$expr2$ || result + --------+--------++-------- + 0 | 0 || 0 + 0 | >=1 || >=1 + >=1 | 0 || >=1 + >=1 | >=1 || >=1 + + +$!expr1$ *crv-opLogNot* +-------- +This is the logical NOT. +The expression is TRUE if$expr1$is FALSE. The expression is FALSE if$expr1$is +TRUE. +The result has type$int$. + + $expr1$|| result + ------++-------- + 0 || >=1 + >=1 || 0 + + + +------------------------------------------------------------------------------ +I.3.4 Relational *crv-opRelational* + +$expr1 == expr2$ *crv-opRelEqual* +---------------- +Equality operator. The result is 1 if operands are equal. The result is +0 if operands are unequal. +The result has type$int$. + +Example: > + int x, a, b; + + a = 1; + b = 2; + + if (a == 1) + { + printf("a is equal to 1"); + } + + x = a == b; + printf("%d", x); // output is 0, since a != b + + +$expr1 != expr2$ *crv-opRelUnequal* +---------------- +Unequality operator. The result is 1 if operands are unequal. The result is +0 if operands are equal. +The result has type$int$. + +Example: > + int x, a, b; + + a = 1; + b = 2; + + if (a != b) + { + printf("a is unequal to b"); + } + + x = a != b; + printf("%d", x); // output is 1, since a != b + + +$expr1 > expr2$ *crv-opRelGT* +--------------- +"greater than" operator. The result is 1 if value of$expr1$is greater than +value of $expr2$, else result is 0. +The result has type$int$. + +Example: > + int x, a, b; + + a = 5; + b = 2; + + if (a > b) + { + printf("a is greater than b"); + } + + x = a > b; + printf("%d", x); // output is 1, since a > b + + +$expr1 < expr2$ *crv-opRelLT* +--------------- +"less than" operator. The result is 1 if value of$expr1$is less than +value of$expr2$, else result is 0. +The result has type$int$. + +Example: > + int x, a, b; + + a = 1; + b = 2; + + if (a < b) + { + printf("a is less than b"); + } + + x = a < b; + printf("%d", x); // output is 1, since a < b + + +$expr1 >= expr2$ *crv-opRelGTE* +---------------- +"greater than or equal to" operator. The result is 1 if value of$expr1$is +greater than or equal to value of$expr2$, else result is 0. +The result has type$int$. + +Example: > + int x, a, b; + + a = 1; + b = 1; + + if (a >= b) + { + printf("a is greater than or equal to b"); + } + + a = 1; b = 2; + x = a >= b; + printf("%d", x); // output is 0, since a < b + + +$expr1 <= expr2$ *crv-opRelLTE* +---------------- +"less than or equal to" operator. The result is 1 if value of$expr1$is +less than or equal to value of$expr2$, else result is 0. +The result has type$int$. + +Example: > + int x, a, b; + + a = 1; + b = 2; + + if (a <= b) + { + printf("a is less than or equal to b"); + } + + x = a <= b; + printf("%d", x); // output is 1, since a <= b + + + +------------------------------------------------------------------------------ +I.3.5 Bitwise *crv-opBitwise* + +$expr1 & expr2$ *crv-opBitAnd* +--------------- +Bitwise AND operator. This operator does a bitwise AND on the values +of$expr1$and$expr2$. +The result is a value the same size as the expressions. + + $expr1$ | $expr2$ || result + n-th Bit | n-th Bit || n-th Bit + ----------+-----------++---------- + 0 | 0 || 0 + 0 | 1 || 0 + 1 | 0 || 0 + 1 | 1 || 1 + +Example: > + int a, b; + + b = 0x81; + a = b & 0xF0; + // value of a is: 0x80 + + +$expr1 | expr2$ *crv-opBitOr* +--------------- +Bitwise OR operator. This operator does a bitwise OR on the values +of$expr1$and$expr2$. +The result is a value the same size as the expressions. + + $expr1$ | $expr2$ || result + n-th Bit | n-th Bit || n-th Bit + ----------+-----------++---------- + 0 | 0 || 0 + 0 | 1 || 1 + 1 | 0 || 1 + 1 | 1 || 1 + +Example: > + int a, b; + + b = 0x81; + a = b | 0xF0; + // value of a is: 0xF1 + + +$expr1 ^ expr2$ *crv-opBitXor* +--------------- +Bitwise XOR operator. This operator does a bitwise XOR on the values +of$expr1$and$expr2$. +The result is a value the same size as the expressions. + + $expr1$ | $expr2$ || result + n-th Bit | n-th Bit || n-th Bit + ----------+-----------++---------- + 0 | 0 || 0 + 0 | 1 || 1 + 1 | 0 || 1 + 1 | 1 || 0 + +Example: > + int a, b; + + b = 0x81; + a = b ^ 0xF0; + // value of a is: 0x71 + + +$expr1 << expr2$ *crv-opBitLeftShift* +---------------- +Bitwise left-shift operator. The result is$expr1$left-shifted$expr2$bit +positions, vacated bits are filled with 0. + +IF$expr1$is an unsigned type the value of the result is: + $expr1$* 2^($expr2$) modulo (1 + maximum value representable in resulting + type) +ELSE + IF$expr1$is a signed type and has a nonnegative value and + $expr1$* 2^($expr2$) is representable in the result type then the + result is: + $expr1$* 2^($expr2$) + ELSE + behavior is undefined + +Both expressions must be integer types (char, short, int, long..., +signed or unsigned). +The result has the type of$expr1$. +If the value of$expr2$is negative or is greater than or equal to the +width of$expr1$, the behavior is implementation specific. + +Example: > + int a, b, c; + + a = 3; + b = 2; + c = a << b; + // value of c is 12 + + +$expr1 >> expr2$ *crv-opBitRightShift* +---------------- +Bitwise right-shift operator. The result is$expr1$right-shifted$expr2$ +bit positions. + +If$expr1$has an unsigned type or if$expr1$has a signed type and a nonnegative +value, the result is: + $expr1$/ 2^($expr2$) + +If$expr1$has a signed type and a negative value, the result is implementation +specific. Many compilers set vacated bits to 1. + +Example: > + int a, b, c; + + a = 17; + b = 2; + c = a >> b; + // value of c is 4 + + +$~expr1$ *crv-opBitCompl* +-------- +Bitwise one's complement. A bit in the result is set if the corresponding bit +in$expr1$is not set. A bit in the result is cleared if the corresponding bit +in$expr1$is set. + +The expression must has an integer type (char, short, int, long..., +signed or unsigned). The result has the type of$expr1$. + +Example: > + int a, b; + + a = 0xF0; + b = ~a; + // value of b is 0x0F + + + +------------------------------------------------------------------------------ +I.3.6 Assignments *crv-opAssigns* + + +$expr1 = expr2$ *crv-opAsAssign* +--------------- +The value of$expr2$is assigned to$expr1$. + +Example: > + int a, b; + + a = 2; + b = 3; + b = a * b; + + +$expr1 *= expr2$ *crv-opAsMul* +---------------- +Assign$expr1$the value of$expr1$multiplied by$expr2$. + +Same as: $expr1 = expr1 * expr2$ + +see |crv-opMultiply| + +Example: > + int a, b; + + a = 2; + b = 3; + a *= b; + // a has value 6 + + +$expr1 /= expr2$ *crv-opAsDiv* +---------------- +Assign$expr1$the value of$expr1$divided by$expr2$. + +Same as: $expr1 = expr1 / expr2$ + +see |crv-opDivide| + +Example: > + int a, b; + + a = 6; + b = 3; + a /= b; + // a has value 2 + + +$expr1 %= expr2$ *crv-opAsModulo* +---------------- +Assign$expr1$the remainder after dividing$expr1$by$expr2$. + +Same as: $expr1 = expr1 % expr2$ + +see |crv-opModulo| + +Example: > + int a, b; + + a = 6; + b = 3; + a %= b; + // a has value 0 + + +$expr1 += expr2$ *crv-opAsAdd* +---------------- +Assign$expr1$the value of the sum of$expr1$and$expr2$. + +Same as: $expr1 = expr1 + expr2$ + +see |crv-opAdd| + +Example: > + int a, b; + + a = 6; + b = 3; + a += b; + // a has value 9 + + + +$expr1 -= expr2$ *crv-opAsSub* +---------------- +Assign$expr1$the value of$expr2$substracted by$expr1$. + +Same as: $expr1 = expr1 - expr2$ + +see |crv-opSub| + +Example: > + int a, b; + + a = 6; + b = 4; + a -= b; + // a has value 2 + + +$expr1 <<= expr2$ *crv-opAsLeftShift* +----------------- +Assign$expr1$the value of$expr1$left-shifted by$expr2$bit positions. + +Same as: $expr1 = expr1 << expr2$ + +see |crv-opBitLeftShift| + +Example: > + int a, b; + + a = 6; + b = 2; + a <<= b; + // a has value 24 + + +$expr1 >>= expr2$ *op-opAsRightShift* +----------------- +Assign$expr1$the value of$expr1$right-shifted by$expr2$bit positions. + +Same as: $expr1 = expr1 >> expr2$ + +see |crv-opBitRightShift| + +Example: > + int a, b; + + a = 6; + b = 1; + a >>= b; + // a has value 3 + + +$expr1 &= expr2$ *opAsBitAnd* +---------------- +Assign$expr1$the value of the bitwise AND of$expr1$and$expr2$. + +Same as: $expr1 = expr1 & expr2$ + +see |crv-opBitAnd| + +Example: > + int a, b; + + a = 0x81; + b = 0x0F; + a &= b; + // a has value 0x01 + + +$expr1 ^= expr2$ *opAsBitXor* +---------------- +Assign$expr1$the value of the bitwise XOR of$expr1$and$expr2$. + +Same as: $expr1 = expr1 ^ expr2$ + +see |crv-opBitXor| + +Example: > + int a, b; + + a = 0x81; + b = 0x0F; + a &= b; + // a has value 0x01 + + +$expr1 |= expr2$ *opAsBitOr* +---------------- +Assign$expr1$the value of the bitwise OR of$expr1$and$expr2$. + +Same as: $expr1 = expr1 | expr2$ + +see |crv-opBitOr| + +Example: > + int a, b; + + a = 0x81; + b = 0x0F; + a |= b; + // a has value 0x8F + + + +------------------------------------------------------------------------------ +I.3.7 Others *crv-opOthers* + +I.3.7.1 Size of *crv-opSizeOf* +---------------- +Operator: $sizeof$ *crv-sizeof* +Declaration: + $size_t sizeof expression$ + or + $size_t sizeof (type-name)$ + +The$sizeof$operator yields the size of its operand (number of bytes). +The operand is either an expression or a name of a type. The name of type +must be in parenthesis. +The result has type$size_t$which is an unsigned integer type (unsigned int, +unsigned long,.... implementation specific). + +The result for$char$,$unsigned char$,$signed char$or a typedef of them is 1. +For arrays the result is the total number of bytes used by the object. +For structures or unions the result is the total number of bytes in the +object including pad-bytes added by the compiler for alignment. + +Examples: > + char a[7]; + printf("%d", sizeof a ); // prints 7 + printf("%d", sizeof a[0] ); // prints 1 + + printf("%d", sizeof(float) ); // prints 4 + + -------- + + struct Test { + char ch; + float f; + } tst; + + printf("%d", sizeof(tst) ); // print 8 (impl. specific) + printf("%d", sizeof(struct Test) ); // print 8 (impl. specific) + + + +I.3.7.2 Address of *crv-opAddress* +------------------- +Syntax: $&operand$ + +The$&$operator returns the address of its operand. If the operand has type +"type" the result has type "pointer to type". + +Operand can be: + - a data type that is not register nor bit-fields + - function designator + - the result of$[]$operator + - the result of$*$operator + + +Example: > + int a, *ptr; + + a = 3; + ptr = &a; // assign address of a to prt + + printf("a: value = %d, address = %p", a, ptr); + + +I.3.7.3 Contents of *crv-opContents* +-------------------- +Syntax: $*operand$ + +The$*$operator refers to the value of the object a pointer points to. +The operand must be a pointer type. +If the operand has type "pointer to type" the result has type "type". + +Example: > + int a, b, *ptr; + + ptr = &a; // assign address of a to prt + *ptr = 5 // set value of object ptr points to to 5 (object is a) + b = *ptr; // assign value of object pointer ptr points to to b + + +I.3.7.4 Conditional *crv-opConditional* +-------------------- +Syntax: $expr1 ? expr2 : expr3$ + +At first$expr1$is evaluated. If$expr1$is unequal 0,$expr2$is evaluated. +If$expr1$is equal 0,$expr3$is evaluated. + +The result of the conditional operator is either the value of$expr2$or$expr3$, +whichever is evaluated. The type of the result is: + - If$expr2$and$expr3$have the same type, the result has that type. + - If$expr2$and$expr3$have different types, the result has the type + that would be determined by the usual arithmetic conversions, were they + applied to$expr2$and$expr3$. + +Example: > + int a, b, max; + + a = 2; + b = 5; + + max = a > b ? a : b; // get maximum of a and b + + a == 2 ? FuncA() : FuncB(); // call FuncA() if a == 2, else call FuncB() + + +I.3.7.5 Series *crv-opSeries* +--------------- +Syntax: $expr1, expr2$ + +The comma operator$,$ allows to put two separate expressions where one is +required. +At first$expr1$is evaluated. Then$expr2$is evaluated. The result of the +comma operator has the value and type of$expr2$. + +It is allowed to nest expressions. + +Example: > + int i, j, k; + + for (i=0, j=15, k=2; i < 5; i++, j--) + { + .... + } + + func(3, (i=3, i+6), k); // second parameter has value 9 and type int + + + +I.3.7.6 Type Cast *crv-opTypeCast* +------------------ +Syntax: $(type-name)expr1$ + +The type cast operator converts the value of$expr1$to$type-name$. + +Examples: > + int a, b; + float f; + + a = 5; + b = 10; + + f = a / b; + // f has value 0, integer division + + f = (float)a / (float)b; + // f has value 0.5 + + +I.3.7.7 Struct/Union Selectors *crv-opStructUnionSel* +------------------------------- +- Struct/Union: $expr1.identifier$ +The$.$operator selects a member of a structure or union. +$expr1$has the type of a structure or union. + + +- Pointer to Struct/Union: $expr1->identifier$ +The$->$operator selects a member of a structure or union. +$expr1$has the type of "pointer to structure" or +"pointer to union". + +Examples: > + struct Example { + int element1; + float element2; + } expl; + + struct Example *ptr; + + ptr = &expl; + + expl.element1 = 2; + ptr->element2 = 42.0f; + + +I.3.7.8 Array Selector *crv-opArraySel* +----------------------- +Syntax: $expr1[expr2]...[exprN]$ + +Selects an element of an array. First element has index 0. + +Examples: > + int a[3] = {1,2,3}; + int b[2][3] = { {1,2,3}, {4,5,6}}; + + printf("%d\n", b[1][0]); // output 4 + + a[2] = 0; // array a contains {1,2,0} + + +I.3.7.9 Parentheses *crv-opParenth* +-------------------- +Operator:$()$ + +The parentheses-operator is used for: + +- group expressions + $a = (b + 2) * c$ + +- declare functions + $a = func(b, c + 1)$ + +- explicit type-cast (see |crv-opTypeCast|) + +- statements like + $if (...)$ + $for (...)$ + $while(...)$ + .... + + +------------------------------------------------------------------------------ +I.3.8 Precedence *crv-opPrecedence* + +The precedence defines which operator is done before other ones +(e.g.$a + b * c$: at first the multiplication is done then the addition). +The following table shows the order of precedence, operators at the top have +highest precedence. + + + Operator | Associativity + ---------------------------------------+---------------- +$ () [] -> . $| left to right +$ ! ~ ++ -- + - (type-name) * & sizeof $| right to left (unary operators) +$ * / % $| left to right +$ + - $| left to right +$ << >> $| left to right +$ < <= > >= $| left to right +$ == != $| left to right +$ & $| left to right +$ ^ $| left to right +$ | $| left to right +$ && $| left to right +$ || $| left to right +$ ?: $| right to left +$ = += -= /= *= %= >>= <<= &= |= ^= $| right to left +$ , $| left to right + + +If operators have the same order of precedence, the associativity defines +the order in which operators are done: +E.g. + $ a - b - c$ +is done as + $(a - b) - c$ +(from left to right) + + +NOTE: Precedence and associativity define which operator is done before +other ones. But the order of evaluation of subexpressions is unspecified, +except from function-call$()$,$&&$,$||$,$?:$and$,$. The order in which side +effects take place is unspecified too. + + Example: + $a = b + c * d;$ + + Because of the precedence a compiler has to calculate$c*d$and has + to add$b$and has to assign the result of that whole expression to$a$. + This is defined in the C standard. But a compiler is free to take e.g. + $b$and save it, then take$c$and then$d$and do$c*d$, add the saved value + of$b$and assign result to$a$. Or do any other order of evaluating the + subexpressions. + There are just a few operators that force compilers to a specified + sequence of evaluating subexpressions (see paragraph above). + + But of course the order of evaluating subexpressions can be relevant: + Example: > + int a = 4; + int b; + + b = ((a=2) * (a*=3)); // b either 12 or 24? + // a either 2 or 6? compiler specific +< + If the compiler takes first the expression$(a=2)$and then$(a*=3)$the + result will be 12. But if the compiler takes first$(a*=3)$and then + $(a=2)$the result will be 24. + + NOTE: Never ever write code that depends on the order of evaluating + expressions. + + + + +============================================================================== +I.4 Punctuators *crv-punctuators* + +Punctuators are special characters, they are not operands or identifiers. +They have their own semantic and syntactic. + + Punctuator | Example | Description + ------------+------------------------+--------------------------------------- +$ < > $| <stdio.h> | header name +$ [ ] $| n = a[3]; | array delimiter +$ ( ) $| func(a, b); | function parameter list or + | | expression grouping +$ { } $| char ch[2]={'a', 'b'}; | function body, initializer list, + | | compound statement +$ * $| int *ptr; | pointer declaration +$ # $| #include | preprocessor directive +$ , $| char ch[2]={'a', 'b'}; | argument list separator +$ : $| label: | label +$ ; $| a = b + c; | end of statement +$ ... $| func(int a, ...) | variable length of argument list +$ = $| int n = 2; | declaration initializer +$ ' ' $| char ch = 'a'; | character constant +$ " " $| char ch[] = "abc"; | string constant or header file name + + + + +============================================================================== +I.5 Datatypes *crv-datatypes* + + +------------------------------------------------------------------------------ +I.5.1 Overview *crv-dtOverview* + +I.5.1.1 Type Specifiers *crv-dtTypeSpecifiers* +------------------------ +To specify a datatype in standard C the following type-specifiers are +allowed: + + $void $ + $char $ *crv-char* + $short $ *crv-short* + $int $ *crv-int* + $long $ *crv-long* + $float $ *crv-float* + $double $ *crv-double* + $signed $ *crv-signed* + $unsigned $ *crv-unsigned* + $_Bool $ *crv-_Bool* + $_Complex $ *crv-_Complex* + $_Imaginary$ *crv-_Imaginary* + $struct $ + $union $ + $enum $ + $typedef-name$ + + +Type specifiers can be combined, the whole set of possible type specifiers is +viewed in the table below. Specifiers given in the same row have the same +meaning. + + + Type Specifier | Description + =========================+================================================== +$void $| empty or NULL value + -------------------------+-------------------------------------------------- +$char $| store member of basic character set +$signed char $| + -------------------------+-------------------------------------------------- +$unsigned char $| same as char, but unsigned values only + -------------------------+-------------------------------------------------- +$short $| defines a short signed integer +$short int $| +$signed short $| +$signed short int $| + -------------------------+-------------------------------------------------- +$unsigned short $| same as short, but unsigned values only +$unsigned short int $| + -------------------------+-------------------------------------------------- +$int $| defines a signed integer +$signed $| +$signed int $| + -------------------------+-------------------------------------------------- +$unsigned $| same as int, but unsigned values only +$unsigned int $| + -------------------------+-------------------------------------------------- +$long $| defines a long signed integer +$long int $| +$signed long $| +$signed long int $| + -------------------------+-------------------------------------------------- +$unsigned long $| same as long, but unsigned values only +$unsigned long int $| + -------------------------+-------------------------------------------------- +$long long $| defines a long long signed integer +$long long int $| +$signed long long $| +$signed long long int $| + -------------------------+-------------------------------------------------- +$unsigned long long $| same as long long, but unsigned values only +$unsigned long long int $| + -------------------------+-------------------------------------------------- +$float $| defines a floating-point number + -------------------------+-------------------------------------------------- +$double $| defines a more accurate floating-point number + | than float + -------------------------+-------------------------------------------------- +$long double $| defines a more accurate floating-point number + | than double + -------------------------+-------------------------------------------------- +$_Bool $| defines a Bool-integer (0 or 1 only) + -------------------------+-------------------------------------------------- +$float _Complex $| defines a complex number with floating + -------------------------+-------------------------------------------------- +$double _Complex $| defines a complex number more accurate + | than the float type + -------------------------+-------------------------------------------------- +$long double _Complex $| defines a complex number more accurate than + | the double type + -------------------------+-------------------------------------------------- +$float _Imaginary $| defines an imaginary number with floating + -------------------------+-------------------------------------------------- +$double _Imaginary $| defines an imaginary number more accurate + | than the float type + -------------------------+-------------------------------------------------- +$long double _Imaginary $| defines an imaginary number more accurate than + | the double type + -------------------------+-------------------------------------------------- +$struct $| defines a set of elements that have possibly + | different datatypes (unlike an array) + -------------------------+-------------------------------------------------- +$union $| defines a set of elements that have possibly + | different datatypes and use the same overlapping + | memory (total size is size of biggest element) + -------------------------+-------------------------------------------------- +$enum $| defines a set of named integer constant values + -------------------------+-------------------------------------------------- +$typedef-name $| a new named type defined with the$typedef$ + | keyword, the new type is a synonym for one of the + | types listed above + =========================+================================================== + + + +I.5.1.2 Type Grouping *crv-dtTypeGrouping* +---------------------- + +The types can be grouped in this way: + + + TYPE + | + -------------------+-----------+------------- + | | | + | | | + ------- SCALAR ----- AGGREGATE $void$ + | | | + | | +------------- + | | | | + - ARITHMETIC --- $pointers$ ARRAY STRUCTURE + | | | | + | | | | +INTEGER - FLOATING -+----------- $array$ -$struct$- + | | | | | | + | | | | | | + | REAL COMPLEX IMAGINARY $union bit-field$ + | | | | + | | | $_Imaginary$(1) + | | | | + | | | +-------+--------- + | | | | | | + | | | $float double long double$ + | | | + | | | + | | $_Complex$(1) + | | | + | | +-------+--------- + | | | | | + | | $float double long double$ + | | + | | + | +-------+--------- + | | | | + | $float double long double$ + | + | + +-----------------+---------------+--------- + | | | | +$char short enum _Bool$ +$signed/unsigned int $ +$ long $ +$ long long $ +$ signed/unsigned $ + + + (1): implementation of these datatypes is not required + + +The basic types are type char, signed/unsigned integer types and floating +types. + + + + +------------------------------------------------------------------------------ +I.5.2 Sizes and Ranges *crv-dtSizeRange* + + +The C standard defines the basic types as having a "at least" size. + + Type | Size/Range + ============+=================================================== +$char $| large enough to store any member of the basic + | character set + ------------+--------------------------------------------------- +$short $| same as int or smaller range + ------------+--------------------------------------------------- +$int $| has the natural size suggested by the architecture + | of the execution environment + ------------+--------------------------------------------------- +$long $| same as int or greater range + ------------+--------------------------------------------------- +$long long $| same as long or greater range + ------------+--------------------------------------------------- +$float $| IEEE-754 floating-point standard, single format + ------------+-------------------------------------------------- +$double $| IEEE-754 floating-point standard, double format + ------------+--------------------------------------------------- +$long double$| shall have more precision than double and at + | least the range of double + ------------+--------------------------------------------------- +$_Bool $| large enough to store values 0 and 1 + ============+=================================================== + + + +Common - but not guaranteed - values are: + + + Type | Size/Range + | 16-bit Architecture 32-bit Architecture + ============+================================================================ +$char $| 8 bit + | 0...255 + | -128...127 + ------------+---------------------------------------------------------------- +$short $| 16 bit + | 0...65535 + | -32768...32767 + ------------+---------------------------------------------------------------- +$int $| 16 bit | 32 bit + | 0...65535 | 0...4,294,967,295 + | -32768...32767 | -2,147,483,648...2,147,483,647 + ------------+---------------------------------------------------------------- +$long $| 32 bit + | 0...4,294,967,295 + | -2,147,483,648...2,147,483,647 + ------------+---------------------------------------------------------------- +$long long $| 64 bit + | 0...18,446,744,073,709,551,615 + | -9,223,372,036,854,775,808...9,223,372,036,854,775,807 + ------------+---------------------------------------------------------------- +$float $| 32 bit + | magnitudes: 1.175494351e-38...3.402823466e+38 + | significant digits: >= 6 + | given x, next is: x * (1 + 1.192092896e-7) + ------------+---------------------------------------------------------------- +$double $| 64 bits + | magnitudes: 2.2250738585072014e-308...1.7976931348623158e+308 + | significant digits: >= 15 + | given x, next is: x * (1 + 2.2204460492503131e-16) + ------------+---------------------------------------------------------------- +$long double$| 96 bits, 80 bits used + | magnitudes: 3.36210314311209351e-4932 1.18973149535723177e+4932 + | significant digits: >= 18 + | given x, next is: x * (1 + 1.08420217248550443e-19) + ------------+---------------------------------------------------------------- +$_Bool $| 16 bit | 32 bit + | 0, 1 | 0, 1 + ============+================================================================ + + + + +------------------------------------------------------------------------------ +I.5.2 Formats *crv-dtFormats* + +I.5.2.1 Integer *crv-dtFormatsInt* +---------------- + +Integer values are represented as binary numbers (base 2). + +The range of unsinged integer types is 0...2^(N-1), whereas N is the size +of the integer type (8, 16, 32, 64 bit...). + +Value = bitN*2^(N-1) + ... + bit3*2^3 + bit2*2^2 + bit1*2^1 + bit0*2^0 + +N is the most significant bit, 0 the least significant. + +For signed integer values one bit is used as sign, commonly the most +significant bit. +If sign bit is 0, the representation is the same as for unsigned integer. +If sign bit is 1, a negative value is represented. There are three +possibilities to represent a negative value: + + - Sign-Magnitude *crv-signMagnitude* + -------------- + Sign bit 0: the rest is a positive number + Sign bit 1: the rest is a negative number + E.g.: + 0000 1001 = +9 + 1000 1001 = -9 + + Attributs: + +0 and -0 exists + Range: -2^(N-1) - 1 ... 2^(N-1) - 1 (e.g. 8bit: -127 ... +127) + adding, subtracting, dividing, multiplying needs extra logic + conversion from positive to negative values and vice versa is simple + + - One's Complement *crv-onesComplement* + ---------------- + The negative value is obtained by inverting all bits of the corresponding + positive value. + The most significant bit is the sign bit. Positive values have sign bit 0, + negative values have sign bit 1. + + Attributs: + +0 and -0 exists + Range: -2^(N-1) - 1 ... 2^(N-1) - 1 (e.g. 8bit: -127 ... +127) + conversion from positive to negative values and vice versa is simple + adding can be done directly, subtracting can be converted to adding + multiplication needs extra logic for sign + + - Two's Complement *crv-twosComplement* + ---------------- + The negative value is obtained by inverting all bits of the corresponding + positive value and adding 1. + The most significant bit is the sign bit. Positive values have sign bit 0, + negative values have sign bit 1. + + Attributs: + only one 0 exists + Range: -2^(N-1) ... 2^(N-1) - 1, asymetric (e.g. 8bit: -128 ... +127) + adding and multiplying is straight forward + sign extension when promoting is simple (repeat sign bit on the left) + +Which method is used to represent negative values is implementation specific, +commonly the two's complement is used. + + +Beneath decimal numbers (base 10), octal (base 8) and hexadecimal (base 16) +numbers can be used in standard C. + +Octal numbers start with a 0 (zero), hexadecimal start with a 0x (zero x). +Opposed to decimal numbers, conversions from and to binary is easier with +octal and hexadecimal numbers. +Octal groups 3 bits, one digit has range 0...7. +Hexadecimal groups 4 bits, one digit has range 0...9, A...F. + +Examples: + Bit + 15 14 13 12 11 10 9 8 | 7 6 5 4 3 2 1 0 + -------------------------------------------------- + 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 + | | | | | +octal: 1 | 6 | 4 | 5 | 3 | 1 = 0164531 + + + Bit + 15 14 13 12 11 10 9 8 | 7 6 5 4 3 2 1 0 + -------------------------------------------------- + 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 + | | | +hex: E | 9 | 5 | 9 = 0xE959 + + + + +I.5.2.2 Floating-Point *crv-dtFormatsFloat* +----------------------- + +I.5.2.2.1 Basics *crv-dtFormatsFPBasics* +----------------- +In standard C floating values are represented as described in the floating- +point standard IEC 60559 (previously IEEE-754). +NOTE: The standard does not define bit-positions! + +Generally a floating pointer number consists of four parts: + - sign + - mantissa + - radix + - exponent + + ---------------------------------------------- ~ + | value = sign * mantissa * radix^(exponent) |~ + ---------------------------------------------- ~ + +The sign is +1 or -1. The mantissa holds the significant digits of a +floating-point number and is always positive. +The exponent indicates the positive or negative power of the radix. To +be able to get positive and negative exponents a bias is added to the +actual exponent. + +A number can be expressed in many different ways, e.g.: + 3.0: 3.0 * 10^0 + 0.03 * 10^2 + 300 * 10^(-2) + ..... + +To maximize the quantity of representable numbers, floating-point numbers +are typically stored in a normalized form. +A normalized floating-point number has a mantissa that's leftmost digit +is non-zero. To normalize the mantissa is shifted left until the leftmost +digit is non-zero, the exponent is reduced by the number of shifts. +The normalized form of the number 3.0 would be: + 3.0 * 10^0 +A mantissa of a floating-point number fulfils the following equation: + + 1/radix <= mantissa < 1~ + +If this equation is not fulfilled, the floating-point number is called +denormalized. + +For bias 2 an optimization is available and exploited: for normalized +floating-point numbers the leftmost bit of the mantissa is always 1. +This bit don't need to be stored explicitly. We can assume it to be 1 so that +we get an extra bit to increase resolution (e.g. for float we have a 23 bit +mantissa, but a 24 bit resolution). + + +Special Values: *crv-dtFormatsFPValues* +--------------- +There are some special values explained below. + + Zero: *crv-dtFormatsFPZero* + ----- + All exponent and mantissa bits are set to 0. The sign bit can be set or + cleared, so that +0 and -0 is possible. Both are treated as 0.0. + + Note: There is no way to represent the value 0.0 in the format described + above. Because of normalization the leading digit must be unequal 0. + + Infinity: *crv-dtFormatsFPInfinity* + --------- + Infinity is signaled by all bits of exponent set and all bits of mantissa + cleared. The sign bit denotes +infinity and -infinity. + Infinity allows to handle overflows. + + NaN (Not a Number): *crv-dtFormatsFPNaN* + ------------------- + NaN is used to signal that the value is not a real number. NaN is denoted + by all exponent bits set and the mantissa != 0. + There are two types of NaN: Signalling NaN and Quiet NaN + Both indicates that something went wrong. + + Signalling NaN: + The most significant mantissa bit cleared denotes a signalling NaN. + A signalling NaN denotes an invalid operation (e.g. division by zero). + + Quiet NaN: + The most significant mantissa bit set denotes a quiet NaN. + A quiet NaN is set, if the result of an operation is not mathematically + defined. + + Denormalized: *crv-dtFormatsFPSDenorm* + ------------- + If the exponent is 0 and the mantissa is unequal 0, then the value is a + denormalized number. A denormalized number has no assumed 1 in the + mantissa. + + + +Special Operations: *crv-dtFormatsFPOp* +------------------- + + Operation | Result + -------------------------+------------ + n / +-infinity | 0 + +-nonzero / 0 | +-infinity + +-infinity * +-infinity | +-infinity + infinity + infinity | infinity + infinity - infinity | NaN + +-infinity / +-infinity | NaN + +-infinity * 0 | NaN + +-0 / +-0 | NaN + + + +I.5.2.2.2 Types *crv-dtFormatsFPTypes* +---------------- +Below commonly used floating-point formats are described. The bit positions +are not defined in standards, neither in standard C nor in IEEE-754. + +The radix is 2, so that the formula to get the value of a floating-point +number is: + + ------------------------------------------ ~ + | value = sign * mantissa * 2^(exponent) |~ + ------------------------------------------ ~ + +Float: *crv-dtFormatsFPFloat* +------ + Radix: 2 + Sign: 1 bit, = 0 positive, = 1 negative + Exponent: 8 bit, bias 127 + Mantissa: 23 bit, 24 bit resolution + Total Size: 32 bit + Range: 1.175494351e-38...3.402823466e+38 + Precision: >= 6 (number of digital digits of precision) + (see also |crv-dtSizeRange|) + + Bit: 31 30 23 22 0 + s eeeeeeee mmmmmmmmmmmmmmmmmmmmmmm + + s: signe + e: exponent + m: mantissa + + Examples: + s eeeeeeee mmmmmmmmmmmmmmmmmmmmmmm + 0.75 = 0 01111110 10000000000000000000000 + |___________ + | + e = 126 - 127 = -1 | + m = 1 (assume MSB 1) + 1/(2^1) + = 1.5 + value = 1.5 * 2^(-1) = 0.75 + + s eeeeeeee mmmmmmmmmmmmmmmmmmmmmmm + 12.75 = 0 10000010 10011000000000000000000 + | ||____________________________ + | |____________________ | + |___________ | | + | | | + e = 130 - 127 = 3 | | | + m = 1 (assume MSB 1) + 1/(2^1) + 1/(2^4) + 1/(2^5) + = 1.59375 + value = 1.59375 * 2^3 = 12.75 + + denormalized: + s eeeeeeee mmmmmmmmmmmmmmmmmmmmmmm + 1.46936...e-39 = 0 0000000 01000000000000000000000 + |________ + | + e = 0 - 127 = -127 | + m = 0 (no assumed MSB 1) + 1/(2^2) + = 0.25 + value = 0.25 * 2^(-127) = 1.4693679385278594e-39 + +Double: *crv-dtFormatsFPDouble* +------- + Radix: 2 + Sign: 1 bit, = 0 positive, = 1 negative + Exponent: 11 bit, bias 1023 + Mantissa: 52 bit, 53 bit resolution + Total Size: 64 bit + Range: 2.2250738585072014e-308...1.7976931348623158e+308 + Precision: >= 15 (number of digital digits of precision) + (see also |crv-dtSizeRange|) + + Bit: 63 62 52 51 0 + s eeeeeeeeeee mmmmmmmm...mmmmmmmmmmmm + + s: signe + e: exponent + m: mantissa + + +Long Double: *crv-dtFormatsFPLDouble* +------------ + Radix: 2 + Sign: 1 bit, = 0 positive, = 1 negative + Exponent: 15 bit, bias 16383 + Mantissa: 64 bit, 64 bit resolution(!), no assumed 1 in MSB + Total Size: 92 bit, 80 bit used + Range: 3.36210314311209351e-4932...1.18973149535723177e+4932 + Precision: >= 18 (number of digital digits of precision) + (see also |crv-dtSizeRange|) + + Bit: 79 78 64 63 0 + s eeeeeeeeeeeeeee mmmmmmmm...mmmmmmmmmmmm + + s: signe + e: exponent + m: mantissa + + +------------------------------------------------------------------------------ +I.5.3 void Type *crv-dtVoid* + *crv-void* +The$void$type specifies an empty or NULL type. This is used to: + - signify that a function does not return a value + - specify a function prototype with no arguments + - indicate a generic pointer + A generic pointer can point to any object type. No type cast is + necessary. + +Examples: + - function with no return value > + void Func(int n) + { + ... + } +< + - function with no arguments > + int Func (void) + { + ... + } +< + - generic pointer > + int i; + long l; + void *ptr; + + ptr = &i; + ptr = &l; +< + + + +------------------------------------------------------------------------------ +I.5.4 Arrays *crv-dtArrays* + +Syntax: +$storage-class-specifier type-specifier declarator[constant-expression$or$*];$ + +$storage-class-specifier$,$constant-expression$and$*$are optional + +Arrays are used to group data types of the same type. An array can be of any +data type, except$void$. + +When addressing an index within this array, indexing starts at 0 and ends +at array-size(in elements) - 1. + +An array has only one dimension. To get a multidemsional array an array of +array(s) can be declared. +The elements of arrays are stored in increasing addresses so that the +rightmost subscript varies most rapidly. +Example: $int n[2][3];$ + the elements are stored in this sequence: + n[0][0], n[0][1], n[0][2], n[1][0], n[1][1], n[1][2] + + It can be initialized with: + $int n[2][3] = { {0, 1, 2}, {3, 4, 5} };$ + + +Complete Array Type Declaration *crv-dtCompleteArrayDecl* +------------------------------- + +A complete array type declaration is a declaration of an array with known +size. The number of elements an array stores is specified at declaration. + +E.g.: $int array[2];$ + +The number of elements must be a constant value of >= 1 or a$*$. + +If a$*$is specified then the array type is a variable-length array type of +unspecified size, which can be used only in declarations with function +prototype scope. + + +Incomplete Array Type Declaration *drv-dtIncompleteArrayDecl* +--------------------------------- + +It is possible to declare an array of unknown size by omitting the size- +information at declaration. This sort of array declaration is called +incomplete array declaration. The size of an incomplete array declaration must +be specified elsewhere, so that the array type itself is complete. + +Incomplete array type declaration is useful for: + - When initializing at declaration. E.g.: > + char name1[] = "bert"; // end of string (0x00) is added automatically + char name2[] = {'b', 'e', 'r', 't', '\0'}; +< + The size of both arrays is 5 bytes. The initialization does complete the + array type. + + - To reference to an external defined array with known size: > + extern array[]; + + int main(void) + { + array[0] = 42; + .... + } +< + To work with this array, its size must be known of course. + + - For function parameter incomplete array type declaration can be used in the + function's declaration. E.g. > + void func(int array[]) + { + array[0] = 2; + } +< + A pointer must be passed to this function! + + +Initialization of Arrays *drv-dtArrayInit* +------------------------ + +Arrays can be initialized at definition time. It is allowed to initialized +less or all elements of a array. If less are initialized the remaining +elements are set to 0 automatically. + + Initialize all elements of the array, e.g.: + $int a[2] = {1, 2};$ + + Initialize the first elements, the rest is set to 0: + $int a[5] = {1, 2, 3};$ + Not allowed is to initialize more elements as the array can store: + $int a[5] = {1, 2, 3, 4, 5, 6}; // ERROR at compilation time$ + + Initialize multidimensional arrays: + $int b[2][3] = { {0, 1, 2}, {3, 4, 5} };$ + + Initialize incomplete arrays: + $char name1[] = "bert"; // end-of-string (0x00) is added$ + $char name2[] = {'b', 'e', 'r', 't', '\0'};$ + + Attention when assigning strings to arrays: + The end-of-string (0x00) is added only if the string fits into array: + $char ch[3] = "abc" // no end-of-string (0x00) is added here!$ + $char ch[4] = "abc" // end-of-string is added$ + $char ch[] = "abc" // end-of-string is added, array gets dimension of 4$ + + + +------------------------------------------------------------------------------ +I.5.5 Structures *crv-dtStructurs* + *crv-struct* +Syntax: + $struct$structur-name${$ + $variables,...$ + $}$structur-variable,...$;$ + + +Structures are used to group heterogenous data. The elements (members) of a +structure can be of different data types (opposed to arrays). All data types +are allowed, except$void$type. +The member names must be unique within a structure, but the same names can be +used in nested structures. +A structure cannot contain instances of themselves, but can have pointers +to instances of themselves as members. + +The members are stored sequentially in increasing addresses. The first member +is at the starting address of a structure. But a compiler is free to add +pad-bytes for alignment. So the total size of a structure may differ from the +sum of member-sizes. +A pointer to a structure points to the starting address of the structure, +there the first member is stored. + +To access a member of a structure, the structure selector$.$is used. To access +a member of a structure a pointer points to$->$is used. + +A structure can be passed by value to functions and returned by value by +functions. Allowed operators with structures are$=$and$sizeof$. + + +Declaration *crv-dtStructDef* +----------- +To declare a structure the 'structur-variable' is omitted, e.g.: > + struct myStruct { + int n; + char *name; + long counter; + }; +No variable is generated here, it's the declaration of a structure with +name myStruct. To get an object do: +$ struct myStruct ms;$ + + +Definition *crv-dtStructDecl* +---------- +A definition can be done in several ways: + + - If a structure is declared already, a definition is done this way: + $struct Person pers;$ + perss is the object generated + + - Declaration and definition can be done both, e.g.: > + struct Person { + int age; + char *name; + } pers1; +< An object pers1 is generated. 'structur-variable' can be a comma- + separated list of variables, e.g.: > + struct Person { + int age; + char *name; + } pers1, pers2, pers3; +< The objects pers1, pers2 and pers3 are generated. + + Further definitions can be done via: + $struct Person pers4;$ + because a 'structure-name' was specified above. + + - Only definition, no 'struct-name' specified, e.g.: > + struct { + int age; + char *name; + } pers1; +< An object pers1 is generated. + + +Initialization *crv-dtStructInit* +-------------- +Structures can be initialized at definition time. It is allowed to initialized +less or all members of a structure. If less are initialized the remaining +elements are set to 0 automatically. + +Examples: > + struct Person { + int age; + char *name; + } pers1 = {42, "Sting"}; +<or > + struct Person pers2 = {42, "Sting"}; + + +Accessing *crv-dtStructAccess* +--------- +A member of a structure can be accessed via$.$,e.g.: > + myStruct.age = 42; + myStruct.anotherStruct.n = 3; + +A member of a structure a pointer points to can be accessed via$->$, e.g.: > + myStructPtr->age = 42; + myStructPtr->anotherStruct.n = 3; + + +------------------------------------------------------------------------------ +I.5.6 Unions *crv-dtUnions* + *crv-union* +Syntax: + $union$union-name${$ + $variables,...$ + $}$union-variable,...$;$ + + +A union is used to store objects of different data types at the same location +in memory. All members of a union have offset 0 to the start address of the +union. Enough space is allocated only for the largest member in the union. + +For members all data types are allowed, except$void$type. The member names +must be unique within a union, but the same names can be used in nested +unions. A union cannot contain instances of themselves, but can have pointers +to instances of themselves as members. + +A pointer to a union points to the starting address of the union. + +To access a member of a union, the union selector$.$is used. To access a +member of a union a pointer points to$->$is used. + +A union can be passed by value to functions and returned by value by +functions. Allowed operators with unions are$=$and$sizeof$. + + +Declaration *crv-dtUnionDef* +----------- +To declare a union the 'union-variable' is omitted, e.g.: > + union Integers { + char c; + short s; + int n; + long l; + }; +No variable is generated here, it's the declaration of a union with name +Integers. To get an object do: +$ union Integers ints;$ + + +Definition *crv-dtUnionDecl* +---------- +A definition can be done in several ways: + + - If a union is declared already, a definition is done this way: + $union Integers ints;$ + ints is the object generated + + - Declaration and definition can be done both, e.g.: > + union Integers { + char c; + short s; + int n; + long l; + } ints1; +< An object ints1 is generated. 'union-variable' can be a comma- + separated list of variables, e.g.: > + union Integers { + char c; + short s; + int n; + long l; + } ints1, ints2, ints3; +< The objects ints1, ints2 and ints3 are generated. + + Forther definitions can be done via: + $union Integers ints;$ + because a 'union-name' was specified above. + + - Only definition, no 'union-name' specified, e.g.: > + union { + char c; + short s; + int n; + long l; + } ints1; +< An object ints1 is generated. + + +Initialization *crv-dtUnionInit* +-------------- +Unions can be initialized at definition time, but only the first member can +be given an initializer. + +Examples: > + union Integers { + char c; + short s; + int n; + long l; + } ints1 = {'a'}; +<or > + union Integers ints2 = {'a'}; + + +Accessing *crv-dtUnionAccess* +--------- +A member of a union can be accessed via$.$,e.g.: > + myUnion.age = 42; + myUnion.anotherUnion.n = 3; + +A member of a union a pointer points to can be accessed via$->$, e.g.: > + myUnionPtr->age = 42; + myUnionPtr->anotherUnion.n = 3; + + + +------------------------------------------------------------------------------ +I.5.7 Bit-Fields *crv-dtBitFields* + +Syntax: + $type-specifier identifier:constant-expression$ + +A member of a structure or union can be declared to consist of a specified +number of bits. Such a member is called a bit-field. +A bit-field can be of type$_Bool$,$signed int$,$unsigned int$or of some other +implementation specific type. The specified number of bits for a bit-field +must be small enough to be stored in its type. + +Sequences of bit-fields are packed as tightly as possible, they are assigned +from low-order to high-order bit. +If in a sequence of bit-fields a further bit-field is specified, and this +bit-field does not fit into the remaining bits, it's implementation-specific +whether this bit-field is put into the next unit or overlaps adjacent units. + +A bit-field can be closed in two ways: + - specify a data-type !=$bit-field$, a following bit-field will be started + in a new unit at low-order bit + - specify a bit-field with size 0, a following bit-field will be started + in a new unit at low-order bit + +For padding it is possible to declare a bit-field without identifier +(e.g. :10). + +Pointers to bit-field are not possible. + +Examples: > + struct BitField { + unsigned int a:2; + unsigned int :3; // leave 3 bits free + unsigned int b:4; + unsigned int :0; // force to start new unit + + unsigned int c:4: + unsigned int c:1; + + long lng; + + unsigned int d:2; // start a new unit since the previous type is + // not a bit-field + }; +< + also possible would be > + struct BitField { + unsigend int a:2, + :3, // leave 3 bits free + b:4, + :0, // force to start new unit + + c:4, + c:1; + + long lng; + + int d:2; // start a new unit since the previous type is + // not a bit-field + }; + + +Accessing a bit-field is done this way: > + struct BitField { + unsigend int a:2, + b:3; + } bf; + + bf.a = 3; + bf.b = 0; + + + +------------------------------------------------------------------------------ +I.5.8 Enumerated Tags *crv-dtEnumerate* + *crv-enum* +Syntax: + $enum identifier{enumerator-list} declarator;$ + + +An enumeration type is a user-defined integer type. The possible values of +this type are defined in the$enumerator-list$. The elements of this list are +symbolic representations of constant integers. +Each element of the$enumerator-list$gets the value of the previous plus 1. +The first element gets the value 0. Alternatively values can be assigned to +the elements. + +All this could be achieved by using$#define$too. The advantage of enumeration +types is that debuggers can view values of enumeration type objects +symbolically. + + +Examples: + $enum color {red, yellow, green};$ + + $color$is a new integer type that can have the values$red$(=0),$yellow$(=1) + and$green$(=2). + +Assignment can be done this way: > + color col; + col = red; + +To assign values to the constants do: + $enum color {red=10, yellow, green=20, white};$ + + $color$is a new integer type that can have the values$red$(=10),$yellow$ + (=11),$green$(=20) and$white$(=21). + + + +------------------------------------------------------------------------------ +I.5.9 Strings *crv-dtStrings* + +In C a string is an array of characters encapsulated in double quotes. At +the end of the string an end-of-string (0x00} is appended. + +Example: > + char strng[] = "this is a string"; + + + +------------------------------------------------------------------------------ +I.5.10 Type Definitions *crv-dtTypeDef* + +A type definition is used to define a type synonym for a data type. +Type definitions are just aliases. The compiler replaces a type definition +by its assigned type. + +Type definitions can apply to variables or functions. + +Type definitions provide: + - It is possible to replace a lengthy and/or confusing type definition + by an expressive one. + - Type definitions can simplify the process of changing the type of + variables. Example: + $typedef short coordinate;$ + If you notice that$short$is too small for your needs, simply change it: + $typedef long coordinate;$ + and all variables of the type$coordinate$will have the new type$long$. + +Example for data type: > + typedef int * pointerToInt; + + pointerToInt iPtr; // is identical to: int *iPtr; + +Example for function: > + typedef int calculate(int a, int b); // function returns int, and gets + // two ints + calculate sum; // declarate functions + calculate dif; + + int sum(int a, int b) // definition: parameters and return type + { // must be according to the typedef + return a + b; + } + + int dif(int a, int b) + { + return a - b; + } + + + +------------------------------------------------------------------------------ +I.5.11 Storage Classes *crv-dtStorageClasses* + +A storage class defines the scope and lifetime of a variable or function. + see |crv-gloScope|, |crv-gloLifetime| + + Storage Class | + Specifier | Description + ---------------+------------------------------------------------------------ + $ auto $| default, local variable has local lifetime + $ static $| local variable, but maintained during program execution + $ extern $| indicates that a variable is defined outside of the current + | file, no variable is created by this + $ register $| request to access variable as fast as possible (normally + | this means to store an object in a CPU register) + $ typedef $| creates an alias name for a basic or derived data type + none, in | a global variable is defined + file scope | + + + +$auto$ *crv-auto* +------ +The$auto$class specifies a local variable with local lifetime. The storage of +a variable is created upon entry to the block defining the variable, and is +destroyed when exiting the block. + +The contents of a new defined$auto$object is undefined. + +This class can only be declared at the beginning of a block { ... }. +If no storage class if given, this is the default. + +Example: > + int main(void) + { + int a; // auto can be omitted, it's the default + auto int b; + auto long c = 10L; // initializer can be used + + .... + } + + +$static$ *crv-static* +-------- +The$static$class specifies that an object is maintained during the whole +program execution, but it's accessable only within its scope (block or file). +Several objects with the same identifier can co-exist, as long as they have +different scopes. + +A$static$object can be declared anywhere a declaration is allowed. + +The contents of a new$static$object is initialized, arithmetic members are +set to 0, pointer members are set to NULL. If an initializer is given, the +object is initialized only once at program start. Its contents is preserved +after leaving object's scope. + +Example: > + int TestFunction () + { + static int b; // initialized with 0 automatically + static long c = 10L; // initializer can be used + + if (c == 10L) + { + b++; + c++; + } + .... // next time calling b will be 1 and c will be 11 + } + + +$register$ *crv-register* +---------- +The$register$class suggests the compiler to minimize access time for +a variable. Normally this means to assign the value to a register. +The compiler is free to do so or not. +The lifetime is the same as for$auto$. + +The$register$class is the only storage class specifier that can +be used for function parameters too. + +Example: > + int TestFunction (register int a) + { + register int b; + ... + } + + +$extern$ *crv-extern* +-------- +Using$extern$in a declaration brings the named object into the current scope, +the object must be a global one. This is used to access objects that are +defined out of the current file (linkage ->|crv-gloLinkage|). + +No new variable is generated, it is just a link to an existing one. + +Example: > + File 1: File 2: + ------- ------- + int globVar2 = 42; extern int globVar2; + + int main(void) void TestFunc(void) + { { + .... globVar2 = 3; + } ... + } + + +$typedef$ *crv-typedef* +--------- +The$typedef$is used to create an alias for a basic or derived (array, struct, +union) data type. +Actually$typedef$isn't a real storage class, but in standard C it is defined +to be one. +No new variable is generated. +For further information see |crv-dtTypeDef|. + + +Global Variable +--------------- +A global variable is defined when the definition is within file scope and +no storage class specifier is given. + +A global object is initialized, arithmetic members are set to 0, pointer +members are set to null pointer, in unions the first named member is +initialized according to this rules. An initializer can be given. + +To access a global variable from outside of its scope, declare this +variable with$extern$class in the new scope. + +Example: > + File 1: File 2: + ------- ------- + int globVar; extern int globVar2; + + int globVar2 = 42; + + int main(void) void TestFunc(void) + { { + .... globVar2 = 3; + } ... + } + + +------------------------------------------------------------------------------ +I.5.12 Qualifiers *crv-dtQualifiers* + +The type qualifiers allow to set further attributes of data types. + + Type Qualifier | Description + ----------------+------------------------------------------------------------ + $ const $| no write access to a variable + $ restrict $| only for pointers: gives compiler better possibilities for + | optimizations + $ volatile $| disable compiler optimization for a variable + + + +$const$ *crv-const* +------- +The$const$type qualifier is used to qualify an object as not modifiable. This +means no write access is allowed to this object after initialization. +The$const$qualifier can be used for any data type and together with$volatile$. + +When$const$is used to qualify an aggregate type (array, struct, union) all +members are$const$. When$const$is used to qualify a member of an aggregate +only that member is$const$. + +NOTE: Attempting to change a$const$object using a pointer to a non-$const$ +object causes unpredictable behavior. + +Example: > + const a = 5; // a = 5 and a is not modifiable + + const struct Test { + int b; + char *title; + } test; // all members of test are const + + const int *ptr; // pointer to a constant integer type + // pointer is allowed to change, contents not + + int *const ptr; // constant pointer; pointer is not allowed to change + // contents is allowed to change + + const int *const ptr; // both pointer and contents are not allowed + // to change + + +$restrict$ *crv-restrict* +---------- +The$restrict$qualifier can only be used for pointers. It indicates that the +compiler is allowed to make optimizations when dealing with this pointer. + +Normally compilers can do very less optimizations to pointers because the +compiler cannot determine whether or not two pointers point to the same +object. So the compiler must suppress various optimizations. + +The user guarantees that none of the$restrict$qualified pointers do +point to the same object. So the compiler can do further optimizations +for these pointers. + + +$volatile$ *crv-volatile* +---------- +The$volatile$qualifier indicates that the value of an object can possibly be +changed outside of compiler's control (e.g. changes done by other processes, +hardware registers of mikrocontrollers,...). The$volatile$qualifier forces +the compiler to take this into account. The compiler must access the object +always from memory and most optimizations can't be done. + +The$volatile$qualifier can be used for any data type and together with$const$ +qualifier. +When$volatile$is used to qualify an aggregate type (array, struct, union) all +members are$volatile$. When$volatile$is used to qualify a member of an +aggregate only that member is$volatile$. + +Example: > + volatile int a; + + int main(void) + { + .... + } + + +Hint: When type casting a volatile variable, the volatile qualifier will be + lost if it is omitted in the type cast operator. + +Example: > + volatile int ptrA; + long ptrB; + + ... + + ptrA = (int *)ptrB; // ATTENTION: after this, ptrA is no + // longer volatile! + + ptrA = (volatile int *)ptrB; // ptrA is still volatile + + + + + + +------------------------------------------------------------------------------ +I.5.13 Pointers *crv-dtPointers* + +A pointer contains the address of a variable of stated type, function or +memory area. + +A pointer can have a special value indicating that the pointer points to +nowhere. Such a pointer is called null pointer, its value is NULL. +A pointer of type$void$can be used to point to an object of any type. +A pointer can point to pointers. + +A pointer is declared using the$*$punctuator. The operator$*$is used to +dereference a pointer in order to have access to the contents of the object +the pointer points to. + + +I.5.13.1 Variables *crv-dtPtrVars* +------------------- +To assign the address of a variable to a pointer the address operator$&$is +used. To dereference the$*$operator is used. + +Example simple pointer: > + int n = 3; + int *ptr; // define pointer of type int + + ptr = &n; // pointer points to n + *ptr = 4; // assign object pointer points to value 4 (=> n=4) + +Example pointer to pointer: > + int n = 3; + int *ptr1; // pointer to int + int **ptr2; // pointer to pointer to int + + ptr1 = &n; // pointer ptr1 points to int n + ptr2 = &ptr1; // pointer ptr2 points to pointer to int n + **ptr2 = 4; // dereference pointer to pointer and assign 4 (n = 4) + +A pointer can be set to a fix address this way (not standard C): > + int *ptr; + + ptr = (int *)42000; + + +Pointer and Arrays +------------------ +Example pointer to array: > + int n[2]; + int *ptr; + + ptr = &n[0]; + ptr = n; // is equivalent to ptr = &n[0] + +Example array of pointers: > + int *ptrs[3]; // array of pointers to int + int n1 = 1, n2 = 2, n3 = 3; + + ptrs[0] = &n1; + ptrs[1] = &n2; + ptrs[2] = ptrs[0]; + + +Pointer to String +----------------- +A sequence of characters encapsulated with double quotes is a pointer to +const character. +Example: > + char *ptr; + + ptr = "string"; + + + +I.5.13.2 Functions *crv-dtPtrFuncs* +------------------- +A pointer can point to a function and the function can be called via pointer. + +A function pointer is defined in a similar way as a function prototype, the +function name is replaced with$(*pointer-name)$. + +Example: > + int (*funcPtr)(int a, int b); // define a function pointer "funcPtr" + + funcPtr = anyFunction; // assign function to pointer + + c = funcPtr(2, 3); // call via function pointer + + +Example: > + int sum(int a, int b) + { + return a + b; + } + + + int (*funcPtr)(int a, int b); // define a function pointer + + int main(void) + { + int a; + + funcPtr = sum; // assign function to pointer + + a = funcPtr(2, 3); // same as a = sum(2, 3); + + printf("%d\n", a); // 5 is printed + } + + +Example, call function at absolut address: > + + // call a function of type int Func(int nNumOf) + // located at address 0x42000 + + // typedefs make usage of function pointers a little bit clearer + + typedef int (*FuncPtr)( int nNumOf ); + + + int main(void) + { + FuncPtr func1; + + ... + + func1 = (FuncPtr)0x42000; // assign address to function pointer + + result = func1( n ); // call function func1 points to + } + + + + +I.5.13.3 Arithmetics *crv-dtPtrArithmetics* +--------------------- + +Some operators are allowed to be used on pointers. + + +Relational Operators +-------------------- +The relational operators$==$,$!=$,$>$,$<$,$>=$,$<=$are allowed if both +operands are pointers of the same type and both pointers point to an element +of the same array or to the first element after that array. + +The operators$==$and$!=$are allowed in any case if one of the operands is a +null pointer (NULL). + + +Negation +-------- +The logic negation$!$is allowed. +The negation of a null pointer (value NULL) is an integer value 1. The +negation of a pointer not equal NULL is an integer value 0. + + +Increasing and Decreasing +------------------------- +Increasing or decreasing of pointers of type$void$is not allowed, because the +size of the object a$void$pointer points to is unknown. + +For other pointer types it is allowed to add / subtract an integer value. +If an integer value N is added to a pointer the pointer points to the Nth +element located after the element the pointer pointed to before adding. +If an integer value N is subtracted from a pointer the pointer points to the +Nth element located before the element the pointer pointed to before +subtracting. + +Allowed operations: > + pointer + integer-value + pointer - integer-value + pointer++ + pointer-- + ++pointer + --pointer + + +Subtraction +----------- +Pointers can be subtracted. Both pointers must not be of type$void$. +Both pointers must be of the same type and must point to an element of the +same array or to the first element after that array. + +The operation$pointer1 - pointer2$returns the number of elements separating +them (negative value if pointer1 < pointer2). + + +Assignments +----------- +Assignments of pointers are of course allowed. The pointers must be of the +same type (if needed a type cast is to be done). + +Compound assignments are allowed as long as the requirements for increasing, +decreasing and subtracting are fulfilled. + +Allowed assignments: > + pointer1 = pointer2 + pointer += integer-value + pointer -= integer-value + pointer1 -= pointer2 + +------------------------------------------------------------------------------ +I.5.14 Type Cast *crv-dtTypeCast* + +Type cast is an operation that converts the type of an operand into another +type. There are two types of casts, explicit and implicit. + + +I.5.14.1 Explicit *crv-dtTypeCastExpl* +------------------ +The explicit type cast is done with the type cast operator$(type-name)$. +Example: > + int main(void) + { + int nVar = 42; + float fVar; + + fVar = (float)nVar; + } + + +I.5.14.2 Implicit *crv-dtTypeCastImpl* +------------------ +Implicit type casts are done by the compiler according to well defined rules. + +A compiler does an implicit type cast: + - When two or more operands of different types appear in an expression. + - When arguments are passed to a function that do not conform to the + parameters declared in a function prototype. + + +When a floating-type operand is converted to an integer, the fractional part +is discarded. + + + - If either operand is not of arithmetic type, no conversion is performed. + + - If either operand has type$long double$, the other operand is converted + to$long double$. + + - Otherwise, if either operand has type$double$, the other operand is + converted to$double$. + + - Otherwise, if either operand has type$float$, the other operand is + converted to$float$. + + - Otherwise the following rules apply: + + - If both operands have signed integer types or both operands have + unsigned integer types the operand with the type of lesser rank + is converted to the type of the operand with greater rank. + + - Otherwise, if the operand that has unsigned integer type has rank + greater or equal to the rank of the other operand, then the operand with + signed integer type is converted to the type of the operand with + unsigned integer type. + + - Otherwise, if the type of the operand with signed integer type can + represent all of the values of the type of the operand with unsigned + integer type, then the operand with unsigned integer type is converted + to the type of the operand with signed integer type. + + - Otherwise, both operands are converted to the unsigned integer type + corresponding to the type of the operand with signed integer type. + + +Ranking is $long long$>$long$>$int$>$short$>$char$>$bit-field$ + no matter whether singed or unsigned + + + +------------------------------------------------------------------------------ +I.5.15 Constants *crv-dtConstants* + +Beneath$enum$there are three categories of constants in C, they are described +below. + + +I.5.15.1 Integer *crv-dtConstInt* +----------------- + +An integer constant can be specified in decimal, hexadecimal or octal. A +suffix can be added to specify a constant's type. + +Decimal~ +To specify a decimal constant, the first digit must be a 1...9. For the +following digits the characters 0...9 are allowed. + +Hexadecimal~ +To specify a hexadecimal constant, a prefix 0x or 0X must be in front of the +hexadecimal number. For hex-numbers the characters 0...9, a-f and A-F are +allowed. + +Octal~ +To specify an octal constant the first digit must be a 0 (zero). For the +following digits the characters 0...7 are allowed. + + +Type~ +The type of an integer constant is the first of the corresponding list +in which its value can be represented: + + | | octal or hexadecimal + Suffix | decimal constant | constant + ==============+========================+======================== + none |$int $|$int$ + |$long int $|$unsigned int$ + |$long long int $|$long int$ + |$ $|$unsigned long int$ + | |$long long int$ + | |$unsigned long long int$ + -------------+------------------------+------------------------ + $u$or$U$ |$unsigned int$ |$unsigned int$ + |$unsigned long int$ |$unsigned long int$ + |$unsigned long long int$|$unsigned long long int$ + -------------+------------------------+------------------------ + $l$or$L$ |$long int$ |$long int$ + |$long long int$ |$unsigned long int$ + | |$long long int$ + | |$unsigned long long int$ + -------------+------------------------+------------------------ + both$u$or$U$|$unsigned long int$ |$unsigned long int$ + and$l$or$L$ |$unsigned long long int$|$unsigned long long int$ + -------------+------------------------+------------------------ + $ll$or$LL$ |$long long int$ |$long long int$ + | |$unsigned long long int$ + -------------+------------------------+------------------------ + both$u$or$U$ | | + and$ll$or$LL$|$unsigned long long int$|$unsigned long long int$ + -------------+------------------------+------------------------ + + +I.5.15.2 Floating-Point *crv-dtConstFloat* +------------------------ +A floating constant has a significant part that may be followed by an exponent +part and a suffix that specifies its type. + +If a floating constant has no suffix, its type is$double$. If suffix is$f$or +$F$it has type$float$. If suffix is$l$or$L$its type is$long double$. + + Example | Value | Type + -----------+---------+------------- + .0 | 0.00000 | double + 1. | 1.00000 | double + 2.23 | 2.23000 | double + 2e2 | 200.000 | double + 2.e2 | 200.000 | double + 2.0e2 | 200.000 | double + 2.0e+2 | 200.000 | double + 2.0e-2 | 0.02000 | double + 3.4f | 3.40000 | float + 3.4l | 3.40000 | long double + + + +I.5.15.3 Character *crv-dtConstChar* +------------------- +A character constant is any character from the source character set enclosed +in apostrophes. +See escape sequences (-> |crv-lngEscSeq|) for special characters. + +Examples: > + char a; + + a = 'd'; + a = '\x2F'; + + + +============================================================================== +I.6 Statements *crv-statements* + + +------------------------------------------------------------------------------ +I.6.1 if-else *crv-stIfElse* + *crv-if* *crv-else* +Syntax: $if (expr1)$ + $ statement1$ + $else$ + $ statement2$ + + +If$expr1$is not equal to 0,$statement1$is done. If$expr1$is equal to 0, +$statement2$is done. The$else$-part is optional. + + +------------------------------------------------------------------------------ +I.6.2 switch *crv-stSwitch* + *crv-switch* *crv-case* *crv-default* +Syntax: $switch (expr1) {$ + $ case constant-expression1:$ + $ statement1$ + $ ...$ + $ default:$ + $ statementN$ + $}$ + + +Both$case$and$default$-part are optional. + +If$expr1$is equal to one of the$constant-expressions$in the$case$labels, +the according $statement$is executed. The$default$-part is entered, +if$expr1$is not equal to one of the$constant-expressions$of the$case$labels. + +If a$statement$is done, the following$statements$are done until the end of +the$switch$statement is reached or a$break$is done. + +There can be several$case$labels, but only one$default$label. The order is +arbitrary. + + + +------------------------------------------------------------------------------ +I.6.3 while Loop *crv-stWhile* + *crv-while* +Syntax: $while (expr1)$ + $ statement$ + + +The$while$statement provides an iterative loop. +The loop body ($statement$) is executed as long as$expr1$is true (!=0). If +$expr1$is false (=0) the loop is finished. +The expression$expr1$is evaluated before$statement$is executed. + + +------------------------------------------------------------------------------ +I.6.4 do-while Loop *crv-stDoWhile* + *crv-do* +Syntax: $do$ + $ statement$ + $while (expr1);$ + + +The$do-while$statement provides an iterative loop. +The loop body ($statement$) is executed as long as$expr1$is true (!=0). If +$expr1$is false (=0) the loop is finished. +The expression$expr1$is evaluated after$statement$is executed (opposed to +$while$-loop). + + +------------------------------------------------------------------------------ +I.6.5 for Loop *crv-stFor* + *crv-for* +Syntax: $for (expr1; expr2; expr3)$ + $ statement$ + +The expressions$expr1$,$expr2$and$expr3$are optional. + + +The$for$statement provides an iterative loop. + +$expr1$: This expression is evaluated once before the first execution of the + loop body. Usually this is used to initialize variables used in the + loop body (e.g. loop counter). + +$expr2$: The loop body ($statement$) is executed as long as$expr2$is true + (!=0). If$expr2$is false (=0) the loop is finished. + If$expr2$is omitted, the expression is always true (infinite loop). + +$expr3$: This expression is evaluated after each iteration. + +The expression$expr2$is evaluated before$statement$is executed. + + +------------------------------------------------------------------------------ +I.6.6 break *crv-stBreak* + *crv-break* +Syntax: $break;$ + + +The$break$statement is used to immediately terminate the execution of the +enclosing$switch$,$for$,$while$or$do-while$statement. + + +------------------------------------------------------------------------------ +I.6.7 continue *crv-stContinue* + *crv-continue* +Syntax: $continue;$ + + +The$continue$statement is used to immediately jump to the end of the +enclosing$for$,$while$or$do-while$statement. + + +------------------------------------------------------------------------------ +I.6.8 goto *crv-stGoto* + *crv-goto* +Syntax: $goto identifier;$ + + +The$goto$statement causes an unconditional jump to a labeled statement +that is specified by$identifier$. The labeled statement must be in the scope +of the function containing the$goto$statement. + +A$goto$statement is not allowed to jump past any declaration of objects. +Apart from this jumping into other blocks is allowed. + + +------------------------------------------------------------------------------ +I.6.9 return *crv-stReturn* + *crv-return* +Syntax: $return expr1;$ + +$expr1$is optional + + +The$return$statement terminates execution of the current function and returns +control to its caller. If present,$expr1$is evaluated and its value is +returned to the calling function. If the type of$expr1$is not the same as +the type of the function, implicit type cast is done. + +A$return$statement can appear anywhere in a function, several$return$ +statements are allowed. + +For functions of type$void$either a return without$expr1$must be given or +no$return$statement ($return;$and the enclosing$}$of the function are treated +as the same). + + +------------------------------------------------------------------------------ +I.6.10 Null Statement *crv-stNull* + +Syntax: $;$ + + +A null statement performs no operation. A null statement is used in situations +where the grammar of C requires a statement, but the program needs no +operation. + +Usage: + - supply an empty loop body + Example: > + char *strngPtr; + + while (*stngPtr++ != 'a') // search first 'a' in string + ; +< + - set a label just before the closing$}$ + Example: > + .... + } + end_loop: ; + } + + + + +============================================================================== +I.7 Functions *crv-functions* + + +------------------------------------------------------------------------------ +I.7.1 Definition *crv-fuDefinition* + + $return-type function-name(parameter-list, ...) {$ + $ statement...$ + $}$ + + $return-type$ type of value returned by function + $function-name$ name of function + $parameter-list$ list of parameters passed to function + + +The$return-type$is the type the function returns. It can be any type except +array types or function types. If no value is returned,$void$must be used. +If$return-type$is omitted,$int$is assumed. + +The$function-name$is the identifier under that a function can be called +(see |crv-gloIdentifier| for valid names). + +The$parameter-list$specifies the parameters a function expects when called. +A function can have no parameter, a specific number of parameters or +a variable number of parameters. + + - No Parameter + -------------- + $parameter-list$must be$void$ + Example: > + int Func(void) + { + ... + return 0; + } +< + - One or More Parameters + ------------------------ + $parameter-list$is a comma separated list of parameter specifications. + Each parameter must be specified this way: $type-name identifier$ + $type-name$ : type of the parameter, if omitted$int$is used + $identifier$: identifier under which this parameter can be referenced + within the function + Example: > + int Func(char ch, int cntr) + { + if ( (ch == 'q') || (cntr == 42) ) + exit(0); + + return 0; + } +< + - Variable Number of Parameters *crv-fuDefVarPara* + ------------------------------- + $parameter-list$is a comma separated list of parameter specifications + ending with an ellipsis ($,...$). + Functions declared in$<stdarg.h>$can be used to access arguments. + + Example: > + #include <stdarg.h> + #include <stdio.h> + + + void Func(int numOfArgs, ...) + { + int n; + va_list ap; + + va_start(ap, numOfArgs); // initialize + + for (n = 0; n < numOfArgs; n++) + printf("%d ", va_arg(ap, int)); // get next argument, type is int + + printf("\n"); + + va_end(ap); // finish + } + + + int main(void) + { + Func(1, 100); // output is 100 + Func(2, 100, 101); // output is 100 101 + Func(3, 100, 101, 102); // output is 100 101 102 + } +< + +A parameter can be of any type. But parameters of array type or function type +are converted automatically to pointers. +Example: > + #include <stdio.h> + + + int Func2() + { + return 3; + } + + + void Func1(int n[3], int (*func)(void)) + { + n[0] = 1; + n[1] = 2; + n[2] = func(); + } + + int main(void) + { + int n[3] = {5, 5, 5}; + + Func1(n, Func2); + + printf("%d %d %d\n", n[0], n[1], n[2]); // output is 1 2 3 + + } +< + +The only allowed storage class for a parameter is$register$. +All kinds of type qualifiers are allowed for parameters. + +Arguments are passed by value, that means that a function receives a copy +of the argument's value. +The order of evaluation of arguments is not specified. + + + +------------------------------------------------------------------------------ +I.7.2 Prototype *crv-fuPrototype* + + $return-type function-name(parameter-list, ...);$ + + +If a function is used before it's defined then it must be prototyped, so +that the compiler knows about return type and parameter types of the function, +else$int$is assumed for return type and parameter types. + +A prototype is identical to the function header with the addition of an +ending$;$. Function prototypes need not use parameter identifiers. Only the +types are required. + +Normally prototyping occurs at the beginning of a source code file or in a +header file. + + +Example: > + int Func(char ch); + + + int main(void) + { + if (Func1('q') == 2) + { + .... + } + } + + + int Func(char ch) + { + ... + } +< + + +------------------------------------------------------------------------------ +I.7.3 Conversion *crv-fuConversion* + + +If a function is called the arguments must be of the same types as specified +in prototype. If not, conversions are done. + +Example: > + void Func(int n, char c, long l); + + int main(void) + { + char chr; + long a; + int b; + + ... + + Func(chr, a, b); // chr is converted to type int + // a is converted to type char + // b is converted to type long + } +< + +If no prototype is in scope when calling a function the following conversions +are done on the arguments: + - An argument of type$float$is converted to type$double$. + - If an$int$can represent all values of the original type, the value is + converted to an$int$. Otherwise it is converted to an$unsigned int$. + For most compilers this means: an argument of type$char$,$unsigned char$, + $short$,$unsigned short$is converted to type$int$. + +This is called "argument promotion". + +No other conversions are performed on arguments. + + +------------------------------------------------------------------------------ +I.7.4 Storage Classes *crv-fuStorageClasses* + +Implicitly functions do have the storage class$extern$. To limit the scope of +a function to a file$static$can be used. + +Example$extern$: > + File 1 File 2 + ------ ------ + + int GetSolution(void) extern int GetSolution(void); + { + return 42; + } void Func(void) + { + if (GetSolution() == 42) + int main(void) { + { ... + if (GetSolution() != 42) } + { } + ... + } + } +< + +Example$static$: > + File + ---- + + static int GetSolution(void) // can only be referenced within same file + { + return 42; + } + + + int main(void) + { + if (GetSolution() == 42) + { + ... + } + } +< + + +------------------------------------------------------------------------------ +I.7.5 Specifier *crv-fuSpecifier* + *crv-inline* + +A function declared with an$inline$specifier is an inline function. This +suggests that calls to the function be as fast as possible. The extend to +which this suggestion is taken into account is implementation specific. + +Normally$inline$means that the call to the function is replaced by the +function body. As a result of this there is no overhead for calling, but at +the expense of code size, since each call of the inline function is replaced +by it's function body. + +For$main()$the$inline$specifier is not allowed. + +Example: > + + inline int Func(void) + { + ... + return 42; + } + + + int main(void) + { + int a; + + a = Func(); + ... + } +< + + + +------------------------------------------------------------------------------ +I.7.6 main() *crv-fuMain* + +A program begins by calling the$main()$function and ends by exiting +the$main()$function. There is no prototype required for$main()$. + +$main()$can be defined in two ways, either with no parameter + +$ int main(void)$ +$ {$ +$ statements$ +$ }$ + +or with two parameters + +$ int main(int argc, char *argv[])$ +$ {$ +$ statements$ +$ }$ + +The return type is type$int$. + +The parameters do not have to be named$argc$and$argv$, but it is a common way +to do so. + +Parameter$argc$is a nonnegative integer. If the value of$argc$is greater than +zero, the string pointed to by$argv[0]$is the program name. If the value +of$argc$is greater than one, the strings pointed to by$argv[1]$through +$argv[argc - 1]$represent the program parameters. + + + +============================================================================== +I.8 Preprocessor *crv-preprocessor* + +A preprocessor is the first pass of a compiler. It does perform macro +substitution, inclusion of files, conditional compilation and provides the +ability to pass control directives to the compiler. + +A C-preprocessor directive is invoked by a$#$. Opposed to a C-statement a +C-preprocessor directive is NOT terminated by a semicolon ($;$), instead of +it is terminated by the new-line. To span a directive over several lines +the "line-escape"$\$can be used (see |crv-lngEscSeq|). +Example: > + #define MEAS_CYCLES (3 \ + + \ + 1) +< +is synonymical to: > + #define MEAS_CYCLES (3 + 1) + + +A C-preprocessor directive can be placed anywhere in a source file. The +directive is active from the line of invocation up to the end of source file. + + +In the following sections possible preprocessor directives and preprocessor +operators are described. + + + +------------------------------------------------------------------------------ +I.8.1 Macros *crv-preMacros* + +A macro is an identifier that is equated to a text or symbolic expression +to which it is to be expanded by the preprocessor. + + *crv-preMacObj* *crv-preMacFunc* +There are two types of macros: macros without parameters, they are called +object-like macros and macros with parameters, they are called function-like +macros. + +When using a macro each subsequent occurrence of the macro$identifier$within +source-file is replaced by its$replacement-list$, unless the macro occurs +inside of a comment, a literal string or a character constant. + +A macro definition lasts until end of the source-file or until a corresponding +$#undef$is encountered. + +Macros can be nested. + + +NOTE: It is not a good programming style to specify macro arguments that +use side effects. Macro parameters can be used several times within a macro, +that can cause unexpected behaviour. +Example: > + #define MIN(a, b) ( (a < b) ? a : b ) + + MIN(val1++, val2) +< + would be replaced: > + ( (val1++ < val2) ? val1++ : val2 ) + + + +I.8.1.1 Definition #define *crv-preMacDef* +--------------------------- + *crv-#define* +Syntax Object-Like Macro: + $#define identifier replacement-list newline$ + +Syntax Function-Like Macro: + $#define identifier(identifier-list) replacement-list newline$ + + +Example of an object-like macro: > + #define CONST_ADD 42 + #define FOREVER for(;;) + + int main(void) + { + int a = 0; + + FOREVER + { + a += CONST_ADD; + ... + } + } +< +Example of a function-like macro: > + #define MIN(a, b) ( (a < b) ? a : b ) + + int main(void) + { + int x1, x2, x; + + x1 = 2; + x2 = 5; + + x = MIN(x1, x2); + } +< +Example of a nested macro: > + #define CONST1 ( 35 + CONST2 ) + #define COSNT2 7 +< + + +I.8.1.2 Cancellation #undef *crv-preMacCancel* +---------------------------- +Syntax: $#undef identifier newline$ *crv-#undef* + +A macro specified by$identifier$is no longer a macro name. If$identifier$is +currently no macro, this directive is ignored. + +Example: > + #define CONST 5 + + int main(void) + { + ... + a = CONST; + ... + + #undef CONST + + a = CONST; // will cause an error at compilation time + } +< + + +I.8.1.3 # Operator *crv-preMac#Operator* +------------------- + *crv-#* +The preprocessor operator$#$converts an argument of a function-like macro to a +string literal. + +Example: > + #define PRINT1(var) printf("Value of "#var" is: %d\n", var) + #define PRINT2(var) printf("Value of %s is: %d\n", #var, var) + + int main(void) + { + int a = 2; + int b = 3; + + PRINT1(a); // prints: Value of a is: 2 + PRINT2(b); // prints: Value of b is: 3 + } + + + +I.8.1.4 ## Operator *crv-preMac##Operator* +-------------------- + *crv-##* +The preprocessor operator$##$concatenates two tokens. + +Example: > + #define PRINT(prefix, postfix) printf("Value is: %d\n", prefix ## postfix) + + int main(void) + { + int varCar = 2; + int varHouse = 3; + + PRINT(var, Car); // prints: Value is: 2 + PRINT(var, House); // prints: Value is: 3 + } + + + +I.8.1.5 Predefined Macros *crv-preMacPredefined* +-------------------------- + +There is a set of predefined macro names. They are not allowed to be changed. + *crv-__DATA__* +$__DATA__$ This macro is evaluated to a string literal representing the + date when compilation of the current source-file began. Its + form is "Mmm dd yyyy". The names of the months are the same as + those generated by the$asctime()$function. + *crv-__FILE__* +$__FILE__$ This macro is evaluated to a string literal representing the + name of the current source-file. + *crv-__LINE__* +$__LINE__$ This macro is evaluated to a decimal constant representing the + current line number. + *crv-__STDC__* +$__STDC__$ The integer constant 1. Used to indicate if this is a standard + C compiler. + +$__STDC_HOSTED__$ *crv-__STDC_HOSTED__* + This macro is evaluated to an integer constant value. If 1 + the compiler is hosted, if 0 it is not. + +$__STDC_VERSION__$ *crv-__STDC_VERSION__* + This macro is evaluated to a$long int$value that belongs to the + revision of the International C Standard. + *crv-__TIME__* +$__TIME__$ This macro is evaluated to a string literal representing the + time when compilation of the current source-file began. Its + form is "hh:mm:ss", the same as what is generated the$asctime()$ + function. + + +Furthermore the compiler conditionally provides the following macros: + +$__STDC_IEC_559__$ *crv-__STDC_IEC_559__* + The integer constant 1. Used to indicate if this C compiler is + conform to the floating-point standard IEC 60559. + +$__STDC_IEC_559_COMPLEX__$ *crv-__STDC_IEC_559_COMPLEX__* + The integer constant 1. Used to indicate if this C compiler's + complex arithmetic is conform to the floating-point standard + IEC 60559. + +$__STDC_ISO_10646__$ *crv-__STDC_ISO10646__* + This macro is evaluated to a$long int$constant value of the + form yyyymm. Its intention is to indicate that values of + $wchar_t$are the coded representations of the characters defined + by ISO/IEC 10646. The year/month refers to the ISO/IEC 10646 + including amendments and corrections this implementation is + conform to. + + + +------------------------------------------------------------------------------ +I.8.2 Conditional Compilation *crv-preConditional* + +There are preprocessor directives that allow to control which part of a +source-code is to be or is not to be translated (conditional compilation). + + +I.8.2.1 defined Operator *crv-preCondDefined* +------------------------- + *crv-defined* +Syntax: $defined identifier$ + or$defined (identifier)$ + + +The$defined$operator evaluates to 1 if$identifier$is defined, else it +evaluates to 0.$identifier$is a macro name. + +$defined$operators can be combined in any logical expression using logical +operators (see |crv-opLogical|). +$defined$is allowed to be used in the expression of an$#if$or$#elif$directive. + + +Example: > + #if defined(MACRO1) || (defined(MACRO2) && !defined(MACRO3)) + ... + #endif + + +I.8.2.2 #if Directive *crv-preCondIf* +---------------------- + *crv-#if* +Syntax: $#if constant-expression newline$ + + +This preprocessor directive checks whether the constant expression evaluates +to nonzero. If so, the source-code between$#if$and the corresponding$#endif$, +$#else$or$#elif$is passed to compiler, else it's skipped. + +The constant expression may be a$defined$operator, a macro name or any +constant integer expression. Not allowed are type-casts, keywords or +expressions that need memory ($++$,$--$...). +If a macro name used in the constant expression does not exist, it's treated +as zero. + +Example: > + #if defined(MACRO1) || (defined(MACRO2) && !defined(MACRO3)) + ... + #endif + + #if (CONST_VALUE + 5 == 8) + ... // its value is 8 + #else + ... // its value is not 8 + #endif + + + +I.8.2.3 #ifdef Directive *crv-preCondIfdef* +------------------------- + *crv-#ifdef* +Syntax: $#ifdef identifier newline$ + + +This preprocessor directive checks whether the identifier is currently +defined. If so, the source-code between$#ifdef$and the corresponding$#endif$, +$#else$or$#elif$is passed to compiler, else it's skipped. + +Example: > + #define DEBUG 1 + + #ifdef DEBUG + ... // that is passed to the compiler + #endif + + + +I.8.2.4 #ifndef Directive *crv-preCondIfndef* +-------------------------- + *crv-#ifndef* +Syntax: $#ifndef identifier newline$ + + +This preprocessor directive checks whether the identifier is currently not +defined. If so, the source-code between$#ifndef$and the corresponding$#endif$, +$#else$or$#elif$is passed to compiler, else it's skipped. + +Example: > + #define DEBUG 1 + + #ifndef DEBUG + ... // that is not passed to the compiler + #endif + + + +I.8.2.5 #else Directive *crv-preCondElse* +------------------------ + *crv-#else* +Syntax: $#else newline$ + + +This directive is used together with$#if$,$#ifdef$or$#ifndef$. If the "if" +does not evaluate to nonzero, the source code between the matching$else$and +the$endif$is passed to compiler. + +Example: > + #define DEBUG 1 + + #ifndef DEBUG + ... // that is not passed to the compiler + #else + ... // that is passed to the compiler + #endif + + + +I.8.2.6 #elif Directive *crv-preCondElif* +------------------------ + *crv-#elif* +Syntax: $#elif constant-expression newline$ + + +This directive provides an else-if statement. It can be used together +with$#if$,$#ifdef$,$#ifndef$or another$#elif$. If the corresponding "if" does +not evaluate to nonzero the$#elif$'s constant expression is tested to be +nonzero. If so, the source-code between$#elif$and the matching$#else$,$#elif$ +or$#endif$is passed to the compiler, else not. + +See |crv-preCondIf| for further information on the constant expression. + +Example: > + #if (CONST_VALUE + 5 == 8) + ... // its value is 8 + #elif (CONST_VALUE + 5 == 9) + ... // its value is 9 + #endif + + + +I.8.2.7 #endif Directive *crv-preCondEndif* +------------------------- + *crv-#endif* +Syntax: $#endif newline$ + + +This directive is used to finish one of this directives:$#if$,$#ifdef$, +$#ifndef$,$elif$or$else$. + + +Example: > + #ifdef DEBUG + ... + #endif + + + +------------------------------------------------------------------------------ +I.8.3 File Inclusion #include *crv-preSourceInc* + *crv-#include* +Syntax: $#include "filename" newline$ (1) + $#include <filename> newline$ (2) + $#include macro-name newline$ (3) + + +This preprocessor directive causes the replacement of that directive by the +entire contents of the file specified by$filename$. + +Files enclosed in <...> are searched in an implementation-defined manner. +Files enclosed in quotes "..." are searched in an implementation-defined +manner too, if a file is not found it is searched in the same way like +files enclosed in <...>. + +In general, form (1) is used to include user files whereas form (2) is used +to include standard library files. + +This directive does support macro replacement (form (3)). + +Nesting is allowed, an included file may itself contain$#include$directives. +But nesting easy leads to the situation that files are included several times, +which would waste time and may cause compilation errors. There is a standard +way to prevent that a file is included twice due to nesting. It is called +"wrapper #ifndef". Do the following in included files to avoid processing +them twice: > + // file foo.h + + #ifndef _FOO_H_ + #define _FOO_H_ + + ... the entire file + + #endif // #endif of _FOO_H_ + + +Example: > + #include <stdio.h> + + #include "galer.h" + + + #define HEADER_FILE "datatype.h" + + #include HEADER_FILE + + + + +------------------------------------------------------------------------------ +I.8.4 Line Control #line *crv-preLine* + *crv-#line* +Syntax: $#line digit-sequence newline$ (1) + $#line digit-sequence "filename" newline$ (2) + $#line macro-names newline$ (3) + + +This preprocessor directive allows to change the current line number and/or +the name of the current source-code file. + +The$#line$directive gives the next line in source-code a new line-number. +The line numbers of the subsequent lines are derived from this number by +incrementing for each new line. +The new line-number is specified by$digit-sequence$. Line numbers must be +in the range of 1 to 2147483647. + +Furthermore for the current source-code file a new filename can be specified +($filename$). + +Form (1) can be used to set a new line number. Form (2) can be used to set +both, a new line number and a new filename. +In form (3) the macro-names are expanded, the result must match either +form (1) or (2). Its then processed appropriate. + +The$#line$directive effects the predefined macros$#__LINE__$and$#__FILE__$. + +Example: > + #line 1000 "GALer.c" +or > + #define NEW_LINE_NUMBER 1000 + #define SOURCE "GALer.c" + + #line NEW_LINE_NUMBER SOURCE + printf("%d %s\n", __LINE__, __FILE__); // result is: 1000 GALer.c + + + +------------------------------------------------------------------------------ +I.8.5 Error Directive #error *crv-preError* + *crv-#error* +Syntax: $#error message newline$ + + $message$is optional + + +This preprocessor directive causes the compiler to print a diagnostic message +that includes$message$and cancel compilation. + +Example: > + #if defined UNIX + ... + #elif defined LINUX + ... + #elif + #error Error: no system specified + #endif +< + If neither UNIX nor LINUX is defined, the compiler prints an error message: + "Error: no system specified" and cancels compilation. + + + +------------------------------------------------------------------------------ +I.8.6 Pragma Directive #pragma *crv-prePragma* + *crv-#pragma* +Syntax: $#pragma directive newline$ + + +This preprocessor directive provides further control over the compiler. Which +$#pragma$directives an implementation provides is implementation specific. +If a$#pragma$directive is not known by the implementation, it is ignored. + + +Example: > + #pragma Int16 // use 16 bit integer for this file + + #pragma DISABLE_WARNING_32 // disable warning 32 for this file + ... do stuff that would cause a warning 32 + #pragma ENABLE_WARNING_32 + + + + +------------------------------------------------------------------------------ +I.8.7 Null Directive # *crv-preNull* + +Syntax: $# newline$ + +The preprocessor directive of the form$# newline$has no effect. + + + + + + +============================================================================== +Chapter II STANDARD C LIBRARY *crv-stdCLib* +============================================================================== + +The C language provides no built-in facilities for performing such common +operations as input/output, memory management, string manipulation, and the +like. Instead, these facilities are defined in a standard C library which can +be linked to program. +Subject of this chapter is the standard C library as specified by the ISO C +standard. + + +============================================================================== +II.1 Standard Headers *crv-libHeaders* + +Below is an alphabetically sorted list of all header files of the standard C +library. + + Header | Short Description + --------------+----------------------------------------------------------- + $<assert.h> $| diagnostics.............................|crv-libAssertH| + $<complex.h> $| complex arithmetic......................|crv-libComplexH| + $<ctype.h> $| character handling......................|crv-libCtypeH| + $<errno.h> $| error codes.............................|crv-libErrnoH| + $<fenv.h> $| floating point environment..............|crv-libFenvH| + $<float.h> $| characteristics of floating point types.|crv-libFloatH| + $<inttypes.h>$| format conversion of integer types......|crv-libInttypesH| + $<iso646.h> $| alternative spelling....................|crv-libIso646H| + $<limits.h> $| sizes of integer types..................|crv-libLimitsH| + $<local.h> $| localization............................|crv-libLocalH| + $<math.h> $| mathematics.............................|crv-libMathH| + $<setjmp.h> $| nonlocal jumps..........................|crv-libSetjmpH| + $<signal.h> $| signal handling.........................|crv-libSignalH| + $<stdarg.h> $| variable arguments......................|crv-libStdargH| + $<stdbool.h> $| boolean type and values.................|crv-libStdboolH| + $<stddef.h> $| common definitions......................|crv-libStddefH| + $<stdint.h> $| integer types...........................|crv-libStdintH| + $<stdio.h> $| input / output..........................|crv-libStdioH| + $<stdlib.h> $| general utilities.......................|crv-libStdlibH| + $<string.h> $| string handling.........................|crv-libStringH| + $<tgmath.h> $| type-generic math.......................|crv-libTgmathH| + $<time.h> $| date and time...........................|crv-libTimeH| + $<wchar.h> $| extended multibyte and wide.............|crv-libWcharH| + | character utilities + $<wctype.h> $| wide character classification and.......|crv-libWctypeH| + | mapping utilities + + + +============================================================================== +II.2 <assert.h> Diagnostics *crv-libAssertH* + + Quicklink: + $assert()$ Macro |crv-assert| + $NDEBUG$ Macro |crv-NDEBUG| + + +assert() Macro *crv-assert* *crv-NDEBUG* +-------------- +Synopsis~ + $#include <assert.h>$ + $void assert (int expression);$ + +Return~ + none + +Description~ +The macro$assert()$tests the value of$expression$. If it is false (zero), +the$assert()$macro writes the following information on the standard error +stream: + - text of argument + - name of source file + - line number + - name of the enclosing function +The format of output is implementation-defined. After writing this information +the program is terminated by calling the$abort()$function. + +If the macro$NDEBUG$is defined before including$<assert.h>$,$assert()$is +defined as follows: + $#define assert(ignore) ((void)0)$ +This means that the macro has no effect,$expression$is even not evaluated. + +Note: The assert facility is designed for detecting internal inconsistency; +it is not suitable for reporting invalid input or improper usage by the user +of the program. + + + + +============================================================================== +II.3 <complex.h> Complex Math *crv-libComplexH* + +This header file defines macros and declares functions that allow to do +complex arithmetic. + +Quicklink: + $_Complex_I$ Macro |crv-_Complex_I| + $_Imaginary_I$ Macro |crv-_Imaginary_I| + $cabs()$ Func |crv-cabs| + $cabsf()$ Func |crv-cabsf| + $cabsl()$ Func |crv-cabsl| + $cacos()$ Func |crv-cacos| + $cacosf()$ Func |crv-cacosf| + $cacosl()$ Func |crv-cacosl| + $casin()$ Func |crv-casin| + $casinf()$ Func |crv-casinf| + $casinl()$ Func |crv-casinl| + $catan()$ Func |crv-catan| + $catanf()$ Func |crv-catanf| + $catanl()$ Func |crv-catanl| + $cacosh()$ Func |crv-cacosh| + $cacoshf()$ Func |crv-cacoshf| + $cacoshl()$ Func |crv-cacoshl| + $carg()$ Func |crv-carg| + $cargf()$ Func |crv-cargf| + $cargl()$ Func |crv-cargl| + $casinh()$ Func |crv-casinh| + $casinhf()$ Func |crv-casinhf| + $casinhl()$ Func |crv-casinhl| + $catanh()$ Func |crv-catanh| + $catanhf()$ Func |crv-catanhf| + $catanhl()$ Func |crv-catanhl| + $ccos()$ Func |crv-ccos| + $ccosf()$ Func |crv-ccosf| + $ccosl()$ Func |crv-ccosl| + $ccosh()$ Func |crv-ccosh| + $ccoshf()$ Func |crv-ccoshf| + $ccoshl()$ Func |crv-ccoshl| + $cexp()$ Func |crv-cexp| + $cexpf()$ Func |crv-cexpf| + $cexpl()$ Func |crv-cexpl| + $cimag()$ Func |crv-cimag| + $cimagf()$ Func |crv-cimagf| + $cimagl()$ Func |crv-cimagl| + $clog()$ Func |crv-clog| + $clogf()$ Func |crv-clogf| + $clogl()$ Func |crv-clogl| + $conj()$ Func |crv-conj| + $conjf()$ Func |crv-conjf| + $conjl()$ Func |crv-conjl| + $cpow()$ Func |crv-cpow| + $cpowf()$ Func |crv-cpowf| + $cpowl()$ Func |crv-cpowl| + $cproj()$ Func |crv-cproj| + $cprojf()$ Func |crv-cprojf| + $cprojl()$ Func |crv-cprojl| + $creal()$ Func |crv-creal| + $crealf()$ Func |crv-crealf| + $creall()$ Func |crv-creall| + $csinh()$ Func |crv-csinh| + $csin()$ Func |crv-csin| + $csinf()$ Func |crv-csinf| + $csinl()$ Func |crv-csinl| + $csinh()$ Func |crv-csinh| + $csinhf()$ Func |crv-csinhf| + $csinhl()$ Func |crv-csinhl| + $csqrt()$ Func |crv-csqrt| + $csqrtf()$ Func |crv-csqrtf| + $csqrtl()$ Func |crv-csqrtl| + $ctan()$ Func |crv-ctan| + $ctanf()$ Func |crv-ctanf| + $ctanl()$ Func |crv-ctanl| + $ctanh()$ Func |crv-ctanh| + $ctanhf()$ Func |crv-ctanhf| + $ctanhl()$ Func |crv-ctanhl| + $complex$ Macro |crv-complex| + $CX_LIMITED_RANGE$ Pragma |crv-CX_LIMITED_RANGE| + $I$ Macro |crv-I| + $imaginary$ Macro |crv-imaginary| + + +------------------------------------------------------------------------------ +II.3.1 Macros *crv-libCHMac* + + +_Complex_I Macro *crv-_Complex_I* +---------------- +This macro expands to$const float _Complex$with the complex number "0+1i". + + +_Imaginary_I Macro *crv-_Imaginary_I* +------------------ +This macro is defined only if the compiler supports imaginary types. +If defined, it expands to$_Imaginary$and a constant expression of the type +$const float _Imaginary$with the value "0+1i". + + +complex Macro *crv-complex* +------------- +This macro expands to$_Complex$. + + +I Macro *crv-I* +------- +This macro either expands to$_Imaginary_I$or$_Complex_I$. If$_Imaginary_I$is +not defined$I$expands to$_Complex_I$. + + +imaginary Macro *crv-imaginary* +--------------- +This macro is defined only if the compiler supports imaginary types. +If defined, it expands to$_Imaginary$and a constant expression of the type +$const float _Imaginary$with the value "0+1i". + + + +------------------------------------------------------------------------------ +II.3.2 Pragmas *crv-libCHPrag* + + +CX_LIMITED_RANGE Pragma *crv-CX_LIMITED_RANGE* +----------------------- +Synopsis~ + $#include <complex.h>$ + $#pragma STDC CX_LIMITED_RANGE on/off-switch$ + + $on/off-switch$is$ON$,$OFF$or$DEFAULT$ + +Description~ +Complex arithmetic is problematic because of their treatment of infinities +and because of undue overflow and underflow. +If this pragma is on the compiler is informed that the usual mathematical +formulas can be used. If on, the compiler can use this formulas: + (x + iy)x(u + iv) = (xu - yv) + i(yu + xv) + + (x + iy) / ( u + iv) = [(xu + yv) + i(yu - xv)] / (u^2 + v^2) + + ----------- + | x + iy | = \| x^2 + y^2 + +When inside a compound statement, the pragma takes effect from its occurrence +until end of compound statement or until the next$CX_LIMITED_RANGE$is +encountered; at the end of a compound statement the state of the pragma is +restored to its state just before entering that compound statement. +When outside a compound statement, the pragma takes effect from its occurrence +until end of source-file or until the next$CX_LIMITED_RANGE$is encountered. +The default state of this pragma is off. + + + +------------------------------------------------------------------------------ +II.3.3 Trigonometric *crv-libCHTrig* + + +cacos() Functions *crv-cacos* *crv-cacosf* *crv-cacosl* +----------------- +Synopsis~ + $#include <complex.h>$ + $double complex cacos(double complex z);$ + $float complex cacosf(float complex z);$ + $long double complex cacosl(long double complex z);$ + +Return~ +return complex arc cosine of z in radians +Values: imaginary is unbounded, real is in the interval [0, PI] + +Description~ +These functions compute the complex arc cosine of z, with branch cuts outside +the interval [-1, +1] along real axis. + + + +casin() Functions *crv-casin* *crv-casinf* *crv-casinl* +----------------- +Synopsis~ + $#include <complex.h>$ + $double complex casin(double complex z);$ + $float complex casinf(float complex z);$ + $long double complex casinl(long double complex z);$ + +Return~ +return complex arc sine of z in radians +Range: imaginary is unbounded, real is in the interval [-PI/2, +PI/2] + +Description~ +These functions compute the complex arc sine of z, with branch cuts outside +the interval [-1, +1] along real axis + + + +catan() Functions *crv-catan* *crv-catanf* *crv-catanl* +----------------- +Synopsis~ + $#include <complex.h>$ + $double complex catan(double complex z);$ + $float complex catanf(float complex z);$ + $long double complex catanl(long double complex z);$ + +Return~ +return complex arc tangent of z in radians +Range: imaginary is unbounded, real is in the interval [-PI/2, +PI/2] + +Description~ +These functions compute the complex arc tangent of z, with branch cuts outside +the interval [-i, +i] along imaginary axis. + + + +ccos() Functions *crv-ccos* *crv-ccosf* *crv-ccosl* +---------------- +Synopsis~ + $#include <complex.h>$ + $double complex ccos(double complex z);$ + $float complex ccosf(float complex z);$ + $long double complex ccosl(long double complex z);$ + +Return~ +return complex cosine of z + +Description~ +These functions compute the complex cosine of z. +The mathematical definition of the complex cosine is: + cos(z) = 1/2 * (exp(z*i) + exp(-z*i)) + + + +csin() Functions *crv-csin* *crv-csinf* *crv-csinl* +---------------- +Synopsis~ + $#include <complex.h>$ + $double complex csin(double complex z);$ + $float complex csinf(float complex z);$ + $long double complex csinl(long double complex z);$ + +Return~ +return complex sine of z + +Description~ +These functions compute the complex sine of z. +The mathematical definition of the complex sine is: + sin(z) = 1/(2*i) * (exp(z*i) - exp(-z*i)) + + + +ctan() Functions *crv-ctan* *crv-ctanf* *crv-ctanl* +---------------- +Synopsis~ + $#include <complex.h>$ + $double complex ctan(double complex z);$ + $float complex ctanf(float complex z);$ + $long double complex ctanl(long double complex z);$ + +Return~ +return complex tangent of z + +Description~ +These functions compute the complex tangent of z. +The mathematical definition of the complex tangent is: + tan(z) = -i * (exp(z*i) - exp(-z*i)) / (exp(z*i) + exp(-z*i)) + +NOTE: The complex tangent has poles at PI/2 + 2n, where n is an integer. +$ctan()$may signal overflow if z is too close to a pole. + + + +------------------------------------------------------------------------------ +II.3.4 Hyperbolic *crv-libCHHyper* + + +cacosh() Functions *crv-cacosh* *crv-cacoshf* *crv-cacoshl* +------------------ +Synopsis~ + $#include <complex.h>$ + $double complex cacosh(double complex z);$ + $float complex cacoshf(float complex z);$ + $long double complex cacoshl(long double complex z);$ + +Return~ +return complex arc hyperbolic cosine of z +Range: real is >= 0, imaginary is [-iPI, +iPI] + +Description~ +These functions compute the complex arc hyperbolic cosine of z. +Domain: real of z >= 1 + + + +casinh() Functions *crv-casinh* *crv-casinhf* *crv-casinhl* +------------------ +Synopsis~ + $#include <complex.h>$ + $double complex casinh(double complex z);$ + $float complex casinhf(float complex z);$ + $long double complex casinhl(long double complex z);$ + +Return~ +return complex arc hyperbolic sine of z +Range: real is unbounded, imaginary is [-iPI/2, +iPI/2] + +Description~ +These functions compute the complex arc hyperbolic sine of z. +Domain: imaginary in range [-i, +i] + + + +catanh() Functions *crv-catanh* *crv-catanhf* *crv-catanhl* +------------------ +Synopsis~ + $#include <complex.h>$ + $double complex catanh(double complex z);$ + $float complex catanhf(float complex z);$ + $long double complex catanhl(long double complex z);$ + +Return~ +return complex arc hyperbolic tangent of z +Range: imaginary is unbounded, real is [-PI/2, +PI/2] + +Description~ +These functions compute the complex arc hyperbolic tangent of z. +Domain: real in range [-1, +1] + + + +ccosh() Functions *crv-ccosh* *crv-ccosfh* *crv-ccoslh* +----------------- +Synopsis~ + $#include <complex.h>$ + $double complex ccosh(double complex z);$ + $float complex ccoshf(float complex z);$ + $long double complex ccoshl(long double complex z);$ + +Return~ +return complex hyperbolic cosine of z + +Description~ +These functions compute the complex hyperbolic cosine of z. +The mathematical definition of the complex hyperbolic cosine is: + cosh(z) = 1/2 * (exp(z) + exp(-z)) + + + +csinh() Functions *crv-csinh* *crv-csinhf* *crv-csinhl* +----------------- +Synopsis~ + $#include <complex.h>$ + $double complex csinh(double complex z);$ + $float complex csinhf(float complex z);$ + $long double complex csinhl(long double complex z);$ + +Return~ +return complex hyperbolic sine of z + +Description~ +These functions compute the complex hyperbolic sine of z. +The mathematical definition of the complex hyperbolic sine is: + sinh(z) = 1/2 * (exp(z) - exp(-z)) / 2 + + + +ctanh() Functions *crv-ctanh* *crv-ctanhf* *crv-ctanhl* +----------------- +Synopsis~ + $#include <complex.h>$ + $double complex ctanh(double complex z);$ + $float complex ctanhf(float complex z);$ + $long double complex ctanhl(long double complex z);$ + +Return~ +return complex hyperbolic tangent of z + +Description~ +These functions compute the complex hyperbolic tangent of z. +The mathematical definition of the complex hyperbolic tangent is: + tanh(z) = sinh(z) / cosh(z) + + + +------------------------------------------------------------------------------ +II.3.5 Exponential & Logarithmic *crv-libCHExpLog* + + +cexp() Functions *crv-cexp* *crv-cexpf* *crv-cexpl* +---------------- +Synopsis~ + $#include <complex.h>$ + $double complex cexp(double complex z);$ + $float complex cexpf(float complex z);$ + $long double complex cexpl(long double complex z);$ + +Return~ +return complex base e exponential of z + +Description~ +These functions compute e (the base of natural logarithms) raised to the power +of z. Mathematically, this corresponds to the value + + exp(z) = exp(creal(z)) * (cos(cimag(z)) + I * sin(cimag(z))) + + + +clog() Functions *crv-clog* *crv-clogf* *crv-clogl* +---------------- +Synopsis~ + $#include <complex.h>$ + $double complex clog(double complex z);$ + $float complex clogf(float complex z);$ + $long double complex clogl(long double complex z);$ + +Return~ +return complex natural logarithm of z +Range: real > 0 + +Description~ +These functions compute the complex natural logarithm of z (base e). +Domain: imaginary is [-iPI, +iPI], real is unbounded + +The mathematical definition is: + log(z) = log(cabs(z)) + I * carg(z) + + + +------------------------------------------------------------------------------ +II.3.6 Power & Absolute *crv-libCHPower* + + +cabs() Functions *crv-cabs* *crv-cabsf* *crv-cabsl* +---------------- +Synopsis~ + $#include <complex.h>$ + $double cabs(double complex z);$ + $float cabsf(float complex z);$ + $long double cabsl(long double complex z);$ + +Return~ +return absolute value of z + +Description~ +These functions compute the absolute value of the complex number z. + + ------------------------ + absolute value = \|creal(z)^2 + cimag(z)^2 + + + +cpow() Functions *crv-cpow* *crv-cpowf* *crv-cpowl* +---------------- +Synopsis~ + $#include <complex.h>$ + $double complex cpow(double complex base, double complex power);$ + $float complex cpowf(float complex base, double complex power);$ + $long double complex cpowl(long double complex base,$ + $ long doubl complex power);$ + +Return~ +return complex power of z + +Description~ +These functions compute the complex power function x^y +($base$raised to the power$power$). + +This is equivalent to: + exp(y * log(x)) + + + +csqrt() Functions *crv-csqrt* *crv-csqrtf* *crv-csqrtl* +----------------- +Synopsis~ + $#include <complex.h>$ + $double complex csqrt(double complex z);$ + $float complex csqrtf(float complex z);$ + $long double complex csqrtl(long double complex z);$ + +Return~ +return complex square root of z +Range: real >= 0 + +Description~ +These functions compute the complex square root of z. +Domain: imaginary unbounded, real >= 0 + + + +------------------------------------------------------------------------------ +II.3.7 Manipulating *crv-libCHMani* + + +carg() Functions *crv-carg* *crv-cargf* *crv-cargl* +---------------- +Synopsis~ + $#include <complex.h>$ + $double carg(double complex z);$ + $float cargf(float complex z);$ + $long double cargl(long double complex z);$ + +Return~ +return argument of z +Range: [-PI, +PI] + +Description~ +These functions compute the argument of the complex number z. +The argument of a complex number is the angle in the complex plane between the +positive real axis and a line passing through zero and the number. +Domain: branch cut along the positive real axis + + + +cimag() Functions *crv-cimag* *crv-cimagf* *crv-cimagl* +----------------- +Synopsis~ + $#include <complex.h>$ + $double cimag(double complex z);$ + $float cimagf(float complex z);$ + $long double cimagl(long double complex z);$ + +Return~ +return imaginary part of z + +Description~ +These functions compute the imaginary part of the complex number z. + + + +conj() Functions *crv-conj* *crv-conjf* *crv-conjl* +---------------- +Synopsis~ + $#include <complex.h>$ + $double complex conj(double complex z);$ + $float complex conjf(float complex z);$ + $long double complex conjl(long double complex z);$ + +Return~ +return complex conjugate value of z + +Description~ +These functions compute the complex conjugate of the complex number z. +The conjugate of a complex number has the same real part and a negated +imaginary part. In other words, conj(a + bi) = a + -bi. + + + +cproj() Functions *crv-cproj* *crv-cprojf* *crv-cprojl* +----------------- +Synopsis~ + $#include <complex.h>$ + $double complex cproj(double complex z);$ + $float complex cprojf(float complex z);$ + $long double complex cprojl(long double complex z);$ + +Return~ +return value of projection onto the Riemann sphere + +Description~ +These functions compute the projection of the complex value z onto the Riemann +sphere. Values with a infinite imaginary part are projected to positive +infinity on the real axis, even if the real part is NaN. If the real part is +infinite, the result is equivalent to + INFINITY + I * copysign (0.0, cimag(z)) + + + +creal() Functions *crv-creal* *crv-crealf* *crv-creall* +----------------- +Synopsis~ + $#include <complex.h>$ + $double creal(double complex z);$ + $float crealf(float complex z);$ + $long double creall(long double complex z);$ + +Return~ +return real part of z + +Description~ +These functions compute the real part of the complex number z. + + + + +============================================================================== +II.4 <ctype.h> Character *crv-libCtypeH* + + +This header declares functions useful for case mapping and classifying +characters. + +Quicklink: + $isalnum()$ Func |crv-isalnum| + $isalpha()$ Func |crv-isalpha| + $isblank()$ Func |crv-isblank| + $iscntrl()$ Func |crv-iscntrl| + $isdigit()$ Func |crv-isdigit| + $isgraph()$ Func |crv-isgraph| + $islower()$ Func |crv-islower| + $isprint()$ Func |crv-isprint| + $ispunct()$ Func |crv-ispunct| + $isspace()$ Func |crv-isspace| + $isupper()$ Func |crv-isupper| + $isxdigit()$ Func |crv-isxdigit| + $tolower()$ Func |crv-tolower| + $toupper()$ Func |crv-toupper| + + + +------------------------------------------------------------------------------ +II.4.1 Character Handling *crv-libCharHandling* + +Each of the functions in this section tests for membership in a particular +class of characters; each has a name starting with is. Each of them takes +one argument, which is a character to test, and returns an int which is +treated as a boolean value. The character argument is passed as an int, +and it may be the constant value EOF instead of a real character. + +The attributes of any given character can vary between locales. + + +$int isalnum(int c);$ *crv-isalnum* + Returns true if c is an alphanumeric character (a letter or number); in + other words, if either$isalpha$or$isdigit$is true of a character, then + $isalnum$ is also true. + + +$int isalpha(int c);$ *crv-isalpha* + Returns true if c is an alphabetic character (a letter). If$islower$or + $isupper$is true of a character, then$isalpha$is also true. + It returns also true, if c is one of a local-specific set of characters for + which none of$iscntrl$,$isdigt$,$ispunct$ or$isspcace$is true. + + In some locales, there may be additional characters for which isalpha + is true - letters which are neither upper case nor lower case. But in + the standard C locale, there are no such additional characters. + + +$int isblank(int c);$ *crv-isblank* + Returns true if c is a blank character; that is, a space or a tab. + + +$int iscntrl(int c);$ *crv-iscntrl* + Returns true if c is a control character (that is, a character that is + not a printing character). + + +$int isdigit(int c);$ *crv-isdigit* + Returns true if c is a decimal digit (0 through 9). + + +$int isgraph(int c);$ *crv-isgraph* + Returns true if c is a graphic character; that is any printing character + except a space character. + + +$int islower(int c);$ *crv-islower* + Returns true if c is a lower-case letter or is one of a local-specific set + of characters for which none of$iscntrl$,$isdigt$,$ispunct$ or$isspcace$is + true. + + +$int isprint(int c);$ *crv-isprint* + Returns true if c is a printing character. Printing characters include + all the graphic characters, plus the space (' ') character. + + +$int ispunct(int c);$ *crv-ispunct* + Returns true if c is a punctuation character. This means any printing + character for that is neither$isalnum$nor$isspace$is true (no + alphanumeric and no space character). + + +$int isspace(int c);$ *crv-isspace* + Returns true if c is a whitespace character. In the standard "C" locale, + $isspace$returns true for only the standard whitespace characters: + ' ' space + '\f' formfeed + '\n' newline + '\r' carriage return + '\t' horizontal tab + '\v' vertical tab + + +$int isupper(int c);$ *crv-isupper* + Returns true if c is an upper-case letter or is one of a local-specific set + of characters for which none of$iscntrl$,$isdigt$,$ispunct$ or$isspcace$is + true. + + +$int isxdigit(int c);$ *crv-isxdigit* + Returns true if c is a hexadecimal digit. Hexadecimal digits include the + normal decimal digits 0 through 9 and the letters A through F and + a through f. + + + + +------------------------------------------------------------------------------ +II.4.2 Character Mapping *crv-libCharMapping* + +This section explains the functions for performing case mappings on +characters. +These functions take one argument of type int, which is the character to +convert, and return the converted character as an int. If the conversion is +not applicable to the argument given, the argument is returned unchanged. + + +$int tolower(int c);$ *crv-tolower* + If c is an upper-case letter,$tolower$returns the corresponding lower-case + letter. If c is not an upper-case letter, c is returned unchanged. + +$int toupper(int c);$ *crv-toupper* + If c is a lower-case letter,$toupper$returns the corresponding upper-case + letter. If c is not an lower-case letter, c is returned unchanged. + + + + +============================================================================== +II.5 <errno.h> Error Codes *crv-libErrnoH* + +This header file defines macros used for reporting of error conditions. +All macros expand to integer constant expressions of type$int$with distinct +positive values. + +Additional macro definitions may be specified by the implementation. They +begin with E followed by digits or begin with E followed by uppercase letters. + + +EDOM Macro *crv-EDOM* +---------- +Domain error; used by mathematical functions when an argument value does not +fall into the domain over which the function is defined. + + +EILSEQ Macro *crv-EILSEQ* +------------ +While decoding a multibyte character the function came along an invalid or an +incomplete sequence of bytes or the given wide character is invalid. + + +ERANGE Macro *crv-ERANGE* +------------ +Range error; used by mathematical functions when the result value is not +representable because of overflow or underflow. + + +errno Macro/Variable *crv-errno* +-------------------- +$errno$is either a macro or an external variable of type int (implementation- +defined). + +The$errno$variable is used for holding implementation-defined error codes +reported by library routines. See above for error code macros specified by the +standard C language. +The value of$errno$is set to 0 at program startup, but is never set to 0 +by any library function. Therefore,$errno$should be set to 0 before calling a +library function and then inspected afterward. + + + + +------------------------------------------------------------------------------ +II.6 <fenv.h> FPU Status *crv-libFenvH* + +This header declares types, macros and functions to provide access to the +floating-point environment (floating-point status word and control modes). + +Quicklink: + $FE_ALL_EXCEPT$ Macro |crv-FE_ALL_EXCEPT| + $FE_DIVBYZERO$ Macro |crv-FE_DIVBYZERO| + $FE_DOWNWARD$ Macro |crv-FE_DOWNWARD| + $FE_INEXACT$ Macro |crv-FE_INEXACT| + $FE_INVALID$ Macro |crv-FE_INVALID| + $FE_OVERFLOW$ Macro |crv-FE_OVERFLOW| + $FE_TONEAREST$ Macro |crv-FE_TONEAREST| + $FE_TOWARDZERO$ Macro |crv-FE_TOWARDZERO| + $FE_UNDERFLOW$ Macro |crv-FE_UNDERFLOW| + $FE_UPWARD$ Macro |crv-FE_UPWARD| + $FENV_ACCESS$ Pragma |crv-FENV_ACCESS| + $feclearexcept()$ Func |crv-feclearexcept| + $fegetenv()$ Func |crv-fegetenv| + $fegetexceptflag()$ Func |crv-fegetexceptflag| + $fegetround()$ Func |crv-fegetround| + $feholdexcept()$ Func |crv-feholdexcept| + $feraiseexcept()$ Func |crv-feraiseexcept| + $fesetenv()$ Func |crv-fesetenv| + $fesetexceptflag()$ Func |crv-fesetexceptflag| + $fesetround()$ Func |crv-fesetround| + $fetestexcept()$ Func |crv-fetestexcept| + $feupdateenv()$ Func |crv-feupdateenv| + + + +------------------------------------------------------------------------------ +II.6.1 Pragmas *crv-libFHPrag* + +FENV_ACCESS Pragma *crv-FENV_ACCESS* +------------------ +Synopsis~ + $#include <fenv.h>$ + $#pragma STDC FENV_ACCESS on/off-switch$ + + $on/off-switch$is$ON$,$OFF$or$DEFAULT$ + +Description~ +This pragma provides a means to inform the compiler when a program might +access the floating-point environment (FPU or software emulation of FP) to +test status flags or run under non-default control modes. An "off"-state +signals that a program does not test status flags and does not run under +non-default control modes. Knowing this the compiler can do better +optimization that could subvert flag tests or mode changes. + +When inside a compound statement, the pragma takes effect from its occurrence +until end of compound statement or until the next$FENV_ACCESS$is encountered; +at the end of a compound statement the state of the pragma is restored to its +state just before entering that compound statement. +When outside a compound statement, the pragma takes effect from its occurrence +until end of source-file or until the next$FENV_ACCESS$is encountered. +The default state of this pragma is implementation-defined. + + + +------------------------------------------------------------------------------ +II.6.2 Exceptions *crv-libFHExceptions* + +The following functions allow to query and manipulate the floating-point +status word. They can be used to check for untrapped exceptions when it's +convenient, rather than worrying about them in the middle of a calculation. + +The macros below represent the various IEEE 754 exceptions. Not all FPUs +report all the different exceptions. Each constant is defined if and only if +the FPU compiling for supports that exception.$#ifdef$can be used to test for +FPU support. +Additional macro definitions may be specified by the implementation. They +begin with FE_ followed by uppercase letters. + + +FE_INEXACT Macro *crv-FE_INEXACT* +---------------- +The inexact exception. + + +FE_DIVBYZERO Macro *crv-FE_DIVBYZERO* +------------------ +The divide by zero exception. + + +FE_UNDERFLOW Macro *crv-FE_UNDERFLOW* +------------------ +The underflow exception. + + +FE_OVERFLOW Macro *crv-FE_OVERFLOW* +----------------- +The overflow exception. + + +FE_INVALID Macro *crv-FE_INVALID* +---------------- +The invalid exception. + + +FE_ALL_EXCEPT Macro *crv-FE_ALL_EXCEPT* +------------------- +This macro is the bitwise OR of all exception macros which are supported by +the FP implementation. + + +feclearexcept() Function *crv-feclearexcept* +------------------------ +Synopsis~ + $#include <fenv.h>$ + $int feclearexcept(int excepts);$ + +Return~ +zero in case the operation was successful, otherwise a non-zero value + +Description~ +This function clears all of the supported exception flags indicated by +$excepts$. + + +fegetexceptflag() Function *crv-fegetexceptflag* +-------------------------- +Synopsis~ + $#include <fenv.h>$ + $int fegetexceptflag(fexcept_t *flagp, int excepts);$ + +Return~ +zero in case the operation was successful, otherwise a non-zero value + +Description~ +This function attempts to store in the variable pointed to by$flagp$an +implementation-defined value representing the current setting of the +exception flags indicated by$excepts$. + + +feraiseexcept() Function *crv-feraiseexcept* +------------------------ +Synopsis~ + $#include <fenv.h>$ + $int feraiseexcept(int excepts);$ + +Return~ +zero in case the operation was successful, otherwise a non-zero value + +Description~ +This function attempts to raises the supported exceptions indicated by +$excepts$. If more than one exception bit in$excepts$is set the order in which +the exceptions are raised is undefined except that overflow ($FE_OVERFLOW$) or +underflow ($FE_UNDERFLOW$) are raised before inexact ($FE_INEXACT$). Whether +for overflow or underflow the inexact exception is also raised is also +implementation dependent. + + +fesetexceptflag() Function *crv-fesetexceptflag* +-------------------------- +Synopsis~ + $#include <fenv.h>$ + $int fesetexceptflag(fexcept_t *flagp, int excepts);$ + +Return~ +zero in case the operation was successful, otherwise a non-zero value + +Description~ +This function attempts to restore the flags for the exceptions indicated by +$excepts$to the values stored in the variable pointed to by $flagp$. + + +fetestexcept() Function *crv-fetestexcept* +----------------------- +Synopsis~ + $#include <fenv.h>$ + $int fetestexcept(int excepts);$ + +Return~ +flags which are set + +Description~ +Test whether the exception flags indicated by the parameter$except$are +currently set. If any of them are, a nonzero value is returned which specifies +which exceptions are set. Otherwise the result is zero. + + + +------------------------------------------------------------------------------ +II.6.3 Rounding *crv-libFHRounding* + +Floating-point calculations are carried out internally with extra precision, +and then rounded to fit into the destination type. This ensures that results +are as precise as the input data. IEEE 754 defines four possible rounding +modes: + +- Round to nearest + This is the default mode. It should be used unless there is a specific need + for one of the others. In this mode results are rounded to the nearest + representable value. If the result is midway between two representable + values, the even representable is chosen. Even here means the lowest-order + bit is zero. This rounding mode prevents statistical bias and guarantees + numeric stability: round-off errors in a lengthy calculation will remain + smaller than half of$FLT_EPSILON$. + +- Round toward plus Infinity + All results are rounded to the smallest representable value which is greater + than the result. + +- Round toward minus Infinity + All results are rounded to the largest representable value which is less + than the result. + +- Round toward zero + All results are rounded to the largest representable value whose magnitude + is less than that of the result. In other words, if the result is negative + it is rounded up; if it is positive, it is rounded down. + +For examples of effects see |crv-FLT_ROUNDS|. + +$<fenv.h>$defines constants which you can use to refer to the various rounding +modes. Each one will be defined if and only if the FPU supports the +corresponding rounding mode. + + +FE_TONEAREST Macro *crv-FE_TONEAREST* +------------------ +Round to nearest. + + +FE_UPWARD Macro *crv-FE_UPWARD* +--------------- +Round toward +∞. + + +FE_DOWNWARD Macro *crv-FE_DOWNWARD* +----------------- +Round toward -∞. + + +FE_TOWARDZERO Macro *crv-FE_TOWARDZERO* +------------------- +Round toward zero. + + +Underflow is an unusual case. Normally, IEEE 754 floating point numbers are +always normalized. Numbers smaller than 2^r (where r is the minimum exponent +cannot be represented as normalized numbers. Rounding all such numbers to zero +or 2^r would cause some algorithms to fail at 0. Therefore, they are left in +denormalized form. That produces loss of precision, since some bits of the +mantissa are stolen to indicate the decimal point. + +If a result is too small to be represented as a denormalized number, it is +rounded to zero. However, the sign of the result is preserved; if the +calculation was negative, the result is negative zero. Negative zero can also +result from some operations on infinity, such as 4/-∞. Negative zero +behaves identically to zero except when the copysign or signbit functions are +used to check the sign bit directly. + + +At any time one of the above four rounding modes is selected. The following +functions allow to get and set the rounding modes: + + +fegetround() Function *crv-fegetround* +--------------------- +Synopsis~ + $#include <fenv.h>$ + $int fegetround(void);$ + +Return~ +currently selected rounding mode + +Description~ +Returns the currently selected rounding mode, represented by one of the values +of the defined rounding mode macros. + + +fesetround() Function *crv-fesetround* +--------------------- +Synopsis~ + $#include <fenv.h>$ + $int fesetround(int round);$ + +Return~ +zero if it changed the rounding mode, a nonzero value if the mode is not +supported + +Description~ +Changes the currently selected rounding mode to$round$. If$round$does not +correspond to one of the supported rounding modes nothing is changed. + +You should avoid changing the rounding mode if possible. It can be an +expensive operation; also, some hardware requires you to compile your +program differently for it to work. The resulting code may run slower. See +your compiler documentation for details. + + + + +------------------------------------------------------------------------------ +II.6.4 Environment *crv-libFHEnv* + +The functions in this section manage the floating-point environment. + + *crv-fentv_t* +The functions to save and restore the floating-point environment all use a +variable of type$fenv_t$to store information. This type is defined in +$<fenv.h>$. Its size and contents are implementation-defined. This variable +should not be manipulated directly. + + +fegetenv() Function *crv-fegetenv* +------------------- +Synopsis~ + $#include <fenv.h>$ + $int fegetenv(fenv_t *envp);$ + +Return~ +zero in case the operation was successful, otherwise a non-zero value + +Description~ +Store the floating-point environment in the variable pointed to by$envp$. + + +feholdexcept() Function *crv-feholdexcept* +----------------------- +Synopsis~ + $#include <fenv.h>$ + $int feholdexcept(fenv_t *envp);$ + +Return~ +zero in case the operation was successful, otherwise a non-zero value + +Description~ +Store the current floating-point environment in the object pointed to by +$envp$. Then clear all exception flags, and set the FPU to trap no exceptions. +Not all FPUs support trapping no exceptions; if$feholdexcept$cannot set this +mode, it returns nonzero value. + + +fesetenv() Function *crv-fesetenv* +------------------- +Synopsis~ + $#include <fenv.h>$ + $int fesetenv(const fenv_t *envp);$ + +Return~ +zero in case the operation was successful, otherwise a non-zero value + +Description~ +Set the floating-point environment to that described by$envp$. + + +feupdateenv() Function *crv-feupdateenv* +---------------------- +Synopsis~ + $#include <fenv.h>$ + $int feupdateenv(const fenv_t *envp);$ + +Return~ +zero in case the operation was successful, otherwise a non-zero value + +Description~ +Like$fesetenv()$, this function sets the floating-point environment to that +described by$envp$. However, if any exceptions were flagged in the status word +before$feupdateenv()$was called, they remain flagged after the call. In other +words, after$feupdateenv()$is called, the status word is the bitwise OR of the +previous status word and the one saved in$envp$. + + + + +============================================================================== +II.7 <float.h> Floating Point *crv-libFloatH* + +This header file defines several macros that expand to various +implementation-specific limits and parameters describing floating-point +properties. +NOTE: The values are platform- and implementation-specific.The ISO C standard +specifies minimum and maximum values for most of these parameters. + +Macro names starting with FLT_ refer to the float type, while names beginning +with DBL_ refer to the double type and names beginning with LDBL_ refer to the +long double type. + +Quicklink: + $FLT_DIG $ Macro |crv-FLT_DIG| + $FLT_EPSILON $ Macro |crv-FLT_EPSILON| + $FLT_MANT_DIG $ Macro |crv-FLT_MANT_DIG| + $FLT_MAX $ Macro |crv-FLT_MAX| + $FLT_MAX_10_EXP $ Macro |crv-FLT_MAX_10_EXP| + $FLT_MAX_EXP $ Macro |crv-FLT_MAX_EXP| + $FLT_MIN $ Macro |crv-FLT_MIN| + $FLT_MIN_10_EXP $Macro |crv-FLT_MIN_10_EXP| + $FLT_MIN_EXP $ Macro |crv-FLT_MIN_EXP| + $FLT_RADIX $ Macro |crv-FLT_RADIX| + $FLT_ROUNDS $ Macro |crv-FLT_ROUNDS| + $DBL_DIG $ Macro |crv-DBL_DIG| + $DBL_EPSILON $ Macro |crv-DBL_EPSILON| + $DBL_MANT_DIG $ Macro |crv-DBL_MANT_DIG| + $DBL_MAX $ Macro |crv-DBL_MAX| + $DBL_MAX_10_EXP $ Macro |crv-DBL_MAX_10_EXP| + $DBL_MAX_EXP $ Macro |crv-DBL_MAX_EXP| + $DBL_MIN $ Macro |crv-DBL_MIN| + $DBL_MIN_10_EXP $Macro |crv-DBL_MIN_10_EXP| + $DBL_MIN_EXP $ Macro |crv-DBL_MIN_EXP| + $LDBL_DIG $ Macro |crv-LDBL_DIG| + $LDBL_EPSILON $ Macro |crv-LDBL_EPSILON| + $LDBL_MANT_DIG $ Macro |crv-LDBL_MANT_DIG| + $LDBL_MAX $ Macro |crv-LDBL_MAX| + $LDBL_MAX_10_EXP$ Macro |crv-LDBL_MAX_10_EXP| + $LDBL_MAX_EXP $ Macro |crv-LDBL_MAX_EXP| + $LDBL_MIN $ Macro |crv-LDBL_MIN| + $LDBL_MIN_10_EXP $Macro |crv-LDBL_MIN_10_EXP| + $LDBL_MIN_EXP $ Macro |crv-LDBL_MIN_EXP| + + + +FLT_ROUNDS Macro *crv-FLT_ROUNDS* +---------------- +This value characterizes the rounding mode for floating point addition. The +following values indicate standard rounding modes: + + Value | Mode + --------+---------------------------------------------------------------- + -1 | the mode is indeterminable + 0 | rounding is towards zero, see |crv-libFHRounding| + 1 | rounding is to the nearest number, see |crv-libFHRounding| + 2 | rounding is towards positive infinity, see |crv-libFHRounding| + 3 | rounding is towards negative infinity, see |crv-libFHRounding| + +Any other value represents a machine-dependent nonstandard rounding mode. + +On most machines, the value is 1, in accordance with the IEEE standard for +floating point. + +Here is a table showing how certain values round for each possible value +of$FLT_ROUNDS$, if the other aspects of the representation match the IEEE +single-precision standard: + + Value | 0 | 1 | 2 | 3 + ------------+------+-------------+-------------+------------- + 1.00000003 | 1.0 | 1.0 | 1.00000012 | 1.0 + 1.00000007 | 1.0 | 1.00000012 | 1.00000012 | 1.0 + -1.00000003 | -1.0 | -1.0 | -1.0 | -1.00000012 + -1.00000007 | -1.0 | -1.00000012 | -1.0 | -1.00000012 + + + +FLT_RADIX Macro *crv-FLT_RADIX* +--------------- +This is the value of the base, or radix, of the exponent representation. In +the very most times the value is 2 (except IBM 360 and derivatives). + + +FLT_MANT_DIG Macro *crv-FLT_MANT_DIG* +DBL_MANT_DIG Macro *crv-DBL_MANT_DIG* +LDBL_MANT_DIG Macro *crv-LDBL_MANT_DIG* +------------------ +This is the number of base-$FLT_RADIX$digits in the floating point mantissa. + + +FLT_DIG Macro *crv-FLT_DIG* +DBL_DIG Macro *crv-DBL_DIG* +LDBL_DIG Macro *crv-LDBL_DIG* +-------------- +This is the number of decimal digits of precision. +To satisfy standard C, the values supposed to be at least: + FLT_DIG >= 6 + DBL_DIG >= 10 + LDBL_DIG >= 10 + +Technically, if p and b are the precision and base (respectively) for the +representation, then the decimal precision q is the maximum number of decimal +digits such that any floating point number with q base 10 digits can be +rounded to a floating point number with p base b digits and back again, +without change to the q decimal digits. + + +FLT_MIN_EXP Macro *crv-FLT_MIN_EXP* +DBL_MIN_EXP Macro *crv-DBL_MIN_EXP* +LDBL_MIN_EXP Macro *crv-LDBL_MIN_EXP* +------------------ +This is the minimum negative integer value for an exponent in base$FLT_RADIX$. + + +FLT_MIN_10_EXP Macro *crv-FLT_MIN_10_EXP* +DBL_MIN_10_EXP Macro *crv-DBL_MIN_10_EXP* +LDBL_MIN_10_EXP Macro *crv-LDBL_MIN_10_EXP* +--------------------- +This is the minimum negative integer value for an exponent in base 10. +To satisfy standard C, the values supposed to be at least: + FLT_MIN_10_EXP <= -37 + DBL_MIN_10_EXP <= -37 + LDBL_MIN_10_EXP <= -37 + + +FLT_MAX_EXP Macro *crv-FLT_MAX_EXP* +DBL_MAX_EXP Macro *crv-DBL_MAX_EXP* +LDBL_MAX_EXP Macro *crv-LDBL_MAX_EXP* +------------------ +This is the maximum integer value for an exponent in base$FLT_RADIX$. + + +FLT_MAX_10_EXP Macro *crv-FLT_MAX_10_EXP* +DBL_MAX_10_EXP Macro *crv-DBL_MAX_10_EXP* +LDBL_MAX_10_EXP Macro *crv-LDBL_MAX_10_EXP* +--------------------- +This is the maximum integer value for an exponent in base 10. +To satisfy standard C, the values supposed to be at least: + FLT_MAX_10_EXP >= -37 + DBL_MAX_10_EXP >= -37 + LDBL_MAX_10_EXP >= -37 + + + +FLT_MAX Macro *crv-FLT_MAX* +DBL_MAX Macro *crv-DBL_MAX* +LDBL_MAX Macro *crv-LDBL_MAX* +-------------- +The value is the maximum finite number representable. +To satisfy standard C, the values supposed to be at least: + FLT_MAX >= 1E+37 + DBL_MAX >= 1E+37 + LDBL_MAX >= 1E+37 + +The smallest representable number is -FLT_MAX, -DBL_MAX, -LDBL_MAX. + + +FLT_MIN Macro *crv-FLT_MIN* +DBL_MIN Macro *crv-DBL_MIN* +LDBL_MIN Macro *crv-LDBL_MIN* +-------------- +The value is the minimum number representable. +To satisfy standard C, the values supposed to be at least: + FLT_MIN <= 1E-37 + DBL_MIN <= 1E-37 + LDBL_MIN <= 1E-37 + + +FLT_EPSILON Macro *crv-FLT_EPSILON* +DBL_EPSILON Macro *crv-DBL_EPSILON* +LDBL_EPSILON Macro *crv-LDBL_EPSILON* +------------------ +This is the maximum positive floating point number such that +1.0 +$FLT_EPSILON$!= 1.0 is true (least significant digit representable). + +To satisfy standard C, the values supposed to be at least: + FLT_EPSILON >= 1E-5 + DBL_EPSILON >= 1E-9 + LDBL_EPSILON >= 1E-9 + + + +============================================================================== +II.8 <inttypes.h> Absolute Value *crv-libInttypesH* + +This header extends the$<stdint.h>$header (->|crv-libStdintH|). It provides +macros for format conversion of integer types and provides functions for +manipulating greatest-width integer types. + +Quicklink: + $imaxdiv_t$ Type |crv-imaxdiv_t| + $imaxabs$ Func |crv-imaxabs| + $imaxdiv$ Func |crv-imaxdiv| + + $PRIdN$ Macro |crv-PRIdN| + $PRIdLEASTN$ Macro |crv-PRIdLEASTN| + $PRIdFASTN$ Macro |crv-PRIdFASTN| + $PRIdMAX$ Macro |crv-PRIdMAX| + $PRIdPTR$ Macro |crv-PRIdPTR| + + $PRIiN$ Macro |crv-PRIiN| + $PRIiLEASTN$ Macro |crv-PRIiLEASTN| + $PRIiFASTN$ Macro |crv-PRIiFASTN| + $PRIiMAX$ Macro |crv-PRIiMAX| + $PRIiPTR$ Macro |crv-PRIiPTR| + + $PRIoN$ Macro |crv-PRIoN| + $PRIoLEASTN$ Macro |crv-PRIoLEASTN| + $PRIoFASTN$ Macro |crv-PRIoFASTN| + $PRIoMAX$ Macro |crv-PRIoMAX| + $PRIoPTR$ Macro |crv-PRIoPTR| + + $PRIuN$ Macro |crv-PRIuN| + $PRIuLEASTN$ Macro |crv-PRIuLEASTN| + $PRIuFASTN$ Macro |crv-PRIuFASTN| + $PRIuMAX$ Macro |crv-PRIuMAX| + $PRIuPTR$ Macro |crv-PRIuPTR| + + $PRIxN$ Macro |crv-PRIxN| + $PRIxLEASTN$ Macro |crv-PRIxLEASTN| + $PRIxFASTN$ Macro |crv-PRIxFASTN| + $PRIxMAX$ Macro |crv-PRIxMAX| + $PRIxPTR$ Macro |crv-PRIxPTR| + + $PRIXN$ Macro |crv-PRIXN| + $PRIXLEASTN$ Macro |crv-PRIXLEASTN| + $PRIXFASTN$ Macro |crv-PRIXFASTN| + $PRIXMAX$ Macro |crv-PRIXMAX| + $PRIXPTR$ Macro |crv-PRIXPTR| + + $SCNdN$ Macro |crv-SCNdN| + $SCNdLEASTN$ Macro |crv-SCNdLEASTN| + $SCNdFASTN$ Macro |crv-SCNdFASTN| + $SCNdMAX$ Macro |crv-SCNdMAX| + $SCNdPTR$ Macro |crv-SCNdPTR| + + $SCNiN$ Macro |crv-SCNiN| + $SCNiLEASTN$ Macro |crv-SCNiLEASTN| + $SCNiFASTN$ Macro |crv-SCNiFASTN| + $SCNiMAX$ Macro |crv-SCNiMAX| + $SCNiPTR$ Macro |crv-SCNiPTR| + + $SCNoN$ Macro |crv-SCNoN| + $SCNoLEASTN$ Macro |crv-SCNoLEASTN| + $SCNoFASTN$ Macro |crv-SCNoFASTN| + $SCNoMAX$ Macro |crv-SCNoMAX| + $SCNoPTR$ Macro |crv-SCNoPTR| + + $SCNuN$ Macro |crv-SCNuN| + $SCNuLEASTN$ Macro |crv-SCNuLEASTN| + $SCNuFASTN$ Macro |crv-SCNuFASTN| + $SCNuMAX$ Macro |crv-SCNuMAX| + $SCNuPTR$ Macro |crv-SCNuPTR| + + $SCNxN$ Macro |crv-SCNxN| + $SCNxLEASTN$ Macro |crv-SCNxLEASTN| + $SCNxFASTN$ Macro |crv-SCNxFASTN| + $SCNxMAX$ Macro |crv-SCNxMAX| + $SCNxPTR$ Macro |crv-SCNxPTR| + + $strtoimax$ Func |crv-strtoimax| + $strtoumax$ Func |crv-strtoumax| + $wcstoimax$ Func |crv-wcstoimax| + $wcstoumax$ Func |crv-wcstoumax| + + +Macros *crv-__STDC_FORMAT_MACROS* +------ +The following macros expand to a string (in most cases a single character) +containing a conversion specifier suitable for use within format arguments +of formated input/output functions, like$printf()$or$scanf()$. +They are only defined when$__STDC_FORMAT_MACROS$is defined before including +$<inttypes.h>$. +For each type declared in$<stdint.h>$, corresponding macros for conversion +specifiers for use with the formatted input/output functions are defined. + +The macro names have a prefix PRI for the printf family or SCN for the +scanf family functions followed by the conversion specifier, followed by name +that is similar to the type name this macro is for, followed by a number N. +The number N represents the width of the type as specified in$<stdint.h>.$ + +Example: The macro$PRIxFAST32$can be used in a format string to print an +integer value of type$int_fast32_t$in hexedecimal format ('x'). + +Usage see example below. + + +Format Specifiers for ..printf +------------------------------ + +Signed Integers: +$PRIdN$ width N, decimal notation *crv-PRIdN* +$PRIdLEASTN$ minimum width N, decimal notation *crv-PRIdLEASTN* +$PRIdFASTN$ width N, fast to operate with, decimal not. *crv-PRIdFASTN* +$PRIdMAX$ type$intmax_t$, decimal notation *crv-PRIdMAX* +$PRIdPTR$ type$intptr_t$, decimal notation *crv-PRIdPTR* + +$PRIiN$ width N, decimal notation *crv-PRIiN* +$PRIiLEASTN$ minimum width N, decimal notation *crv-PRIiLEASTN* +$PRIiFASTN$ width N, fast to operate with, decimal not. *crv-PRIiFASTN* +$PRIiMAX$ type$intmax_t$, decimal notation *crv-PRIiMAX* +$PRIiPTR$ type$intptr_t$, decimal notation *crv-PRIiPTR* + +Unsigned Integers: +$PRIoN$ width N, octal notation *crv-PRIoN* +$PRIoLEASTN$ minimum width N, octal notation *crv-PRIoLEASTN* +$PRIoFASTN$ width N, fast to operate with, octal not. *crv-PRIoFASTN* +$PRIoMAX$ type$intmax_t$, octal notation *crv-PRIoMAX* +$PRIoPTR$ type$intptr_t$, octal notation *crv-PRIoPTR* + +$PRIuN$ width N, decimal notation *crv-PRIuN* +$PRIuLEASTN$ minimum width N, decimal notation *crv-PRIuLEASTN* +$PRIuFASTN$ width N, fast to operate with, decimal not. *crv-PRIuFASTN* +$PRIuMAX$ type$intmax_t$, decimal notation *crv-PRIuMAX* +$PRIuPTR$ type$intptr_t$, decimal notation *crv-PRIuPTR* + +$PRIxN$ width N, lowercase hex. notation *crv-PRIxN* +$PRIxLEASTN$ minimum width N, lowercase hex. notation *crv-PRIxLEASTN* +$PRIxFASTN$ width N, fast operation, lowercase hex. not *crv-PRIxFASTN* +$PRIxMAX$ type$intmax_t$, lowercase hex. notation *crv-PRIxMAX* +$PRIxPTR$ type$intptr_t$, lowercase hex. notation *crv-PRIxPTR* + +$PRIXN$ width N, uppercase hex. notation *crv-PRIXN* +$PRIXLEASTN$ minimum width N, uppercase hex. notation *crv-PRIXLEASTN* +$PRIXFASTN$ width N, fast operation, uppercase hex. not. *crv-PRIXFASTN* +$PRIXMAX$ type$intmax_t$, uppercase hex. notation *crv-PRIXMAX* +$PRIXPTR$ type$intptr_t$, uppercase hex. notation *crv-PRIXPTR* + + +Format Specifiers for ..scanf +----------------------------- + +Signed Integers: +$SCNdN$ width N, decimal notation *crv-SCNdN* +$SCNdLEASTN$ minimum width N, decimal notation *crv-SCNdLEASTN* +$SCNdFASTN$ width N, fast to operate with, decimal not. *crv-SCNdFASTN* +$SCNdMAX$ type$intmax_t$, decimal notation *crv-SCNdMAX* +$SCNdPTR$ type$intptr_t$, decimal notation *crv-SCNdPTR* + +$SCNiN$ width N, decimal notation *crv-SCNiN* +$SCNiLEASTN$ minimum width N, decimal notation *crv-SCNiLEASTN* +$SCNiFASTN$ width N, fast to operate with, decimal not. *crv-SCNiFASTN* +$SCNiMAX$ type$intmax_t$, decimal notation *crv-SCNiMAX* +$SCNiPTR$ type$intptr_t$, decimal notation *crv-SCNiPTR* + +Unsigned Integers: +$SCNoN$ width N, octal notation *crv-SCNoN* +$SCNoLEASTN$ minimum width N, octal notation *crv-SCNoLEASTN* +$SCNoFASTN$ width N, fast to operate with, octal not. *crv-SCNoFASTN* +$SCNoMAX$ type$intmax_t$, octal notation *crv-SCNoMAX* +$SCNoPTR$ type$intptr_t$, octal notation *crv-SCNoPTR* + +$SCNuN$ width N, decimal notation *crv-SCNuN* +$SCNuLEASTN$ minimum width N, decimal notation *crv-SCNuLEASTN* +$SCNuFASTN$ width N, fast to operate with, decimal not. *crv-SCNuFASTN* +$SCNuMAX$ type$intmax_t$, decimal notation *crv-SCNuMAX* +$SCNuPTR$ type$intptr_t$, decimal notation *crv-SCNuPTR* + +$SCNxN$ width N, hex. notation *crv-SCNxN* +$SCNxLEASTN$ minimum width N, hex. notation *crv-SCNxLEASTN* +$SCNxFASTN$ width N, fast operation, hex. not *crv-SCNxFASTN* +$SCNxMAX$ type$intmax_t$, hex. notation *crv-SCNxMAX* +$SCNxPTR$ type$intptr_t$, hex. notation *crv-SCNxPTR* + + +Example: > + #define __STDC_FORMAT_MACROS + + #include <inttypes.h> + #include <stdio.h> + + int main(void) + { + int16_t n = -123; + + printf("Value is %4" PRIu16 "\n", n); + } + + + +imaxdiv_t Type *crv-imaxdiv_t* +-------------- +This is a structure type used to hold the result returned by the$imaxdiv()$ +function. It holds both, the quotient and the remainder from the division. + + + +imaxabs() Function *crv-imaxabs* +------------------- +Synopsis~ + $#include <inttypes.h>$ + $intmax_t imaxabs(intmax_t j);$ + +Return~ +absolute value of$j$ + +Description~ +This function computes the absolute value of an integer$j$. + + + +imaxdiv() Function *crv-imaxdiv* +------------------- +Synopsis~ + $#include <inttypes.h>$ + $intdiv_t imaxdiv(intmax_t numerator, intmax_t denominator );$ + +Return~ +returns result of division and modulo operation, both stored in$intdiv_t$ +structur + +Description~ +This functions computes$numerator / denominator$and$numerator % denominator$in +a single operation. + + + +strtoimax() Function *crv-strtoimax* +-------------------- +Synopsis~ + $#include <inttypes.h>$ + $intmax_t strtoimax(const char *restrict string, char **restrict tailptr,$ + $int base);$ + +Return~ +converted value + +Description~ +This function ("string-to-imax") converts the initial part of$string$to a +signed integer, which is returned as a value of type$intmax_t$. +See$strol()$for description of parameters (|crv-libstrtol|). + + + +strtoumax() Function *crv-strtoumax* +-------------------- +Synopsis~ + $#include <inttypes.h>$ + $uintmax_t strtoumax(const char *restrict string, char **restrict tailptr,$ + $int base);$ + +Return~ +converted value + +Description~ +This function ("string-to-umax") converts the initial part of$string$to a +signed integer, which is returned as a value of type$uintmax_t$. +See$stroul()$for description of parameters (|crv-libstrtoul|). + + + +wcstoimax() Function *crv-wcstoimax* +-------------------- +Synopsis~ + $#include <stddef.h> // for wchar_t$ + $#include <inttypes.h>$ + $wchar_t wcstoimax(const wchar_t *restrict string,$ + $wchar_t **restrict tailptr, int base);$ + +Return~ +converted value + +Description~ +This function is equivalent to the$strtoimax()$function in nearly all aspects +but handles wide character strings (see |crv-libstrtoimax| for further +information). + + + +wcstoumax() Function *crv-wcstoumax* +-------------------- +Synopsis~ + $#include <stddef.h> // for wchar_t$ + $#include <inttypes.h>$ + $wchar_t wcstoimax(const wchar_t *restrict string,$ + $wchar_t **restrict tailptr, int base);$ + +Return~ +converted value + +Description~ +This function is equivalent to the$strtoumax()$function in nearly all aspects +but handles wide character strings (see |crv-libstrtoumax| for further +information). + + + +============================================================================== +II.9 <iso646.h> Alternatives *crv-libIso646H* + +This header defines some macros. They can be used for alternative spellings. + + Macro | Expands to + ----------+------------ + $and$ | $&&$ + $and_eq$ | $&=$ + $bitand$ | $&$ + $bitor$ | $|$ + $compl$ | $~$ + $not$ | $!$ + $not_eq$ | $!=$ + $or$ | $||$ + $or_eq$ | $|=$ + $xor$ | $^$ + $xor_eq$ | $^=$ + + + +============================================================================== +II.10 <limits.h> Limits of Integer Types *crv-libLimitsH* + +This header file defines several macros that expand to various limits and +parameters of the integer types. +NOTE: The values are platform- and implementation-specific.The ISO C standard +specifies minimum and maximum values for most of these parameters. + +The macros of this header can be grouped in: + - range of integer type + - width of type + - selection of conversion and its properties + + +Quicklink: + $CHAR_BIT$ Macro |crv-CHAR_BIT| + $CHAR_MAX$ Macro |crv-CHAR_MAX| + $CHAR_MIN$ Macro |crv-CHAR_MIN| + $INT_MAX$ Macro |crv-INT_MAX| + $INT_MIN$ Macro |crv-INT_MIN| + $LONG_LONG_MAX$ Macro |crv-LONG_LONG_MAX| + $LONG_LONG_MIN$ Macro |crv-LONG_LONG_MIN| + $LONG_MAX$ Macro |crv-LONG_MAX| + $LONG_MIN$ Macro |crv-LONG_MIN| + $MB_LEN_MAX$ Macro |crv-MB_LEN_MAX| + $SCHAR_MAX$ Macro |crv-SCHAR_MAX| + $SCHAR_MIN$ Macro |crv-SCHAR_MIN| + $SHRT_MAX$ Macro |crv-SHRT_MAX| + $SHRT_MIN$ Macro |crv-SHRT_MIN| + $UCHAR_MAX$ Macro |crv-UCHAR_MAX| + $UINT_MAX$ Macro |crv-UINT_MAX| + $ULONG_LONG_MAX$Macro |crv-ULONG_LONG_MAX| + $ULONG_MAX$ Macro |crv-ULONG_MAX| + $USHRT_MAX$ Macro |crv-USHRT_MAX| + + +------------------------------------------------------------------------------ +II.10.1 Range of Integer Type *crv-libLHRange* + +Each signed integer type has a pair of macros which give the smallest and +largest values that it can hold. Each unsigned integer type has one such +macro, for the maximum value; the minimum value is, of course, zero. + +The values of these macros are all integer constant expressions. The MAX and +MIN macros for$char$and$short int$types have values of type$int$. The MAX and +MIN macros for the other types have values of the same type described by +the macro - thus,$ULONG_MAX$has type$unsigned long int$. + +SCHAR_MIN Macro *crv-SCHAR_MIN* +SCHAR_MAX Macro *crv-SCHAR_MAX* +--------------- +minimum / maximum value that can be represented by a$signed char$ + + +UCHAR_MAX Macro *crv-UCHAR_MAX* +--------------- +maximum value that can be represented by an$unsigned char$ + + +CHAR_MIN Macro *crv-CHAR_MIN* +CHAR_MAX Macro *crv-CHAR_MAX* +-------------- +minimum / maximum value that can be represented by a$char$ + + +SHRT_MIN Macro *crv-SHRT_MIN* +SHRT_MAX Macro *crv-SHRT_MAX* +-------------- +minimum / maximum value that can be represented by a$signed short int$ + + +USHRT_MAX Macro *crv-USHRT_MAX* +--------------- +maximum value that can be represented by an$unsigned short int$ + + +INT_MIN Macro *crv-INT_MIN* +INT_MAX Macro *crv-INT_MAX* +------------- +minimum / maximum value that can be represented by a$signed int$ + +UINT_MAX Macro *crv-UINT_MAX* +-------------- +maximum value that can be represented by an$unsigned int$ + + +LONG_MIN Macro *crv-LONG_MIN* +LONG_MAX Macro *crv-LONG_MAX* +-------------- +minimum / maximum value that can be represented by a$signed long int$ + + +ULONG_MAX Macro *crv-ULONG_MAX* +--------------- +maximum value that can be represented by an$unsigned long int$ + + +LONG_LONG_MIN Macro *crv-LONG_LONG_MIN* +LONG_LONG_MAX Macro *crv-LONG_LONG_MAX* +------------------- +minimum / maximum value that can be represented by a$signed long long int$ + + +ULONG_LONG_MAX Macro *crv-ULONG_LONG_MAX* +-------------------- +maximum value that can be represented by an$unsigned long long int$ + + + + +------------------------------------------------------------------------------ +II.10.2 Width of Type *crv-libLHWidth* + +CHAR_BIT Macro *crv-CHAR_BIT* +-------------- +this is the number of bits in a$char$- eight, on most systems. The value +has type$int$. + + + +------------------------------------------------------------------------------ +II.10.3 Conversion and Properties *crv-libLHConv* + +A characteristic of each multibyte character set is the maximum number of +bytes that can be necessary to represent one character. This information +is quite important when writing code that uses the conversion functions. + +MB_LEN_MAX Macro *crv-MB_LEN_MAX* +---------------- +Specifies the maximum number of bytes in the multibyte sequence for a single +character in any of the supported locales. This is a compile-time constant. + + + + +============================================================================== +II.11 <local.h> Localization *crv-libLocalH* + +This header defines macros and declares functions for setting local specific +things. + +Quicklink: + $LC_ALL$ Macro |crv-LC_ALL| + $LC_COLLATE$ Macro |crv-LC_COLLATE| + $LC_CTYPE$ Macro |crv-LC_CTYPE| + $LC_MONETARY$ Macro |crv-LC_MONETARY| + $LC_NUMERIC$ Macro |crv-LC_NUMERIC| + $lconf$ Type |crv-lconf| + $localeconf()$ Func |crv-localeconv| + $setlocale()$ Func |crv-setlocale| + + +------------------------------------------------------------------------------ +II.11.1 Categories *crv-libLocHCat* + +The purposes that locales serve are grouped into categories, so that a user +or a program can choose the locale for each category independently. +The following macro names are both an environment variable that +a user can set, and a macro name that can be used as an argument +to$setlocale()$. +Additional macro definitions beginning with LC_ followed by uppercase letters +my be specified by the compiler. + + +LC_COLLATE Macro *crv-LC_COLLATE* +---------------- +This category applies to collation of strings (functions$strcoll()$and +$strxfrm()$). + + +LC_CTYPE Macro *crv-LC_CTYPE* +-------------- +This category applies to classification and conversion of characters, and to +multibyte and wide characters. + + +LC_MONETARY Macro *crv-LC_MONETARY* +----------------- +This category applies to formatting monetary values. + + +LC_NUMERIC Macro *crv-LC_NUMERIC* +---------------- +This category applies to formatting numeric values that are not monetary. + + +LC_ALL Macro *crv-LC_ALL* +------------ +This is not an environment variable; it is only a macro that can be use with +$setlocale()$to set a single locale for all purposes. Setting this environment +variable overwrites all selections by the other LC_* variables. + + + +------------------------------------------------------------------------------ +II.11.2 Standard Locales *crv-libLocHLoc* + +There are two standard locales: + +"C" +This is the standard C locale. The attributes and behavior it provides are +specified in the ISO C standard. This is the default. +For "C" the members of the$lconf$structure have the following values: > + char *decimal_point // "." + char *mon_decimal_point // "" + char *thousands_sep // "" + char *mon_thousands_sep // "" + char *grouping // "" + char *mon_grouping // "" + char int_frac_digits // CHAR_MAX + char frac_digits // CHAR_MAX + char *currency_symbol // "" + char *int_curr_symbol // "" + char p_cs_precedes // CHAR_MAX + char n_cs_precedes // CHAR_MAX + char int_p_cs_precedes // CHAR_MAX + char int_n_cs_precedes // CHAR_MAX + char p_sep_by_space // CHAR_MAX + char n_sep_by_space // CHAR_MAX + char int_p_sep_by_space // CHAR_MAX + char int_n_sep_by_space // CHAR_MAX + char *positive_sign // "" + char *negative_sign // "" + char p_sign_posn // CHAR_MAX + char n_sign_posn // CHAR_MAX + char int_p_sign_posn // CHAR_MAX + char int_n_sign_posn // CHAR_MAX +An empty string or$CHAR_MAX$indicates that the value is not available +in this local. + +"" +The empty name says to select a locale based on environment variables, +see categories (|crv-libLocHCat|). + + + +------------------------------------------------------------------------------ +II.11.3 Information Structure *crv-libLocHInfo* + + +lconf Type *crv-lconf* +---------- +$lconf$is a structure giving information about numeric and monetary notation. +According to standard C this structure must have at least the following +elements. +If a member of the structure has type$char$, and the value is$CHAR_MAX$, +it means that the current locale has no value for that parameter. + + +$char *decimal_point$ *crv-decimal_point* +$char *mon_decimal_point$ *crv-mon_decimal_point* +These are the decimal-point separators used in formatting non-monetary and +monetary quantities, respectively. + + +$char *thousands_sep$ *crv-thousands_sep* +$char *mon_thousands_sep$ *crv-mon_thousands_sep* +These are the separators used to delimit groups of digits to the left of the +decimal point in formatting non-monetary and monetary quantities, +respectively. + + +$char *grouping$ *crv-grouping* +$char *mon_grouping$ *crv-mon_grouping* +These are strings that specify how to group the digits to the left of the +decimal point.$grouping$applies to non-monetary quantities and$mon_grouping$ +applies to monetary quantities. Use either$thousands_sep$or$mon_thousands_sep$ +to separate the digit groups. + +Each member of these strings is to be interpreted as an integer value of type +$char$. Successive numbers (from left to right) give the sizes of successive +groups (from right to left, starting at the decimal point.) The last member +is either 0, in which case the previous member is used over and over again +for all the remaining groups, or$CHAR_MAX$, in which case there is no more +grouping - or, put another way, any remaining digits form one large group +without separators. + +For example, if grouping is "\04\03\02", the correct grouping for the number +123456787654321 is 12, 34, 56, 78, 765, 4321. This uses a group of 4 digits +at the end, preceded by a group of 3 digits, preceded by groups of 2 digits +(as many as needed). With a separator of ,, the number would be printed as +12,34,56,78,765,4321. + +A value of "\03" indicates repeated groups of three digits, as normally used +in the U.S. + + +$char int_frac_digits$ *crv-int_frac_digits* +$char frac_digits$ *crv-frac_digits* +These are small integers indicating how many fractional digits (to the right +of the decimal point) should be displayed in a monetary value in international +and local formats, respectively. + + +$char *currency_symbol$ *crv-currency_symbol* +The local currency symbol for the selected locale. + + +$char *int_curr_symbol$ *crv-int_curr_symbol* +The international currency symbol for the selected locale. The value should +normally consist of a three-letter abbreviation. + + +$char p_cs_precedes$ *crv-p_cs_precedes* +$char n_cs_precedes$ *crv-n_cs_precedes* +$char int_p_cs_precedes$ *crv-int_p_cs_precedes* +$char int_n_cs_precedes$ *crv-int_n_cs_precedes* +These members are 1 if the$currency_symbol$or$int_curr_symbol$strings should +precede the value of a monetary amount, or 0 if the strings should follow +the value. The$p_cs_precedes$and$int_p_cs_precedes$members apply to positive +amounts (or zero), and the$n_cs_precedes$and$int_n_cs_precedes$members apply +to negative amounts. +The members with the$int_ prefix$apply to the$int_curr_symbol$while the other +two apply to$currency_symbol$. + + +$char p_sep_by_space$ *crv-p_sep_by_space* +$char n_sep_by_space$ *crv-n_sep_by_space* +$char int_p_sep_by_space$ *crv-int_p_sep_by_space* +$char int_n_sep_by_space$ *crv-int_n_sep_by_space* +These members are 1 if a space should appear between the$currency_symbol$ +or$int_curr_symbol$strings and the amount, or 0 if no space should appear. +The$p_sep_by_space$and$int_p_sep_by_space$members apply to positive amounts +(or zero), and the$n_sep_by_space$and$int_n_sep_by_space$members apply to +negative amounts. +The members with the$int_ prefix$apply to the$int_curr_symbol$while the other +two apply to$currency_symbol$. There is one specialty with +the$int_curr_symbol$though. Since all legal values contain a space at the +end the string one either$printf()$this space (if the currency symbol must +appear in front and must be separated) or one has to avoid printing this +character at all (especially when at the end of the string). + + +$char *positive_sign$ *crv-positive_sign* +$char *negative_sign$ *crv-negative_sign* +These are strings used to indicate positive (or zero) and negative monetary +quantities, respectively. + + +$char p_sign_posn$ *crv-p_sign_posn* +$char n_sign_posn$ *crv-n_sign_posn* +$char int_p_sign_posn$ *crv-int_p_sign_posn* +$char int_n_sign_posn$ *crv-int_n_sign_posn* +These members are small integers that indicate how to position the sign for +nonnegative and negative monetary quantities, respectively. (The string used +by the sign is what was specified with$positive_sign$or$negative_sign$.) +The possible values are as follows: + +0 The currency symbol and quantity should be surrounded by parentheses. + +1 Print the sign string before the quantity and currency symbol. + +2 Print the sign string after the quantity and currency symbol. + +3 Print the sign string right before the currency symbol. + +4 Print the sign string right after the currency symbol. + +CHAR_MAX "Unspecified". Both members have this value in the standard C +locale. + +The members with the$int_ prefix$apply to the$int_curr_symbol$while the other +two apply to$currency_symbol$. + + + +------------------------------------------------------------------------------ +II.11.4 Functions *crv-libLocHFunc* + + +setlocale() Function *crv-setlocale* +-------------------- +Synopsis~ + $#include <locale.h>$ + $char *setlocale(int category, const char *locale);$ + +Return~ +see description + +Description~ +This function sets the current locale for category$category$to$locale$. + +If category is$ LC_ALL$, this specifies the locale for all purposes. The other +possible values of$category$specify an single purpose +(see Categories |crv-libLocHCat| ). + +This function can also be used to find out the current locale by passing a null +pointer as the$locale$argument. In this case, a string is returned that is the +name of the locale currently selected for category$category$. + +The string returned should not be modified. + +When the current locale for category$LC_ALL$is read, the value encodes the +entire combination of selected locales for all categories. + +It is not guaranteed that the returned pointer remains valid over time, so a +copy must be made. + +When the$locale$argument is not a null pointer, the string returned reflects +the newly-modified locale. + +If an empty string for$locale$is specified, this means to read the appropriate +environment variable and use its value to select the locale for$category$. + +If a nonempty string is given for$locale$, then the locale of that name is +used if possible. + +If an invalid locale name is specified,$setlocale()$returns a null pointer +and leaves the current locale unchanged. + + + +localeconf() Function *crv-localeconv* +--------------------- +Synopsis~ + $#include <locale.h>$ + $struct lconv *localeconv(void);$ + +Return~ +pointer to structure$lconv$, representing the current local settings + +Description~ +This function returns a pointer to the structure$lconv$whose components +contain information about how numeric and monetary values should be +formatted in the current locale. + + + + +============================================================================== +II.12 <math.h> Mathematics *crv-libMathH* + +This header file defines macros and declares functions that allow to do +mathematics. + +Quicklink: + $acos()$ Func |crv-acos| + $acosf()$ Func |crv-acosf| + $acosh()$ Func |crv-acosh| + $acoshf()$ Func |crv-acoshf| + $acoshl()$ Func |crv-acoshl| + $acosl()$ Func |crv-acosl| + $asin()$ Func |crv-asin| + $asinf()$ Func |crv-asinf| + $asinh()$ Func |crv-asinh| + $asinhf()$ Func |crv-asinhf| + $asinhl()$ Func |crv-asinhl| + $asinl()$ Func |crv-asinl| + $atan()$ Func |crv-atan| + $atanf()$ Func |crv-atanf| + $atanh()$ Func |crv-atanh| + $atanhf()$ Func |crv-atanhf| + $atanhl()$ Func |crv-atanhl| + $atanl()$ Func |crv-atanl| + $atan2()$ Func |crv-atan2| + $atan2f()$ Func |crv-atan2f| + $atan2l()$ Func |crv-atan2l| + $cbrt()$ Func |crv-cbrt| + $cbrtf()$ Func |crv-cbrtf| + $cbrtl()$ Func |crv-cbrtl| + $ceil()$ Func |crv-ceil| + $ceilf()$ Func |crv-ceilf| + $ceill()$ Func |crv-ceill| + $copysign()$ Func |crv-copysign| + $copysignf()$ Func |crv-copysignf| + $copysignl()$ Func |crv-copysignl| + $cos()$ Func |crv-cos| + $cosf()$ Func |crv-cosf| + $cosh()$ Func |crv-cosh| + $coshf()$ Func |crv-coshf| + $coshl()$ Func |crv-coshl| + $cosl()$ Func |crv-cosl| + $erf()$ Func |crv-erf| + $erff()$ Func |crv-erff| + $erfl()$ Func |crv-erfl| + $erfc()$ Func |crv-erfc| + $erfcf()$ Func |crv-erfcf| + $erfcl()$ Func |crv-erfcl| + $exp2()$ Func |crv-exp2| + $exp2f()$ Func |crv-exp2f| + $exp2l()$ Func |crv-exp2l| + $exp()$ Func |crv-exp| + $expf()$ Func |crv-expf| + $expl()$ Func |crv-expl| + $expm1()$ Func |crv-expm1| + $expm1f()$ Func |crv-expm1f| + $expm1l()$ Func |crv-expm1l| + $fabs()$ Func |crv-fabs| + $fabsf()$ Func |crv-fabsf| + $fabsl()$ Func |crv-fabsl| + $fdim()$ Func |crv-fdim| + $fdimf()$ Func |crv-fdimf| + $fdiml()$ Func |crv-fdiml| + $floor()$ Func |crv-floor| + $floorf()$ Func |crv-floorf| + $floorl()$ Func |crv-floorl| + $fmin()$ Func |crv-fmin| + $fminf()$ Func |crv-fminf| + $fminl()$ Func |crv-fminl| + $fma()$ Func |crv-fma| + $fmaf()$ Func |crv-fmaf| + $fmal()$ Func |crv-fmal| + $fmax()$ Func |crv-fmax| + $fmaxf()$ Func |crv-fmaxf| + $fmaxl()$ Func |crv-fmaxl| + $fmod()$ Func |crv-fmod| + $fmodf()$ Func |crv-fmodf| + $fmodl()$ Func |crv-fmodl| + $FP_FAST_FMA$ Macro |crv-FP_FAST_FMA| + $FP_FAST_FMAF$ Macro |crv-FP_FAST_FMAF| + $FP_FAST_FMAL$ Macro |crv-FP_FAST_FMAL| + $FP_ILOGB0$ Macro |crv-FP_ILOGB0| + $FP_ILOGBNAN$ Macro |crv-FP_ILOGBNAN| + $frexp()$ Func |crv-frexp| + $frexpf()$ Func |crv-frexpf| + $frexpl()$ Func |crv-frexpl| + $hypot()$ Func |crv-hypot| + $hypotf()$ Func |crv-hypotf| + $hypotl()$ Func |crv-hypotl| + $ilogb()$ Func |crv-ilogb| + $ilogbf()$ Func |crv-ilogbf| + $ilogbl()$ Func |crv-ilogbl| + $isfinite()$ Macro |crv-isfinite| + $isgreater()$ Macro |crv-isgreater| + $isgreaterequal()$Macro |crv-isgreaterequal| + $isinf()$ Macro |crv-isinf| + $isless()$ Macro |crv-isless| + $islessequal()$ Macro |crv-islessequal| + $islessgreater()$ Macro |crv-islessgreater| + $isnan()$ Macro |crv-isnan| + $isnormal()$ Macro |crv-isnormal| + $isunordered()$ Macro |crv-isunordered| + $ldexp()$ Func |crv-ldexp| + $ldexpf()$ Func |crv-ldexpf| + $ldexpl()$ Func |crv-ldexpl| + $lgamma()$ Func |crv-lgamma| + $lgammaf()$ Func |crv-lgammaf| + $lgammal()$ Func |crv-lgammal| + $log()$ Func |crv-log| + $logf()$ Func |crv-logf| + $logl()$ Func |crv-logl| + $log10()$ Func |crv-log10| + $log10f()$ Func |crv-log10f| + $log10l()$ Func |crv-log10l| + $log1p()$ Func |crv-log1p| + $log1pf()$ Func |crv-log1pf| + $log1pl()$ Func |crv-log1pl| + $log2()$ Func |crv-log2| + $log2f()$ Func |crv-log2f| + $log2l()$ Func |crv-log2l| + $logb()$ Func |crv-logb| + $logbf()$ Func |crv-logbf| + $logbl()$ Func |crv-logbl| + $lrint()$ Func |crv-lrint| + $lrintf()$ Func |crv-lrintf| + $lrintl()$ Func |crv-lrintl| + $llrint()$ Func |crv-llrint| + $llrintf()$ Func |crv-llrintf| + $llrintl()$ Func |crv-llrintl| + $lround()$ Func |crv-lround| + $lroundf()$ Func |crv-lroundf| + $lroundl()$ Func |crv-lroundl| + $llround()$ Func |crv-llround| + $llroundf()$ Func |crv-llroundf| + $llroundl()$ Func |crv-llroundl| + $modf()$ Func |crv-modf| + $modff()$ Func |crv-modff| + $modfl()$ Func |crv-modfl| + $nan()$ Func |crv-nan| + $nanf()$ Func |crv-nanf| + $nanl()$ Func |crv-nanl| + $nearbyint()$ Func |crv-nearbyint| + $nearbyintf()$ Func |crv-nearbyintf| + $nearbyintl()$ Func |crv-nearbyintl| + $nextafter()$ Func |crv-nextafter| + $nextafterf()$ Func |crv-nextafterf| + $nextafterl()$ Func |crv-nextafterl| + $nexttoward()$ Func |crv-nexttoward| + $nexttowardf()$ Func |crv-nexttowardf| + $nexttowardl()$ Func |crv-nexttowardl| + $pow()$ Func |crv-pow| + $powf()$ Func |crv-powf| + $powl()$ Func |crv-powl| + $remainder()$ Func |crv-remainder| + $remainderf()$ Func |crv-remainderf| + $remainderl()$ Func |crv-remainderl| + $remquo()$ Func |crv-remquo| + $remquof()$ Func |crv-remquof| + $remquol()$ Func |crv-remquol| + $rint()$ Func |crv-rint| + $rintf()$ Func |crv-rintf| + $rintl()$ Func |crv-rintl| + $round()$ Func |crv-round| + $roundf()$ Func |crv-roundf| + $roundl()$ Func |crv-roundl| + $scalbn()$ Func |crv-scalbn| + $scalbnf()$ Func |crv-scalbnf| + $scalbnl()$ Func |crv-scalbnl| + $scalbln()$ Func |crv-scalbln| + $scalblnf()$ Func |crv-scalblnf| + $scalblnl()$ Func |crv-scalblnl| + $signbit()$ Macro |crv-signbit| + $signgam$ Var |crv-signgam| + $sin()$ Func |crv-sin| + $sinf() $ Func |crv-sinf| + $sinh()$ Func |crv-sinh| + $sinhf()$ Func |crv-sinhf| + $sinhl()$ Func |crv-sinhl| + $sinl()$ Func |crv-sinl| + $sqrt()$ Func |crv-sqrt| + $sqrtf()$ Func |crv-sqrtf| + $sqrtl()$ Func |crv-sqrtl| + $tan()$ Func |crv-tan| + $tanf()$ Func |crv-tanf| + $tanh()$ Func |crv-tanh| + $tanhf()$ Func |crv-tanhf| + $tanhl()$ Func |crv-tanhl| + $tanl()$ Func |crv-tanl| + $tgamma()$ Func |crv-tgamma| + $tgammaf()$ Func |crv-tgammaf| + $tgammal()$ Func |crv-tgammal| + $trunc()$ Func |crv-trunc| + $truncf()$ Func |crv-truncf| + $truncl()$ Func |crv-truncl| + + + +------------------------------------------------------------------------------ +II.12.1 Error Conditions *crv-libMHErr* + +All functions declared in$<math.h>$do handle errors in a very similar way. + +If an argument is outside the domain over a function is defined a domain +error occurs, then$errno$is set to$EDOM$. The value that the function returns +is implementation specific. + +If the result of a function cannot be represented in the type of return value, +a range error occurs. +If the result overflows, the function returns the value of the macro +$HUGE_VAL$, with the same sign as the correct value of the function; +$errno$is set to$ERANGE$. + +If the result underflows, the function returns 0; whether or not$errno$is +set to$ERANGE$is implementation-defined. + + +HUGE_VAL Macro *crv-HUGE_VAL* +HUGE_VALF Macro *crv-HUGE_VALF* +HUGE_VALL Macro *crv-HUGE_VALL* +--------------- +This macro expands to a positive$double$constant. On machines that use +IEEE 754 floating point format,$HUGE_VAL$is infinity. On other machines, +it's typically the largest positive number that can be represented. +$HUGE_VALF$and$HUGE_VALL$are the analogs for$float$and$long double$. + + + +------------------------------------------------------------------------------ +II.12.2 Classification Macros *crv-libMHClass* + + +fpclassify() Macro *crv-fpclassify* +------------------ +Synopsis~ + $#include <math.h>$ + $int fpclassify(float-type x;$ + +Return~ +FP_NAN +The floating-point number x is "Not a Number" + +FP_INFINITE +The value of x is either plus or minus infinity. + +FP_ZERO +The value of x is zero. + +FP_SUBNORMAL +Numbers whose absolute value is too small to be represented in the normal +format are represented in an alternate, denormalized format +(see |crv-dtFormatsFPBasics|) + +FP_NORMAL +This value is returned for all other values of x. It indicates that there +is nothing special about the number. + +Description~ +This is a generic macro which works on all floating-point types. +It classifies its argument as NaN, infinite, normal, subnormal, zero or into +another implementation-defined category. + + + +isfinite() Macro *crv-isfinite* +---------------- +Synopsis~ + $#include <math.h>$ + $int isfinite(float-type x);$ + +Return~ +0: x is not finite +else x is finite + +Description~ +This is a generic macro which works on all floating-point types. +This macro returns a nonzero value if x is finite: not plus or minus infinity, +and not NaN. It is equivalent to + $(fpclassify (x) != FP_NAN && fpclassify (x) != FP_INFINITE)$ + + + +isnormal() Macro *crv-isnormal* +---------------- +Synopsis~ + $#include <math.h>$ + $int isnormal(float-type x);$ + +Return~ +0: x is not normal +else x is normal + +Description~ +This is a generic macro which works on all floating-point types. +This macro returns a nonzero value if x is finite and normalized. +It is equivalent to + $(fpclassify (x) == FP_NORMAL)$ + + + +isnan() Macro *crv-isnan* +------------- +Synopsis~ + $#include <math.h>$ + $int isnan(float-type x);$ + +Return~ +0: x is not NaN +else x is NaN + +Description~ +This is a generic macro which works on all floating-point types. +This macro returns a nonzero value if x is NaN. It is equivalent to + $(fpclassify (x) == FP_NAN)$ + + + +isinf() Macro *crv-isinf* +------------- +Synopsis~ + $#include <math.h>$ + $int isinf(float-type x);$ + +Return~ +0: x is not infinite +else x is infinite + +Description~ +This is a generic macro which works on all floating-point types. +This macro returns a nonzero value if x is infinte. It is equivalent to + $(fpclassify (x) == FP_INFINITE)$ +~ + + + +------------------------------------------------------------------------------ +II.12.3 Comparison Macros *crv-libMHCmp* + +All macros below are generic macros that work on all floating-point types. + + +isgreater() Macro *crv-isgreater* +----------------- +Synopsis~ + $#include <math.h>$ + $int isgreater(float-type x, float-type y);$ + +Return~ +0: x is not greater y +else x is greater y + +Description~ +This macro determines whether the argument x is greater than y. +It is equivalent to (x) > (y), but no exception is raised if x or y are NaN. + + + +isgreaterequal() Macro *crv-isgreaterequal* +---------------------- +Synopsis~ + $#include <math.h>$ + $int isgreaterequal(float-type x, float-type y);$ + +Return~ +0: x is not greater or equal y +else x is greater or equal y + +Description~ +This macro determines whether the argument x is greater than or equal to y. +It is equivalent to (x) >= (y), but no exception is raised if x or y are NaN. + + + +isless() Macro *crv-isless* +-------------- +Synopsis~ + $#include <math.h>$ + $int isless(float-type x, float-type y);$ + +Return~ +0: x is not less y +else x is less y + +Description~ +This macro determines whether the argument x is less than y. It is equivalent +to (x) < (y), but no exception is raised if x or y are NaN. + + + +islessequal() Macro *crv-islessequal* +------------------- +Synopsis~ + $#include <math.h>$ + $int islessequal(float-type x, float-type y);$ + +Return~ +0: x is not less or equal y +else x is less or equal y + +Description~ +This macro determines whether the argument x is less than or equal to y. It is +equivalent to (x) <= (y), but no exception is raised if x or y are NaN. + + + +islessgreater() Macro *crv-islessgreater* +--------------------- +Synopsis~ + $#include <math.h>$ + $int islessgreater(float-type x, float-type y);$ + +Return~ +0: x is not less or greater y +else x is less or greater y + +Description~ +This macro determines whether the argument x is less or greater than y. It is +equivalent to (x) < (y) || (x) > (y) (although it only evaluates x and y +once), but no exception is raised if x or y are NaN. +This macro is not equivalent to x != y, because that expression is true if x +or y are NaN. + + + +isunordered() Macro *crv-isunordered* +------------------- +Synopsis~ + $#include <math.h>$ + $int isunordered(float-type x, float-type y);$ + +Return~ +0: x and y are not unordered +else x or y is unordered + +Description~ +This macro determines whether its arguments are unordered. In other words, +it is true if x or y are NaN, and false otherwise. + + + +------------------------------------------------------------------------------ +II.12.4 Trigonometric *crv-libMHTrig* + + +asin() Functions *crv-asin* *crv-asinf* *crv-asinl* +---------------- +Synopsis~ + $#include <math.h>$ + $double asin(double x);$ + $float asinf(float x);$ + $long double asinl(long double x);$ + +Return~ +range -PI/2...+PI/2 + +Description~ +These functions compute the arc sine of x. The value is in units of radians. +The arc sine function is defined mathematically only over the domain -1 to 1. +If x is outside the domain, asin signals a domain error. + + + +acos() Functions *crv-acos* *crv-acosf* *crv-acosl* +---------------- +Synopsis~ + $#include <math.h>$ + $double acos(double x);$ + $float acosf(float x);$ + $long double acosl(long double x);$ + +Return~ +range 0...PI + +Description~ +These functions compute the arc cosine of x. The value is in units of radians. +The arc cosine function is defined mathematically only over the domain -1 to +1. If x is outside the domain, acos signals a domain error. + + +atan() Functions *crv-atan* *crv-atanf* *crv-atanl* +---------------- +Synopsis~ + $#include <math.h>$ + $double atan(double x);$ + $float atanf(float x);$ + $long double atanl(long double x);$ + +Return~ +range -PI/2...+PI/2 + +Description~ +These functions compute the arc tangent of x. The value is in units of +radians. + + +atan2() Functions *crv-atan2* *crv-atan2f* *crv-atan2l* +----------------- +Synopsis~ + $#include <math.h>$ + $double atan2(double x);$ + $float atan2f(float x);$ + $long double atan2l(long double x);$ + +Return~ +range -PI...+PI +If both x and y are zero, atan2 returns zero. + +Description~ +This function computes the arc tangent of y/x, but the signs of both arguments +are used to determine the quadrant of the result, and x is permitted to be +zero. The return value is given in radians. + +If x and y are coordinates of a point in the plane, atan2 returns the signed +angle between the line from the origin to that point and the x-axis. +Thus, atan2 is useful for converting Cartesian coordinates to polar +coordinates. + + + +sin() Functions *crv-sin* *crv-sinf* *crv-sinl* +--------------- +Synopsis~ + $#include <math.h>$ + $double sin(double x);$ + $float sinf(float x);$ + $long double sinl(long double x);$ + +Return~ +range -1...+1 + +Description~ +These functions return the sine of x, where x is given in radians. + + +cos() Functions *crv-cos* *crv-cosf* *crv-cosl* +--------------- +Synopsis~ + $#include <math.h>$ + $double cos(double x);$ + $float cosf(float x);$ + $long double cosl(long double x);$ + +Return~ +range -1...+1 + +Description~ +These functions return the cosine of x, where x is given in radians. + + +tan() Functions *crv-tan* *crv-tanf* *crv-tanl* +--------------- +Synopsis~ + $#include <math.h>$ + $double tan(double x);$ + $float tanf(float x);$ + $long double tanl(long double x);$ + +Return~ +tangent of x + +Description~ +These functions return the tangent of x, where x is given in radians. +Mathematically, the tangent function has singularities at odd multiples of +PI/2. If the argument x is too close to one of these singularities,$tan()$ +will signal overflow. + + + +------------------------------------------------------------------------------ +II.12.5 Hyperbolic *crv-libMHHyper* + + +sinh() Functions *crv-sinh* *crv-sinhf* *crv-sinhl* +---------------- +Synopsis~ + $#include <math.h>$ + $double sinh(double x);$ + $float sinhf(float x);$ + $long double sinhl(long double x);$ + +Return~ +hyperbolic sine of x + +Description~ +These functions return the hyperbolic sine of x, defined mathematically as +(exp(x) - exp(-x)) / 2. They may signal overflow if x is too large. + + + +cosh() Functions *crv-cosh* *crv-coshf* *crv-coshl* +---------------- +Synopsis~ + $#include <math.h>$ + $double cosh(double x);$ + $float coshf(float x);$ + $long double coshl(long double x);$ + +Return~ +hyperbolic cosine of x + +Description~ +These function return the hyperbolic cosine of x, defined mathematically as +(exp(x) + exp(-x)) / 2. They may signal overflow if x is too large. + + + +tanh() Functions *crv-tanh* *crv-tanhf* *crv-tanhl* +---------------- +Synopsis~ + $#include <math.h>$ + $double tanh(double x);$ + $float tanhf(float x);$ + $long double tanhl(long double x);$ + +Return~ +hyperbolic tangent of x + +Description~ +These functions return the hyperbolic tangent of x, defined mathematically as +sinh(x) / cosh(x). They may signal overflow if x is too large. + + + +asinh() Functions *crv-asinh* *crv-asinhf* *crv-asinhl* +----------------- +Synopsis~ + $#include <math.h>$ + $double asinh(double x);$ + $float asinhf(float x);$ + $long double asinhl(long double x);$ + +Return~ +inverse hyperbolic sine of x + +Description~ +These functions return the inverse hyperbolic sine of x. + + + +acosh() Functions *crv-acosh* *crv-acoshf* *crv-acoshl* +----------------- +Synopsis~ + $#include <math.h>$ + $double acosh(double x);$ + $float acoshf(float x);$ + $long double acoshl(long double x);$ + +Return~ +inverse hyperbolic cosine of x + +Description~ +These functions return the inverse hyperbolic cosine of x. If x is less than +1, acosh signals a domain error. + + + +atanh() Functions *crv-atanh* *crv-atanhf* *crv-atanhl* +----------------- +Synopsis~ + $#include <math.h>$ + $double atanh(double x);$ + $float atanhf(float x);$ + $long double atanhl(long double x);$ + +Return~ +inverse hyperbolic tangent of x + +Description~ +These functions return the inverse hyperbolic tangent of x. If the absolute +value of x is greater than 1,$atanh()$signals a domain error; if it is +equal to 1, it returns infinity. + + + + +------------------------------------------------------------------------------ +II.12.6 Exponential & Logarithmic *crv-libMHExpLog* + + + +exp() Functions *crv-exp* *crv-expf* *crv-expl* +--------------- +Synopsis~ + $#include <math.h>$ + $double exp(double x);$ + $float expf(float x);$ + $long double expl(long double x);$ + +Return~ +e^x + +Description~ +These functions compute e (the base of natural logarithms) raised to the +power x. If the magnitude of the result is too large to be representable, +$exp()$signals overflow. + + + +exp2() Functions *crv-exp2* *crv-exp2f* *crv-exp2l* +---------------- +Synopsis~ + $#include <math.h>$ + $double exp2(double x);$ + $float exp2f(float x);$ + $long double exp2l(long double x);$ + +Return~ +2^x + +Description~ +These functions compute 2 raised to the power x. Mathematically,$exp2(x)$is +the same as exp(x * log(2)). + + + +expm1() Functions *crv-expm1* *crv-expm1f* *crv-expm1l* +----------------- +Synopsis~ + $#include <math.h>$ + $double expm1(double x);$ + $float expm1f(float x);$ + $long double expm1l(long double x);$ + +Return~ +exp(x)-1 + +Description~ +These functions return a value equivalent to exp(x) - 1. They are computed in a +way that is accurate even if x is near zero - a case where exp(x) - 1 would be +inaccurate owing to subtraction of two numbers that are nearly equal. + + + + +ilogb() Functions *crv-ilogb* *crv-ilogbf* *crv-ilogbl* +----------------- +Synopsis~ + $#include <math.h>$ + $int ilogb(double x);$ + $int ilogbf(float x);$ + $int ilogbl(long double x);$ + +Return~ + + +Description~ +These functions are equivalent to the corresponding logb() functions except +that they return signed integer values. Since integers cannot represent +infinity and NaN,$ilogb()$instead returns an integer that can't be the +exponent of a normal floating-point number, the macros are: + +FP_ILOGB0 Macro *crv-FP_ILOGB0* + $ilogb()$returns this value if its argument is 0. The numeric value is + either$INT_MIN$or$-INT_MAX$. + +FP_ILOGBNAN Macro *crv-FP_ILOGBNAN* + $ilogb()$returns this value if its argument is NaN. The numeric value is + either$INT_MIN$or$INT_MAX$. + + + +log() Functions *crv-log* *crv-logf* *crv-logl* +--------------- +Synopsis~ + $#include <math.h>$ + $double log(double x);$ + $float logf(float x);$ + $long double logl(long double x);$ + +Return~ +see description + +Description~ +These functions compute the natural logarithm of x. If x is negative,$log()$ +signals a domain error. If x is zero, it returns negative infinity; +if x is too close to zero, it may signal overflow. + + + +log10() Functions *crv-log10* *crv-log10f* *crv-log10l* +----------------- +Synopsis~ + $#include <math.h>$ + $double log10(double x);$ + $float log10f(float x);$ + $long double log10l(long double x);$ + +Return~ +base-10 logarithm of x + +Description~ +These functions return the base-10 logarithm of x. + $log10(x)$equals$log(x) / log(10)$ + + + +log1p() Functions *crv-log1p* *crv-log1pf* *crv-log1pl* +------------------ +Synopsis~ + $#include <math.h>$ + $double log1p(double x);$ + $float log1pf(float x);$ + $long double log1pl(long double x);$ + +Return~ +log(1+x) + +Description~ +These functions returns a value equivalent to log(1 + x). They are computed +in a way that is accurate even if x is near zero. + + + +log2() Functions *crv-log2* *crv-log2f* *crv-log2l* +---------------- +Synopsis~ + $#include <math.h>$ + $double log2(double x);$ + $float log2f(float x);$ + $long double log2l(long double x);$ + +Return~ +base-2 logarithm of x + +Description~ +These functions return the base-2 logarithm of x. + $log2(x)$equals$log(x) / log(2)$ + + + +logb() Functions *crv-logb* *crv-logbf* *crv-logbl* +---------------- +Synopsis~ + $#include <math.h>$ + $double log2(double x);$ + $float log2f(float x);$ + $long double log2l(long double x);$ + +Return~ +see description + +Description~ +These functions extract the exponent of x and return it as a floating-point +value. If FLT_RADIX is two,$logb()$is equal to$floor(log2 (x))$, except it's +probably faster. +If x is denormalized,$logb()$returns the exponent x would have if it were +normalized. If x is infinity (positive or negative),$logb()$returns ∞. +If x is zero,$logb()$returns ∞. It does not signal. + + + + +frexp() Functions *crv-frexp* *crv-frexpf* *crv-frexpl* +----------------- +Synopsis~ + $#include <math.h>$ + $double frexp(double x, int *exponent);$ + $float frexpf(float x, int *exponent);$ + $long double frexpl(long double x, int *exponent);$ + +Return~ +see description + +Description~ +These functions are used to split the number value into a normalized fraction +and an exponent. +If the argument value is not zero, the return value is value times a power +of two, and is always in the range 1/2 (inclusive) to 1 (exclusive). The +corresponding exponent is stored in *exponent; the return value multiplied +by 2 raised to this exponent equals the original number value. + +For example,$frexp(12.8, &exponent)$returns 0.8 and stores 4 in exponent. + +If value is zero, then the return value is zero and zero is stored in +*exponent. + + + +ldexp() Functions *crv-ldexp* *crv-ldexpf* *crv-ldexpl* +----------------- +Synopsis~ + $#include <math.h>$ + $double ldexp(double x, int exponent);$ + $float ldexpf(float x, int exponent);$ + $long double ldexpl(long double x, int exponent);$ + +Return~ +see description + +Description~ +These functions return the result of multiplying the floating-point number +value by 2 raised to the power exponent. +(It can be used to reassemble floating-point numbers that were taken apart +by$frexp()$) . +For example,$ldexp(0.8, 4)$returns 12.8. + + + +modf() Functions *crv-modf* *crv-modff* *crv-modfl* +---------------- +Synopsis~ + $#include <math.h>$ + $double modf(double x, double *intpart);$ + $float modff(float x, float *intpart);$ + $long double modfl(long double x, long double *intpart);$ + +Return~ +stores the integer part in *intpart, and returns the fractional part + +Description~ +These functions break the argument value into an integer part and a fractional +part (between -1 and 1, exclusive). Their sum equals value. Each of the parts +has the same sign as value, and the integer part is always rounded toward zero. + +Example:$modf(2.5, &intpart)$returns 0.5 and stores 2.0 into intpart. + + + +scalbn() Functions *crv-scalbn* *crv-scalbnf* *crv-scalbnl* +------------------ +Synopsis~ + $#include <math.h>$ + $double scalbn(double x, int n);$ + $float scalbnf(float x, int n);$ + $long double scalbnl(long double x, int n);$ + +Return~ +x*FLT_RADIX^n + +Description~ +These functions compute x * FLT_RADIX^n efficiently (commonly FLT_RADIX is 2). +n is of type$int$, for type$long int$see$scalbln()$. + + + +scalbln() Functions *crv-scalbln* *crv-scalblnf* *crv-scalblnl* +------------------- +Synopsis~ + $#include <math.h>$ + $double scalbln(double x, long int n);$ + $float scalblnf(float x, long int n);$ + $long double scalblnl(long double x, long int n);$ + +Return~ +x*FLT_RADIX^n + +Description~ +These functions compute x * FLT_RADIX^n efficiently (commonly FLT_RADIX is 2). +n is of type$long int$, for type$int$see$scalbn()$. + + + +------------------------------------------------------------------------------ +II.12.7 Power & Absolute *crv-libMHPower* + + +cbrt() Functions *crv-cbrt* *crv-cbrtf* *crv-cbrtl* +---------------- +Synopsis~ + $#include <math.h>$ + $double cbrt(double x);$ + $float cbrtf(float x);$ + $long double cbrtl(long double x);$ + +Return~ +cube root of x + +Description~ +These functions return the cube root of x. They cannot fail; every +representable real value has a representable real cube root. + + + +fabs() Functions *crv-fabs* *crv-fabsf* *crv-fabsl* +---------------- +Synopsis~ + $#include <math.h>$ + $double fabs(double x);$ + $float fabsf(float x);$ + $long double fabsl(long double x);$ + +Return~ +absolute of x + +Description~ +This function returns the absolute value of the floating-point number x. + + +hypot() Functions *crv-hypot* *crv-hypotf* *crv-hypotl* +----------------- +Synopsis~ + $#include <math.h>$ + $double hypot(double x, double y);$ + $float hypotf(float x, float y);$ + $long double hypotl(long double x, long double y);$ + +Return~ +sqrt(x*x + y*y) + +Description~ +These functions return sqrt(x*x + y*y). +Normally this function is faster and more accurate than the direct formula. + + + +pow() Functions *crv-pow* *crv-powf* *crv-powl* +--------------- +Synopsis~ + $#include <math.h>$ + $double pow(double x, double y);$ + $float powf(float x, float y);$ + $long double powl(long double x, long double y);$ + +Return~ +x^y + +Description~ +These are general exponentiation functions, returning base raised to power +(x^y). + +Mathematically,$pow()$would return a complex number when base is negative and +power is not an integral value.$pow$can't do that, so instead it signals a +domain error.$pow$may also underflow or overflow the destination type. + + + +sqrt() Functions *crv-sqrt* *crv-sqrtf* *crv-sqrtl* +---------------- +Synopsis~ + $#include <math.h>$ + $double sqrt(double x);$ + $float sqrtf(float x);$ + $long double sqrtl(long double x);$ + +Return~ +sqrt(x) + +Description~ +These functions return the nonnegative square root of x. +If x is negative,$sqrt()$signals a domain error. Mathematically, it should +return a complex number. + + + + +------------------------------------------------------------------------------ +II.12.8 Error & Gamma *crv-libMHErrGam* + + +erf() Functions *crv-erf* *crv-erff* *crv-erfl* +--------------- +Synopsis~ + $#include <math.h>$ + $double erf(double x);$ + $float erff(float x);$ + $long double erfl(long double x);$ + +Return~ +error function of x + +Description~ +$erf()$returns the error function of x. The error function is defined as + erf(x) = 2/sqrt(pi) * integral from 0 to x of exp(-t^2) dt + + +erfc() Functions *crv-erfc* *crv-erfcf* *crv-erfcl* +---------------- +Synopsis~ + $#include <math.h>$ + $double erf(double x);$ + $float erff(float x);$ + $long double erfl(long double x);$ + +Return~ +1 - error function of x + +Description~ +$erfc()$returns 1.0 -$erf(x)$, but computed in a fashion that avoids +round-off error when x is large. + + +lgamma() Functions *crv-lgamma* *crv-lgammaf* *crv-lgammal* +------------------ +Synopsis~ + $#include <math.h>$ + $double lgamma(double x);$ + $float lgammaf(float x);$ + $long double lgammal(long double x);$ + +Return~ +see description + +Description~ +$lgamma()$returns the natural logarithm of the absolute value of the gamma +function of x. The gamma function is defined as + + gamma(x) = integral from 0 to ∞ of t^(x-1) e^-t dt + + *crv-signgam* +The sign of the gamma function is stored in the global variable$signgam$, +which is declared in$<math.h>$. It is 1 if the intermediate result was +positive or zero, or -1 if it was negative. + +To compute the real gamma function $tgamma()$can be used or the values as +can be computed as follows: + + lgam = lgamma(x); + gam = signgam*exp(lgam); + + +The gamma function has singularities at the non-positive integers.$lgamma()$ +will raise the zero divide exception if evaluated at a singularity. + + + +tgamma() Functions *crv-tgamma* *crv-tgammaf* *crv-tgammal* +------------------ +Synopsis~ + $#include <math.h>$ + $double tgamma(double x);$ + $float tgammaf(float x);$ + $long double tgammal(long double x);$ + +Return~ +see description + +Description~ +$tgamma()$applies the gamma function to x. The gamma function is defined as + gamma (x) = integral from 0 to ∞ of t^(x-1) e^-t dt + + + + +------------------------------------------------------------------------------ +II.12.9 Nearest Integer *crv-libMHNear* + + +ceil() Functions *crv-ceil* *crv-ceilf* *crv-ceill* +---------------- +Synopsis~ + $#include <math.h>$ + $double ceil(double x);$ + $float ceilf(float x);$ + $long double ceill(long double x);$ + +Return~ +x rounded upwards + +Description~ +These functions round x upwards to the nearest integer, returning that value +as a double. Thus, ceil(1.5)$ is 2.0. + + + +floor() Functions *crv-floor* *crv-floorf* *crv-floorl* +----------------- +Synopsis~ + $#include <math.h>$ + $double floor(double x);$ + $float floorf(float x);$ + $long double floorl(long double x);$ + +Return~ +x rounded downwards + +Description~ +These functions round x downwards to the nearest integer, returning that value +as a double. Thus,$floor(1.5)$is 1.0 and$floor(-1.5)$is -2.0. + + + +trunc() Functions *crv-trunc* *crv-truncf* *crv-truncl* +----------------- +Synopsis~ + $#include <math.h>$ + $double trunc(double x);$ + $float truncf(float x);$ + $long double truncl(long double x);$ + +Return~ +x rounded towards zero + +Description~ +These functions round x towards zero to the nearest integer (returned in +floating-point format). Thus,$trunc(1.5)$is 1.0 and$trunc(-1.5)$is -1.0. + + + +rint() Functions *crv-rint* *crv-rintf* *crv-rintl* +---------------- +Synopsis~ + $#include <math.h>$ + $double rint(double x);$ + $float rintf(float x);$ + $long double rintl(long double x);$ + +Return~ +x rounded according to rounding mode + +Description~ +These functions round x to an integer value according to the current rounding +mode (for modes see "II.6.3 Rounding" |crv-libFHRounding|). The default +rounding mode is to round to the nearest integer. +If x was not initially an integer, these functions raise the inexact +exception. + + + *crv-nearbyint* +nearbyint() Functions *crv-nearbyintf* *crv-nearbyintl* +--------------------- +Synopsis~ + $#include <math.h>$ + $double nearbyint(double x);$ + $float nearbyintf(float x);$ + $long double nearbyintl(long double x);$ + +Return~ +x rounded according to rounding mode + +Description~ +These functions return the same value as the$rint()$functions, but do not +raise the inexact exception if x is not an integer. + + + +round() Functions *crv-round* *crv-roundf* *crv-roundl* +----------------- +Synopsis~ + $#include <math.h>$ + $double round(double x);$ + $float roundf(float x);$ + $long double roundl(long double x);$ + +Return~ +see description + +Description~ +These functions are similar to$rint()$, but they round halfway cases away from +zero instead of to the nearest even integer. + + + +lrint() Functions *crv-lrint* *crv-lrintf* *crv-lrintl* +----------------- +Synopsis~ + $#include <math.h>$ + $long int lrint(double x);$ + $long int lrintf(float x);$ + $long int lrintl(long double x);$ + +Return~ +x rounded according to rounding mode + +Description~ +These functions are just like$rint()$, but they return a$long int$instead of +a floating-point number. + + + +llrint() Functions *crv-llrint* *crv-llrintf* *crv-llrintl* +------------------ +Synopsis~ + $#include <math.h>$ + $long long int llrint(double x);$ + $long long int llrintf(float x);$ + $long long int llrintl(long double x);$ + +Return~ +x rounded according to rounding mode + +Description~ +These functions are just like$rint()$, but they return a$long long int$instead +of a floating-point number. + + + +lround() Functions *crv-lround* *crv-lroundf* *crv-lroundl* +------------------ +Synopsis~ + $#include <math.h>$ + $long int lround(double x);$ + $long int lroundf(float x);$ + $long int lroundl(long double x);$ + +Return~ +x rounded + +Description~ +These functions are just like$round()$, but they return a$long int$instead of +a floating-point number. + + + +llround() Functions *crv-llround* *crv-llroundf* *crv-llroundl* +------------------- +Synopsis~ + $#include <math.h>$ + $long long int llround(double x);$ + $long long int llroundf(float x);$ + $long long int llroundl(long double x);$ + +Return~ +x rounded + +Description~ +These functions are just like$round()$, but they return a$long long int$ +instead of a floating-point number. + + + +------------------------------------------------------------------------------ +II.12.10 Remainder *crv-libMHRem* + + +fmod() Functions *crv-fmod* *crv-fmodf* *crv-fmodl* +---------------- +Synopsis~ + $#include <math.h>$ + $double fmod(double x, double y);$ + $float fmodf(float x, float y);$ + $long double fmodl(long double x, long double y);$ + +Return~ +see description + +Description~ +These functions compute the remainder from the division of x by. Specifically, +the return value is x - n*y, where n is the quotient of x divided by y, +rounded towards zero to an integer. Thus,$fmod(6.5, 2.3)$ returns 1.9, which +is 6.5 minus 4.6. +The result has the same sign as x and has magnitude less than the magnitude +of y. +If y is zero,$fmod()$signals a domain error. + + + *crv-remainder* +remainder() Functions *crv-remainderf* *crv-remainderl* +--------------------- +Synopsis~ + $#include <math.h>$ + $double remainder(double x, double y);$ + $float remainderf(float x, float y);$ + $long double remainderl(long double x, long double y);$ + +Return~ +see description + +Description~ +These functions are like$fmod()$except that they rounds the internal quotient +n to the nearest integer instead of towards zero to an integer. +For example,$remainder(6.5, 2.3)$returns -0.4, which is 6.5 minus 6.9. + +The absolute value of the result is less than or equal to half the absolute +value of y. The difference between$fmod(x, y)$and$remainder(x, y)$is always +either y, -y, or zero. +If denominator is zero,$remainder()$signals a domain error. + + + +remquo() Functions *crv-remquo* *crv-remquof* *crv-remquol* +------------------ +Synopsis~ + $#include <math.h>$ + $double remquo(double x, double y, int *quo);$ + $float remquof(float x, float y, int *quo);$ + $long double remquol(long double x, long double y, int *quo);$ + +Return~ +see description + +Description~ +These functions compute the same remainder as the$remainder()$functions. +In *quo they store a value whose sign is the singe of x/y and whose +magnitude is congruent modulo 2^n to the magnitude of the integral quotient +of x/y, where n is an implementation-defined integer greater or equal to 3. + + + +------------------------------------------------------------------------------ +II.12.11 Manipulating *crv-libMHMani* + + + *crv-copysign* +copysign() Functions *crv-copysignf* *crv-copysignl* +-------------------- +Synopsis~ + $#include <math.h>$ + $double copysign(double x, double y);$ + $float copysignf(float x, float y);$ + $long double copysignl(long double x, long double y);$ + +Return~ +x with sign of y + +Description~ +These functions return x but with the sign of y. They work even if x or y are +NaN or zero. Both of these can carry a sign (although not all implementations +support it). +$copysign()$never raises an exception. + + + +signbit() Macro *crv-signbit* +--------------- +Synopsis~ + $#include <math.h>$ + $int signbit(float-type x);$ + +Return~ +0: x has no negative sign +else x has negative sign + +Description~ +This is a generic macro which works on all floating-point types. +This macro returns a nonzero value if x is negative. +This is not the same as x < 0.0, because IEEE 754 floating point allows zero +to be signed. The comparison -0.0 < 0.0 is false, but$signbit(-0.0)$ will +return a nonzero value. + + + *crv-nextafter* +nextafter() Functions *crv-nextafterf* *crv-nextafterl* +--------------------- +Synopsis~ + $#include <math.h>$ + $double nextafter(double x, double y);$ + $float nextafterf(float x, float y);$ + $long double nextafetl(long double x, long double y);$ + +Return~ +see description + +Description~ +These functions return the next representable neighbor of x in the direction +towards y. The size of the step between x and the result depends on the type +of the result. If x = y the function simply returns y. If either value is +NaN, NaN is returned. Otherwise a value corresponding to the value of the +least significant bit in the mantissa is added or subtracted, depending on +the direction. +$nextafter()$will signal overflow or underflow if the result goes outside of +the range of normalized numbers. + + + *crv-nexttoward* +nexttoward() Functions *crv-nexttowardf* *crv-nexttowardl* +---------------------- +Synopsis~ + $#include <math.h>$ + $double nexttoward(double x, long double y);$ + $float nexttowardf(float x, long double y);$ + $long double nexttowardl(long double x, long double y);$ + +Return~ +see description + +Description~ +These functions are identical to the corresponding versions of$nextafter()$ +except that their second argument is a long double. + + + +nan() Functions *crv-nan* *crv-nanf* *crv-nanl* +--------------- +Synopsis~ + $#include <math.h>$ + $double nan(const char *tagp);$ + $float nanf(const char *tagp);$ + $long double nanl(const char *tagp);$ + +Return~ +NaN + +Description~ +These functions return a representation of NaN, provided that NaN is supported +by the target platform.$nan("n-char-sequence")$is equivalent to +$strtod("NAN(n-char-sequence)")$. + +The argument tagp is used in an unspecified manner. On IEEE 754 systems, there +are many representations of NaN, and tagp selects one. On other systems it may +do nothing. + + + + +------------------------------------------------------------------------------ +II.12.12 Miscellaneous *crv-libMHMisc* + + +fdim() Functions *crv-fdim* *crv-fdimf* *crv-fdiml* +---------------- +Synopsis~ + $#include <math.h>$ + $double fdim(double x, double y);$ + $float fdimf(float x, float y);$ + $long double fdiml(long double x, long double y);$ + +Return~ +positive difference + +Description~ +These functions return the positive difference between x and y. The positive +difference is x - y if x is greater than y, and 0 otherwise. +If x, y, or both are NaN, NaN is returned. + + + +fmin() Functions *crv-fmin* *crv-fminf* *crv-fminl* +---------------- +Synopsis~ + $#include <math.h>$ + $double fmin(double x, double y);$ + $float fminf(float x, float y);$ + $long double fminl(long double x, long double y);$ + +Return~ +minimum of x and y + +Description~ +These functions return the lesser of the two values x and y. It is similar to +the expression ((x) < (y) ? (x) : (y)) except that x and y are only evaluated +once. +If an argument is NaN, the other argument is returned. If both arguments are +NaN, NaN is returned. + + + +fmax() Functions *crv-fmax* *crv-fmaxf* *crv-fmaxl* +---------------- +Synopsis~ + $#include <math.h>$ + $double fmax(double x, double y);$ + $float fmaxf(float x, float y);$ + $long double fmaxl(long double x, long double y);$ + +Return~ +maximum of x and y + +Description~ +These functions return the greater of the two values x and y. +If an argument is NaN, the other argument is returned. If both arguments are +NaN, NaN is returned. + + + +fma() Functions *crv-fma* *crv-fmaf* *crv-fmal* +---------------- +Synopsis~ + $#include <math.h>$ + $double fma(double x, double y, double z);$ + $float fmaf(float x, float y, float z);$ + $long double fmal(long double x, long double y, long double z);$ + +Return~ + +Description~ +These functions perform floating-point multiply-add. This is the operation +(x * y) + z, but the intermediate result is not rounded to the destination +type. This can sometimes improve the precision of a calculation. + +This function was introduced because some processors have a special +instruction to perform multiply-add. The C compiler cannot use it directly, +because the expression x*y + z is defined to round the intermediate result. +$fma()$lets you choose when you want to round only once. + + *crv-FP_FAST_FMA* + *crv-FP_FAST_FMAF* *crv-FP_FAST_FMAL* +On processors which do not implement multiply-add in hardware,$fma$can be +very slow since it must avoid intermediate rounding. +math.h defines the symbols$FP_FAST_FMA$,$FP_FAST_FMAF$, and$FP_FAST_FMAL$ when +the corresponding version of$fma()$is no slower than the expression x*y + z. + + + + +============================================================================== +II.13 <setjmp.h> Nonlocal Jumps *crv-libSetjmpH* + +This header file provides a function, a macro and a data type to perform +nonlocal exits. Typically this is used to do an intermediate return from a +nested function call. + +Quicklink: + $jmp_buf$ Type |crv-libjmp_buf| + $longjmp()$ Func |crv-liblongjmp| + $setjmp()$ Macro |crv-libsetjmp| + + + +jmp_buf Type *crv-jmp_buf* +------------ +Objects of type$jmp_buf$hold the state information to be restored by a +nonlocal exit. The contents of a$jmp_buf$identify a specific place to return +to. + + + +setjmp() Macro *crv-setjmp* +-------------- +Synopsis~ + $#include <setjmp.h>$ + $int setjmp(jmp_buf state);$ + +Return~ +0: if normally executed +!=0: value passed to$longjmp()$ + +Description~ +When called normally,$setjmp()$stores information about the execution state of +the program in$state$and returns zero. If$longjmp()$is later used to perform +a nonlocal exit to this state,$setjmp()$returns a nonzero value. + +Calls to$setjmp()$are safe in only the following contexts: + - As the test expression of a selection or iteration statement (such as$if,$ + $switch$, or$while$). + - As one operand of a equality or comparison operator that appears as the + test expression of a selection or iteration statement. The other operand + must be an integer constant expression. + - As the operand of a unary ! operator, that appears as the test expression + of a selection or iteration statement. + - By itself as an expression statement. + +Return points are valid only during the dynamic extent of the function that +called$setjmp()$to establish them. If returned via$longjmp()$to a return point +that was established in a function that has already returned, unpredictable +and disastrous things are likely to happen. + + + +longjmp() Function *crv-longjmp* +------------------ +Synopsis~ + $#include <setjmp.h>$ + $void longjmp(jmp_buf state, int value);$ + +Return~ +none + +Description~ +This function restores current execution to the state saved in$state$, and +continues execution from the call to$setjmp()$that established that return +point. Returning from$setjmp()$by means of$longjmp()$returns the value +argument that was passed to$longjmp()$, rather than 0. +(But if value is given as 0, setjmp returns 1). + + + +============================================================================== +II.14 <signal.h> Signal Handling *crv-libSignalH* + +This header file defines macros and declares functions for handling signals. + +Quicklink: + $rais()$ Func |crv-rais| + $sig_atomic_t$ Type |crv-sig_atomic_t| + $SIG_DFL$ Macro |crv-SIG_DFL| + $SIG_ERR$ Macro |crv-SIG_ERR| + $SIG_IGN$ Macro |crv-SIG_IGN| + $SIGABRT$ Macro |crv-SIGABRT| + $SIGFPE$ Macro |crv-SIGFPE| + $SIGILL$ Macro |crv-SIGILL| + $SIGINT$ Macro |crv-SIGINT| + $signal()$ Func |crv-signal| + $SIGSEGV$ Macro |crv-SIGSEGV| + $SIGTERM$ Macro |crv-SIGTERM| + + + +------------------------------------------------------------------------------ +II.14.1 Types *crv-libSHTyp* + +sig_atomic_t Type *crv-sig_atomic_t* +----------------- +This is an integer data type. Objects of this type are always accessed +atomically. Reading and writing this data type is guaranteed to happen in a +single instruction, so there's no way for a handler to run "in the middle" +of an access. +The type sig_atomic_t is always an integer data type, but which one it is, +and how many bits it contains, may vary from machine to machine. + + + +------------------------------------------------------------------------------ +II.14.2 Signals *crv-libSHSig* + +Valid signals are: + + Signal | Description + -----------+--------------------------------------------------- + $SIGABRT$ | abnormal termination (e.g. call of$abort()$) *crv-SIGABRT* + $SIGFPE$ | arithmetic error (e.g. division by zero, *crv-SIGFPE* + | overflow) + $SIGILL$ | illegal instruction *crv-SIGILL* + $SIGINT$ | interactive attention signal (e.g. interrupt) *crv-SIGINT* + $SIGSEGV$ | invalid access to storage *crv-SIGSEGV* + $SIGTERM$ | termination request sent to the program *crv-SIGTERM* + +Other signals my be specified by the compiler. + +It depends on the machine whether this signals are generated by the system +itself.$raise()$function can be used to send them. + + + +------------------------------------------------------------------------------ +II.14.3 Functions *crv-libSHFunc* + + +signal() Function *crv-signal* +----------------- +Synopsis~ + $#include <signal.h>$ + $void (*signal(int sig, void (*handler)(int)))(int);$ + +Return~ +- pointer to previous handler, if call was successful +-$SIG_ERR$, if call failed + +Description~ +This function chooses one of three ways in which receipt of the signal$sig$is +to be handled, these ways are: + *crv-SIG_DFL* *crv-SIG_IGN* + - If the value of$handler$is$SIG_DFL$, default handling for that signal + occurs. + - If the value of$handler$is$SIG_IGN$, the signal is ignored. + - If the value of$handler$points to a function, that function is called + with the argument of the type of signal. + +For valid signals see II.14.2 (|crv-libSHSig|). + *crv-SIG_ERR* +If the call to signal is successful, then it returns a pointer to the previous +signal handler for the specified signal type. If the call fails, then$SIG_ERR$ +is returned and$errno$is set to a positive value. + + + +rais() Function *crv-rais* +--------------- +Synopsis~ + $#include <signal.h>$ + $int raise(int signum);$ + +Return~ +0: signal sent successfully +else: failed + +Description~ +The raise function sends the signal$signum$to the calling process. +About the only reason for failure would be if the value of signum is invalid. + + + + +------------------------------------------------------------------------------ +II.15 <stdarg.h> Arguments *crv-libStdargH* + +This header files defines macros which allow to handle functions with an +unknown number of arguments. +See |crv-fuDefVarPara| for an example. + +Quicklink: + $va_arg()$ Macro |crv-libva_arg| + $va_copy()$ Macro |crv-libva_copy| + $va_end()$ Macro |crv-libva_end| + $va_list$ Type |crv-libva_list| + $va_start()$ Macro |crv-libva_start| + + +va_list Type *crv-va_list* +------------ +This type is used for argument pointer variables. + + +va_start() Macro *crv-va_start* +---------------- +Synopsis~ + $#include <signal.h>$ + $void va_start(va_list ap, last-required);$ + +Return~ +none + +Description~ +This macro initializes the argument pointer variable ap to point to the first +of the optional arguments of the current function; last-required must be the +last required argument to the function. + + + +va_arg() Macro *crv-va_arg* +-------------- +Synopsis~ + $#include <signal.h>$ + $type va_arg(va_list ap, type);$ + +Return~ +value of next argument + +Description~ +This macro returns the value of the next optional argument, and modifies the +value of ap to point to the subsequent argument. Thus, successive uses of +$va_arg()$return successive optional arguments. + +The type of the value returned by$va_arg()$is$type$as specified in the call. + + + +va_end() Macro *crv-va_end* +-------------- +Synopsis~ + $#include <signal.h>$ + $void va_end(va_list ap);$ + +Return~ +none + +Description~ +This ends the use of ap. After a$va_end()$call, further$va_arg()$calls with +the same ap may not work.$va_end()$should be invoked before returning from the +function in which$va_start()$was invoked with the same ap argument. + + + +va_copy() Macro *crv-va_copy* +--------------- +Synopsis~ + $#include <signal.h>$ + $void va_copy (va_list dest, va_list src);$ + +Return~ +none + +Description~ +The$va_copy()$macro allows copying of objects of type$va_list$even if this is +not an integral type. +The copies can be used to parse the list of parameters more than once. + + + + +============================================================================== +II.16 <stdbool.h> Boolean Type *crv-libStdboolH* + + +bool Macro *crv-bool* +---------- +expands to$_Bool$ + + +true Macro *crv-true* +---------- +expands to integer constant 1 + + +false Macro *crv-false* +----------- +expands to integer constant 0 + + +__bool_true_false_are_defined Macro *crv-__bool_true_false_are_defined* +----------------------------------- +expands to integer constant 1 + + + + +============================================================================== +II.17 <stddef.h> Definitions *crv-libStddefH* + +This header file defines some macros and types (some of them are also defined +in other header files). + +Quicklink: + $prtdiff_t$ Type |crv-prtdiff_t| + $size_t$ Type |crv-size_t| + $wchar_t$ Type |crv-wchar_t| + $NULL$ Macro |crv-NULL| + $offsetof()$ Macro |crv-offsetof| + + +prtdiff_t Type *crv-prtdiff_t* +-------------- +This is the signed integer type of the result of subtracting two pointers. +For example, with the declaration$char *p1, *p2;$, the expression$p2 - p1$is +of type$ptrdiff_t$. + + +size_t Type *crv-size_t* +----------- +This is an unsigned integer type used to represent the sizes of objects. +Also declared in$<stdlib.h>$, see |crv-size_t2|. +Also declared in$<string.h>$, see |crv-size_t3|. +Also declared in$<time.h>$, see |crv-size_t4|. +Also declared in$<stdio.h>$, see |crv-size_t5|; +Also declared in$<wchar.h>$, see |crv-size_t6|. + + +wchar_t Type *crv-wchar_t* +------------ +This data type is used as the base type for wide character strings. +It's range of values can represent distinct codes for all members of the +largest extended character set specified among the supported locales. +Also declared in$<stdlib.h>$, see |crv-libwchar_t2|. +Also declared in$<wchar.h>$, see |crv-libwchar_t3|. + + +NULL Macro *crv-NULL* +---------- +Expands to an implementation-defined null pointer constant. +Also defined in$<stdlib.h>$, see |crv-NULL2|. +Also defined in$<string.h>$, see |crv-NULL3|. +Also defined in$<time.h>$, see |crv-NULL4|. +Also defined in$<stdio.h>$, see |crv-NULL5|. +Also defined in$<wchar.h>$, see |crv-NULL6|. + + + +offsetof() Macro *crv-offsetof* +---------------- +Synopsis~ + $#include <stddef.h>$ + $size_t offsetof (type, member);$ + +Return~ +offset of$member$in structure$type$ + +Description~ +This expands to an integer constant expression that is the offset of the +structure member named$member$in the structure type$type$. + + + +============================================================================== +II.18 <stdint.h> Integer Type *crv-libStdintH* + +This header file declares a set of integer types having specified widths and +defines a set of macros to handle them. + +Types are defined in the following categories: + - integer types with a certain exact width + - integer types having at least a certain width + - fastest integer types having at least a certain width + - integer types wide enough to hold pointers + - integer types having greatest width + + +------------------------------------------------------------------------------ +II.18.1 Integer Types *crv-libSdHType* + +II.18.1.1 Exact-Width *crv-libSdHTExact* +---------------------- +There are integer types representing exactly N bits. The general form is: +intN_t (signed width N bits width) +uintN_t (unsigned width N bits width) + +Common types are: + $int8_t$ $uint8_t$ *crv-int8_t* *crv-uint8_t* + $int16_t$ $uint16_t$ *crv-int16_t* *crv-uint16_t* + $int32_t$ $uint32_t$ *crv-int32_t* *crv-uint32_t* + $int64_t$ $uint64_t$ *crv-int64_t* *crv-uint64_t* +These types are optional. The compiler is free to declare others (e.g. +$int24_t$). + + +II.18.1.2 Minimum-Width *crv-libSdHTMin* +----------------------- +There are integer types with at least N bits width. The general form is: +int_leastN_t (signed with at least N bits width) +uint_leastN_t (unsigned with at least N bits width) + +Common types are: + $int_least8_t$ $uint_least8_t$ *crv-int_least8_t* + *crv-uint_least8_t* + $int_least16_t$ $uint_least16_t$ *crv-int_least16_t* + *crv-uint_least16_t* + $int_least32_t$ $uint_least32_t$ *crv-int_least32_t* + *crv-uint_least32_t* + $int_least64_t$ $uint_least64_t$ *crv-int_least64_t* + *crv-uint_least64_t* + +These types are required. Others may be declared by the compiler. + + +II.18.1.3 Fastest Minimum-Width *crv-libSdHTFast* +------------------------------- +These integer types allow the fastest access while having at least N bits. +The general form is: +int_fastN_t (fast signed with at least N bits width) +uint_fastN_t (fast unsigned with at least N bits width) + +Common types are: + $int_fast8_t$ $uint_fast8_t$ *crv-int_fast8_t* + *crv-uint_fast8_t* + $int_fast16_t$ $uint_fast16_t$ *crv-int_fast16_t* + *crv-uint_fast16_t* + $int_fast32_t$ $uint_fast32_t$ *crv-int_fast32_t* + *crv-uint_fast32_t* + $int_fast64_t$ $uint_fast64_t$ *crv-int_fast64_t* + *crv-uint_fast64_t* + +These types are required. Others may be declared by the compiler. + + +II.18.1.4 Greatest-Width *crv-libSdHTGreat* +------------------------ +These integer types have the widest range possible on the platform on which +they are being used. + $intmax_t$ (signed) *crv-intmax_t* + $uintmax_t$ (unsigned) *crv-uintmax_t* +These types are required. + + +II.18.1.5 Hold Pointer *crv-libSdHTPtr* +---------------------- +These integer types are wide enough to store a pointer of type$void$. + $intptr_t$ (signed) *crv-intptr_t* + $uintptr_t$ (unsigned) *crv-uintptr_t* + +These types are optional. + + + +------------------------------------------------------------------------------ +II.18.2 Limits *crv-libSdHTLim* + *crv-__STDC_LIMIT_MACROS* +The following macros specify the minimum and maximum of the types declared +in$<stdint.h>$. They are defined only if$__STDC_LIMIT_MACROS$is defined before +including$<stdint.h>$. + +II.18.2.1 Exact-Width *crv-libSdHLExact* +--------------------- +Signed integer minimum: + INTN_MIN, N is the number of bits + Value: -2^(N-1) + Common macros: + $INT8_MIN$ *crv-INT8_MIN* + $INT16_MIN$ *crv-INT16_MIN* + $INT32_MIN$ *crv-INT32_MIN* + $INT64_MIN$ *crv-INT64_MIN* + +Signed integer maximum: + INTN_MAX, N is the number of bits + Value: 2^(N-1) - 1 + Common macros: + $INT8_MAX$ *crv-INT8_MAX* + $INT16_MAX$ *crv-INT16_MAX* + $INT32_MAX$ *crv-INT32_MAX* + $INT64_MAX$ *crv-INT64_MAX* + +Unsigned integer minimum: + is always 0 + +Unsigned integer maximum: + UINTN_MAX, N is the number of bits + Value: 2^N - 1 + Common macros: + $UINT8_MAX$ *crv-UINT8_MAX* + $UINT16_MAX$ *crv-UINT16_MAX* + $UINT32_MAX$ *crv-UINT32_MAX* + $UINT64_MAX$ *crv-UINT64_MAX* + + + +II.18.2.2 Minimum-Width *crv-libSdHLMin* +----------------------- +Signed integer minimum: + INT_LEASTN_MIN, N is the number of bits + Value: <= -2^(N-1) + Common macros: + $INT_LEAST8_MIN$ *crv-INT_LEAST8_MIN* + $INT_LEAST16_MIN$ *crv-INT_LEAST16_MIN* + $INT_LEAST32_MIN$ *crv-INT_LEAST32_MIN* + $INT_LEAST64_MIN$ *crv-INT_LEAST64_MIN* + +Signed integer maximum: + INT_LEASTN_MAX, N is the number of bits + Value: >= 2^(N-1) - 1 + Common macros: + $INT_LEAST8_MAX$ *crv-INT_LEAST8_MAX* + $INT_LEAST16_MAX$ *crv-INT_LEAST16_MAX* + $INT_LEAST32_MAX$ *crv-INT_LEAST32_MAX* + $INT_LEAST64_MAX$ *crv-INT_LEAST64_MAX* + +Unsigned integer minimum: + is always 0 + +Unsigned integer maximum: + UINT_LEASTN_MAX, N is the number of bits + Value: >= 2^N - 1 + Common macros: + $UINT_LEAST8_MAX$ *crv-UINT_LEAST8_MAX* + $UINT_LEAST16_MAX$ *crv-UINT_LEAST16_MAX* + $UINT_LEAST32_MAX$ *crv-UINT_LEAST32_MAX* + $UINT_LEAST64_MAX$ *crv-UINT_LEAST64_MAX* + + + +II.18.2.3 Fastest Minimum-Width *crv-libSdHLFast* +------------------------------- +Signed integer minimum: + INT_FASTN_MIN, N is the number of bits + Value: <= -2^(N-1) + Common macros: + $INT_FAST8_MIN$ *crv-INT_FAST8_MIN* + $INT_FAST16_MIN$ *crv-INT_FAST16_MIN* + $INT_FAST32_MIN$ *crv-INT_FAST32_MIN* + $INT_FAST64_MIN$ *crv-INT_FAST64_MIN* + +Signed integer maximum: + INT_FASTN_MAX, N is the number of bits + Value: >= 2^(N-1) - 1 + Common macros: + $INT_FAST8_MAX$ *crv-INT_FAST8_MAX* + $INT_FAST16_MAX$ *crv-INT_FAST16_MAX* + $INT_FAST32_MAX$ *crv-INT_FAST32_MAX* + $INT_FAST64_MAX$ *crv-INT_FAST64_MAX* + +Unsigned integer minimum: + is always 0 + +Unsigned integer maximum: + UINT_FASTN_MAX, N is the number of bits + Value: >= 2^N - 1 + Common macros: + $UINT_FAST8_MAX$ *crv-UINT_FAST8_MAX* + $UINT_FAST16_MAX$ *crv-UINT_FAST16_MAX* + $UINT_FAST32_MAX$ *crv-UINT_FAST32_MAX* + $UINT_FAST64_MAX$ *crv-UINT_FAST64_MAX* + + + +II.18.2.4 Greatest-Width *crv-libSdHLGreat* +------------------------ +Minimum value of greatest-width signed integer type: +$ INTMAX_MIN$ <= -(2^63) *crv-INTMAX_MIN* + +Maximum value of greatest-width signed integer type: +$ INTMAX_MAX$ >= 2^63 - 1 *crv-INTMAX_MAX* + +Minimum value of greatest-width unsigned integer type: + 0 +Maximum value of greatest-width unsigned integer type: +$ UINTMAX_MAX$ >= 2^64 - 1 *crv-UINTMAX_MAX* + + + +II.18.2.5 Hold Pointer *crv-libSdHLPtr* +---------------------- +Minimum value of pointer holding signed integer type: + $INTPTR_MIN$ <= -(2^15) *crv-INTPTR_MIN* + +Maximum value of pointer holding signed integer type: + $INTPTR_MAX$ >= 2^15 - 1 *crv-INTPTR_MAX* + +Minimum value of pointer holding unsigned integer type: + 0 + +Maximum value of pointer holding unsigned integer type: + $UINTPTR_MAX$ >= 2^16 - 1 *crv-UINTPTR_MAX* + + + +II.18.2.6 Others *crv-libSdHLOther* +---------------- +Limits of$ptrdiff_t$: + $PTRDIFF_MIN$ *crv-PTRDIFF_MIN* + $PTRDIFF_MAX$ *crv-PTRDIFF_MAX* + +Limits of$sig_atomic_t$: + $SIG_ATOMIC_MIN$ *crv-SIG_ATOMIC_MIN* + $SIG_ATOMIC_MAX$ *crv-SIG_ATOMIC_MAX* + +Limits of$size_t$: + $SIZE_MAX$ *crv-SIZE_MAX* + +Limits of$wchar_t$: + $WCHAR_MIN$ *crv-WCHAR_MIN* + $WCHAR_MAX$ *crv-WCHAR_MAX* + Also defined in$<wctype.h>$, see |crv-libWCHAR_MIN2|, |crv-libWCHAR_MAX2|. + +Limits of$wint_t$: + $WINT_MIN$ *crv-WINT_MIN* + $WINT_MAX$ *crv-WINT_MAX* + + + +----------------------------------------------------------------------------- +II.18.3 Macros *crv-libSdHMac* + + +INTMAX_C() Macro *crv-INTMAX_C* +---------------- +Synopsis~ + $#include <stdint.h>$ + $INTMAX_C(val);$ + +Description~ +expands to an integer constant value$val$of type$intmax_t$ + + +UINTMAX_C() Macro *crv-UINTMAX_C* +----------------- +Synopsis~ + $#include <stdint.h>$ + $UINTMAX_C(val);$ + +Description~ +expands to an integer constant value$val$of type$uintmax_t$ + + + *crv-INT8_C* *crv-INT16_C* +INTN_C() Macro *crv-INT32_C* *crv-INT64_C* +-------------- +Synopsis~ + $#include <stdint.h>$ + $INT8_C(val);$ + $INT16_C(val);$ + $INT32_C(val);$ + $INT64_C(val);$ + +Description~ +expands to an integer constant value$val$of type$int_leastN_t$(N number of +bits) + + + *crv-UINT8_C* *crv-UINT16_C* +UINTN_C() Macro *crv-UINT32_C* *crv-UINT64_C* +--------------- +Synopsis~ + $#include <stdint.h>$ + $UINT8_C(val);$ + $UINT16_C(val);$ + $UINT32_C(val);$ + $UINT64_C(val);$ + +Description~ +expands to an integer constant value$val$of type$uint_leastN_t$(N number of +bits) + + + + +============================================================================== +II.19 <stdio.h> Input/Output *crv-libStdioH* + +This header file declares types, macros and functions to perform input/output +operations. + + +------------------------------------------------------------------------------ +II.19.1 Types *crv-libSIOHType* + +Quicklink: + $size_t$ Type |crv-size_t5| + $FILE$ Type |crv-FILE| + $fpos_t$ Type |crv-fpos_t| + + +size_t Type *crv-size_t5* +----------- +This is an unsigned integer type used to represent the sizes of objects. +Also declared in$<stddef.h>$, see |crv-size_t|. +Also declared in$<string.h>$, see |crv-size_t2|. +Also declared in$<stdlib.h>$, see |crv-size_t3|. +Also declared in$<time.h>$, see |crv-size_t4|. +Also declared in$<wchar.h>$, see |crv-size_t6|. + + +FILE Type *crv-FILE* +--------- +This is the data type used to represent stream objects. A FILE object holds +all of the internal state information about the connection to the associated +file. + + +fpos_t Type *crv-fpos_t* +----------- +This is the type of an object that can encode information about the file +position of a stream. + + + + +------------------------------------------------------------------------------ +II.19.2 Macros *crv-libSIOHMac* + +Quicklink: + $_IOFBF$ Macro |crv-_IOFBF| + $_IOLBF$ Macro |crv-_IOLBF| + $_IONBF$ Macro |crv-_IONBF| + $BUFSIZ$ Macro |crv-BUFSIZ| + $BUFSIZ$ Macro |crv-BUFSIZ| + $FOPEN_MAX$ Macro |crv-FOPEN_MAX| + $FILENAME_MAX$ Macro |crv-FILENAME_MAX| + $L_tmpnam$ Macro |crv-L_tmpnam| + $NULL$ Macro |crv-NULL5| + $SEEK_SET$ Macro |crv-SEEK_SET| + $SEEK_CUR$ Macro |crv-SEEK_CUR| + $SEEK_END$ Macro |crv-SEEK_END| + $stderr$ Macro |crv-stderr| + $stdin$ Macro |crv-stdin| + $stdout$ Macro |crv-stdout| + + + +NULL Macro *crv-NULL5* +---------- +Expands to an implementation-defined null pointer constant. +Also defined in$<stddef.h>$, see |crv-libNULL|. +Also defined in$<stdlib.h>$, see |crv-libNULL2|. +Also defined in$<string.h>$, see |crv-libNULL3|. +Also defined in$<time.h>$, see |crv-libNULL4|. +Also defined in$<wchar.h>$, see |crv-libNULL6|. + + + +_IOFBF Macro *crv-_IOFBF* +_IOLBF Macro *crv-_IOLBF* +_IONBF Macro *crv-_IONBF* +------------ +This macros expand to an constant integer expression that can be used as the +mode argument to the$setvbuf()$function. + + $_IOFBF$ specifies that the stream should be fully buffered + $_IOLBF$ specifies that the stream should be line buffered + $_IONBF$ specifies that the stream should be unbuffered + + + +BUFSIZ Macro *crv-BUFSIZ* +------------ +The value of this macro is an integer constant expression that is good to use +for the size argument to$setvbuf()$. This value is guaranteed to be at least +256. + + + +EOF Macro *crv-EOF* +--------- +This is returned by a number of narrow stream functions to indicate an +end-of-file condition, or some other error situation. + + + +FOPEN_MAX Macro *crv-FOPEN_MAX* +--------------- +The value of this macro is an integer constant expression that represents the +minimum number of streams that the implementation guarantees can be open +simultaneously. + + + +FILENAME_MAX Macro *crv-FILENAME_MAX* +------------------ +The value of this macro is an integer constant expression that represents +the maximum length of a file name string. + + + +L_tmpnam Macro *crv-L_tmpnam* +-------------- +The value of this macro is an integer constant expression that represents the +minimum size of a string large enough to hold a file name generated by the +$tmpnam()$function. + + + + +SEEK_SET Macro *crv-SEEK_SET* +SEEK_CUR Macro *crv-SEEK_CUR* +SEEK_END Macro *crv-SEEK_END* +-------------- +These are integer constants which are used as the whence argument to the +fseek() or fseeko() functions. + + $SEEK_SET$ specifies that the offset provided is relative to the beginning + of the file + $SEEK_CUR$ specifies that the offset provided is relative to the current + file position + $SEEK_END$ specifies that the offset provided is relative to the end of the + file + + +TMP_MAX Macro *crv-TMP_MAX* +------------- +This is the maximum number of unique filenames that the function$tmpnam()$can +generate. + + + +stderr Macro *crv-stderr* +stdin Macro *crv-stdin* +stdout Macro *crv-stdout* +------------ +These macros expand to pointers to$FILE$types which correspond to the standard +error, standard input and standard output streams. These streams are text +streams. + +The standard input stream is the normal source of input for the program. +The standard output stream is the normal source of output from the program. +The standard error stream is used for error messages and diagnostics issued +by the program. + + + +------------------------------------------------------------------------------ +II.19.3 Streams and Files *crv-libSIOHStrmFile* + +Streams provide a higher-level interface between program and input/output +device. There are two types of streams: text and binary streams. + +Text and binary streams differ in several ways: + + - The data read from a text stream is divided into lines which are + terminated by newline ('\n') characters, while a binary stream is simply a + long series of characters. + A text stream might on some systems fail to handle lines more than 254 + characters long (including the terminating newline character). + + - On some systems, text files can contain only printing characters, + horizontal tab characters, and newlines, and so text streams may not + support other characters. However, binary streams can handle any character + value. + + - Space characters that are written immediately preceding a newline + character in a text stream may disappear when the file is read in again. + + - More generally, there need not be a one-to-one mapping between characters + that are read from or written to a text stream, and the characters in the + actual file. + +Binary streams transfers data without changing (1:1 copy). + +On some systems text and binary streams use different file formats, the only +way to read or write "an ordinary file of text" that can work with other +text-oriented programs is through a text stream. + +At startup of a program there are three text streams available: standard +input, standard output and standard error. See |crv-libstdout| for further +information. + + +Files are associated with streams. A file must be opened to be used. One of +the attributes of an open file is its file position that keeps track of where +in the file the next character is to be read or written. +The file position is normally set to the beginning of the file when it is +opened, and each time a character is read or written, the file position is +incremented, so access to the file is normally sequential. + +Ordinary files permit read or write operations at any position within the +file. Some other kinds of files may also permit this. Files which do permit +this are sometimes referred to as random-access files. The file position +can be changed using the$fseek()$function on a stream. + +Streams that are opened for append access are treated specially for output: +output to such files is always appended sequentially to the end of the +file, regardless of the file position. However, the file position is still +used to control where in the file reading is done. + +Each opening of a file creates a separate file position. Thus, if a file is +opened twice - even in the same program - two streams with independent +file positions are generated. + + +An open file must be closed,$fclose()$can be used to do that. If$main()$ +returns or$exit()$is called, all opened files are closed automatically. +Other path to program termination (e.g.$abort()$) do not need to close +files (dependes on compiler). + + + +------------------------------------------------------------------------------ +II.19.4 File Operations *crv-libSIOHFOp* + + +remove() Function *crv-remove* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int remove(const char *file_name);$ + +Return~ +0: successful +nonzero: failed + +Description~ +Remove the file (unlink it) with name$*file$points to. Any subsequent attempt +to open it again will fail. If the file is currently open, then the result is +implementation-defined. + + + +rename() Function *crv-rename* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int rename(const char *oldname, const char *newname);$ + +Return~ +0: successful +else: failed + +Description~ +This function renames the file$oldname$to$newname$. The file formerly +accessible under the name$oldname$is afterwards accessible as$newname$instead. +If the new file exists before renaming, then the result is +implementation-defined. + + + +tmpfile() Function *crv-tmpfile* +------------------ +Synopsis~ + $#include <stdio.h>$ + $FILE *tmpfile(void);$ + +Return~ +NULL: failed +else: pointer to stream of the created file + +Description~ +This function creates a temporary binary file for update mode, as if by +calling$fopen()$with mode "wb+". The file is deleted automatically when it is +closed or when the program terminates. + + + +tmpnam() Function *crv-tmpnam* +----------------- +Synopsis~ + $#include <stdio.h>$ + $char *tmpnam(char *result);$ + +Return~ +NULL: failed +else: pointer to name of file + +Description~ +This function constructs and returns a valid file name that does not refer to +any existing file. If the$result$argument is a null pointer, the return value +is a pointer to an internal static string, which might be modified by +subsequent calls. Otherwise, the$result$argument should be a pointer to an +array of at least$L_tmpnam$characters, and the result is written into that +array. In this case the value of the argument is returned. +Each call of$tmpnam()$generates a different name, up to$TMP_MAX$times. + + + + +------------------------------------------------------------------------------ +II.19.5 File Access *crv-libSIOHFAcc* + + +fclose() Function *crv-fclose* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int fclose(FILE *stream);$ + +Return~ +0: success +EOF: failed + +Description~ +This function causes$stream$to be closed and the connection to the +corresponding file to be broken. Any buffered output is written and any +buffered input is discarded. + + + +fflush() Function *crv-fflush* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int fflush(FILE *stream);$ + +Return~ +0: success +EOF: failed + +Description~ +This function causes any buffered output on$stream$to be delivered to the +file. If$stream$is a null pointer, then$fflush()$causes buffered output on all +open output streams to be flushed. + + + +fopen() Function *crv-fopen* +---------------- +Synopsis~ + $#include <stdio.h>$ + $FILE *fopen(const char *file_name, const char *opentype);$ + +Return~ +NULL: failed +else: pointer to stream of opened file + +Description~ +This function opens a stream for I/O to the file$file_name$, and returns a +pointer to the stream. +The$opentype$argument is a string that controls how the file is opened and +specifies attributes of the resulting stream. It must begin with one of the +following sequences of characters, other may follow (implementation-defined): + + Mode | Description + ------------+-------------------------------------------------------------- + $r$ | open text file for reading + $w$ | truncate to zero length or create text file for writing + $a$ | append; open or create text file for writing at end-of-file + $rb$ | open binary file for reading + $wb$ | truncate to zero length or create binary file for writing + $ab$ | append; open or create binary file for writing at end-of-file + $r+$ | open text file for reading and writing + $w+$ | truncate to zero length or create text file for reading and + | writing + $a+$ | append; open or create text file for reading and writing, + | writing at end-of-file + $r+b or rb+$| open binary file for reading and writing + $w+b or wb+$| truncate to zero length or create binary file for reading + | and writing + $a+b or ab+$| append; open or create binary file for reading and writing, + | writing at end-of-file + + + + +freopen() Function *crv-freopen* +------------------ +Synopsis~ + $#include <stdio.h>$ + $FILE *freopen(const char *file_name, const char *opentype, FILE *stream);$ + +Return~ +NULL: failed +else: pointer to stream of opened file + +Description~ +This function is like a combination of$fclose()$and$fopen()$. It first closes +the stream referred to by$stream$, ignoring any errors that are detected in +the process. Then the file named by$file_name$is opened with mode$opentype$as +for$fopen()$, and associated with the same stream object$stream$. + +This is traditionally been used to connect a standard stream such as$stdin$ +with a file. + + + +setbuf() Function *crv-setbuf* +----------------- +Synopsis~ + $#include <stdio.h>$ + $void setbuf(FILE *stream, char *buf);$ + +Return~ +none + +Description~ +If$buf$is a null pointer, the effect of this function is equivalent to calling +$setvbuf()$with a mode argument of$_IONBF$. Otherwise, it is equivalent to +calling$setvbuf()$with$buf$, and a mode of$_IOFBF$and a size argument of +$BUFSIZ$. + +This function is provided for compatibility with old code; use$setvbuf()$in +all new programs. + + + +setvbuf() Function *crv-setvbuf* +------------------ +Synopsis~ + $#include <stdio.h>$ + $int setvbuf(FILE *stream, char *buf, int mode, size_t size);$ + +Return~ +0: success +nonzero: failed + +Description~ +This function is used to specify that the stream$stream$should have the +buffering mode$mode$, which can be: + +$_IOFBF$ full buffering |crv-lib_IOFBF| +$_IOLBF$ line buffering |crv-lib_IOLBF| +$_IONBF$ unbuffered input/output |crv-lib_IONBF| + +If a null pointer as the$buf$argument is specified, then$setvbuf()$allocates +a buffer itself. This buffer will be freed when closing the stream. + +Otherwise,$buf$should be a character array that can hold at least$size$ +characters. This space should not be freed as long as the stream remains open +and this array remains its buffer. + + + + +------------------------------------------------------------------------------ +II.19.6 Formatted Input/Output *crv-libSIOHIO* + + +II.19.6.1 Format Control *crv-libSIOHIOFormat* +------------------------ + +II.19.6.1.1 Output, printf() *crv-libSIOHIOFout* +----------------------------- +The family of printf() functions write output to a stream, under control of +the format string. The format specifies how subsequent arguments are converted +to output. +A format string for output has the following syntax: + $%[flags][width][.precision][modifier]type$ + +[flags] control convertion (optional) +[width] number of characters to output (optional) +[.precision] precision of number (optional) +[modifier] overrides size (type) of argument (optional) +[type] type of conversion (required) + + +[flag] control convertion (optional) + + zero or more flags may be specified + + flag | Description + -------+--------------------------------------------------------------------- + $-$ | value is left-justified (default is right-justified) + $+$ | forces to show sign of value (+ or -) + | default is to show only - for negative values, overrules space + space | print " " in front of positive value, print - for negative value + $#$ | convert to alternative form: + | $o$ increase precision to force the first digit to be a zero + | + | $x$or$X$ nonzero result will have prefix "0x" or "0X" + | + | $a$,$A$, + | $e$,$E$, + | $f$,$F$, + | $g$or$G$ result will always have decimal point + | + | $g$or$G$ trailing zeros are not removed + | + $0$ | for $d, i, o, u, x, X, a, A, e, E, f, F, g, G$conversions leading + | zeros are used to pad to the field width instead of spaces + + +[width] number of characters to output (optional) + This is a decimal integer specifying the minimum field width. If the normal + conversion produces fewer characters than this, the field is padded with + spaces to the specified width. If the normal conversion produces more + characters than this, the field is not truncated. Normally, the output is + right-justified within the field. + A field width of$*$may be specified. This means that the next argument + in the argument list (before the actual value to be printed) is used as the + field width. The value must be an integer of type$int$. If the value is + negative, this means to set the$-$flag and to use the absolute value as + the field width. + +[.precision] precision of number (optional) + The precision specifies the number of digits to be written for the numeric + conversions. If the precision is specified, it consists of a period ($.$) + followed optionally by a decimal integer (which defaults to zero if + omitted). + + A precision of$*$may be specified. This means that the next argument + in the argument list (before the actual value to be printed) is used as the + precision. The value must be an integer of type$int$, and is ignored if it + is negative. + If$*$is specified for both the field width and precision, the field width + argument precedes the precision argument. + + + precision | Description + -----------+----------------------------------------------------------------- + (none) | default precision: + | 1 for$d, i, o, u, x, X$types. Precision gives the minimum number + | of digits to appear. + | 6 for$f, F, e, E$types. Precision gives the number of digits to + | appear after decimal point. + | For$g, G$types all digits are printed. + | For$s$type all characters of the string are printed, not + | including the terminating null character. + | For$a, A$and$FLT_RADIX$of 2: precision is sufficient for an + | exact representation of the value. + | For$a, A$and$FLT_RADIX$not equal to 2: precision is sufficient + | to distinguish values of type$double$. + | + $.$or$.0$ | For$d, i, o, u, x, X$types the default precision is used, unless + | the value is 0, then no characters are printed. + | For$f, F, e, E$types no decimal-point and no decimal-digits are + | printed.. + | For$g, G$types precision is assumed to be 1. + | For$s$type nothing is printed. + | For$a, A$types no decimal-point and no decimal-digits appear. + | + $.N$ | For$d, i, o, u, x, X$types. At least N digits appear, if + | necessary output is expanded with leading zeros. + | For$f, F, e, E$types. N digits appear after decimal point. + | For$g, G$types N digits are printed. + | For$s$type a maximum of N characters of the string are printed, + | not including the terminating null character. + | For$a, A$types N specifies the number of digits after decimal + | point. + | + + + +[modifier] overrides size (type) of argument (optional) + The modifier character is used to specify the data type of the corresponding + argument if it differs from the default type. + + + modifier | Description + ----------+------------------------------------------------------------------ + $hh$ | Specifies that the argument is a$signed char$or$unsigned char$, + | as appropriate. A$char$argument is converted to an$int$or + |$unsigned int$by the default argument promotions anyway, but this + | modifier says to convert it back to a$char$again. + | + $h$ | Specifies that the argument is a$short int$or$unsigned short int$ + | as appropriate. A$short$argument is converted to an$int$or + |$unsigned int$by the default argument promotions anyway, but this + | modifier says to convert it back to a$short$again. + | + $l$ | Specifies that the argument is a$long int$or$unsigned long int$, + | as appropriate. Two l characters is like the L modifier, below + | If used with$%c$or$%s$the corresponding parameter is considered + | as a wide character or wide character string respectively. + | + $ll$ | Specifies that a following$d, i, o, u, x, X$applies to a + |$long long int$or$unsigned long long int$argument; or that a + |$n$applies to a pointer to$long long int$. + | + $L$ | Specifies that a following$a, A, e, E, f, F, g, G$conversion + | specifier applies to a$long double$argument. + | + $j$ | Specifies that a following$d, i, o, u, x, X$applies to$intmax_t$ + | or$uintmax_t$, or that a following$n$applies to pointer to + |$intmax_t$. + | + $t$ | Specifies that a following$d, i, o, u, x, X$applies to a + |$ptrdiff_t$or the corresponding unsigned integer type argument; + | or that a$n$applies to a pointer to a$ptrdiff_t$argument. + | + $z$ | Specifies that the following$d, i, o, u, x, X$applies to a + |$size_t$or the corresponding singed integer type argument; + | or that a$n$applies to a pointer to a signed integer type + | corresponding to$size_t$argument. + + +[type] type of conversion (required) + + The conversion specifier specifies the conversion to be applied. + + type | Description + --------+------------------------------------------------------------------ + $ d, i$ | type$signed int$, output decicmal, style [-]dddd + $o$ | type$unsigned int$, output octal, style: dddd + $u$ | type$unsigned int$, output decimal, style dddd + $x$ | type$unsigned int$, output hexadecimal, style dddd using a...f + $X$ | type$unsigned int$, output hexadecimal, style dddd using A...F + $f, F$ | type$double$, output decimal, style [-]ddd.ddd + $e$ | type$double$, output decimal, style [-]d.ddde+/-dd + $E$ | type$double$, output decimal, style [-]d.dddE+/-dd + $g$ | type$double$, printed as type$e$if exponent is less than -4 + | or greater than or equal to the precision. Otherwise$f$is used. + $G$ | type$double$, printed as type$E$if exponent is less than -4 + | or greater than or equal to the precision. Otherwise$F$is used. + $a$ | type$double$, style [-]0xh.hhhhp+/-d + | h: hexadecimal digit 0...9, a...f + | d: decimal digit + $A$ | type$double$, style [-]0Xh.hhhhP+/-d + | h: hexadecimal digit 0...9, A...F + | d: decimal digit + $c$ | no$l$modifier: type$char$, single character is printed + | with$l$modifier: type$wchar_t$, single character is printed + $s$ | no$l$modifier: pointer to array of$char$, string is printed + | with$l$modifier: pointer to array of$char$, string is printed + $p$ | type pointer to$void$, value of pointer is printed in an + | implementation-defined way + $n$ | argument is a pointer to$signed int$into which is written the + | number of characters written to the output stream so far + $%$ | a % is printed + + + + +II.19.6.1.2 Input, scanf() *crv-libSIOHIOFin* +--------------------------- +The family of scanf() functions read input from a stream, under control of +the format string. The format specifies how the input is to be stored in +the appropriate variable(s). +A white-space character may match with any whitespace character (space, tab, +carriage return, new line, vertical tab, or formfeed). +Other characters in the format string that are not part of conversion +specifications must match characters in the input stream exactly; if this is +not the case, a matching failure occurs and scanning is stopped. + +A format string for input has the following syntax: + $%[*][width][modifier]type$ + +[*] assignment suppressor (optional) +[width] maximum number of characters to be read (optional) +[modifier] overrides size (type) of argument (optional) +[type] type of conversion (required) + + +[*] assignment suppressor (optional) + The assignment suppressor$*$says to ignore the text read for this + specification. When scanf() finds a conversion specification that uses this + flag, it reads input as directed by the rest of the conversion + specification, but it discards this input, does not use a pointer argument, + and does not increment the count of successful assignments. + + +[width] maximum number of characters to be read (optional) + This is a decimal integer that specifies the maximum field width. Reading of + characters from the input stream stops either when this maximum is reached + or when a non-matching character is found, whichever happens first. Then + what was read so far is converted and stored in the variable. + + Most conversions discard initial whitespace characters (those that don't are + explicitly documented), and these discarded characters don't count towards + the maximum field width. String input conversions store a null character + to mark the end of the input; the maximum field width does not include this + terminator. + + +[modifier] overrides size (type) of argument (optional) + The modifier character is used to specify the data type of the corresponding + argument if it differs from the default type. + + + modifier | Description + ----------+------------------------------------------------------------------ + $hh$ | Specifies that a following$d, i, o, u, x, X, n$conversion applies + | to an argument with type pointer to$signed char$or + | $unsigned char$ + | + $h$ | Specifies that a following$d, i, o, u, x, X, n$conversion applies + | to an argument with type pointer to$short int$or$unsigned short$. + | + $l$ | Specifies that a following$d, i, o, u, x, X, n$conversion applies + | to an argument with type pointer to$long int$or + |$unsigned long int$; or that a following$a, A, e, E, f, F, g, G$ + | converstion applies to an argument with type pointer to$double$; + | or that a following$c, s, [$conversion applies to an argument + | with type pointer to$wchar_t$. + | + $ll$ | Specifies that a following$d, i, o, u, x, X, n$argument applies + | to an argument with type pointer to$long long int$or + | $unsigned long long int$. + | + $L$ | Specifies that a following$a, A, e, E, f, F, g, G$conversion + | applies to an argument of type pointer to$long double$argument. + | + $j$ | Specifies that a following$d, i, o, u, x, X, n$conversion applies + | to an argument with type pointer to$intmax_t$or$uintmax_t$. + | + $t$ | Specifies that a following$d, i, o, u, x, X, n$conversion applies + | to an argument of type pointer to$ptrdiff_t$or the corresponding + | unsigned integer type. + | + $z$ | Specifies that a following$d, i, o, u, x, X, n$conversion applies + | to an argument of type pointer to$size_t$or the corresponding + | singed integer type. + + + +[type] type of conversion (required) + + The conversion specifier specifies the conversion to be applied. + + type | Description + --------+-------------------------------------------------------------------- + $ d $ | type$signed int$, matches an optionally signed integer written + | in decimal + | + $i$ | type$signed int$, matches an optionally signed integer in any of + | the formats that the C language defines for specifying an integer + | constant. The based used depends on the first two characters: + | - first character 1...9, then base 10 (decimal) + | - first digit 0, followed by 0..7, then base 8 (octal) + | - first digit 0, followed by x or X, then base 16 (hexadecimal) + | + $o$ | type$unsigned int$, matches octal numbers (digits 0...7 only) + | + $u$ | type$unsigned int$, matches decimal numbers (digits 0...9 only) + | + $x, X$ | type$unsigned int$, matches hexadecimal numbers (characters 0...9, + | a-f, A-F only). The number may be prefixed with 0x or 0X. + | + $f, F$ | matches an optionally signed floating point number + $e, E$ | + $g, G$ | + $a, A$ | + | + $c$ | Matches a string of one or more characters; the number of + | characters read is controlled by the maximum field width given for + | the conversion. No null character is appended. + | no$l$modifier: argument is of type pointer to array of$char$ + | with$l$modifier: argument is of type pointer to array of$wchar_t$ + | + $s$ | Matches a sequence of non-white-space characters. A null + | character is appended. + | no$l$modifier: argument is of type pointer to array of$char$ + | with$l$modifier: argument is of type pointer to array of$wchar_t$ + | + $ [...]$| Matches a nonempty sequence of characters from a set of expected + | characters enclosed in brackets [...] (scanset). If the first + | character is a circumflex (^), the selection is inverted, in that + | case the scanset contains all characters that do NOT appear in the + | list between [^ and ]. + | A null character is appended. + | no$l$modifier: argument is of type pointer to array of$char$ + | with$l$modifier: argument is of type pointer to array of$wchar_t$ + | + $p$ | Matches a pointer value in the same implementation-defined format + | used by the$%p$output conversion for printf(). + | + $n$ | No input is consumed. It records the number of characters read so + | far by this call. Argument is a pointer to$signed int$into which is + | written the number of characters read from the input stream so far. + | + $%$ | Matches a single %. No conversion or assignment occurs. + + + + +II.19.6.2 Functions *crv-libSIOHIOFunc* +------------------- + +Quicklink + $printf()$ Func |crv-printf| + $fprintf()$ Func |crv-fprintf| + $sprintf()$ Func |crv-sprintf| + $snprintf()$ Func |crv-snprintf| + $vfprintf()$ Func |crv-vfprintf| + $vprintf()$ Func |crv-vprintf| + $vsprintf()$ Func |crv-vsprintf| + $vsnprintf()$Func |crv-vsnprintf| + + $fscanf()$ Func |crv-fscanf| + $scanf()$ Func |crv-scanf| + $sscanf()$ Func |crv-sscanf| + $vfscanf()$ Func |crv-vfscanf| + $vscanf()$ Func |crv-vscanf| + $vsscanf()$ Func |crv-vsscanf| + + + +printf() Function *crv-printf* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int printf(const char *format, ...);$ + +Return~ +<0: output error occurred +>= 0: number of transmitted characters + +Description~ +This function prints the optional arguments under the control of the format +string$format$to the standard output stream$stdout$. +For format string see |crv-libSIOHIOFout|. + + + +fprintf() Function *crv-fprintf* +------------------ +Synopsis~ + $#include <stdio.h>$ + $int fprintf(FILE *stream, const char *format, ...);$ + +Return~ +<0: output error occurred +>= 0: number of transmitted characters + +Description~ +This function is equivalent to$printf()$, except that the output is written +to the stream$stream$instead of$stdout$. + + + +sprintf() Function *crv-sprintf* +------------------ +Synopsis~ + $#include <stdio.h>$ + $int sprintf(char *s, const char *format, ...);$ + +Return~ +<0: error occurred +number of characters stored in array, not including terminating null character + +Description~ +This is like$printf()$, except that the output is stored in the character +array$s$instead of written to a stream. A null character is written to mark +the end of the string. + + + +snprintf() Function *crv-snprintf* +------------------- +Synopsis~ + $#include <stdio.h>$ + $int snprintf(char *s, size_t size, const char *format, ...);$ + +Return~ +<0: error occurred +The return value is the number of characters which would be generated for the +given input, excluding the trailing null. If this value is greater or equal +to$size$, not all characters from the result have been stored in$s$. + +Description~ +This function is similar to$sprintf()$, except that the$size$argument +specifies the maximum number of characters to produce. The trailing null +character is counted towards this limit. + + + +vprintf() Function *crv-vprintf* +------------------ +Synopsis~ + $#include <stdarg.h>$ + $#include <stdio.h>$ + $int vprintf(const char *format, va_list ap);$ + +Return~ +<0: output error occurred +>= 0: number of transmitted characters + +Description~ +This function is similar to$printf()$except that, instead of taking a variable +number of arguments directly, it takes an argument list pointer$ap$, which +must have been initialized by the$va_start()$macro. The$vprintf()$function +does not invoke the$va_end()$macro. + + + +vfprintf() Function *crv-vfprintf* +------------------- +Synopsis~ + $#include <stdarg.h>$ + $#include <stdio.h>$ + $int vfprintf(FILE *stream, const char *format, va_list ap);$ + +Return~ +<0: output error occurred +>= 0: number of transmitted characters + +Description~ +This function is similar to$fprintf()$except that, instead of taking a +variable number of arguments directly, it takes an argument list pointer$ap$, +which must have been initialized by the$va_start()$macro. The$vfprintf()$ +function does not invoke the$va_end()$macro. + + + +vsprintf() Function *crv-vsprintf* +------------------- +Synopsis~ + $#include <stdarg.h>$ + $#include <stdio.h>$ + $int vsnprintf(char *s, size_t size, const char *format, va_list ap);$ + +Return~ +<0: error occurred +number of characters stored in array, not including terminating null character + +Description~ +This function is similar to$sprintf()$except that, instead of taking a +variable number of arguments directly, it takes an argument list pointer$ap$, +which must have been initialized by the$va_start()$macro. The$vsprintf()$ +function does not invoke the$va_end()$macro. + + + +vsnprintf() Function *crv-vsnprintf* +-------------------- +Synopsis~ + $#include <stdarg.h>$ + $#include <stdio.h>$ + $int vsnprintf(char *s, size_t size, const char *format, va_list ap);$ + +Return~ +<0: error occurred +The return value is the number of characters which would be generated for the +given input, excluding the trailing null. If this value is greater or equal +to$size$, not all characters from the result have been stored in$s$. + +Description~ +This function is similar to$snprintf()$except that, instead of taking a +variable number of arguments directly, it takes an argument list pointer$ap$, +which must have been initialized by the$va_start()$macro. The$vsnprintf()$ +function does not invoke the$va_end()$macro. + + + +scanf() Function *crv-scanf* +---------------- +Synopsis~ + $#include <stdio.h>$ + $int scanf(const char *format, ...);$ + +Return~ +The return value is the number of successful assignments. If there is a match +error, this number can be fewer than provided. If an input error occurs +before any matches are performed, then$EOF$is returned. + +Description~ +This function reads formatted input from the standard input stream$stdin$under +the control of the format string$format$. The optional arguments are pointers +to the places which receive the resulting values. +For format string see |crv-libSIOHIOFin|. + + + +fscanf() Function *crv-fscanf* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int fscanf(FILE *stream, const char *format, ...);$ + +Return~ + +Description~ +This function is equivalent to$scanf()$, except that the input is read from +the stream$stream$instead of$stdin$. + + + +sscanf() Function *crv-sscanf* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int sscanf(const char *s, const char *format, ...);$ + +Return~ + +Description~ +This function is similar to$scanf()$, except that the characters are taken +from the null-terminated string$s$instead of from$stdin$. Reaching the end of +the string is treated as an end-of-file condition. + + +vscanf() Function *crv-vscanf* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int vscanf(const char *format, va_list ap);$ + +Return~ + +Description~ +This function is similar to$scanf()$except that, instead of taking a +variable number of arguments directly, it takes an argument list pointer$ap$, +which must have been initialized by the$va_start()$macro. The$vscanf()$ +function does not invoke the$va_end()$macro. + + + +vfscanf() Function *crv-vfscanf* +------------------ +Synopsis~ + $#include <stdio.h>$ + $int vfscanf(FILE *stream, const char *format, va_list ap);$ + +Return~ + +Description~ +This function is similar to$fscanf()$except that, instead of taking a +variable number of arguments directly, it takes an argument list pointer$ap$, +which must have been initialized by the$va_start()$macro. The$vfscanf()$ +function does not invoke the$va_end()$macro. + + + +vsscanf() Function *crv-vsscanf* +------------------ +Synopsis~ + $#include <stdio.h>$ + $int vsscanf(const char *s, const char *format, va_list ap);$ + +Return~ + +Description~ +This function is similar to$sscanf()$except that, instead of taking a +variable number of arguments directly, it takes an argument list pointer$ap$, +which must have been initialized by the$va_start()$macro. The$vsscanf()$ +function does not invoke the$va_end()$macro. + + + + + +------------------------------------------------------------------------------ +II.19.7 Character Input/Output *crv-libSIOHCIO* + +This section describes functions for performing character-oriented input and +output. + +Quicklink: + $fgetc()$ Func |crv-fgetc| + $fgets()$ Func |crv-fgets| + $fputc()$ Func |crv-fputc| + $fputs()$ Func |crv-fputs| + $getc()$ Macro |crv-getc| + $getchar()$ Func |crv-getchar| + $gets()$ Func |crv-gets| + $putc()$ Macro |crv-putc| + $putchar()$ Func |crv-putchar| + $puts()$ Func |crv-puts| + $ungetc()$ Func |crv-ungetc| + + + +fgetc() Function *crv-fgetc* +---------------- +Synopsis~ + $#include <stdio.h>$ + $int fgetc(FILE *stream);$ + +Return~ +character read from stream +error or end-of-file:$EOF$ + +Description~ +This function reads the next character as an$unsigned char$from the stream +$stream$and returns its value, converted to an$int$. If an end-of-file +condition or read error occurs,$EOF$is returned instead. + + + +fgets() Function *crv-fgets* +---------------- +Synopsis~ + $#include <stdio.h>$ + $char *fgets(char *s, int count, FILE *stream);$ + +Return~ +If the system is already at end of file when fgets() is called, then the +contents of the array$s$are unchanged and a null pointer is returned. +A null pointer is also returned if a read error occurs. Otherwise, the +return value is the pointer$s$. + +Description~ +This function reads characters from the stream$stream$up to and including a +newline character and stores them in the string$s$, adding a null character +to mark the end of the string.$count$characters must be supplied worth of +space in$s$, but the number of characters read is at most$count$- 1. +The extra character space is used to hold the null character at the end of +the string. + + + +getc() Macro *crv-getc* +------------ +Synopsis~ + $#include <stdio.h>$ + $int getc(FILE *stream);$ + +Return~ +character read from stream +error or end-of-file:$EOF$ + +Description~ +This is just like$fgetc()$, except that it is permissible (and typical) for +it to be implemented as a macro that evaluates the stream argument more +than once.$getc()$is often highly optimized, so it is usually the best +function to use to read a single character. + + + +getchar() Function *crv-getchar* +------------------ +Synopsis~ + $#include <stdio.h>$ + $int getchar(void);$ + +Return~ +character read from stream +error or end-of-file:$EOF$ + +Description~ +This function is equivalent to$getc()$with$stdin$as the value of the stream +argument. + + + +gets() Function *crv-gets* +--------------- +Synopsis~ + $#include <stdio.h>$ + $char *gets(char *s);$ + +Return~ +If$gets()$encounters a read error or end-of-file, it returns a null pointer; +otherwise it returns$s$. + +Description~ +This function reads characters from the stream$stdin$up to the next newline +character, and stores them in the string$s$. The newline character is +discarded (note that this differs from the behavior of$fgets()$, which copies +the newline character into the string). + + + +ungetc() Function *crv-ungetc* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int ungetc(int c, FILE *stream);$ + +Return~ +$c$pushed back after conversion or$EOF$if the operation fails + +Description~ +This function pushes back the character$c$onto the input stream$stream$. So +the next input from$stream$will read$c$before anything else. + +If$c$is$EOF$,$ungetc()$does nothing and just returns$EOF$. This allows to +call$ungetc()$with the return value of$getc()$without needing to check for an +error from$getc()$. + +The character that is pushed back doesn't have to be the same as the last +character that was actually read from the stream. In fact, it isn't necessary +to actually read any characters from the stream before unreading them with +$ungetc()$. But that is a strange way to write a program; usually$ungetc()$ +is used only to unread a character that was just read from the same stream. + +Pushing back characters doesn't alter the file; only the internal buffering +for the stream is affected. If a file positioning function (such as$fseek()$, +$fseeko()$ or$rewind()$) is called, any pending pushed-back characters are +discarded. + +Unreading a character on a stream that is at end of file clears the +end-of-file indicator for the stream, because it makes the character of +input available. After reading that character, trying to read again will +encounter end of file. + + + +fputc() Function *crv-fputc* +---------------- +Synopsis~ + $#include <stdio.h>$ + $int fputc(int c, FILE *stream);$ + +Return~ +$EOF$is returned if a write error occurs; otherwise the character$c$is +returned + +Description~ +This function converts the character$c$to type$unsigned char$, and writes it +to the stream$stream$. + + + +fputs() Function *crv-fputs* +---------------- +Synopsis~ + $#include <stdio.h>$ + $int fputs(const char *s, FILE *stream);$ + +Return~ +This function returns$EOF$if a write error occurs, and otherwise a +non-negative value. + +Description~ +This function writes the string$s$to the stream$stream$. The terminating +null character is not written. This function does not add a newline character, +either. It outputs only the characters in the string. + + + +putc() Macro *crv-putc* +------------ +Synopsis~ + $#include <stdio.h>$ + $int putc(int c, FILE *stream);$ + +Return~ +This function returns$EOF$if a write error occurs, and otherwise the +character written. + +Description~ +This is just like$fputc()$, except that most systems implement it as a +macro, making it faster. One consequence is that it may evaluate the stream +argument more than once, which is an exception to the general rule for +macros.$putc()$is usually the best function to use for writing a single +character. + + + +putchar() Function *crv-putchar* +------------------ +Synopsis~ + $#include <stdio.h>$ + $int putchar(int c);$ + +Return~ +This function returns$EOF$if a write error occurs, and otherwise the +character written. + +Description~ +This function is equivalent to$putc()$with$stdout$as the value of the stream +argument. + + + +puts() Function *crv-puts* +--------------- +Synopsis~ + $#include <stdio.h>$ + $int puts(const char *s);$ + +Return~ +This function returns$EOF$if a write error occurs, and otherwise a +non-negative value. + +Description~ +This function writes the string$s$to the stream$stdout$followed by a newline. +The terminating null character of the string is not written. (Note that +$fputs()$does not write a newline as this function does.) + +$puts()$is the most convenient function for printing simple messages. + + + +------------------------------------------------------------------------------ +II.19.8 Direct Input/Output *crv-libSIOHDIO* + +This section describes how to do input and output operations on blocks of +data. This functions can be used to read and write binary data, as well as to +read and write text in fixed-size blocks instead of by characters or lines. + +Binary files are typically used to read and write blocks of data in the same +format as is used to represent the data in a running program. In other words, +arbitrary blocks of memory--not just character or string objects--can be +written to a binary file, and meaningfully read in again by the same program. + +Storing data in binary form is often considerably more efficient than using +the formatted I/O functions. Also, for floating-point numbers, the binary form +avoids possible loss of precision in the conversion process. On the other +hand, binary files can't be examined or modified easily using many standard +file utilities (such as text editors), and are not portable between +different implementations of the language, or different kinds of computers. + + +fread() Function *crv-fread* +---------------- +Synopsis~ + $#include <stdio.h>$ + $size_t fread(void *data, size_t size, size_t count, FILE *stream);$ + +Return~ +It returns the number of objects actually read, which might be less than +$count$if a read error occurs or the end of the file is reached. This +function returns a value of zero (and doesn't read anything) if +either$size$or$count$is zero. +If$fread()$encounters end of file in the middle of an object, it returns +the number of complete objects read, and discards the partial object. +Therefore, the stream remains at the actual end of the file. + +Description~ +This function reads up to$count$objects of size$size$into the array$data$, +from the stream$stream$. + + +fwrite() Function *crv-fwrite* +----------------- +Synopsis~ + $#include <stdio.h>$ + $size_t fwrite(const void *data, size_t size, size_t count, FILE *stream);$ + +Return~ +The return value is normally$count$, if the call succeeds. +Any other value indicates some sort of error, such as running out of space. + +Description~ +This function writes up to count objects of size$size$from the array$data$, +to the stream$stream$. + + + + +------------------------------------------------------------------------------ +II.19.9 File Positioning *crv-libSIOHFPos* + +The file position of a stream describes where in the file the stream is +currently reading or writing. I/O on the stream advances the file position +through the file. + +Quicklink: + $fgetpos()$ Func |crv-fgetpos| + $fseek()$ Func |crv-fseek| + $fsetpos()$ Func |crv-fsetpos| + $ftell()$ Func |crv-ftell| + $rewind()$ Func |crv-rewind| + + + +fgetpos() Function *crv-fgetpos* +------------------ +Synopsis~ + $#include <stdio.h>$ + $int fgetpos(FILE *stream, fpos_t *position);$ + +Return~ +If successful,$fgetpos()$ returns zero; otherwise it returns a nonzero value +and stores an implementation-defined positive value in$errno$. + +Description~ +This function stores the value of the file position indicator for the stream +$stream$in the$fpos_t$object pointed to by$position$. + + + +fseek() Function *crv-fseek* +---------------- +Synopsis~ + $#include <stdio.h>$ + $int fseek(FILE *stream, long int offset, int whence);$ + +Return~ +0 if successful, +else failed + +Description~ +This function is used to change the file position of the stream$stream$. The +value of$whence$must be one of the constants$SEEK_SET$,$SEEK_CUR$, or +$SEEK_END$, to indicate whether the offset is relative to the beginning of the +file, the current file position, or the end of the file, respectively. + + + +fsetpos() Function *crv-fsetpos* +------------------ +Synopsis~ + $#include <stdio.h>$ + $int fsetpos(FILE *stream, const fpos_t *position);$ + +Return~ +If successful,$fsetpos()$clears the end-of-file indicator on the stream, +discards any characters that were "pushed back" by the use of$ungetc()$, and +returns a value of zero. +Otherwise, it returns a nonzero value and stores an implementation-defined +positive value in$errno$. + +Description~ +This function sets the file position indicator for the stream$stream$to the +position$position$, which must have been set by a previous call to$fgetpos()$ +on the same stream. + + + +ftell() Function *crv-ftell* +---------------- +Synopsis~ + $#include <stdio.h>$ + $long int ftell(FILE *stream);$ + +Return~ +This function can fail if the stream doesn't support file positioning, or if +the file position can't be represented in a$long int$, and possibly for other +reasons as well. If a failure occurs, a value of -1L is returned and an +implementation-defined positive value is stored in$errno$. + +Description~ +This function returns the current file position of the stream$stream$. + + + +rewind() Function *crv-rewind* +----------------- +Synopsis~ + $#include <stdio.h>$ + $void rewind(FILE *stream);$ + +Return~ +none + +Description~ +This function positions the stream$stream$at the beginning of the file. It is +equivalent to calling$fseek()$on the stream with an offset argument of 0L and a +whence argument of$SEEK_SET$, except that the return value is discarded and the +error indicator for the stream is reset. + + + + +------------------------------------------------------------------------------ +II.19.10 Error Handling *crv-libSIOHErr* + +Quicklink: + $clearerr()$ Func |crv-libclearerr| + $feof()$ Func |crv-libfeof| + $ferror()$ Func |crv-libferror| + $perror()$ Func |crv-libperror| + + + +clearerr() Function *crv-clearerr* +------------------- +Synopsis~ + $#include <stdio.h>$ + $void clearerr(FILE *stream);$ + +Return~ +none + +Description~ +This function clears the end-of-file and error indicators for the stream +$stream$. +The file positioning functions also clear the end-of-file indicator for the +stream. + + + +feof() Function *crv-feof* +--------------- +Synopsis~ + $#include <stdio.h>$ + $int feof(FILE *stream);$ + +Return~ +0: no EOF +else: EOF + +Description~ +This function returns nonzero if and only if the end-of-file indicator for the +stream$stream$ is set. + + + +ferror() Function *crv-ferror* +----------------- +Synopsis~ + $#include <stdio.h>$ + $int ferror(FILE *stream);$ + +Return~ +0: no error +else: error indicator is set + +Description~ +This function returns nonzero if and only if the error indicator for the +stream $stream$is set, indicating that an error has occurred on a previous +operation on the stream. + + + +perror() Function *crv-perror* +----------------- +Synopsis~ + $#include <stdio.h>$ + $void perror(const char *msg);$ + +Return~ +none + +Description~ +This function prints an error message to the stream$stderr$. The orientation +of$stderr$is not changed. + +If$perror()$is called with a message that is either a null pointer or an empty +string,$perror()$just prints the error message corresponding to$errno$, adding +a trailing newline. + +If it's called with a non-null message argument, then$perror()$prefixes its +output with this string. It adds a colon and a space character to separate the +message from the error string corresponding to$errno$. + + + + +============================================================================== +II.20 <stdlib.h> Utilities *crv-libStdlibH* + +This header file declares types, macros and functions of general utility. + + + +------------------------------------------------------------------------------ +II.20.1 Types *crv-libSLHType* + +Quicklink: + $dif_t$ Type |crv-libdif_t| + $ldif_t$ Type |crv-libldif_t| + $lldif_t$ Type |crv-liblldif_t| + $size_t$ Type |crv-libsize_t2| + $wchar_t$ Type |crv-libwchar_t2| + + + +dif_t Type *crv-dif_t* +---------- +This is a structure type used to hold the result returned by the$div()$ +function. It has the following members: + $int quot$: The quotient from the division. + $int rem$ : The remainder from the division. + + +ldif_t Type *crv-ldif_t* +----------- +This is a structure type used to hold the result returned by the$ldiv()$ +function. It has the following members: + $long int quot$: The quotient from the division. + $long int rem$ : The remainder from the division. + + +lldif_t Type *crv-lldif_t* +------------ +This is a structure type used to hold the result returned by the$ldiv()$ +function. It has the following members: + $long long int quot$: The quotient from the division. + $long long int rem$ : The remainder from the division. + + +size_t Type *crv-size_t2* +----------- +This is an unsigned integer type used to represent the sizes of objects. +Also declared in$<stddef.h>$, see |crv-libsize_t|. +Also declared in$<string.h>$, see |crv-libsize_t3|. +Also declared in$<time.h>$, see |crv-libsize_t4|. +Also declared in$<stdio.h>$, see |crv-libsize_t5|. +Also declared in$<wchar.h>$, see |crv-libsize_t6|. + + +wchar_t Type *crv-wchar_t2* +------------ +This data type is used as the base type for wide character strings. +It's range of values can represent distinct codes for all members of the +largest extended character set specified among the supported locales. +Also declared in$<stddef.h>$, see |crv-libwchar_t|. +Also declared in$<wchar.h>$, see |crv-libwchar_t3|. + + + + +------------------------------------------------------------------------------ +II.20.2 Macros *crv-libSLHMac* + +Quicklink: + $EXIT_SUCCESS$ Macro |crv-libEXIT_SUCCESS| + $EXIT_FAILURE$ Macro |crv-libEXIT_FAILURE| + $MB_CUR_MAX$ Macro |crv-libMB_CUR_MAX| + $NULL$ Macro |crv-libNULL2| + $RAND_MAX$ Macro |crv-libRAND_MAX| + + + +RAND_MAX Macro *crv-RAND_MAX* +-------------- +The value of this macro is an integer constant representing the largest value +the rand function can return. Its value is implementation-defined, but at +least 32767. + + + +EXIT_SUCCESS Macro *crv-EXIT_SUCCESS* +------------------ +This macro can be used with the$exit()$function to indicate successful program +completion. + + + +EXIT_FAILURE Macro *crv-EXIT_FAILURE* +------------------ +This macro can be used with the$exit()$function to indicate unsuccessful +program completion in a general sense. + + + +NULL Macro *crv-NULL2* +---------- +Expands to an implementation-defined null pointer constant. +Also defined in$<stddef.h>$, see |crv-NULL|. +Also defined in$<string.h>$, see |crv-NULL3|. +Also defined in$<time.h>$, see |crv-NULL4|. +Also defined in$<stdio.h>$, see |crv-NULL5|. +Also defined in$<wchar.h>$, see |crv-NULL6|. + + + +MB_CUR_MAX Macro *crv-MB_CUR_MAX* +---------------- +This macro expands into a positive integer expression that is the maximum +number of bytes in a multibyte character in the current locale. The value +is never greater than$MB_LEN_MAX$. + + + + +------------------------------------------------------------------------------ +II.20.3 Numeric Conversion *crv-libSLHnum* + +Quicklink: + $atof()$ Func |crv-atof| + $atoi()$ Func |crv-atoi| + $atol()$ Func |crv-atol| + $atoll()$ Func |crv-atoll| + $strtod()$ Func |crv-strtod| + $strtof()$ Func |crv-strtof| + $strtol()$ Func |crv-strtol| + $strtold()$ Func |crv-strtold| + $strtoll()$ Func |crv-strtoll| + $stroul()$ Func |crv-stroul| + $strtoull()$Func |crv-strtoull| + + + +atof() Function *crv-atof* +--------------- +Synopsis~ + $#include <stdlib.h>$ + $double atof(const char *string);$ + +Return~ +result of conversion + +Description~ +This function converts the initial portion of the string$string$to a$double$ +representation. This function is similar to the$strtod()$function, except that +it need not detect overflow and underflow errors. +The atof function is provided mostly for compatibility with existing code; +using$strtod()$is more robust. + + + +atol() Function *crv-atol* +--------------- +Synopsis~ + $#include <stdlib.h>$ + $long int atol(const char *string);$ + +Return~ +result of conversion + +Description~ +This function converts the string$string$to an$long int$value. +This function is similar to the$strtol()$function with a base argument of 10, +except that it need not detect overflow errors. The$atol()$function is +provided mostly for compatibility with existing code; using$strtol()$is more +robust. + + + +atoi() Function *crv-atoi* +--------------- +Synopsis~ + $#include <stdlib.h>$ + $int atoi(const char *string);$ + +Return~ +result of conversion + +Description~ +This function converts the string$string$to an$int$value. +The$atoi()$function is considered obsolete; use$strtol()$instead. + + + +atoll() Function *crv-atoll* +---------------- +Synopsis~ + $#include <stdlib.h>$ + $long long int atoll(const char *string);$ + +Return~ +result of conversion + +Description~ +This function converts the string$string$to an$long long int$value. +The$atoll()$function was introduced in ISO C99. It is obsolete (despite having +just been added); use$strtoll()$instead. + + + + +strtol() Function *crv-strtol* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $long int strtol(const char *restrict string, char **restrict tailptr,$ + $int base);$ + +Return~ +no error: value of conversion +no conversion: 0 is returned +out of range: result is$LONG_MAX$or$LONG_MIN$(according to sign), + $ errno$is set to$ERANGE$ + +Description~ +The$strtol()$("string-to-long") function converts the initial part of string to +a signed integer, which is returned as a value of type$long int$. + +This function attempts to decompose$string$as follows: + + - A (possibly empty) sequence of whitespace characters. Which characters are + whitespace is determined by the$isspace()$function. These are discarded. + - An optional plus or minus sign (+ or -). + - A nonempty sequence of digits in the radix specified by$base$. + If$base$is zero, decimal radix is assumed unless the series of digits + begins with 0 (specifying octal radix), or 0x or 0X (specifying + hexadecimal radix); in other words, the same syntax used for integer + constants in C. + Otherwise$base$must have a value between 2 and 36. If$base$is 16, the + digits may optionally be preceded by 0x or 0X. If$base$has no legal value + the value returned is 0l and the global variable$errno$is set to$EINVAL$. + - Any remaining characters in the string. If$tailptr$is not a null pointer, + $strtol()$stores a pointer to this tail in$*tailptr$. + +If the string is empty, contains only whitespace, or does not contain an +initial substring that has the expected syntax for an integer in the specified +$base$, no conversion is performed. In this case,$strtol()$returns a value of +zero and the value stored in$*tailptr$is the value of$string$. + +In a locale other than the standard "C" locale, this function may recognize +additional implementation-dependent syntax. + +Checking for errors by examining the return value of$strtol()$should not be +done, because the string might be a valid representation of 0l,$LONG_MAX$, +or$LONG_MIN$. Instead, check whether$tailptr$points to what is expected after +the number (e.g. '\0' if the string should end after the number). $errno$needs +also to be cleared before the call and checked afterwards, in case there was +overflow. + + + +strtoll() Function *crv-strtoll* +------------------ +Synopsis~ + $#include <stdlib.h>$ + $long long int strtoll(const char *restrict string, char **restrict tailptr,$ + $int base);$ + +Return~ +no error: value of conversion +no conversion: 0 is returned +out of range: result is$LONG_LONG_MAX$or$LONG_LONG_MIN$(according to sign), + $errno$is set to$ERANGE$ + +Description~ +This function is like$strtol()$except that it returns a$long long int$value, +and accepts numbers with a correspondingly larger range. + + + +stroul() Function *crv-stroul* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $unsigned long int strtoul(const char *retrict string,$ + $char **restrict tailptr, int base);$ + +Return~ +no error: value of conversion +no conversion: 0 is returned +out of range: result is$ULONG_MAX$,$errno$is set to$ERANGE$ + +Description~ +The$strtoul()$("string-to-unsigned-long") function is like$strtol()$except it +converts to an$unsigned long int$value. The syntax is the same as described +for$strtol$. + + + +strtoull() Function *crv-strtoull* +------------------- +Synopsis~ + $#include <stdlib.h>$ + $unsigned long long int strtoull(const char *restrict string,$ + $char **restrict tailptr, int base);$ + +Return~ +no error: value of conversion +no conversion: 0 is returned +out of range: result is$ULONG_LONG_MAX$,$errno$is set to$ERANGE$ + +Description~ +This function is like$strtol()$except that it returns an +$unsigned long long int$value, and accepts numbers with a correspondingly +larger range. + + + + +strtod() Function *crv-strtod* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $double strtod(const char *restrict string, char **restrict tailptr);$ + +Return~ +no error: value of conversion +no conversion: 0 is returned +out of range: result is $-HUGE_VAL$or$+HUGH_VAL$(according to sign), + $errno$is set to$ERANGE$ + +Description~ +The$strtod()$("string-to-double") function converts the initial part of string +to a floating-point number, which is returned as a value of type$double$. + +This function attempts to decompose$string$as follows: + + - A (possibly empty) sequence of whitespace characters. Which characters are + whitespace is determined by the$isspace()$function. These are discarded. + - An optional plus or minus sign (+ or -). + - A floating point number in decimal or hexadecimal format. The decimal + format is: + o A nonempty sequence of digits optionally containing a decimal-point + character - normally, but it depends on the locale. + o An optional exponent part, consisting of a character e or E, an + optional sign, and a sequence of digits. + + The hexadecimal format is as follows: + o A 0x or 0X followed by a nonempty sequence of hexadecimal digits + optionally containing a decimal-point character - normally, but it + depends on the locale. + o An optional binary-exponent part, consisting of a character p or P, + an optional sign, and a sequence of digits. + + - Any remaining characters in the string. If$tailptr$is not a null pointer, + a pointer to this tail of the string is stored in$*tailptr$. + +If the string is empty, contains only whitespace, or does not contain an +initial substring that has the expected syntax for a floating-point number, no +conversion is performed. In this case,$strtod()$returns a value of zero +and the value returned in$*tailptr$is the value of$string$. + +In a locale other than the standard "C", this function may recognize +additional locale-dependent syntax. + +If the string has valid syntax for a floating-point number but the value +is outside the range of a$double$,$strtod()$will signal overflow or +underflow as described in II.12.1 Error Conditions (|crv-libMHErr|). + +$strtod()$recognizes four special input strings. The strings "inf" +and "infinity" are converted to ∞, or to the largest representable +value if the floating-point format doesn't support infinities. You can +prepend a "+" or "-" to specify the sign. Case is ignored when scanning +these strings. + +The strings "nan" and "nan(chars...)" are converted to NaN. Again, case is +ignored. If chars... are provided, they are used in some unspecified fashion +to select a particular representation of NaN (there can be several). + +Since zero is a valid result as well as the value returned on error, you +should check for errors in the same way as for$strtol()$, by examining +$errno$and$tailptr$. + + + +strtof() Function *crv-strtof* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $float strtof(const char *string, char **tailptr);$ + +Return~ +no error: value of conversion +no conversion: 0 is returned +out of range: result is $-HUGE_VALF$or$+HUGH_VALF$(according to sign), + $errno$is set to$ERANGE$ + +Description~ +This function is analogous to$strtod()$, but return$float$values respectively; +it reports errors in the same way. + + + +strtold() Function *crv-strtold* +------------------ +Synopsis~ + $#include <stdlib.h>$ + $long double strtold(const char *string, char **tailptr);$ + +Return~ +no error: value of conversion +no conversion: 0 is returned +out of range: result is $-HUGE_VALL$or$+HUGH_VALL$(according to sign), + $errno$is set to$ERANGE$ + +Description~ +This function is analogous to$strtod()$, but return$long double$values +respectively; it reports errors in the same way. + + + + +------------------------------------------------------------------------------ +II.20.4 Pseudo-Random *crv-libSLHrand* + +This section describes the random number functions. + +Quicklink: + $rand()$ Func |crv-rand| + $srand()$ Func |crv-srand| + + + +rand() Function *crv-rand* +--------------- +Synopsis~ + $#include <stdlib.h>$ + $int rand(void);$ + +Return~ +pseudo-random number + +Description~ +This function returns the next pseudo-random number in the series. The value +ranges from 0 to$RAND_MAX$. + + + +srand() Function *crv-srand* +---------------- +Synopsis~ + $#include <stdlib.h>$ + $void srand(unsigned int seed);$ + +Return~ +none + +Description~ +This function establishes$seed$as the seed for a new series of pseudo-random +numbers. +If$rand()$is called before a seed has been established with$srand()$, it uses +the value 1 as a default seed. + +To produce a different pseudo-random series each time program starts, do +$srand (time (0))$. + + + + +------------------------------------------------------------------------------ +II.20.5 Memory Management *crv-libSLHmem* + +Quicklink: + $calloc()$ Func |crv-calloc| + $free()$ Func |crv-free| + $malloc()$ Func |crv-malloc| + $realloc()$Func |crv-realloc| + + +calloc() Function *crv-calloc* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $void *calloc(size_t count, size_t eltsize);$ + +Return~ +pointer to allocated space or null pointer, if failed + +Description~ +This function allocates a block long enough to contain a vector of$count$ +elements, each of size$eltsize$. Its contents are cleared to zero before +$calloc()$returns. + + + +free() Function *crv-free* +---------------- +Synopsis~ + $#include <stdlib.h>$ + $void free(void *ptr);$ + +Return~ +none + +Description~ +This function deallocates the block of memory pointed at by$ptr$that was +allocated by$calloc()$,$malloc()$or$realloc()$. +It is allowed for$ptr$to be a null pointer. + + + +malloc() Function *crv-malloc* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $void *malloc(size_t size);$ + +Return~ +pointer to allocated space or null pointer, if failed + +Description~ +This function returns a pointer to a newly allocated block$size$bytes long. +The contents of the block is undefined. + + + +realloc() Function *crv-realloc* +------------------ +Synopsis~ + $#include <stdlib.h>$ + $void *realloc(void *ptr, size_t newsize);$ + +Return~ +pointer to new block or null pointer, if failed + +Description~ +This function changes the size of the block whose address is$ptr$to be +$newsize$. +Since the space after the end of the block may be in use,$realloc()$may find +it necessary to copy the block to a new address where more free space is +available. If the block needs to be moved,$realloc()$copies the old contents. + +If a null pointer is passed for$ptr$,$realloc()$behaves just like +$malloc(newsize)$. +If memory for the new block cannot be allocated the old block is not +deallocated and its value is unchanged. + + + + +------------------------------------------------------------------------------ +II.20.6 Communication *crv-libSLHcom* + +Quicklink: + $_Exit()$ Func |crv-_Exit| + $abort()$ Func |crv-abort| + $atexit()$ Func |crv-atexit| + $exit()$ Func |crv-exit| + $getenv()$ Func |crv-getenv| + $system()$ Func |crv-system| + + + +abort() Function *crv-abort* +---------------- +Synopsis~ + $#include <stdlib.h>$ + $void abort(void);$ + +Return~ +this function does not return to its caller + +Description~ +This function causes abnormal program termination. This does not execute +cleanup functions registered with$atexit()$. This function actually terminates +the process by raising a SIGABRT signal. + + + +atexit() Function *crv-atexit* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $int atexit(void (*function) (void));$ + +Return~ +0: successful +else: failed to register function + +Description~ +This function registers the function$function$to be called at normal program +termination. The$function$is called with no arguments. + + + +exit() Function *crv-exit* +--------------- +Synopsis~ + $#include <stdlib.h>$ + $void exit(int status);$ + +Return~ +this function does not return to its caller + +Description~ +This function tells the system that the program is done, which causes it to +terminate the process. The value of$status$is returned to the environment. + +Normal termination causes the following actions: + - Functions that were registered with the$atexit()$function are called in + the reverse order of their registration. This mechanism allows the + application to specify its own "cleanup" actions to be performed at + program termination. + - All open streams are closed, writing out any buffered output data. + In addition, temporary files opened with the$tmpfile()$function are + removed. + - Control is returned to the host environment. If$status$is zero or + $EXIT_SUCCESS$, then this signifies a successful termination. If$status$ + is$EXIT_FAILURE$, then this signifies an unsuccessful termination. + Other values are implementation-defined. + + + +_Exit() Function *crv-_Exit* +---------------- +Synopsis~ + $#include <stdlib.h>$ + $void _Exit(int status);$ + +Return~ +this function does not return to its caller + +Description~ +This function is the primitive for causing a process to terminate with status +$status$. Calling this function does not execute cleanup functions registered +with$atexit()$. + +Termination causes the following actions: + - All open streams are closed, writing out any buffered output data. + In addition, temporary files opened with the$tmpfile()$function are + removed. + - Control is returned to the host environment. If$status$is zero or + $EXIT_SUCCESS$, then this signifies a successful termination. If$status$ + is$EXIT_FAILURE$, then this signifies an unsuccessful termination. + Other values are implementation-defined. + + + +getenv() Function *crv-getenv* +------------------ +Synopsis~ + $#include <stdlib.h>$ + $char * getenv(const char *name);$ + +Return~ +null pointer: environment variable not found +else: pointer to string representing the value of the environment + variable +Description~ +This function returns a string that is the value of the environment variable +$name$. This string must not be modified. + + + +system() Function *crv-system* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $int system(const char *command);$ + +Return~ +If the$command$argument is a null pointer, a return value of zero indicates +that no command processor is available. +If the$command$argument is not a null pointer and the$system()$function does +return, it returns an implementation-defined value. + +Description~ +This function executes$command$as a shell command (shell = command processor). +If$command$is a null pointer, the$system()$function determines whether the +host environment has a command processor. + + + + +------------------------------------------------------------------------------ +II.20.7 Searching and Sorting *crv-libSLHsearch* + +Quicklink: + $bsearch()$ Func |crv-bsearch| + $qsort()$ Func |crv-qsort| + + +bsearch() Function *crv-bsearch* +------------------ +Synopsis~ + $#include <stdlib.h>$ + $void *bsearch(const void *key, const void *array, size_t count,$ + $size_t size, int (* compare)(const void *, const void *));$ + +Return~ +The return value is a pointer to the matching array element, or a null pointer +if no match is found. If the array contains more than one element that +matches, the one that is returned is unspecified. + +Description~ +This function ("binary-search") searches the sorted array$array$for an object +that is equivalent to$key$. The array contains$count$elements, each of which +is of size$size$bytes. + +The$compare$function is used to perform the comparison. This function is +called with two pointer arguments and should return an integer less than, +equal to, or greater than zero corresponding to whether its first argument +is considered less than, equal to, or greater than its second argument. The +elements of the$array$must already be sorted in ascending order according to +this comparison function. + + + +qsort() Function *crv-qsort* +---------------- +Synopsis~ + $#include <stdlib.h>$ + $void qsort(void *array, size_t count, size_t size,$ + $int (* compare)(const void *, const void *));$ + +Return~ +none + +Description~ +This function sorts the array$array$. The array contains$count$elements, each +of which is of size$size$. + +The$compare$function is used to perform the comparison on the array elements. +This function is called with two pointer arguments and should return an +integer less than, equal to, or greater than zero corresponding to whether its +first argument is considered less than, equal to, or greater than its second +argument. + +If two objects compare as equal, their order after sorting is unpredictable. +That is to say, the sorting is not stable. This can make a difference when +the comparison considers only part of the elements. Two elements with the +same sort key may differ in other respects. + + + + +------------------------------------------------------------------------------ +II.20.8 Integer Arithmetic *crv-libSLHintarith* + +Quicklink: + $abs()$ Func |crv-abs| + $labs()$ Func |crv-labs| + $llabs()$ Func |crv-llabs| + $div()$ Func |crv-div| + $ldiv()$ Func |crv-ldiv| + $lldiv()$ Func |crv-lldiv| + + + +abs() Function *crv-abs* +-------------- +Synopsis~ + $#include <stdlib.h>$ + $int abs(int number);$ + +Return~ +absolute value + +Description~ +Evaluates the absolute value of$number$. + + + +labs() Function *crv-labs* +--------------- +Synopsis~ + $#include <stdlib.h>$ + $long int labs(long int number);$ + +Return~ +absolute value + +Description~ +Evaluates the absolute value of$number$. + + + +llabs() Function *crv-llabs* +---------------- +Synopsis~ + $#include <stdlib.h>$ + $long long int labs(long long int number);$ + +Return~ +absolute value + +Description~ +Evaluates the absolute value of$number$. + + + +div() Function *crv-div* +-------------- +Synopsis~ + $#include <stdlib.h>$ + $div_t div(int numerator, int denominator);$ + +Return~ +return the result in a structure of type$div_t$ +If the result cannot be represented (as in a division by zero), the +behavior is undefined. + +Description~ +This function computes the quotient and remainder from the division of +$numerator$by$denominator$. + + + +ldiv() Function *crv-ldiv* +--------------- +Synopsis~ + $#include <stdlib.h>$ + $ldiv_t ldiv(long int numerator, long int denominator);$ + +Return~ +return the result in a structure of type$ldiv_t$ +If the result cannot be represented (as in a division by zero), the +behavior is undefined. + +Description~ +This function computes the quotient and remainder from the division of +$numerator$by$denominator$. + + + +lldiv() Function *crv-lldiv* +---------------- +Synopsis~ + $#include <stdlib.h>$ + $lldiv_t lldiv(long long int numerator, long long int denominator);$ + +Return~ +return the result in a structure of type$lldiv_t$ +If the result cannot be represented (as in a division by zero), the +behavior is undefined. + +Description~ +This function computes the quotient and remainder from the division of +$numerator$by$denominator$. + + + + +------------------------------------------------------------------------------ +II.20.9 Multibyte/Wide Character *crv-libSLHmulchar* + +Quicklink: + $mblen()$ Func |crv-mblen| + $mbtowc()$ Func |crv-mbtowc| + $wctomb()$ Func |crv-wctomb| + + + +mblen() Function *crv-mblen* +---------------- +Synopsis~ + $#include <stdlib.h>$ + $int mblen(const char *string, size_t size);$ + +Return~ +see description + +Description~ +The$mblen()$function with a non-null string argument returns the number of +bytes that make up the multibyte character beginning at$string$, never +examining more than$size$bytes. + +The return value of$mblen()$distinguishes three possibilities: the first$size$ +bytes at$string$start with valid multibyte characters, they start with an +invalid byte sequence or just part of a character, or$string$points to an +empty string (a null character). + +For a valid multibyte character,$mblen()$returns the number of bytes in that +character (always at least 1 and never more than$size$). For an invalid byte +sequence,$mblen()$returns -1. For an empty string, it returns 0. + +If the multibyte character code uses shift characters, then$mblen()$maintains +and updates a shift state as it scans. If$mblen()$is called with a null +pointer for$string$, that initializes the shift state to its standard initial +value. It also returns a nonzero value if the multibyte character code in use +actually has a shift state. + + + +mbtowc() Function *crv-mbtowc* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $int mbtowc(wchar_t *restrict result, const char *restrict string,$ + $size_t size);$ + +Return~ +see description + +Description~ +The$mbtowc()$("multibyte to wide character") function when called with +non-null$string$converts the first multibyte character beginning at$string$to +its corresponding wide character code. It stores the result in$*result$. +$mbtowc()$never examines more than$size$bytes. + +$mbtowc()$with non-null$string$distinguishes three possibilities: the first +size bytes at$string$start with valid multibyte characters, they start with +an invalid byte sequence or just part of a character, or string points to an +empty string (a null character). + +For a valid multibyte character,$mbtowc()$converts it to a wide character and +stores that in$*result$, and returns the number of bytes in that character +(always at least 1 and never more than$size$). + +For an invalid byte sequence,$mbtowc()$returns -1. For an empty string, it +returns 0, also storing '\0' in$*result$. + +If the multibyte character code uses shift characters, then$mbtowc()$ +maintains and updates a shift state as it scans. If$mbtowc()$is called with a +null pointer for$string$, that initializes the shift state to its standard +initial value. It also returns nonzero if the multibyte character code in use +actually has a shift state. + + + +wctomb() Function *crv-wctomb* +----------------- +Synopsis~ + $#include <stdlib.h>$ + $int wctomb(char *string, wchar_t wchar);$ + +Return~ +see description + +Description~ +The$wctomb()$("wide character to multibyte") function converts the wide +character code$wchar$to its corresponding multibyte character sequence, and +stores the result in bytes starting at$string$. At most$MB_CUR_MAX$characters +are stored. + +$wctomb()$with non-null string distinguishes three possibilities for$wchar$: a +valid wide character code (one that can be translated to a multibyte +character), an invalid code, and L'\0'. + +Given a valid code,$wctomb()$converts it to a multibyte character, storing the +bytes starting at$string$. Then it returns the number of bytes in that +character (always at least 1 and never more than$MB_CUR_MAX$). + +If$wchar$is an invalid wide character code,$wctomb()$returns -1. If$wchar$is +L'\0', it returns 0, also storing '\0' in$*string$. + +If the multibyte character code uses shift characters, then$wctomb()$maintains +and updates a shift state as it scans. If$wctomb()$is called with a null +pointer for$string$, that initializes the shift state to its standard initial +value. It also returns nonzero if the multibyte character code in use +actually has a shift state. + + + + +------------------------------------------------------------------------------ +II.20.10 Multibyte/Wide String *crv-libSLHmulstrng* + +Quicklink: +$mbstowcs()$ Func |crv-mbstowcs| +$wcstombs()$ Func |crv-wcstombs| + + + +mbstowcs() Function *crv-mbstowcs* +------------------- +Synopsis~ + $#include <stdlib.h>$ + $size_t mbstowcs(wchar_t *wstring, const char *string, size_t size);$ + +Return~ +see description + +Description~ +The$mbstowcs()$("multibyte string to wide character string") function converts +the null-terminated string of multibyte characters$string$to an array of wide +character codes, storing not more than$size$wide characters into the array +beginning at$wstring$. The terminating null character counts towards the size, +so if$size$is less than the actual number of wide characters resulting from +$string$, no terminating null character is stored. + +The conversion of characters from$string$begins in the initial shift state. + +If an invalid multibyte character sequence is found, the$mbstowcs()$function +returns a value of -1. Otherwise, it returns the number of wide characters +stored in the array$wstring$. This number does not include the terminating +null character, which is present if the number is less than$size$. + + + +wcstombs() Function *crv-wcstombs* +------------------- +Synopsis~ + $#include <stdlib.h>$ + $size_t wcstombs(char *string, const wchar_t *wstring, size_t size);$ + +Return~ +see description + +Description~ +The$wcstombs()$("wide character string to multibyte string") function converts +the null-terminated wide character array$wstring$into a string containing +multibyte characters, storing not more than$size$bytes starting at$string$, +followed by a terminating null character if there is room. + +The conversion of characters begins in the initial shift state. + +The terminating null character counts towards the size, so if$size$is less +than or equal to the number of bytes needed in$wstring$, no terminating null +character is stored. + +If a code that does not correspond to a valid multibyte character is found, +the$wcstombs()$function returns a value of -1. Otherwise, the return value is +the number of bytes stored in the array$string$. This number does not include +the terminating null character, which is present if the number is less than +$size$. + + + +============================================================================== +II.21 <string.h> String *crv-libStringH* + + + +------------------------------------------------------------------------------ +II.21.1 Types *crv-libSRHType* + +size_t Type *crv-size_t3* +----------- +This is an unsigned integer type used to represent the sizes of objects. +Also declared in$<stddef.h>$, see |crv-size_t|. +Also declared in$<stdlib.h>$, see |crv-size_t2|. +Also declared in$<time.h>$, see |crv-size_t4|. +Also declared in$<stdio.h>$, see |crv-size_t5|. +Also declared in$<wchar.h>$, see |crv-size_t6|. + + + + +------------------------------------------------------------------------------ +II.21.2 Macros *crv-libSRHMac* + +NULL Macro *crv-NULL3* +---------- +Expands to an implementation-defined null pointer constant. +Also defined in$<stddef.h>$, see |crv-NULL|. +Also defined in$<stdlib.h>$, see |crv-NULL2|. +Also defined in$<time.h>$, see |crv-NULL4|. +Also defined in$<stdio.h>$, see |crv-NULL5|. +Also defined in$<wchar.h>$, see |crv-NULL6|. + + + + + +------------------------------------------------------------------------------ +II.21.3 Copying *crv-libSRHCopy* + +The functions described in this section can be used to copy the contents of +strings and arrays. + +Quicklink: + $memcpy()$ Func |crv-memcpy| + $memmove()$ Func |crv-memmove| + $strcpy()$ Func |crv-strcpy| + $strncpy()$ Func |crv-strncpy| + + + +memcpy() Function *crv-memcpy* +----------------- +Synopsis~ + $#include <string.h>$ + $void *memcpy(void *restrict to, const void *restrict from, size_t size);$ + +Return~ +value of$to$ + +Description~ +This function copies$size$bytes from the object beginning at$from$into the +object beginning at$to$. The behavior of this function is undefined if the two +arrays$to$and$from$overlap; $memmove()$can be used instead if overlapping is +possible. + + + +memmove() Function *crv-memmove* +------------------ +Synopsis~ + $#include <string.h>$ + $void *memmove(void *to, const void *from, size_t size);$ + +Return~ +value of$to$ + +Description~ +This function copies the$size$bytes at$from$into the$size$bytes at$to$, even +if those two blocks of space overlap. In the case of overlap,$memmove()$is +careful to copy the original values of the bytes in the block at$from$, +including those bytes which also belong to the block at$to$. + + + +strcpy() Function *crv-strcpy* +----------------- +Synopsis~ + $#include <string.h>$ + $char *strcpy(char *restrict to, const char *restrict from);$ + +Return~ +value of$to$ + +Description~ +This copies characters from the string$from$(up to and including the +terminating null character) into the string$to$. Like$memcpy()$, this function +has undefined results if the strings overlap. + + + +strncpy() Function *crv-strncpy* +------------------ +Synopsis~ + $#include <string.h>$ + $char *strncpy(char *restrict to, const char *restrict from, size_t size);$ + +Return~ +value of$to$ + +Description~ +This function is similar to$strcpy()$but always copies exactly$size$characters +into$to$. + +If the length of$from$is more than$size$, then$strncpy()$copies just the first +size characters. In this case there is no null terminator written into$to$. + +If the length of$from$is less than$size$, then$strncpy()$copies all of$from$, +followed by enough null characters to add up to$size$characters in all. + +The behavior of$strncpy()$is undefined if the strings overlap. + +NOTE: Using$strncpy()$as opposed to$strcpy()$is a way to avoid bugs relating +to writing past the end of the allocated space for$to$. However, it can also +make your program much slower in one common case: copying a string which is +probably small into a potentially large buffer. In this case, size may be +large, and when it is,$strncpy()$ will waste a considerable amount of time +copying null characters. + + + + +------------------------------------------------------------------------------ +II.21.4 Concatenation *crv-libSRHConcat* + +Quicklink: + $strcat()$ Func |crv-strcat| + $strncat()$ Func |crv-strncat| + + +strcat() Function *crv-strcat* +----------------- +Synopsis~ + $#include <string.h>$ + $char *strcat(char *restrict to, const char *restrict from);$ + +Return~ +value of$to$ + +Description~ +This function is similar to$strcpy()$, except that the characters from$from$ +are concatenated or appended to the end of$to$, instead of overwriting it. +That is, the first character from$from$overwrites the null character marking +the end of$to$. +This function has undefined results if the strings overlap. + + + +strncat() Function *crv-strncat* +------------------ +Synopsis~ + $#include <string.h>$ + $char *strncat(char *restrict to, const char *restrict from, size_t size);$ + +Return~ +value of$to$ + +Description~ +This function is like$strcat()$except that not more than$size$characters from +$from$are appended to the end of$to$. A single null character is also always +appended to$to$, so the total allocated size of$to$must be at least +$size + 1$bytes longer than its initial length. +The behavior of this function is undefined if the strings overlap. + + + + +------------------------------------------------------------------------------ +II.21.5 Comparison *crv-libSRHCmp* + +Quicklink: + $memcmp()$ Func |crv-memcmp| + $strcmp()$ Func |crv-strcmp| + $strcoll()$ Func |crv-strcoll| + $strncmp()$ Func |crv-strncmp| + $strxfrm()$ Func |crv-strxfrm| + + + +memcmp() Function *crv-memcmp* +----------------- +Synopsis~ + $#include <string.h>$ + $int memcmp(const void *a1, const void *a2, size_t size);$ + +Return~ +The value returned is greater than, equal to, or less than zero, accordingly +as the object pointed to by$a1$is greater than, equal to, or less than the +object pointed to by$a2$. + +Description~ +This function compares the$size$bytes of memory beginning at$a1$against the +$size$bytes of memory beginning at$a2$. + + + +strcmp() Function *crv-strcmp* +----------------- +Synopsis~ + $#include <string.h>$ + $int strcmp(const char *s1, const char *s2);$ + +Return~ +The value returned is greater than, equal to, or less than zero, accordingly +as the string pointed to by$s1$is greater than, equal to, or less than the +string pointed to by$s2$. + +Description~ +This function compares the string$s1$against$s2$. + + + +strcoll() Function *crv-strcoll* +------------------ +Synopsis~ + $#include <string.h>$ + $int strcoll(const char *s1, const char *s2);$ + +Return~ +The value returned is greater than, equal to, or less than zero, accordingly +as the string pointed to by$s1$is greater than, equal to, or less than the +string pointed to by$s2$. + + +Description~ +This function is similar to$strcmp()$but uses the collating sequence of the +current locale for collation (the$LC_COLLATE$locale). + + + +strncmp() Function *crv-strncmp* +------------------ +Synopsis~ + $#include <string.h>$ + $int strncmp(const char *s1, const char *s2, size_t size);$ + +Return~ +The value returned is greater than, equal to, or less than zero, accordingly +as the string pointed to by$s1$is greater than, equal to, or less than the +string pointed to by$s2$. + +Description~ +This function is the similar to$strcmp()$, except that no more than$size$wide +characters are compared. In other words, if the two strings are the same in +their first$size$wide characters, the return value is zero. + + + +strxfrm() Function *crv-strxfrm* +------------------ +Synopsis~ + $#include <string.h>$ + $size_t strxfrm(char *restrict to, const char *restrict from, size_t size);$ + +Return~ +The return value is the length of the entire transformed string. +This value is not affected by the value of$size$, but if it is greater or +equal than$size$, it means that the transformed string did not entirely fit +in the array$to$. In this case, only as much of the string as actually fits +was stored. + +Description~ +This function transforms the string$from$using the collation transformation +determined by the locale currently selected for collation, and stores the +transformed string in the array$to$. Up to$size$characters (including a +terminating null character) are stored. + +If$size$is zero, no characters are stored in$to$. In this case,$strxfrm()$ +simply returns the number of characters that would be the length of the +transformed string. +This is useful for determining what size the allocated array should be. +It does not matter what$to$is if$size$is zero;$to$may even be a null pointer. + +The transformed string may be longer than the original string, and it may +also be shorter. + +The behavior is undefined if the strings$to$and$from$overlap. + + + + +------------------------------------------------------------------------------ +II.21.6 Search *crv-libSRHSearch* + +This section describes library functions which perform various kinds of +searching operations on strings and arrays. + +Quicklink: + $memchr()$ Func |crv-memchr| + $strchr()$ Func |crv-strchr| + $strcspn()$ Func |crv-strcspn| + $strpbrk()$ Func |crv-strpbrk| + $strrchr()$ Func |crv-strrchr| + $strspn()$ Func |crv-strspn| + $strstr()$ Func |crv-strstr| + $strtok()$ Func |crv-strtok| + + + + +memchr() Function *crv-memchr* +----------------- +Synopsis~ + $#include <string.h>$ + $void *memchr(const void *block, int c, size_t size);$ + +Return~ +pointer to the located byte, or null pointer if no match was found + +Description~ +This function finds the first occurrence of the byte$c$(converted to an +$unsigned char$) in the initial$size$bytes of the object beginning at$block$. + + + +strchr() Function *crv-strchr* +----------------- +Synopsis~ + $#include <string.h>$ + $char *strchr(const char *string, int c);$ + +Return~ +pointer to the located byte, or null pointer if no match was found + +Description~ +This function finds the first occurrence of the character$c$(converted to a +$char$) in the null-terminated string beginning at$string$. + + + +strcspn() Function *crv-strcspn* +------------------ +Synopsis~ + $#include <string.h>$ + $size_t strcspn(const char *string, const char *stopset);$ + +Return~ +length of substring + +Description~ +The$strcspn()$("string complement span") function returns the length of the +initial substring of$string$that consists entirely of characters that are not +members of the set specified by the string$stopset$. +(In other words, it returns the offset of the first character in$string$that +is a member of the set$stopset$.) + + + +strpbrk() Function *crv-strpbrk* +------------------ +Synopsis~ + $#include <string.h>$ + $char *strpbrk(const char *string, const char *stopset);$ + +Return~ +returns a pointer to the character, or null pointer if no such character +is found + +Description~ +The$strpbrk()$("string pointer break") function is related to$strcspn()$, +except that it returns a pointer to the first character in$string$that is a +member of the set$stopset$instead of the length of the initial substring. + + + +strrchr() Function *crv-strrchr* +------------------ +Synopsis~ + $#include <string.h>$ + $char *strrchr(const char *string, int c);$ + +Return~ +pointer to the located byte, or null pointer if no match was found + +Description~ +The function$strrchr()$is like$strchr()$, except that it searches backwards +from the end of the string$string$(instead of forwards from the front). + + + +strspn() Function *crv-strspn* +----------------- +Synopsis~ + $#include <string.h>$ + $size_t strspn(const char *string, const char *skipset);$ + +Return~ +length of substring + +Description~ +The$strspn()$("string span") function returns the length of the initial +substring of$string$that consists entirely of characters that are members of +the set specified by the string$skipset$. The order of the characters in +$skipset$is not important. + + + +strstr() Function *crv-strstr* +----------------- +Synopsis~ + $#include <string.h>$ + $char *strstr(const char *haystack, const char *needle);$ + +Return~ +It returns a pointer into the string$haystack$that is the first character of +the substring, or a null pointer if no match was found. If$needle$is an empty +string, the function returns$haystack$. + +Description~ +This is like$strchr()$, except that it searches$haystack$for a substring +$needle$rather than just a single character. + + + +strtok() Function *crv-strtok* +----------------- +Synopsis~ + $#include <string.h>$ + $char *strtok(char *restrict newstring, const char *restrict delimiters);$ + +Return~ +see description + +Description~ +A string can be split into tokens by making a series of calls to the function +$strtok()$. + +The string to be split up is passed as the$newstring$argument on the first +call only. The$strtok()$function uses this to set up some internal state +information. Subsequent calls to get additional tokens from the same string +are indicated by passing a null pointer as the$newstring$argument. Calling +$strtok()$with another non-null$newstring$argument reinitializes the state +information. It is guaranteed that no other library function ever calls +$strtok()$behind your back (which would mess up this internal state +information). + +The$delimiters$argument is a string that specifies a set of delimiters that +may surround the token being extracted. All the initial characters that are +members of this set are discarded. The first character that is not a member +of this set of delimiters marks the beginning of the next token. The end of +the token is found by looking for the next character that is a member of the +$delimiter$set. This character in the original string$newstring$is +overwritten by a null character, and the pointer to the beginning of the token +in$newstring$ is returned. + +On the next call to$strtok()$, the searching begins at the next character +beyond the one that marked the end of the previous token. +Note that the set of delimiters$delimiters$do not have to be the same on every +call in a series of calls to$strtok()$. + +If the end of the string$newstring$is reached, or if the remainder of$string$ +consists only of delimiter characters,$strtok()$returns a null pointer. + +Note that "character" is here used in the sense of byte. In a string using a +multibyte character encoding (abstract) character consisting of more than one +byte are not treated as an entity. Each byte is treated separately. The +function is not locale-dependent. + + + + +------------------------------------------------------------------------------ +II.21.7 Miscellaneous *crv-libSRHMisc* + +Quicklink: + $memset()$ Func |crv-memset| + $strerror()$ Func |crv-strerror| + $strlen()$ Func |crv-strlen| + + + +memset() Function *crv-memset* +----------------- +Synopsis~ + $#include <string.h>$ + $void *memset(void *block, int c, size_t size);$ + +Return~ +value of$block$ + +Description~ +This function copies the value of$c$(converted to an$unsigned char$) into each +of the first$size$bytes of the object beginning at$block$. + + + +strerror() Function *crv-strerror* +------------------- +Synopsis~ + $#include <string.h>$ + $char *strerror(int errnum);$ + +Return~ +The return value is a pointer to error message, which string should not be +modified. Also, if subsequent calls to$strerror()$are done, the string might +be overwritten. But it's guaranteed that no library function ever calls +$strerror()$. + +Description~ +This function maps the error code specified by the$errnum$argument to a +descriptive error message string. +The value$errnum$normally comes from the variable$errno$. + + + +strlen() Function *crv-strlen* +----------------- +Synopsis~ + $#include <string.h>$ + $size_t strlen(const char *s);$ + +Return~ +length of string + +Description~ +The$strlen()$function returns the length of the null-terminated string$s$in bytes. + + + + +============================================================================== +II.22 <tgmath.h> Type-Generic *crv-libTgmathH* + +This header file includes$<math.h>$and$<complex.h>$and defines several +type-generic macros. + +A type-generic macro expands to a function according to the type of the +macro's parameter(s). +E.g. there is a type-generic macro$fabs(parameter)$.This macro expands to: + -$fabs()$ if$parameter$is of type$double$ + -$fabsf()$ if$parameter$is of type$float$ + -$fabsl()$ if$parameter$is of type$long double$ + -$cabs()$ if$parameter$is of type$double complex$ + -$cabsf()$ if$parameter$is of type$float complex$ + -$cabsl()$ if$parameter$is of type$long double complex$ + +For each function declared in$<math.h>$and$<complex.h>$which has no f ($float$) +or l ($long double$) suffix, and which has one or more parameters of type +$double$a type-generic macro is defined (except for$mdof()$). + +For each function declared in$<math.h>$which has no suffix and for which there +is a corresponding function in$<complex.h>$with prefix c, a type-generic macro +is defined for both functions that has the name of the function declared +in$<math.h>$. + +The type-generic macros determine the real type as follows: + - if any parameter is of type$long double$, the type determined is + $long double$ + - otherwise, if any parameter is of type$double$or is of integer type, the + determined type is$double$ + - otherwise, the type determined is$float$ + + + + +============================================================================== +II.23 <time.h> Date and Time *crv-libTimeH* + +This header defines macros and declares types and functions for manipulating +time. + + + +------------------------------------------------------------------------------ +II.23.1 Types *crv-libTHType* + +Quicklink: + $size_t$ Type |crv-size_t4| + $clock_t$ Type |crv-clock_t| + $time_t$ Type |crv-time_t| + $tm$ Type |crv-tm| + + + +size_t Type *crv-size_t4* +----------- +This is an unsigned integer type used to represent the sizes of objects. +Also declared in$<stddef.h>$, see |crv-size_t|. +Also declared in$<stdlib.h>$, see |crv-size_t2|. +Also declared in$<string.h>$, see |crv-size_t3|. +Also declared in$<stdio.h>$, see |crv-size_t5|. +Also declared in$<wchar.h>$, see |crv-size_t6|. + + + +clock_t Type *crv-clock_t* +------------ +This is the type of the value returned by the$clock()$function. Values of +type$clock_t$are numbers of clock ticks. + + + +time_t Type *crv-time_t* +----------- +This is the data type used to represent simple time. Sometimes, it also +represents an elapsed time. When interpreted as a calendar time value, it +represents the number of seconds elapsed since 00:00:00 on January 1, 1970, +Coordinated Universal Time. (This calendar time is sometimes referred to as +the epoch.). + +NOTE: A simple time has no concept of local time zone. Calendar Time T +is the same instant in time regardless of where on the globe the computer is. + + + +struct tm Type *crv-tm* +-------------- +This is the data type used to represent a broken-down time. The structure +contains at least the following members, which can appear in any order. + +$int tm_sec$ + This is the number of full seconds since the top of the minute (normally + in the range 0 through 59, but the actual upper limit is 60, to allow for + leap seconds if leap second support is available). + +$int tm_min$ + This is the number of full minutes since the top of the hour (in the range + 0 through 59). + +$int tm_hour$ + This is the number of full hours past midnight (in the range 0 through 23). + +$int tm_mday$ + This is the ordinal day of the month (in the range 1 through 31). + +$int tm_mon$ + This is the number of full calendar months since the beginning of the year + (in the range 0 through 11). + +$int tm_year$ + This is the number of full calendar years since 1900. + +$int tm_wday$ + This is the number of full days since Sunday (in the range 0 through 6). + +$int tm_yday$ + This is the number of full days since the beginning of the year (in the + range 0 through 365). + +$int tm_isdst$ + This is a flag that indicates whether Daylight Saving Time is (or was, or + will be) in effect at the time described. The value is positive if + Daylight Saving Time is in effect, zero if it is not, and negative if the + information is not available. + +Also declared in$<wchar.h>$, see |crv-tm2|. + + + + +------------------------------------------------------------------------------ +II.23.2 Macros *crv-libTHMac* + +Quicklink: +$CLOCKS_PER_SEC$ Macro |crv-CLOCKS_PER_SEC| +$NULL$ Macro |crv-NULL4| + + + +NULL Macro *crv-NULL4* +---------- +Expands to an implementation-defined null pointer constant. +Also defined in$<stddef.h>$, see |crv-NULL|. +Also defined in$<stdlib.h>$, see |crv-NULL2|. +Also defined in$<string.h>$, see |crv-NULL3|. +Also defined in$<stdio.h>$, see |crv-NULL5|. +Also defined in$<wchar.h>$, see |crv-NULL6|. + + + +CLOCKS_PER_SEC Macro *crv-CLOCKS_PER_SEC* +-------------------- +The value of this macro is the number of clock ticks per second measured by +the$clock()$function. + + + +------------------------------------------------------------------------------ +II.23.3 Time Manipulation *crv-libTHMani* + +Quicklink: + $clock()$ Func |crv-clock| + $difftime()$ Func |crv-difftime| + $mktime()$ Func |crv-mktime| + $time()$ Func |crv-time| + + + +clock() Function *crv-clock* +---------------- +Synopsis~ + $#include <time.h>$ + $clock_t clock(void);$ + +Return~ +CPU time ot (clock_t)(-1) if an error occurred + +Description~ +This function returns the calling process' current CPU time. If the CPU time +is not available or cannot be represented, clock returns the value +(clock_t)(-1). +Time in seconds can be determined by dividing the result of$clock()$by +$CLOCKS_PER_SECOND$. + + + +difftime() Function *crv-difftime* +------------------- +Synopsis~ + $#include <time.h>$ + $double difftime(time_t time1, time_t time0);$ + +Return~ +seconds elapsed + +Description~ +This function returns the number of seconds of elapsed time between calendar +time$time1$and calendar time$time0$, as a value of type$double$. The +difference ignores leap seconds unless leap second support is enabled. + + + +mktime() Function *crv-mktime* +----------------- +Synopsis~ + $#include <time.h>$ + $time_t mktime(struct tm *brokentime);$ + +Return~ +Simple time, or if the specified broken-down time cannot be represented as a +simple time,$mktime()$returns a value of (time_t)(-1) and does not modify the +contents of$brokentime$. + +Description~ +The$mktime()$function is used to convert a broken-down time structure to a +simple time representation. It also "normalizes" the contents of the +broken-down time structure, by filling in the day of week and day of year +based on the other date and time components. + +The$mktime()$function ignores the specified contents of the$tm_wday$and +$tm_yday$members of the broken-down time structure. It uses the values of the +other components to determine the calendar time; it's permissible for these +components to have unnormalized values outside their normal ranges. The last +thing that$mktime()$does is adjust the components of the brokentime structure +(including the$tm_wday$and$tm_yday$). + + + +time() Function *crv-time* +--------------- +Synopsis~ + $#include <time.h>$ + $time_t time(time_t *result);$ + +Return~ +current calenar time or if the current calendar time is not available, +the value (time_t)(-1) + +Description~ +The$time()$function returns the current calendar time as a value of type +$time_t$. If the argument$result$is not a null pointer, the calendar time +value is also stored in$*result$. + + + + +------------------------------------------------------------------------------ +II.23.4 Time Conversion *crv-libTHConv* + +Quicklink: + $asctime()$ Func |crv-asctime| + $ctime()$ Func |crv-ctime| + $gmtime()$ Func |crv-gmtime| + $localtime()$ Func |crv-localtime| + $strftime()$ Func |crv-strftime| + + + +asctime() Function *crv-asctime* +------------------ +Synopsis~ + $#include <time.h>$ + $char *asctime(const struct tm *brokentime);$ + +Return~ +The return value points to a statically allocated string, which might be +overwritten by subsequent calls to$asctime()$or$ctime$. But no other library +function overwrites the contents of this string. + +Description~ +This function converts the broken-down time value that$brokentime$points to +into a string in a standard format: + "Tue May 21 13:46:22 1991\n" + +The abbreviations for the days of week are: Sun, Mon, Tue, Wed, Thu, Fri, and +Sat. + +The abbreviations for the months are: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, +Sep, Oct, Nov, and Dec. + + + +ctime() Function *crv-ctime* +---------------- +Synopsis~ + $#include <time.h>$ + $char *ctime(const time_t *time);$ + +Return~ +The return value points to a statically allocated string, which might be +overwritten by subsequent calls to$asctime()$or$ctime$. But no other library +function overwrites the contents of this string. + +Description~ +The$ctime()$function is similar to$asctime()$, except that calendar time +is specified as a$time_t$simple time value rather than in broken-down local +time format. It is equivalent to: + $asctime (localtime (time))$ + + + +gmtime() Function *crv-gmtime* +----------------- +Synopsis~ + $#include <time.h>$ + $struct tm *gmtime(const time_t *time);$ + +Return~ +returns pointer to the broken-down time, or a null pointer if the specified +time cannot be converted to UTC + +Description~ +This function is similar to$localtime()$, except that the broken-down time is +expressed as Coordinated Universal Time (UTC) (formerly called Greenwich Mean +Time (GMT)) rather than relative to a local time zone. + + + +localtime() Function *crv-localtime* +-------------------- +Synopsis~ + $#include <time.h>$ + $struct tm *localtime (const time_t *time);$ + +Return~ +returns pointer to the broken-down time, or a null pointer if the specified +time cannot be converted to local time + +Description~ +The$localtime()$function converts the simple time pointed to by$time$to +broken-down time representation, expressed relative to the user's specified +time zone. + + + +strftime() Function *crv-strftime* +------------------- +Synopsis~ + $#include <time.h>$ + $size_t strftime(char *s, size_t size, const char *format,$ + $const struct tm *brokentime;$ + +Return~ +number of characters placed in$s$, not including the terminating null +character +if this number is greater than$size$, zero is returned + +Description~ +This function is similar to the$sprintf()$function, but the conversion +specifications that can appear in the format$format$are specialized for +printing components of the date and time$brokentime$according to the locale +currently specified for time conversion. + +Ordinary characters appearing in the format are copied to the output +string$s$; this can include multibyte character sequences. Conversion +specifiers are introduced by a$%$character, followed by an optional +modifier. The modifier extensions are: + + - E Use the locale's alternate representation for date and time. This + modifier applies to the$%c, %C, %x, %X, %y, %Y$format specifiers. + - O Use the locale's alternate numeric symbols for numbers. This modifier + applies only to numeric format specifiers. + + +If the format supports the modifier but no alternate representation is +available, it is ignored. + +The conversion specifier ends with a format specifier taken from the following +list. The whole % sequence is replaced in the output string as follows: + +$%a$ The abbreviated weekday name according to the current locale. +$%A$ The full weekday name according to the current locale. +$%b$ The abbreviated month name according to the current locale. +$%B$ The full month name according to the current locale. +$%c$ The preferred calendar time representation for the current locale. +$%C$ The century of the year. This is equivalent to the greatest integer + not greater than the year divided by 100. +$%d$ The day of the month as a decimal number (range 01 through 31). +$%D$ The date using the format$%m/%d/%y$. +$%e$ The day of the month like with %d, but padded with blank (range 1 + through 31). +$%F$ The date using the format$%Y-%m-%d$. +$%g$ The year corresponding to the ISO week number, but without the century + (range 00 through 99). This has the same format and value as$%y$, + except that if the ISO week number (see$%V$) belongs to the previous + or next year, that year is used instead. +$%G$ The year corresponding to the ISO week number. This has the same format + and value as$%Y$, except that if the ISO week number (see %V) belongs + to the previous or next year, that year is used instead. +$%h$ The abbreviated month name according to the current locale. The action + is the same as for$%b$. +$%H$ The hour as a decimal number, using a 24-hour clock (range 00 through + 23). +$%I$ The hour as a decimal number, using a 12-hour clock (range 01 through + 12). +$%j$ The day of the year as a decimal number (range 001 through 366). +$%k$ The hour as a decimal number, using a 24-hour clock like$%H$, but padded + with blank (range 0 through 23). +$%l$ The hour as a decimal number, using a 12-hour clock like$%I$, but padded + with blank (range 1 through 12). +$%m$ The month as a decimal number (range 01 through 12). +$%M$ The minute as a decimal number (range 00 through 59). +$%n$ A single \n (newline) character. +$%p$ Either AM or PM, according to the given time value; or the corresponding + strings for the current locale. Noon is treated as PM and midnight as AM. +$%r$ The complete calendar time using the AM/PM format of the current locale. +$%R$ The hour and minute in decimal numbers using the format$%H:%M$. +$%S$ The seconds as a decimal number (range 00 through 60). +$%t$ A single \t (tabulator) character. +$%T$ The time of day using decimal numbers using the format$%H:%M:%S$. +$%u$ The day of the week as a decimal number (range 1 through 7), Monday + being 1. +$%U$ The week number of the current year as a decimal number (range 00 through + 53), starting with the first Sunday as the first day of the first week. + Days preceding the first Sunday in the year are considered to be in week + 00. +$%V$ The ISO 8601:1988 week number as a decimal number (range 01 through 53). + ISO weeks start with Monday and end with Sunday. Week 01 of a year is the + first week which has the majority of its days in that year; this is + equivalent to the week containing the year's first Thursday, and it is + also equivalent to the week containing January 4. Week 01 of a year can + contain days from the previous year. The week before week 01 of a year + is the last week (52 or 53) of the previous year even if it contains days + from the new year. +$%w$ The day of the week as a decimal number (range 0 through 6), Sunday + being 0. +$%W$ The week number of the current year as a decimal number (range 00 through + 53), starting with the first Monday as the first day of the first week. + All days preceding the first Monday in the year are considered to be in + week 00. +$%x$ The preferred date representation for the current locale. +$%X$ The preferred time of day representation for the current locale. +$%y$ The year without a century as a decimal number (range 00 through 99). + This is equivalent to the year modulo 100. +$%Y$ The year as a decimal number, using the Gregorian calendar. Years before + the year 1 are numbered 0, -1, and so on. +$%z$ RFC 822/ISO 8601:1988 style numeric time zone (e.g., -0600 or +0100), or + nothing if no time zone is determinable. + A full RFC 822 timestamp is generated by the format + $"%a, %d %b %Y %H:%M:%S %z"$ (or the equivalent$"%a, %d %b %Y %T %z"$). +$%Z$ The time zone abbreviation (empty if the time zone can't be determined). +$%%$ A literal % character. + + +The$size$parameter can be used to specify the maximum number of characters to +be stored in the array$s$, including the terminating null character. If the +formatted time requires more than$size$characters,$strftime()$returns zero +and the contents of the array$s$are undefined. Otherwise the return value +indicates the number of characters placed in the array$s$, not including +the terminating null character. + +Warning: This convention for the return value which is prescribed in ISO C +can lead to problems in some situations. For certain format strings and +certain locales the output really can be the empty string and this cannot +be discovered by testing the return value only. E.g., in most locales the +AM/PM time format is not supported (most of the world uses the 24 hour +time representation). In such locales$"%p"$will return the empty string, +i.e., the return value is zero. To detect situations like this something +similar to the following code should be used: +> + buf[0] = '\1'; + len = strftime (buf, bufsize, format, tp); + if (len == 0 && buf[0] != '\0') + { + /* Something went wrong in the strftime call. */ + ... + } + + +If$s$is a null pointer,$strftime()$does not actually write anything, but +instead returns the number of characters it would have written. + + + + +============================================================================== +II.24 <wchar.h> Wide Utilities *crv-libWcharH* + + +------------------------------------------------------------------------------ +II.24.1 Types *crv-libWCHType* + +Quicklink: + $mbstate_t$ Type |crv-mbstate_t| + $tm$ Type |crv-tm2| + $size_t$ Type |crv-size_t6| + $wchar_t$ Type |crv-wchar_t3| + $wint_t$ Type |crv-wint_t2| + + + +mbstate_t Type *crv-mbstate_t* +-------------- +A variable of type$mbstate_t$can contain all the information about the shift +state needed from one call to a conversion function to another. + + +struct tm Type *crv-tm2* +-------------- +Also declared in$<time.h>$, for description see |crv-tm|. + + +size_t Type *crv-size_t6* +----------- +This is an unsigned integer type used to represent the sizes of objects. +Also declared in$<stddef.h>$, see |crv-size_t|. +Also declared in$<stdlib.h>$, see |crv-size_t2|. +Also declared in$<string.h>$, see |crv-size_t3|. +Also declared in$<time.h>$, see |crv-size_t4|. +Also declared in$<stdio.h>$, see |crv-size_t5|. + + +wchar_t Type *crv-wchar_t3* +------------ +This data type is used as the base type for wide character strings. +It's range of values can represent distinct codes for all members of the +largest extended character set specified among the supported locales. +Also declared in$<stddef.h>$, see |crv-wchar_t|. +Also declared in$<stdlib.h>$, see |crv-wchar_t2|. + + +wint_t Type *crv-wint_t2* +----------- +This is a data type used for parameters and variables that contain a single +wide character. +Also declared in$<wctype.h>$, see |crv-wint_t|. + + + + +------------------------------------------------------------------------------ +II.24.2 Macros *crv-libWCHMac* + +Quicklink: + $NULL$ Macro |crv-NULL6| + $WCHAR_MIN$ Macro |crv-WCHAR_MIN2| + $WCHAR_MAX$ Macro |crv-WCHAR_MAX2| + $WEOF$ Macro |crv-WEOF2| + + +NULL Macro *crv-NULL6* +---------- +Expands to an implementation-defined null pointer constant. +Also defined in$<stddef.h>$, see |crv-NULL|. +Also defined in$<stdlib.h>$, see |crv-NULL2|. +Also defined in$<string.h>$, see |crv-NULL3|. +Also defined in$<time.h>$, see |crv-NULL4|. +Also defined in$<stdio.h>$, see |crv-NULL5|. + + +WCHAR_MIN Macro *crv-WCHAR_MIN2* +WCHAR_MAX Macro *crv-WCHAR_MAX2* +--------------- +Minimum and maximum value representable by an object of type$wchar_t$. +Also defined in$<wctype.h>$, see |crv-libWCHAR_MIN|, |crv-libWCHAR_MAX|. + + +WEOF Macro *crv-WEOF2* +---------- +This macro expands to an expression of type$wint_t$that is returned by a +number of wide stream functions to indicate an end-of-file condition, or some +other error situation. +Also declared in$<wctype.t>$, see |crv-libWEOF|. + + + + +------------------------------------------------------------------------------ +II.24.3 Formatted Input/Output *crv-libWCHIO* + +Quicklink: + $fwprintf()$ Func |crv-fwprintf| + $swprintf()$ Func |crv-swprintf| + $wprintf()$ Func |crv-wprintf| + $wscanf()$ Func |crv-wscanf| + $fwscanf()$ Func |crv-fwscanf| + $swscanf()$ Func |crv-swscanf| + $vfwprintf()$ Func |crv-vfwprintf| + $vswprintf()$ Func |crv-vswprintf| + $vwprintf()$ Func |crv-vwprintf| + $vfwscanf()$ Func |crv-vfwscanf| + $vswscanf()$ Func |crv-vswscanf| + $vwscanf()$ Func |crv-vwscanf| + + + +wprintf() Function *crv-wprintf* +------------------ +Synopsis~ + $#include <wchar.h>$ + $int wprintf(const wchar_t *format, ...);$ + +Return~ +<0: output error occurred +>= 0: number of transmitted characters + +Description~ +This function prints the optional arguments under the control of the wide +format string$format$to the standard output stream$stdout$. +For format string see |crv-libSIOHIOFout|. + + + +fwprintf() Function *crv-fwprintf* +------------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $int fwprintf(FILE *stream, const wchar_t *format, ...);$ + +Return~ +<0: output error occurred +>= 0: number of transmitted characters + +Description~ +This function is just like$wprintf()$, except that the output is written to +the stream$stream$instead of standard output stream$stdout$. + + + +swprintf() Function *crv-swprintf* +------------------- +Synopsis~ + $#include <wchar.h>$ + $int swprintf(wchar_t *s, size_t size, const wchar_t *format, ...);$ + +Return~ +The return value is the number of characters generated for the given input, +excluding the trailing null. If not all output fits into the provided +buffer or an error occurred a negative value is returned. + +Description~ +This is like$wprintf()$, except that the output is stored in the wide +character array$s$instead of written to a stream. A null wide character is +written to mark the end of the string. The$size$argument specifies the maximum +number of characters to produce. The trailing null character is counted +towards this limit. + + + +vwprintf() Function *crv-vwprintf* +------------------- +Synopsis~ + $#include <stdarg.h>$ + $#include <wchar.h>$ + $int vwprintf(const wchar_t *format, va_list ap);$ + +Return~ + +Description~ +This function is similar to$wprintf()$except that, instead of taking a +variable number of arguments directly, it takes an argument list pointer$ap$. + + + +vfwprintf() Function *crv-vfwprintf* +-------------------- +Synopsis~ + $#include <stdarg.h>$ + $#include <stdio.h>$ + $#include <wchar.h>$ + $int vfwprintf(FILE *stream, const wchar_t *format, va_list ap);$ + +Return~ + +Description~ +This is the equivalent of$fwprintf()$with the variable argument list specified +directly as for$vwprintf()$. + + + +vswprintf() Function *crv-vswprintf* +-------------------- +Synopsis~ + $#include <stdarg.h>$ + $#include <stdio.h>$ + $#include <wchar.h>$ + $int vswprintf(wchar_t *s, size_t size, const wchar_t *format, va_list ap);$ + +Return~ + +Description~ +This is the equivalent of$swprintf()$with the variable argument list specified +directly as for$vwprintf()$. + + + +wscanf() Function *crv-wscanf* +----------------- +Synopsis~ + $#include <wchar.h>$ + $int wscanf(const wchar_t *format, ...);$ + +Return~ +The return value is normally the number of successful assignments. If an +end-of-file condition is detected before any matches are performed, including +matches against whitespace and literal characters in the template, then$WEOF$ +is returned. + +Description~ +The$wscanf()$function reads formatted input from the stream$stdin$under the +control of the format string$format$. The optional arguments are pointers to +the places which receive the resulting values. +For format string see |crv-libSIOHIOFin|. + + + +fwscanf() Function *crv-fwscanf* +------------------ +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $int fwscanf(FILE *stream, const wchar_t *format, ...);$ + +Return~ + +Description~ +This function is just like$wscanf()$, except that the input is read from the +stream$stream$instead of$stdin$. + + + +swscanf() Function *crv-swscanf* +------------------ +Synopsis~ + $#include <wchar.h>$ + $int swscanf (const wchar_t *ws, const char *format, ...);$ + +Return~ + +Description~ +This is like$wscanf()$, except that the characters are taken from the +null-terminated string$ws$instead of from a$stream$. Reaching the end of the +string is treated as an end-of-file condition. + +The behavior of this function is undefined if copying takes place between +objects that overlap. + + + +vwscanf() Function *crv-vwscanf* +------------------ +Synopsis~ + $#include <stdarg.h>$ + $#include <wchar.h>$ + $int vwscanf(const wchar_t *format, va_list ap);$ + +Return~ + +Description~ +This function is similar to$wscanf()$, but instead of taking a variable number +of arguments directly, it takes an argument list pointer ap of type$va_list$. + + + +vfwscanf() Function *crv-vfwscanf* +------------------- +Synopsis~ + $#include <stdarg.h>$ + $#include <stdio.h>$ + $#include <wchar.h>$ + $int vfwscanf(FILE *stream, const wchar_t *format, va_list ap);$ + +Return~ + +Description~ +This is the equivalent of$fwscanf()$with the variable argument list specified +directly as for$vwscanf()$. + + + +vswscanf() Function *crv-vswscanf* +------------------- +Synopsis~ + $#include <stdarg.h>$ + $#include <wchar.h>$ + $int vswscanf(const wchar_t *s, const wchar_t *format, va_list ap);$ + +Return~ + +Description~ +This is the equivalent of$swscanf()$with the variable argument list specified +directly as for$vwscanf()$. + + + + +------------------------------------------------------------------------------ +II.24.4 Character Input/Output *crv-libWCHCIO* + +Quicklink: + $fgetwc()$ Func |crv-fgetwc| + $fgetws()$ Func |crv-fgetws| + $getwc()$ Macro |crv-getwc| + $getwchar()$ Macro |crv-getwchar| + $ungetwc()$ Func |crv-ungetwc| + $fputwc()$ Func |crv-fputwc| + $fputws()$ Func |crv-fputws| + $putwc()$ Macro |crv-putwc| + $putwchar()$ Macro |crv-putwchar| + $fwide()$ Func |crv-fwide| + + + +fgetwc() Function *crv-fgetwc* +----------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $wint_t fgetwc(FILE *stream);$ + +Return~ +wide character read from stream, or$WEOF$if an error or an end-of-file +condition occurred + +Description~ +This function reads the next wide character from the stream$stream$and returns +its value. + + + +fgetws() Function *crv-fgetws* +----------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $wchar_t *fgetws(wchar_t *ws, int count, FILE *stream);$ + +Return~ +If the system is already at end of file when$fgetws()$is called, then the +contents of the array$ws$are unchanged and a null pointer is returned. A null +pointer is also returned if a read error occurs. Otherwise, the return value +is the pointer$ws$. + +Description~ +This function reads wide characters from the stream$stream$up to and including +a newline character and stores them in the string$ws$, adding a null wide +character to mark the end of the string.$count$wide characters worth of space +in$ws$must be supplied, but the number of characters read is at most +$count - 1$. The extra character space is used to hold the null wide character +at the end of the string. + + + +getwc() Macro *crv-getwc* +------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $wint_t getwc(FILE *stream);$ + +Return~ +wide character read from stream, or$WEOF$if an error or an end-of-file +condition occurred + +Description~ +This is just like$fgetwc()$, except that it is permissible for it to be +implemented as a macro that evaluates the$stream$argument more than once. +$getwc()$can be highly optimized, so it is usually the best function to use +to read a single wide character. + + + +getwchar() Macro *crv-getwchar* +---------------- +Synopsis~ + $#include <wchar.h>$ + $wint_t getwchar(void);$ + +Return~ +wide character read from stream, or$WEOF$if an error or an end-of-file +condition occurred + +Description~ +This function is equivalent to$getwc()$with$stdin$as the value of the stream +argument. + + + +ungetwc() Function *crv-ungetwc* +------------------ +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $wint_t ungetwc(wint_t wc, FILE *stream);$ + +Return~ + +Description~ +The$ungetwc()$function behaves just like$ungetc()$just that it pushes back a +wide character. + + + +fputwc() Function *crv-fputwc* +----------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $wint_t fputwc(wchar_t wc, FILE *stream);$ + +Return~ +$WEOF$is returned if a write error occurs; otherwise the character$wc$is +returned + +Description~ +This function writes the wide character$wc$to the stream$stream$. + + + +fputws() Function *crv-fputws* +----------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $int fputws(const wchar_t *ws, FILE *stream);$ + +Return~ +$WEOF$is returned if a write error occurs, otherwise a non-negative value + +Description~ +The function$fputws()$writes the wide character string$ws$to the stream +$stream$. The terminating null character is not written. This function does +not add a newline character, either. It outputs only the characters in the +string. + + + +putwc() Macro *crv-putwc* +------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $wint_t putwc(wchar_t wc, FILE *stream);$ + +Return~ +$WEOF$is returned if a write error occurs; otherwise the character$wc$is +returned + +Description~ +This is just like$fputwc()$, except that it can be implement as a macro, +making it faster. One consequence is that it may evaluate the$stream$argument +more than once, which is an exception to the general rule for macros.$putwc()$ +is usually the best function to use for writing a single wide character. + + + +putwchar() Macro *crv-putwchar* +---------------- +Synopsis~ + $#include <wchar.h>$ + $wint_t putwchar(wchar_t wc);$ + +Return~ +$WEOF$is returned if a write error occurs; otherwise the character$wc$is +returned + +Description~ +The$putwchar()$function is equivalent to$putwc()$with$stdout$as the value +of the stream argument. + + + +fwide() Function *crv-fwide* +---------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $int fwide(FILE *stream, int mode);$ + +Return~ +The$fwide()$function returns a negative value, zero, or a positive value if +the stream is narrow, not at all, or wide oriented respectively. + +Description~ +The$fwide()$function can be used to set and query the state of the orientation +of the stream$stream$. If the$mode$parameter has a positive value the streams +get wide oriented, for negative values narrow oriented. It is not possible +to overwrite previous orientations with$fwide()$. I.e., if the stream$stream$ +was already oriented before the call nothing is done. + +If$mode$is zero the current orientation state is queried and nothing is +changed. + + + + +------------------------------------------------------------------------------ +II.24.5 String Utilities *crv-libWCHStrng* + + +II.24.5.1 Numeric Conversions *crv-libWCHNum* +------------------------------ + +Quicklink: + $wcstod()$ Func |crv-wcstod| + $wcstof()$ Func |crv-wcstof| + $wcstold()$ Func |crv-wcstold| + $wcstol()$ Func |crv-wcstol| + $wcstoll()$ Func |crv-wcstoll| + $wcstoul()$ Func |crv-wcstoul| + $wcstoull()$ Func |crv-wcstoull| + + + +wcstod() Function *crv-wcstod* +wcstof() Function *crv-wcstof* +wcstold() Function *crv-wcstold* +------------------ +Synopsis~ + $#include <wchar.h>$ + $double wcstod(const wchar_t *restrict string, wchar_t **restrict tailptr);$ + $float wcstof(const wchar_t *string, wchar_t **tailptr);$ + $long double wcstold(const wchar_t *string, wchar_t **tailptr);$ + +Description~ +The$wcstod()$,$wcstof()$, and$wcstol()$functions are equivalent in nearly all +aspect to the$strtod()$,$strtof()$, and$strtold()$functions but it handles +wide character string. + + + +wcstol() Function *crv-wcstol* +wcstoll() Function *crv-wcstoll* +wcstoul() Function *crv-wcstoul* +wcstoull() Function *crv-wcstoull* +------------------- +Synopsis~ + $#include <wchar.h>$ + $long int wcstol(const wchar_t *restrict string,$ + $wchar_t **restrict tailptr, int base);$ + $long long int wcstoll(const wchar_t *restrict string,$ + $wchar_t **restrict tailptr, int base);$ + $unsigned long int wcstoul(const wchar_t *restrict string,$ + $wchar_t **restrict tailptr, int base);$ + $unsigned long long int wcstoull(const wchar_t *restrict string,$ + $wchar_t **restrict tailptr, int base);$ + +Description~ +The$wcstol()$,$wcstoll()$,$wcstoul()$,$wcstoull()$functions are equivalent in +nearly all aspectes to$strtol()$,$strstoll()$,$strtoul()$,$strtoull()$ +functions but handels wide character string. + + + + +II.24.5.2 Copying *crv-libWCHCopy* +------------------ + +Quicklink: + $wcscpy()$ Func |crv-wcscpy| + $wcsncpy()$ Func |crv-wcsncpy| + $wmemcpy()$ Func |crv-wmemcpy| + $wmemmove()$ Func |crv-wmemmove| + + +wcscpy() Function *crv-wcscpy* +----------------- +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wcscpy(wchar_t *restrict wto, const wchar_t *restrict wfrom);$ + +Return~ +value is the value of$wto$ + +Description~ +This copies wide characters from the string$wfrom$(up to and including the +terminating null wide character) into the string$wto$. Like$wmemcpy()$, this +function has undefined results if the strings overlap. + + + +wcsncpy() Function *crv-wcsncpy* +------------------ +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wcsncpy(wchar_t *restrict wto, const wchar_t *restrict wfrom,$ + $size_t size);$ + +Return~ +value is the value of$wto$ + +Description~ +This function is similar to$wcscpy()$but always copies exactly$size$wide +characters into$wto$. + +If the length of$wfrom$is more than$size$, then$wcsncpy()$copies just the +first$size$wide characters. Note that in this case there is no null +terminator written into$wto$. + +If the length of$wfrom$is less than$size$, then$wcsncpy()$copies all of +$wfrom$, followed by enough null wide characters to add up to$size$wide +characters in all. + +The behavior of$wcsncpy()$is undefined if the strings overlap. + + + +wmemcpy() Function *crv-wmemcpy* +------------------ +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wmemcpy(wchar_t *restrict wto, const wchar_t *restruct wfrom,$ + $size_t size);$ + +Return~ +value is the value of$wto$ + +Description~ +The$wmemcpy()$function copies$size$wide characters from the object beginning +at$wfrom$into the object beginning at$wto$. The behavior of this function is +undefined if the two arrays$wto$and$wfrom$overlap; use$wmemmove()$instead if +overlapping is possible. + + + +wmemmove() Function *crv-wmemmove* +------------------- +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wmemmove(wchar *wto, const wchar_t *wfrom, size_t size);$ + +Return~ +value is the value of$wto$ + +Description~ +This function copies the$size$wide characters at$wfrom$into the$size$wide +characters at$wto$, even if those two blocks of space overlap. In the case of +overlap,$memmove()$is careful to copy the original values of the wide +characters in the block at$wfrom$, including those wide characters which also +belong to the block at$wto$. + + + + +II.24.5.3 Concatenation *crv-libWCHConcat* +------------------------ + +Quicklink: + $wcscat()$ Func |crv-wcscat| + $wcsncat()$ Func |crv-wcsncat| + + +wcscat() Function *crv-wcscat* +----------------- +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wcscat(wchar_t *restrict wto, const wchar_t *restrict wfrom);$ + +Return~ +value is the value of$wto$ + +Description~ +The$wcscat()$function is similar to$wcscpy()$, except that the characters +fromw$from$are concatenated or appended to the end of$wto$, instead of +overwriting it. That is, the first character from$wfrom$overwrites the null +character marking the end of$wto$. + + + +wcsncat() Function *crv-wcsncat* +------------------ +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wcsncat(wchar_t *restrict wto, const wchar_t *restrict wfrom,$ + $size_t size);$ + +Return~ +value is the value of$wto$ + +Description~ +This function is like$wcscat()$except that not more than$size$characters +from$from$are appended to the end of$wto$. A single null character is also +always appended to$wto$, so the total allocated size of$wto$ must be at least +$size + 1$bytes longer than its initial length. + + + + +II.24.5.4 Comparison *crv-libWCHCmp* +--------------------- + +Quicklink: + $wcscmp()$ Func |crv-wcscmp| + $wcscoll()$ Func |crv-wcscoll| + $wcsncmp()$ Func |crv-wcsncmp| + $wcsxfrm()$ Func |crv-wcsxfrm| + $wmemcmp()$ Func |crv-wmemcmp| + + + +wcscmp() Function *crv-wcscmp* +----------------- +Synopsis~ + $#include <wchar.h>$ + $int wcscmp(const wchar_t *ws1, const wchar_t *ws2);$ + +Return~ +The value returned is greater than, equal to, or less than zero, accordingly +as the string pointed to by$ws1$is greater than, equal to, or less than the +string pointed to by$ws2$. + +A consequence of the ordering used by$wcscmp()$is that if$ws1$is an initial +substring of$ws2$, then$ws1$is considered to be "less than"$ws2$. + +Description~ +The$wcscmp()$function compares the wide character string$ws1$against$ws2$. + + + +wcscoll() Function *crv-wcscoll* +------------------ +Synopsis~ + $#include <wchar.h>$ + $int wcscoll(const wchar_t *ws1, const wchar_t *ws2);$ + +Return~ +The value returned is greater than, equal to, or less than zero, accordingly +as the string pointed to by$ws1$is greater than, equal to, or less than the +string pointed to by$ws2$. + +Description~ +The$wcscoll()$function is similar to$wcscmp()$but uses the collating sequence +of the current locale for collation (the$LC_COLLATE$locale). + + + +wcsncmp() Function *crv-wcsncmp* +------------------ +Synopsis~ + $#include <wchar.h>$ + $int wcsncmp(const wchar_t *ws1, const wchar_t *ws2, size_t size);$ + +Return~ +The value returned is greater than, equal to, or less than zero, accordingly +as the string pointed to by$ws1$is greater than, equal to, or less than the +string pointed to by$ws2$. + +Description~ +This function is the similar to$wcscmp()$, except that no more than$size$wide +characters are compared. In other words, if the two strings are the same in +their first$size$wide characters, the return value is zero. + + + +wcsxfrm() Function *crv-wcsxfrm* +------------------ +Synopsis~ + $#include <wchar.h>$ + $size_t wcsxfrm(wchar_t *restrict wto, const wchar_t *wfrom, size_t size);$ + +Description~ +This function is the similar to$strxfrm()$but handles wide characters. +See |crv-libstrxfrm| for further information on$strxfrm()$. + + + +wmemcmp() Function *crv-wmemcmp* +------------------ +Synopsis~ + $#include <wchar.h>$ + $int wmemcmp(const wchar_t *a1, const wchar_t *a2, size_t size);$ + +Return~ +The value returned is greater than, equal to, or less than zero, accordingly +as the string pointed to by$a1$is greater than, equal to, or less than the +string pointed to by$a2$. + +Description~ +The function$wmemcmp()$compares the$size$wide characters beginning at$a1$ +against the$size$wide characters beginning at$a2$. + + + + +II.24.5.5 Search *crv-libWCHSearch* +----------------- + +Quicklink: + $wcschr()$ Func |crv-wcschr| + $wcscspn()$ Func |crv-wcscspn| + $wcspbrk()$ Func |crv-wcspbrk| + $wcsrchr()$ Func |crv-wcsrchr| + $wcsspn()$ Func |crv-wcsspn| + $wcsstr()$ Func |crv-wcsstr| + $wcstok()$ Func |crv-wcstok| + $wmemchr()$ Func |crv-wmemchr| + + + +wcschr() Function *crv-wcschr* +----------------- +Synopsis~ + $#include <wchar.h>$ + $wchar_t * wcschr(const wchar_t *wstring, int wc);$ + +Description~ +This function is the similar to$strchr()$but handles wide character. + + + +wcscspn() Function *crv-wcscspn* +------------------ +Synopsis~ + $#include <wchar.h>$ + $size_t wcscspn(const wchar_t *wstring, const wchar_t *stopset);$ + +Description~ +This function is the similar to$strspn()$but handles wide character. + + + +wcspbrk() Function *crv-wcspbrk* +------------------ +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wcspbrk (const wchar_t *wstring, const wchar_t *stopset);$ + +Description~ +This function is the similar to$strpbrk()$but handles wide character. + + + +wcsrchr() Function *crv-wcsrchr* +------------------ +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wcsrchr (const wchar_t *wstring, wchar_t c);$ + +Description~ +This function is the similar to$strrchr()$but handles wide character. + + + +wcsspn() Function *crv-wcsspn* +----------------- +Synopsis~ + $#include <wchar.h>$ + $size_t wcsspn(const wchar_t *wstring, const wchar_t *skipset);$ + +Description~ +This function is the similar to$strspn()$but handles wide character. + + + +wcsstr() Function *crv-wcsstr* +----------------- +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wcsstr(const wchar_t *haystack, const wchar_t *needle);$ + +Description~ +This function is the similar to$strstr()$but handles wide character. + + + +wcstok() Function *crv-wcstok* +----------------- +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wcstok(wchar_t *newstring, const char *delimiters);$ + +Description~ +This function is the similar to$strtok()$but handles wide character. + + + +wmemchr() Function *crv-wmemchr* +------------------ +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wmemchr(const wchar_t *block, wchar_t wc, size_t size);$ + +Description~ +This function is the similar to$memchr()$but handles wide character. + + + + +II.24.5.6 Miscellaneous *crv-libWCHMisc* +------------------------ + +Quicklink: + $wmemset()$ Func |crv-wmemset| + $wcslen()$ Func |crv-wcslen| + + + +wcslen() Function *crv-wcslen* +----------------- +Synopsis~ + $#include <wchar.h>$ + $size_t wcslen(const wchar_t *ws);$ + +Description~ +This function is the similar to$strlen()$but handles wide character. + + + +wmemset() Function *crv-wmemset* +------------------ +Synopsis~ + $#include <wchar.h>$ + $wchar_t *wmemset(wchar_t *block, wchar_t wc, size_t size);$ + +Description~ +This function is the similar to$memset()$but handles wide character. + + + + +------------------------------------------------------------------------------ +II.24.6 Time Conversions *crv-libWCHTimeConv* + +Quicklink: + $wcsftime()$ Func |crv-wcsftime| + + + +wcsftime() Function *crv-wcsftime* +------------------- +Synopsis~ + $#include <time.h>$ + $#include <wchar.h>$ + $size_t wcsftime(wchar_t *s, size_t size, const wchar_t *template,$ + $const struct tm *brokentime);$ + +Description~ +This function is the similar to$strftime()$but handles wide character. + + + + +------------------------------------------------------------------------------ +II.24.7 Character Conversions *crv-libWCHCharConv* + +Quicklink: + $btowc()$ Func |crv-btowc| + $wctob()$ Func |crv-wctob| + $mbsinit()$ Func |crv-mbsinit| + $mbrlen()$ Fucn |crv-mbrlen| + $mbrtowc()$ Func |crv-mbrtowc| + $wcrtomb()$ Func |crv-wcrtomb| + $mbsrtowc()$ Func |crv-mbsrtowc| + $wcsrtombs()$ Func |crv-wcsrtombs| + + + +btowc() Function *crv-btowc* +---------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $wint_t btowc(int c);$ + +Return~ +If ($unsigned char$)$c$is no valid single byte multibyte character or if$c$ +is$EOF$, the function returns$WEOF$. Otherwise the wide character +representation of$c$is returned. + +Description~ +The$btowc()$function ("byte to wide character") converts a valid single byte +character$c$in the initial shift state into the wide character equivalent +using the conversion rules from the currently selected locale of the$LC_CTYPE$ +category. + + + +wctob() Function *crv-wctob* +---------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $int wctob(wint_t c);$ + +Return~ +If the multibyte representation for this character in the initial state is +exactly one byte long, the return value of this function is this character. +Otherwise the return value is$EOF$. + +Description~ +The$wctob()$function ("wide character to byte") takes as the parameter a valid +wide character. + + + +mbsinit() Function *crv-mbsinit* +------------------ +Synopsis~ + $#include <wchar.h>$ + $int mbsinit(const mbstate_t *ps);$ + +Return~ +If$ps$is a null pointer or the object is in the initial state the return value +is nonzero. Otherwise it is zero. + +Description~ +The$mbsinit()$function determines whether the state object pointed to by$ps$is +in the initial state. + + + +mbrlen() Fucntion *crv-mbrlen* +----------------- +Synopsis~ + $#include <wchar.h>$ + $size_t mbrlen(const char *restrict s, size_t n, mbstate_t *ps);$ + +Return~ +see description + +Description~ +The$mbrlen()$function ("multibyte restartable length") computes the number of +at most$n$bytes starting at$s$, which form the next valid and complete +multibyte character. + +If the next multibyte character corresponds to the NUL wide character, the +return value is 0. If the next$n$bytes form a valid multibyte character, the +number of bytes belonging to this multibyte character byte sequence is +returned. + +If the the first$n$bytes possibly form a valid multibyte character but the +character is incomplete, the return value is$(size_t) - 2$. Otherwise the +multibyte character sequence is invalid and the return value +is$(size_t) - 1$. + +The multibyte sequence is interpreted in the state represented by the object +pointed to by$ps$. If$ps$ is a null pointer, a state object local +to$mbrlen()$is used. + + + +mbrtowc() Function *crv-mbrtowc* +------------------ +Synopsis~ + $#include <wchar.h>$ + $size_t mbrtowc(wchar_t *restrict pwc, const char *restrict s,$ + $size_t n, mbstate_t *restrict ps);$ + +Return~ +see description + +Description~ +The$mbrtowc()$function ("multibyte restartable to wide character") converts +the next multibyte character in the string pointed to by$s$into a wide +character and stores it in the wide character string pointed to by$pwc$. The +conversion is performed according to the locale currently selected for +the$LC_CTYPE$category. If the conversion for the character set used in the +locale requires a state, the multibyte string is interpreted in the state +represented by the object pointed to by$ps$. If$ps$is a null pointer, a +static, internal state variable used only by the$mbrtowc()$function is used. + +If the next multibyte character corresponds to the NUL wide character, the +return value of the function is 0 and the state object is afterwards in the +initial state. If the next$n$or fewer bytes form a correct multibyte +character, the return value is the number of bytes starting from$s$that form +the multibyte character. The conversion state is updated according to the +bytes consumed in the conversion. In both cases the wide character (either +the L'\0' or the one found in the conversion) is stored in the string +pointed to by$pwc$if$pwc$is not null. + +If the first$n$bytes of the multibyte string possibly form a valid multibyte +character but there are more than$n$bytes needed to complete it, the return +value of the function is$(size_t) - 2$and no value is stored. Please note +that this can happen even if$n$has a value greater than or equal +to$MB_CUR_MAX$since the input might contain redundant shift sequences. + +If the first$n$bytes of the multibyte string cannot possibly form a valid +multibyte character, no value is stored, the global variable$errno$is set to +the value$EILSEQ$, and the function returns$(size_t) - 1$. The conversion +state is afterwards undefined. + + + +wcrtomb() Function *crv-wcrtomb* +----------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $size_t wcrtomb(char *restrict s, wchar_t wc, mbstate_t *restrict ps);$ + +Return~ +see description + +Description~ +The$wcrtomb()$function ("wide character restartable to multibyte") converts a +single wide character into a multibyte string corresponding to that wide +character. + +If$s$is a null pointer, the function resets the state stored in the objects +pointed to by$ps$(or the internal$mbstate_t$object) to the initial state. This +can also be achieved by a call like this: + + $wcrtombs(temp_buf, L'\0', ps)$ + +since, if$s$is a null pointer,$wcrtomb()$performs as if it writes into an +internal buffer, which is guaranteed to be large enough. + +If$wc$is the NUL wide character,$wcrtomb()$emits, if necessary, a shift +sequence to get the state$ps$into the initial state followed by a single +$NULL$byte, which is stored in the string$s$. + +Otherwise a byte sequence (possibly including shift sequences) is written into +the string$s$. This only happens if$wc$is a valid wide character. If$wc$is no +valid wide character, nothing is stored in the strings$s$,$errno$is set +to$EILSEQ$, the conversion state in$ps$is undefined and the return value +is$(size_t) - 1$. + +If no error occurred the function returns the number of bytes stored in the +string$s$. This includes all bytes representing shift sequences. + + + +mbsrtowc() Function *crv-mbsrtowc* +------------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $size_t mbsrtowcs(wchar_t *restrict dst, const char **restrict src,$ + $size_t len, mbstate_t *restrict ps);$ + +Return~ +see description + +Description~ +The$mbsrtowcs()$function ("multibyte string restartable to wide character +string") converts an NUL-terminated multibyte character string at$*src$into an +equivalent wide character string, including the NUL wide character at the end. +The conversion is started using the state information from the object pointed +to by$ps$or from an internal object of$mbsrtowcs()$if$ps$is a null pointer. +Before returning, the state object is updated to match the state after the +last converted character. The state is the initial state if the terminating +NUL byte is reached and converted. + +If$dst$is not a null pointer, the result is stored in the array pointed to +by$dst$; otherwise, the conversion result is not available since it is stored +in an internal buffer. + +If$len$wide characters are stored in the array$dst$before reaching the end of +the input string, the conversion stops and$len$is returned. If$dst$is a null +pointer,$len$is never checked. + +Another reason for a premature return from the function call is if the input +string contains an invalid multibyte sequence. In this case the global +variable$errno$is set to$EILSEQ$and the function returns$(size_t) - 1$. + +In all other cases the function returns the number of wide characters +converted during this call. If$dst$is not null,$mbsrtowcs()$stores in the +pointer pointed to by$src$either a null pointer (if the NUL byte in the +input string was reached) or the address of the byte following the last +converted multibyte character. + + + +wcsrtombs() Function *crv-wcsrtombs* +-------------------- +Synopsis~ + $#include <stdio.h>$ + $#include <wchar.h>$ + $size_t wcsrtombs(char *restrict dst, const wchar_t **restrict src,$ + $size_t len, mbstate_t *restrict ps);$ + +Return~ +see description + +Description~ +The$wcsrtombs()$function ("wide character string restartable to multibyte +string") converts the NUL-terminated wide character string at$*src$ into an +equivalent multibyte character string and stores the result in the array +pointed to by$dst$. The NUL wide character is also converted. The conversion +starts in the state described in the object pointed to by$ps$or by a state +object locally to$wcsrtombs()$in case$ps$is a null pointer. If$dst$is a +null pointer, the conversion is performed as usual but the result is not +available. If all characters of the input string were successfully converted +and if$dst$is not a null pointer, the pointer pointed to by$src$gets assigned +a null pointer. + +If one of the wide characters in the input string has no valid multibyte +character equivalent, the conversion stops early, sets the global variable +$errno$to$EILSEQ$, and returns$(size_t) - 1$. + +Another reason for a premature stop is if$dst$is not a null pointer and the +next converted character would require more than$len$bytes in total to the +array$dst$. In this case (and if$dest$is not a null pointer) the pointer +pointed to by$src$is assigned a value pointing to the wide character right +after the last one successfully converted. + +Except in the case of an encoding error the return value of the$wcsrtombs()$ +function is the number of bytes in all the multibyte character sequences +stored in$dst$. Before returning the state in the object pointed to by$ps$ +(or the internal object in case$ps$is a null pointer) is updated to reflect +the state after the last conversion. The state is the initial shift state +in case the terminating NUL wide character was converted. + + + + +============================================================================== +II.25 <wctype.h> Wide Character *crv-libWctypeH* + +In this section wide character classification and mapping utilities are +described. + + +------------------------------------------------------------------------------ +II.25.1 Types *crv-libWTHType* + +Quicklink: + $wctrans_t$ Type |crv-wctrans_t| + $wctype_t$ Type |crv-wctype_t| + $wint_t$ Type |crv-wint_t| + + + +wint_t Type *crv-wint_t* +----------- +This is a data type used for parameters and variables that contain a single +wide character. +Also declared in$<wchar.h>$, see |crv-libwint_t2|. + + + +wctrans_t Type *crv-wctrans_t* +-------------- +This data type is defined as a scalar type which can hold a value representing +the locale-dependent character mapping. There is no way to construct such a +value apart from using the return value of the$wctrans()$function. + + + +wctype_t Type *crv-wctype_t* +------------- +This type can hold a value which represents a character class. The only +defined way to generate such a value is by using the$wctype()$function. + + + + +------------------------------------------------------------------------------ +II.25.2 Macros *crv-libWTHMac* + + +WEOF Macro *crv-WEOF* +---------- +This macro expands to an expression of type$wint_t$that is returned by a +number of wide stream functions to indicate an end-of-file condition, or some +other error situation. +Also declared in$<wchar.t>$, see |crv-WEOF2|. + + + +------------------------------------------------------------------------------ +II.25.3 Classification *crv-libWTHClass* + + +II.25.3.1 Wide Character *crv-libWTHCwide* +------------------------- + +Quicklink: + $iswalnum()$ Func |crv-iswalnum| + $iswalpha()$ Func |crv-iswalpha| + $iswblank()$ Func |crv-iswblank| + $iswcntrl()$ Func |crv-iswcntrl| + $iswdigit()$ Func |crv-iswdigit| + $iswgraph()$ Func |crv-iswgraph| + $iswlower()$ Func |crv-iswlower| + $iswprint()$ Func |crv-iswprint| + $iswpunct()$ Func |crv-iswpunct| + $iswspace()$ Func |crv-iswspace| + $iswupper()$ Func |crv-iswupper| + $iswxdigit()$ Func |crv-iswxdigit| + + + +iswalnum() Function *crv-iswalnum* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswalnum(wint_t wc);$ + +Description~ +This function returns a nonzero value if$wc$is an alphanumeric character (a +letter or number); in other words, if either$iswalpha()$or$iswdigit()$is true +of a character, then$iswalnum()$is also true. + + + +iswalpha() Function *crv-iswalpha* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswalpha(wint_t wc);$ + +Description~ +Returns true if$wc$is an alphabetic character (a letter). If$iswlower()$or +$iswupper()$is true of a character, then$iswalpha()$is also true. + + + +iswblank() Function *crv-iswblank* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswblank(wint_t wc);$ + +Description~ +Returns true if$wc$is a blank character; that is, a space or a tab. + + + +iswcntrl() Function *crv-iswcntrl* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswcntrl(wint_t wc);$ + +Description~ +Returns true if$wc$is a control character (that is, a character that is not a +printing character). + + + +iswdigit() Function *crv-iswdigit* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswdigit(wint_t wc);$ + +Description~ +Returns true if$wc$is a digit (e.g., 0 through 9). Please note that this +function does not only return a nonzero value for decimal digits, but for +all kinds of digits. + + + +iswgraph() Function *crv-iswgraph* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswgraph(wint_t wc);$ + +Description~ +Returns true if$wc$is a graphic character; that is, a character that has a +glyph associated with it. The whitespace characters are not considered +graphic. +In other words: returns true if$iswprint()$is true and if$iswspace()$is false. + + + +iswlower() Function *crv-iswlower* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswlower(wint_t wc);$ + +Description~ +Returns true if$wc$is a lower-case letter. + + + +iswprint() Function *crv-iswprint* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswprint(wint_t wc);$ + +Description~ +Returns true if$wc$is a printing character. Printing characters include all +the graphic characters, plus the space (" ") character. + + + +iswpunct() Function *crv-iswpunct* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswpunct(wint_t wc);$ + +Description~ +Returns true if$wc$is a punctuation character. This means any printing +character that is not alphanumeric or a space character. + + + +iswspace() Function *crv-iswspace* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswspace(wint_t wc);$ + +Description~ +Returns true if$wc$is a whitespace character. In the standard "C" locale, +$iswspace()$returns true for only the standard whitespace characters: + + $L' '$ space + $L'\f'$ formfeed + $L'\n'$ newline + $L'\r'$ carriage return + $L'\t'$ horizontal tab + $L'\v'$ vertical tab + + + +iswupper() Function *crv-iswupper* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswupper(wint_t wc);$ + +Description~ +Returns true if$wc$is an upper-case letter. + + + +iswxdigit() Function *crv-iswxdigit* +-------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswxdigit(wint_t wc);$ + +Description~ +Returns true if$wc$is a hexadecimal digit. Hexadecimal digits include the +normal decimal digits 0 through 9 and the letters A through F and a through f. + + + + + +II.25.3.2 Extensible Wide Char *crv-libWTHCextens* +------------------------------- + +Quicklink: + $iswctype()$ Func |crv-iswctype| + $wctype()$ Func |crv-wctype| + + +iswctype() Function *crv-iswctype* +------------------- +Synopsis~ + $#include <wctype.h>$ + $int iswctype(wint_t wc, wctype_t desc);$ + +Description~ +This function returns a nonzero value if$wc$is in the character class +specified by$desc$.$desc$must previously be returned by a successful call +to$wctype()$. + + + +wctype() Function *crv-wctype* +----------------- +Synopsis~ + $#include <wctype.h>$ + $wctype_t wctype(const char *property);$ + +Description~ +The$wctype()$returns a value representing a class of wide characters which is +identified by the string$property$. Beside some standard properties each +locale can define its own ones. In case no$property$with the given name is +known for the current locale selected for the$LC_CTYPE$category, the function +returns zero. + +The properties known in every locale are: +$"alnum"$ +$"alpha"$ +$"cntrl"$ +$"digit"$ +$"graph"$ +$"lower"$ +$"print"$ +$"punct"$ +$"space"$ +$"upper"$ +$"xdigit"$ + + + +------------------------------------------------------------------------------ +II.25.4 Mapping *crv-libWTHMap* + + +II.25.4.1 Wide Character *crv-libWTHMwide* +------------------------- + +Quicklink: + $towlower()$ Func |crv-towlower| + $towupper()$ Func |crv-towupper| + + + +towlower() Function *crv-towlower* +------------------- +Synopsis~ + $#include <wctype.h>$ + $wint_t towlower(wint_t wc);$ + +Return~ +lower-case letter + +Description~ +If$wc$is an upper-case letter,$towlower()$returns the corresponding lower-case +letter. Otherwise$wc$is returned unchanged. + + + +towupper() Function *crv-towupper* +------------------- +Synopsis~ + $#include <wctype.h>$ + $wint_t towupper(wint_t wc);$ + +Return~ +upper-case letter + +Description~ +If$wc$is a lower-case letter,$towupper()$returns the corresponding upper-case +letter. Otherwise$wc$is returned unchanged. + + + + +II.25.4.2 Extensible Wide Char *crv-libWTHMextens* +------------------------------- + +Quicklink: + $towctrans()$ Func |crv-towctrans| + $wctrans()$ Func |crv-wctrans| + + + +towctrans() Function *crv-towctrans* +-------------------- +Synopsis~ + $#include <wctype.h>$ + $wint_t towctrans(wint_t wc, wctrans_t desc);$ + +Return~ +mapped value of$wc$ + +Description~ +This function maps the input character$wc$according to the rules of the +mapping for which$desc$is a descriptor, and returns the value it finds.$desc$ +must be obtained by a successful call to$wctrans()$. + + + +wctrans() Function *crv-wctrans* +------------------ +Synopsis~ + $#include <wctype.h>$ + $wctrans_t wctrans(const char *property);$ + +Return~ +0: mapping unknown +else: mapping known + +Description~ +This function has to be used to find out whether a named mapping is defined in +the current locale selected for the$LC_CTYPE$category. If the returned value +is non-zero, it can be used afterwards in calls to$towctrans()$. If the return +value is zero no such mapping is known in the current locale. + +Beside locale-specific mappings there are two mappings which are guaranteed +to be available in every locale: +$"tolower"$ +$"toupper"$ + + + + +============================================================================== +Appendix A GLOSSARY *crv-glossary* + + + *crv-gloAlignment* +Alignment Requirement that objects of a particular type be located on + storage boundaries with addresses that are particular + multiples of a byte address. + + *crv-gloArgument* +Argument An argument is an expression in a comma-separated list bounded + by parentheses in a function call or macro invocation. + + *crv-gloArray* +Array Set of elements that have the same data type. + + *crv-gloBinary* +Binary see Operator |crv-gloOperator| + + *crv-gloBlock* +Block C statements enclosed within braces ({...}) + + *crv-gloCompState* +Compound A compound statement is a block (see |crv-gloBlock|) +Statement + *crv-gloDataType* +Data Type see Type |crv-gloType| + + *crv-gloDeclaration* +Declaration A C construct that associates the attributes of a variable, + type or function with a name. A declaration does not need + memory, opposed to a definition (-> Definition). + + Example: +> + struct MeasVar { + int nCntr; + int nNumOfCycles; + float fResult; + }; +< + *crv-gloDefinition* +Definition A C construct that specifies the name, formal parameters, body + and return type of a function or that initializes and allocates + storage for a variable. A definition needs memory, opposed + to a declaration (-> Declaration). + + Example: +> + struct MeasVar mv; +< + *crv-gloExpression* +Expression An expression is a sequence of operators and operands that + specifies computation of a value or that designates an object + or function. + See |crv-gloOperand|, |crv-gloOperator| + + +False / True see |crv-gloTrueFalse| + + *crv-gloIdentifier* +Identifier An identifier is a name of a variable, function, macro... + Valid identifiers consists of uppercase and lowercase Latin + letters [a-z], [A-Z] and digits [0-9] and the underscore _. + They must start with a letter or underscore and must be + different to keywords. + + *crv-gloLifetime* +Lifetime The lifetime of a variable is the portion of program execution + during which storage is guaranteed to be reserved for it. + Throughout its lifetime a variable exists, has a fix address + and retains its last assigned value. + + *crv-gloLinkage* +Linkage Linkage is used to extend the scope of a variable or function + to the actual context. The keyword$extern$is used for that. + + *crv-gloLvalue* +lvalue A lvalue is an epxression that describes the location of an + object. The location is the object's lvalue. The object's rvalue + is the value stored at the location described by the lvalue. + + *crv-gloLvalueMod* +lvalue, A modifiable lvalue is an expression representing an object that +modifialbe can be changed. + A lvalue is a modifiable lvalue if: + - it has no array type + - it has no incomplete type + - it has no$const$type + - it has struct or union type and no$const$member + + *crv-gloMacro* +Macro An identifier that is equated to a text or symbolic expression + to which it is to be expanded by the preprocessor. + + *crv-gloObject* +Object An area of memory used by a variable, the contents represents + values. + + *crv-gloOperand* +Operand Parameter of an operator. + Example: + $a = b * c$ + + $*$is the operator, $a$and$b$are the operands + $b * c$is an expression + + *crv-gloOperator* +Operator An operator is used with operands to build an expression. + Example: + $a = b * c$ + + $*$is the operator, $a$and$b$are the operands + $b * c$is an expression + + An operator with two operands is called binary *crv-gloOpBinary* + e.g. *, /, +, ... + An operator with one operand is called unary. *crv-gloOpUnary* + e.g. - (sign), ++, --, .... + + *crv-gloParameter* +Parameter A parameter is the value that is passed to a function or macro. + In principle there are two ways parameters can be passed: + - By Value + This means that the function/macro works with a copy of + the parameter. Thus the value of the parameter can be + changed within the function/macro, but from caller's + view the parameter will keep its original value. + - By Reference + This means that the function/macro works with the + original parameter. Thus a caller of a function/macro + will "see" changes done to the parameter within + the function/macro. + C always uses pass by value. Use pointers to simulate a pass + by reference. + + *crv-gloPointer* +Pointer A variable that contains the address of a C element (variable, + structure, function) or memory area. + + *crv-gloPreprocessor* +Preprocessor A preprocessor is the first pass of a compiler. It does: + - read include files + - expand macros + - replace defines by their contents + - pass control directives to the compiler + + *crv-gloPromote* +Promote Promoting is a type cast from a "lower" type to a "higher" + type, e.g. from int to long. + + *crv-gloPrototype* +Prototype A function prototype is a declaration of a function that declares + the types of its parameters. + + *crv-gloRvalue* +rvalue A rvalue is the value of an expression. + See also lvalue |crv-gloLvalue|. + + *crv-gloScope* +Scope Scope is the visibility of a C element (variable, function) + within a program. The scope are the sections of a program where + an element can be referenced by name. The scope of an element + may be limited to file, function or block. + The scope of an element is determined from where it is defined. + If it is defined outside of a block, it has file scope. + If it is defined within a function prototype, it has function + scope. + If it is defined within a block, it has block scope. + + *crv-gloSemantics* +Semantics The relationships between symbols and their meanings. + + *crv-gloSideEffect* +Side-Effect During evaluation of an expression the value of a variable is + changed. Example: +> + b = (a = 2) * (a *= 3) +< + NOTE: To keep a program maintainable and readable don't use + side-effects. + + *crv-gloSignExtension* +Sign- Sign-extension is the filling of the left most bits with the +Extension state of the sign-bit when shifting right or when promoting. + + *crv-gloStatement* +Statement A statement is an expression followed by a semicolon. + see |crv-gloExpression| + + *crv-gloStructure* +Structure A set of elements that have possibly different data types. A + structure groups them together. + + *crv-gloSyntax* +Syntax A syntax describes the structure and order of the elements + of a language statement. In other words: it specifies how words + and symbols are put together to form a program. + + Example for Syntax versus Semantics: + The syntax rules of a human language could be: + - each word must be build with the characters a-z or A-Z + - words are separated by at least one space (" "). + - words must start either with an upper or lower character, + the following characters must be lower ones + - a sentence consists of words + - the first word of a sentence must start with an upper + character, the others with a lower one + - a sentence ends with a point (.) + + Following these rules, this would be a valid sentence: + "The weather is fine today." + + But this one would also be a syntactically correct + sentence: + "Thkds sdfasd ksdf dsf dfklsflsd." + + The semantics of a language connects words with meanings. + Thus the second sentence is a semantically incorrect sentence. + + So a language is defined by its semantics AND syntax. + The syntax defines how to form words and the semantics gives + words a meaning. + + *crv-gloToken* +Token Tokens are the minimal lexical elements of a programming + language. A token can be a keyword, an identifier, a constant, + a string literal, an operator or a punctuator. + + *crv-gloTrueFalse* +True / False In standard C an expression is FALSE if its value is 0, else + it is TRUE. The value of a logical TRUE is implementation + specific. + So never do something like + $if (IsWindowOpen() == TRUE)$ + instead of this do + $if (IsWindowOpen())$ + or + $if (IsWindowOpen() != FALSE)$ + + *crv-gloType* +Type The meaning of a value stored in an object or returned by a + function is determined by its type. + + *crv-gloTypeIncomplete* +Type, An incomplete type describes an object but lacks information to +incomplete determine its size. + E.g. an array type of unknown size is an incomplete type. + + *crv-gloTypeCast* +Type Cast A type cast is an operation in which an operand of one type is + converted to another type. In C the cast operator + is$(type-name)$. + Example: +> + int main(void) + { + int nVar = 42; + float fVar; + + fVar = (float)nVar; + } +< + *crv-gloUnary* +Unary see Operator |crv-gloOperator| + + *crv-gloVariable* +Variable Is the symbolic representation of a memory area. + + *crv-gloWhiteSpace* +White-Space A space, tab, carriage return, new line, vertical tab, or + formfeed character. + + + +============================================================================== +Appendix B BIBLIOGRAPHY *crv-bibliography* + +[1] "Erfolgreich programmieren mit C", 1. Auflage, 1985 + J. Anton Illik + SYBEX Verlag GmbH, Duesseldorf (Germany) + +[2] "Softwareentwicklung in C", 3. September 2001 + Klaus Schmaranz + Springer Verlag + +[3] "The GNU C Library Reference Manual", for Version 2.2.x of the GNU C + Library, Edition 0.10, last updated 2001-07-06 + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002 + Free Software Foundation, Inc. + +[4] ISO/IEC 9899:1999(E) + International Standard + Programming languages - C + Published by American National Standards Institute + + + +============================================================================== +For Appendix C COPYRIGHT & LICENSES go to |crvdoc-copyright| + + +============================================================================== +For Appendix D AUTHOR go to |crvdoc-author| + + +============================================================================== +For Appendix E CREDITS go to |crvdoc-credits| + + +============================================================================== +For Appendix F HISTORY go to |crvdoc-history| + + + +------------------------------------------------------------------------------ + vim:tw=78:ts=4:ft=help:norl: diff --git a/vimfiles/doc/crefvimdoc.txt b/vimfiles/doc/crefvimdoc.txt new file mode 100644 index 0000000..34b600d --- /dev/null +++ b/vimfiles/doc/crefvimdoc.txt @@ -0,0 +1,1742 @@ +*crefvimdoc.txt* C-Reference Manual for Vim + Vim version 6.0 + + + *crefvimdoc* + Project CRefVim + ====================== + Version 1.0.4 + 27. Nov. 2004 + + + (c) 2002-2004 by Christian Habermann + christian (at) habermann-net (point) de + + + This is a C-reference manual especially designed for the text-editor Vim. + The scripts to view and access this manual within Vim are released under + the GNU General Public License (GPL), the documentation is released under + the GNU Free Documentation License (FDL). + + In the C-reference manual most parts of the chapter about the standard C + library are based on "The GNU C Library Reference Manual", edition 0.10. + "The GNU C Library Reference Manual" is copyright (c) 1993 - 2002 by the + Free Software Foundation, Inc. + Enhancements to this GNU-manual and modifications of this GNU-manual + in context with CRefVim were done by Christian Habermann. + + In the following this file (crefvimdoc.txt) and the C-reference manual + (crefvim.txt) is an entity called "document". + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 or + any later version published by the Free Software Foundation; with the + Invariant Sections being "Free Software Needs Free Documentation" and + "GNU Lesser General Public License", the Front-Cover text being + "A Manual Supported by GNU", and with the Back-Cover text being + "You have freedom to copy and modify this manual.". + A copy of the license is included in the section entitled + "GNU Free Documentation License". + + + + Table of C o n t e n t s: + + 1. Introduction.....................|crvdoc-intro| + 2. Installation.....................|crvdoc-install| + 3. Usage............................|crvdoc-usage| + 4. Customization....................|crvdoc-customization| + 5. Limitations & Bugs...............|crvdoc-limbugs| + + Appendix + + A GLOSSARY............................|crv-glossary| + B BIBLIOGRAPHY........................|crv-bibliography| + C COPYRIGHT & LICENSES................|crvdoc-copyright| + C.1 GNU General Public License........|crvdoc-licGPL| + C.2 GNU Free Documentation License....|crvdoc-licFDL| + C.3 GNU Lesser General Public License.|crvdoc-licLGPL| + C.4 Free Software Needs Free + Documentation.....................|crvdoc-licFreeDoc| + D AUTHOR..............................|crvdoc-author| + E CREDITS.............................|crvdoc-credits| + F HISTORY.............................|crvdoc-history| + + Go to |C-Reference| + + +Happy viming... + + +============================================================================== +1. INTRODUCTION *crvdoc-intro* + +The intention of this project is to provide a C-reference manual that can +be accessed from within Vim. + +This project consists of four parts: + 1. crefvim.vim plugin to get access to the C-reference + 2. crefvimdoc.txt documentation of this project + 3. crefvim.txt a C-reference with Vim-tags for navigation + 4. help.vim an extention to the standard syntax highlighting for + help files (needed and active only for the C-reference + manual) + +The C-reference is a reference, it is NOT a tutorial or a guide on how +to write C-programs. It is a quick reference to the functions and syntax +of the standard C language. + +The project CRefVim is released under the GNU General Public License 2 +(GPL 2) or later. +The documents of the project CRefVim are released under the GNU Free +Documentation License (GNU FDL) version 1.1 or later. +For further information on licenses see |crvdoc-copyright|. + + + +============================================================================== +2. INSTALLATION *crvdoc-install* + +CRefVim consists of four files, the script 'crefvim.vim', its +documentation 'crefvimdoc.txt', the C-reference 'crefvim.txt' and a syntax +file to extend the standard syntax highlighting for help files called +'help.vim'. + +To use the script copy it into your local plugin-directory + Unix: ~/.vim/plugin + Windows: c:\vimfiles\plugin +After starting Vim this script is sourced from their automatically. + +This script can be customized in your .vimrc, for further information +see |crvdoc-customization|. + + +You have to add this documentation and the C-reference to Vim's help +system. To do this, copy both 'crefvimdoc.txt' and 'crefvim.txt' to +your local doc-directory: + Unix: ~/.vim/doc + Windows: c:\vimfiles\doc + +Then start Vim and do: + :helptags ~/.vim/doc (or :helptags c:\vimfiles\doc for Windows) + + +Finally the standard help syntax highlighting must be extended, so that +the C-reference is viewed correctly. To do so, copy the file 'help.vim' to +your local after/syntax directory: + Unix: ~/.vim/after/syntax + Windows: c:\vimfiles\after\syntax + +This extention of the help syntax file is only active for the C-reference +manual. + + +That's all to do. + + +General Hint: If the console version of Vim is used, the background color + of Vim and the background color of the console should be the + same. If so, the control characters used in help-files to do + some syntax-highlighting are not visible. + + + +============================================================================== +3. USAGE *crvdoc-usage* + +There are several ways to specify a word CRefVim should search for in order +to view help: + + <Leader>cr normal mode: get help for word under cursor + Memory aid cr: (c)-(r)eference + <Leader>cr visual mode: get help for visually selected text + Memory aid cr: (c)-(r)eference + <Leader>cw: prompt for word CRefVim should search for + Memory aid cw: (c)-reference (w)hat + <Leader>cc: jump to table of contents of the C-reference manual + Memory aid cc: (c)-reference (c)ontents + +Note: by default <Leader> is \, e.g. press \cr to invoke C-reference + +Note: The best way to search for an operator (++, --, %, ...) is to visually +select it and press <Leader>cr. + + + +============================================================================== +4. CUSTOMIZATION *crvdoc-customization* + +The key-maps used to invoke CRefVim can be customized. To do so set the +following variables in your .vimrc-file. If they are not set, defaults are +taken. + + - <Plug>CRV_CRefVimVisual + mapping to start search for visually selected text + default: + vmap <silent> <unique> <Leader>cr <Plug>CRV_CRefVimVisual + + - <Plug>CRV_CRefVimNormal + mapping to start search for text under cursor + default: + nmap <silent> <unique> <Leader>cr <Plug>CRV_CRefVimNormal + + - <Plug>CRV_CRefVimAsk + mapping to ask for word to search for + default: + map <silent> <unique> <Leader>cw <Plug>CRV_CRefVimAsk + + - <Plug>CRV_CRefVimInvoke + mapping to let Vim jump to the contents of the C-reference manual + default: + map <silent> <unique> <Leader>cc <Plug>CRV_CRefVimInvoke + + + +============================================================================== +5. LIMITATIONS & BUGS *crvdoc-limbugs* + + +------------------------------------------------------------------------------ +5.1 Script *crvdoc-lbScript* + +Known limitations: + none + +Known bugs: + none - well, up to now ;-) + + +------------------------------------------------------------------------------ +5.2 C-Reference *crvdoc-lbCRef* + +Known incorrectnesses: + none + + + +============================================================================== +For Appendix A GLOSSARY go to |crv-glossary| + + + +============================================================================== +For Appendix B BIBLIOGRAPHY go to |crv-bibliography| + + + +============================================================================== +Appendix C COPYRIGHT & LICENSES *crvdoc-copyright* + + +CRefVim is copyright (c) 2002-2004 by Christian Habermann + +The scripts of the project CRefVim are released under the GNU General Public +License 2 (GPL 2) or later (see |crvdoc-licGPL| for license). + +The documents of the project CRefVim are released under the GNU Free +Documentation License (GNU FDL) version 1.1 or later (see |crvdoc-licFDL| for +license). + +The most sections about the standard C library functions, macros and types +were extracted from "The GNU C Library Reference Manual", edition 0.10. +"The GNU C Library Reference Manual" is copyright (c) 1993 - 2002 by the +Free Software Foundation, Inc. + + + + +Scripts of the project CRefVim: +------------------------------- +Copyright (c) 2002-2004 by Christian Habermann. + + +All scripts of CRefVim are an entity called "program": + + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2 of the License, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warrenty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + +Documents of the project CRefVim: +--------------------------------- +Copyright (c) 2002-2004 by Christian Habermann. + + +This file and the C-reference manual is an entity called "document": + + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Free Software Needs Free Documentation" and +"GNU Lesser General Public License", the Front-Cover text being +"A Manual Supported by GNU", and with the Back-Cover text being +"You have freedom to copy and modify this manual.". +A copy of the license is included in the section entitled +"GNU Free Documentation License". + + + +------------------------------------------------------------------------------ +Appendix C.1 GNU General Public License *crvdoc-licGPL* + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + + + +------------------------------------------------------------------------------ +Appendix C.2 GNU Free Documentation License *crvdoc-licFDL* + + + GNU Free Documentation License + Version 1.1, March 2000 + + Copyright (C) 2000 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + +0. PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +written document "free" in the sense of freedom: to assure everyone +the effective freedom to copy and redistribute it, with or without +modifying it, either commercially or noncommercially. Secondarily, +this License preserves for the author and publisher a way to get +credit for their work, while not being considered responsible for +modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +1. APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work that contains a +notice placed by the copyright holder saying it can be distributed +under the terms of this License. The "Document", below, refers to any +such manual or work. Any member of the public is a licensee, and is +addressed as "you". + +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (For example, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. + +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. + +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, whose contents can be viewed and edited directly and +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup has been designed to thwart or discourage +subsequent modification by readers is not Transparent. A copy that is +not "Transparent" is called "Opaque". + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML designed for human modification. Opaque formats include +PostScript, PDF, proprietary formats that can be read and edited only +by proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML produced by some word processors for output +purposes only. + +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + + +2. VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +3. COPYING IN QUANTITY + +If you publish printed copies of the Document numbering more than 100, +and the Document's license notice requires Cover Texts, you must enclose +the copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a publicly-accessible computer-network location containing a complete +Transparent copy of the Document, free of added material, which the +general network-using public has access to download anonymously at no +charge using public-standard network protocols. If you use the latter +option, you must take reasonably prudent steps, when you begin +distribution of Opaque copies in quantity, to ensure that this +Transparent copy will remain thus accessible at the stated location +until at least one year after the last time you distribute an Opaque +copy (directly or through your agents or retailers) of that edition to +the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + + +4. MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has less than five). +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section entitled "History", and its title, and add to + it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. In any section entitled "Acknowledgements" or "Dedications", + preserve the section's title, and preserve in the section all the + substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section as "Endorsements" + or to conflict in title with any Invariant Section. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +5. COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections entitled "History" +in the various original documents, forming one section entitled +"History"; likewise combine any sections entitled "Acknowledgements", +and any sections entitled "Dedications". You must delete all sections +entitled "Endorsements." + + +6. COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + + +7. AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, does not as a whole count as a Modified Version +of the Document, provided no compilation copyright is claimed for the +compilation. Such a compilation is called an "aggregate", and this +License does not apply to the other self-contained works thus compiled +with the Document, on account of their being thus compiled, if they +are not themselves derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one quarter +of the entire aggregate, the Document's Cover Texts may be placed on +covers that surround only the Document within the aggregate. +Otherwise they must appear on covers around the whole aggregate. + + +8. TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License provided that you also include the +original English version of this License. In case of a disagreement +between the translation and the original English version of this +License, the original English version will prevail. + + +9. TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + + +10. FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + + +ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + +If you have no Invariant Sections, write "with no Invariant Sections" +instead of saying which ones are invariant. If you have no +Front-Cover Texts, write "no Front-Cover Texts" instead of +"Front-Cover Texts being LIST"; likewise for Back-Cover Texts. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + + + +------------------------------------------------------------------------------ +Appendix C.3 GNU Lesser General Public License *crvdoc-licLGPL* + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + + +------------------------------------------------------------------------------ +Appendix C.4 Free Software Needs Free Documentation *crvdoc-licFreeDoc* + + +The biggest deficiency in the free software community today is not in the +software - it is the lack of good free documentation that we can include with +the free software. Many of our most important programs do not come with free +reference manuals and free introductory texts. Documentation is an essential +part of any software package; when an important free software package does not +come with a free manual and a free tutorial, that is a major gap. We have many +such gaps today. + +Consider Perl, for instance. The tutorial manuals that people normally use are +non-free. How did this come about? Because the authors of those manuals +published them with restrictive terms - no copying, no modification, source +files not available - which exclude them from the free software world. + +That wasn't the first time this sort of thing happened, and it was far from +the last. Many times we have heard a GNU user eagerly describe a manual that +he is writing, his intended contribution to the community, only to learn that +he had ruined everything by signing a publication contract to make it +non-free. + +Free documentation, like free software, is a matter of freedom, not price. The +problem with the non-free manual is not that publishers charge a price for +printed copies - that in itself is fine. (The Free Software Foundation sells +printed copies of manuals, too.) The problem is the restrictions on the use of +the manual. Free manuals are available in source code form, and give you +permission to copy and modify. Non-free manuals do not allow this. + +The criteria of freedom for a free manual are roughly the same as for free +software. Redistribution (including the normal kinds of commercial +redistribution) must be permitted, so that the manual can accompany every copy +of the program, both on-line and on paper. + +Permission for modification of the technical content is crucial too. When +people modify the software, adding or changing features, if they are +conscientious they will change the manual too - so they can provide accurate +and clear documentation for the modified program. A manual that leaves you no +choice but to write a new manual to document a changed version of the program +is not really available to our community. + +Some kinds of limits on the way modification is handled are acceptable. For +example, requirements to preserve the original author's copyright notice, the +distribution terms, or the list of authors, are ok. It is also no problem to +require modified versions to include notice that they were modified. Even +entire sections that may not be deleted or changed are acceptable, as long as +they deal with nontechnical topics (like this one). These kinds of +restrictions are acceptable because they don't obstruct the community's normal +use of the manual. + +However, it must be possible to modify all the technical content of the +manual, and then distribute the result in all the usual media, through all the +usual channels. Otherwise, the restrictions obstruct the use of the manual, it +is not free, and we need another manual to replace it. + +Please spread the word about this issue. Our community continues to lose +manuals to proprietary publishing. If we spread the word that free software +needs free reference manuals and free tutorials, perhaps the next person who +wants to contribute by writing documentation will realize, before it is too +late, that only free manuals contribute to the free software community. + +If you are writing documentation, please insist on publishing it under the +GNU Free Documentation License or another free documentation license. Remember +that this decision requires your approval - you don't have to let the +publisher decide. Some commercial publishers will use a free license if you +insist, but they will not propose the option; it is up to you to raise the +issue and say firmly that this is what you want. If the publisher you are +dealing with refuses, please try other publishers. If you're not sure whether +a proposed license is free, write to licensing@gnu.org. + +You can encourage commercial publishers to sell more free, copylefted manuals +and tutorials by buying them, and particularly by buying copies from the +publishers that paid for their writing or for major improvements. Meanwhile, +try to avoid buying non-free documentation at all. Check the distribution +terms of a manual before you buy it, and insist that whoever seeks your +business must respect your freedom. Check the history of the book, and try +reward the publishers that have paid or pay the authors to work on it. + +The Free Software Foundation maintains a list of free documentation published +by other publishers, at <http://www.fsf.org/doc/other-free-books.html>. + + + +============================================================================== +Appendix D AUTHOR *crvdoc-author* + +Author of CRefVim is Christian Habermann. For contact, write to: + + christian (at) habermann-net (point) de + + + +============================================================================== +Appendix E CREDITS *crvdoc-credits* + + +- Credit must go out to Bram Moolenaar and all the Vim developers for making + Vim to an excellent tool. + +- Credit must go out to the Free Software Foundation for specifying the + GNU Free Documentation License (GNU FDL) and for releasing "The GNU C + Library Reference Manual" under the GNU FDL. + "The GNU C Library Reference Manual" is copyright (c) 1993 - 2002 by the + Free Software Foundation, Inc. + +- Special thanks to Richard Stallman for helping me to release this + project in a way that is conform to the license of "The GNU C Library + Reference Manual". + He also gave permission to alter the Front-Cover text and the Back-Cover + text specified by the GNU FDL of "The GNU C Library Reference Manual" to: + Front-Cover text: "A Manual Supported by GNU" + Back-Cover text: "You have freedom to copy and modify this manual." + + (Original: + Front-Cover text: "A GNU Manual" + Back-Cover text: "You have freedom to copy and modify this GNU Manual, + like GNU software. Copies published by the Free + Software Foundation raise funds for GNU development." + ) + + + +============================================================================== +Appendix F HISTORY *crvdoc-history* + +Project CRefVim + + The most sections about the standard C library functions, macros and types + were extracted from "The GNU C Library Reference Manual", edition 0.10. + "The GNU C Library Reference Manual" is copyright (c) 1993 - 2002 by the + Free Software Foundation, Inc. + At http://www.gnu.org/manual/glibc-2.2.5/libc.html the original version + of this manual can be found. + + + - V 0.1.0 12. Dec. 2002 - 23. Feb. 2003 + initial version, no release + tested under Linux (vim, gvim 6.1) and Win98SE (gvim 6.1) + Consists of: + crefvim.vim V 0.1.0, initial version + crefvimdoc.txt V 0.1.0, initial version + crefvim.txt V 0.1.0, initial version + help.vim V 0.1.0, initial version + + + - V 0.2.0 5. Apr. 2003 + no release + tested under Linux (vim, gvim 6.1) and Win98SE (gvim 6.1) + Consists of: + crefvim.vim V 0.2.0 + - "Appendix D AUTHOR" added + crefvimdoc.txt V 0.2.0 + - "Appendix D AUTHOR" added + - License GNU FDL 1.1 instead of 1.2, since License is an invariant + section of the GNU manual. To avoid to include both 1.1 and 1.2, + I released the documents under 1.1. + - CREDITS extended + crefvim.txt V 0.1.0, not changed + help.vim V 0.1.0, not changed + + + - V 1.0.0 6. Apr. 2003 + no changes, first release + Consists of: + crefvim.vim V 1.0.0 + crefvimdoc.txt V 1.0.0 + crefvim.txt V 1.0.0 + help.vim V 1.0.0 + + + - V 1.0.1 13. Apr. 2003 + crefvimdoc.txt: + - bug-fix in description of installation: + destination of help.vim is after/syntax + Unix: ~/.vim/after/syntax + Windows: c:\vimfiles\after\syntax + (was syntax/after) + + Consists of: + crefvim.vim V 1.0.0 not changed + crefvimdoc.txt V 1.0.1 changed + crefvim.txt V 1.0.0 not changed + help.vim V 1.0.0 not changed + + + - V 1.0.2 15. Dec. 2003 + crefvimdoc.txt: some typos fixed + crefvim.txt: some typos fixed + + Consists of: + crefvim.vim V 1.0.0 not changed + crefvimdoc.txt V 1.0.2 changed + crefvim.txt V 1.0.1 changed + help.vim V 1.0.0 not changed + + + - V 1.0.3 4. Mar. 2004 + crefvimdoc.txt: copyright and version-numbers updated + + crefvim.txt: - marker for syntax-highlighting changed from 0xa7 to $ + in order to avoid problems with fonts that use + codes > 0x7f as multibyte characters (e.g. Chinese, + Korean, Japanese... fonts) + - two typos fixed + - three bad tags corrected + + help.vim: syntax-highlighting adapted to new marker + + Consists of: + crefvim.vim V 1.0.0 not changed + crefvimdoc.txt V 1.0.3 changed + crefvim.txt V 1.0.2 changed + help.vim V 1.0.1 changed + + + - V 1.0.4 27. Nov. 2004 + crefvimdoc.txt: history and version numbers updated + + crefvim.txt: - I.5.13.2: example on how to assign an absolute address + to a function pointer added + - I.5.12: hint on volatile added + - dead tag corrected + + Consists of: + crefvim.vim V 1.0.0 not changed + crefvimdoc.txt V 1.0.4 changed + crefvim.txt V 1.0.3 changed + help.vim V 1.0.1 not changed + + + +------------------------------------------------------------------------------ + vim:tw=78:ts=4:ft=help:norl: diff --git a/vimfiles/doc/pi_getscript.txt b/vimfiles/doc/pi_getscript.txt new file mode 100644 index 0000000..22facbc --- /dev/null +++ b/vimfiles/doc/pi_getscript.txt @@ -0,0 +1,406 @@ +*pi_getscript.txt* For Vim version 7.0. Last change: 2006 Nov 1 +> + GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr. +< +Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz> + (remove NOSPAM from the email address) + *GetLatestVimScripts-copyright* +Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *glvs-copyright* + The VIM LICENSE applies to getscript.vim and + pi_getscript.txt (see |copyright|) except use + "getscript" instead of "Vim". No warranty, express or implied. + Use At-Your-Own-Risk. + +Getscript is a plugin that simplifies retrieval of the latest versions of the +scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will +then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to +get the latest versions of scripts listed therein from http://vim.sf.net/. + +============================================================================== +1. Contents *glvs-contents* *glvs* *getscript* + *GetLatestVimScripts* + + 1. Contents........................................: |glvs-contents| + 2. GetLatestVimScripts -- Getting Started..........: |glvs-install| + 3. GetLatestVimScripts Usage.......................: |glvs-usage| + 4. GetLatestVimScripts Data File...................: |glvs-data| + 5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins| + 6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall| + 7. GetLatestViMScripts Options.....................: |glvs-options| + 8. GetLatestVimScripts Algorithm...................: |glvs-alg| + 9. GetLatestVimScripts History.....................: |glvs-hist| + + +============================================================================== +2. GetLatestVimScripts -- Getting Started *getscript-start* + *getlatestvimscripts-install* + + VERSION FROM VIM DISTRIBUTION *glvs-dist-install* + +Vim 7.0 does not include the GetLatestVimScripts.dist file which +serves as an example and a template. So, you'll need to create +your own! See |GetLatestVimScripts_dat|. + + VERSION FROM VIM SF NET *glvs-install* + +NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist +file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for +the first time. + +The GetLatestVimScripts.dist file serves as an example and a template for your +own personal list. Feel free to remove all the scripts mentioned within it; +the "important" part of it is the first two lines. + +Your computer needs to have wget for GetLatestVimScripts to do its work. + + 1. if compressed: gunzip getscript.vba.gz + 2. Unix: + vim getscript.vba + :so % + :q + cd ~/.vim/GetLatest + mv GetLatestVimScripts.dist GetLatestVimScripts.dat + (edit GetLatestVimScripts.dat to install your own personal + list of desired plugins -- see |GetLatestVimScripts_dat|) + + 3. Windows: + vim getscript.vba + :so % + :q + cd **path-to-vimfiles**/GetLatest + mv GetLatestVimScripts.dist GetLatestVimScripts.dat + (edit GetLatestVimScripts.dat to install your own personal + list of desired plugins -- see |GetLatestVimScripts_dat|) + + +============================================================================== +3. GetLatestVimScripts Usage *glvs-usage* *:GLVS* + +Unless its been defined elsewhere, > + :GLVS +will invoke GetLatestVimScripts(). If some other plugin has defined that +command, then you may type +> + :GetLatestVimScripts +< +The script will attempt to update and, if permitted, will automatically +install scripts from http://vim.sourceforge.net/. To do so it will peruse a +file, +> + .vim/GetLatest/GetLatestVimScripts.dat (unix) +< +or > + ..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows) +(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin +directory (see |glvs-plugins|). + +Scripts which have been downloaded will appear in the +~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows) +subdirectory. GetLatestVimScripts will attempt to automatically +install them if you have the following line in your <.vimrc>: > + + let g:GetLatestVimScripts_allowautoinstall=1 + +The <GetLatestVimScripts.dat> file will be automatically be updated to +reflect the latest version of script(s) so downloaded. +(also see |glvs-options|) + + +============================================================================== +4. GetLatestVimScripts Data File *getscript-data* *glvs-data* + *:GetLatestVimScripts_dat* +The data file <GetLatestVimScripts.dat> must have for its first two lines +the following text: +> + ScriptID SourceID Filename + -------------------------- +< +Following those two lines are three columns; the first two are numeric +followed by a text column. The GetLatest/GetLatestVimScripts.dist file +contains an example of such a data file. Anything following a #... is +ignored, so you may embed comments in the file. + +The first number on each line gives the script's ScriptID. When you're about +to use a web browser to look at scripts on http://vim.sf.net/, just before you +click on the script's link, you'll see a line resembling + + http://vim.sourceforge.net/scripts/script.php?script_id=40 + +The "40" happens to be a ScriptID that GetLatestVimScripts needs to +download the associated page. + +The second number on each line gives the script's SourceID. The SourceID +records the count of uploaded scripts as determined by vim.sf.net; hence it +serves to indicate "when" a script was uploaded. Setting the SourceID to 1 +insures that GetLatestVimScripts will assume that the script it has is +out-of-date. + +The SourceID is extracted by GetLatestVimScripts from the script's page on +vim.sf.net; whenever its greater than the one stored in the +GetLatestVimScripts.dat file, the script will be downloaded +(see |GetLatestVimScripts_dat|). + +If your script's author has included a special comment line in his/her plugin, +the plugin itself will be used by GetLatestVimScripts to build your +<GetLatestVimScripts.dat> file, including any dependencies on other scripts it +may have. As an example, consider: > + + " GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim + +This comment line tells getscript.vim to check vimscript #884 and that the +script is automatically installable. Getscript will also use this line to +help build the GetLatestVimScripts.dat file, by including a line such as: > + + 884 1 AutoAlign.vim +< +in it an AutoAlign.vim line isn't already in GetLatestVimScripts.dat file. +See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a +comprehensive ability to keep your plugins up-to-date! + + *GetLatestVimScripts_dat* +As an example of a <GetLatestVimScripts.dat> file: +> + ScriptID SourceID Filename + -------------------------- + 294 1 Align.vim + 120 2 decho.vim + 40 3 DrawIt.tar.gz + 451 4 EasyAccents.vim + 195 5 engspchk.vim + 642 6 GetLatestVimScripts.vim + 489 7 Manpageview.vim +< +Note: the first two lines are required, but essentially act as comments. + + +============================================================================== +5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins* + +If a plugin author includes the following comment anywhere in their plugin, +GetLatestVimScripts will find it and use it to automatically build the user's +GetLatestVimScripts.dat files: +> + src_id + v + " GetLatestVimScripts: ### ### yourscriptname + ^ + scriptid +< +As an author, you should include such a line in to refer to your own script +plus any additional lines describing any plugin dependencies it may have. +Same format, of course! + +If your command is auto-installable (see |glvs-autoinstall|), and most scripts +are, then you may include :AutoInstall: at the start of "yourscriptname". + +GetLatestVimScripts commands for those scripts are then appended, if not +already present, to the user's GetLatest/GetLatestVimScripts.dat file. Its a +relatively painless way to automate the acquisition of any scripts your +plugins depend upon. + +Now, as an author, you probably don't want GetLatestVimScripts to download +your own scripts for you yourself, thereby overwriting your not-yet-released +hard work. GetLatestVimScripts provides a solution for this: put +> + 0 0 yourscriptname +< +into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip +examining the "yourscriptname" scripts for those GetLatestVimScripts comment +lines. As a result, those lines won't be inadvertently installed into your +<GetLatestVimScripts.dat> file and subsequently used to download your own +scripts. This is especially important to do if you've included the +:AutoInstall: option. + +Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line +as you've used in your GetLatestVimScripts comment! + + +============================================================================== +6. GetLatestVimScripts AutoInstall *getscript-autoinstall* + *glvs-autoinstall* + +GetLatestVimScripts now supports "AutoInstall". Not all scripts are +supportive of auto-install, as they may have special things you need to do to +install them (please refer to the script's "install" directions). On the +other hand, most scripts will be auto-installable. + +To let GetLatestVimScripts do an autoinstall, the data file's comment field +should begin with (surrounding blanks are ignored): > + + :AutoInstall: +< +Both colons are needed, and it should begin the comment (yourscriptname) +field. + +One may prevent any autoinstalling by putting the following line in your +<.vimrc>: > + + let g:GetLatestVimScripts_allowautoinstall= 0 +< +With :AutoInstall: enabled, as it is by default, files which end with + + ---.tar.bz2 : decompressed & untarred in .vim/ directory + ---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it + ---.vim.bz2 : decompressed & moved into .vim/plugin directory + ---.tar.gz : decompressed & untarred in .vim/ directory + ---.vba.gz : decompressed in .vim/ directory, then vimball handles it + ---.vim.gz : decompressed & moved into .vim/plugin directory + ---.vba : unzipped in .vim/ directory + ---.vim : moved to .vim/plugin directory + ---.zip : unzipped in .vim/ directory + +and which merely need to have their components placed by the untar/gunzip or +move-to-plugin-directory process should be auto-installable. Vimballs, of +course, should always be auto-installable. + +When is a script not auto-installable? Let me give an example: + + .vim/after/syntax/blockhl.vim + +The <blockhl.vim> script provides block highlighting for C/C++ programs; it is +available at: + + http://vim.sourceforge.net/scripts/script.php?script_id=104 + +Currently, vim's after/syntax only supports by-filetype scripts (in +blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would +possibly overwrite the current user's after/syntax/c.vim file. + +In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to +allow a after/syntax/c/ directory: + + http://vim.sourceforge.net/scripts/script.php?script_id=1023 + +The script allows multiple syntax files to exist separately in the +after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an +appropriate tarball for auto-install because of the potential for the +after/syntax/c.vim contained in it to overwrite a user's c.vim. + + +============================================================================== +7. GetLatestVimScripts Options *glvs-options* +> + g:GetLatestVimScripts_wget +< default= "wget" + This variable holds the name of the command for obtaining + scripts. +> + g:GetLatestVimScripts_options +< default= "-q -O" + This variable holds the options to be used with the + g:GetLatestVimScripts_wget command. +> + g:getLatestVimScripts_allowautoinstall +< default= 1 + This variable indicates whether GetLatestVimScripts is allowed + to attempt to automatically install scripts. Note that it + doesn't understand vimballs (yet). Furthermore, the plugin + author has to have explicitly indicated that his/her plugin + is automatically installable. + + +============================================================================== +8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg* + +The Vim sourceforge page dynamically creates a page by keying off of the +so-called script-id. Within the webpage of + + http://vim.sourceforge.net/scripts/script.php?script_id=40 + +is a line specifying the latest source-id (src_id). The source identifier +numbers are always increasing, hence if the src_id is greater than the one +recorded for the script in GetLatestVimScripts then its time to download a +newer copy of that script. + +GetLatestVimScripts will then download the script and update its internal +database of script ids, source ids, and scriptnames. + +The AutoInstall process will: + + Move the file from GetLatest/ to the following directory + Unix : $HOME/.vim + Windows: $HOME\vimfiles + if the downloaded file ends with ".bz2" + bunzip2 it + else if the downloaded file ends with ".gz" + gunzip it + if the resulting file ends with ".zip" + unzip it + else if the resulting file ends with ".tar" + tar -oxvf it + else if the resulting file ends with ".vim" + move it to the plugin subdirectory + + +============================================================================== +9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1 + +v23 Nov 03, 2006 : * ignores comments (#...) + * handles vimballs +v22 Oct 13, 2006 : * supports automatic use of curl if wget is not + available +v21 May 01, 2006 : * now takes advantage of autoloading. +v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use; + unzip needs the -o flag to overwrite. +v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong + script! Fixed. +v18 Mar 21, 2005 : * bugfix to automatic database construction + * bugfix - nowrapscan caused an error + (tnx to David Green for the fix) + Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in + :AutoInstall:s, even though its o/s is windows + Apr 01, 2005 * when downloading errors occurred, GLVS was + terminating early. It now just goes on to trying + the next script (after trying three times to + download a script description page) + Apr 20, 2005 * bugfix - when a failure to download occurred, + GetLatestVimScripts would stop early and claim that + everything was current. Fixed. +v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which + defaults to 1, can be used to prevent all + :AutoInstall: +v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent + * fixed bug with :AutoInstall: use of helptags +v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't + always preventing downloads (just usually). Fixed. +v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than + s:dotvim. Fixed. +v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid + is zero. Useful for script authors; that way their + own GetLatestVimScripts activity won't overwrite + their scripts. +v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that + was intended only for testing. Removed, now works. + * :AutoInstall: implemented +v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin: + * :GetLatestVimScripts command + * (runtimepath)/GetLatest/GetLatestVimScripts.dat + now holds scripts that need updating +v10 Apr 19, 2004 : * moved history from script to doc +v9 Jan 23, 2004 : windows (win32/win16/win95) will use + double quotes ("") whereas other systems will use + single quotes ('') around the urls in calls via wget +v8 Dec 01, 2003 : makes three tries at downloading +v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id=" + not found in downloaded webpage + Uses t_ti, t_te, and rs to make progress visible +v6 Aug 06, 2003 : final status messages now display summary of work + ( "Downloaded someqty scripts" or + "Everything was current") + Now GetLatestVimScripts is careful about downloading + GetLatestVimScripts.vim itself! + (goes to <NEW_GetLatestVimScripts.vim>) +v5 Aug 04, 2003 : missing an endif near bottom +v4 Jun 17, 2003 : redraw! just before each "considering" message +v3 May 27, 2003 : Protects downloaded files from errant shell + expansions with single quotes: '...' +v2 May 14, 2003 : extracts name of item to be obtained from the + script file. Uses it instead of comment field + for output filename; comment is used in the + "considering..." line and is now just a comment! + * Fixed a bug: a string-of-numbers is not the + same as a number, so I added zero to them + and they became numbers. Fixes comparison. + +============================================================================== +vim:tw=78:ts=8:ft=help:fdm=marker diff --git a/vimfiles/doc/pi_netrw.txt b/vimfiles/doc/pi_netrw.txt new file mode 100644 index 0000000..328321c --- /dev/null +++ b/vimfiles/doc/pi_netrw.txt @@ -0,0 +1,2133 @@ +*pi_netrw.txt* For Vim version 7.0. Last change: 2007 Mar 21 + + ----------------------------------------------------- + NETRW REFERENCE MANUAL by Charles E. Campbell, Jr. + ----------------------------------------------------- + + +*dav* *http* *network* *Nwrite* *netrw-file* +*fetch* *netrw* *Nread* *rcp* *scp* +*ftp* *netrw.vim* *Nsource* *rsync* *sftp* + +============================================================================== +1. Contents *netrw-contents* + +1. Contents.............................................|netrw-contents| +2. Starting With Netrw..................................|netrw-start| +3. Netrw Reference......................................|netrw-ref| + CONTROLLING EXTERNAL APPLICATIONS..................|netrw-externapp| + READING............................................|netrw-read| + WRITING............................................|netrw-write| + DIRECTORY LISTING..................................|netrw-dirlist| + CHANGING THE USERID AND PASSWORD...................|netrw-chgup| + VARIABLES..........................................|netrw-variables| + PATHS..............................................|netrw-path| +4. Network-Oriented File Transfer.......................|netrw-xfer| + NETRC..............................................|netrw-netrc| + PASSWORD...........................................|netrw-passwd| +5. Activation...........................................|netrw-activate| +6. Transparent File Transfer............................|netrw-transparent| +7. Ex Commands..........................................|netrw-ex| +8. Variables and Options................................|netrw-var| +9. Directory Browsing...................................|netrw-browse| {{{1 + Maps...............................................|netrw-maps| + Exploring..........................................|netrw-explore-cmds| + Quick Reference Commands Table.....................|netrw-browse-cmds| + Netrw Browser Variables............................|netrw-browse-var| + Introduction To Directory Browsing.................|netrw-browse-intro| + Netrw Browsing And Option Incompatibilities........|netrw-incompatible| + Directory Exploring Commands.......................|netrw-explore| + Refreshing The Listing.............................|netrw-ctrl-l| + Going Up...........................................|netrw--| + Browsing...........................................|netrw-cr| + Obtaining A File...................................|netrw-O| + Change Listing Style...............................|netrw-i| + Making A New Directory.............................|netrw-d| + Deleting Files Or Directories......................|netrw-D| + Renaming Files Or Directories......................|netrw-move| + Hiding Files Or Directories........................|netrw-a| + Edit File Or Directory Hiding List.................|netrw-ctrl-h| + Browsing With A Horizontally Split Window..........|netrw-o| + Browsing With A Vertically Split Window............|netrw-v| + Browsing With A New Tab............................|netrw-t| + Preview Window.....................................|netrw-p| + Selecting Sorting Style............................|netrw-s| + Editing The Sorting Sequence.......................|netrw-S| + Reversing Sorting Order............................|netrw-r| + Changing To A Predecessor Directory................|netrw-u| + Changing To A Successor Directory..................|netrw-U| + Customizing Browsing With A User Function..........|netrw-x| + Making The Browsing Directory The Current Directory|netrw-c| + Bookmarking A Directory............................|netrw-mb| + Changing To A Bookmarked Directory.................|netrw-gb| + Listing Bookmarks And History......................|netrw-q| + Improving Directory Browsing.......................|netrw-listhack| }}}1 +10. Problems and Fixes...................................|netrw-problems| +11. Debugging............................................|netrw-debug| +12. History..............................................|netrw-history| +13. Credits..............................................|netrw-credits| + +The Netrw plugin is generally sourced automatically as it is a +|standard-plugin|. That said, to make use of netrw, one must +have plugins available which can be done with the following +two lines in your <.vimrc>: > + + set nocp " 'compatible' is not set + filetype plugin on " plugins are enabled +< +You can avoid loading this plugin by setting the "loaded_netrw" variable +in your <.vimrc> file: > + + :let loaded_netrw = 1 + +{Vi does not have any of this} + +============================================================================== +2. Starting With Netrw *netrw-start* + +Netrw makes reading, writing, and browsing over a network connection easy! +First, make sure that you have plugins enabled, so you'll need to have at +least the following in your <.vimrc>: (or see |netrw-activate|) > + + set nocp " 'compatible' is not set + filetype plugin on " plugins are enabled +< +(see |'cp'| and |:filetype-plugin-on|) + +Netrw supports "transparent" editing of files on other machines using urls +(see |netrw-transparent|). As an example of this, let's assume you have an +account on some other machine; try > + + vim scp://hostname/path/to/file +< +if you have an ssh connection. Want to make ssh/scp easier to use? Check +out |netrw-listhack|! + +What if you have ftp, not ssh/scp? That's easy, too; try > + + vim ftp://hostname/path/to/file +< +Want to make ftp simpler to use? See if your ftp supports a file called +<.netrc> -- typically it goes in your home directory, has read/write +permissions for only the user to read (ie. not group, world, other, etc), +and has lines resembling > + + machine HOSTNAME login USERID password "PASSWORD" + machine HOSTNAME login USERID password "PASSWORD" + ... + default login USERID password "PASSWORD" +< +Now about browsing -- ie. when you just want to look around before editing a +file. For browsing on your current host, just "edit" a directory: > + + vim . + vim /home/userid/path +< +For browsing on a remote host, "edit" a directory (but make sure that +the directory name is followed by a "/"): > + + vim scp://hostname/ + vim ftp://hostname/path/to/dir/ +< +See |netrw-browse| for more! + +There's more protocols supported than scp and ftp, too: see the next +section, |netrw-externapp|. + +============================================================================== +3. Netrw Reference *netrw-ref* + +CONTROLLING EXTERNAL APPLICATIONS *netrw-externapp* + + Protocol Variable Default Value + -------- ---------------- ------------- + dav: *g:netrw_dav_cmd* = "cadaver" + fetch: *g:netrw_fetch_cmd* = "fetch -o" if fetch is available + ftp: *g:netrw_ftp_cmd* = "ftp" + http: *g:netrw_http_cmd* = "curl -o" if curl is available + http: g:netrw_http_cmd = "wget -q -O" else if wget is available + http: g:netrw_http_cmd = "fetch -o" else if fetch is available + rcp: *g:netrw_rcp_cmd* = "rcp" + rsync: *g:netrw_rsync_cmd* = "rsync -a" + scp: *g:netrw_scp_cmd* = "scp -q" + sftp: *g:netrw_sftp_cmd* = "sftp" + +READING *netrw-read* *netrw-nread* + :Nread ? give help + :Nread "machine:path" uses rcp + :Nread "machine path" uses ftp w/ <.netrc> + :Nread "machine id password path" uses ftp + :Nread "dav://machine[:port]/path" uses cadaver + :Nread "fetch://[user@]machine/path" uses fetch + :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc> + :Nread "http://[user@]machine/path" uses http uses wget + :Nread "rcp://[user@]machine/path" uses rcp + :Nread "rsync://[user@]machine[:port]/path" uses rsync + :Nread "scp://[user@]machine[[:#]port]/path" uses scp + :Nread "sftp://[user@]machine/path" uses sftp + +WRITING *netrw-write* *netrw-nwrite* + :Nwrite ? give help + :Nwrite "machine:path" uses rcp + :Nwrite "machine path" uses ftp w/ <.netrc> + :Nwrite "machine id password path" uses ftp + :Nwrite "dav://machine[:port]/path" uses cadaver + :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc> + :Nwrite "rcp://[user@]machine/path" uses rcp + :Nwrite "rsync://[user@]machine[:port]/path" uses rsync + :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp + :Nwrite "sftp://[user@]machine/path" uses sftp + http: not supported! + +SOURCING *netrw-source* + :Nsource ? give help + :Nsource "dav://machine[:port]/path" uses cadaver + :Nsource "fetch://[user@]machine/path" uses fetch + :Nsource "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc> + :Nsource "http://[user@]machine/path" uses http uses wget + :Nsource "rcp://[user@]machine/path" uses rcp + :Nsource "rsync://[user@]machine[:port]/path" uses rsync + :Nsource "scp://[user@]machine[[:#]port]/path" uses scp + :Nsource "sftp://[user@]machine/path" uses sftp + +DIRECTORY LISTING *netrw-dirlist* + :Nread [protocol]://[user]@hostname/path/ + + *netrw-login* *netrw-password* + CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* + Attempts to use ftp will prompt you for a user-id and a password. + These will be saved in g:netrw_uid and g:netrw_passwd Subsequent uses + of ftp will re-use those. If you need to use a different user id + and/or password, you'll want to call NetUserPass() first. + + :NetUserPass [uid [password]] -- prompts as needed + :call NetUserPass() -- prompts for uid and password + :call NetUserPass("uid") -- prompts for password + :call NetUserPass("uid","password") -- sets global uid and password + +VARIABLES *netrw-variables* + +(see also: |netrw-browse-var||netrw-protocol||netrw-settings||netrw-var|) + + *b:netrw_lastfile* last file Network-read/written retained on a per-buffer + basis (supports plain :Nw ) + + *g:netrw_ftp* if it doesn't exist, use default ftp + =0 use default ftp (uid password) + =1 use alternate ftp method (user uid password) + If you're having trouble with ftp, try changing the + value of this variable to see if the alternate ftp + method works for your setup. + + *g:netrw_extracmd* default: doesn't exist + If this variable exists, then any string it contains + will be placed into the commands set to your ftp + client. As an example: + ="passive" + + *g:netrw_ftpmode* ="binary" (default) + ="ascii" + + *g:netrw_ignorenetrc* =0 (default for linux, cygwin) + =1 If you have a <.netrc> file but it doesn't work and + you want it ignored, then set this variable as shown. + (default for Windows + cmd.exe) + + *g:netrw_menu* =0 disable netrw's menu + =1 (default) netrw's menu enabled + + *g:netrw_nogx* if this variable exists, then the "gx" map will not + be available (see |netrw-gx|) + + *g:netrw_uid* (ftp) user-id, retained on a per-session basis + *g:netrw_passwd* (ftp) password, retained on a per-session basis + + *g:netrw_shq* = "'" for Unix/Linux systems (ie. a single quote) + = "'" for Windows + cygwin systems (ie. a single quote) + = '"' for Windows systems, not using cygwin + (ie. a double quote) + Controls the quoting character used during scp and ftp + commands. + + *g:netrw_win95ftp* =1 if using Win95, will remove four trailing blank + lines that o/s's ftp "provides" on transfers + =0 force normal ftp behavior (no trailing line removal) + + *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also + permits network browsing to use ls with time and + size sorting (default if windows) + =0 assume Windows' scp accepts windows-style paths + Network browsing uses dir instead of ls + This option is ignored if you're using unix + + *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP + =1 use WinNT's rcp in binary mode (default) + +PATHS *netrw-path* + +Paths to files are generally user-directory relative for most protocols. +It is possible that some protocol will make paths relative to some +associated directory, however. +> + example: vim scp://user@host/somefile + example: vim scp://user@host/subdir1/subdir2/somefile +< +where "somefile" is the "user"'s home directory. If you wish to get a +file using root-relative paths, use the full path: +> + example: vim scp://user@host//somefile + example: vim scp://user@host//subdir1/subdir2/somefile +< + +============================================================================== +4. Network-Oriented File Transfer *netrw-xfer* + +Network-oriented file transfer under Vim is implemented by a VimL-based script +(<netrw.vim>) using plugin techniques. It currently supports both reading and +writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch, +dav/cadaver, rsync, or sftp. + +http is currently supported read-only via use of wget or fetch. + +<netrw.vim> is a standard plugin which acts as glue between Vim and the +various file transfer programs. It uses autocommand events (BufReadCmd, +FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. > + + ex. vim ftp://hostname/path/to/file +< +The characters preceding the colon specify the protocol to use; in the +example, its ftp. The <netrw.vim> script then formulates a command or a +series of commands (typically ftp) which it issues to an external program +(ftp, scp, etc) which does the actual file transfer/protocol. Files are read +from/written to a temporary file (under Unix/Linux, /tmp/...) which the +<netrw.vim> script will clean up. + + *netrw-putty* *netrw-pscp* *netrw-psftp* +One may modify any protocol's implementing external application by setting a +variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to +"scp -q"). As an example, consider using PuTTY: > + + let g:netrw_scp_cmd = '"c:\Program Files\PuTTY\pscp.exe" -q -batch' + let g:netrw_sftp_cmd= '"c:\Program Files\PuTTY\psftp.exe"' +< +See |netrw-p8| for more about putty, pscp, psftp, etc. + +Ftp, an old protocol, seems to be blessed by numerous implementations. +Unfortunately, some implementations are noisy (ie., add junk to the end of the +file). Thus, concerned users may decide to write a NetReadFixup() function +that will clean up after reading with their ftp. Some Unix systems (ie., +FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is +not noisy and more convenient, actually, for <netrw.vim> to use. +Consequently, if "fetch" is executable, it will be used to do reads for +ftp://... (and http://...) . See |netrw-var| for more about this. + +For rcp, scp, sftp, and http, one may use network-oriented file transfers +transparently; ie. +> + vim rcp://[user@]machine/path + vim scp://[user@]machine/path +< +If your ftp supports <.netrc>, then it too can be just as transparently used +if the needed triad of machine name, user id, and password are present in +that file. Your ftp must be able to use the <.netrc> file on its own, however. +> + vim ftp://[user@]machine[[:#]portnumber]/path +< +However, ftp will often need to query the user for the userid and password. +The latter will be done "silently"; ie. asterisks will show up instead of +the actually-typed-in password. Netrw will retain the userid and password +for subsequent read/writes from the most recent transfer so subsequent +transfers (read/write) to or from that machine will take place without +additional prompting. + + *netrw-urls* + +=================================+============================+============+ + | Reading | Writing | Uses | + +=================================+============================+============+ + | DAV: | | | + | dav://host/path | | cadaver | + | :Nread dav://host/path | :Nwrite dav://host/path | cadaver | + +---------------------------------+----------------------------+------------+ + | FETCH: | | | + | fetch://[user@]host/path | | | + | fetch://[user@]host:http/path | Not Available | fetch | + | :Nread fetch://[user@]host/path| | | + +---------------------------------+----------------------------+------------+ + | FILE: | | | + | file:///* | file:///* | | + | file://localhost/* | file://localhost/* | | + +---------------------------------+----------------------------+------------+ + | FTP: (*3) | (*3) | | + | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) | + | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc | + | :Nread host path | :Nwrite host path | ftp+.netrc | + | :Nread host uid pass path | :Nwrite host uid pass path | ftp | + +---------------------------------+----------------------------+------------+ + | HTTP: wget is executable: (*4) | | | + | http://[user@]host/path | Not Available | wget | + +---------------------------------+----------------------------+------------+ + | HTTP: fetch is executable (*4) | | | + | http://[user@]host/path | Not Available | fetch | + +---------------------------------+----------------------------+------------+ + | RCP: | | | + | rcp://[user@]host/path | rcp://[user@]host/path | rcp | + +---------------------------------+----------------------------+------------+ + | RSYNC: | | | + | rsync://[user@]host/path | rsync://[user@]host/path | rsync | + | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync | + | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp | + +---------------------------------+----------------------------+------------+ + | SCP: | | | + | scp://[user@]host/path | scp://[user@]host/path | scp | + | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) | + +---------------------------------+----------------------------+------------+ + | SFTP: | | | + | sftp://[user@]host/path | sftp://[user@]host/path | sftp | + | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) | + +=================================+============================+============+ + + (*1) For an absolute path use scp://machine//path. + + (*2) if <.netrc> is present, it is assumed that it will + work with your ftp client. Otherwise the script will + prompt for user-id and password. + + (*3) for ftp, "machine" may be machine#port or machine:port + if a different port is needed than the standard ftp port + + (*4) for http:..., if wget is available it will be used. Otherwise, + if fetch is available it will be used. + +Both the :Nread and the :Nwrite ex-commands can accept multiple filenames. + + +NETRC *netrw-netrc* + +The typical syntax for lines in a <.netrc> file is given as shown below. +Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't. +> + machine {full machine name} login {user-id} password "{password}" + default login {user-id} password "{password}" + +Your ftp client must handle the use of <.netrc> on its own, but if the +<.netrc> file exists, an ftp transfer will not ask for the user-id or +password. + + Note: + Since this file contains passwords, make very sure nobody else can + read this file! Most programs will refuse to use a .netrc that is + readable for others. Don't forget that the system administrator can + still read the file! + + +PASSWORD *netrw-passwd* + +The script attempts to get passwords for ftp invisibly using |inputsecret()|, +a built-in Vim function. See |netrw-uidpass| for how to change the password +after one has set it. + +Unfortunately there doesn't appear to be a way for netrw to feed a password to +scp. Thus every transfer via scp will require re-entry of the password. +However, |netrw-listhack| can help with this problem. + + +============================================================================== +5. Activation *netrw-activate* + +Network-oriented file transfers are available by default whenever Vim's +|'nocompatible'| mode is enabled. The <netrw.vim> file resides in your +system's vim-plugin directory and is sourced automatically whenever you bring +up vim. I suggest that, at a minimum, you have at least the following in your +<.vimrc> customization file: > + + set nocp + if version >= 600 + filetype plugin indent on + endif +< + +============================================================================== +6. Transparent File Transfer *netrw-transparent* + +Transparent file transfers occur whenever a regular file read or write +(invoked via an |:autocmd| for |BufReadCmd| or |BufWriteCmd| events) is made. +Thus one may use files across networks just as simply as if they were local. > + + vim ftp://[user@]machine/path + ... + :wq + +See |netrw-activate| for more on how to encourage your vim to use plugins +such as netrw. + + +============================================================================== +7. Ex Commands *netrw-ex* + +The usual read/write commands are supported. There are also a few +additional commands available. Often you won't need to use Nw or +Nread as shown in |netrw-transparent| (ie. simply use > + :e url + :r url + :w url +instead, as appropriate) -- see |netrw-urls|. In the explanations +below, a {netfile} is an url to a remote file. + +:[range]Nw Write the specified lines to the current + file as specified in b:netrw_lastfile. + +:[range]Nw {netfile} [{netfile}]... + Write the specified lines to the {netfile}. + +:Nread Read the specified lines into the current + buffer from the file specified in + b:netrw_lastfile. + +:Nread {netfile} {netfile}... + Read the {netfile} after the current line. + +:Nsource {netfile} + Source the {netfile}. + To start up vim using a remote .vimrc, one may use + the following (all on one line) (tnx to Antoine Mechelynck) > + vim -u NORC -N + --cmd "runtime plugin/netrwPlugin.vim" + --cmd "source scp://HOSTNAME/.vimrc" +< *netrw-uidpass* +:call NetUserPass() + If b:netrw_uid and b:netrw_passwd don't exist, + this function query the user for them. + +:call NetUserPass("userid") + This call will set the b:netrw_uid and, if + the password doesn't exist, will query the user for it. + +:call NetUserPass("userid","passwd") + This call will set both the b:netrw_uid and b:netrw_passwd. + The user-id and password are used by ftp transfers. One may + effectively remove the user-id and password by using "" + strings. + +:NetrwSettings This command is described in |netrw-settings| -- used to + display netrw settings and change netrw behavior. + + +============================================================================== +8. Variables and Options *netrw-options* *netrw-var* + +The <netrw.vim> script provides several variables which act as options to +ffect <netrw.vim>'s behavior. These variables typically may be set in the +user's <.vimrc> file: +(see also: |netrw-settings||netrw-browse-var||netrw-protocol||netrw-settings|) > + + ------------- + Netrw Options + ------------- + Option Meaning + -------------- ----------------------------------------------- +< + b:netrw_col Holds current cursor position (during NetWrite) + g:netrw_cygwin =1 assume scp under windows is from cygwin + (default/windows) + =0 assume scp under windows accepts windows + style paths (default/else) + g:netrw_ftp =0 use default ftp (uid password) + g:netrw_ftpmode ="binary" (default) + ="ascii" (your choice) + g:netrw_ignorenetrc =1 (default) + if you have a <.netrc> file but you don't + want it used, then set this variable. Its + mere existence is enough to cause <.netrc> + to be ignored. + b:netrw_lastfile Holds latest method/machine/path. + b:netrw_line Holds current line number (during NetWrite) + g:netrw_passwd Holds current password for ftp. + g:netrw_silent =0 transfers done normally + =1 transfers done silently + g:netrw_uid Holds current user-id for ftp. + =1 use alternate ftp (user uid password) + (see |netrw-options|) + g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default) + =1 use WinNT/2K/XP's rcp, binary mode + g:netrw_win95ftp =0 use unix-style ftp even if win95/98/ME/etc + =1 use default method to do ftp > + ----------------------------------------------------------------------- +< +The script will also make use of the following variables internally, albeit +temporarily. +> + ------------------- + Temporary Variables + ------------------- + Variable Meaning + -------- ------------------------------------ +< + g:netrw_method Index indicating rcp/ftp+.netrc/ftp + g:netrw_machine Holds machine name parsed from input + g:netrw_fname Holds filename being accessed > + ------------------------------------------------------------ +< + *netrw-protocol* + +Netrw supports a number of protocols. These protocols are invoked using the +variables listed below, and may be modified by the user. +> + ------------------------ + Protocol Control Options + ------------------------ + Option Type Setting Meaning + --------- -------- -------------- --------------------------- +< + netrw_ftp variable =doesn't exist userid set by "user userid" + =0 userid set by "user userid" + =1 userid set by "userid" + NetReadFixup function =doesn't exist no change + =exists Allows user to have files + read via ftp automatically + transformed however they wish + by NetReadFixup() + g:netrw_dav_cmd variable ="cadaver" + g:netrw_fetch_cmd variable ="fetch -o" if fetch is available + g:netrw_ftp_cmd variable ="ftp" + g:netrw_http_cmd variable ="fetch -o" if fetch is available + g:netrw_http_cmd variable ="wget -O" else if wget is available + g:netrw_list_cmd variable ="ssh USEPORT HOSTNAME ls -Fa" + g:netrw_rcp_cmd variable ="rcp" + g:netrw_rsync_cmd variable ="rsync -a" + g:netrw_scp_cmd variable ="scp -q" + g:netrw_sftp_cmd variable ="sftp" > + ------------------------------------------------------------------------- +< + *netrw-ftp* + +The g:netrw_..._cmd options (|g:netrw_ftp_cmd| and |g:netrw_sftp_cmd|) +specify the external program to use handle the ftp protocol. They may +include command line options (such as -p for passive mode). + +Browsing is supported by using the |g:netrw_list_cmd|; the substring +"HOSTNAME" will be changed via substitution with whatever the current request +is for a hostname. + +Two options (|g:netrw_ftp| and |netrw-fixup|) both help with certain ftp's +that give trouble . In order to best understand how to use these options if +ftp is giving you troubles, a bit of discussion is provided on how netrw does +ftp reads. + +For ftp, netrw typically builds up lines of one of the following formats in a +temporary file: +> + IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1 + ---------------------------------- ------------------------------ +< + open machine [port] open machine [port] + user userid password userid password + [g:netrw_ftpmode] password + [g:netrw_extracmd] [g:netrw_ftpmode] + get filename tempfile [g:netrw_extracmd] + get filename tempfile > + --------------------------------------------------------------------- +< +The |g:netrw_ftpmode| and |g:netrw_extracmd| are optional. + +Netrw then executes the lines above by use of a filter: +> + :%! {g:netrw_ftp_cmd} -i [-n] +< +where + g:netrw_ftp_cmd is usually "ftp", + -i tells ftp not to be interactive + -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>) + +If <.netrc> exists it will be used to avoid having to query the user for +userid and password. The transferred file is put into a temporary file. +The temporary file is then read into the main editing session window that +requested it and the temporary file deleted. + +If your ftp doesn't accept the "user" command and immediately just demands a +userid, then try putting "let netrw_ftp=1" in your <.vimrc>. + + *netrw-cadaver* +To handle the SSL certificate dialog for untrusted servers, one may pull +down the certificate and place it into /usr/ssl/cert.pem. This operation +renders the server treatment as "trusted". + + *netrw-fixup* *netreadfixup* +If your ftp for whatever reason generates unwanted lines (such as AUTH +messages) you may write a NetReadFixup(tmpfile) function: +> + function! NetReadFixup(method,line1,line2) + " a:line1: first new line in current file + " a:line2: last new line in current file + if a:method == 1 "rcp + elseif a:method == 2 "ftp + <.netrc> + elseif a:method == 3 "ftp + machine,uid,password,filename + elseif a:method == 4 "scp + elseif a:method == 5 "http/wget + elseif a:method == 6 "dav/cadaver + elseif a:method == 7 "rsync + elseif a:method == 8 "fetch + elseif a:method == 9 "sftp + else " complain + endif + endfunction +> +The NetReadFixup() function will be called if it exists and thus allows you to +customize your reading process. As a further example, <netrw.vim> contains +just such a function to handle Windows 95 ftp. For whatever reason, Windows +95's ftp dumps four blank lines at the end of a transfer, and so it is +desirable to automate their removal. Here's some code taken from <netrw.vim> +itself: +> + if has("win95") && g:netrw_win95ftp + fun! NetReadFixup(method, line1, line2) + if method == 3 " ftp (no <.netrc>) + let fourblanklines= line2 - 3 + silent fourblanklines.",".line2."g/^\s*/d" + endif + endfunction + endif +> + +============================================================================== +9. Directory Browsing *netrw-browse* *netrw-dir* *netrw-list* *netrw-help* + +MAPS *netrw-maps* + <F1>.............Help.......................................|netrw-help| + <cr>.............Browsing...................................|netrw-cr| + <del>............Deleting Files or Directories..............|netrw-delete| + -................Going Up...................................|netrw--| + a................Hiding Files or Directories................|netrw-a| + mb...............Bookmarking a Directory....................|netrw-mb| + gb...............Changing to a Bookmarked Directory.........|netrw-gb| + c................Make Browsing Directory The Current Dir....|netrw-c| + d................Make A New Directory.......................|netrw-d| + D................Deleting Files or Directories..............|netrw-D| + <c-h>............Edit File/Directory Hiding List............|netrw-ctrl-h| + i................Change Listing Style.......................|netrw-i| + <c-l>............Refreshing the Listing.....................|netrw-ctrl-l| + o................Browsing with a Horizontal Split...........|netrw-o| + p................Preview Window.............................|netrw-p| + q................Listing Bookmarks and History..............|netrw-q| + r................Reversing Sorting Order....................|netrw-r| + R................Renaming Files or Directories..............|netrw-R| + s................Selecting Sorting Style....................|netrw-s| + S................Editing the Sorting Sequence...............|netrw-S| + t................Browsing with a new tab....................|netrw-t| + u................Changing to a Predecessor Directory........|netrw-u| + U................Changing to a Successor Directory..........|netrw-U| + v................Browsing with a Vertical Split.............|netrw-v| + x................Customizing Browsing.......................|netrw-x| + + COMMANDS *netrw-explore-cmds* + :Explore[!] [dir] Explore directory of current file........|netrw-explore| + :Sexplore[!] [dir] Split & Explore directory ...............|netrw-explore| + :Hexplore[!] [dir] Horizontal Split & Explore...............|netrw-explore| + :Vexplore[!] [dir] Vertical Split & Explore.................|netrw-explore| + :Texplore[!] [dir] Tab & Explore............................|netrw-explore| + :Pexplore[!] [dir] Vertical Split & Explore.................|netrw-explore| + :Nexplore[!] [dir] Vertical Split & Explore.................|netrw-explore| + :NetrwSettings.............................................|netrw-settings| + +QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds* +> + ------- ----------- + Command Explanation + ------- ----------- +< <F1> Causes Netrw to issue help + <cr> Netrw will enter the directory or read the file |netrw-cr| + <del> Netrw will attempt to remove the file/directory |netrw-del| + - Makes Netrw go up one directory |netrw--| + a Toggles between normal display, |netrw-a| + hiding (suppress display of files matching g:netrw_list_hide) + showing (display only files which match g:netrw_list_hide) + mb bookmark current directory + gb go to previous bookmarked directory + c Make current browsing directory the current directory |netrw-c| + d Make a directory |netrw-d| + D Netrw will attempt to remove the file(s)/directory(ies) |netrw-D| + <c-h> Edit file hiding list |netrw-ctrl-h| + i Cycle between thin, long, wide, and tree listings|netrw-i| + <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l| + o Enter the file/directory under the cursor in a new browser + window. A horizontal split is used. |netrw-o| + O Obtain a file specified by cursor |netrw-O| + p Preview the file |netrw-p| + P Browse in the previously used window |netrw-P| + q List bookmarked directories and history |netrw-q| + r Reverse sorting order |netrw-r| + R Rename the designed file(s)/directory(ies) |netrw-R| + s Select sorting style: by name, time, or file size |netrw-s| + S Specify suffix priority for name-sorting |netrw-S| + t Enter the file/directory under the cursor in a new tab|netrw-t| + u Change to recently-visited directory |netrw-u| + U Change to subsequently-visited directory |netrw-U| + v Enter the file/directory under the cursor in a new browser + window. A vertical split is used. |netrw-v| + x Apply a function to a file. (special browsers) |netrw-x| + +NETRW BROWSER VARIABLES *netrw-browse-var* +> + --- ----------- + Var Explanation + --- ----------- +< *g:netrw_alto* change from above splitting to below splitting + by setting this variable (see |netrw-o|) + default: =&sb (see |'sb'|) + + *g:netrw_altv* change from left splitting to right splitting + by setting this variable (see |netrw-v|) + default: =&spr (see |'spr'|) + + *g:netrw_browse_split* when browsing, <cr> will open the file by: + =0: re-using the same window + =1: horizontally splitting the window first + =2: vertically splitting the window first + =3: open file in new tab + + *g:netrw_browsex_viewer* specify user's preference for a viewer: > + "kfmclient exec" + "gnome-open" +< If > + "-" +< is used, then netrwFileHandler() will look for + a script/function to handle the given + extension. (see |netrw_filehandler|). + + *g:netrw_fastbrowse* =0: slow speed browsing, never re-use + directory listings; always obtain + directory listings. + =1: medium speed browsing, re-use directory + listings only when remote browsing. + (default value) + =2: fast browsing, only obtains directory + listings when the directory hasn't been + seen before (or |netrw-ctrl-l| is used). + Fast browsing retains old directory listing + buffers so that they don't need to be + re-acquired. This feature is especially + important for remote browsing. However, if + a file is introduced or deleted into or from + such directories, the old directory buffer + becomes out-of-date. One may always refresh + such a directory listing with |netrw-ctrl-l|. + This option gives the choice of the trade-off + between accuracy and speed to the user. + + *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings + that can show up as "directories" and "files" + in the listing. This pattern is used to + remove such embedded messages. By default its + value is: + '^total\s\+\d\+$\| + ^Trying\s\+\d\+.*$\| + ^KERBEROS_V\d rejected\| + ^Security extensions not\| + No such file\| + : connect to address [0-9a-fA-F:]* + : No route to host$' + + *g:netrw_ftp_list_cmd* options for passing along to ftp for directory + listing. Defaults: + unix or g:netrw_cygwin set: : "ls -lF" + otherwise "dir" + + + *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory + listing, sorted by size of file. + Defaults: + unix or g:netrw_cygwin set: : "ls -slF" + otherwise "dir" + + *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory + listing, sorted by time of last modification. + Defaults: + unix or g:netrw_cygwin set: : "ls -tlF" + otherwise "dir" + + *g:netrw_hide* if true, the hiding list is used + default: =0 + + *g:netrw_keepdir* =1 (default) keep current directory immune from + the browsing directory. + =0 keep the current directory the same as the + browsing directory. + The current browsing directory is contained in + b:netrw_curdir (also see |netrw-c|) + + *g:netrw_list_cmd* command for listing remote directories + default: (if ssh is executable) + "ssh HOSTNAME ls -FLa" + + *g:netrw_liststyle* Set the default listing style: + = 0: thin listing (one file per line) + = 1: long listing (one file per line with time + stamp information and file size) + = 2: wide listing (multiple files in columns) + = 3: tree style listing + *g:netrw_list_hide* comma separated pattern list for hiding files + default: "" + + *g:netrw_local_mkdir* command for making a local directory + default: "mkdir" + + *g:netrw_local_rmdir* remove directory command (rmdir) + default: "rmdir" + + *g:netrw_maxfilenamelen* =32 by default, selected so as to make long + listings fit on 80 column displays. + If your screen is wider, and you have file + or directory names longer than 32 bytes, + you may set this option to keep listings + columnar. + + *g:netrw_mkdir_cmd* command for making a remote directory + default: "ssh USEPORT HOSTNAME mkdir" + + *g:netrw_rm_cmd* command for removing files + default: "ssh USEPORT HOSTNAME rm" + + *g:netrw_rmdir_cmd* command for removing directories + default: "ssh USEPORT HOSTNAME rmdir" + + *g:netrw_rmf_cmd* command for removing softlinks + default: "ssh USEPORT HOSTNAME rm -f" + + *g:netrw_sort_by* sort by "name", "time", or "size" + default: "name" + + *g:netrw_sort_direction* sorting direction: "normal" or "reverse" + default: "normal" + + *g:netrw_sort_sequence* when sorting by name, first sort by the + comma-separated pattern sequence + default: '[\/]$,*,\.bak$,\.o$,\.h$, + \.info$,\.swp$,\.obj$' + + *g:netrw_ssh_cmd* One may specify an executable command + to use instead of ssh for remote actions + such as listing, file removal, etc. + default: ssh + + *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines, + messages, banners, and whatnot that one doesn't + want masquerading as "directories" and "files". + Use this pattern to remove such embedded + messages. By default its value is: + '^total\s\+\d\+$' + + *g:netrw_use_noswf* netrw normally avoids writing swapfiles + for browser buffers. However, under some + systems this apparently is causing nasty + ml_get errors to appear; if you're getting + ml_get errors, try putting + let g:netrw_use_noswf= 0 + in your .vimrc. + + *g:netrw_timefmt* specify format string to strftime() (%c) + default: "%c" + + *g:netrw_winsize* specify initial size of new o/v windows + default: "" + + *g:NetrwTopLvlMenu* This variable specifies the top level + menu name; by default, its "Netrw.". If + you wish to change this, do so in your + .vimrc. + +INTRODUCTION TO DIRECTORY BROWSING *netrw-browse-intro* + +Netrw supports the browsing of directories on the local system and on remote +hosts, including listing files and directories, entering directories, editing +files therein, deleting files/directories, making new directories, and moving +(renaming) files and directories. The Netrw browser generally implements the +previous explorer maps and commands for remote directories, although details +(such as pertinent global variable names) necessarily differ. + +The Netrw remote file and directory browser handles two protocols: ssh and +ftp. The protocol in the url, if it is ftp, will cause netrw to use ftp +in its remote browsing. Any other protocol will be used for file transfers, +but otherwise the ssh protocol will be used to do remote directory browsing. + +To use Netrw's remote directory browser, simply attempt to read a "file" with a +trailing slash and it will be interpreted as a request to list a directory: + + vim [protocol]://[user@]hostname/path/ + +For local directories, the trailing slash is not required. + +If you'd like to avoid entering the password in for remote directory listings +with ssh or scp, see |netrw-listhack|. + + +NETRW BROWSING AND OPTION INCOMPATIBILITIES *netrw-incompatible* + +Netrw will not work properly with > + + :set acd + :set fo=...ta... +< +If either of these options are present when browsing is attempted, netrw +will change them by using noacd and removing the ta suboptions from the +|'formatoptions'|. + + *netrw-explore* *netrw-pexplore* *netrw-texplore* + *netrw-hexplore* *netrw-sexplore* *netrw-nexplore* + *netrw-vexplore* +DIRECTORY EXPLORING COMMANDS + + :Explore[!] [dir]... Explore directory of current file *:Explore* + :Sexplore[!] [dir]... Split&Explore directory of current file *:Sexplore* + :Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore* + :Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore* + :Texplore [dir]... Tab & Explore *:Texplore* + + Used with :Explore **/pattern : (also see |netrw-starstar|) + :Nexplore............. go to next matching file *:Nexplore* + :Pexplore............. go to previous matching file *:Pexplore* + +:Explore will open the local-directory browser on the current file's + directory (or on directory [dir] if specified). The window will be + split only if the file has been modified, otherwise the browsing + window will take over that window. Normally the splitting is taken + horizontally. +:Explore! is like :Explore, but will use vertical splitting. +:Sexplore will always split the window before invoking the local-directory + browser. As with Explore, the splitting is normally done + horizontally. +:Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically. +:Hexplore [dir] does an :Explore with |:belowright| horizontal splitting. +:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting. +:Vexplore [dir] does an :Explore with |:leftabove| vertical splitting. +:Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting. +:Texplore [dir] does a tabnew before generating the browser window + +By default, these commands use the current file's directory. However, one +may explicitly provide a directory (path) to use. + + *netrw-starstar* +When Explore, Sexplore, Hexplore, or Vexplore are used with a **/filepat, +such as: +> + :Explore **/filename_pattern +< +netrw will attempt to find a file in the current directory or any subdirectory +which matches the filename pattern. Internally, it produces a list of files +which match the pattern and their paths; to that extent it resembles the Unix +operation: +> + find $(pwd) -name "$1" -exec "echo" "{}" ";" 2> /dev/null +< +The directory display is updated to show the subdirectory containing a +matching file. One may then proceed to the next (or previous) matching files' +directories by using Nexplore or Pexplore, respectively. If your console or +gui produces recognizable shift-up or shift-down sequences, then you'll likely +find using shift-downarrow and shift-uparrow convenient. They're mapped by +netrw: + + <s-down> == Nexplore, and + <s-up> == Pexplore. + +As an example, consider +> + :Explore **/*.c + :Nexplore + :Nexplore + :Pexplore +< +The status line will show, on the right hand side of the status line, a +message like "Match 3 of 20". + + *netrw-starpat* +When Explore, Sexplore, Hexplore, or Vexplore are used with a */pattern, +such as: +> + :Explore */pattern +< +netrw will use |:vimgrep| to find files which contain the given pattern. +Like what happens with |netrw-starstar|, a list of files which contain +matches to the given pattern is generated. The cursor will then jump +to the first file with the given pattern; |:Nexplore|, |:Pexplore|, and +the shifted-down and -up arrows work with the list to move to the next +or previous files in that list. + + *netrw-starstarpat* +When Explore, Sexplore, Hexplore, or Vexplore are used with a **//pattern, +such as: +> + :Explore **//pattern +< +then Explore will use |:vimgrep| to find files like |netrw-starpat|; +however, Explore will also search subdirectories as well as the current +directory. + + +REFRESHING THE LISTING *netrw-ctrl-l* *netrw-ctrl_l* + +To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or +hit the <cr> when atop the ./ directory entry in the listing. One may also +refresh a local directory by using ":e .". + + +GOING UP *netrw--* + +To go up a directory, press "-" or press the <cr> when atop the ../ directory +entry in the listing. + +Netrw will use the command in |g:netrw_list_cmd| to perform the directory +listing operation after changing HOSTNAME to the host specified by the +user-provided url. By default netrw provides the command as: + + ssh HOSTNAME ls -FLa + +where the HOSTNAME becomes the [user@]hostname as requested by the attempt to +read. Naturally, the user may override this command with whatever is +preferred. The NetList function which implements remote directory browsing +expects that directories will be flagged by a trailing slash. + + +BROWSING *netrw-cr* + +Browsing is simple: move the cursor onto a file or directory of interest. +Hitting the <cr> (the return key) will select the file or directory. +Directories will themselves be listed, and files will be opened using the +protocol given in the original read request. + + CAVEAT: There are four forms of listing (see |netrw-i|). Netrw assumes + that two or more spaces delimit filenames and directory names for the long + and wide listing formats. Thus, if your filename or directory name has two + or more spaces embedded in it, or any trailing spaces, then you'll need to + use the "thin" format to select it. + +The |g:netrw_browse_split| option, which is zero by default, may be used to +cause the opening of files to be done in a new window or tab. When the option +is one or two, the splitting will be taken horizontally or vertically, +respectively. When the option is set to three, a <cr> will cause the file +to appear in a new tab. + + +OBTAINING A FILE *netrw-O* + +When browsing a remote directory, one may obtain a file under the cursor (ie. +get a copy on your local machine, but not edit it) by pressing the O key. +Only ftp and scp are supported for this operation (but since these two are +available for browsing, that shouldn't be a problem). The status bar +will then show, on its right hand side, a message like "Obtaining filename". +The statusline will be restored after the transfer is complete. + +Netrw can also "obtain" a file using the local browser. Netrw's display +of a directory is not necessarily the same as Vim's "current directory", +unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select +a file using the local browser (by putting the cursor on it) and pressing +"O" will then "obtain" the file; ie. copy it to Vim's current directory. + +Related topics: + * To see what the current directory is, use |:pwd| + * To make the currently browsed directory the current directory, see |netrw-c| + * To automatically make the currently browsed directory the current + directory, see |g:netrw_keepdir|. + + +CHANGE LISTING STYLE *netrw-i* + +The "i" map cycles between the thin, long, wide, and tree listing formats. + +The short listing format gives just the files' and directories' names. + +The long listing is either based on the "ls" command via ssh for remote +directories or displays the filename, file size (in bytes), and the time and +date of last modification for local directories. With the long listing +format, netrw is not able to recognize filenames which have trailing spaces. +Use the thin listing format for such files. + +The wide listing format uses two or more contiguous spaces to delineate +filenames; when using that format, netrw won't be able to recognize or use +filenames which have two or more contiguous spaces embedded in the name or any +trailing spaces. The thin listing format will, however, work with such files. +This listing format is the most compact. + +The tree listing format has a top directory followed by files and directories +preceded by a "|". One may open and close directories by pressing the <cr> +key while atop the directory name. There is only one tree listing buffer; +hence, using "v" or "o" on a subdirectory will only show the same buffer, +twice. + + +MAKING A NEW DIRECTORY *netrw-d* + +With the "d" map one may make a new directory either remotely (which depends +on the global variable g:netrw_mkdir_cmd) or locally (which depends on the +global variable g:netrw_local_mkdir). Netrw will issue a request for the new +directory's name. A bare <CR> at that point will abort the making of the +directory. Attempts to make a local directory that already exists (as either +a file or a directory) will be detected, reported on, and ignored. + + +DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* *netrw-del* + +Deleting/removing files and directories involves moving the cursor to the +file/directory to be deleted and pressing "D". Directories must be empty +first before they can be successfully removed. If the directory is a softlink +to a directory, then netrw will make two requests to remove the directory +before succeeding. Netrw will ask for confirmation before doing the +removal(s). You may select a range of lines with the "V" command (visual +selection), and then pressing "D". + +The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used +to control the attempts to remove files and directories. The g:netrw_rm_cmd +is used with files, and its default value is: + + g:netrw_rm_cmd: ssh HOSTNAME rm + +The g:netrw_rmdir_cmd variable is used to support the removal of directories. +Its default value is: + + g:netrw_rmdir_cmd: ssh HOSTNAME rmdir + +If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt +to remove it again using the g:netrw_rmf_cmd variable. Its default value is: + + g:netrw_rmf_cmd: ssh HOSTNAME rm -f + + +RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* + +Renaming/moving files and directories involves moving the cursor to the +file/directory to be moved (renamed) and pressing "R". You will then be +queried for where you want the file/directory to be moved. You may select a +range of lines with the "V" command (visual selection), and then pressing "R". + +The g:netrw_rename_cmd variable is used to implement renaming. By default its +value is: + + ssh HOSTNAME mv + +One may rename a block of files and directories by selecting them with +the V (|linewise-visual|). + + +HIDING FILES OR DIRECTORIES *netrw-a* *netrw-hiding* + +Netrw's browsing facility allows one to use the hiding list in one of three +ways: ignore it, hide files which match, and show only those files which +match. The "a" map allows the user to cycle about these three ways. + +The g:netrw_list_hide variable holds a comma delimited list of patterns (ex. +\.obj) which specify the hiding list. (also see |netrw-ctrl-h|) To set the +hiding list, use the <c-h> map. As an example, to hide files which begin with +a ".", one may use the <c-h> map to set the hiding list to '^\..*' (or one may +put let g:netrw_list_hide= '^\..*' in one's <.vimrc>). One may then use the +"a" key to show all files, hide matching files, or to show only the matching +files. + + Example: ^.*\.[ch] + This hiding list command will hide/show all *.c and *.h files. + + Example: ^.*\.c,^.*\.h + This hiding list command will also hide/show all *.c and *.h + files. + +Don't forget to use the "a" map to select the normal/hiding/show mode you want! + + *netrw-ctrl_h* +EDIT FILE OR DIRECTORY HIDING LIST *netrw-ctrl-h* *netrw-edithide* + +The "<ctrl-h>" map brings up a requestor allowing the user to change the +file/directory hiding list. The hiding list consists of one or more patterns +delimited by commas. Files and/or directories satisfying these patterns will +either be hidden (ie. not shown) or be the only ones displayed (see +|netrw-a|). + + +BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* + +Normally one enters a file or directory using the <cr>. However, the "o" map +allows one to open a new window to hold the new directory listing or file. A +horizontal split is used. (for vertical splitting, see |netrw-v|) + +Normally, the o key splits the window horizontally with the new window and +cursor at the top. To change to splitting the window horizontally with the +new window and cursor at the bottom, have + + let g:netrw_alto = 1 + +in your <.vimrc>. (also see |netrw-t| |netrw-v| |g:netrw_alto|) + +There is only one tree listing buffer; using "o" on a displayed subdirectory +will split the screen, but the same buffer will be shown twice. + + +BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* + +Normally one enters a file or directory using the <cr>. However, the "v" map +allows one to open a new window to hold the new directory listing or file. A +vertical split is used. (for horizontal splitting, see |netrw-o|) + +Normally, the v key splits the window vertically with the new window and +cursor at the left. To change to splitting the window vertically with the new +window and cursor at the right, have + + let g:netrw_altv = 1 + +in your <.vimrc>. (also see: |netrw-o| |netrw-t| |g:netrw_altv|) + +There is only one tree listing buffer; using "v" on a displayed subdirectory +will split the screen, but the same buffer will be shown twice. + + +BROWSING WITH A NEW TAB *netrw-t* + +Normally one enters a file or directory using the <cr>. The "t" map +allows one to open a new window hold the new directory listing or file in a +new tab. (also see: |netrw-o| |netrw-v|) + + +PREVIEW WINDOW *netrw-p* *netrw-preview* + +One may use a preview window by using the "p" key when the cursor is atop the +desired filename to be previewed. + + +PREVIOUS WINDOW *netrw-P* *netrw-prvwin* + +To edit a file or directory in the previously used window (see :he |CTRL-W_P|), +press a "P". If there's only one window, then the one window will be +horizontally split (above/below splitting is controlled by |g:netrw_alto|, +and its initial size is controlled by |g:netrw_winsize|). + +If there's more than one window, the previous window will be re-used on +the selected file/directory. If the previous window's associated buffer +has been modified, and there's only one window with that buffer, then +the user will be asked if s/he wishes to save the buffer first (yes, +no, or cancel). + + +SELECTING SORTING STYLE *netrw-s* *netrw-sort* + +One may select the sorting style by name, time, or (file) size. The "s" map +allows one to circulate amongst the three choices; the directory listing will +automatically be refreshed to reflect the selected style. + + +EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* + +When "Sorted by" is name, one may specify priority via the sorting sequence +(g:netrw_sort_sequence). The sorting sequence typically prioritizes the +name-listing by suffix, although any pattern will do. Patterns are delimited +by commas. The default sorting sequence is: +> + [\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$ +< +The lone * is where all filenames not covered by one of the other patterns +will end up. One may change the sorting sequence by modifying the +g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by +using the "S" map. + + +REVERSING SORTING ORDER *netrw-r* *netrw-reverse* + +One may toggle between normal and reverse sorting order by pressing the +"r" key. + + +CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* + +Every time you change to a new directory (new for the current session), +netrw will save the directory in a recently-visited directory history +list (unless g:netrw_dirhistmax is zero; by default, its ten). With the +"u" map, one can change to an earlier directory (predecessor). To do +the opposite, see |netrw-U|. + + +CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* + +With the "U" map, one can change to a later directory (successor). +This map is the opposite of the "u" map. (see |netrw-u|) Use the +q map to list both the bookmarks and history. (see |netrw-q|) + + *netrw-gx* +CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* *netrw-handler* + (also see |netrw_filehandler|) + +Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are +best seen with a special handler (ie. a tool provided with your computer). +Netrw allows one to invoke such special handlers by: > + + * when Exploring, hit the "x" key + * when editing, hit gx with the cursor atop the special filename +< (not available if the |g:netrw_nogx| variable exists) + +Netrw determines which special handler by the following method: + + * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to + view files. Examples of useful settings (place into your <.vimrc>): > + + :let g:netrw_browsex_viewer= "kfmclient exec" +< or > + :let g:netrw_browsex_viewer= "gnome-open" +< + If g:netrw_browsex_viewer == '-', then netrwFileHandler() will be + invoked first (see |netrw_filehandler|). + + * for Windows 32 or 64, the url and FileProtocolHandler dlls are used. + * for Gnome (with gnome-open): gnome-open is used. + * for KDE (with kfmclient): kfmclient is used. + * otherwise the netrwFileHandler plugin is used. + +The file's suffix is used by these various approaches to determine an +appropriate application to use to "handle" these files. Such things as +OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps, +*.eps) can be handled. + + *netrw_filehandler* + +The "x" map applies a function to a file, based on its extension. Of course, +the handler function must exist for it to be called! +> + Ex. mypgm.html x -> + NFH_html("scp://user@host/some/path/mypgm.html") +< +Users may write their own netrw File Handler functions to support more +suffixes with special handling. See <plugin/netrwFileHandlers.vim> for +examples on how to make file handler functions. As an example: > + + " NFH_suffix(filename) + fun! NFH_suffix(filename) + ..do something special with filename.. + endfun +< +These functions need to be defined in some file in your .vim/plugin +(vimfiles\plugin) directory. Vim's function names may not have punctuation +characters (except for the underscore) in them. To support suffices that +contain such characters, netrw will first convert the suffix using the +following table: > + + @ -> AT ! -> EXCLAMATION % -> PERCENT + : -> COLON = -> EQUAL ? -> QUESTION + , -> COMMA - -> MINUS ; -> SEMICOLON + $ -> DOLLAR + -> PLUS ~ -> TILDE +< +So, for example: > + + file.rcs,v -> NFH_rcsCOMMAv() +< +If more such translations are necessary, please send me email: > + NdrOchip at ScampbellPfamily.AbizM - NOSPAM +with a request. + + +MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* *netrw-curdir* + +By default, |g:netrw_keepdir| is 1. This setting means that the current +directory will not track the browsing directory. + +Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory to +track netrw's browsing directory. + +However, given the default setting for g:netrw_keepdir of 1 where netrw +maintains its own separate notion of the current directory, in order to make +the two directories the same, use the "c" map (just type c). That map will +set Vim's notion of the current directory to netrw's current browsing +directory. + + +BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* +One may easily "bookmark" a directory by using > + + {cnt}mb +< +Any count may be used. One may use viminfo's "!" option to retain bookmarks +between vim sessions. See |netrw-gb| for how to return to a bookmark and +|netrw-q| for how to list them. + + +CHANGING TO A BOOKMARKED DIRECTORY *netrw-gb* + +To change directory back to a bookmarked directory, use + + {cnt}gb + +Any count may be used to reference any of the bookmarks. See |netrw-mb| on +how to bookmark a directory and |netrw-q| on how to list bookmarks. + + +LISTING BOOKMARKS AND HISTORY *netrw-q* *netrw-listbookmark* + +Pressing "q" will list the bookmarked directories and directory traversal +history (query). (see |netrw-mb|, |netrw-gb|, |netrw-u|, and |netrw-U|) + + +IMPROVING DIRECTORY BROWSING *netrw-listhack* + +Especially with the remote directory browser, constantly entering the password +is tedious. + +For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength +tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3), gives a tip +for setting up no-password ssh and scp, plus discusses associated security +issues. It used to be available at http://hacks.oreilly.com/pub/h/66 , +but apparently that address is now being redirected to some "hackzine". +I'll attempt a summary: + + 1. Generate a public/private key pair on the ssh server: + ssh-keygen -t rsa + (saving the file in ~/.ssh/id_rsa is ok) + 2. Just hit the <CR> when asked for passphrase (twice). + 3. This creates two files: + ~/.ssh/id_rsa + ~/.ssh/id_rsa.pub + 4. On the client: + cd + mkdir .ssh + chmod 0700 .ssh + scp {serverhostname}:.ssh/id_rsa.pub . + cat id_rsa.pub >> .ssh/authorized_keys2 + +For Windows, folks on the vim mailing list have mentioned that Pageant helps +with avoiding the constant need to enter the password. + + +NETRW SETTINGS *netrw-settings* + +With the NetrwSettings.vim plugin, > + :NetrwSettings +will bring up a window with the many variables that netrw uses for its +settings. You may change any of their values; when you save the file, the +settings therein will be used. One may also press "?" on any of the lines for +help on what each of the variables do. + +(see also: |netrw-browse-var||netrw-protocol||netrw-var||netrw-variables|) + + +============================================================================== +10. Problems and Fixes *netrw-problems* + + (This section is likely to grow as I get feedback) + (also see |netrw-debug|) + *netrw-p1* + P1. I use windows 95, and my ftp dumps four blank lines at the + end of every read. + + See |netrw-fixup|, and put the following into your + <.vimrc> file: + + let g:netrw_win95ftp= 1 + + *netrw-p2* + P2. I use Windows, and my network browsing with ftp doesn't sort by + time or size! -or- The remote system is a Windows server; why + don't I get sorts by time or size? + + Windows' ftp has a minimal support for ls (ie. it doesn't + accept sorting options). It doesn't support the -F which + gives an explanatory character (ABC/ for "ABC is a directory"). + Netrw then uses "dir" to get both its short and long listings. + If you think your ftp does support a full-up ls, put the + following into your <.vimrc>: > + + let g:netrw_ftp_list_cmd = "ls -lF" + let g:netrw_ftp_timelist_cmd= "ls -tlF" + let g:netrw_ftp_sizelist_cmd= "ls -slF" +< + Alternatively, if you have cygwin on your Windows box, put + into your <.vimrc>: > + + let g:netrw_cygwin= 1 +< + This problem also occurs when the remote system is Windows. + In this situation, the various g:netrw_ftp_[time|size]list_cmds + are as shown above, but the remote system will not correctly + modify its listing behavior. + + + *netrw-p3* + P3. I tried rcp://user@host/ (or protocol other than ftp) and netrw + used ssh! That wasn't what I asked for... + + Netrw has two methods for browsing remote directories: ssh + and ftp. Unless you specify ftp specifically, ssh is used. + When it comes time to do download a file (not just a directory + listing), netrw will use the given protocol to do so. + + *netrw-p4* + P4. I would like long listings to be the default. + + let g:netrw_liststyle= 1 + + Check out |netrw-browse-var| for more customizations that + you can set. + + *netrw-p5* + P5. My times come up oddly in local browsing + + Does your system's strftime() accept the "%c" to yield dates + such as "Sun Apr 27 11:49:23 1997"? If not, do a "man strftime" + and find out what option should be used. Then put it into + your <.vimrc>: + let g:netrw_timefmt= "%X" (where X is the option) + + *netrw-p6* + P6. I want my current directory to track my browsing. + How do I do that? + + let g:netrw_keepdir= 0 + + *netrw-p7* + P7. I use Chinese (or other non-ascii) characters in my filenames, and + netrw (Explore, Sexplore, Hexplore, etc) doesn't display them! + + (taken from an answer provided by Wu Yongwei on the vim + mailing list) + I now see the problem. You code page is not 936, right? Vim + seems only able to open files with names that are valid in the + current code page, as are many other applications that do not + use the Unicode version of Windows APIs. This is an OS-related + issue. You should not have such problems when the system + locale uses UTF-8, such as modern Linux distros. + + (...it is one more reason to recommend that people use utf-8!) + + *netrw-p8* + P8. I'm getting "ssh is not executable on your system" -- what do I + do? + + (Dudley Fox) Most people I know use putty for windows ssh. It + is a free ssh/telnet application. You can read more about it + here: + + http://www.chiark.greenend.org.uk/~sgtatham/putty/ Also: + + (Marlin Unruh) This program also works for me. It's a single + executable, so he/she can copy it into the Windows\System32 + folder and create a shortcut to it. + + (Dudley Fox) You might also wish to consider plink, as it + sounds most similar to what you are looking for. plink is an + application in the putty suite. + + http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html#plink + + (Vissale Neang) Maybe you can try OpenSSH for windows, which + can be obtained from: + + http://sshwindows.sourceforge.net/ + + It doesn't need the full Cygwin package. + + (Antoine Mechelynck) For individual Unix-like programs needed + for work in a native-Windows environment, I recommend getting + them from the GnuWin32 project on sourceforge if it has them: + + http://gnuwin32.sourceforge.net/ + + Unlike Cygwin, which sets up a Unix-like virtual machine on + top of Windows, GnuWin32 is a rewrite of Unix utilities with + Windows system calls, and its programs works quite well in the + cmd.exe "Dos box". + + (dave) Download WinSCP and use that to connect to the server. + In Preferences > Editors, set gvim as your editor: + + - Click "Add..." + - Set External Editor (adjust path as needed, include + the quotes and !.! at the end): + "c:\Program Files\Vim\vim70\gvim.exe" !.! + - Check that the filetype in the box below is + {asterisk}.{asterisk} (all files), or whatever types + you want (cec: change {asterisk} to * ; I had to + write it that way because otherwise the helptags + system thinks its a tag) + - Make sure its at the top of the listbox (click it, + then click "Up" if its not) + If using the Norton Commander style, you just have to hit <F4> + to edit a file in a local copy of gvim. + + (Vit Gottwald) How to generate public/private key and save + public key it on server: > + http://www.tartarus.org/~simon/puttydoc/Chapter8.html#pubkey-gettingready + 8.3 Getting ready for public key authentication +< + How to use private key with 'pscp': > + http://www.tartarus.org/~simon/puttydoc/Chapter5.html + 5.2.4 Using public key authentication with PSCP +< + (cec) To make proper use of these suggestions above, you will + need to modify the following user-settable variables in your + .vimrc: + + |g:netrw_ssh_cmd| |g:netrw_list_cmd| |g:netrw_mkdir_cmd| + |g:netrw_rm_cmd| |g:netrw_rmdir_cmd| |g:netrw_rmf_cmd| + + The first one (|g:netrw_ssh_cmd|) is the most important; most + of the others will use the string in g:netrw_ssh_cmd by + default. + *netrw-p9* *netrw-ml_get* + P9. I'm browsing, changing directory, and bang! ml_get errors + appear and I have to kill vim. Any way around this? + + Normally netrw attempts to avoid writing swapfiles for + its temporary directory buffers. However, on some systems + this attempt appears to be causing ml_get errors to + appear. Please try setting |g:netrw_use_noswf| to 0 + in your <.vimrc>: > + let g:netrw_use_noswf= 0 +< + +============================================================================== +11. Debugging *netrw-debug* + +The <netrw.vim> script is typically available as: +> + /usr/local/share/vim/vim6x/plugin/netrw.vim +< -or- > + /usr/local/share/vim/vim7x/plugin/netrw.vim +< +which is loaded automatically at startup (assuming :set nocp). + + 1. Get the <Decho.vim> script, available as: + + http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_scripts + as "Decho, a vimL debugging aid" + or + http://vim.sourceforge.net/scripts/script.php?script_id=120 + + and put it into your local plugin directory. + + 2. <Decho.vim> itself needs the <cecutil.vim> script, so you'll need + to put it into your .vim/plugin, too. You may obtain it from: + + http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs + as "DrC's Utilities" + + 3. Edit the <netrw.vim> file by typing: + + vim netrw.vim + :DechoOn + :wq + + To restore to normal non-debugging behavior, edit <netrw.vim> + by typing + + vim netrw.vim + :DechoOff + :wq + + This command, provided by <Decho.vim>, will comment out all + Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()). + + 4. Then bring up vim and attempt a transfer or do browsing. A set of + messages should appear concerning the steps that <netrw.vim> took + in attempting to read/write your file over the network. + + To save the file, use > + :wincmd j + :set bt= + :w! DBG +< Please send that information to <netrw.vim>'s maintainer, > + NdrOchip at ScampbellPfamily.AbizM - NOSPAM +< +============================================================================== +12. History *netrw-history* {{{1 + + v108: Jan 03, 2007 * included preview map (|netrw-p|), supporting + remote browsing + * netrw can now source remote files + Jan 26, 2007 * Colton Jamieson noted that remote directory + browsing did not support alternate port + selection. This feature has now been extended + to apply to all remote browsing commands via ssh. + (list, remove/delete, rename) + Jan 31, 2007 * Luis Florit reported that @* was an invalid + register. The @* register is now only saved and + restored if |guioptions| contains "a". + Feb 02, 2007 * Fixed a bug that cropped up when writing files + via scp using cygwin + Feb 08, 2007 * tree listing mode managed to stop working again; + fixed again! + Feb 15, 2007 * Guido Van Hoecke reported that netrw didn't + handle browsing well with M$ ftp servers. He even + set up a temporary account for me to test with + (thanks!). Netrw now can browse M$ ftp servers. + v107: Oct 12, 2006 * bypassed the autowrite option + Oct 24, 2006 * handles automatic decompression of *.gz and *.bz2 + files + Nov 03, 2006 * Explore will highlight matching files when + **/pattern is used (and if the |'hls'| option + is set) + Nov 09, 2006 * a debugging line, when enabled, was inadvertently + bringing up help instead of simply reporting on + list contents + Nov 21, 2006 * tree listing improved (cursor remains put) + Nov 27, 2006 * fixed b:netrw_curdir bug when repeated "i"s were + pressed. + Dec 15, 2006 * considerable qty of changes, mostly to share more + code between local and remote browsing. Includes + support for tree-style listing for both remote + and local browsing. + Dec 15, 2006 * Included Peter Bengtsson's modifications to + support the Amiga. + v106: Sep 21, 2006 * removed old v:version<700 code as netrw now + requires vim 7.0 + * worked around a bug where register * was + overwritten during local browsing + v104: Sep 05, 2006 * as suggested by Rodolfo Borges, :Explore and + variants will position the cursor on the file + just having been edited + * changed default |g:netrw_sort_sequence| order + * changed b, Nb to simply mb (see |netrw-mb|) + * changed B, NB to simply gb (see |netrw-gb|) + * tree listing style (see |g:netrw_liststyle|) + * attempts to retain the alternate file + v103: Jul 26, 2006 * used Yakov Lerner's tip#1289 to improve netrw + error message display + * wide listings didn't handle files with backslashes + in their names properly. A symptom was an + inability to open files. + Aug 09, 2006 * included "t" mapping for opening tabbed windows, + both for remote and local browsing + * changed netrw_longlist to netrw_liststyle + Aug 15, 2006 * fixed one of the NB maps + Aug 22, 2006 * changed *Explore commands to use -nargs=* instead + of -nargs=?. Allows both -complete=dir _and_ the + starstar arguments to work (-nargs=? seems to + require one or the other). + Aug 23, 2006 * copied all w:.. variables across splits to + new windows + Aug 25, 2006 * when g:netrw_browsex_viewer was '-' + (see |g:netrw_browsex_viewer|) it wasn't causing + netrwFileHandlers#Invoke() to be called as it + was expected to. (tnx Steve Dugaro) + Aug 29, 2006 * changed NetBrowseX() to use "setlocal ... noswf" + instead of "set ... noswf" (tnx Benji Fisher) + Aug 31, 2006 * tabs and fastbrowse<=1 didn't work together. + v102: Jun 15, 2006 * chgd netrwPlugin to call netrw#LocalBrowseCheck() + * bugfix: g:netrw_keepdir==0 had stopped working + Jul 06, 2006 * bugfix: NetOptionSave/Restore now saves/restores + the unnamed register (|registers|) + Jul 07, 2006 * |g:netrw_menu| support included + Jul 13, 2006 * :Texplore command implemented + Jul 17, 2006 * NetSplit and (Local|Net)BrowseChgDir() were both + splitting windows. This affected o, v, and + g:netrw_browse_split. + Jul 20, 2006 * works around wildignore setting (was causing + netrw's local browser not to list wildignore'd + files) + Jul 24, 2006 * <leftmouse> acts as a <cr> for selecting a file + <rightmouse> acts as a <del> for deleting a file + v100: May 14, 2006 * when using Windows and shell==cmd.exe, the + default for g:netrw_ignorenetrc is now 1 + * bugfix: unwanted ^Ms now removed + (affected shell==cmd.exe - Windows) + * added Bookmarks and History to the menu + * an error message about non-existing + w:netrw_longlist was appearing during attempts to + Explore (fixed) + * g:netrw_shq now available to make netrw use + specified style of quotes for commands + May 29, 2006 * user NFH_*() functions were inadvertently being + ignored + * fixed a Windows non-cygwin ftp handling problem. + * hiding pattern candidate separators included some + characters it shouldn't have (tnx to Osei Poku) + Jun 01, 2006 * for browsing, netrw was supposed to use "dir" + instead of "ls -lF" when using + ftp+non-cygwin+windows. Fixed. + * an inadvertently left-in-place debugging statement + was preventing use of the "x" key with browsing. + Jun 05, 2006 * g:netrw_nogx available to prevent making the gx + map (see |g:netrw_nogx|) + * bugfix, Explore woulnd't change directory + properly (vim ., :Explore subdirname) + Jun 06, 2006 * moved history to 2nd line in Netrw menu + * fixed delete for unix-based systems + Jun 07, 2006 * x key now works for windows-noncygwin-ftp + Jun 08, 2006 * Explore */pat and **//pat now wraps + v99: May 09, 2006 * g:netrw_browse_split=3 for opening files in new + tabs implemented. + May 12, 2006 * deletes temporary file at end of NetRead() + * visual mode based Obtain implemented + * added -complete=dir to the various Explore + commands + v98: May 02, 2006 * the "p" key didn't work properly when the browsing + directory name had spaces in it. + v97: May 01, 2006 * exists("&acd") now used to determine if + the 'acd' option exists + * "obtain" now works again under Windows + v96: * bugfix - the |'acd'| option is not always defined but is + now bypassed only when it is + v95: * bugfix - Hiding mode worked correctly (don't show any file + matching any of the g:netrw_hide patterns), but + but showing mode was showing only those files that didn't + match any of the g:netrw_hide patterns. Instead, it now + shows all files that match any of the g:netrw_hide patterns + (the difference between a logical and and logical or). + v94: * bugfix - a Decho() had a missing quote; only affects things + when debugging was enabled. + v93: * bugfix - removed FocusGained event from causing a slow-browser + refresh for Windows + v92: * :Explore **//pattern implemented (**/filepattern already taken) + v91: * :Explore */pattern implemented + * |'acd'| option bypassed + v90: * mark ', as suggested by Yegappan Lakshmanan, used to help + guarantee entry into the jump list when appropriate. + * <s-down> and <s-up> are no longer defined until a + :Explore **/pattern is used (if the user already has a map + for them). They will be defined for new browser windows + from that point forward. + v89: * A <s-down>, <s-up>, :Nexplore, or a :Pexplore without having + first done an :Explore **/pattern (see |netrw-starstar|) caused + a lot of unhelpful error messages to appear + v88: * moved DrChip.Netrw menu to Netrw. Now has priority 80 by + default. g:NetrwTopLvlMenu == "Netrw" and can be changed + by the user to suit. The priority is g:NetrwMenuPriority. + * Changed filetype for browser displays from netrwlist to netrw. + v87: * bug fix -- menus were partially disappearing + v85: * bug fix -- missing an endif + * bug fix -- handles spaces in names and directories when using + ftp-based browsing + v83: * disabled stop-acd handling; the change in directory handling + may allow acd to be used again. Awaiting feedback. + * D was refusing to delete remote files/directories in wide + listing mode. + v81: * FocusGained also used to refresh/wipe local browser directory + buffers + * (bugfix) netrw was leaving [Scratch] buffers behind when the + the user had the "hidden" option set. The 'hidden' option is + now bypassed. + v80: * ShellCmdPost event used in conjunction with g:netrw_fastbrowse + to refresh/wipe local browser directory buffers. + v79: * directories are now displayed with nowrap + * (bugfix) if the column width was smaller than the largest + file's name, then netrw would hang when using wide-listing + mode - fixed + * g:netrw_fastbrowse introduced + v78: * progress has been made on allowing spaces inside directory + names for remote work (reading, writing, browsing). (scp) + v77: * Mikolaj Machowski fixed a bug in a substitute command + * g:netrw_browsex_viewer implemented + * Mikolaj Machowski pointed out that gnome-open is often + executable under KDE systems, although it is effectively + not functional. NetBrowseX now looks for "kicker" as + a running process to determine if KDE is actually the + really running. + * Explorer's O functionality was inadvertently left out. + Netrw now does the same thing, but with the "P" key. + * added g:netrw_browse_split option + * fixed a bug where the directory contained a "." but + the file didn't (was treating the dirname from "." + onwards as a suffix) + v76: * "directory is missing" error message now restores echo + highlighting + v75: * file://... now conforms to RFC2396 (thanks to S. Zacchiroli) + * if the binary option is set, then NetWrite() will only write + the whole file (line numbers don't make sense with this). + Supports writing of tar and zip files. + v74: * bugfix (vim, then :Explore) now works + * ctrl-L keeps cursor at same screen location (both local and + remote browsing) + * netrw now can read remote zip and tar files + * Obtain now uses WinXP ftp+.netrc successfully + v73: * bugfix -- scp://host/path/file was getting named incorrectly + * netrw detects use of earlier-than-7.0 version of vim and issues + a pertinent error message. + * netrwSettings.vim is now uses autoloading. Only + <netrwPlugin.vim> is needed as a pure plugin + (ie. always loaded). + v72: * bugfix -- formerly, one could prevent the loading of netrw + by "let g:loaded_netrw=1"; when autoloading became supported, + this feature was lost. It is now restored. + v71: * bugfix -- made some "set nomodifiable"s into setlocal variants + (allows :e somenewfile to be modifiable as usual) + * NetrwSettings calls a netrw function, thereby assuring that + netrw has loaded. However, if netrw does not load for whatever + reason, then NetrwSettings will now issue a warning message. + * For what reason I don't recall, when wget and fetch are both + not present, and an attempt to read a http://... url is made, + netrw exited. It now only returns. + * When ch=1, on the second and subsequent uses of browsing Netrw + would issue a blank line to clear the echo'd messages. This + caused an annoying "Hit-Enter" prompt; now a blank line message + is echo'd only if &ch>1. + v70: * when using |netrw-O|, the "Obtaining filename" message is now + shown using |hl-User9|. If User9 has not been defined, netrw + will define it. + v69: * Bugfix: win95/98 machines were experiencing a + "E121: Undefined variable: g:netrw_win95ftp" message + v68: * double-click-leftmouse selects word under mouse + v67: * Passwords which contain blanks will now be surrounded by + double-quotes automatically (Yongwei) + v66: * Netrw now seems to work with a few more Windows situations + * O now obtains a file: remote browsing file -> local copy, + locally browsing file -> current directory (see :pwd) + * i now cycles between thin, long, and wide listing styles + * NB and Nb are maps that are always available; corresponding + B and b maps are only available when not using wide listing + in order to allow them to be used for motions + v65: * Browser functions now use NetOptionSave/Restore; in particular, + netrw now works around the report setting + v64: * Bugfix - browsing a "/" directory (Unix) yielded buffers + named "[Scratch]" instead of "/" + * Bugfix - remote browsing with ftp was omitting the ./ and ../ + v63: * netrw now takes advantage of autoload (and requires 7.0) + * Bugfix - using r (to reverse sort) working again + v62: * Bugfix - spaces allowed again in directory names with + g:netrw_keepdir=0. In fact, I've tested netrw (again) + with most ANSI punctuation marks for directory names. + * Bugfix - NetrwSettings gave errors when g:netrw_silent + had not be set. + v61: * document upgrade -- netrw variable-based settings all should + have tags. Supports NetrwSettings command. + * several important variables are window-oriented. Netrw has + to transfer these across a window split. See s:BufWinVars() + and s:UseBufWinVars(). + v60: * when using the i map to switch between long and short listings, + netrw will now keep cursor on same line + * "Match # of #" now uses status line + * :Explore **/*.c will now work from a non-netrw-browser window + * :Explore **/patterns can now be run in separate browser windows + * active banner (hit <cr> will cause various things to happen) + v59: * bugfix -- another keepalt work-around installed (for vim6.3) + * "Match # of #" for Explore **/pattern matches + v58: * Explore and relatives can now handle **/somefilepattern (v7) + * Nexplore and Pexplore introduced (v7). shift-down and shift-up + cursor keys will invoke Nexplore and Pexplore, respectively. + * bug fixed with o and v + * autochdir only worked around for vim when it has been + compiled with either |+netbeans_intg| or |+sun_workshop| + * Under Windows, all directories and files were being preceded + with a "/" when local browsing. Fixed. + * When: syntax highlighting is off, laststatus=2, and remote + browsing is used, sometimes the laststatus highlighting + bleeds into the entire display. Work around - do an extra + redraw in that case. + * Bugfix: when g:netrw_keepdir=0, due to re-use of buffers, + netrw didn't change the directory when it should've + * Bugfix: D and R commands work again + v57: * Explore and relatives can now handle RO files + * reverse sort restored with vim7's sort command + * g:netrw_keepdir now being used to keep the current directory + unchanged as intended (sense change) + * vim 6.3 still supported + v56: * LocalBrowse now saves autochdir setting, unsets it, and + restores it before returning. + * using vim's rename() instead of system + local_rename variable + * avoids changing directory when g:netrw_keepdir is false + v55: * -bar used with :Explore :Sexplore etc to allow multiple + commands to be separated by |s + * browser listings now use the "nowrap" option + * browser: some unuseful error messages now suppressed + v54: * For backwards compatibility, Explore and Sexplore have been + implemented. In addition, Hexplore and Vexplore commands + are available, too. + * <amatch> used instead of <afile> in the transparency + support (BufReadCmd, FileReadCmd, FileWriteCmd) + * ***netrw*** prepended to various error messages netrw may emit + * g:netrw_port used instead of b:netrw_port for scp + * any leading [:#] is removed from port numbers + v53: * backslashes as well as slashes placed in various patterns + (ex. g:netrw_sort_sequence) to better support Windows + v52: * nonumber'ing now set for browsing buffers + * when the hiding list hid all files, error messages ensued. Fixed + * when browsing, swf is set, but directory is not set, when netrw + was attempting to restore options, vim wanted to save a swapfile + to a local directory using an url-style path. Fixed + v51: * cygwin detection now automated (using windows and &shell is bash) + * customizable browser "file" rejection patterns + * directory history + * :[range]w url now supported (ie. netrw has a FileWriteCmd event) + * error messages have a "Press <cr> to continue" to allow them + to be seen + * directory browser displays no longer bother the swapfile + * u/U commands to go up and down the history stack + * history stack may be saved with viminfo with its "!" option + * bugfixes associated with unwanted [No Files] entries + v50: * directories now displayed using buftype=nofile; should keep the + directory names as-is + * attempts to remove empty "[No File]" buffers leftover + from :file ..name.. commands + * bugfix: a "caps-lock" editing difficulty left in v49 was fixed + * syntax highlighting for "Showing:" the hiding list included + * bookmarks can now be retained if "!" is in the viminfo option + v49: * will use ftp for http://.../ browsing v48: + * One may use ftp to do remote host file browsing + * (windows and !cygwin) remote browsing with ftp can now use + the "dir" command internally to provide listings + * g:netrw_keepdir now allows one to keep the initial current + directory as the current directory (normally the local file + browser makes the currently viewed directory the current + directory) + * g:netrw_alto and g:netrw_altv now support alternate placement + of windows started with o or v + * Nread ? and Nwrite ? now uses echomsg (instead of echo) so + :messages can repeat showing the help + * bugfix: avoids problems with partial matches of directory names + to prior buffers with longer names + * one can suppress error messages with g:netrw_quiet ctrl-h used + * instead of <Leader>h for editing hiding list one may edit the + * sorting sequence with the S map now allows confirmation of + * deletion with [y(es) n(o) a(ll) q(uit)] the "x" map now handles + * special file viewing with: + (windows) rundll32 url.dll (gnome) gnome-open (kde) + kfmclient If none of these are on the executable path, then + netrwFileHandlers.vim is used. + * directory bookmarking during both local and remote browsing + implemented + * one may view all, use the hiding list to suppress, or use the + hiding list to show-only remote and local file/directory + listings + * improved unusual file and directory name handling preview + * window support + v47: * now handles local directory browsing. + v46: * now handles remote directory browsing + * g:netrw_silent (if 1) will cause all transfers to be silent + v45: * made the [user@]hostname:path form a bit more restrictive to + better handle errors in using protocols (e.g. scp:usr@host:file + was being recognized as an rcp request) v44: * changed from + "rsync -a" to just "rsync" + * somehow an editing error messed up the test to recognize + use of the fetch method for NetRead. + * more debugging statements included + v43: * moved "Explanation" comments to <pi_netrw.txt> help file as + "Network Reference" (|netrw-ref|) + * <netrw.vim> now uses Dfunc() Decho() and Dret() for debugging + * removed superfluous NetRestorePosn() calls + v42: * now does BufReadPre and BufReadPost events on file:///* and + file://localhost/* v41: * installed file:///* and + file://localhost/* handling v40: * prevents redraw when a + protocol error occurs so that the user may see it v39: * sftp + support v38: * Now uses NetRestorePosn() calls with + Nread/Nwrite commands + * Temporary files now removed via bwipe! instead of bwipe + (thanks to Dave Roberts) v37: * Claar's modifications which + test if ftp is successful, otherwise give an error message + * After a read, the alternate file was pointing to the temp file. + The temp file buffer is now wiped out. + * removed silent from transfer methods so user can see what's + happening + + +============================================================================== +12. Credits *netrw-credits* {{{1 + + Vim editor by Bram Moolenaar (Thanks, Bram!) + dav support by C Campbell + fetch support by Bram Moolenaar and C Campbell + ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM> + http support by Bram Moolenaar <bram@moolenaar.net> + rcp + rsync support by C Campbell (suggested by Erik Warendorph) + scp support by raf <raf@comdyn.com.au> + sftp support by C Campbell + + inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell + + Jérôme Augé -- also using new buffer method with ftp+.netrc + Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use, + fetch,... + Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution + Erik Warendorph -- for several suggestions (g:netrw_..._cmd + variables, rsync etc) + Doug Claar -- modifications to test for success with ftp + operation + +============================================================================== + vim:tw=78:ts=8:ft=help:norl:fdm=marker diff --git a/vimfiles/doc/pi_vimball.txt b/vimfiles/doc/pi_vimball.txt new file mode 100644 index 0000000..ff3bb90 --- /dev/null +++ b/vimfiles/doc/pi_vimball.txt @@ -0,0 +1,137 @@ +*pi_vimball.txt* For Vim version 7.0. Last change: 2007 Jan 03 + + ---------------- + Vimball Archiver + ---------------- + +Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM> + (remove NOSPAM from Campbell's email first) +Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright* + The VIM LICENSE applies to Vimball.vim, and Vimball.txt + (see |copyright|) except use "Vimball" instead of "Vim". + No warranty, express or implied. + Use At-Your-Own-Risk! + +============================================================================== +1. Contents *vba* *vimball* *vimball-contents* + + 1. Contents......................................: |vimball-contents| + 2. Vimball Manual................................: |vimball-manual| + MkVimball.....................................: |:MkVimball| + UseVimball....................................: |:UseVimball| + RmVimball.....................................: |:RmVimball| + 3. Vimball History...............................: |vimball-history| + + +============================================================================== +2. Vimball Manual *vimball-manual* + + *:MkVimball* + :[range]MkVimball[!] filename [path] + + The range is composed of lines holding paths to files to be included + in your new vimball. As an example: > + plugin/something.vim + doc/something.txt +< using > + :[range]MkVimball filename +< + on this range of lines will create a file called "filename.vba" which + can be used by Vimball.vim to re-create these files. If the + "filename.vba" file already exists, then MkVimball will issue a + warning and not create the file. Note that these paths are relative + to your .vim (vimfiles) directory, and the files should be in that + directory. The vimball plugin normally uses the first |'runtimepath'| + directory that exists as a prefix; don't use absolute paths, unless + the user has specified such a path. + *g:vimball_home* + You may override the use of the |'runtimepath'| by specifying a + variable, g:vimball_home. + + If you use the exclamation point (!), then MkVimball will create the + "filename.vba" file, overwriting it if it already exists. This + behavior resembles that for |:w|. + + *vimball-extract* + vim filename.vba + + Simply editing a Vimball will cause Vimball.vim to tell the user to + source the file to extract its contents. + + Extraction will only proceed if the first line of a putative vimball + file holds the "Vimball Archiver by Charles E. Campbell, Jr., Ph.D." + line. + + :VimballList *:VimballList* + + This command will tell Vimball to list the files in the archive, along + with their lengths in lines. + + :UseVimball [path] *:UseVimball* + + This command is contained within the vimball itself; it invokes the + vimball#Vimball() routine which is responsible for unpacking the + vimball. One may choose to execute it by hand instead of sourcing + the vimball; one may also choose to specify a path for the + installation, thereby overriding the automatic choice of the first + existing directory on the |'runtimepath'|. + + :RmVimball vimballfile [path] *:RmVimball* + + This command removes all files generated by the specified vimball + (but not any directories it may have made). One may choose a path + for de-installation, too (see |'runtimepath'|); otherwise, the + default is the first existing directory on the |'runtimepath'|. + To implement this, a file (.VimballRecord) is made in that directory + containing a record of what files need to be removed for all vimballs + used thus far. + + +============================================================================== +3. Vimball History *vimball-history* {{{1 + + 21 : Nov 27, 2006 * (tnx to Bill McCarthy) vimball had a header + handling problem and it now changes \s to /s + 20 : Nov 20, 2006 * substitute() calls have all had the 'e' flag + removed. + 18 : Aug 01, 2006 * vimballs now use folding to easily display their + contents. + * if a user has AsNeeded/somefile, then vimball + will extract plugin/somefile to the AsNeeded/ + directory + 17 : Jun 28, 2006 * changes all \s to /s internally for Windows + 16 : Jun 15, 2006 * A. Mechylynk's idea to allow users to specify + installation root paths implemented for + UseVimball, MkVimball, and RmVimball. + * RmVimball implemented + 15 : Jun 13, 2006 * bugfix + 14 : May 26, 2006 * bugfixes + 13 : May 01, 2006 * exists("&acd") used to determine if the acd + option exists + 12 : May 01, 2006 * bugfix - the |'acd'| option is not always defined + 11 : Apr 27, 2006 * VimballList would create missing subdirectories that + the vimball specified were needed. Fixed. + 10 : Apr 27, 2006 * moved all setting saving/restoration to a pair of + functions. Included some more settings in them + which frequently cause trouble. + 9 : Apr 26, 2006 * various changes to support Windows prediliction + for backslashes and spaces in file and directory + names. + 7 : Apr 25, 2006 * bypasses foldenable + * uses more exe and less norm! (:yank :put etc) + * does better at insuring a "Press ENTER" prompt + appears to keep its messages visible + 4 : Mar 31, 2006 * BufReadPost seems to fire twice; BufReadEnter + only fires once, so the "Source this file..." + message is now issued only once. + 3 : Mar 20, 2006 * removed query, now requires sourcing to be + extracted (:so %). Message to that effect + included. + * :VimballList now shows files that would be + extracted. + 2 : Mar 20, 2006 * query, :UseVimball included + 1 : Mar 20, 2006 * initial release + + +============================================================================== +vim:tw=78:ts=8:ft=help:fdm=marker diff --git a/vimfiles/doc/tComment.txt b/vimfiles/doc/tComment.txt new file mode 100644 index 0000000..1e8f73d --- /dev/null +++ b/vimfiles/doc/tComment.txt @@ -0,0 +1,151 @@ +*tComment.txt* tComment -- One comment plugin to rule them all + +Author: Thomas Link, samul AT web.de + +tComment provides easy to use, file type sensible comments for Vim. It +can handle embedded syntax. + + + *tComment-Installation* +Installation~ +Copy the file tComment.vim to your plugin directory (~/.vim/plugins/ or +similar). See |standard-plugin| for further details. + + *tComment-uninstall* +In case you have some bash or similar, you can feed the file +etc/tComment.lst to rm: > + + cd $HOME/.vim/ + rm -i `cat etc/tComment.lst` + + *tComment-Usage* +Usage~ +The command TComment is bound to <c-_><c-_> by default. TComment works +like a toggle, i.e., it will comment out text that contains uncommented +lines, and it will remove comment markup for already commented text +(i.e. text that contains no uncommented lines). + + *tComment-Key-Bindings* +Key bindings~ + <c-_><c-_> :: :TComment + <c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END> + <c-_>b :: :TCommentBlock + <c-_>a :: :TCommentAs <QUERY COMMENT TYPE> + <c-_>s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE> + <c-_>i :: :TCommentInline + <c-_>r :: :TCommentRight + + *tComment-commands* +Alternatively, you can type (? meaning "optional argument"): + + *:TComment* + :?<range> TComment ?commentBegin ?commentEnd + :?<range> TComment! ?commentBegin ?commentEnd + NOTE: If there is a visual selection that begins and ends in the same + line, then TCommentInline is used instead. + + NOTE: The range is optional and defaults to the current line. + + *:TCommentInline* + :?<range> TCommentInline ?commentBegin ?commentEnd + :?<range> TCommentInline! ?commentBegin ?commentEnd + Use the {&ft}_inline comment style. + + *:TCommentBlock* + :?<range> TCommentBlock ?commentBegin ?commentEnd + :?<range> TCommentBlock! ?commentBegin ?commentEnd + Comment as "block", e.g. use the {&ft}_block comment style. + NOTE: This command is kind of crude. It doesn't indent or reformat + the text. + + *:TCommentAs* + :?<range> TCommentAs filetype + :?<range> TCommentAs! filetype + NOTE: TCommentAs requires g:tcomment_{filetype} to be defined. + NOTE: This command supports command line completion. See 'wildmode' + and 'wildmenu' for how to get the most out of it. + + *:TCommentRight* + :?<range> TCommentRight + :?<range> TCommentRight! + 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 + are commented out at from the current cursor positon downwards. + + The bang (!) variants always comment out the selected text and don't + work as toggles. + + *TCommentDefineType()* + Using this command you can also use different comment styles with + the TCommentDefineType(name, commentstring) function. This function + takes two arguments: + name :: The name is either &filetype or {&filetype}_{style}. + I.e., For block comments the {&filetype}_block and for + inline comments the {&filetype}_inline styles are used. + comment string :: a string mostly as described in + 'commentstring'. + + If you want to define, e.g., a fancy block comment style for html + you could do something like: > + + call TCommentDefineType("html_fancy_block", "<!--%s -->\n -- ") + +< The part after the newline character is used for marking "middle" + lines. + + This comment style could then be accessed via (this command has + command line completion): > + + '<,'>TCommentAs html_fancy_block + +< If you're editing a html file, this could best be done by the <c-_>s + key map. + + +Goals~ +- Maintain indentation of selected text; the comment markers are left + aligned but the text on the right (i.e., the comment) is indented + like the original text + +- Handle embedded syntax like php+html or html+javaScript+css; you + have to set g:tcommentGuessFileType_{&filetype} to 1 or to the + fallback file type in order to activate this feature for other file + types than php or html + + tComment deduces the correct file type from the syntax name, similar + to the way EnhancedCommentify.vim does it. In opposition to + EnhancedCommentify.vim, it matches the syntax name against a list the + known file types, so that it can deal with, e.g., embedded javaScript + +- Easy to customize/adapt for an yet unknown syntax by setting buffer + local variables (b:commentStart, b:commentEnd, or b:commentstring), + global variables (g:tcomment_{&ft} and g:tcomment_{&ft}_block), or the + buffer local &commentstring option (which can be set on a vim + |modeline|) + +- Use 'commentstring' or 'comments' as a fallback (i.e., if a filetype + is properly defined, TComment will automatically support it) + +- Same short-cut for commenting text and for removing comment markup + +- The decision whether text should be commented or uncommented is made + 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 + with some other plugins + +As of version 1.5, the following file types are explicitly defined +(other filetypes are most likely supported through the 'commentstring' +or 'comments' variables): + + ada, apache, autoit, catalog, cpp, css, c, cfg, conf, desktop, + docbk, dosbatch, dosini, dsl, dylan, eiffel, gtkrc, haskell, html, + io, javaScript, java, lisp, m4, nroff, objc, ocaml, pascal, perl, + php, prolog, ruby, r, scheme, sgml, sh, sql, spec, sps, tcl, tex, + tpl, viki, vim, websec, xml, xslt, yaml + +Credits~ +The way we check for embedded syntax was adapted from/inspired by Meikel +Brandmeyer's EnhancedCommentify.vim (vimscript #23). + + +vim: tw=72 diff --git a/vimfiles/doc/tags b/vimfiles/doc/tags new file mode 100644 index 0000000..029ce2e --- /dev/null +++ b/vimfiles/doc/tags @@ -0,0 +1,1547 @@ +:Explore pi_netrw.txt /*:Explore* +:GLVS pi_getscript.txt /*:GLVS* +:GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat* +:Hexplore pi_netrw.txt /*:Hexplore* +:MkVimball pi_vimball.txt /*:MkVimball* +:Nexplore pi_netrw.txt /*:Nexplore* +:Pexplore pi_netrw.txt /*:Pexplore* +:RmVimball pi_vimball.txt /*:RmVimball* +:Sexplore pi_netrw.txt /*:Sexplore* +:TComment tComment.txt /*:TComment* +:TCommentAs tComment.txt /*:TCommentAs* +:TCommentBlock tComment.txt /*:TCommentBlock* +:TCommentInline tComment.txt /*:TCommentInline* +:TCommentRight tComment.txt /*:TCommentRight* +:Texplore pi_netrw.txt /*:Texplore* +:UseVimball pi_vimball.txt /*:UseVimball* +:Vexplore pi_netrw.txt /*:Vexplore* +:VimballList pi_vimball.txt /*:VimballList* +C-Reference crefvim.txt /*C-Reference* +GetLatestVimScripts pi_getscript.txt /*GetLatestVimScripts* +GetLatestVimScripts-copyright GetLatestVimScripts.txt /*GetLatestVimScripts-copyright* +GetLatestVimScripts-copyright pi_getscript.txt /*GetLatestVimScripts-copyright* +GetLatestVimScripts_dat pi_getscript.txt /*GetLatestVimScripts_dat* +I visincr.txt /*I* +IA visincr.txt /*IA* +ID visincr.txt /*ID* +IDMY visincr.txt /*IDMY* +II visincr.txt /*II* +IIO visincr.txt /*IIO* +IIR visincr.txt /*IIR* +IIX visincr.txt /*IIX* +IM visincr.txt /*IM* +IMDY visincr.txt /*IMDY* +IO visincr.txt /*IO* +IR visincr.txt /*IR* +IX visincr.txt /*IX* +IYMD visincr.txt /*IYMD* +Nread pi_netrw.txt /*Nread* +Nsource pi_netrw.txt /*Nsource* +Nwrite pi_netrw.txt /*Nwrite* +TCommentDefineType() tComment.txt /*TCommentDefineType()* +Vimball-copyright pi_vimball.txt /*Vimball-copyright* +b:netrw_lastfile pi_netrw.txt /*b:netrw_lastfile* +crefvim crefvim.txt /*crefvim* +crefvim.txt crefvim.txt /*crefvim.txt* +crefvimdoc crefvimdoc.txt /*crefvimdoc* +crefvimdoc.txt crefvimdoc.txt /*crefvimdoc.txt* +crv-# crefvim.txt /*crv-#* +crv-## crefvim.txt /*crv-##* +crv-#define crefvim.txt /*crv-#define* +crv-#elif crefvim.txt /*crv-#elif* +crv-#else crefvim.txt /*crv-#else* +crv-#endif crefvim.txt /*crv-#endif* +crv-#error crefvim.txt /*crv-#error* +crv-#if crefvim.txt /*crv-#if* +crv-#ifdef crefvim.txt /*crv-#ifdef* +crv-#ifndef crefvim.txt /*crv-#ifndef* +crv-#include crefvim.txt /*crv-#include* +crv-#line crefvim.txt /*crv-#line* +crv-#pragma crefvim.txt /*crv-#pragma* +crv-#undef crefvim.txt /*crv-#undef* +crv-BUFSIZ crefvim.txt /*crv-BUFSIZ* +crv-CHAR_BIT crefvim.txt /*crv-CHAR_BIT* +crv-CHAR_MAX crefvim.txt /*crv-CHAR_MAX* +crv-CHAR_MIN crefvim.txt /*crv-CHAR_MIN* +crv-CLOCKS_PER_SEC crefvim.txt /*crv-CLOCKS_PER_SEC* +crv-CX_LIMITED_RANGE crefvim.txt /*crv-CX_LIMITED_RANGE* +crv-DBL_DIG crefvim.txt /*crv-DBL_DIG* +crv-DBL_EPSILON crefvim.txt /*crv-DBL_EPSILON* +crv-DBL_MANT_DIG crefvim.txt /*crv-DBL_MANT_DIG* +crv-DBL_MAX crefvim.txt /*crv-DBL_MAX* +crv-DBL_MAX_10_EXP crefvim.txt /*crv-DBL_MAX_10_EXP* +crv-DBL_MAX_EXP crefvim.txt /*crv-DBL_MAX_EXP* +crv-DBL_MIN crefvim.txt /*crv-DBL_MIN* +crv-DBL_MIN_10_EXP crefvim.txt /*crv-DBL_MIN_10_EXP* +crv-DBL_MIN_EXP crefvim.txt /*crv-DBL_MIN_EXP* +crv-EDOM crefvim.txt /*crv-EDOM* +crv-EILSEQ crefvim.txt /*crv-EILSEQ* +crv-EOF crefvim.txt /*crv-EOF* +crv-ERANGE crefvim.txt /*crv-ERANGE* +crv-EXIT_FAILURE crefvim.txt /*crv-EXIT_FAILURE* +crv-EXIT_SUCCESS crefvim.txt /*crv-EXIT_SUCCESS* +crv-FENV_ACCESS crefvim.txt /*crv-FENV_ACCESS* +crv-FE_ALL_EXCEPT crefvim.txt /*crv-FE_ALL_EXCEPT* +crv-FE_DIVBYZERO crefvim.txt /*crv-FE_DIVBYZERO* +crv-FE_DOWNWARD crefvim.txt /*crv-FE_DOWNWARD* +crv-FE_INEXACT crefvim.txt /*crv-FE_INEXACT* +crv-FE_INVALID crefvim.txt /*crv-FE_INVALID* +crv-FE_OVERFLOW crefvim.txt /*crv-FE_OVERFLOW* +crv-FE_TONEAREST crefvim.txt /*crv-FE_TONEAREST* +crv-FE_TOWARDZERO crefvim.txt /*crv-FE_TOWARDZERO* +crv-FE_UNDERFLOW crefvim.txt /*crv-FE_UNDERFLOW* +crv-FE_UPWARD crefvim.txt /*crv-FE_UPWARD* +crv-FILE crefvim.txt /*crv-FILE* +crv-FILENAME_MAX crefvim.txt /*crv-FILENAME_MAX* +crv-FLT_DIG crefvim.txt /*crv-FLT_DIG* +crv-FLT_EPSILON crefvim.txt /*crv-FLT_EPSILON* +crv-FLT_MANT_DIG crefvim.txt /*crv-FLT_MANT_DIG* +crv-FLT_MAX crefvim.txt /*crv-FLT_MAX* +crv-FLT_MAX_10_EXP crefvim.txt /*crv-FLT_MAX_10_EXP* +crv-FLT_MAX_EXP crefvim.txt /*crv-FLT_MAX_EXP* +crv-FLT_MIN crefvim.txt /*crv-FLT_MIN* +crv-FLT_MIN_10_EXP crefvim.txt /*crv-FLT_MIN_10_EXP* +crv-FLT_MIN_EXP crefvim.txt /*crv-FLT_MIN_EXP* +crv-FLT_RADIX crefvim.txt /*crv-FLT_RADIX* +crv-FLT_ROUNDS crefvim.txt /*crv-FLT_ROUNDS* +crv-FOPEN_MAX crefvim.txt /*crv-FOPEN_MAX* +crv-FP_FAST_FMA crefvim.txt /*crv-FP_FAST_FMA* +crv-FP_FAST_FMAF crefvim.txt /*crv-FP_FAST_FMAF* +crv-FP_FAST_FMAL crefvim.txt /*crv-FP_FAST_FMAL* +crv-FP_ILOGB0 crefvim.txt /*crv-FP_ILOGB0* +crv-FP_ILOGBNAN crefvim.txt /*crv-FP_ILOGBNAN* +crv-HUGE_VAL crefvim.txt /*crv-HUGE_VAL* +crv-HUGE_VALF crefvim.txt /*crv-HUGE_VALF* +crv-HUGE_VALL crefvim.txt /*crv-HUGE_VALL* +crv-I crefvim.txt /*crv-I* +crv-INT16_C crefvim.txt /*crv-INT16_C* +crv-INT16_MAX crefvim.txt /*crv-INT16_MAX* +crv-INT16_MIN crefvim.txt /*crv-INT16_MIN* +crv-INT32_C crefvim.txt /*crv-INT32_C* +crv-INT32_MAX crefvim.txt /*crv-INT32_MAX* +crv-INT32_MIN crefvim.txt /*crv-INT32_MIN* +crv-INT64_C crefvim.txt /*crv-INT64_C* +crv-INT64_MAX crefvim.txt /*crv-INT64_MAX* +crv-INT64_MIN crefvim.txt /*crv-INT64_MIN* +crv-INT8_C crefvim.txt /*crv-INT8_C* +crv-INT8_MAX crefvim.txt /*crv-INT8_MAX* +crv-INT8_MIN crefvim.txt /*crv-INT8_MIN* +crv-INTMAX_C crefvim.txt /*crv-INTMAX_C* +crv-INTMAX_MAX crefvim.txt /*crv-INTMAX_MAX* +crv-INTMAX_MIN crefvim.txt /*crv-INTMAX_MIN* +crv-INTPTR_MAX crefvim.txt /*crv-INTPTR_MAX* +crv-INTPTR_MIN crefvim.txt /*crv-INTPTR_MIN* +crv-INT_FAST16_MAX crefvim.txt /*crv-INT_FAST16_MAX* +crv-INT_FAST16_MIN crefvim.txt /*crv-INT_FAST16_MIN* +crv-INT_FAST32_MAX crefvim.txt /*crv-INT_FAST32_MAX* +crv-INT_FAST32_MIN crefvim.txt /*crv-INT_FAST32_MIN* +crv-INT_FAST64_MAX crefvim.txt /*crv-INT_FAST64_MAX* +crv-INT_FAST64_MIN crefvim.txt /*crv-INT_FAST64_MIN* +crv-INT_FAST8_MAX crefvim.txt /*crv-INT_FAST8_MAX* +crv-INT_FAST8_MIN crefvim.txt /*crv-INT_FAST8_MIN* +crv-INT_LEAST16_MAX crefvim.txt /*crv-INT_LEAST16_MAX* +crv-INT_LEAST16_MIN crefvim.txt /*crv-INT_LEAST16_MIN* +crv-INT_LEAST32_MAX crefvim.txt /*crv-INT_LEAST32_MAX* +crv-INT_LEAST32_MIN crefvim.txt /*crv-INT_LEAST32_MIN* +crv-INT_LEAST64_MAX crefvim.txt /*crv-INT_LEAST64_MAX* +crv-INT_LEAST64_MIN crefvim.txt /*crv-INT_LEAST64_MIN* +crv-INT_LEAST8_MAX crefvim.txt /*crv-INT_LEAST8_MAX* +crv-INT_LEAST8_MIN crefvim.txt /*crv-INT_LEAST8_MIN* +crv-INT_MAX crefvim.txt /*crv-INT_MAX* +crv-INT_MIN crefvim.txt /*crv-INT_MIN* +crv-LC_ALL crefvim.txt /*crv-LC_ALL* +crv-LC_COLLATE crefvim.txt /*crv-LC_COLLATE* +crv-LC_CTYPE crefvim.txt /*crv-LC_CTYPE* +crv-LC_MONETARY crefvim.txt /*crv-LC_MONETARY* +crv-LC_NUMERIC crefvim.txt /*crv-LC_NUMERIC* +crv-LDBL_DIG crefvim.txt /*crv-LDBL_DIG* +crv-LDBL_EPSILON crefvim.txt /*crv-LDBL_EPSILON* +crv-LDBL_MANT_DIG crefvim.txt /*crv-LDBL_MANT_DIG* +crv-LDBL_MAX crefvim.txt /*crv-LDBL_MAX* +crv-LDBL_MAX_10_EXP crefvim.txt /*crv-LDBL_MAX_10_EXP* +crv-LDBL_MAX_EXP crefvim.txt /*crv-LDBL_MAX_EXP* +crv-LDBL_MIN crefvim.txt /*crv-LDBL_MIN* +crv-LDBL_MIN_10_EXP crefvim.txt /*crv-LDBL_MIN_10_EXP* +crv-LDBL_MIN_EXP crefvim.txt /*crv-LDBL_MIN_EXP* +crv-LONG_LONG_MAX crefvim.txt /*crv-LONG_LONG_MAX* +crv-LONG_LONG_MIN crefvim.txt /*crv-LONG_LONG_MIN* +crv-LONG_MAX crefvim.txt /*crv-LONG_MAX* +crv-LONG_MIN crefvim.txt /*crv-LONG_MIN* +crv-L_tmpnam crefvim.txt /*crv-L_tmpnam* +crv-MB_CUR_MAX crefvim.txt /*crv-MB_CUR_MAX* +crv-MB_LEN_MAX crefvim.txt /*crv-MB_LEN_MAX* +crv-NDEBUG crefvim.txt /*crv-NDEBUG* +crv-NULL crefvim.txt /*crv-NULL* +crv-NULL2 crefvim.txt /*crv-NULL2* +crv-NULL3 crefvim.txt /*crv-NULL3* +crv-NULL4 crefvim.txt /*crv-NULL4* +crv-NULL5 crefvim.txt /*crv-NULL5* +crv-NULL6 crefvim.txt /*crv-NULL6* +crv-PRIXFASTN crefvim.txt /*crv-PRIXFASTN* +crv-PRIXLEASTN crefvim.txt /*crv-PRIXLEASTN* +crv-PRIXMAX crefvim.txt /*crv-PRIXMAX* +crv-PRIXN crefvim.txt /*crv-PRIXN* +crv-PRIXPTR crefvim.txt /*crv-PRIXPTR* +crv-PRIdFASTN crefvim.txt /*crv-PRIdFASTN* +crv-PRIdLEASTN crefvim.txt /*crv-PRIdLEASTN* +crv-PRIdMAX crefvim.txt /*crv-PRIdMAX* +crv-PRIdN crefvim.txt /*crv-PRIdN* +crv-PRIdPTR crefvim.txt /*crv-PRIdPTR* +crv-PRIiFASTN crefvim.txt /*crv-PRIiFASTN* +crv-PRIiLEASTN crefvim.txt /*crv-PRIiLEASTN* +crv-PRIiMAX crefvim.txt /*crv-PRIiMAX* +crv-PRIiN crefvim.txt /*crv-PRIiN* +crv-PRIiPTR crefvim.txt /*crv-PRIiPTR* +crv-PRIoFASTN crefvim.txt /*crv-PRIoFASTN* +crv-PRIoLEASTN crefvim.txt /*crv-PRIoLEASTN* +crv-PRIoMAX crefvim.txt /*crv-PRIoMAX* +crv-PRIoN crefvim.txt /*crv-PRIoN* +crv-PRIoPTR crefvim.txt /*crv-PRIoPTR* +crv-PRIuFASTN crefvim.txt /*crv-PRIuFASTN* +crv-PRIuLEASTN crefvim.txt /*crv-PRIuLEASTN* +crv-PRIuMAX crefvim.txt /*crv-PRIuMAX* +crv-PRIuN crefvim.txt /*crv-PRIuN* +crv-PRIuPTR crefvim.txt /*crv-PRIuPTR* +crv-PRIxFASTN crefvim.txt /*crv-PRIxFASTN* +crv-PRIxLEASTN crefvim.txt /*crv-PRIxLEASTN* +crv-PRIxMAX crefvim.txt /*crv-PRIxMAX* +crv-PRIxN crefvim.txt /*crv-PRIxN* +crv-PRIxPTR crefvim.txt /*crv-PRIxPTR* +crv-PTRDIFF_MAX crefvim.txt /*crv-PTRDIFF_MAX* +crv-PTRDIFF_MIN crefvim.txt /*crv-PTRDIFF_MIN* +crv-PreInc crefvim.txt /*crv-PreInc* +crv-RAND_MAX crefvim.txt /*crv-RAND_MAX* +crv-SCHAR_MAX crefvim.txt /*crv-SCHAR_MAX* +crv-SCHAR_MIN crefvim.txt /*crv-SCHAR_MIN* +crv-SCNdFASTN crefvim.txt /*crv-SCNdFASTN* +crv-SCNdLEASTN crefvim.txt /*crv-SCNdLEASTN* +crv-SCNdMAX crefvim.txt /*crv-SCNdMAX* +crv-SCNdN crefvim.txt /*crv-SCNdN* +crv-SCNdPTR crefvim.txt /*crv-SCNdPTR* +crv-SCNiFASTN crefvim.txt /*crv-SCNiFASTN* +crv-SCNiLEASTN crefvim.txt /*crv-SCNiLEASTN* +crv-SCNiMAX crefvim.txt /*crv-SCNiMAX* +crv-SCNiN crefvim.txt /*crv-SCNiN* +crv-SCNiPTR crefvim.txt /*crv-SCNiPTR* +crv-SCNoFASTN crefvim.txt /*crv-SCNoFASTN* +crv-SCNoLEASTN crefvim.txt /*crv-SCNoLEASTN* +crv-SCNoMAX crefvim.txt /*crv-SCNoMAX* +crv-SCNoN crefvim.txt /*crv-SCNoN* +crv-SCNoPTR crefvim.txt /*crv-SCNoPTR* +crv-SCNuFASTN crefvim.txt /*crv-SCNuFASTN* +crv-SCNuLEASTN crefvim.txt /*crv-SCNuLEASTN* +crv-SCNuMAX crefvim.txt /*crv-SCNuMAX* +crv-SCNuN crefvim.txt /*crv-SCNuN* +crv-SCNuPTR crefvim.txt /*crv-SCNuPTR* +crv-SCNxFASTN crefvim.txt /*crv-SCNxFASTN* +crv-SCNxLEASTN crefvim.txt /*crv-SCNxLEASTN* +crv-SCNxMAX crefvim.txt /*crv-SCNxMAX* +crv-SCNxN crefvim.txt /*crv-SCNxN* +crv-SCNxPTR crefvim.txt /*crv-SCNxPTR* +crv-SEEK_CUR crefvim.txt /*crv-SEEK_CUR* +crv-SEEK_END crefvim.txt /*crv-SEEK_END* +crv-SEEK_SET crefvim.txt /*crv-SEEK_SET* +crv-SHRT_MAX crefvim.txt /*crv-SHRT_MAX* +crv-SHRT_MIN crefvim.txt /*crv-SHRT_MIN* +crv-SIGABRT crefvim.txt /*crv-SIGABRT* +crv-SIGFPE crefvim.txt /*crv-SIGFPE* +crv-SIGILL crefvim.txt /*crv-SIGILL* +crv-SIGINT crefvim.txt /*crv-SIGINT* +crv-SIGSEGV crefvim.txt /*crv-SIGSEGV* +crv-SIGTERM crefvim.txt /*crv-SIGTERM* +crv-SIG_ATOMIC_MAX crefvim.txt /*crv-SIG_ATOMIC_MAX* +crv-SIG_ATOMIC_MIN crefvim.txt /*crv-SIG_ATOMIC_MIN* +crv-SIG_DFL crefvim.txt /*crv-SIG_DFL* +crv-SIG_ERR crefvim.txt /*crv-SIG_ERR* +crv-SIG_IGN crefvim.txt /*crv-SIG_IGN* +crv-SIZE_MAX crefvim.txt /*crv-SIZE_MAX* +crv-TMP_MAX crefvim.txt /*crv-TMP_MAX* +crv-UCHAR_MAX crefvim.txt /*crv-UCHAR_MAX* +crv-UINT16_C crefvim.txt /*crv-UINT16_C* +crv-UINT16_MAX crefvim.txt /*crv-UINT16_MAX* +crv-UINT32_C crefvim.txt /*crv-UINT32_C* +crv-UINT32_MAX crefvim.txt /*crv-UINT32_MAX* +crv-UINT64_C crefvim.txt /*crv-UINT64_C* +crv-UINT64_MAX crefvim.txt /*crv-UINT64_MAX* +crv-UINT8_C crefvim.txt /*crv-UINT8_C* +crv-UINT8_MAX crefvim.txt /*crv-UINT8_MAX* +crv-UINTMAX_C crefvim.txt /*crv-UINTMAX_C* +crv-UINTMAX_MAX crefvim.txt /*crv-UINTMAX_MAX* +crv-UINTPTR_MAX crefvim.txt /*crv-UINTPTR_MAX* +crv-UINT_FAST16_MAX crefvim.txt /*crv-UINT_FAST16_MAX* +crv-UINT_FAST32_MAX crefvim.txt /*crv-UINT_FAST32_MAX* +crv-UINT_FAST64_MAX crefvim.txt /*crv-UINT_FAST64_MAX* +crv-UINT_FAST8_MAX crefvim.txt /*crv-UINT_FAST8_MAX* +crv-UINT_LEAST16_MAX crefvim.txt /*crv-UINT_LEAST16_MAX* +crv-UINT_LEAST32_MAX crefvim.txt /*crv-UINT_LEAST32_MAX* +crv-UINT_LEAST64_MAX crefvim.txt /*crv-UINT_LEAST64_MAX* +crv-UINT_LEAST8_MAX crefvim.txt /*crv-UINT_LEAST8_MAX* +crv-UINT_MAX crefvim.txt /*crv-UINT_MAX* +crv-ULONG_LONG_MAX crefvim.txt /*crv-ULONG_LONG_MAX* +crv-ULONG_MAX crefvim.txt /*crv-ULONG_MAX* +crv-USHRT_MAX crefvim.txt /*crv-USHRT_MAX* +crv-WCHAR_MAX crefvim.txt /*crv-WCHAR_MAX* +crv-WCHAR_MAX2 crefvim.txt /*crv-WCHAR_MAX2* +crv-WCHAR_MIN crefvim.txt /*crv-WCHAR_MIN* +crv-WCHAR_MIN2 crefvim.txt /*crv-WCHAR_MIN2* +crv-WEOF crefvim.txt /*crv-WEOF* +crv-WEOF2 crefvim.txt /*crv-WEOF2* +crv-WINT_MAX crefvim.txt /*crv-WINT_MAX* +crv-WINT_MIN crefvim.txt /*crv-WINT_MIN* +crv-_Bool crefvim.txt /*crv-_Bool* +crv-_Complex crefvim.txt /*crv-_Complex* +crv-_Complex_I crefvim.txt /*crv-_Complex_I* +crv-_Exit crefvim.txt /*crv-_Exit* +crv-_IOFBF crefvim.txt /*crv-_IOFBF* +crv-_IOLBF crefvim.txt /*crv-_IOLBF* +crv-_IONBF crefvim.txt /*crv-_IONBF* +crv-_Imaginary crefvim.txt /*crv-_Imaginary* +crv-_Imaginary_I crefvim.txt /*crv-_Imaginary_I* +crv-__DATA__ crefvim.txt /*crv-__DATA__* +crv-__FILE__ crefvim.txt /*crv-__FILE__* +crv-__LINE__ crefvim.txt /*crv-__LINE__* +crv-__STDC_FORMAT_MACROS crefvim.txt /*crv-__STDC_FORMAT_MACROS* +crv-__STDC_HOSTED__ crefvim.txt /*crv-__STDC_HOSTED__* +crv-__STDC_IEC_559_COMPLEX__ crefvim.txt /*crv-__STDC_IEC_559_COMPLEX__* +crv-__STDC_IEC_559__ crefvim.txt /*crv-__STDC_IEC_559__* +crv-__STDC_ISO10646__ crefvim.txt /*crv-__STDC_ISO10646__* +crv-__STDC_LIMIT_MACROS crefvim.txt /*crv-__STDC_LIMIT_MACROS* +crv-__STDC_VERSION__ crefvim.txt /*crv-__STDC_VERSION__* +crv-__STDC__ crefvim.txt /*crv-__STDC__* +crv-__TIME__ crefvim.txt /*crv-__TIME__* +crv-__bool_true_false_are_defined crefvim.txt /*crv-__bool_true_false_are_defined* +crv-abort crefvim.txt /*crv-abort* +crv-abs crefvim.txt /*crv-abs* +crv-acos crefvim.txt /*crv-acos* +crv-acosf crefvim.txt /*crv-acosf* +crv-acosh crefvim.txt /*crv-acosh* +crv-acoshf crefvim.txt /*crv-acoshf* +crv-acoshl crefvim.txt /*crv-acoshl* +crv-acosl crefvim.txt /*crv-acosl* +crv-asctime crefvim.txt /*crv-asctime* +crv-asin crefvim.txt /*crv-asin* +crv-asinf crefvim.txt /*crv-asinf* +crv-asinh crefvim.txt /*crv-asinh* +crv-asinhf crefvim.txt /*crv-asinhf* +crv-asinhl crefvim.txt /*crv-asinhl* +crv-asinl crefvim.txt /*crv-asinl* +crv-assert crefvim.txt /*crv-assert* +crv-atan crefvim.txt /*crv-atan* +crv-atan2 crefvim.txt /*crv-atan2* +crv-atan2f crefvim.txt /*crv-atan2f* +crv-atan2l crefvim.txt /*crv-atan2l* +crv-atanf crefvim.txt /*crv-atanf* +crv-atanh crefvim.txt /*crv-atanh* +crv-atanhf crefvim.txt /*crv-atanhf* +crv-atanhl crefvim.txt /*crv-atanhl* +crv-atanl crefvim.txt /*crv-atanl* +crv-atexit crefvim.txt /*crv-atexit* +crv-atof crefvim.txt /*crv-atof* +crv-atoi crefvim.txt /*crv-atoi* +crv-atol crefvim.txt /*crv-atol* +crv-atoll crefvim.txt /*crv-atoll* +crv-auto crefvim.txt /*crv-auto* +crv-bibliography crefvim.txt /*crv-bibliography* +crv-bool crefvim.txt /*crv-bool* +crv-break crefvim.txt /*crv-break* +crv-bsearch crefvim.txt /*crv-bsearch* +crv-btowc crefvim.txt /*crv-btowc* +crv-cabs crefvim.txt /*crv-cabs* +crv-cabsf crefvim.txt /*crv-cabsf* +crv-cabsl crefvim.txt /*crv-cabsl* +crv-cacos crefvim.txt /*crv-cacos* +crv-cacosf crefvim.txt /*crv-cacosf* +crv-cacosh crefvim.txt /*crv-cacosh* +crv-cacoshf crefvim.txt /*crv-cacoshf* +crv-cacoshl crefvim.txt /*crv-cacoshl* +crv-cacosl crefvim.txt /*crv-cacosl* +crv-calloc crefvim.txt /*crv-calloc* +crv-carg crefvim.txt /*crv-carg* +crv-cargf crefvim.txt /*crv-cargf* +crv-cargl crefvim.txt /*crv-cargl* +crv-case crefvim.txt /*crv-case* +crv-casin crefvim.txt /*crv-casin* +crv-casinf crefvim.txt /*crv-casinf* +crv-casinh crefvim.txt /*crv-casinh* +crv-casinhf crefvim.txt /*crv-casinhf* +crv-casinhl crefvim.txt /*crv-casinhl* +crv-casinl crefvim.txt /*crv-casinl* +crv-catan crefvim.txt /*crv-catan* +crv-catanf crefvim.txt /*crv-catanf* +crv-catanh crefvim.txt /*crv-catanh* +crv-catanhf crefvim.txt /*crv-catanhf* +crv-catanhl crefvim.txt /*crv-catanhl* +crv-catanl crefvim.txt /*crv-catanl* +crv-cbrt crefvim.txt /*crv-cbrt* +crv-cbrtf crefvim.txt /*crv-cbrtf* +crv-cbrtl crefvim.txt /*crv-cbrtl* +crv-ccos crefvim.txt /*crv-ccos* +crv-ccosf crefvim.txt /*crv-ccosf* +crv-ccosfh crefvim.txt /*crv-ccosfh* +crv-ccosh crefvim.txt /*crv-ccosh* +crv-ccosl crefvim.txt /*crv-ccosl* +crv-ccoslh crefvim.txt /*crv-ccoslh* +crv-ceil crefvim.txt /*crv-ceil* +crv-ceilf crefvim.txt /*crv-ceilf* +crv-ceill crefvim.txt /*crv-ceill* +crv-cexp crefvim.txt /*crv-cexp* +crv-cexpf crefvim.txt /*crv-cexpf* +crv-cexpl crefvim.txt /*crv-cexpl* +crv-char crefvim.txt /*crv-char* +crv-cimag crefvim.txt /*crv-cimag* +crv-cimagf crefvim.txt /*crv-cimagf* +crv-cimagl crefvim.txt /*crv-cimagl* +crv-clearerr crefvim.txt /*crv-clearerr* +crv-clock crefvim.txt /*crv-clock* +crv-clock_t crefvim.txt /*crv-clock_t* +crv-clog crefvim.txt /*crv-clog* +crv-clogf crefvim.txt /*crv-clogf* +crv-clogl crefvim.txt /*crv-clogl* +crv-complex crefvim.txt /*crv-complex* +crv-conj crefvim.txt /*crv-conj* +crv-conjf crefvim.txt /*crv-conjf* +crv-conjl crefvim.txt /*crv-conjl* +crv-const crefvim.txt /*crv-const* +crv-continue crefvim.txt /*crv-continue* +crv-copysign crefvim.txt /*crv-copysign* +crv-copysignf crefvim.txt /*crv-copysignf* +crv-copysignl crefvim.txt /*crv-copysignl* +crv-cos crefvim.txt /*crv-cos* +crv-cosf crefvim.txt /*crv-cosf* +crv-cosh crefvim.txt /*crv-cosh* +crv-coshf crefvim.txt /*crv-coshf* +crv-coshl crefvim.txt /*crv-coshl* +crv-cosl crefvim.txt /*crv-cosl* +crv-cpow crefvim.txt /*crv-cpow* +crv-cpowf crefvim.txt /*crv-cpowf* +crv-cpowl crefvim.txt /*crv-cpowl* +crv-cproj crefvim.txt /*crv-cproj* +crv-cprojf crefvim.txt /*crv-cprojf* +crv-cprojl crefvim.txt /*crv-cprojl* +crv-creal crefvim.txt /*crv-creal* +crv-crealf crefvim.txt /*crv-crealf* +crv-creall crefvim.txt /*crv-creall* +crv-csin crefvim.txt /*crv-csin* +crv-csinf crefvim.txt /*crv-csinf* +crv-csinh crefvim.txt /*crv-csinh* +crv-csinhf crefvim.txt /*crv-csinhf* +crv-csinhl crefvim.txt /*crv-csinhl* +crv-csinl crefvim.txt /*crv-csinl* +crv-csqrt crefvim.txt /*crv-csqrt* +crv-csqrtf crefvim.txt /*crv-csqrtf* +crv-csqrtl crefvim.txt /*crv-csqrtl* +crv-ctan crefvim.txt /*crv-ctan* +crv-ctanf crefvim.txt /*crv-ctanf* +crv-ctanh crefvim.txt /*crv-ctanh* +crv-ctanhf crefvim.txt /*crv-ctanhf* +crv-ctanhl crefvim.txt /*crv-ctanhl* +crv-ctanl crefvim.txt /*crv-ctanl* +crv-ctime crefvim.txt /*crv-ctime* +crv-currency_symbol crefvim.txt /*crv-currency_symbol* +crv-datatypes crefvim.txt /*crv-datatypes* +crv-decimal_point crefvim.txt /*crv-decimal_point* +crv-default crefvim.txt /*crv-default* +crv-defined crefvim.txt /*crv-defined* +crv-dif_t crefvim.txt /*crv-dif_t* +crv-difftime crefvim.txt /*crv-difftime* +crv-div crefvim.txt /*crv-div* +crv-do crefvim.txt /*crv-do* +crv-double crefvim.txt /*crv-double* +crv-dtArrays crefvim.txt /*crv-dtArrays* +crv-dtBitFields crefvim.txt /*crv-dtBitFields* +crv-dtCompleteArrayDecl crefvim.txt /*crv-dtCompleteArrayDecl* +crv-dtConstChar crefvim.txt /*crv-dtConstChar* +crv-dtConstFloat crefvim.txt /*crv-dtConstFloat* +crv-dtConstInt crefvim.txt /*crv-dtConstInt* +crv-dtConstants crefvim.txt /*crv-dtConstants* +crv-dtEnumerate crefvim.txt /*crv-dtEnumerate* +crv-dtFormats crefvim.txt /*crv-dtFormats* +crv-dtFormatsFPBasics crefvim.txt /*crv-dtFormatsFPBasics* +crv-dtFormatsFPDouble crefvim.txt /*crv-dtFormatsFPDouble* +crv-dtFormatsFPFloat crefvim.txt /*crv-dtFormatsFPFloat* +crv-dtFormatsFPInfinity crefvim.txt /*crv-dtFormatsFPInfinity* +crv-dtFormatsFPLDouble crefvim.txt /*crv-dtFormatsFPLDouble* +crv-dtFormatsFPNaN crefvim.txt /*crv-dtFormatsFPNaN* +crv-dtFormatsFPOp crefvim.txt /*crv-dtFormatsFPOp* +crv-dtFormatsFPSDenorm crefvim.txt /*crv-dtFormatsFPSDenorm* +crv-dtFormatsFPTypes crefvim.txt /*crv-dtFormatsFPTypes* +crv-dtFormatsFPValues crefvim.txt /*crv-dtFormatsFPValues* +crv-dtFormatsFPZero crefvim.txt /*crv-dtFormatsFPZero* +crv-dtFormatsFloat crefvim.txt /*crv-dtFormatsFloat* +crv-dtFormatsInt crefvim.txt /*crv-dtFormatsInt* +crv-dtOverview crefvim.txt /*crv-dtOverview* +crv-dtPointers crefvim.txt /*crv-dtPointers* +crv-dtPtrArithmetics crefvim.txt /*crv-dtPtrArithmetics* +crv-dtPtrFuncs crefvim.txt /*crv-dtPtrFuncs* +crv-dtPtrVars crefvim.txt /*crv-dtPtrVars* +crv-dtQualifiers crefvim.txt /*crv-dtQualifiers* +crv-dtSizeRange crefvim.txt /*crv-dtSizeRange* +crv-dtStorageClasses crefvim.txt /*crv-dtStorageClasses* +crv-dtStrings crefvim.txt /*crv-dtStrings* +crv-dtStructAccess crefvim.txt /*crv-dtStructAccess* +crv-dtStructDecl crefvim.txt /*crv-dtStructDecl* +crv-dtStructDef crefvim.txt /*crv-dtStructDef* +crv-dtStructInit crefvim.txt /*crv-dtStructInit* +crv-dtStructurs crefvim.txt /*crv-dtStructurs* +crv-dtTypeCast crefvim.txt /*crv-dtTypeCast* +crv-dtTypeCastExpl crefvim.txt /*crv-dtTypeCastExpl* +crv-dtTypeCastImpl crefvim.txt /*crv-dtTypeCastImpl* +crv-dtTypeDef crefvim.txt /*crv-dtTypeDef* +crv-dtTypeGrouping crefvim.txt /*crv-dtTypeGrouping* +crv-dtTypeSpecifiers crefvim.txt /*crv-dtTypeSpecifiers* +crv-dtUnionAccess crefvim.txt /*crv-dtUnionAccess* +crv-dtUnionDecl crefvim.txt /*crv-dtUnionDecl* +crv-dtUnionDef crefvim.txt /*crv-dtUnionDef* +crv-dtUnionInit crefvim.txt /*crv-dtUnionInit* +crv-dtUnions crefvim.txt /*crv-dtUnions* +crv-dtVoid crefvim.txt /*crv-dtVoid* +crv-else crefvim.txt /*crv-else* +crv-enum crefvim.txt /*crv-enum* +crv-erf crefvim.txt /*crv-erf* +crv-erfc crefvim.txt /*crv-erfc* +crv-erfcf crefvim.txt /*crv-erfcf* +crv-erfcl crefvim.txt /*crv-erfcl* +crv-erff crefvim.txt /*crv-erff* +crv-erfl crefvim.txt /*crv-erfl* +crv-errno crefvim.txt /*crv-errno* +crv-exit crefvim.txt /*crv-exit* +crv-exp crefvim.txt /*crv-exp* +crv-exp2 crefvim.txt /*crv-exp2* +crv-exp2f crefvim.txt /*crv-exp2f* +crv-exp2l crefvim.txt /*crv-exp2l* +crv-expf crefvim.txt /*crv-expf* +crv-expl crefvim.txt /*crv-expl* +crv-expm1 crefvim.txt /*crv-expm1* +crv-expm1f crefvim.txt /*crv-expm1f* +crv-expm1l crefvim.txt /*crv-expm1l* +crv-extern crefvim.txt /*crv-extern* +crv-fabs crefvim.txt /*crv-fabs* +crv-fabsf crefvim.txt /*crv-fabsf* +crv-fabsl crefvim.txt /*crv-fabsl* +crv-false crefvim.txt /*crv-false* +crv-fclose crefvim.txt /*crv-fclose* +crv-fdim crefvim.txt /*crv-fdim* +crv-fdimf crefvim.txt /*crv-fdimf* +crv-fdiml crefvim.txt /*crv-fdiml* +crv-feclearexcept crefvim.txt /*crv-feclearexcept* +crv-fegetenv crefvim.txt /*crv-fegetenv* +crv-fegetexceptflag crefvim.txt /*crv-fegetexceptflag* +crv-fegetround crefvim.txt /*crv-fegetround* +crv-feholdexcept crefvim.txt /*crv-feholdexcept* +crv-fentv_t crefvim.txt /*crv-fentv_t* +crv-feof crefvim.txt /*crv-feof* +crv-feraiseexcept crefvim.txt /*crv-feraiseexcept* +crv-ferror crefvim.txt /*crv-ferror* +crv-fesetenv crefvim.txt /*crv-fesetenv* +crv-fesetexceptflag crefvim.txt /*crv-fesetexceptflag* +crv-fesetround crefvim.txt /*crv-fesetround* +crv-fetestexcept crefvim.txt /*crv-fetestexcept* +crv-feupdateenv crefvim.txt /*crv-feupdateenv* +crv-fflush crefvim.txt /*crv-fflush* +crv-fgetc crefvim.txt /*crv-fgetc* +crv-fgetpos crefvim.txt /*crv-fgetpos* +crv-fgets crefvim.txt /*crv-fgets* +crv-fgetwc crefvim.txt /*crv-fgetwc* +crv-fgetws crefvim.txt /*crv-fgetws* +crv-float crefvim.txt /*crv-float* +crv-floor crefvim.txt /*crv-floor* +crv-floorf crefvim.txt /*crv-floorf* +crv-floorl crefvim.txt /*crv-floorl* +crv-fma crefvim.txt /*crv-fma* +crv-fmaf crefvim.txt /*crv-fmaf* +crv-fmal crefvim.txt /*crv-fmal* +crv-fmax crefvim.txt /*crv-fmax* +crv-fmaxf crefvim.txt /*crv-fmaxf* +crv-fmaxl crefvim.txt /*crv-fmaxl* +crv-fmin crefvim.txt /*crv-fmin* +crv-fminf crefvim.txt /*crv-fminf* +crv-fminl crefvim.txt /*crv-fminl* +crv-fmod crefvim.txt /*crv-fmod* +crv-fmodf crefvim.txt /*crv-fmodf* +crv-fmodl crefvim.txt /*crv-fmodl* +crv-fopen crefvim.txt /*crv-fopen* +crv-for crefvim.txt /*crv-for* +crv-fpclassify crefvim.txt /*crv-fpclassify* +crv-fpos_t crefvim.txt /*crv-fpos_t* +crv-fprintf crefvim.txt /*crv-fprintf* +crv-fputc crefvim.txt /*crv-fputc* +crv-fputs crefvim.txt /*crv-fputs* +crv-fputwc crefvim.txt /*crv-fputwc* +crv-fputws crefvim.txt /*crv-fputws* +crv-frac_digits crefvim.txt /*crv-frac_digits* +crv-fread crefvim.txt /*crv-fread* +crv-free crefvim.txt /*crv-free* +crv-freopen crefvim.txt /*crv-freopen* +crv-frexp crefvim.txt /*crv-frexp* +crv-frexpf crefvim.txt /*crv-frexpf* +crv-frexpl crefvim.txt /*crv-frexpl* +crv-fscanf crefvim.txt /*crv-fscanf* +crv-fseek crefvim.txt /*crv-fseek* +crv-fsetpos crefvim.txt /*crv-fsetpos* +crv-ftell crefvim.txt /*crv-ftell* +crv-fuConversion crefvim.txt /*crv-fuConversion* +crv-fuDefVarPara crefvim.txt /*crv-fuDefVarPara* +crv-fuDefinition crefvim.txt /*crv-fuDefinition* +crv-fuMain crefvim.txt /*crv-fuMain* +crv-fuPrototype crefvim.txt /*crv-fuPrototype* +crv-fuSpecifier crefvim.txt /*crv-fuSpecifier* +crv-fuStorageClasses crefvim.txt /*crv-fuStorageClasses* +crv-functions crefvim.txt /*crv-functions* +crv-fwide crefvim.txt /*crv-fwide* +crv-fwprintf crefvim.txt /*crv-fwprintf* +crv-fwrite crefvim.txt /*crv-fwrite* +crv-fwscanf crefvim.txt /*crv-fwscanf* +crv-getc crefvim.txt /*crv-getc* +crv-getchar crefvim.txt /*crv-getchar* +crv-getenv crefvim.txt /*crv-getenv* +crv-gets crefvim.txt /*crv-gets* +crv-getwc crefvim.txt /*crv-getwc* +crv-getwchar crefvim.txt /*crv-getwchar* +crv-gloAlignment crefvim.txt /*crv-gloAlignment* +crv-gloArgument crefvim.txt /*crv-gloArgument* +crv-gloArray crefvim.txt /*crv-gloArray* +crv-gloBinary crefvim.txt /*crv-gloBinary* +crv-gloBlock crefvim.txt /*crv-gloBlock* +crv-gloCompState crefvim.txt /*crv-gloCompState* +crv-gloDataType crefvim.txt /*crv-gloDataType* +crv-gloDeclaration crefvim.txt /*crv-gloDeclaration* +crv-gloDefinition crefvim.txt /*crv-gloDefinition* +crv-gloExpression crefvim.txt /*crv-gloExpression* +crv-gloIdentifier crefvim.txt /*crv-gloIdentifier* +crv-gloLifetime crefvim.txt /*crv-gloLifetime* +crv-gloLinkage crefvim.txt /*crv-gloLinkage* +crv-gloLvalue crefvim.txt /*crv-gloLvalue* +crv-gloLvalueMod crefvim.txt /*crv-gloLvalueMod* +crv-gloMacro crefvim.txt /*crv-gloMacro* +crv-gloObject crefvim.txt /*crv-gloObject* +crv-gloOpBinary crefvim.txt /*crv-gloOpBinary* +crv-gloOpUnary crefvim.txt /*crv-gloOpUnary* +crv-gloOperand crefvim.txt /*crv-gloOperand* +crv-gloOperator crefvim.txt /*crv-gloOperator* +crv-gloParameter crefvim.txt /*crv-gloParameter* +crv-gloPointer crefvim.txt /*crv-gloPointer* +crv-gloPreprocessor crefvim.txt /*crv-gloPreprocessor* +crv-gloPromote crefvim.txt /*crv-gloPromote* +crv-gloPrototype crefvim.txt /*crv-gloPrototype* +crv-gloRvalue crefvim.txt /*crv-gloRvalue* +crv-gloScope crefvim.txt /*crv-gloScope* +crv-gloSemantics crefvim.txt /*crv-gloSemantics* +crv-gloSideEffect crefvim.txt /*crv-gloSideEffect* +crv-gloSignExtension crefvim.txt /*crv-gloSignExtension* +crv-gloStatement crefvim.txt /*crv-gloStatement* +crv-gloStructure crefvim.txt /*crv-gloStructure* +crv-gloSyntax crefvim.txt /*crv-gloSyntax* +crv-gloToken crefvim.txt /*crv-gloToken* +crv-gloTrueFalse crefvim.txt /*crv-gloTrueFalse* +crv-gloType crefvim.txt /*crv-gloType* +crv-gloTypeCast crefvim.txt /*crv-gloTypeCast* +crv-gloTypeIncomplete crefvim.txt /*crv-gloTypeIncomplete* +crv-gloUnary crefvim.txt /*crv-gloUnary* +crv-gloVariable crefvim.txt /*crv-gloVariable* +crv-gloWhiteSpace crefvim.txt /*crv-gloWhiteSpace* +crv-glossary crefvim.txt /*crv-glossary* +crv-gmtime crefvim.txt /*crv-gmtime* +crv-goto crefvim.txt /*crv-goto* +crv-grouping crefvim.txt /*crv-grouping* +crv-hypot crefvim.txt /*crv-hypot* +crv-hypotf crefvim.txt /*crv-hypotf* +crv-hypotl crefvim.txt /*crv-hypotl* +crv-if crefvim.txt /*crv-if* +crv-ilogb crefvim.txt /*crv-ilogb* +crv-ilogbf crefvim.txt /*crv-ilogbf* +crv-ilogbl crefvim.txt /*crv-ilogbl* +crv-imaginary crefvim.txt /*crv-imaginary* +crv-imaxabs crefvim.txt /*crv-imaxabs* +crv-imaxdiv crefvim.txt /*crv-imaxdiv* +crv-imaxdiv_t crefvim.txt /*crv-imaxdiv_t* +crv-inline crefvim.txt /*crv-inline* +crv-int crefvim.txt /*crv-int* +crv-int16_t crefvim.txt /*crv-int16_t* +crv-int32_t crefvim.txt /*crv-int32_t* +crv-int64_t crefvim.txt /*crv-int64_t* +crv-int8_t crefvim.txt /*crv-int8_t* +crv-int_curr_symbol crefvim.txt /*crv-int_curr_symbol* +crv-int_fast16_t crefvim.txt /*crv-int_fast16_t* +crv-int_fast32_t crefvim.txt /*crv-int_fast32_t* +crv-int_fast64_t crefvim.txt /*crv-int_fast64_t* +crv-int_fast8_t crefvim.txt /*crv-int_fast8_t* +crv-int_frac_digits crefvim.txt /*crv-int_frac_digits* +crv-int_least16_t crefvim.txt /*crv-int_least16_t* +crv-int_least32_t crefvim.txt /*crv-int_least32_t* +crv-int_least64_t crefvim.txt /*crv-int_least64_t* +crv-int_least8_t crefvim.txt /*crv-int_least8_t* +crv-int_n_cs_precedes crefvim.txt /*crv-int_n_cs_precedes* +crv-int_n_sep_by_space crefvim.txt /*crv-int_n_sep_by_space* +crv-int_n_sign_posn crefvim.txt /*crv-int_n_sign_posn* +crv-int_p_cs_precedes crefvim.txt /*crv-int_p_cs_precedes* +crv-int_p_sep_by_space crefvim.txt /*crv-int_p_sep_by_space* +crv-int_p_sign_posn crefvim.txt /*crv-int_p_sign_posn* +crv-intmax_t crefvim.txt /*crv-intmax_t* +crv-intptr_t crefvim.txt /*crv-intptr_t* +crv-intro crefvim.txt /*crv-intro* +crv-isalnum crefvim.txt /*crv-isalnum* +crv-isalpha crefvim.txt /*crv-isalpha* +crv-isblank crefvim.txt /*crv-isblank* +crv-iscntrl crefvim.txt /*crv-iscntrl* +crv-isdigit crefvim.txt /*crv-isdigit* +crv-isfinite crefvim.txt /*crv-isfinite* +crv-isgraph crefvim.txt /*crv-isgraph* +crv-isgreater crefvim.txt /*crv-isgreater* +crv-isgreaterequal crefvim.txt /*crv-isgreaterequal* +crv-isinf crefvim.txt /*crv-isinf* +crv-isless crefvim.txt /*crv-isless* +crv-islessequal crefvim.txt /*crv-islessequal* +crv-islessgreater crefvim.txt /*crv-islessgreater* +crv-islower crefvim.txt /*crv-islower* +crv-isnan crefvim.txt /*crv-isnan* +crv-isnormal crefvim.txt /*crv-isnormal* +crv-isprint crefvim.txt /*crv-isprint* +crv-ispunct crefvim.txt /*crv-ispunct* +crv-isspace crefvim.txt /*crv-isspace* +crv-isunordered crefvim.txt /*crv-isunordered* +crv-isupper crefvim.txt /*crv-isupper* +crv-iswalnum crefvim.txt /*crv-iswalnum* +crv-iswalpha crefvim.txt /*crv-iswalpha* +crv-iswblank crefvim.txt /*crv-iswblank* +crv-iswcntrl crefvim.txt /*crv-iswcntrl* +crv-iswctype crefvim.txt /*crv-iswctype* +crv-iswdigit crefvim.txt /*crv-iswdigit* +crv-iswgraph crefvim.txt /*crv-iswgraph* +crv-iswlower crefvim.txt /*crv-iswlower* +crv-iswprint crefvim.txt /*crv-iswprint* +crv-iswpunct crefvim.txt /*crv-iswpunct* +crv-iswspace crefvim.txt /*crv-iswspace* +crv-iswupper crefvim.txt /*crv-iswupper* +crv-iswxdigit crefvim.txt /*crv-iswxdigit* +crv-isxdigit crefvim.txt /*crv-isxdigit* +crv-jmp_buf crefvim.txt /*crv-jmp_buf* +crv-keywords crefvim.txt /*crv-keywords* +crv-labs crefvim.txt /*crv-labs* +crv-language crefvim.txt /*crv-language* +crv-lconf crefvim.txt /*crv-lconf* +crv-ldexp crefvim.txt /*crv-ldexp* +crv-ldexpf crefvim.txt /*crv-ldexpf* +crv-ldexpl crefvim.txt /*crv-ldexpl* +crv-ldif_t crefvim.txt /*crv-ldif_t* +crv-ldiv crefvim.txt /*crv-ldiv* +crv-lgamma crefvim.txt /*crv-lgamma* +crv-lgammaf crefvim.txt /*crv-lgammaf* +crv-lgammal crefvim.txt /*crv-lgammal* +crv-libAssertH crefvim.txt /*crv-libAssertH* +crv-libCHExpLog crefvim.txt /*crv-libCHExpLog* +crv-libCHHyper crefvim.txt /*crv-libCHHyper* +crv-libCHMac crefvim.txt /*crv-libCHMac* +crv-libCHMani crefvim.txt /*crv-libCHMani* +crv-libCHPower crefvim.txt /*crv-libCHPower* +crv-libCHPrag crefvim.txt /*crv-libCHPrag* +crv-libCHTrig crefvim.txt /*crv-libCHTrig* +crv-libCharHandling crefvim.txt /*crv-libCharHandling* +crv-libCharMapping crefvim.txt /*crv-libCharMapping* +crv-libComplexH crefvim.txt /*crv-libComplexH* +crv-libCtypeH crefvim.txt /*crv-libCtypeH* +crv-libErrnoH crefvim.txt /*crv-libErrnoH* +crv-libFHEnv crefvim.txt /*crv-libFHEnv* +crv-libFHExceptions crefvim.txt /*crv-libFHExceptions* +crv-libFHPrag crefvim.txt /*crv-libFHPrag* +crv-libFHRounding crefvim.txt /*crv-libFHRounding* +crv-libFenvH crefvim.txt /*crv-libFenvH* +crv-libFloatH crefvim.txt /*crv-libFloatH* +crv-libHeaders crefvim.txt /*crv-libHeaders* +crv-libInttypesH crefvim.txt /*crv-libInttypesH* +crv-libIso646H crefvim.txt /*crv-libIso646H* +crv-libLHConv crefvim.txt /*crv-libLHConv* +crv-libLHRange crefvim.txt /*crv-libLHRange* +crv-libLHWidth crefvim.txt /*crv-libLHWidth* +crv-libLimitsH crefvim.txt /*crv-libLimitsH* +crv-libLocHCat crefvim.txt /*crv-libLocHCat* +crv-libLocHFunc crefvim.txt /*crv-libLocHFunc* +crv-libLocHInfo crefvim.txt /*crv-libLocHInfo* +crv-libLocHLoc crefvim.txt /*crv-libLocHLoc* +crv-libLocalH crefvim.txt /*crv-libLocalH* +crv-libMHClass crefvim.txt /*crv-libMHClass* +crv-libMHCmp crefvim.txt /*crv-libMHCmp* +crv-libMHErr crefvim.txt /*crv-libMHErr* +crv-libMHErrGam crefvim.txt /*crv-libMHErrGam* +crv-libMHExpLog crefvim.txt /*crv-libMHExpLog* +crv-libMHHyper crefvim.txt /*crv-libMHHyper* +crv-libMHMani crefvim.txt /*crv-libMHMani* +crv-libMHMisc crefvim.txt /*crv-libMHMisc* +crv-libMHNear crefvim.txt /*crv-libMHNear* +crv-libMHPower crefvim.txt /*crv-libMHPower* +crv-libMHRem crefvim.txt /*crv-libMHRem* +crv-libMHTrig crefvim.txt /*crv-libMHTrig* +crv-libMathH crefvim.txt /*crv-libMathH* +crv-libSHFunc crefvim.txt /*crv-libSHFunc* +crv-libSHSig crefvim.txt /*crv-libSHSig* +crv-libSHTyp crefvim.txt /*crv-libSHTyp* +crv-libSIOHCIO crefvim.txt /*crv-libSIOHCIO* +crv-libSIOHDIO crefvim.txt /*crv-libSIOHDIO* +crv-libSIOHErr crefvim.txt /*crv-libSIOHErr* +crv-libSIOHFAcc crefvim.txt /*crv-libSIOHFAcc* +crv-libSIOHFOp crefvim.txt /*crv-libSIOHFOp* +crv-libSIOHFPos crefvim.txt /*crv-libSIOHFPos* +crv-libSIOHIO crefvim.txt /*crv-libSIOHIO* +crv-libSIOHIOFin crefvim.txt /*crv-libSIOHIOFin* +crv-libSIOHIOFormat crefvim.txt /*crv-libSIOHIOFormat* +crv-libSIOHIOFout crefvim.txt /*crv-libSIOHIOFout* +crv-libSIOHIOFunc crefvim.txt /*crv-libSIOHIOFunc* +crv-libSIOHMac crefvim.txt /*crv-libSIOHMac* +crv-libSIOHStrmFile crefvim.txt /*crv-libSIOHStrmFile* +crv-libSIOHType crefvim.txt /*crv-libSIOHType* +crv-libSLHMac crefvim.txt /*crv-libSLHMac* +crv-libSLHType crefvim.txt /*crv-libSLHType* +crv-libSLHcom crefvim.txt /*crv-libSLHcom* +crv-libSLHintarith crefvim.txt /*crv-libSLHintarith* +crv-libSLHmem crefvim.txt /*crv-libSLHmem* +crv-libSLHmulchar crefvim.txt /*crv-libSLHmulchar* +crv-libSLHmulstrng crefvim.txt /*crv-libSLHmulstrng* +crv-libSLHnum crefvim.txt /*crv-libSLHnum* +crv-libSLHrand crefvim.txt /*crv-libSLHrand* +crv-libSLHsearch crefvim.txt /*crv-libSLHsearch* +crv-libSRHCmp crefvim.txt /*crv-libSRHCmp* +crv-libSRHConcat crefvim.txt /*crv-libSRHConcat* +crv-libSRHCopy crefvim.txt /*crv-libSRHCopy* +crv-libSRHMac crefvim.txt /*crv-libSRHMac* +crv-libSRHMisc crefvim.txt /*crv-libSRHMisc* +crv-libSRHSearch crefvim.txt /*crv-libSRHSearch* +crv-libSRHType crefvim.txt /*crv-libSRHType* +crv-libSdHLExact crefvim.txt /*crv-libSdHLExact* +crv-libSdHLFast crefvim.txt /*crv-libSdHLFast* +crv-libSdHLGreat crefvim.txt /*crv-libSdHLGreat* +crv-libSdHLMin crefvim.txt /*crv-libSdHLMin* +crv-libSdHLOther crefvim.txt /*crv-libSdHLOther* +crv-libSdHLPtr crefvim.txt /*crv-libSdHLPtr* +crv-libSdHMac crefvim.txt /*crv-libSdHMac* +crv-libSdHTExact crefvim.txt /*crv-libSdHTExact* +crv-libSdHTFast crefvim.txt /*crv-libSdHTFast* +crv-libSdHTGreat crefvim.txt /*crv-libSdHTGreat* +crv-libSdHTLim crefvim.txt /*crv-libSdHTLim* +crv-libSdHTMin crefvim.txt /*crv-libSdHTMin* +crv-libSdHTPtr crefvim.txt /*crv-libSdHTPtr* +crv-libSdHType crefvim.txt /*crv-libSdHType* +crv-libSetjmpH crefvim.txt /*crv-libSetjmpH* +crv-libSignalH crefvim.txt /*crv-libSignalH* +crv-libStdargH crefvim.txt /*crv-libStdargH* +crv-libStdboolH crefvim.txt /*crv-libStdboolH* +crv-libStddefH crefvim.txt /*crv-libStddefH* +crv-libStdintH crefvim.txt /*crv-libStdintH* +crv-libStdioH crefvim.txt /*crv-libStdioH* +crv-libStdlibH crefvim.txt /*crv-libStdlibH* +crv-libStringH crefvim.txt /*crv-libStringH* +crv-libTHConv crefvim.txt /*crv-libTHConv* +crv-libTHMac crefvim.txt /*crv-libTHMac* +crv-libTHMani crefvim.txt /*crv-libTHMani* +crv-libTHType crefvim.txt /*crv-libTHType* +crv-libTgmathH crefvim.txt /*crv-libTgmathH* +crv-libTimeH crefvim.txt /*crv-libTimeH* +crv-libWCHCIO crefvim.txt /*crv-libWCHCIO* +crv-libWCHCharConv crefvim.txt /*crv-libWCHCharConv* +crv-libWCHCmp crefvim.txt /*crv-libWCHCmp* +crv-libWCHConcat crefvim.txt /*crv-libWCHConcat* +crv-libWCHCopy crefvim.txt /*crv-libWCHCopy* +crv-libWCHIO crefvim.txt /*crv-libWCHIO* +crv-libWCHMac crefvim.txt /*crv-libWCHMac* +crv-libWCHMisc crefvim.txt /*crv-libWCHMisc* +crv-libWCHNum crefvim.txt /*crv-libWCHNum* +crv-libWCHSearch crefvim.txt /*crv-libWCHSearch* +crv-libWCHStrng crefvim.txt /*crv-libWCHStrng* +crv-libWCHTimeConv crefvim.txt /*crv-libWCHTimeConv* +crv-libWCHType crefvim.txt /*crv-libWCHType* +crv-libWTHCextens crefvim.txt /*crv-libWTHCextens* +crv-libWTHClass crefvim.txt /*crv-libWTHClass* +crv-libWTHCwide crefvim.txt /*crv-libWTHCwide* +crv-libWTHMac crefvim.txt /*crv-libWTHMac* +crv-libWTHMap crefvim.txt /*crv-libWTHMap* +crv-libWTHMextens crefvim.txt /*crv-libWTHMextens* +crv-libWTHMwide crefvim.txt /*crv-libWTHMwide* +crv-libWTHType crefvim.txt /*crv-libWTHType* +crv-libWcharH crefvim.txt /*crv-libWcharH* +crv-libWctypeH crefvim.txt /*crv-libWctypeH* +crv-llabs crefvim.txt /*crv-llabs* +crv-lldif_t crefvim.txt /*crv-lldif_t* +crv-lldiv crefvim.txt /*crv-lldiv* +crv-llrint crefvim.txt /*crv-llrint* +crv-llrintf crefvim.txt /*crv-llrintf* +crv-llrintl crefvim.txt /*crv-llrintl* +crv-llround crefvim.txt /*crv-llround* +crv-llroundf crefvim.txt /*crv-llroundf* +crv-llroundl crefvim.txt /*crv-llroundl* +crv-lngAllowedChar crefvim.txt /*crv-lngAllowedChar* +crv-lngBlockComment crefvim.txt /*crv-lngBlockComment* +crv-lngChar crefvim.txt /*crv-lngChar* +crv-lngComment crefvim.txt /*crv-lngComment* +crv-lngEscSeq crefvim.txt /*crv-lngEscSeq* +crv-lngLineComment crefvim.txt /*crv-lngLineComment* +crv-localeconv crefvim.txt /*crv-localeconv* +crv-localtime crefvim.txt /*crv-localtime* +crv-log crefvim.txt /*crv-log* +crv-log10 crefvim.txt /*crv-log10* +crv-log10f crefvim.txt /*crv-log10f* +crv-log10l crefvim.txt /*crv-log10l* +crv-log1p crefvim.txt /*crv-log1p* +crv-log1pf crefvim.txt /*crv-log1pf* +crv-log1pl crefvim.txt /*crv-log1pl* +crv-log2 crefvim.txt /*crv-log2* +crv-log2f crefvim.txt /*crv-log2f* +crv-log2l crefvim.txt /*crv-log2l* +crv-logb crefvim.txt /*crv-logb* +crv-logbf crefvim.txt /*crv-logbf* +crv-logbl crefvim.txt /*crv-logbl* +crv-logf crefvim.txt /*crv-logf* +crv-logl crefvim.txt /*crv-logl* +crv-long crefvim.txt /*crv-long* +crv-longjmp crefvim.txt /*crv-longjmp* +crv-lrint crefvim.txt /*crv-lrint* +crv-lrintf crefvim.txt /*crv-lrintf* +crv-lrintl crefvim.txt /*crv-lrintl* +crv-lround crefvim.txt /*crv-lround* +crv-lroundf crefvim.txt /*crv-lroundf* +crv-lroundl crefvim.txt /*crv-lroundl* +crv-malloc crefvim.txt /*crv-malloc* +crv-mblen crefvim.txt /*crv-mblen* +crv-mbrlen crefvim.txt /*crv-mbrlen* +crv-mbrtowc crefvim.txt /*crv-mbrtowc* +crv-mbsinit crefvim.txt /*crv-mbsinit* +crv-mbsrtowc crefvim.txt /*crv-mbsrtowc* +crv-mbstate_t crefvim.txt /*crv-mbstate_t* +crv-mbstowcs crefvim.txt /*crv-mbstowcs* +crv-mbtowc crefvim.txt /*crv-mbtowc* +crv-memchr crefvim.txt /*crv-memchr* +crv-memcmp crefvim.txt /*crv-memcmp* +crv-memcpy crefvim.txt /*crv-memcpy* +crv-memmove crefvim.txt /*crv-memmove* +crv-memset crefvim.txt /*crv-memset* +crv-mktime crefvim.txt /*crv-mktime* +crv-modf crefvim.txt /*crv-modf* +crv-modff crefvim.txt /*crv-modff* +crv-modfl crefvim.txt /*crv-modfl* +crv-mon_decimal_point crefvim.txt /*crv-mon_decimal_point* +crv-mon_grouping crefvim.txt /*crv-mon_grouping* +crv-mon_thousands_sep crefvim.txt /*crv-mon_thousands_sep* +crv-n_cs_precedes crefvim.txt /*crv-n_cs_precedes* +crv-n_sep_by_space crefvim.txt /*crv-n_sep_by_space* +crv-n_sign_posn crefvim.txt /*crv-n_sign_posn* +crv-nan crefvim.txt /*crv-nan* +crv-nanf crefvim.txt /*crv-nanf* +crv-nanl crefvim.txt /*crv-nanl* +crv-nearbyint crefvim.txt /*crv-nearbyint* +crv-nearbyintf crefvim.txt /*crv-nearbyintf* +crv-nearbyintl crefvim.txt /*crv-nearbyintl* +crv-negative_sign crefvim.txt /*crv-negative_sign* +crv-nextafter crefvim.txt /*crv-nextafter* +crv-nextafterf crefvim.txt /*crv-nextafterf* +crv-nextafterl crefvim.txt /*crv-nextafterl* +crv-nexttoward crefvim.txt /*crv-nexttoward* +crv-nexttowardf crefvim.txt /*crv-nexttowardf* +crv-nexttowardl crefvim.txt /*crv-nexttowardl* +crv-offsetof crefvim.txt /*crv-offsetof* +crv-onesComplement crefvim.txt /*crv-onesComplement* +crv-opAdd crefvim.txt /*crv-opAdd* +crv-opAddress crefvim.txt /*crv-opAddress* +crv-opArithmetic crefvim.txt /*crv-opArithmetic* +crv-opArraySel crefvim.txt /*crv-opArraySel* +crv-opAsAdd crefvim.txt /*crv-opAsAdd* +crv-opAsAssign crefvim.txt /*crv-opAsAssign* +crv-opAsDiv crefvim.txt /*crv-opAsDiv* +crv-opAsLeftShift crefvim.txt /*crv-opAsLeftShift* +crv-opAsModulo crefvim.txt /*crv-opAsModulo* +crv-opAsMul crefvim.txt /*crv-opAsMul* +crv-opAsSub crefvim.txt /*crv-opAsSub* +crv-opAssigns crefvim.txt /*crv-opAssigns* +crv-opBitAnd crefvim.txt /*crv-opBitAnd* +crv-opBitCompl crefvim.txt /*crv-opBitCompl* +crv-opBitLeftShift crefvim.txt /*crv-opBitLeftShift* +crv-opBitOr crefvim.txt /*crv-opBitOr* +crv-opBitRightShift crefvim.txt /*crv-opBitRightShift* +crv-opBitXor crefvim.txt /*crv-opBitXor* +crv-opBitwise crefvim.txt /*crv-opBitwise* +crv-opConditional crefvim.txt /*crv-opConditional* +crv-opContents crefvim.txt /*crv-opContents* +crv-opDivide crefvim.txt /*crv-opDivide* +crv-opLogAnd crefvim.txt /*crv-opLogAnd* +crv-opLogNot crefvim.txt /*crv-opLogNot* +crv-opLogOr crefvim.txt /*crv-opLogOr* +crv-opLogical crefvim.txt /*crv-opLogical* +crv-opModulo crefvim.txt /*crv-opModulo* +crv-opMultiply crefvim.txt /*crv-opMultiply* +crv-opNegSign crefvim.txt /*crv-opNegSign* +crv-opOthers crefvim.txt /*crv-opOthers* +crv-opOverview crefvim.txt /*crv-opOverview* +crv-opParenth crefvim.txt /*crv-opParenth* +crv-opPosSign crefvim.txt /*crv-opPosSign* +crv-opPostDec crefvim.txt /*crv-opPostDec* +crv-opPostInc crefvim.txt /*crv-opPostInc* +crv-opPreDec crefvim.txt /*crv-opPreDec* +crv-opPrecedence crefvim.txt /*crv-opPrecedence* +crv-opRelEqual crefvim.txt /*crv-opRelEqual* +crv-opRelGT crefvim.txt /*crv-opRelGT* +crv-opRelGTE crefvim.txt /*crv-opRelGTE* +crv-opRelLT crefvim.txt /*crv-opRelLT* +crv-opRelLTE crefvim.txt /*crv-opRelLTE* +crv-opRelUnequal crefvim.txt /*crv-opRelUnequal* +crv-opRelational crefvim.txt /*crv-opRelational* +crv-opSeries crefvim.txt /*crv-opSeries* +crv-opSizeOf crefvim.txt /*crv-opSizeOf* +crv-opStructUnionSel crefvim.txt /*crv-opStructUnionSel* +crv-opSub crefvim.txt /*crv-opSub* +crv-opTypeCast crefvim.txt /*crv-opTypeCast* +crv-operators crefvim.txt /*crv-operators* +crv-p_cs_precedes crefvim.txt /*crv-p_cs_precedes* +crv-p_sep_by_space crefvim.txt /*crv-p_sep_by_space* +crv-p_sign_posn crefvim.txt /*crv-p_sign_posn* +crv-perror crefvim.txt /*crv-perror* +crv-positive_sign crefvim.txt /*crv-positive_sign* +crv-pow crefvim.txt /*crv-pow* +crv-powf crefvim.txt /*crv-powf* +crv-powl crefvim.txt /*crv-powl* +crv-preCondDefined crefvim.txt /*crv-preCondDefined* +crv-preCondElif crefvim.txt /*crv-preCondElif* +crv-preCondElse crefvim.txt /*crv-preCondElse* +crv-preCondEndif crefvim.txt /*crv-preCondEndif* +crv-preCondIf crefvim.txt /*crv-preCondIf* +crv-preCondIfdef crefvim.txt /*crv-preCondIfdef* +crv-preCondIfndef crefvim.txt /*crv-preCondIfndef* +crv-preConditional crefvim.txt /*crv-preConditional* +crv-preError crefvim.txt /*crv-preError* +crv-preLine crefvim.txt /*crv-preLine* +crv-preMac##Operator crefvim.txt /*crv-preMac##Operator* +crv-preMac#Operator crefvim.txt /*crv-preMac#Operator* +crv-preMacCancel crefvim.txt /*crv-preMacCancel* +crv-preMacDef crefvim.txt /*crv-preMacDef* +crv-preMacFunc crefvim.txt /*crv-preMacFunc* +crv-preMacObj crefvim.txt /*crv-preMacObj* +crv-preMacPredefined crefvim.txt /*crv-preMacPredefined* +crv-preMacros crefvim.txt /*crv-preMacros* +crv-preNull crefvim.txt /*crv-preNull* +crv-prePragma crefvim.txt /*crv-prePragma* +crv-preSourceInc crefvim.txt /*crv-preSourceInc* +crv-preprocessor crefvim.txt /*crv-preprocessor* +crv-printf crefvim.txt /*crv-printf* +crv-prtdiff_t crefvim.txt /*crv-prtdiff_t* +crv-punctuators crefvim.txt /*crv-punctuators* +crv-putc crefvim.txt /*crv-putc* +crv-putchar crefvim.txt /*crv-putchar* +crv-puts crefvim.txt /*crv-puts* +crv-putwc crefvim.txt /*crv-putwc* +crv-putwchar crefvim.txt /*crv-putwchar* +crv-qsort crefvim.txt /*crv-qsort* +crv-rais crefvim.txt /*crv-rais* +crv-rand crefvim.txt /*crv-rand* +crv-realloc crefvim.txt /*crv-realloc* +crv-register crefvim.txt /*crv-register* +crv-remainder crefvim.txt /*crv-remainder* +crv-remainderf crefvim.txt /*crv-remainderf* +crv-remainderl crefvim.txt /*crv-remainderl* +crv-remove crefvim.txt /*crv-remove* +crv-remquo crefvim.txt /*crv-remquo* +crv-remquof crefvim.txt /*crv-remquof* +crv-remquol crefvim.txt /*crv-remquol* +crv-rename crefvim.txt /*crv-rename* +crv-restrict crefvim.txt /*crv-restrict* +crv-return crefvim.txt /*crv-return* +crv-rewind crefvim.txt /*crv-rewind* +crv-rint crefvim.txt /*crv-rint* +crv-rintf crefvim.txt /*crv-rintf* +crv-rintl crefvim.txt /*crv-rintl* +crv-round crefvim.txt /*crv-round* +crv-roundf crefvim.txt /*crv-roundf* +crv-roundl crefvim.txt /*crv-roundl* +crv-scalbln crefvim.txt /*crv-scalbln* +crv-scalblnf crefvim.txt /*crv-scalblnf* +crv-scalblnl crefvim.txt /*crv-scalblnl* +crv-scalbn crefvim.txt /*crv-scalbn* +crv-scalbnf crefvim.txt /*crv-scalbnf* +crv-scalbnl crefvim.txt /*crv-scalbnl* +crv-scanf crefvim.txt /*crv-scanf* +crv-setbuf crefvim.txt /*crv-setbuf* +crv-setjmp crefvim.txt /*crv-setjmp* +crv-setlocale crefvim.txt /*crv-setlocale* +crv-setvbuf crefvim.txt /*crv-setvbuf* +crv-short crefvim.txt /*crv-short* +crv-sig_atomic_t crefvim.txt /*crv-sig_atomic_t* +crv-signMagnitude crefvim.txt /*crv-signMagnitude* +crv-signal crefvim.txt /*crv-signal* +crv-signbit crefvim.txt /*crv-signbit* +crv-signed crefvim.txt /*crv-signed* +crv-signgam crefvim.txt /*crv-signgam* +crv-sin crefvim.txt /*crv-sin* +crv-sinf crefvim.txt /*crv-sinf* +crv-sinh crefvim.txt /*crv-sinh* +crv-sinhf crefvim.txt /*crv-sinhf* +crv-sinhl crefvim.txt /*crv-sinhl* +crv-sinl crefvim.txt /*crv-sinl* +crv-size_t crefvim.txt /*crv-size_t* +crv-size_t2 crefvim.txt /*crv-size_t2* +crv-size_t3 crefvim.txt /*crv-size_t3* +crv-size_t4 crefvim.txt /*crv-size_t4* +crv-size_t5 crefvim.txt /*crv-size_t5* +crv-size_t6 crefvim.txt /*crv-size_t6* +crv-sizeof crefvim.txt /*crv-sizeof* +crv-snprintf crefvim.txt /*crv-snprintf* +crv-sprintf crefvim.txt /*crv-sprintf* +crv-sqrt crefvim.txt /*crv-sqrt* +crv-sqrtf crefvim.txt /*crv-sqrtf* +crv-sqrtl crefvim.txt /*crv-sqrtl* +crv-srand crefvim.txt /*crv-srand* +crv-sscanf crefvim.txt /*crv-sscanf* +crv-stBreak crefvim.txt /*crv-stBreak* +crv-stContinue crefvim.txt /*crv-stContinue* +crv-stDoWhile crefvim.txt /*crv-stDoWhile* +crv-stFor crefvim.txt /*crv-stFor* +crv-stGoto crefvim.txt /*crv-stGoto* +crv-stIfElse crefvim.txt /*crv-stIfElse* +crv-stNull crefvim.txt /*crv-stNull* +crv-stReturn crefvim.txt /*crv-stReturn* +crv-stSwitch crefvim.txt /*crv-stSwitch* +crv-stWhile crefvim.txt /*crv-stWhile* +crv-statements crefvim.txt /*crv-statements* +crv-static crefvim.txt /*crv-static* +crv-stdCLib crefvim.txt /*crv-stdCLib* +crv-stderr crefvim.txt /*crv-stderr* +crv-stdin crefvim.txt /*crv-stdin* +crv-stdout crefvim.txt /*crv-stdout* +crv-strcat crefvim.txt /*crv-strcat* +crv-strchr crefvim.txt /*crv-strchr* +crv-strcmp crefvim.txt /*crv-strcmp* +crv-strcoll crefvim.txt /*crv-strcoll* +crv-strcpy crefvim.txt /*crv-strcpy* +crv-strcspn crefvim.txt /*crv-strcspn* +crv-strerror crefvim.txt /*crv-strerror* +crv-strftime crefvim.txt /*crv-strftime* +crv-strlen crefvim.txt /*crv-strlen* +crv-strncat crefvim.txt /*crv-strncat* +crv-strncmp crefvim.txt /*crv-strncmp* +crv-strncpy crefvim.txt /*crv-strncpy* +crv-stroul crefvim.txt /*crv-stroul* +crv-strpbrk crefvim.txt /*crv-strpbrk* +crv-strrchr crefvim.txt /*crv-strrchr* +crv-strspn crefvim.txt /*crv-strspn* +crv-strstr crefvim.txt /*crv-strstr* +crv-strtod crefvim.txt /*crv-strtod* +crv-strtof crefvim.txt /*crv-strtof* +crv-strtoimax crefvim.txt /*crv-strtoimax* +crv-strtok crefvim.txt /*crv-strtok* +crv-strtol crefvim.txt /*crv-strtol* +crv-strtold crefvim.txt /*crv-strtold* +crv-strtoll crefvim.txt /*crv-strtoll* +crv-strtoull crefvim.txt /*crv-strtoull* +crv-strtoumax crefvim.txt /*crv-strtoumax* +crv-struct crefvim.txt /*crv-struct* +crv-strxfrm crefvim.txt /*crv-strxfrm* +crv-switch crefvim.txt /*crv-switch* +crv-swprintf crefvim.txt /*crv-swprintf* +crv-swscanf crefvim.txt /*crv-swscanf* +crv-system crefvim.txt /*crv-system* +crv-tan crefvim.txt /*crv-tan* +crv-tanf crefvim.txt /*crv-tanf* +crv-tanh crefvim.txt /*crv-tanh* +crv-tanhf crefvim.txt /*crv-tanhf* +crv-tanhl crefvim.txt /*crv-tanhl* +crv-tanl crefvim.txt /*crv-tanl* +crv-tgamma crefvim.txt /*crv-tgamma* +crv-tgammaf crefvim.txt /*crv-tgammaf* +crv-tgammal crefvim.txt /*crv-tgammal* +crv-thousands_sep crefvim.txt /*crv-thousands_sep* +crv-time crefvim.txt /*crv-time* +crv-time_t crefvim.txt /*crv-time_t* +crv-tm crefvim.txt /*crv-tm* +crv-tm2 crefvim.txt /*crv-tm2* +crv-tmpfile crefvim.txt /*crv-tmpfile* +crv-tmpnam crefvim.txt /*crv-tmpnam* +crv-tolower crefvim.txt /*crv-tolower* +crv-toupper crefvim.txt /*crv-toupper* +crv-towctrans crefvim.txt /*crv-towctrans* +crv-towlower crefvim.txt /*crv-towlower* +crv-towupper crefvim.txt /*crv-towupper* +crv-trigraph crefvim.txt /*crv-trigraph* +crv-true crefvim.txt /*crv-true* +crv-trunc crefvim.txt /*crv-trunc* +crv-truncf crefvim.txt /*crv-truncf* +crv-truncl crefvim.txt /*crv-truncl* +crv-twosComplement crefvim.txt /*crv-twosComplement* +crv-typedef crefvim.txt /*crv-typedef* +crv-uint16_t crefvim.txt /*crv-uint16_t* +crv-uint32_t crefvim.txt /*crv-uint32_t* +crv-uint64_t crefvim.txt /*crv-uint64_t* +crv-uint8_t crefvim.txt /*crv-uint8_t* +crv-uint_fast16_t crefvim.txt /*crv-uint_fast16_t* +crv-uint_fast32_t crefvim.txt /*crv-uint_fast32_t* +crv-uint_fast64_t crefvim.txt /*crv-uint_fast64_t* +crv-uint_fast8_t crefvim.txt /*crv-uint_fast8_t* +crv-uint_least16_t crefvim.txt /*crv-uint_least16_t* +crv-uint_least32_t crefvim.txt /*crv-uint_least32_t* +crv-uint_least64_t crefvim.txt /*crv-uint_least64_t* +crv-uint_least8_t crefvim.txt /*crv-uint_least8_t* +crv-uintmax_t crefvim.txt /*crv-uintmax_t* +crv-uintptr_t crefvim.txt /*crv-uintptr_t* +crv-ungetc crefvim.txt /*crv-ungetc* +crv-ungetwc crefvim.txt /*crv-ungetwc* +crv-union crefvim.txt /*crv-union* +crv-unsigned crefvim.txt /*crv-unsigned* +crv-va_arg crefvim.txt /*crv-va_arg* +crv-va_copy crefvim.txt /*crv-va_copy* +crv-va_end crefvim.txt /*crv-va_end* +crv-va_list crefvim.txt /*crv-va_list* +crv-va_start crefvim.txt /*crv-va_start* +crv-vfprintf crefvim.txt /*crv-vfprintf* +crv-vfscanf crefvim.txt /*crv-vfscanf* +crv-vfwprintf crefvim.txt /*crv-vfwprintf* +crv-vfwscanf crefvim.txt /*crv-vfwscanf* +crv-void crefvim.txt /*crv-void* +crv-volatile crefvim.txt /*crv-volatile* +crv-vprintf crefvim.txt /*crv-vprintf* +crv-vscanf crefvim.txt /*crv-vscanf* +crv-vsnprintf crefvim.txt /*crv-vsnprintf* +crv-vsprintf crefvim.txt /*crv-vsprintf* +crv-vsscanf crefvim.txt /*crv-vsscanf* +crv-vswprintf crefvim.txt /*crv-vswprintf* +crv-vswscanf crefvim.txt /*crv-vswscanf* +crv-vwprintf crefvim.txt /*crv-vwprintf* +crv-vwscanf crefvim.txt /*crv-vwscanf* +crv-wchar_t crefvim.txt /*crv-wchar_t* +crv-wchar_t2 crefvim.txt /*crv-wchar_t2* +crv-wchar_t3 crefvim.txt /*crv-wchar_t3* +crv-wcrtomb crefvim.txt /*crv-wcrtomb* +crv-wcscat crefvim.txt /*crv-wcscat* +crv-wcschr crefvim.txt /*crv-wcschr* +crv-wcscmp crefvim.txt /*crv-wcscmp* +crv-wcscoll crefvim.txt /*crv-wcscoll* +crv-wcscpy crefvim.txt /*crv-wcscpy* +crv-wcscspn crefvim.txt /*crv-wcscspn* +crv-wcsftime crefvim.txt /*crv-wcsftime* +crv-wcslen crefvim.txt /*crv-wcslen* +crv-wcsncat crefvim.txt /*crv-wcsncat* +crv-wcsncmp crefvim.txt /*crv-wcsncmp* +crv-wcsncpy crefvim.txt /*crv-wcsncpy* +crv-wcspbrk crefvim.txt /*crv-wcspbrk* +crv-wcsrchr crefvim.txt /*crv-wcsrchr* +crv-wcsrtombs crefvim.txt /*crv-wcsrtombs* +crv-wcsspn crefvim.txt /*crv-wcsspn* +crv-wcsstr crefvim.txt /*crv-wcsstr* +crv-wcstod crefvim.txt /*crv-wcstod* +crv-wcstof crefvim.txt /*crv-wcstof* +crv-wcstoimax crefvim.txt /*crv-wcstoimax* +crv-wcstok crefvim.txt /*crv-wcstok* +crv-wcstol crefvim.txt /*crv-wcstol* +crv-wcstold crefvim.txt /*crv-wcstold* +crv-wcstoll crefvim.txt /*crv-wcstoll* +crv-wcstombs crefvim.txt /*crv-wcstombs* +crv-wcstoul crefvim.txt /*crv-wcstoul* +crv-wcstoull crefvim.txt /*crv-wcstoull* +crv-wcstoumax crefvim.txt /*crv-wcstoumax* +crv-wcsxfrm crefvim.txt /*crv-wcsxfrm* +crv-wctob crefvim.txt /*crv-wctob* +crv-wctomb crefvim.txt /*crv-wctomb* +crv-wctrans crefvim.txt /*crv-wctrans* +crv-wctrans_t crefvim.txt /*crv-wctrans_t* +crv-wctype crefvim.txt /*crv-wctype* +crv-wctype_t crefvim.txt /*crv-wctype_t* +crv-while crefvim.txt /*crv-while* +crv-wint_t crefvim.txt /*crv-wint_t* +crv-wint_t2 crefvim.txt /*crv-wint_t2* +crv-wmemchr crefvim.txt /*crv-wmemchr* +crv-wmemcmp crefvim.txt /*crv-wmemcmp* +crv-wmemcpy crefvim.txt /*crv-wmemcpy* +crv-wmemmove crefvim.txt /*crv-wmemmove* +crv-wmemset crefvim.txt /*crv-wmemset* +crv-wprintf crefvim.txt /*crv-wprintf* +crv-wscanf crefvim.txt /*crv-wscanf* +crvdoc-author crefvimdoc.txt /*crvdoc-author* +crvdoc-copyright crefvimdoc.txt /*crvdoc-copyright* +crvdoc-credits crefvimdoc.txt /*crvdoc-credits* +crvdoc-customization crefvimdoc.txt /*crvdoc-customization* +crvdoc-history crefvimdoc.txt /*crvdoc-history* +crvdoc-install crefvimdoc.txt /*crvdoc-install* +crvdoc-intro crefvimdoc.txt /*crvdoc-intro* +crvdoc-lbCRef crefvimdoc.txt /*crvdoc-lbCRef* +crvdoc-lbScript crefvimdoc.txt /*crvdoc-lbScript* +crvdoc-licFDL crefvimdoc.txt /*crvdoc-licFDL* +crvdoc-licFreeDoc crefvimdoc.txt /*crvdoc-licFreeDoc* +crvdoc-licGPL crefvimdoc.txt /*crvdoc-licGPL* +crvdoc-licLGPL crefvimdoc.txt /*crvdoc-licLGPL* +crvdoc-limbugs crefvimdoc.txt /*crvdoc-limbugs* +crvdoc-usage crefvimdoc.txt /*crvdoc-usage* +dav pi_netrw.txt /*dav* +drv-dtArrayInit crefvim.txt /*drv-dtArrayInit* +drv-dtIncompleteArrayDecl crefvim.txt /*drv-dtIncompleteArrayDecl* +ex-visincr-I visincr.txt /*ex-visincr-I* +ex-visincr-IA visincr.txt /*ex-visincr-IA* +ex-visincr-ID visincr.txt /*ex-visincr-ID* +ex-visincr-IDMY visincr.txt /*ex-visincr-IDMY* +ex-visincr-II visincr.txt /*ex-visincr-II* +ex-visincr-IM visincr.txt /*ex-visincr-IM* +ex-visincr-IMDY visincr.txt /*ex-visincr-IMDY* +ex-visincr-IYMD visincr.txt /*ex-visincr-IYMD* +fetch pi_netrw.txt /*fetch* +ftp pi_netrw.txt /*ftp* +g:NetrwTopLvlMenu pi_netrw.txt /*g:NetrwTopLvlMenu* +g:netrw_alto pi_netrw.txt /*g:netrw_alto* +g:netrw_altv pi_netrw.txt /*g:netrw_altv* +g:netrw_browse_split pi_netrw.txt /*g:netrw_browse_split* +g:netrw_browsex_viewer pi_netrw.txt /*g:netrw_browsex_viewer* +g:netrw_cygwin pi_netrw.txt /*g:netrw_cygwin* +g:netrw_dav_cmd pi_netrw.txt /*g:netrw_dav_cmd* +g:netrw_extracmd pi_netrw.txt /*g:netrw_extracmd* +g:netrw_fastbrowse pi_netrw.txt /*g:netrw_fastbrowse* +g:netrw_fetch_cmd pi_netrw.txt /*g:netrw_fetch_cmd* +g:netrw_ftp pi_netrw.txt /*g:netrw_ftp* +g:netrw_ftp_browse_reject pi_netrw.txt /*g:netrw_ftp_browse_reject* +g:netrw_ftp_cmd pi_netrw.txt /*g:netrw_ftp_cmd* +g:netrw_ftp_list_cmd pi_netrw.txt /*g:netrw_ftp_list_cmd* +g:netrw_ftp_sizelist_cmd pi_netrw.txt /*g:netrw_ftp_sizelist_cmd* +g:netrw_ftp_timelist_cmd pi_netrw.txt /*g:netrw_ftp_timelist_cmd* +g:netrw_ftpmode pi_netrw.txt /*g:netrw_ftpmode* +g:netrw_hide pi_netrw.txt /*g:netrw_hide* +g:netrw_http_cmd pi_netrw.txt /*g:netrw_http_cmd* +g:netrw_ignorenetrc pi_netrw.txt /*g:netrw_ignorenetrc* +g:netrw_keepdir pi_netrw.txt /*g:netrw_keepdir* +g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd* +g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide* +g:netrw_liststyle pi_netrw.txt /*g:netrw_liststyle* +g:netrw_local_mkdir pi_netrw.txt /*g:netrw_local_mkdir* +g:netrw_local_rmdir pi_netrw.txt /*g:netrw_local_rmdir* +g:netrw_maxfilenamelen pi_netrw.txt /*g:netrw_maxfilenamelen* +g:netrw_menu pi_netrw.txt /*g:netrw_menu* +g:netrw_mkdir_cmd pi_netrw.txt /*g:netrw_mkdir_cmd* +g:netrw_nogx pi_netrw.txt /*g:netrw_nogx* +g:netrw_passwd pi_netrw.txt /*g:netrw_passwd* +g:netrw_rcp_cmd pi_netrw.txt /*g:netrw_rcp_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_rmf_cmd pi_netrw.txt /*g:netrw_rmf_cmd* +g:netrw_rsync_cmd pi_netrw.txt /*g:netrw_rsync_cmd* +g:netrw_scp_cmd pi_netrw.txt /*g:netrw_scp_cmd* +g:netrw_sftp_cmd pi_netrw.txt /*g:netrw_sftp_cmd* +g:netrw_shq pi_netrw.txt /*g:netrw_shq* +g:netrw_sort_by pi_netrw.txt /*g:netrw_sort_by* +g:netrw_sort_direction pi_netrw.txt /*g:netrw_sort_direction* +g:netrw_sort_sequence pi_netrw.txt /*g:netrw_sort_sequence* +g:netrw_ssh_browse_reject pi_netrw.txt /*g:netrw_ssh_browse_reject* +g:netrw_ssh_cmd pi_netrw.txt /*g:netrw_ssh_cmd* +g:netrw_timefmt pi_netrw.txt /*g:netrw_timefmt* +g:netrw_uid pi_netrw.txt /*g:netrw_uid* +g:netrw_use_noswf pi_netrw.txt /*g:netrw_use_noswf* +g:netrw_use_nt_rcp pi_netrw.txt /*g:netrw_use_nt_rcp* +g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp* +g:netrw_winsize pi_netrw.txt /*g:netrw_winsize* +g:vimball_home pi_vimball.txt /*g:vimball_home* +g:visincr_datedivset visincr.txt /*g:visincr_datedivset* +getlatestvimscripst-install GetLatestVimScripts.txt /*getlatestvimscripst-install* +getlatestvimscripts GetLatestVimScripts.txt /*getlatestvimscripts* +getlatestvimscripts-algorithm GetLatestVimScripts.txt /*getlatestvimscripts-algorithm* +getlatestvimscripts-autoinstall GetLatestVimScripts.txt /*getlatestvimscripts-autoinstall* +getlatestvimscripts-data GetLatestVimScripts.txt /*getlatestvimscripts-data* +getlatestvimscripts-history GetLatestVimScripts.txt /*getlatestvimscripts-history* +getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install* +getlatestvimscripts-plugins GetLatestVimScripts.txt /*getlatestvimscripts-plugins* +getlatestvimscripts-start GetLatestVimScripts.txt /*getlatestvimscripts-start* +getlatestvimscripts.txt GetLatestVimScripts.txt /*getlatestvimscripts.txt* +getscript pi_getscript.txt /*getscript* +getscript-autoinstall pi_getscript.txt /*getscript-autoinstall* +getscript-data pi_getscript.txt /*getscript-data* +getscript-history pi_getscript.txt /*getscript-history* +getscript-plugins pi_getscript.txt /*getscript-plugins* +getscript-start pi_getscript.txt /*getscript-start* +glvs GetLatestVimScripts.txt /*glvs* +glvs pi_getscript.txt /*glvs* +glvs-alg GetLatestVimScripts.txt /*glvs-alg* +glvs-alg pi_getscript.txt /*glvs-alg* +glvs-algorithm pi_getscript.txt /*glvs-algorithm* +glvs-autoinstall GetLatestVimScripts.txt /*glvs-autoinstall* +glvs-autoinstall pi_getscript.txt /*glvs-autoinstall* +glvs-contents GetLatestVimScripts.txt /*glvs-contents* +glvs-contents pi_getscript.txt /*glvs-contents* +glvs-copyright pi_getscript.txt /*glvs-copyright* +glvs-data GetLatestVimScripts.txt /*glvs-data* +glvs-data pi_getscript.txt /*glvs-data* +glvs-dist-install pi_getscript.txt /*glvs-dist-install* +glvs-hist GetLatestVimScripts.txt /*glvs-hist* +glvs-hist pi_getscript.txt /*glvs-hist* +glvs-install GetLatestVimScripts.txt /*glvs-install* +glvs-install pi_getscript.txt /*glvs-install* +glvs-options pi_getscript.txt /*glvs-options* +glvs-plugins GetLatestVimScripts.txt /*glvs-plugins* +glvs-plugins pi_getscript.txt /*glvs-plugins* +glvs-usage pi_getscript.txt /*glvs-usage* +http pi_netrw.txt /*http* +netreadfixup pi_netrw.txt /*netreadfixup* +netrw pi_netrw.txt /*netrw* +netrw-- pi_netrw.txt /*netrw--* +netrw-D pi_netrw.txt /*netrw-D* +netrw-O pi_netrw.txt /*netrw-O* +netrw-P pi_netrw.txt /*netrw-P* +netrw-R pi_netrw.txt /*netrw-R* +netrw-S pi_netrw.txt /*netrw-S* +netrw-U pi_netrw.txt /*netrw-U* +netrw-a pi_netrw.txt /*netrw-a* +netrw-activate pi_netrw.txt /*netrw-activate* +netrw-bookmark pi_netrw.txt /*netrw-bookmark* +netrw-bookmarks pi_netrw.txt /*netrw-bookmarks* +netrw-browse pi_netrw.txt /*netrw-browse* +netrw-browse-cmds pi_netrw.txt /*netrw-browse-cmds* +netrw-browse-intro pi_netrw.txt /*netrw-browse-intro* +netrw-browse-var pi_netrw.txt /*netrw-browse-var* +netrw-c pi_netrw.txt /*netrw-c* +netrw-cadaver pi_netrw.txt /*netrw-cadaver* +netrw-chgup pi_netrw.txt /*netrw-chgup* +netrw-contents pi_netrw.txt /*netrw-contents* +netrw-cr pi_netrw.txt /*netrw-cr* +netrw-credits pi_netrw.txt /*netrw-credits* +netrw-ctrl-h pi_netrw.txt /*netrw-ctrl-h* +netrw-ctrl-l pi_netrw.txt /*netrw-ctrl-l* +netrw-ctrl_h pi_netrw.txt /*netrw-ctrl_h* +netrw-ctrl_l pi_netrw.txt /*netrw-ctrl_l* +netrw-curdir pi_netrw.txt /*netrw-curdir* +netrw-d pi_netrw.txt /*netrw-d* +netrw-debug pi_netrw.txt /*netrw-debug* +netrw-del pi_netrw.txt /*netrw-del* +netrw-delete pi_netrw.txt /*netrw-delete* +netrw-dir pi_netrw.txt /*netrw-dir* +netrw-dirlist pi_netrw.txt /*netrw-dirlist* +netrw-downdir pi_netrw.txt /*netrw-downdir* +netrw-edithide pi_netrw.txt /*netrw-edithide* +netrw-ex pi_netrw.txt /*netrw-ex* +netrw-explore pi_netrw.txt /*netrw-explore* +netrw-explore-cmds pi_netrw.txt /*netrw-explore-cmds* +netrw-externapp pi_netrw.txt /*netrw-externapp* +netrw-file pi_netrw.txt /*netrw-file* +netrw-fixup pi_netrw.txt /*netrw-fixup* +netrw-ftp pi_netrw.txt /*netrw-ftp* +netrw-gb pi_netrw.txt /*netrw-gb* +netrw-gx pi_netrw.txt /*netrw-gx* +netrw-handler pi_netrw.txt /*netrw-handler* +netrw-help pi_netrw.txt /*netrw-help* +netrw-hexplore pi_netrw.txt /*netrw-hexplore* +netrw-hiding pi_netrw.txt /*netrw-hiding* +netrw-history pi_netrw.txt /*netrw-history* +netrw-horiz pi_netrw.txt /*netrw-horiz* +netrw-i pi_netrw.txt /*netrw-i* +netrw-incompatible pi_netrw.txt /*netrw-incompatible* +netrw-list pi_netrw.txt /*netrw-list* +netrw-listbookmark pi_netrw.txt /*netrw-listbookmark* +netrw-listhack pi_netrw.txt /*netrw-listhack* +netrw-login pi_netrw.txt /*netrw-login* +netrw-maps pi_netrw.txt /*netrw-maps* +netrw-mb pi_netrw.txt /*netrw-mb* +netrw-ml_get pi_netrw.txt /*netrw-ml_get* +netrw-move pi_netrw.txt /*netrw-move* +netrw-netrc pi_netrw.txt /*netrw-netrc* +netrw-nexplore pi_netrw.txt /*netrw-nexplore* +netrw-nread pi_netrw.txt /*netrw-nread* +netrw-nwrite pi_netrw.txt /*netrw-nwrite* +netrw-o pi_netrw.txt /*netrw-o* +netrw-options pi_netrw.txt /*netrw-options* +netrw-p pi_netrw.txt /*netrw-p* +netrw-p1 pi_netrw.txt /*netrw-p1* +netrw-p2 pi_netrw.txt /*netrw-p2* +netrw-p3 pi_netrw.txt /*netrw-p3* +netrw-p4 pi_netrw.txt /*netrw-p4* +netrw-p5 pi_netrw.txt /*netrw-p5* +netrw-p6 pi_netrw.txt /*netrw-p6* +netrw-p7 pi_netrw.txt /*netrw-p7* +netrw-p8 pi_netrw.txt /*netrw-p8* +netrw-p9 pi_netrw.txt /*netrw-p9* +netrw-passwd pi_netrw.txt /*netrw-passwd* +netrw-password pi_netrw.txt /*netrw-password* +netrw-path pi_netrw.txt /*netrw-path* +netrw-pexplore pi_netrw.txt /*netrw-pexplore* +netrw-preview pi_netrw.txt /*netrw-preview* +netrw-problems pi_netrw.txt /*netrw-problems* +netrw-protocol pi_netrw.txt /*netrw-protocol* +netrw-prvwin pi_netrw.txt /*netrw-prvwin* +netrw-pscp pi_netrw.txt /*netrw-pscp* +netrw-psftp pi_netrw.txt /*netrw-psftp* +netrw-putty pi_netrw.txt /*netrw-putty* +netrw-q pi_netrw.txt /*netrw-q* +netrw-r pi_netrw.txt /*netrw-r* +netrw-read pi_netrw.txt /*netrw-read* +netrw-ref pi_netrw.txt /*netrw-ref* +netrw-rename pi_netrw.txt /*netrw-rename* +netrw-reverse pi_netrw.txt /*netrw-reverse* +netrw-s pi_netrw.txt /*netrw-s* +netrw-settings pi_netrw.txt /*netrw-settings* +netrw-sexplore pi_netrw.txt /*netrw-sexplore* +netrw-sort pi_netrw.txt /*netrw-sort* +netrw-sortsequence pi_netrw.txt /*netrw-sortsequence* +netrw-source pi_netrw.txt /*netrw-source* +netrw-starpat pi_netrw.txt /*netrw-starpat* +netrw-starstar pi_netrw.txt /*netrw-starstar* +netrw-starstarpat pi_netrw.txt /*netrw-starstarpat* +netrw-start pi_netrw.txt /*netrw-start* +netrw-t pi_netrw.txt /*netrw-t* +netrw-texplore pi_netrw.txt /*netrw-texplore* +netrw-transparent pi_netrw.txt /*netrw-transparent* +netrw-u pi_netrw.txt /*netrw-u* +netrw-uidpass pi_netrw.txt /*netrw-uidpass* +netrw-updir pi_netrw.txt /*netrw-updir* +netrw-urls pi_netrw.txt /*netrw-urls* +netrw-userpass pi_netrw.txt /*netrw-userpass* +netrw-v pi_netrw.txt /*netrw-v* +netrw-var pi_netrw.txt /*netrw-var* +netrw-variables pi_netrw.txt /*netrw-variables* +netrw-vexplore pi_netrw.txt /*netrw-vexplore* +netrw-write pi_netrw.txt /*netrw-write* +netrw-x pi_netrw.txt /*netrw-x* +netrw-xfer pi_netrw.txt /*netrw-xfer* +netrw.vim pi_netrw.txt /*netrw.vim* +netrw_filehandler pi_netrw.txt /*netrw_filehandler* +network pi_netrw.txt /*network* +op-opAsRightShift crefvim.txt /*op-opAsRightShift* +opAsBitAnd crefvim.txt /*opAsBitAnd* +opAsBitOr crefvim.txt /*opAsBitOr* +opAsBitXor crefvim.txt /*opAsBitXor* +pi_getscript.txt pi_getscript.txt /*pi_getscript.txt* +pi_netrw.txt pi_netrw.txt /*pi_netrw.txt* +pi_vimball.txt pi_vimball.txt /*pi_vimball.txt* +rcp pi_netrw.txt /*rcp* +rsync pi_netrw.txt /*rsync* +scp pi_netrw.txt /*scp* +sftp pi_netrw.txt /*sftp* +tComment-Installation tComment.txt /*tComment-Installation* +tComment-Key-Bindings tComment.txt /*tComment-Key-Bindings* +tComment-Usage tComment.txt /*tComment-Usage* +tComment-commands tComment.txt /*tComment-commands* +tComment-uninstall tComment.txt /*tComment-uninstall* +tComment.txt tComment.txt /*tComment.txt* +vba pi_vimball.txt /*vba* +vimball pi_vimball.txt /*vimball* +vimball-contents pi_vimball.txt /*vimball-contents* +vimball-extract pi_vimball.txt /*vimball-extract* +vimball-history pi_vimball.txt /*vimball-history* +vimball-manual pi_vimball.txt /*vimball-manual* +viscinr-I visincr.txt /*viscinr-I* +viscinr-contents visincr.txt /*viscinr-contents* +visincr visincr.txt /*visincr* +visincr-IA visincr.txt /*visincr-IA* +visincr-ID visincr.txt /*visincr-ID* +visincr-IDMY visincr.txt /*visincr-IDMY* +visincr-II visincr.txt /*visincr-II* +visincr-IIO visincr.txt /*visincr-IIO* +visincr-IIR visincr.txt /*visincr-IIR* +visincr-IIX visincr.txt /*visincr-IIX* +visincr-IM visincr.txt /*visincr-IM* +visincr-IMDY visincr.txt /*visincr-IMDY* +visincr-IO visincr.txt /*visincr-IO* +visincr-IR visincr.txt /*visincr-IR* +visincr-IX visincr.txt /*visincr-IX* +visincr-IYMD visincr.txt /*visincr-IYMD* +visincr-RI visincr.txt /*visincr-RI* +visincr-RID visincr.txt /*visincr-RID* +visincr-RIDMY visincr.txt /*visincr-RIDMY* +visincr-RII visincr.txt /*visincr-RII* +visincr-RIM visincr.txt /*visincr-RIM* +visincr-RIMDY visincr.txt /*visincr-RIMDY* +visincr-RIYMD visincr.txt /*visincr-RIYMD* +visincr-calutil visincr.txt /*visincr-calutil* +visincr-copyright visincr.txt /*visincr-copyright* +visincr-decrease visincr.txt /*visincr-decrease* +visincr-decrement visincr.txt /*visincr-decrement* +visincr-examples visincr.txt /*visincr-examples* +visincr-history visincr.txt /*visincr-history* +visincr-increase visincr.txt /*visincr-increase* +visincr-increment visincr.txt /*visincr-increment* +visincr-leaddate visincr.txt /*visincr-leaddate* +visincr-options visincr.txt /*visincr-options* +visincr-raggedright visincr.txt /*visincr-raggedright* +visincr-usage visincr.txt /*visincr-usage* +visincr.txt visincr.txt /*visincr.txt* diff --git a/vimfiles/doc/visincr.txt b/vimfiles/doc/visincr.txt new file mode 100644 index 0000000..a97a8c9 --- /dev/null +++ b/vimfiles/doc/visincr.txt @@ -0,0 +1,462 @@ +*visincr.txt* The Visual Incrementing Tool Sep 19, 2006 + +Author: Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM> + (remove NOSPAM from Campbell's email before using) +Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. *visincr-copyright* + The VIM LICENSE applies to visincr.vim and visincr.txt + (see |copyright|) except use "visincr" instead of "Vim" + No warranty, express or implied. Use At-Your-Own-Risk. + +============================================================================== +1. Contents *visincr* *viscinr-contents* + + 1. Contents ....................: |visincr| + 2. Quick Usage .................: |visincr-usage| + 3. Increasing/Decreasing Lists..: |viscinr-increase| |viscinr-decrease| + :I [#] ...................: |visincr-I| + :II [# [zfill]] ...........: |visincr-II| + :IO [#] ...................: |visincr-IO| + :IIO [# [zfill]] ...........: |visincr-IIO| + :IX [#] ...................: |visincr-IX| + :IIX [# [zfill]] ...........: |visincr-IIX| + :IYMD [# [zfill]] ...........: |visincr-IYMD| + :IMDY [# [zfill]] ...........: |visincr-IMDY| + :IDMY [# [zfill]] ...........: |visincr-IDMY| + :IA [#] ...................: |visincr-IA| + :ID [#] ...................: |visincr-ID| + :IM [#] ...................: |visincr-IM| + 4. Examples.....................: |visincr-examples| + :I ..........................: |ex-viscinr-I| + :II .........................: |ex-viscinr-II| + :IMDY .......................: |ex-viscinr-IMDY| + :IYMD .......................: |ex-viscinr-IYMD| + :IDMY .......................: |ex-viscinr-IDMY| + :IA .........................: |ex-viscinr-IA| + :ID .........................: |ex-viscinr-ID| + 5. Options .....................: |visincr-options| + 6. History .....................: |visincr-history| + +============================================================================== +2. Quick Usage *visincr-usage* + + Use ctrl-v to visually select a column of numbers. Then + + :I [#] will use the first line's number as a starting point + default increment (#) is 1 + will justify left (pad right) + For more see |visincr-I| + + :II [# [zfill]] + will use the first line's number as a starting point + default increment (#) is 1 + default zfill is a blank (ex. :II 1 0) + will justify right (pad left) + For more see |visincr-II| + + ORIG I II + +---+ +----+ +----+ + | 8 | | 8 | | 8 | + | 8 | | 9 | | 9 | + | 8 | | 10 | | 10 | + | 8 | | 11 | | 11 | + +---+ +----+ +----+ + + For octal and hexadecimal incrementing, use the variants + (the increment is also octal or hexadecimal, respectively) + + :IO [#] :IX [#] + :IIO [# [zfil]] :IIX [# [zfill]] + + ORIG IO IIO + +---+ +----+ +----+ + | 6 | | 6 | | 6 | + | 6 | | 7 | | 7 | + | 6 | | 10 | | 10 | + | 6 | | 11 | | 11 | + +---+ +----+ +----+ + + ORIG IX IIX + +---+ +----+ +----+ + | 9 | | 9 | | 9 | + | 9 | | a | | a | + | 9 | | b | | b | + | 9 | | c | | c | + | 9 | | d | | d | + | 9 | | e | | e | + | 9 | | f | | f | + | 9 | | 10 | | 10 | + | 9 | | 11 | | 11 | + +---+ +----+ +----+ + + + The following three commands need <calutil.vim> to do + their work: + + :IYMD [#] Increment year/month/day dates (by optional # days) + :IMDY [#] Increment month/day/year dates (by optional # days) + :IDMY [#] Increment day/month/year dates (by optional # days) + For more: see |visincr-IYMD|, |visincr-IMDY|, and |visincr-IDMY| + (these options require the calutil.vim plugin; please see + |visincr-calutil|) + + :ID Increment days by name (Monday, Tuesday, etc). If only + three or fewer letters are highlighted, then only + three-letter abbreviations will be used. + For more: see |visincr-ID| + + :IA Increment alphabetic lists + For more: see |visincr-IA| + + :IM Increment months by name (January, February, etc). + Like ID, if three or fewer letters are highlighted, + then only three-letter abbreviations will be used. + For more: see |visincr-IM| + + :RI RII RIYMD RIMDY RIDMY RID RM + Restricted variants of the above commands - requires + that the visual block on the current line start with + an appropriate pattern (ie. a number for :I, a + dayname for :ID, a monthname for :IM, etc). + For more, see |visincr-RI|, |visincr-RII|, |visincr-RIYMD|, + |visincr-RIMDY|, |visincr-RIDMY|, |visincr-RID|, and + |visincr-M|. + + +============================================================================== +3. Increasing/Decreasing Lists *visincr-increase* *visincr-decrease* + *visincr-increment* *visincr-decrement* + +The visincr plugin facilitates making a column of increasing or decreasing +numbers, dates, or daynames. + + LEFT JUSTIFIED INCREMENTING *I* *viscinr-I* + :I [#] Will use the first line's number as a starting point to build + a column of increasing numbers (or decreasing numbers if the + increment is negative). + + Default increment: 1 + Justification : left (will pad on the right) + + The IX variant supports hexadecimal incrementing. + + *visincr-RI* + The restricted version (:RI) applies number incrementing only + to those lines in the visual block that begin with a number. + + See |visincr-raggedright| for a discussion on ragged-right + handling. + + *IX* *visincr-IX* *IO* *visincr-IO* + The following two commands are variants of :I : > + :IO [#] left justified octal incrementing + :IX [#] left justified hexadecimal incrementing +< The increments are in octal or hexadecimal for their + respective commands. + + *IR* *visincr-IR* *IIR* *visincr-IIR* + These commands do left (IR) and right (IIR) justified + Roman numeral enumeration. The increment for these + commands is in the usual arabic numerals (ie. decimal) + as Roman numerals don't support negative numbers. + + + + + RIGHT JUSTIFIED INCREMENTING *II* *visincr-II* + :II [# [zfill]] Will use the first line's number as a starting point + to build a column of increasing numbers (or decreasing numbers + if the increment is negative). + + Default increment: 1 + Justification : right (will pad on the left) + Zfill : left padding will be done with the given + character, typically a zero. + + *IIX* *visincr-IIX* *IIO* *visincr-IIO* + The following two commands are variants of :II : + :IIO [# [zfill]] right justified octal incrementing + :IIX [# [zfill]] right justified hexadecimal incrementing + + *visincr-RII* + The restricted version (:RII) applies number incrementing only to + those lines in the visual block that begin with zero or more + spaces and end with a number. + + RAGGED RIGHT HANDLING FOR I AND II *visincr-raggedright* + For :I and :II: + + If the visual block is ragged on the right-hand side (as can + easily happen when the "$" is used to select the + right-hand-side), the block will have spaces appended to + straighten it out. If the string length of the count exceeds + the visual-block, then additional spaces will be inserted as + needed. Leading tabs are handled by using virtual column + calculations. + + DATE INCREMENTING + :IYMD [# [zfill]] year/month/day *IYMD* *visincr-IYMD* + :IMDY [# [zfill]] month/day/year *IMDY* *visincr-IMDY* + :IDMY [# [zfill]] day/month/year *IDMY* *visincr-IDMY* + Will use the starting line's date to construct an increasing + or decreasing list of dates, depending on the sign of the + number. (these options need |visincr-calutil|) + + Default increment: 1 (in days) + + *visincr-RIYMD* *visincr-RIMDY* *visincr-RIDMY* + Restricted versions (:RIYMD, :RIMDY, :RIDMY) applies number + incrementing only to those lines in the visual block that + begin with a date (#/#/#). + + zfill: since dates include both single and double digits, + to line up the single digits must be padded. By default, + visincr will pad the single-digits in dates with zeros. + However, one may get blank padding by using a backslash + and then a space: > + :IYMD 1 \ + ^(space here) +< Of course, one may use any charcter for such padding. + + By default, English daynames and monthnames are used. + However, one may use whatever daynames and monthnames + one wishes by placing lines such as > + let g:visincr_dow = "Mandag,Tirsdag,Onsdag,Torsdag,Fredag,Lørdag,Søndag" + let g:visincr_month= "Janvier,Février,Mars,Avril,Mai,Juin,Juillet,Août,Septembre,Octobre,Novembre,Décembre" +< in your <.vimrc> initialization file. The two variables + (dow=day-of-week) should be set to a comma-delimited set of + words. + *g:visincr_datedivset* + By default, the date dividers are: given by: > + let g:visincr_datedivset= '[-./]' +< You may change the set in your <.vimrc>. The separator actually + used is the first one found in your date column. + + + SINGLE DIGIT DAYS OR MONTHS *visincr-leaddate* + + Single digit days or months are converted into two characters + by use of +> + g:visincr_leaddate +< + which, by default, is '0'. If you prefer blanks, simply put +> + let g:visincr_leaddate= ' ' +< + into your <.vimrc> file. + + CALUTIL NEEDED FOR DATE INCREMENTING *visincr-calutil* + For :IYMD, :IMDY, and IDMY: + + These options utilize the <calutil.vim> plugin, available as + "Calendar Utilities" at the following url on the web: + + http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs + + ALPHABETIC INCREMENTING *IA* *visincr-IA* + :IA Will produce an increasing/decreasing list of alphabetic + characters. + + DAYNAME INCREMENTING *ID* *visincr-ID* *visincr-RID* + :ID [#] Will produce an increasing/decreasing list of daynames. + Three-letter daynames will be used if the first day on the + first line is a three letter dayname; otherwise, full names + will be used. + + Restricted version (:RID) applies number incrementing only + to those lines in the visual block that begin with a dayname + (mon tue wed thu fri sat). + + MONTHNAME INCREMENTING *IM* *visincr-IM* *visincr-RIM* + :IM [#] will produce an increasing/decreasing list of monthnames. + Monthnames may be three-letter versions (jan feb etc) or + fully-spelled out monthnames. + + Restricted version (:RIM) applies number incrementing only + to those lines in the visual block that begin with a + monthname (jan feb mar etc). + + +============================================================================== +4. Examples: *visincr-examples* + + LEFT JUSTIFIED INCREMENTING EXAMPLES + :I :I 2 *ex-visincr-I* + Use ctrl-V to Use ctrl-V to + Original Select, :I Original Select, :I 2 + 8 8 8 8 + 8 9 8 10 + 8 10 8 12 + 8 11 8 14 + 8 12 8 16 + + :I -1 :I -2 + Use ctrl-V to Use ctrl-V to + Original Select, :I -1 Original Select, :I -3 + 8 8 8 8 + 8 7 8 5 + 8 6 8 2 + 8 5 8 -1 + 8 4 8 -4 + + RIGHT JUSTIFIED INCREMENTING EXAMPLES + :II :II 2 *ex-visincr-II* + Use ctrl-V to Use ctrl-V to + Original Select, :II Original Select, :II 2 + 8 8 8 8 + 8 9 8 10 + 8 10 8 12 + 8 11 8 14 + 8 12 8 16 + + :II -1 :II -2 + Use ctrl-V to Use ctrl-V to + Original Select, :II -1 Original Select, :II -3 + 8 8 8 8 + 8 7 8 5 + 8 6 8 2 + 8 5 8 -1 + 8 4 8 -4 + + DATE INCREMENTING EXAMPLES + :IMDY *ex-visincr-IMDY* + Use ctrl-V to Use ctrl-V to + Original Select, :IMDY Original Select, :IMDY 7 + 06/10/03 6/10/03 06/10/03 6/10/03 + 06/10/03 6/11/03 06/10/03 6/11/03 + 06/10/03 6/12/03 06/10/03 6/12/03 + 06/10/03 6/13/03 06/10/03 6/13/03 + 06/10/03 6/14/03 06/10/03 6/14/03 + + + :IYMD *ex-visincr-IYMD* + Use ctrl-V to Use ctrl-V to + Original Select, :IYMD Original Select, :IYMD 7 + 03/06/10 03/06/10 03/06/10 03/06/10 + 03/06/10 03/06/11 03/06/10 03/06/17 + 03/06/10 03/06/12 03/06/10 03/06/24 + 03/06/10 03/06/13 03/06/10 03/07/ 1 + 03/06/10 03/06/14 03/06/10 03/07/ 8 + + + :IDMY *ex-visincr-IDMY* + Use ctrl-V to Use ctrl-V to + Original Select, :IDMY Original Select, :IDMY 7 + 10/06/03 10/06/03 10/06/03 10/06/03 + 10/06/03 11/06/03 10/06/03 17/06/03 + 10/06/03 12/06/03 10/06/03 24/06/03 + 10/06/03 13/06/03 10/06/03 1/07/03 + 10/06/03 14/06/03 10/06/03 8/07/03 + + + ALPHABETIC INCREMENTING EXAMPLES + :IA *ex-visincr-IA* + Use ctrl-V to Use ctrl-V to + Original Select, :IA Original Select, :IA 2 + a) a) A) A) + a) b) A) C) + a) c) A) E) + a) d) A) G) + + DAYNAME INCREMENTING EXAMPLES + :ID *ex-visincr-ID* + Use ctrl-V to Use ctrl-V to + Original Select, :ID Original Select, :ID 2 + Sun Sun Sun Sun + Sun Mon Sun Tue + Sun Tue Sun Thu + Sun Wed Sun Sat + Sun Thu Sun Mon + + + :ID + Use ctrl-V to Use ctrl-V to + Original Select, :ID Original Select, :ID 2 + Sunday Sunday Sunday Sunday + Sunday Monday Sunday Monday + Sunday Tuesday Sunday Tuesday + Sunday Wednesday Sunday Wednesday + Sunday Thursday Sunday Thursday + + MONTHNAME INCREMENTING EXAMPLES + :IM *ex-visincr-IM* + Use ctrl-V to Use ctrl-V to + Original Select, :IM Original Select, :IM 2 + Jan Jan Jan Jan + Jan Feb Jan Mar + Jan Mar Jan May + Jan Apr Jan Jul + Jan May Jan Sep + + :IM + Use ctrl-V to Use ctrl-V to + Original Select, :IM Original Select, :IM 2 + January January January January + January February January March + January March January May + January April January July + January May January September + + +============================================================================== +5. Options *visincr-options* + + Default values are shown: > + + let g:visincr_dow ="Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" + let g:visincr_month="January,February,March,April,May,June,July,August,September,October,November,December" + let g:visincr_datedivset= '[-./]' +< + Controls respectively the day of week (ID), name of month (IM), + and dividers used by IMDY, IYMD, IDMY. + + +============================================================================== +6. History: *visincr-history* {{{1 + + v17: 07/26/06 : -complete=expression added to all visincr + commands + 07/27/06 * g:visincr_datedivset support included + v16: 06/15/06 : :IX, :IIX, :IO, and :IIO now support negative + increments and negative counts + 07/13/06 * :IR :IIR (roman numeral) support included + v14: 03/21/06 : :IX and :IIX implemented to support hexadecimal + incrementing + 03/25/06 * Visincr converted to use Vim 7.0's autoloading + 06/12/06 * Visincr will now direct users trying to do a + calendrical incrementing operation (IMDY, IYMD, + IDMY) but missing calutil.vim to the help on + where to get it (|visincr-calutil|). + 06/12/06 * :IO and :IIO implemented to support octal + incrementing + v13: 03/15/06 : a zfill of '' or "" now stands for an empty zfill + 03/16/06 * visincr now insures that the first character of + a month or day incrementing sequence (:IM, :ID) + is capitalized + * (bugfix) names embedded in a line weren't being + incremented correctly; text to the right of the + daynames/monthnames went missing. Fixed. + v12: 04/20/05 : load-once variable changed to g:loaded_visincr + protected from users' cpo options + 05/06/05 zfill capability provided to IDMY IMDY IYMD + 05/09/05 g:visincr_dow and g:visincr_month now can be + set by the user to customize daynames and + monthnames. + 03/07/06 passes my pluginkiller test (avoids more + problems causes by various options to vim) + v11: 08/24/04 : g:visincr_leaddate implemented + v10: 07/26/04 : IM and ID now handle varying length long-names + selected via |linewise-visual| mode + v9 : 03/05/04 : included IA command + v8 : 06/24/03 : added IM command + added RI .. RM commands (restricted) + v7 : 06/09/03 : bug fix -- years now retain leading zero + v6 : 05/29/03 : bug fix -- pattern for IMDY IDMY IYMD didn't work + with text on the sides of dates; it now does + v5 : II : implements 0-filling automatically if + the first number has the format 0000...0# + IYMD IMDY IDMY : date incrementing, uses <calutil.vim> + ID : day-of-week incrementing + v4 : gdefault option bypassed (saved/set nogd/restored) + +vim: tw=78:ts=8:ft=help:fdm=marker diff --git a/vimfiles/ftplugin/srec.vim b/vimfiles/ftplugin/srec.vim new file mode 100644 index 0000000..b05f18c --- /dev/null +++ b/vimfiles/ftplugin/srec.vim @@ -0,0 +1,108 @@ +" Vim filetype plugin file +" Language: S-record +" Maintainer: ZhaoRuFei <slimzhao@21cn.com> +" Last Change: 2004 May 31 +" License: This file is placed in the public domain. + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl et< fo< com< commentstring<" + +" Decode the S0 record +function! <SID>Interprete() + let b:s0_line = getline('.') + let b:data_count= ("0x". strpart(b:s0_line, 2, 2))+0 + "Contain 1 byte checksum, 1 byte DataCount(Contain checksum) + let b:line_len = strlen(b:s0_line)/2 + if b:data_count != (b:line_len-1) && b:data_count != (b:line_len-2) + echo "The data count of this record(line ". line('.'). ") is wrong!" + return + elseif b:data_count == b:line_len-1 + echo "This record looks have no checksum, press <C-K> to generate checksum for it" + return + else + "Check checksum + let b:right_cs = CheckSum(0) + if b:right_cs != strpart(b:s0_line, strlen(b:s0_line)-2) + echo "The Check sum is wrong!, should be: 0x". b:right_cs. ",Press <C-K> to correct it" + endif + endif + "Currently only parse S0 record + if getline('.') !~ '^S0' + return + endif + + let b:mname = strpart( b:s0_line, 8) + let b:mname = strpart( b:mname, 0, strlen(b:mname)-2) + let b:mname = substitute(b:mname,'[0-9a-fA-F]\{2}','\=(nr2char("0x".submatch(0)))', 'g') + echo "Info: " . b:mname + "RecType, DataCount, Address, Mname, ver, rev + +endfunction + + +"a worker function, invoked by others +func! Nr2Hex(nr) + let n = a:nr + let r = "" + while n + let r = '0123456789ABCDEF'[n % 16] . r + let n = n / 16 + endwhile + return r +endfunc +"Re-calculate the check sum, Assume there's no checksum at current line +"arg1 == 0, return CheckSum, don't modify, arg1 == 1, modify, and return; +"arg1 =~ [^01], nothing +function! CheckSum(arg1) + if a:arg1 != 0 && a:arg1 != 1 + return + endif + + let b:curr_line = strpart(getline('.'), 2) + let b:curr_line = strpart(b:curr_line, 0) + "Number of bytes to Sum + let n = strlen(b:curr_line) / 2 + let b:count = ('0x'. strpart(b:curr_line, 0, 2)) + 0 + "CheckSum + let sum = 0 + let j = 0 + let b:n_trim_sum = n + "Current line hasn't checksum at present + if b:count+1 == strlen(b:curr_line)/2 + let b:n_trim_sum = b:n_trim_sum-1 + elseif b:count != strlen(b:curr_line)/2 + return "BAD_DATACOUNT" + endif + + while j < b:n_trim_sum + let sum = "0x". strpart(b:curr_line, j*2, 2) + sum + let j = j+1 + endwhile + "echo '_' . curr_line . '_' + "echo 255-sum%256 + let sum_chars = Nr2Hex(255-sum%256) + if strlen(sum_chars) == 1 + let sum_chars = "0". sum_chars + elseif strlen(sum_chars) == 0 + "echo sum. ":" . b:curr_line. ":". n + let sum_chars = "00" + endif + "There's no checksum at present, 2: CheckSum(1byte) + DataCount(1byte) + if a:arg1 == 1 + if n == b:count + s/$/\= sum_chars/ + else + s/..$/\=sum_chars/ + endif + endif + return sum_chars +endfunction + +"add *.srec/*.s3 to the possible fileext +au! CursorHold *.s19,*.s28,*.37,*.srec,*.s3 call <SID>Interprete() +nnoremap <C-K> :silent call CheckSum(1)<CR> diff --git a/vimfiles/ftplugin/xml.vim b/vimfiles/ftplugin/xml.vim new file mode 100644 index 0000000..eae609f --- /dev/null +++ b/vimfiles/ftplugin/xml.vim @@ -0,0 +1,1860 @@ +" Vim script file vim600:fdm=marker: +" FileType: XML +" Author: Rene de Zwart <renez (at) lightcon.xs4all.nl> +" Maintainer: Rene de Zwart <renez (at) lightcon.xs4all.nl> +" Last Change: $Date: 2007/03/17 12:39:40 $ +" Version: $Revision: 1.35 $ +" +" Licence: This program is free software; you can redistribute it +" and/or modify it under the terms of the GNU General Public +" License. See http://www.gnu.org/copyleft/gpl.txt +" Credits: Devin Weaver <vim (at) tritarget.com> et all +" for the original code. Guo-Peng Wen for the self +" install documentation code. +" Bart vam Deenen for makeElement function + + +" Observation - If you want to do something to a match pair most of the time +" you must do first the close tag. Because doing first the open +" tag could change the close tag position. + + + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=<!--%s--> + +" XML: thanks to Johannes Zellner and Akbar Ibrahim +" - case sensitive +" - don't match empty tags <fred/> +" - match <!--, --> style comments (but not --, --) +" - match <!, > inlined dtd's. This is not perfect, as it +" gets confused for example by +" <!ENTITY gt ">"> +if exists("loaded_matchit") + let b:match_ignorecase=0 + let b:match_words = + \ '<:>,' . + \ '<\@<=!\[CDATA\[:]]>,'. + \ '<\@<=!--:-->,'. + \ '<\@<=?\k\+:?>,'. + \ '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,'. + \ '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>' +endif + +" Script rgular expresion used. Documents those nasty criters {{{1 +let s:NoSlashBeforeGt = '\(\/\)\@\<!>' +" Don't check for quotes around attributes!!! +let s:Attrib = '\(\(\s\|\n\)\+\([^>= \t]\+=[^>&]\+\)\(\s\|\n\)*\)' +let s:OptAttrib = s:Attrib . '*'. s:NoSlashBeforeGt +let s:ReqAttrib = s:Attrib . '\+'. s:NoSlashBeforeGt +let s:OpenTag = '<[^!/?][^>]*' . s:OptAttrib +let s:OpenOrCloseTag = '<[^!?][^>]*'. s:OptAttrib +let s:CloseTag = '<\/[^>]*'. s:OptAttrib +let s:SpaceInfront = '^\s*<' +let s:EndofName = '\($\|\s\|>\)' + +" Buffer variables {{{1 +let b:emptyTags='^\(img\|input\|param\|frame\|br\|hr\|meta\|link\|base\|area\)$' +let b:firstWasEndTag = 0 +let b:html_mode =((&filetype =~ 'x\?html') && !exists("g:xml_no_html")) +let b:haveAtt = 0 +let b:lastTag = "" +let b:lastAtt = "" +let b:suffix = (exists('g:makeElementSuf') ? g:makeElementSuf : ';;') +let b:xml_use_xhtml = 0 +if exists('g:xml_use_xhtml') + let b:xml_use_xhtml = g:xml_use_xhtml +elseif &filetype == 'xhtml' + let b:xml_use_xhtml = 1 +en + + + + +" NewFileXML -> Inserts <?xml?> at top of new file. {{{1 +if !exists("*NewFileXML") +function! NewFileXML( ) + " Where is g:did_xhtmlcf_inits defined? + if &filetype == 'xml' || + \ (!exists ("g:did_xhtmlcf_inits") && + \ b:xml_use_xhtml && + \ (&filetype =~ 'x\?html')) + if append (0, '<?xml version="1.0"?>') + normal! G + endif + endif +endfunction +endif + + + +" Callback -> Checks for tag callbacks and executes them. {{{1 +if !exists("*s:Callback") +function! s:Callback( xml_tag, isHtml ) + let text = 0 + if a:isHtml == 1 && exists ("*HtmlAttribCallback") + let text = HtmlAttribCallback (a:xml_tag) + elseif exists ("*XmlAttribCallback") + let text = XmlAttribCallback (a:xml_tag) + endif + if text != '0' + execute "normal! i " . text ."\<Esc>l" + endif +endfunction +endif + +" SavePos() saves position in bufferwide variable {{{1 +if !exists('*s:SavePos') +fun! s:SavePos() + retu 'call cursor('.line('.').','. col('.'). ')' +endf +en + +" findOpenTag() {{{1 +if !exists('*s:findOpenTag') +fun! s:findOpenTag(flag) + call search(s:OpenTag,a:flag) +endf +en + +" findCloseTag() {{{1 +if !exists('*s:findCloseTag') +fun! s:findCloseTag(flag) + call search(s:CloseTag,a:flag) +endf +en + +" GetTagName() Gets the tagname from start position {{{1 +"Now lets go for the name part. The namepart are xmlnamechars which +"is quite a big range. We assume that everything after '<' or '</' +"until the first 'space', 'forward slash' or '>' ends de name part. +if !exists('*s:GetTagName') +fun! s:GetTagName(from) + let l:end = match(getline('.'), s:EndofName,a:from) + return strpart(getline('.'),a:from, l:end - a:from ) +endf +en +" hasAtt() Looks for attribute in open tag {{{1 +" expect cursor to be on < +if !exists('*s:hasAtt') +fun! s:hasAtt() + "Check if this open tag has attributes + let l:line = line('.') | let l:col = col('.') + if search(b:tagName . s:ReqAttrib,'W') > 0 + if l:line == line('.') && l:col == (col('.')-1) + let b:haveAtt = 1 + en + en +endf +en + + +" TagUnderCursor() Is there a tag under the cursor? {{{1 +" Set bufer wide variable +" - b:firstWasEndTag +" - b:tagName +" - b:endcol & b:endline only used by Match() +" - b:gotoCloseTag (if the tag under the cursor is one) +" - b:gotoOpenTag (if the tag under the cursor is one) +" on exit +" - returns 1 (true) or 0 (false) +" - position is at '<' +if !exists('*s:TagUnderCursor') +fun! s:TagUnderCursor() + let b:firstWasEndTag = 0 + let l:haveTag = 0 + let b:haveAtt = 0 + + "Lets find forward a < or a >. If we first find a > we might be in a tag. + "If we find a < first or nothing we are definitly not in a tag + + if getline('.')[col('.') - 1] == '>' + let b:endcol = col('.') + let b:endline = line('.') + if getline('.')[col('.')-2] == '/' + "we don't work with empty tags + retu l:haveTag + en + " begin: gwang customization for JSP development + if getline('.')[col('.')-2] == '%' + "we don't work with jsp %> tags + retu l:haveTag + en + " end: gwang customization for JSP development + " begin: gwang customization for PHP development + if getline('.')[col('.')-2] == '?' + "we don't work with php ?> tags + retu l:haveTag + en + " end: gwang customization for PHP development + elseif search('[<>]','W') >0 + if getline('.')[col('.')-1] == '>' + let b:endcol = col('.') + let b:endline = line('.') + if getline('.')[col('.')-2] == '-' + "we don't work with comment tags + retu l:haveTag + en + if getline('.')[col('.')-2] == '/' + "we don't work with empty tags + retu l:haveTag + en + el + retu l:haveTag + en + el + retu l:haveTag + en + + if search('[<>]','bW' ) >=0 + if getline('.')[col('.')-1] == '<' + if getline('.')[col('.')] == '/' + let b:firstWasEndTag = 1 + let b:gotoCloseTag = s:SavePos() + elseif getline('.')[col('.')] == '?' || getline('.')[col('.')] == '!' + "we don't deal with processing instructions or dtd + "related definitions + retu l:haveTag + el + let b:gotoOpenTag = s:SavePos() + en + el + retu l:haveTag + en + el + retu l:haveTag + en + + "we have established that we are between something like + "'</\?[^>]*>' + + let b:tagName = s:GetTagName(col('.') + b:firstWasEndTag) + "echo 'Tag ' . b:tagName + + "begin: gwang customization, do not work with an empty tag name + if b:tagName == '' + retu l:haveTag + en + "end: gwang customization, do not work with an empty tag name + + let l:haveTag = 1 + if b:firstWasEndTag == 0 + call s:hasAtt() + exe b:gotoOpenTag + en + retu l:haveTag +endf +en + +" Match(tagname) Looks for open or close tag of tagname {{{1 +" Set buffer wide variable +" - b:gotoCloseTag (if the Match tag is one) +" - b:gotoOpenTag (if the Match tag is one) +" on exit +" - returns 1 (true) or 0 (false) +" - position is at '<' +if !exists('*s:Match') +fun! s:Match(name) + let l:pat = '</\=' . a:name . s:OptAttrib + if b:firstWasEndTag + exe b:gotoCloseTag + let l:flags='bW' + let l:level = -1 + el + exe 'normal '.b:endline.'G0'.(b:endcol-1).'l' + let l:flags='W' + let l:level = 1 + en + while l:level && search(l:pat,l:flags) > 0 + let l:level = l:level + (getline('.')[col('.')] == '/' ? -1 : 1) + endwhile + if l:level + echo "no matching tag!!!!!" + retu l:level + en + if b:firstWasEndTag + let b:gotoOpenTag = s:SavePos() + call s:hasAtt() + exe b:gotoOpenTag + el + let b:gotoCloseTag = s:SavePos() + en + retu l:level == 0 +endf +en + +" InComment() Is there a Comment under the cursor? {{{1 +" - returns 1 (true) or 0 (false) + +if !exists('*s:InComment') +fun! s:InComment() +let b:endcom=0 +let b:begcom=0 + + "Lets find forward a < or a >. If we first find a > we might be in a comment. + "If we find a < first or nothing we are definitly not in a Comment + + if getline('.')[col('.') - 1] == '>' + if getline('.')[col('.')-2] == '-' && getline('.')[col('.')-3] == '-' + let b:endcomcol=col('.') + let b:endcomline=line('.') + let b:endcom=1 + retu 1 + en + elseif getline('.')[col('.')-1] == '<' && getline('.')[col('.')] == '!' + \ && getline('.')[col('.')+1] == '-' && getline('.')[col('.')+2] == '-' + let b:begcomcol= col('.') + let b:begcomline=line('.') + let b:begcom=1 + retu 1 + en + "We are not standing on a begin/end comment + "Is the first > an ending comment? + if search('[<>]','W') >0 + if getline('.')[col('.')-1] == '>' + if getline('.')[col('.')-2] == '-' && getline('.')[col('.')-3] == '-' + let b:endcomcol=col('.') + let b:endcomline=line('.') + let b:endcom=1 + retu 1 + en + en + en + "Forward is not a ending comment + "is backward a starting comment + + if search('[<>]','bW' ) >=0 + if getline('.')[col('.')-1] == '<' && getline('.')[col('.')] == '!' + \ && getline('.')[col('.')+1] == '-' && getline('.')[col('.')+2] == '-' + let b:begcomcol=col('.') + let b:begcomline=line('.') + let b:begcom=1 + retu 1 + en + en + retu 0 +endf +en + +" DelComment() Is there a Comment under the cursor? {{{1 +" - returns 1 (true) or 0 (false) + +if !exists('*s:DelComment') +fun! s:DelComment() + + let l:restore = s:SavePos() + if s:InComment() + if b:begcom + if search('-->','W' ) >=0 + normal hh3x + call cursor(b:begcomline,b:begcomcol) + normal 4x + retu 1 + en + el + if search('<!--','bW' ) >=0 + normal 4x + call cursor(b:endcomline,b:endcomcol) + normal hh3x + retu 1 + en + en + en + exe l:restore + retu 0 +endf +en + +" DelCommentSection() Is there a Comment under the cursor? {{{1 +" - returns 1 (true) or 0 (false) + +if !exists('*s:DelCommentSection') +fun! s:DelCommentSection() + + let l:restore = s:SavePos() + if s:InComment() + let l:sentinel = 'XmLSeNtInElXmL' + let l:len = strlen(l:sentinel) + if b:begcom + if search('-->','W' ) >=0 + exe "normal f>a".l:sentinel."\<Esc>" + call cursor(b:begcomline,b:begcomcol) + exe "normal \"xd/".l:sentinel."/e-".l:len."\<Cr>" + exe "normal ".l:len."x" + retu 1 + en + el + if search('<!--','bW' ) >=0 + let l:restore = s:SavePos() + call cursor(b:endcomline,b:endcomcol) + exe "normal a".l:sentinel."\<Esc>" + exe l:restore + exe "normal \"xd/".l:sentinel."/e-".l:len."\<Cr>" + exe "normal ".l:len."x" + retu 1 + en + en + en + exe l:restore + retu 0 +endf +en + +" DelCData() Is there a CData under the cursor? {{{1 +" - returns 1 (true) or 0 (false) + +if !exists('*s:DelCData') +fun! s:DelCData() + + let l:restore = s:SavePos() + if s:InCData() + if b:begdat + if search(']]>','W' ) >=0 + normal hh3x + call cursor(b:begdatline,b:begdatcol) + normal 9x + retu 1 + en + el + if search('<![CDATA[','bW' ) >=0 + normal 9x + call cursor(b:enddatline,b:enddatcol) + normal hh3x + retu 1 + en + en + en + exe l:restore + retu 0 +endf +en + +" InCData() Is there a CData under the cursor? {{{1 +" - returns 1 (true) or 0 (false) + +if !exists('*s:InCData') +fun! s:InCData() +let b:enddat=0 +let b:begdat=0 + + "Lets find forward a < or a >. If we first find a > we might be in a comment. + "If we find a < first or nothing we are definitly not in a Comment + + if getline('.')[col('.') - 1] == '>' + if getline('.')[col('.')-2] == ']' && getline('.')[col('.')-3] == ']' + let b:enddatcol=col('.') + let b:enddatline=line('.') + let b:enddat=1 + retu 1 + en + elseif getline('.')[col('.')-1] == '<' + if match(getline('.'),'<![CDATA[') > 0 + let b:begdatcol= col('.') + let b:begdatline=line('.') + let b:begdat=1 + retu 1 + en + en + "We are not standing on a begin/end comment + "Is the first > aending comment? + if search('[<>]','W') >0 + if getline('.')[col('.')-1] == '>' + if getline('.')[col('.')-2] == ']' && getline('.')[col('.')-3] == ']' + let b:enddatcol=col('.') + let b:enddatline=line('.') + let b:enddat=1 + retu 1 + en + en + en + "Forward is not a ending datment + "is backward a starting comment + + if search('[<>]','bW' ) >=0 + if getline('.')[col('.')-1] == '<' + if match(getline('.'),'<![CDATA[') > 0 + let l:newname = inputdialog('Found CDATA') + let b:begdatcol=col('.') + let b:begdatline=line('.') + let b:begdat=1 + retu 1 + en + en + en + retu 0 +endf +en + + +" DelCDataSection() Is there a CData under the cursor? {{{1 +" - returns 1 (true) or 0 (false) + +if !exists('*s:DelCDataSection') +fun! s:DelCDataSection() + + let l:restore = s:SavePos() + if s:InCData() + let l:sentinel = 'XmLSeNtInElXmL' + let l:len = strlen(l:sentinel) + if b:begdat + if search(']]>','W' ) >=0 + exe "normal f>a".l:sentinel."\<Esc>" + call cursor(b:begdatline,b:begdatcol) + exe "normal \"xd/".l:sentinel."/e-".l:len."\<Cr>" + exe "normal ".l:len."x" + retu 1 + en + el + if search('<![CDATA[','bW' ) >=0 + let l:restore = s:SavePos() + call cursor(b:enddatline,b:enddatcol) + exe "normal a".l:sentinel."\<Esc>" + exe l:restore + exe "normal \"xd/".l:sentinel."/e-".l:len."\<Cr>" + exe "normal ".l:len."x" + retu 1 + en + en + en + exe l:restore + retu 0 +endf +en + + +" Matches() Matches de tagname under de cursor {{{1 +if !exists('*s:Matches') +fun! s:Matches() + let l:restore = s:SavePos() + if s:TagUnderCursor() + if s:Match(b:tagName) + retu + en + en + exe l:restore +endf +en + +" MatchesVisual() Matches de tagname under de cursor {{{1 +if !exists('*s:MatchesVisual') +fun! s:MatchesVisual() + let l:restore = s:SavePos() + if s:TagUnderCursor() + if b:firstWasEndTag + normal f> + en + normal gv + if s:Match(b:tagName) + if b:firstWasEndTag == 0 + normal f> + en + retu + en + normal v + en + exe l:restore +endf +en + +" makeElement() makes the previous woord an tag and close {{{1 +if !exists('*s:makeElement') +function! s:makeElement() + let b:tagName = @@ + let b:haveAtt = 0 + let l:alone = (match(getline('.'),'^\s*>\s*$') >= 0) + let l:endOfLine = ((col('.')+1) == col('$')) + normal i<pf> + if b:html_mode && b:tagName =~? b:emptyTags + if b:haveAtt == 0 + call s:Callback (b:tagName, b:html_mode) + endif + if b:xml_use_xhtml + exe "normal i/\<Esc>l" + en + if l:endOfLine + start! + el + normal l + start + en + el + if b:haveAtt == 0 + call s:Callback (b:tagName, b:html_mode) + end + if l:alone + exe 'normal! o</pa>Ox>>$x' + start! + el + exe 'normal! a</pa>F<' + start + en + en +endfunction +en + +" CloseTagFun() closing the tag which is being typed {{{1 +if !exists('*s:CloseTagFun') +fun! s:CloseTagFun() + let l:restore = s:SavePos() + let l:endOfLine = ((col('.')+1) == col('$')) + if col('.') > 1 && getline('.')[col('.')-2] == '>' + "Multiline request. <t>></t> --> + "<t> + " cursor comes here + "</t> + normal h + if s:TagUnderCursor() + if b:firstWasEndTag == 0 + exe "normal 2f>s\<Cr>\<Esc>Ox\<Esc>>>$x" + start! + retu + en + en + elseif s:TagUnderCursor() + if b:firstWasEndTag == 0 + exe "normal />\<Cr>" + if b:html_mode && b:tagName =~? b:emptyTags + if b:haveAtt == 0 + call s:Callback (b:tagName, b:html_mode) + en + if b:xml_use_xhtml + exe "normal i/\<Esc>l" + en + if l:endOfLine + start! + retu + el + normal l + start + retu + en + el + if b:haveAtt == 0 + call s:Callback (b:tagName, b:html_mode) + en + exe "normal! a</" . b:tagName . ">\<Esc>F<" + start + retu + en + en + en + exe l:restore + if (col('.')+1) == col("$") + startinsert! + else + normal l + startinsert + en +endf +en + +" BlockTag() Surround a visual block with a tag {{{1 +" Be carefull where You place the block +" the top is done with insert! +" the bottem is done with append! +if !exists('*s:BlockTag') +fun! s:BlockTag(multi) + let l:newname = inputdialog('Surround block with : ',b:lastTag) + if strlen( l:newname) == 0 + retu + en + let b:lastTag = l:newname + let l:newatt = inputdialog('Attributes for '.l:newname.' : ',b:lastAtt) + if strlen(l:newatt) + let b:lastAtt = l:newatt + en + + "Get at the end of the block + if col('.') == col("'<") && line('.') == line("'<") + normal gvov + en + if a:multi + exe "normal! a\<Cr></".l:newname.">\<Cr>\<Esc>" + let l:eline = line('.') + normal gvov + if col('.') == col("'>") && line('.') == line("'>") + normal gvov + en + let l:sline = line(".") + 2 + exe "normal! i\<Cr><".l:newname. + \ (strlen(l:newatt) ? ' '.l:newatt : '' ) + \ .">\<Cr>\<Esc>" + let l:rep=&report + let &report=999999 + exe l:sline.','.l:eline.'>' + let &report= l:rep + exe 'normal '.l:sline.'G0mh'.l:eline."G$v'hgq" + el + exe "normal! a</".l:newname.">\<Esc>gvov" + if col('.') == col("'>") && line('.') == line("'>") + normal gvov + en + exe "normal! i<".l:newname. + \ (strlen(l:newatt) ? ' '.l:newatt : '' ) + \ .">\<Esc>" + en +endf +en +" BlockWith() Surround a visual block with a open and a close {{{1 +" Be carefull where You place the block +" the top is done with insert! +" the bottem is done with append! +if !exists('*s:BlockWith') +fun! s:BlockWith(open,close) + if col('.') == col("'<") && line('.') == line("'<") + normal gvov + en + exe "normal! a\<Cr>;x\<Esc>0cfx".a:close."\<Cr>\<Esc>" + normal gvov + exe "normal! i\<Cr>;x\<Esc>0cfx".a:open."\<Cr>\<Esc>" +endf +en +" vlistitem() Surround a visual block with a listitem para tag {{{1 +" Be carefull where You place the block +" the top is done with insert! +" the bottem is done with append! +if !exists('*s:vlistitem') +fun! s:vlistitem() + "Get at the end of the block + if col('.') == col("'<") && line('.') == line("'<") + normal gvov + en + exe "normal! a</para>\<Cr></listitem>\<Esc>mh" + normal gvov + exe "normal! i\<Cr><listitem>\<Cr>\<Tab><para>\<Esc>'h/listitem>/e+1\<Cr>" +endf +en +" Change() Only renames the tag {{{1 +if !exists('*s:Change') +fun! s:Change() + let l:restore = s:SavePos() + if s:TagUnderCursor() + let l:newname = inputdialog('Change tag '.b:tagName.' to : ',b:lastTag) + if strlen( l:newname) == 0 + retu + en + let b:lastTag = l:newname + if s:Match(b:tagName) + exe b:gotoCloseTag + exe 'normal 2lcw' . l:newname . "\<Esc>" + exe b:gotoOpenTag + exe 'normal lcw' . l:newname . "\<Esc>" + en + en +endf +en + +" Join() Joins two the same tag adjacent sections {{{1 +if !exists('*s:Join') +fun! s:Join() + let l:restore = s:SavePos() + if s:TagUnderCursor() + let l:pat = '<[^?!]\S\+\($\| \|\t\|>\)' + let l:flags='W' + if b:firstWasEndTag == 0 + let l:flags='Wb' + en + if search(s:OpenOrCloseTag,l:flags) > 0 + + let l:secondChar = getline('.')[col('.')] + if l:secondChar == '/' && b:firstWasEndTag ||l:secondChar != '/' && !b:firstWasEndTag + exe l:restore + retu + en + let l:end = 0 + if l:secondChar == '/' + let l:end = 1 + en + let l:name = s:GetTagName(col('.') + l:end) + if l:name == b:tagName + if b:firstWasEndTag + let b:gotoOpenTag = s:SavePos() + el + let b:gotoCloseTag = s:SavePos() + en + let l:DeleteTag = "normal d/>/e\<Cr>" + exe b:gotoCloseTag + exe l:DeleteTag + exe b:gotoOpenTag + exe l:DeleteTag + en + en + en + exe l:restore +endf +en + +" ChangeWholeTag() removes attributes and rename tag {{{1 +if !exists('*s:ChangeWholeTag') +fun! s:ChangeWholeTag() + if s:TagUnderCursor() + let l:newname = inputdialog('Change whole tag '.b:tagName.' to : ',b:lastTag) + if strlen(l:newname) == 0 + retu + en + let b:lastTag = l:newname + let l:newatt = inputdialog('Attributes for '.l:newname.' : ',b:lastAtt) + if strlen(l:newatt) + let b:lastAtt = l:newatt + en + if s:Match(b:tagName) + exe b:gotoCloseTag + exe "normal 2lc/>\<Cr>".l:newname."\<Esc>" + exe b:gotoOpenTag + exe "normal lc/>/\<Cr>".l:newname. + \ (strlen(l:newatt) ? ' '.l:newatt : '' ) + \."\<Esc>" + en + en +endf +en + +" Delete() Removes a tag '<a id="a">blah</a>' --> 'blah' {{{1 +if !exists('*s:Delete') +fun! s:Delete() + let l:restore = s:SavePos() + if s:TagUnderCursor() + if s:Match(b:tagName) + let l:DeleteTag = "normal d/>/e\<Cr>" + exe b:gotoCloseTag + exe l:DeleteTag + exe b:gotoOpenTag + exe l:DeleteTag + en + else + exe l:restore + en +endf +en + + +" DeleteSection() Deletes everything between start of open tag and end of {{{1 +" closing tag +if !exists('*s:DeleteSection') +fun! s:DeleteSection() + let l:restore = s:SavePos() + if s:TagUnderCursor() + if s:Match(b:tagName) + let l:sentinel = 'XmLSeNtInElXmL' + let l:len = strlen(l:sentinel) + let l:rep=&report + let &report=999999 + exe b:gotoCloseTag + exe "normal />\<Cr>a".l:sentinel."\<Esc>" + exe b:gotoOpenTag + exe "normal \"xd/".l:sentinel."/e-".l:len."\<Cr>" + exe "normal ".l:len."x" + let &report= l:rep + en + en +endf +en +" +" FoldTag() Fold the tag under the cursor {{{1 +if !exists('*s:FoldTag') +fun! s:FoldTag() + let l:restore = s:SavePos() + if s:TagUnderCursor() + let l:sline = line('.') + if s:Match(b:tagName) + if b:firstWasEndTag + exe '.,'.l:sline.'fold' + el + exe l:sline.',.fold' + en + en + el + exe l:restore + en +endf +en + +" FoldTagAll() Fold all tags of under the cursor {{{1 +" If no tag under the cursor it asks for a tag +if !exists('*s:FoldTagAll') +fun! s:FoldTagAll() + let l:restore = s:SavePos() + if s:TagUnderCursor() + let l:tname = b:tagName + el + let l:tname = inputdialog('Which tag to fold : ',b:lastTag) + if strlen(l:tname) == 0 + exe l:restore + retu + en + let b:lastTag = l:tname + en + normal G$ + let l:flag='w' + while search('<'.l:tname.s:OptAttrib,l:flag) > 0 + let l:flag='W' + let l:sline = line('.') + let l:level = 1 + while l:level && search('</\='.l:tname.s:OptAttrib,'W') > 0 + let l:level = l:level + (getline('.')[col('.')] == '/' ? -1 : 1) + endwhile + if l:level == 0 + exe l:sline.',.fold' + el + let l:tmp = + \ inputdialog("The tag ".l:tname."(".l:sline.") doesn't have a closetag") + break + en + endwhile + exe l:restore +endf +en + + +" StartTag() provide the opening tag {{{1 +if !exists('*s:StartTag') +fun! s:StartTag() + let l:restore = s:SavePos() + let l:level = 1 + if getline('.')[col('.')-1] == '<' + if s:TagUnderCursor() + if b:firstWasEndTag + exe 'normal! i<'. b:tagName.">\<Esc>F<" + retu + el + let l:level = l:level + 1 + en + en + exe l:restore + en + while l:level && search(s:OpenOrCloseTag ,'W') > 0 + let l:level = l:level + (getline('.')[col('.')] == '/' ? -1 : 1) + endwhile + if l:level == 0 + let l:Name = s:GetTagName(col('.') + 1) + exe l:restore + exe 'normal! i<'. l:Name.">\<Esc>" + en + exe l:restore +endf +en + + + +" EndTag() search for open tag and produce endtaf {{{1 +if !exists('*s:EndTag') +fun! s:EndTag() + let l:restore = s:SavePos() + let l:level = -1 + while l:level && search(s:OpenOrCloseTag,'bW') > 0 + let l:level = l:level + (getline('.')[col('.')] == '/' ? -1 : 1) + endwhile + if l:level == 0 + let l:Name = s:GetTagName(col('.')) + exe l:restore + exe 'normal a</'. l:Name.">\e" + el + exe l:restore + en +endf +en + + +" BeforeTag() surrounds the current tag with a new one {{{1 +if !exists('*s:BeforeTag') +fun! s:BeforeTag() + let l:restore = s:SavePos() + if s:TagUnderCursor() + let l:newname = + \ inputdialog('Surround Before Tag '.b:tagName.' with : ',b:lastTag) + if strlen(l:newname) == 0 + retu + en + let b:lastTag = l:newname + let l:newatt = inputdialog('Attributes for '.l:newname.' : ',b:lastAtt) + if strlen(l:newatt) + let b:lastAtt = l:newatt + en + if s:Match(b:tagName) + exe b:gotoCloseTag + exe "normal! />\<Cr>a\<Cr></" . l:newname . ">\<Esc>" + let l:To = line('.') + exe b:gotoOpenTag + exe 'normal! i<' . l:newname . + \ (strlen(l:newatt) ? ' '.l:newatt : '' ) + \.">\<Cr>\<Esc>" + let l:rep=&report + let &report=999999 + exe line('.').','.l:To.'>' + let &report= l:rep + en + exe l:restore + en +endf +en + +" CommentTag() surrounds the current tag with a new one {{{1 +if !exists('*s:CommentTag') +fun! s:CommentTag() + let l:restore = s:SavePos() + if s:TagUnderCursor() + if s:Match(b:tagName) + exe b:gotoCloseTag + exe "normal! />\<Cr>a\<Cr>-->\<Esc>" + let l:To = line('.') + exe b:gotoOpenTag + exe "normal! i<!--\<Cr>\<Esc>" + let l:rep=&report + let &report=999999 + exe line('.').','.l:To.'>' + let &report= l:rep + en + else + exe l:restore + en +endf +en +" AfterTag() surrounds the tags after the current one with new {{{1 +if !exists('*s:AfterTag') +fun! s:AfterTag() + let l:restore = s:SavePos() + if s:TagUnderCursor() + let l:newname = + \ inputdialog('Add Tag After '.b:tagName.' with : ',b:lastTag) + if strlen(l:newname) == 0 + retu + en + let b:lastTag = l:newname + let l:newatt = inputdialog('Attributes for '.l:newname.' : ',b:lastAtt) + if strlen(l:newatt) + let b:lastAtt = l:newatt + en + if s:Match(b:tagName) + exe b:gotoCloseTag + exe 'normal! i</' . l:newname . ">\<Cr>\<Esc>" + let l:To = line('.') + exe b:gotoOpenTag + exe "normal! />\<Cr>a\<Cr><".l:newname. + \ (strlen(l:newatt) ? ' '.l:newatt : '' ) + \.">\<Esc>" + let l:rep=&report + let &report=999999 + exe line('.').','.l:To.'>' + let &report= l:rep + en + en + exe l:restore +endf +en +" ShiftRight() Shift the tag to the right {{{1 +if !exists('*s:ShiftRight') +fun! s:ShiftRight() + let l:restore = s:SavePos() + if s:TagUnderCursor() + let l:sline = line('.') + if s:Match(b:tagName) + let l:eline = line('.') + if b:firstWasEndTag + exe l:eline.','.l:sline.'>' + el + exe l:sline.','.l:eline.'>' + en + en + en +endf +en + +" ShiftLeft() Shift the tag to the left {{{1 +if !exists('*s:ShiftLeft') +fun! s:ShiftLeft() + let l:restore = s:SavePos() + if s:TagUnderCursor() + let l:sline = line('.') + if s:Match(b:tagName) + let l:eline = line('.') + if b:firstWasEndTag + exe l:eline.','.l:sline.'<' + el + exe l:sline.','.l:eline.'<' + en + en + en +endf +en +" FormatTag() visual select the block and use gq {{{1 +if !exists('*s:FormatTag') +fun! s:FormatTag() + if s:TagUnderCursor() + if s:Match(b:tagName) + exe b:gotoCloseTag + normal hhmh + exe b:gotoOpenTag + exe "normal />/e+1\<Cr>v'hgq" + en + en +endf +en + + + + +" FormatTagAll() Format all tags of name under the cursor {{{1 +" If no tag under the cursor it asks for a tag +if !exists('*s:FormatTagAll') +fun! s:FormatTagAll() + let l:restore = s:SavePos() + if s:TagUnderCursor() + let l:tname = b:tagName + el + let l:tname = inputdialog('Format every tag : ') + if strlen(l:tname) == 0 + exe l:restore + retu + en + en + normal G$ + let l:flag = 'w' + while search('<'.l:tname . s:OptAttrib, l:flag) > 0 + let l:flag = 'W' + let l:sline = line('.') + let l:level = 1 + exe "normal />/e+1\<cr>mh" + while l:level && search('</\='.l:tname . s:EndofName,'W') > 0 + let l:level = l:level + (getline('.')[col('.')] == '/' ? -1 : 1) + endwhile + if l:level == 0 + normal hv'hogq + el + let l:tmp = + \ inputdialog("The tag ".l:tname."(".l:sline.") doesn't have a closetag") + break + en + endwhile + exe l:restore +endf +en + + +" IndentAll() indent all tags multiline {{{1 +if !exists('*s:IndentAll') +fun! s:IndentAll() + + let l:restore = s:SavePos() + let l:rep=&report + let &report=999999 + "shift everything left + normal 1G<G<G<G<G<G<GG$ + if search(s:OpenTag,'w') > 0 + let l:level = 1 + normal f> + "if there is something after the tag move that to the next line + if col('.')+1 != col('$') + echo "after tag".line('.') + exe "normal a\<Cr>\<Esc>" + el + normal j + en + normal >Gk$ + while search(s:OpenOrCloseTag,'W') > 0 + "if there is text before the tag then move the tag to the next line + if match(getline('.'),s:SpaceInfront) == -1 + exe "normal i\<Cr>\<Esc>l" + en + if getline('.')[col('.')] == '/' + normal <G0f> + "if there is something after the tag move that to the next line + if col('.')+1 != col('$') + exe "normal a\<Cr>\<Esc>" + en + let l:level = l:level - 1 + el + normal f> + "if there is something after the tag move that to the next line + if col('.')+1 != col('$') + exe "normal a\<Cr>\<Esc>" + el + normal j0 + en + normal >Gk$ + let l:level = l:level + 1 + en + endwhile + if l:level + let l:tmp = + \ inputdialog("The tags opening and closing are unbalanced ".l:level) + en + en + exe l:restore + let &report= l:rep +endf +en + + +" Menu options: {{{1 +augroup XML_menu_autos +au! +autocmd BufLeave,BufWinLeave * + \ if &filetype == "xml" || &filetype == "html" || &filetype == "xhtml" | + \ amenu disable Xml | + \ amenu disable Xml.* | + \ endif +autocmd BufEnter,BufWinEnter * + \ if &filetype == "xml" || &filetype == "html" || &filetype == "xhtml" | + \ amenu enable Xml | + \ amenu enable Xml.* | + \ endif +au BufNewFile * + \ if &filetype == "xml" || &filetype == "html" || &filetype == "xhtml" | + \ call NewFileXML() | + \ endif +augroup END +if !exists("g:did_xml_menu") + let g:did_xml_menu = 1 + :1011 vmenu <script> &Xml.BlockTag\ multi<Tab>V <Esc>:call <SID>BlockTag(1)<Cr> + vmenu <script> Xml.BlockTag\ inline<Tab>v <Esc>:call <SID>BlockTag(0)<CR> + vmenu <script> Xml.Insert\ listitem<Tab>l <Esc>:call <SID>vlistitem()<CR> + vmenu <script> Xml.Comment<Tab>< <Esc>:call <SID>BlockWith('<!--','-->')<Cr> + vmenu <script> Xml.Comment\ With\ CData<Tab>c <Esc>:call <SID>BlockWith('<![CDATA[',']]>')<Cr> + nmenu <script> Xml.Comment\ Tag<Tab>= <Esc>:call <SID>CommentTag()<Cr> + imenu <script> Xml.Comment\ Tag<Tab>= <Esc>:call <SID>CommentTag()<Cr> + nmenu <script> Xml.Change<Tab>c :call <SID>Change()<CR> + imenu <script> Xml.Change<Tab>c <C-C>:call <SID>Change()<CR> + nmenu <script> Xml.Change\ Whole\ Tag<Tab>C :call <SID>ChangeWholeTag()<CR> + imenu <script> Xml.Change\ Whole\ Tag<Tab>C <C-C>:call <SID>ChangeWholeTag()<CR> + nmenu <script> Xml.Delete\ Comment<Tab>] :call <SID>DelComment()<CR> + imenu <script> Xml.Delete\ Comment<Tab>] <C-C>:call <SID>DelComment()<CR> + nmenu <script> Xml.Delete\ Comment\ Section<Tab>} :call <SID>DelCommentSection()<CR> + imenu <script> Xml.Delete\ Comment\ Section<Tab>} <C-C>:call <SID>DelCommentSection()<CR> + nmenu <script> Xml.Delete\ CData<Tab>[ :call <SID>DelCData()<CR> + imenu <script> Xml.Delete\ CData<Tab>[ <C-C>:call <SID>DelCData()<CR> + nmenu <script> Xml.Delete\ CData\ Section<Tab>[ :call <SID>DelCDataSection()<CR> + imenu <script> Xml.Delete\ CData\ Section<Tab>[ <C-C>:call <SID>DelCDataSection()<CR> + nmenu <script> Xml.Delete\ Tag<Tab>d :call <SID>Delete()<CR> + imenu <script> Xml.Delete\ Tag<Tab>d <C-C>:call <SID>Delete()<CR> + nmenu <script> Xml.Delete\ Section<Tab>D :call <SID>DeleteSection()<CR> + imenu <script> Xml.Delete\ Section<Tab>D <C-C>:call <SID>DeleteSection()<CR> + nmenu <script> Xml.End\ Tag<Tab>e :call <SID>EndTag()<CR> + imenu <script> Xml.End\ Tag<Tab>e <C-C>:call <SID>EndTag()<CR> + nmenu <script> Xml.Fold\ Comment :?<!--?,/-->/fo<CR> + nmenu <script> Xml.Fold\ CData :?<!\[CDATA\[?,/\]\]>/fo<CR> + nmenu <script> Xml.Fold\ Processing\ instruc :?<\?[a-zA-Z]*?,/?>/fo<CR> + nmenu <script> Xml.Fold\ Tag<Tab>f :call <SID>FoldTag()<CR> + nmenu <script> Xml.Fold\ All\ Tags<Tab>F :call <SID>FoldTagAll()<CR> + nmenu <script> Xml.Format\ Tags<Tab>g :call <SID>FormatTag()<CR> + nmenu <script> Xml.Format\ All\ Tags<Tab>G :call <SID>FormatTagAll()<CR> + nmenu <script> Xml.Join<Tab>j :call <SID>Join()<CR> + imenu <script> Xml.Join<Tab>j <C-C>:call <SID>Join()<CR> + nmenu <script> Xml.Open\ After\ Tag<Tab>O :call <SID>AfterTag()<CR> + imenu <script> Xml.Open\ After\ Tag<Tab>O <C-C>:call <SID>AfterTag()<CR> + nmenu <script> Xml.open\ Before\ Tag<Tab>o :call <SID>BeforeTag()<CR> + imenu <script> Xml.open\ Before\ Tag<Tab>o <C-C>:call <SID>BeforeTag()<CR> + nmenu <script> Xml.Match<Tab>5 :call <SID>Matches()<CR> + imenu <script> Xml.Match<Tab>5 <C-C>:call <SID>Matches()<CR><C-\><C-G> + nmenu <script> Xml.Shift\ Left<Tab>< :call <SID>ShiftLeft()<CR> + imenu <script> Xml.Shift\ Left<Tab>< <C-C>:call <SID>ShiftLeft()<CR><C-\><C-G> + nmenu <script> Xml.Shift\ Right<Tab>> :call <SID>ShiftRight()<CR> + imenu <script> Xml.Shift\ Right<Tab>> <C-C>:call <SID>ShiftRight()<CR><C-\><C-G> + nmenu <script> Xml.Start\ Tag<Tab>s :call <SID>StartTag()<CR> + imenu <script> Xml.Start\ Tag<Tab>s <C-C>:call <SID>StartTag()<CR><C-\><C-G> +en + +" Section: Doc installation {{{1 +" Function: s:XmlInstallDocumentation(full_name, revision) {{{2 +" Install help documentation. +" Arguments: +" full_name: Full name of this vim plugin script, including path name. +" revision: Revision of the vim script. #version# mark in the document file +" will be replaced with this string with 'v' prefix. +" Return: +" 1 if new document installed, 0 otherwise. +" Note: Cleaned and generalized by guo-peng Wen +"''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +function! s:XmlInstallDocumentation(full_name, revision) + " Name of the document path based on the system we use: + if (has("unix")) + " On UNIX like system, using forward slash: + let l:slash_char = '/' + let l:mkdir_cmd = ':silent !mkdir -p ' + else + " On M$ system, use backslash. Also mkdir syntax is different. + " This should only work on W2K and up. + let l:slash_char = '\' + let l:mkdir_cmd = ':silent !mkdir ' + endif + + let l:doc_path = l:slash_char . 'doc' + "let l:doc_home = l:slash_char . '.vim' . l:slash_char . 'doc' + + " Figure out document path based on full name of this script: + let l:vim_plugin_path = fnamemodify(a:full_name, ':h') + "let l:vim_doc_path = fnamemodify(a:full_name, ':h:h') . l:doc_path + let l:vim_doc_path = matchstr(l:vim_plugin_path, + \ '.\{-}\ze\%(\%(ft\)\=plugin\|macros\)') . l:doc_path + if (!(filewritable(l:vim_doc_path) == 2)) + echomsg "Doc path: " . l:vim_doc_path + execute l:mkdir_cmd . l:vim_doc_path + if (!(filewritable(l:vim_doc_path) == 2)) + " Try a default configuration in user home: + "let l:vim_doc_path = expand("~") . l:doc_home + let l:vim_doc_path = matchstr(&rtp, + \ escape($HOME, '\') .'[/\\]\%(\.vim\|vimfiles\)') + if (!(filewritable(l:vim_doc_path) == 2)) + execute l:mkdir_cmd . l:vim_doc_path + if (!(filewritable(l:vim_doc_path) == 2)) + " Put a warning: + echomsg "Unable to open documentation directory" + echomsg " type :help add-local-help for more informations." + return 0 + endif + endif + endif + endif + + " Exit if we have problem to access the document directory: + if (!isdirectory(l:vim_plugin_path) + \ || !isdirectory(l:vim_doc_path) + \ || filewritable(l:vim_doc_path) != 2) + return 0 + endif + + " Full name of script and documentation file: + let l:script_name = 'xml.vim' + let l:doc_name = 'xml-plugin.txt' + let l:plugin_file = l:vim_plugin_path . l:slash_char . l:script_name + let l:doc_file = l:vim_doc_path . l:slash_char . l:doc_name + + " Bail out if document file is still up to date: + if (filereadable(l:doc_file) && + \ getftime(l:plugin_file) < getftime(l:doc_file)) + return 0 + endif + + " Prepare window position restoring command: + if (strlen(@%)) + let l:go_back = 'b ' . bufnr("%") + else + let l:go_back = 'enew!' + endif + + " Create a new buffer & read in the plugin file (me): + setl nomodeline + exe 'enew!' + exe 'r ' . l:plugin_file + + setl modeline + let l:buf = bufnr("%") + setl noswapfile modifiable + + norm zR + norm gg + + " Delete from first line to a line starts with + " === START_DOC + 1,/^=\{3,}\s\+START_DOC\C/ d + + " Delete from a line starts with + " === END_DOC + " to the end of the documents: + /^=\{3,}\s\+END_DOC\C/,$ d + + " Remove fold marks: + "% s/{\{3}[1-9]/ / + + " Add modeline for help doc: the modeline string is mangled intentionally + " to avoid it be recognized by VIM: + call append(line('$'), '') + call append(line('$'), ' v' . 'im:tw=78:ts=8:fen:fdm=marker:ft=help:norl:') + + " Replace revision: + exe "normal :1,5s/#version#/ v" . a:revision . "/\<CR>" + + " Save the help document: + exe 'w! ' . l:doc_file + exe l:go_back + exe 'bw ' . l:buf + + " Build help tags: + exe 'helptags ' . l:vim_doc_path + + return 1 +endfunction +" }}}2 + +let s:revision= + \ substitute("$Revision: 1.35 $",'\$\S*: \([.0-9]\+\) \$','\1','') +silent! let s:install_status = + \ s:XmlInstallDocumentation(expand('<sfile>:p'), s:revision) +if (s:install_status == 1) + echom expand("<sfile>:t:r") . '-plugin v' . s:revision . + \ ': Help-documentation installed.' +endif + + +" Mappings of keys to functions {{{1 +nnoremap <silent> <buffer> <LocalLeader>5 :call <SID>Matches()<Cr> +vnoremap <silent> <buffer> <LocalLeader>5 <Esc>:call <SID>MatchesVisual()<Cr> +nnoremap <silent> <buffer> <LocalLeader>% :call <SID>Matches()<Cr> +vnoremap <silent> <buffer> <LocalLeader>% <Esc>:call <SID>MatchesVisual()<Cr> +nnoremap <silent> <buffer> <LocalLeader>c :call <SID>Change()<Cr> +nnoremap <silent> <buffer> <LocalLeader>C :call <SID>ChangeWholeTag()<Cr> +nnoremap <silent> <buffer> <LocalLeader>d :call <SID>Delete()<Cr> +nnoremap <silent> <buffer> <LocalLeader>D :call <SID>DeleteSection()<Cr> +nnoremap <silent> <buffer> <LocalLeader>e :call <SID>EndTag()<Cr> +nnoremap <silent> <buffer> <LocalLeader>] :call <SID>DelComment()<Cr> +nnoremap <silent> <buffer> <LocalLeader>} :call <SID>DelCommentSection()<Cr> +nnoremap <silent> <buffer> <LocalLeader>f :call <SID>FoldTag()<Cr> +nnoremap <silent> <buffer> <LocalLeader>F :call <SID>FoldTagAll()<Cr> +nnoremap <silent> <buffer> <LocalLeader>g :call <SID>FormatTag()<Cr> +nnoremap <silent> <buffer> <LocalLeader>G :call <SID>FormatTagAll()<Cr> +nnoremap <silent> <buffer> <LocalLeader>I :call <SID>IndentAll()<Cr> +nnoremap <silent> <buffer> <LocalLeader>j :call <SID>Join()<Cr> +nnoremap <silent> <buffer> <LocalLeader>O :call <SID>BeforeTag()<Cr> +nnoremap <silent> <buffer> <LocalLeader>= :call <SID>CommentTag()<Cr> +nnoremap <silent> <buffer> <LocalLeader>o :call <SID>AfterTag()<Cr> +nnoremap <silent> <buffer> <LocalLeader>s :call <SID>StartTag()<Cr> +nnoremap <silent> <buffer> <LocalLeader>[ :call <SID>DelCData()<Cr> +nnoremap <silent> <buffer> <LocalLeader>{ :call <SID>DelCDataSection()<Cr> +nnoremap <silent> <buffer> <LocalLeader>> :call <SID>ShiftRight()<Cr> +nnoremap <silent> <buffer> <LocalLeader>< :call <SID>ShiftLeft()<Cr> +vnoremap <silent> <buffer> <LocalLeader>l <Esc>:call <SID>vlistitem()<Cr> +vnoremap <silent> <buffer> <LocalLeader>v <Esc>:call <SID>BlockTag(0)<Cr> +vnoremap <silent> <buffer> <LocalLeader>V <Esc>:call <SID>BlockTag(1)<Cr> +vnoremap <silent> <buffer> <LocalLeader>c <Esc>:call <SID>BlockWith('<![CDATA[',']]>')<Cr> +vnoremap <silent> <buffer> <LocalLeader>< <Esc>:call <SID>BlockWith('<!--','-->')<Cr> + +" Move around functions. +noremap <silent><buffer> [[ m':call <SID>findOpenTag("bW")<CR> +noremap <silent><buffer> ]] m':call <SID>findOpenTag( "W")<CR> +noremap <silent><buffer> [] m':call <SID>findCloseTag( "bW")<CR> +noremap <silent><buffer> ][ m':call <SID>findCloseTag( "W")<CR> + +" Move around comments +noremap <silent><buffer> ]" :call search('^\(\s*<!--.*\n\)\@<!\(\s*-->\)', "W")<CR> +noremap <silent><buffer> [" :call search('\%(^\s*<!--.*\n\)\%(^\s*-->\)\@!', "bW")<CR> + + +setlocal iskeyword=@,48-57,_,192-255,58 +exe 'inoremap <silent> <buffer> '.b:suffix. " ><Esc>db:call <SID>makeElement()<Cr>" +if !exists("g:xml_tag_completion_map") + inoremap <silent> <buffer> > ><Esc>:call <SID>CloseTagFun()<Cr> +else + execute "inoremap <silent> <buffer> " . g:xml_tag_completion_map . " ><Esc>:call <SID>CloseTagFun()<Cr>" +endif + + + +finish + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""/*}}}*/ +" Section: Documentation content {{{1 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +=== START_DOC +*xml-plugin.txt* Help edit XML and SGML documents. #version# + + XML Edit ~ + +A filetype plugin to help edit XML and SGML documents. + +This script provides some convenience when editing XML (and some SGML +including HTML) formated documents. It allows you to jump to the +beginning or end of the tag block your cursor is in. '%' will jump +between '<' and '>' within the tag your cursor is in. When in insert +mode and you finish a tag (pressing '>') the tag will be completed. If +you press '>' twice it will place the cursor in the middle of the tags +on it's own line (helps with nested tags). + +Usage: Place this file into your ftplugin directory. To add html support +Sym-link or copy this file to html.vim in your ftplugin directory. To activte +the script place 'filetype plugin on' in your |.vimrc| file. See |ftplugins| +for more information on this topic. + +If the file edited is of type "html" and "xml_use_html" is defined then +the following tags will not auto complete: <img>, <input>, <param>, +<frame>, <br>, <hr>, <meta>, <link>, <base>, <area> + +If the file edited is of type 'html' and 'xml_use_xhtml' is defined the +above tags will autocomplete the xml closing staying xhtml compatable. +ex. <hr> becomes <hr /> (see |xml-plugin-settings|) + +Known Bugs {{{1 ~ + +- < & > marks inside of a CDATA section are interpreted as actual XML tags + even if unmatched. +- The script can not handle leading spaces such as < tag></ tag> it is + illegal XML syntax and considered very bad form. +- Placing a literal `>' in an attribute value will auto complete despite that + the start tag isn't finished. This is poor XML anyway you should use + > instead. + + +------------------------------------------------------------------------------ + *xml-plugin-settings* +Options {{{1 + +(All options must be placed in your |.vimrc| prior to the |ftplugin| +command.) + +xml_tag_completion_map + Use this setting to change the default mapping to auto complete a + tag. By default typing a literal `>' will cause the tag your editing + to auto complete; pressing twice will auto nest the tag. By using + this setting the `>' will be a literal `>' and you must use the new + mapping to perform auto completion and auto nesting. For example if + you wanted Control-L to perform auto completion inmstead of typing a + `>' place the following into your .vimrc: > + let xml_tag_completion_map = "<C-l>" +< +xml_no_auto_nesting (Not Working!!!!!) + This turns off the auto nesting feature. After a completion is made + and another `>' is typed xml-edit automatically will break the tag + accross multiple lines and indent the curser to make creating nested + tqags easier. This feature turns it off. Enter the following in your + .vimrc: > + let xml_no_auto_nesting = 1 +< +xml_use_xhtml + When editing HTML this will auto close the short tags to make valid + XML like <hr/> and <br/>. Enter the following in your vimrc to + turn this option on: > + let xml_use_xhtml = 1 + if the filetype is xhtml and g:xml_use_xhtml doesn't exists + the script defines it to be 1. (This also assumes that you have linked + xml.vim to xhtml.vim. Otherwise this item is moot) + For a file to be of xhtml type there need to be a doctype declaration!! + just naming a file something.xhtml doesn't make it type xhtml! +< +xml_no_html + This turns of the support for HTML specific tags. Place this in your + .vimrc: > + let xml_no_html = 1 +< +------------------------------------------------------------------------------ + *xml-plugin-mappings* + +Mapings and their functions {{{1 + +Typing '>' will start the tag closing routine. +Typing (Where | means cursor position) + <para>| +results in + <para>|</para> + +Typing + <para>>|</para> +results in + <para> + | + </para> +typing a lone '>' and no '<' in front of it accepts the '>' (But having +lone '>' or '<' in a XML file is frown upon except in <!CDATA> sections, +and that will throw of the plugin!!). + +Typing </tag> or <tag/> also results in na expanding. So when editing +html type <input .... /> + +The closing routing also ignores DTD tags '<!,,>' and processing +instructions '<?....?>'. Thus typing these result in no expansion. + + +<LocalLeader> is a setting in VIM that depicts a prefix for scripts and +plugins to use. By default this is the backslash key `\'. See |mapleader| +for details. + +;; make element out previous word and close it {{{2 + - when typing a word;; wil create <word>|</word> + when word on its own line it will be + <word> + | + </word> + the suffix can be changed by setting + let makeElementSuf = ',,,' in your .vimrc + Thanks to Bart van Deenen + (http://www.vim.org/scripts/script.php?script_id=632) + +[ and ] mappings {{{2 + <LocalLeader>[ Delete <![CDATA[ ]]> delimiters + <LocalLeader>{ Delete <![CDATA[ ]]> section + <LocalLeader>] Delete <!-- --> delimiters + <LocalLeader>} Delete <!-- --> section + [[ Goto to the previous open tag + [[ Goto to the next open tag + [] Goto to the previous close tag + ][ Goto to the next close tag + [" Goto to the next comment + ]" Goto the previous comment +<LocalLeader>5 Jump to the matching tag. {{{2 +<LocalLeader>% Jump to the matching tag. + + +<LocalLeader>c Rename tag {{{2 + +<LocalLeader>C Rename tag and remove attributes {{{2 + Will ask for attributes + +<LocalLeader>d Deletes the surrounding tags from the cursor. {{{2 + <tag1>outter <tag2>inner text</tag2> text</tag1> + | + Turns to: + outter <tag2>inner text</tag2> text + | + +<LocalLeader>D Deletes the tag and it contents {{{2 + - and put it in register x. + <tag1>outter <tag2>inner text</tag2> text</tag1> + | + Turns to: + <tag1>outter text</tag1> + +<LocalLeader>e provide endtag for open tags. {{{2 + - provide endtag for open tags. Watch where de cursor is + <para><listitem>list item content + | + pressing \e twice produces + <para><listitem>list item content</para></listitem> + +<LocalLeader>f fold the tag under the cursor {{{2 + <para> + line 1 + line 2 + line 3 + </para> + \f produces + +-- 5 lines: <para>-------------------------- + + +<LocalLeader>F all tags of name 'tag' will be fold. {{{2 + - If there isn't a tag under + the cursor you will be asked for one. + +<LocalLeader>g Format (Vim's gq function) {{{2 + - will make a visual block of tag under cursor and then format using gq + + +<LocalLeader>G Format all tags under cursor (Vim's gq function) {{{2 + - If there isn't a tag under + the cursor you will be asked for one. + + +<LocalLeader>I Indent all tags {{{2 + - will create a multiline layout every opening tag will be shifted out + and every closing tag will be shifted in. Be aware that the rendering + of the XML through XSLT and/or DSSSL, might be changed by this. + Be aware tha if the file is big, more than 1000 lines, the reformatting + takes a long time because vim has to make a big undo buffer. + For example using \I on the example below: + + <chapter><title>Indent</title><para>The documentation</para></chapter> + + - Becomes + + <chapter> + <title> + Indent + </title> + <para> + The documentation + </para> + </chapter> + + +<LocalLeader>j Joins two the SAME sections together. {{{2 + - The sections must be next to each other. + <para> This is line 1 + of a paragraph. </para> + <para> This is line 2 + | + of a paragraph. </para> + \j produces + <para> This is line 1 + of a paragraph. + This is line 2 + of a paragraph. </para> + +<LocalLeader>l visual surround the block with listitem and para {{{2 + When marking up docbook tekst you have the issue that listitems + consist of 2 item. This key combination inserts them both, + + blaah + | + \l produces + <listitem> + <para>blaah</para> + </listitem> + +<LocalLeader>o Insert a tag inside the current one (like vim o) {{{2 + You are asked for tag and attributes. + + <tag1><tag2><tag3>blaah</tag3></tag2></tag1> + | + \o produces + <tag1> + <aftertag><tag2><tag3>blaah</tag3></tag2></aftertag> + </tag1> + +<LocalLeader>O Insert a tag outside the current one (like vim O) {{{2 + You are asked for tag and attributes. + <tag1><tag2><tag3>blaah</tag3></tag2></tag1> + | + \O produces + <beforetag> + <tag1><tag2><tag3>blaah</tag3></tag2></tag1> + </beforetag> + +<LocalLeader>s Insert an opening tag for an closing tag. {{{2 + list item content</para></listitem> + | + pressing \s twice produces + <para><listitem>list item content</para></listitem> + +<LocalLeader>[ Delete <![CDATA[ ]]> delimiters {{{2 + Removes Only <CDATA[ and ]]> + handy when you want to uncomment a section. + You need to stand in the tag and not on an other tag + <![CDATA[ <tag> ]]> + if you cursor is outside <tag> but inside the + CDATA tag the delition works. +<LocalLeader>{ Delete <![CDATA[ ]]> section {{{2 + Removes everything tag and Content +<LocalLeader>] Delete <!-- --> delimiters {{{2 + Uncommnet a block. +<LocalLeader>} Delete <!-- --> section {{{2 + Removes everything tag and Content +<LocalLeader>> shift right opening tag and closing tag. {{{2 + shift everything between the tags 1 shiftwide right +<LocalLeader>< shift left opening tag and closing tag. {{{2 + shift everything between the tags 1 shiftwide left +<LocalLeader>c Visual Place a CDATA section around the selected text. {{{2 + Place Cdata section around the block +<LocalLeader>< Visual Place a Comment around the selected text. {{{2 + Place comment around the block +<LocalLeader>5 Extend the visual selection to the matching tag. {{{2 +<LocalLeader>% + Extend the visual selection to the matching tag. Make sure you are at + the start of the opening tag or the end of the closing tag. +<LocalLeader>v Visual Place a tag around the selected text. {{{2 + - You are asked for tag and attributes. You + need to have selected text in visual mode before you can use this + mapping. See |visual-mode| for details. + Be careful where you place the marks. + The top uses append + The bottom uses append + Useful when marking up a text file + +------------------------------------------------------------------------------ + *xml-plugin-callbacks* + +------------------------------------------------------------------------------ + *xml-plugin-callbacks* + +Callback Functions {{{2 ~ + +A callback function is a function used to customize features on a per tag +basis. For example say you wish to have a default set of attributs when you +type an empty tag like this: + You type: <tag> + You get: <tag default="attributes"></tag> + +This is for any script programmers who wish to add xml-plugin support to +there own filetype plugins. + +Callback functions recive one attribute variable which is the tag name. The +all must return either a string or the number zero. If it returns a string +the plugin will place the string in the proper location. If it is a zero the +plugin will ignore and continue as if no callback existed. + +The following are implemented callback functions: + +HtmlAttribCallback + This is used to add default attributes to html tag. It is intended + for HTML files only. + +XmlAttribCallback + This is a generic callback for xml tags intended to add attributes. + + *xml-plugin-html* +Callback Example {{{2 ~ + +The following is an example of using XmlAttribCallback in your .vimrc +> + function XmlAttribCallback (xml_tag) + if a:xml_tag ==? "my-xml-tag" + return "attributes=\"my xml attributes\"" + else + return 0 + endif + endfunction +< +The following is a sample html.vim file type plugin you could use: +> + " Vim script file vim600:fdm=marker: + " FileType: HTML + " Maintainer: Devin Weaver <vim (at) tritarget.com> + " Location: http://www.vim.org/scripts/script.php?script_id=301 + + " This is a wrapper script to add extra html support to xml documents. + " Original script can be seen in xml-plugin documentation. + + " Only do this when not done yet for this buffer + if exists("b:did_ftplugin") + finish + endif + " Don't set 'b:did_ftplugin = 1' because that is xml.vim's responsability. + + let b:html_mode = 1 + + if !exists("*HtmlAttribCallback") + function HtmlAttribCallback( xml_tag ) + if a:xml_tag ==? "table" + return "cellpadding=\"0\" cellspacing=\"0\" border=\"0\"" + elseif a:xml_tag ==? "link" + return "href=\"/site.css\" rel=\"StyleSheet\" type=\"text/css\"" + elseif a:xml_tag ==? "body" + return "bgcolor=\"white\"" + elseif a:xml_tag ==? "frame" + return "name=\"NAME\" src=\"/\" scrolling=\"auto\" noresize" + elseif a:xml_tag ==? "frameset" + return "rows=\"0,*\" cols=\"*,0\" border=\"0\"" + elseif a:xml_tag ==? "img" + return "src=\"\" width=\"0\" height=\"0\" border=\"0\" alt=\"\"" + elseif a:xml_tag ==? "a" + if has("browse") + " Look up a file to fill the href. Used in local relative file + " links. typeing your own href before closing the tag with `>' + " will override this. + let cwd = getcwd() + let cwd = substitute (cwd, "\\", "/", "g") + let href = browse (0, "Link to href...", getcwd(), "") + let href = substitute (href, cwd . "/", "", "") + let href = substitute (href, " ", "%20", "g") + else + let href = "" + endif + return "href=\"" . href . "\"" + else + return 0 + endif + endfunction + endif + + " On to loading xml.vim + runtime ftplugin/xml.vim +< +=== END_DOC +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" v im:tw=78:ts=8:ft=help:norl: +" vim600: set foldmethod=marker tabstop=8 shiftwidth=2 softtabstop=2 smartindent smarttab : +"fileencoding=iso-8859-15 +=== END_DOC +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + + + + + +" Vim settingѕ {{{1 +" vim:tw=78:ts=2:ft=help:norl: +" vim: set foldmethod=marker tabstop=2 shiftwidth=2 softtabstop=2 smartindent smarttab : +"fileencoding=utf-8 + diff --git a/vimfiles/plugin/DirDiff.vim b/vimfiles/plugin/DirDiff.vim new file mode 100644 index 0000000..2b77a69 --- /dev/null +++ b/vimfiles/plugin/DirDiff.vim @@ -0,0 +1,1075 @@ +" -*- vim -*- +" FILE: "C:\Documents and Settings\William Lee\vimfiles\plugin\DirDiff.vim" {{{ +" LAST MODIFICATION: "Wed, 22 Feb 2006 22:31:59 Central Standard Time" +" HEADER MAINTAINED BY: N/A +" VERSION: 1.1.1 +" (C) 2001-2006 by William Lee, <wl1012@yahoo.com> +" }}} + + +" PURPOSE: {{{ +" - Diffing a directory recursively and enable easy merging, copying and +" deleting of files and directories. +" +" REQUIREMENTS: +" - Make sure you have GNU diff in your path on Unix and Windows. I only +" tested this on cygwin's version on Windows. If you have a diff that +" doesn't support -x or -I flag, do not set variable g:DirDiffExcludes and +" g:DirDiffIgnore to "". It should still work. +" - On Windows, you need to have "xcopy", "copy", "del", and "rd" in your +" path. +" - On Unix, you need to have "rm" and "cp" in your path. +" +" USAGE: +" Put this file in your ~/.vim/plugin +" +" Doing the following will generate a diff window. +" +" :DirDiff <A:Src Directory> <B:Src Directory> +" e.g. +" :DirDiff ../something/dir1 /usr/bin/somethingelse/dir2 +" +" The following commands can be used inside the diff window: +" 'Enter','o' - Diff open: open the diff file(s) where your cursor is at +" 's' - Synchronize the current diff. You can also select +" a range (through visual) and press 's' to synchronize differences +" across a range. +" +" - There are 6 Options you can choose when you hit 's': +" 1. A -> B +" Copy A to overwrite B +" If A's file actually points to a directory, it'll copy it to B +" recursively. +" 2. B -> A +" Copy B to overwrite A +" If B's file actually points to a directory, it'll copy it to A +" recursively. +" 3. Always A +" For the rest of the items that you've selected, +" synchronize like (1). +" 4. Always B +" For the rest of the items that you've selected, +" synchronize like (2). +" 5. Skip +" Skip this diff entry. +" 6. Cancel +" Quit the loop and exit. +" +" 'u' - Diff update: update the diff window +" 'x' - Sets the exclude pattern, separated by ',' +" 'i' - Sets the ignore pattern, separated by ',' +" 'a' - Sets additional arguments for diff, eg. -w to ignore white space, +" etc. +" 'q' - Quit DirDiff +" +" The following comamnds can be used in the Vim diff mode +" \dg - Diff get: maps to :diffget<CR> +" \dp - Diff put: maps to :diffput<CR> +" \dj - Diff next: (think j for down) +" \dk - Diff previous: (think k for up) +" +" You can set the following DirDiff variables. You can add the following +" "let" lines in your .vimrc file. +" +" Sets diff command: +" let g:DirDiffCommand = $VIMRUNTIME . "diff" +" +" Sets default exclude pattern: +" let g:DirDiffExcludes = "CVS,*.class,*.exe,.*.swp" +" +" Sets default ignore pattern: +" let g:DirDiffIgnore = "Id:,Revision:,Date:" +" +" If DirDiffSort is set to 1, sorts the diff lines. +" let g:DirDiffSort = 1 +" +" Sets the diff window (bottom window) height (rows) +" let g:DirDiffWindowSize = 14 +" +" Ignore case during diff +" let g:DirDiffIgnoreCase = 0 +" +" Dynamically figure out the diff text. If you are using and i18n version +" of diff, this will try to get the specific diff text during runtime. It's +" turned off by default. If you are always targetting a specific version of +" diff, you can turn this off and set the DirDiffText* variables +" accordingly. +" let g:DirDiffDynamicDiffText = 0 +" +" String used for the English equivalent "Files " +" let g:DirDiffTextFiles = "Files " + +" String used for the English equivalent " and " +" let g:DirDiffTextAnd = " and " +" +" String used for the English equivalent " differ") +" let g:DirDiffTextDiffer = " differ" +" +" String used for the English equivalent "Only in ") +" let g:DirDiffTextOnlyIn = "Only in " +" +" NOTES: +" This script can copy and remove your files. This can be powerful (or too +" powerful) at times. Please do not blame me if you use this and +" disintegrate your hard work. Be warned! +" +" CREDITS: +" +" Please mail any comment/suggestion/patch to +" William Lee <wl1012@yahoo.com> +" +" LICENSE: +" Copyright (c) 2001-2006 William Lee +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions are +" met: +" +" * Redistributions of source code must retain the above copyright +" notice, this list of conditions and the following disclaimer. +" * Redistributions in binary form must reproduce the above copyright +" notice, this list of conditions and the following disclaimer in the +" documentation and/or other materials provided with the distribution. +" * Neither the name William Lee nor the names of its contributors may be +" used to endorse or promote products derived from this software without +" specific prior written permission. +" +" THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +" WILLIAM LEE AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +" +" THANKS: +" +" Florian Delizy for the i18n diff patch +" Robert Webb for his sorting function +" Salman Halim, Yosuke Kimura, and others for their suggestions +" +" HISTORY: +" 1.1.1 - Added support for custom diff-command +" 1.1.0 - Added support for i18n (tested on a French version for now only). +" Can dynamically figure out the diff strings output by diff. +" 1.0.2 - Fixed a small typo bug in the quit function. +" 1.0.1 - Ensure the path separator is correct when running in W2K +" 1.0 - Fixed a bug that flags errors if the user use the nowrapscan option. +" Implements a quit function that exit the diff windows. +" 0.94 - Fixed a bug where the diff will give incorrect A and B file due to +" similarity of directory names. Allow you to modify the diff +" argument. +" 0.93 - Opps, messed up the key mapping usage. +" 0.92 - Doesn't use n and p mappings since it confuses the search next key +" mapping and causes some bugs. Minor modification to change the +" exclude and ignore pattern. +" 0.91 - Clean up delete routine. +" - Added interactive mode. +" - Added multiple entries of exclude and ignore pattern. +" - Custom configuration through global variables. +" - Change exclude and ignore patterns on the fly. +" +" 0.9 - Reorganization of the interface. Much simplier dialog for +" synchronization. Support for range synchronization option (REALLY +" powerful) +" - Removed unnecessary key bindings. All key bindings are local to +" the diff window. (except for the \dg and \dp) +" +" 0.8 - Added syntax highlighting. +" - Enter and double-click in buffer opens diff. +" - Removed dependency on "sort" +" - Removed usage of registry and marker +" - Code cleanup and some bug fixes +" - On Windows the diff command will use the -i flag instead +" - Changed mappings for diff next (\dj) and diff previous (\dk) +" - Added mappings for vim diff mode (\dg, \dp) +" +" 0.7 Initial Release +" +" }}} + +" Public Interface: +command! -nargs=* -complete=dir DirDiff call <SID>DirDiff (<f-args>) +command! -nargs=0 DirDiffOpen call <SID>DirDiffOpen () +command! -nargs=0 DirDiffNext call <SID>DirDiffNext () +command! -nargs=0 DirDiffPrev call <SID>DirDiffPrev () +command! -nargs=0 DirDiffUpdate call <SID>DirDiffUpdate () +command! -nargs=0 DirDiffQuit call <SID>DirDiffQuit () + +if !hasmapto('<Plug>DirDiffGet') + map <unique> <Leader>dg <Plug>DirDiffGet +endif +if !hasmapto('<Plug>DirDiffPut') + map <unique> <Leader>dp <Plug>DirDiffPut +endif +if !hasmapto('<Plug>DirDiffNext') + map <unique> <Leader>dj <Plug>DirDiffNext +endif +if !hasmapto('<Plug>DirDiffPrev') + map <unique> <Leader>dk <Plug>DirDiffPrev +endif + +" Global Maps: +map <unique> <script> <Plug>DirDiffGet :diffget<CR> +map <unique> <script> <Plug>DirDiffPut :diffput<CR> +map <unique> <script> <Plug>DirDiffNext :call <SID>DirDiffNext()<CR> +map <unique> <script> <Plug>DirDiffPrev :call <SID>DirDiffPrev()<CR> +map <unique> <script> <Plug>DirDiffQuit :call <SID>DirDiffQuit()<CR> + +" Default Variables. You can override these in your global variables +" settings. +" +" For DirDiffExcludes and DirDiffIgnore, separate different patterns with a +" ',' (comma and no space!). +" +" eg. in your .vimrc file: let g:DirDiffExcludes = "CVS,*.class,*.o" +" let g:DirDiffIgnore = "Id:" +" " ignore white space in diff +" let g:DirDiffAddArgs = "-w" +" +" You can set the diff command. Defaults to 'diff' +if !exists("g:DirDiffCommand") + let g:DirDiffCommand = "diff" +endif +" You can set the pattern that diff excludes. Defaults to the CVS directory +if !exists("g:DirDiffExcludes") + let g:DirDiffExcludes = "" +endif +" This is the -I argument of the diff, ignore the lines of differences that +" matches the pattern +if !exists("g:DirDiffIgnore") + let g:DirDiffIgnore = "" +endif +if !exists("g:DirDiffSort") + let g:DirDiffSort = 1 +endif +if !exists("g:DirDiffWindowSize") + let g:DirDiffWindowSize = 14 +endif +if !exists("g:DirDiffInteractive") + let g:DirDiffInteractive = 0 +endif +if !exists("g:DirDiffIgnoreCase") + let g:DirDiffIgnoreCase = 0 +endif +" Additional arguments +if !exists("g:DirDiffAddArgs") + let g:DirDiffAddArgs = "" +endif +" Support for i18n (dynamically figure out the diff text) +" Defaults to off +if !exists("g:DirDiffDynamicDiffText") + let g:DirDiffDynamicDiffText = 0 +endif + +" String used for the English equivalent "Files " +if !exists("g:DirDiffTextFiles") + let g:DirDiffTextFiles = "Files " +endif + +" String used for the English equivalent " and " +if !exists("g:DirDiffTextAnd") + let g:DirDiffTextAnd = " and " +endif + +" String used for the English equivalent " differ") +if !exists("g:DirDiffTextDiffer") + let g:DirDiffTextDiffer = " differ" +endif + +" String used for the English equivalent "Only in ") +if !exists("g:DirDiffTextOnlyIn") + let g:DirDiffTextOnlyIn = "Only in " +endif + +" Set some script specific variables: +" +let s:DirDiffFirstDiffLine = 6 +let s:DirDiffALine = 1 +let s:DirDiffBLine = 2 + +" -- Variables used in various utilities +if has("unix") + let s:DirDiffCopyCmd = "cp" + let s:DirDiffCopyFlags = "" + let s:DirDiffCopyDirCmd = "cp" + let s:DirDiffCopyDirFlags = "-rf" + let s:DirDiffCopyInteractiveFlag = "-i" + + let s:DirDiffDeleteCmd = "rm" + let s:DirDiffDeleteFlags = "" + let s:DirDiffDeleteInteractiveFlag = "-i" + + let s:DirDiffDeleteDirCmd = "rm" + let s:DirDiffDeleteDirFlags = "-rf" + + let s:sep = "/" + + let s:DirDiffMakeDirCmd = "!mkdir " + +elseif has("win32") + let s:DirDiffCopyCmd = "copy" + let s:DirDiffCopyFlags = "" + let s:DirDiffCopyDirCmd = "xcopy" + let s:DirDiffCopyDirFlags = "/e /i /q" + let s:DirDiffCopyInteractiveFlag = "/-y" + + let s:DirDiffDeleteCmd = "del" + let s:DirDiffDeleteFlags = "/s /q" + let s:DirDiffDeleteInteractiveFlag = "/p" + " Windows is somewhat stupid since "del" can only remove the files, not + " the directory. The command "rd" would remove files recursively, but it + " doesn't really work on a file (!). where is the deltree command??? + + let s:DirDiffDeleteDirCmd = "rd" + " rd is by default prompting, we need to handle this in a different way + let s:DirDiffDeleteDirFlags = "/s" + let s:DirDiffDeleteDirQuietFlag = "/q" + + let s:sep = "\\" + + let s:DirDiffMakeDirCmd = "!mkdir " +else + " Platforms not supported + let s:DirDiffCopyCmd = "" + let s:DirDiffCopyFlags = "" + let s:DirDiffDeleteCmd = "" + let s:DirDiffDeleteFlags = "" + let s:sep = "" +endif + + +function! <SID>DirDiff(srcA, srcB) + " Setup + let DirDiffAbsSrcA = fnamemodify(expand(a:srcA, ":p"), ":p") + let DirDiffAbsSrcB = fnamemodify(expand(a:srcB, ":p"), ":p") + + " Check for an internationalized version of diff ? + call <SID>GetDiffStrings() + + " Remove the trailing \ or / + let DirDiffAbsSrcA = substitute(DirDiffAbsSrcA, '\\$\|/$', '', '') + let DirDiffAbsSrcB = substitute(DirDiffAbsSrcB, '\\$\|/$', '', '') + + let DiffBuffer = tempname() + " We first write to that file + " Constructs the command line + let cmd = "!".g:DirDiffCommand + let cmdarg = " -r --brief" + + " If variable is set, we ignore the case + if (g:DirDiffIgnoreCase) + let cmdarg = cmdarg." -i" + endif + if (g:DirDiffAddArgs != "") + let cmdarg = cmdarg." ".g:DirDiffAddArgs." " + endif + if (g:DirDiffExcludes != "") + let cmdarg = cmdarg.' -x"'.substitute(g:DirDiffExcludes, ',', '" -x"', 'g').'"' + endif + if (g:DirDiffIgnore != "") + let cmdarg = cmdarg.' -I"'.substitute(g:DirDiffIgnore, ',', '" -I"', 'g').'"' + endif + " Prompt the user for additional arguments +" let addarg = input("Additional diff args (current =". cmdarg. "): ") + let addarg = "" + let cmd = cmd.cmdarg." ".addarg." \"".DirDiffAbsSrcA."\" \"".DirDiffAbsSrcB."\"" + let cmd = cmd." > \"".DiffBuffer."\"" + + echo "Diffing directories, it may take a while..." + let error = <SID>DirDiffExec(cmd, 0) + if (error == 0) + echo "There is no diff here." + return + endif + silent exe "edit ".DiffBuffer + echo "Defining [A] and [B] ... " + " We then do a substitution on the directory path + " We need to do substitution of the the LONGER string first, otherwise + " it'll mix up the A and B directory + if (strlen(DirDiffAbsSrcA) > strlen(DirDiffAbsSrcB)) + silent! exe "%s/".<SID>EscapeDirForRegex(DirDiffAbsSrcA)."/[A]/" + silent! exe "%s/".<SID>EscapeDirForRegex(DirDiffAbsSrcB)."/[B]/" + else + silent! exe "%s/".<SID>EscapeDirForRegex(DirDiffAbsSrcB)."/[B]/" + silent! exe "%s/".<SID>EscapeDirForRegex(DirDiffAbsSrcA)."/[A]/" + endif + " In windows, diff behaves somewhat weirdly, for the appened path it'll + " use "/" instead of "\". Convert this to \ + if (has("win32")) + silent! %s/\//\\/g + endif + + echo "Sorting entries ..." + " We then sort the lines if the option is set + if (g:DirDiffSort == 1) + 1,$call <SID>Sort("s:Strcmp") + endif + + " Put in spacer in front of each line + silent! %s/^/ / + + " We then put the file [A] and [B] on top of the diff lines + call append(0, "[A]=". DirDiffAbsSrcA) + call append(1, "[B]=". DirDiffAbsSrcB) + call append(2, "Usage: <Enter>/'o'=open,'s'=sync,'\\dj'=next,'\\dk'=prev, 'q'=quit") + call append(3, "Options: 'u'=update,'x'=set excludes,'i'=set ignore,'a'=set args" ) + call append(4, "Diff Args:" . cmdarg) + call append(5, "") + " go to the beginning of the file + 0 + setlocal nomodified + setlocal nomodifiable + setlocal buftype=nowrite + setlocal bufhidden=delete + setlocal nowrap + + " Set up local key bindings + " 'n' actually messes with the search next pattern, I think using \dj and + " \dk is enough. Otherwise, use j,k, and enter. +" nnoremap <buffer> n :call <SID>DirDiffNext()<CR> +" nnoremap <buffer> p :call <SID>DirDiffPrev()<CR> + nnoremap <buffer> s :. call <SID>DirDiffSync()<CR> + vnoremap <buffer> s :call <SID>DirDiffSync()<CR> + nnoremap <buffer> u :call <SID>DirDiffUpdate()<CR> + nnoremap <buffer> x :call <SID>ChangeExcludes()<CR> + nnoremap <buffer> a :call <SID>ChangeArguments()<CR> + nnoremap <buffer> i :call <SID>ChangeIgnore()<CR> + nnoremap <buffer> q :call <SID>DirDiffQuit()<CR> + + nnoremap <buffer> o :call <SID>DirDiffOpen()<CR> + nnoremap <buffer> <CR> :call <SID>DirDiffOpen()<CR> + nnoremap <buffer> <2-Leftmouse> :call <SID>DirDiffOpen()<CR> + call <SID>SetupSyntax() + + " Open the first diff + call <SID>DirDiffNext() +endfunction + +" Set up syntax highlighing for the diff window +function! <SID>SetupSyntax() + if has("syntax") && exists("g:syntax_on") + "&& !has("syntax_items") + syn match DirDiffSrcA "\[A\]" + syn match DirDiffSrcB "\[B\]" + syn match DirDiffUsage "^Usage.*" + syn match DirDiffOptions "^Options.*" + exec 'syn match DirDiffFiles "' . s:DirDiffDifferLine .'"' + exec 'syn match DirDiffOnly "' . s:DirDiffDiffOnlyLine . '"' + syn match DirDiffSelected "^==>.*" contains=DirDiffSrcA,DirDiffSrcB + + hi def link DirDiffSrcA Directory + hi def link DirDiffSrcB Type + hi def link DirDiffUsage Special + hi def link DirDiffOptions Special + hi def link DirDiffFiles String + hi def link DirDiffOnly PreProc + hi def link DirDiffSelected DiffChange + endif +endfunction + +" You should call this within the diff window +function! <SID>DirDiffUpdate() + let dirA = <SID>GetBaseDir("A") + let dirB = <SID>GetBaseDir("B") + call <SID>DirDiff(dirA, dirB) +endfun + +" Quit the DirDiff mode +function! <SID>DirDiffQuit() + let in = confirm ("Are you sure you want to quit DirDiff?", "&Yes\n&No", 2) + if (in == 1) + call <SID>CloseDiffWindows() + bd! + endif +endfun + +" Returns an escaped version of the path for regex uses +function! <SID>EscapeDirForRegex(path) + " This list is probably not complete, modify later + return escape(a:path, "/\\[]$^~") +endfunction + +" Close the opened diff comparison windows if they exist +function! <SID>CloseDiffWindows() + if (<SID>AreDiffWinsOpened()) + wincmd k + " Ask the user to save if buffer is modified + call <SID>AskIfModified() + bd! + " User may just have one window opened, we may not need to close + " the second diff window + if (&diff) + call <SID>AskIfModified() + bd! + endif + endif +endfunction + + +function! <SID>DirDiffOpen() + " First dehighlight the last marked + call <SID>DeHighlightLine() + + " Mark the current location of the line + "mark n + let b:currentDiff = line(".") + + " We first parse back the [A] and [B] directories from the top of the line + let dirA = <SID>GetBaseDir("A") + let dirB = <SID>GetBaseDir("B") + + call <SID>CloseDiffWindows() + + let line = getline(".") + " Parse the line and see whether it's a "Only in" or "Files Differ" + call <SID>HighlightLine() + let fileA = <SID>GetFileNameFromLine("A", line) + let fileB = <SID>GetFileNameFromLine("B", line) + if <SID>IsOnly(line) + " We open the file + let fileSrc = <SID>ParseOnlySrc(line) + if (fileSrc == "A") + let fileToOpen = fileA + elseif (fileSrc == "B") + let fileToOpen = fileB + endif + split + wincmd k + silent exec "edit ".fileToOpen + " Fool the window saying that this is diff + diffthis + wincmd j + " Resize the window + exe("resize " . g:DirDiffWindowSize) + exe (b:currentDiff) + elseif <SID>IsDiffer(line) + "Open the diff windows + split + wincmd k + silent exec "edit ".fileB + silent exec "vert diffsplit ".fileA + " Go back to the diff window + wincmd j + " Resize the window + exe("resize " . g:DirDiffWindowSize) + exe (b:currentDiff) + " Center the line + exe ("normal z.") + else + echo "There is no diff at the current line!" + endif +endfunction + +" Ask the user to save if the buffer is modified +" +function! <SID>AskIfModified() + if (&modified) + let input = confirm("File " . expand("%:p") . " has been modified.", "&Save\nCa&ncel", 1) + if (input == 1) + w! + endif + endif +endfunction + +function! <SID>HighlightLine() + let savedLine = line(".") + exe (b:currentDiff) + setlocal modifiable + let line = getline(".") + if (match(line, "^ ") == 0) + s/^ /==> / + endif + setlocal nomodifiable + setlocal nomodified + exe (savedLine) + redraw +endfunction + +function! <SID>DeHighlightLine() + let savedLine = line(".") + exe (b:currentDiff) + let line = getline(".") + setlocal modifiable + if (match(line, "^==> ") == 0) + s/^==> / / + endif + setlocal nomodifiable + setlocal nomodified + exe (savedLine) + redraw +endfunction + +" Returns the directory for buffer "A" or "B". You need to be in the diff +" buffer though. +function! <SID>GetBaseDir(diffName) + let currLine = line(".") + if (a:diffName == "A") + let baseLine = s:DirDiffALine + else + let baseLine = s:DirDiffBLine + endif + let regex = '\['.a:diffName.'\]=\(.*\)' + let line = getline(baseLine) + let rtn = substitute(line, regex , '\1', '') + return rtn +endfunction + +function! <SID>DirDiffNext() + " If the current window is a diff, go down one + if (&diff == 1) + wincmd j + endif + " if the current line is <= 6, (within the header range), we go to the + " first diff line open it + if (line(".") < s:DirDiffFirstDiffLine) + exe (s:DirDiffFirstDiffLine) + let b:currentDiff = line(".") + endif + silent! exe (b:currentDiff + 1) + call <SID>DirDiffOpen() +endfunction + +function! <SID>DirDiffPrev() + " If the current window is a diff, go down one + if (&diff == 1) + wincmd j + endif + silent! exe (b:currentDiff - 1) + call <SID>DirDiffOpen() +endfunction + +" For each line, we can perform a recursive copy or delete to sync up the +" difference. Returns non-zero if the operation is NOT successful, returns 0 +" if everything is fine. +" +function! <SID>DirDiffSyncHelper(AB, line) + let fileA = <SID>GetFileNameFromLine("A", a:line) + let fileB = <SID>GetFileNameFromLine("B", a:line) +" echo "Helper line is ". a:line. " fileA " . fileA . " fileB " . fileB + if <SID>IsOnly(a:line) + " If a:AB is "A" and the ParseOnlySrc returns "A", that means we need to + " copy + let fileSrc = <SID>ParseOnlySrc(a:line) + let operation = "" + if (a:AB == "A" && fileSrc == "A") + let operation = "Copy" + " Use A, and A has source, thus copy the file from A to B + let fileFrom = fileA + let fileTo = fileB + elseif (a:AB == "A" && fileSrc == "B") + let operation = "Delete" + " Use A, but B has source, thus delete the file from B + let fileFrom = fileB + let fileTo = fileA + elseif (a:AB == "B" && fileSrc == "A") + let operation = "Delete" + " Use B, but the source file is A, thus removing A + let fileFrom = fileA + let fileTo = fileB + elseif (a:AB == "B" && fileSrc == "B") + " Use B, and B has the source file, thus copy B to A + let operation = "Copy" + let fileFrom = fileB + let fileTo = fileA + endif + elseif <SID>IsDiffer(a:line) + " Copy no matter what + let operation = "Copy" + if (a:AB == "A") + let fileFrom = fileA + let fileTo = fileB + elseif (a:AB == "B") + let fileFrom = fileB + let fileTo = fileA + endif + else + echo "There is no diff here!" + " Error + return 1 + endif + if (operation == "Copy") + let rtnCode = <SID>Copy(fileFrom, fileTo) + elseif (operation == "Delete") + let rtnCode = <SID>Delete(fileFrom) + endif + return rtnCode +endfunction + +" Synchronize the range +function! <SID>DirDiffSync() range + let answer = 1 + let silence = 0 + let syncMaster = "A" + let currLine = a:firstline + let lastLine = a:lastline + let syncCount = 0 + + while ((currLine <= lastLine)) + " Update the highlight + call <SID>DeHighlightLine() + let b:currentDiff = currLine + call <SID>HighlightLine() + let line = getline(currLine) + if (!silence) + let answer = confirm(substitute(line, "^....", '', ''). "\nSynchronization option:" , "&A -> B\n&B -> A\nA&lways A\nAl&ways B\n&Skip\nCa&ncel", 6) + if (answer == 1 || answer == 3) + let syncMaster = "A" + endif + if (answer == 2 || answer == 4) + let syncMaster = "B" + endif + if (answer == 3 || answer == 4) + let silence = 1 + endif + if (answer == 5) + let currLine = currLine + 1 + continue + endif + if (answer == 6) + break + endif + endif + +" call <SID>DeHighlightLine() + let rtnCode = <SID>DirDiffSyncHelper(syncMaster, line) + if (rtnCode == 0) + " Successful + let syncCount = syncCount + 1 + " Assume that the line is synchronized, we delete the entry + setlocal modifiable + exe (currLine.",".currLine." delete") + setlocal nomodifiable + setlocal nomodified + let lastLine = lastLine - 1 + else + " Failed! + let currLine = currLine + 1 + endif + endwhile + echo syncCount . " diff item(s) synchronized." +endfunction + +" Return file "A" or "B" depending on the line given. If it's a Only line, +" either A or B does not exist, but the according value would be returned. +function! <SID>GetFileNameFromLine(AB, line) + " Determine where the source of the copy is. + let dirA = <SID>GetBaseDir("A") + let dirB = <SID>GetBaseDir("B") + + let fileToProcess = "" + + if <SID>IsOnly(a:line) + let fileToProcess = <SID>ParseOnlyFile(a:line) + elseif <SID>IsDiffer(a:line) + let regex = '^.*' . s:DirDiffDifferLine . '\[A\]\(.*\)' . s:DirDiffDifferAndLine . '\[B\]\(.*\)' . s:DirDiffDifferEndLine . '.*$' + let fileToProcess = substitute(a:line, regex, '\1', '') + else + endif + + "echo "line : " . a:line. "AB = " . a:AB . " File to Process " . fileToProcess + if (a:AB == "A") + return dirA . fileToProcess + elseif (a:AB == "B") + return dirB . fileToProcess + else + return "" + endif +endfunction + +"Returns the source (A or B) of the "Only" line +function! <SID>ParseOnlySrc(line) + return substitute(a:line, '^.*' . s:DirDiffDiffOnlyLine . '\[\(.\)\].*:.*', '\1', '') +endfunction + +function! <SID>ParseOnlyFile(line) + let regex = '^.*' . s:DirDiffDiffOnlyLine . '\[.\]\(.*\): \(.*\)' + let root = substitute(a:line, regex , '\1', '') + let file = root . s:sep . substitute(a:line, regex , '\2', '') + return file +endfunction + +function! <SID>Copy(fileFromOrig, fileToOrig) + let fileFrom = substitute(a:fileFromOrig, '/', s:sep, 'g') + let fileTo = substitute(a:fileToOrig, '/', s:sep, 'g') + echo "Copy from " . fileFrom . " to " . fileTo + if (s:DirDiffCopyCmd == "") + echo "Copy not supported on this platform" + return 1 + endif + + " Constructs the copy command + let copycmd = "!".s:DirDiffCopyCmd." ".s:DirDiffCopyFlags + " Append the interactive flag + if (g:DirDiffInteractive) + let copycmd = copycmd . " " . s:DirDiffCopyInteractiveFlag + endif + let copycmd = copycmd . " \"".fileFrom."\" \"".fileTo."\"" + + " Constructs the copy directory command + let copydircmd = "!".s:DirDiffCopyDirCmd." ".s:DirDiffCopyDirFlags + " Append the interactive flag + if (g:DirDiffInteractive) + let copydircmd = copydircmd . " " . s:DirDiffCopyInteractiveFlag + endif + let copydircmd = copydircmd . " \"".fileFrom."\" \"".fileTo."\"" + + let error = 0 + if (isdirectory(fileFrom)) + let error = <SID>DirDiffExec(copydircmd, g:DirDiffInteractive) + else + let error = <SID>DirDiffExec(copycmd, g:DirDiffInteractive) + endif + if (error != 0) + echo "Can't copy from " . fileFrom . " to " . fileTo + return 1 + endif + return 0 +endfunction + +" Would execute the command, either silent or not silent, by the +" interactive flag ([0|1]). Returns the v:shell_error after +" executing the command. +function! <SID>DirDiffExec(cmd, interactive) + let error = 0 + if (a:interactive) + exe (a:cmd) + let error = v:shell_error + else + silent exe (a:cmd) + let error = v:shell_error + endif +" let d = input("DirDiffExec: " . a:cmd . " " . a:interactive . " returns " . v:shell_error) + return error +endfunction + +" Delete the file or directory. Returns 0 if nothing goes wrong, error code +" otherwise. +function! <SID>Delete(fileFromOrig) + let fileFrom = substitute(a:fileFromOrig, '/', s:sep, 'g') + echo "Deleting from " . fileFrom + if (s:DirDiffDeleteCmd == "") + echo "Delete not supported on this platform" + return 1 + endif + + let delcmd = "" + + if (isdirectory(fileFrom)) + let delcmd = "!".s:DirDiffDeleteDirCmd." ".s:DirDiffDeleteDirFlags + if (g:DirDiffInteractive) + " If running on Unix, and we're running in interactive mode, we + " append the -i tag + if (has("unix")) + let delcmd = delcmd . " " . s:DirDiffDeleteInteractiveFlag + endif + else + " If running on windows, and we're not running in interactive + " mode, we append the quite flag to the "rd" command + if (has("win32")) + let delcmd = delcmd . " " . s:DirDiffDeleteDirQuietFlag + endif + endif + else + let delcmd = "!".s:DirDiffDeleteCmd." ".s:DirDiffDeleteFlags + if (g:DirDiffInteractive) + let delcmd = delcmd . " " . s:DirDiffDeleteInteractiveFlag + endif + endif + + let delcmd = delcmd ." \"".fileFrom."\"" + let error = <SID>DirDiffExec(delcmd, g:DirDiffInteractive) + if (error != 0) + echo "Can't delete " . fileFrom + endif + return error +endfunction + +function! <SID>AreDiffWinsOpened() + let currBuff = expand("%:p") + let currLine = line(".") + wincmd k + let abovedBuff = expand("%:p") + if (&diff) + let abovedIsDiff = 1 + else + let abovedIsDiff = 0 + endif + " Go Back if the aboved buffer is not the same + if (currBuff != abovedBuff) + wincmd j + " Go back to the same line + exe (currLine) + if (abovedIsDiff == 1) + return 1 + else + " Aboved is just a bogus buffer, not a diff buffer + return 0 + endif + else + exe (currLine) + return 0 + endif +endfunction + +" The given line begins with the "Only in" +function! <SID>IsOnly(line) + return (match(a:line, "^ *" . s:DirDiffDiffOnlyLine . "\\|^==> " . s:DirDiffDiffOnlyLine ) == 0) +endfunction + +" The given line begins with the "Files" +function! <SID>IsDiffer(line) + return (match(a:line, "^ *" . s:DirDiffDifferLine . "\\|^==> " . s:DirDiffDifferLine ) == 0) +endfunction + +" Let you modify the Exclude patthern +function! <SID>ChangeExcludes() + let g:DirDiffExcludes = input ("Exclude pattern (separate multiple patterns with ','): ", g:DirDiffExcludes) + echo "\nPress update ('u') to refresh the diff." +endfunction + +" Let you modify additional arguments for diff +function! <SID>ChangeArguments() + let g:DirDiffAddArgs = input ("Additional diff args: ", g:DirDiffAddArgs) + echo "\nPress update ('u') to refresh the diff." +endfunction + +" Let you modify the Ignore patthern +function! <SID>ChangeIgnore() + let g:DirDiffIgnore = input ("Ignore pattern (separate multiple patterns with ','): ", g:DirDiffIgnore) + echo "\nPress update ('u') to refresh the diff." +endfunction + +" Sorting functions from the Vim docs. Use this instead of the sort binary. +" +" Function for use with Sort(), to compare two strings. +func! <SID>Strcmp(str1, str2) + if (a:str1 < a:str2) + return -1 + elseif (a:str1 > a:str2) + return 1 + else + return 0 + endif +endfunction + +" Sort lines. SortR() is called recursively. +func! <SID>SortR(start, end, cmp) + if (a:start >= a:end) + return + endif + let partition = a:start - 1 + let middle = partition + let partStr = getline((a:start + a:end) / 2) + let i = a:start + while (i <= a:end) + let str = getline(i) + exec "let result = " . a:cmp . "(str, partStr)" + if (result <= 0) + " Need to put it before the partition. Swap lines i and partition. + let partition = partition + 1 + if (result == 0) + let middle = partition + endif + if (i != partition) + let str2 = getline(partition) + call setline(i, str2) + call setline(partition, str) + endif + endif + let i = i + 1 + endwhile + + " Now we have a pointer to the "middle" element, as far as partitioning + " goes, which could be anywhere before the partition. Make sure it is at + " the end of the partition. + if (middle != partition) + let str = getline(middle) + let str2 = getline(partition) + call setline(middle, str2) + call setline(partition, str) + endif + call <SID>SortR(a:start, partition - 1, a:cmp) + call <SID>SortR(partition + 1, a:end, a:cmp) +endfunc + +" To Sort a range of lines, pass the range to Sort() along with the name of a +" function that will compare two lines. +func! <SID>Sort(cmp) range + call <SID>SortR(a:firstline, a:lastline, a:cmp) +endfunc + +" Added to deal with internationalized version of diff, which returns a +" different string than "Files ... differ" or "Only in ... " + +function! <SID>GetDiffStrings() + " Check if we have the dynamic text string turned on. If not, just return + " what's set in the global variables + + if (g:DirDiffDynamicDiffText == 0) + let s:DirDiffDiffOnlyLine = g:DirDiffTextOnlyIn + let s:DirDiffDifferLine = g:DirDiffTextFiles + let s:DirDiffDifferAndLine = g:DirDiffTextAnd + let s:DirDiffDifferEndLine = g:DirDiffTextDiffer + return + endif + + let tmp1 = tempname() + let tmp2 = tempname() + let tmpdiff = tempname() + + " We need to pad the backslashes in order to make it match + let tmp1rx = <SID>EscapeDirForRegex(tmp1) + let tmp2rx = <SID>EscapeDirForRegex(tmp2) + let tmpdiffrx = <SID>EscapeDirForRegex(tmpdiff) + + silent exe s:DirDiffMakeDirCmd . "\"" . tmp1 . "\"" + silent exe s:DirDiffMakeDirCmd . "\"" . tmp2 . "\"" + silent exe "!echo test > \"" . tmp1 . s:sep . "test" . "\"" + silent exe "!diff -r --brief \"" . tmp1 . "\" \"" . tmp2 . "\" > \"" . tmpdiff . "\"" + + " Now get the result of that diff cmd + silent exe "split ". tmpdiff + "echo "First line: " . getline(1) + "echo "tmp1: " . tmp1 + "echo "tmp1rx: " . tmp1rx + let s:DirDiffDiffOnlyLine = substitute( getline(1), tmp1rx . ".*$", "", '') + "echo "DirDiff Only: " . s:DirDiffDiffOnlyLine + + q + + " Now let's get the Differ string + "echo "Getting the diff in GetDiffStrings" + + silent exe "!echo testdifferent > \"" . tmp2 . s:sep . "test" . "\"" + silent exe "!diff -r --brief \"" . tmp1 . "\" \"" . tmp2 . "\" > \"" . tmpdiff . "\"" + + silent exe "split ". tmpdiff + let s:DirDiffDifferLine = substitute( getline(1), tmp1rx . ".*$", "", '') + " Note that the diff on cygwin may output '/' instead of '\' for the + " separator, so we need to accomodate for both cases + let andrx = "^.*" . tmp1rx . "[\\\/]test\\(.*\\)" . tmp2rx . "[\\\/]test.*$" + let endrx = "^.*" . tmp1rx . "[\\\/]test.*" . tmp2rx . "[\\\/]test\\(.*$\\)" + "echo "andrx : " . andrx + "echo "endrx : " . endrx + let s:DirDiffDifferAndLine = substitute( getline(1), andrx , "\\1", '') + let s:DirDiffDifferEndLine = substitute( getline(1), endrx, "\\1", '') + + "echo "s:DirDiffDifferLine = " . s:DirDiffDifferLine + "echo "s:DirDiffDifferAndLine = " . s:DirDiffDifferAndLine + "echo "s:DirDiffDifferEndLine = " . s:DirDiffDifferEndLine + + q + + " Delete tmp files + "echo "Deleting tmp files." + + call <SID>Delete(tmp1) + call <SID>Delete(tmp2) + call <SID>Delete(tmpdiff) + +endfunction diff --git a/vimfiles/plugin/DoxygenToolkit.vim b/vimfiles/plugin/DoxygenToolkit.vim new file mode 100644 index 0000000..4cfdee7 --- /dev/null +++ b/vimfiles/plugin/DoxygenToolkit.vim @@ -0,0 +1,713 @@ +" DoxygenToolkit.vim +" Brief: Usefull tools for Doxygen (comment, author, license). +" Version: 0.1.16 +" Date: 02/27/07 +" Author: Mathias Lorente +" +" Note: Bug correction : function that returns null pointer are correctly +" documented (Thanks to Ronald WAHL for his report and patch). +" +" Note: Remove header and footer from doxygen documentation +" - Generated documentation with block header/footer activated (see +" parameters g:DoxygenToolkit_blockHeader and +" g:DoxygenToolkit_blockFooter) do not integrate header and footer +" anymore. +" Thanks to Justin RANDALL for this. +" Now comments are as following: +" /* --- My Header --- */ // --- My Header --- +" /** /// @brief ... +" * @brief ... or // --- My Footer --- +" */ +" /* -- My Footer --- */ +" +" Note: Changes to customize cinoptions +" - New option available for cinoptions : g:DoxygenToolkit_cinoptions +" (default value is still c1C1) +" Thanks to Arnaud GODET for this. Now comment can have the following +" look: +" /** /** +" * and not only * +" */ */ +" Note: Changes for linux kernel comment style +" - New option are available for brief tag and parameter tag ! Now there is +" a pre and a post tag for each of these tag. +" - You can define 'let g:DoxygenToolkit_briefTag_funcName = "yes"' to add +" the name of commented function between pre-brief tag and post-brief tag. +" - With these new features you can get something like: +" /** +" * @brief MyFunction - +" * +" * @param foo: +" * @param bar: +" */ +" Note: Changes suggested by Soh Kok Hong: +" - Fixed indentation in comments +" ( no more /** /** +" * but * +" */ */ ) +" Note: Changes made by Jason Mills: +" - Fixed \n bug which resulted in comments being screwed up +" - Added use of doxygen /// comments. +" Note: Changes made by Mathias Lorente on 05/25/04 +" - Fixed filename bug when including doxygen author comment whereas file +" has not been open directly on commamd line. +" - Now /// or /** doxygen comments are correctly integrated (except for +" license). +" Note: Changes made by Mathias Lorente on 08/02/04 +" - Now include only filename in author comment (no more folder...) +" - Fixed errors with function with no indentation. +" +" +" Actually five purposes have been defined : +" +" Generates a doxygen license comment. The tag text is configurable. +" +" Generates a doxygen author skeleton. The tag text is configurable. +" +" Generates a doxygen comment skeleton for a C, C++, or Java function or class, +" including @brief, @param (for each named argument), and @return. The tag +" text as well as a comment block header and footer are configurable. +" (Consequently, you can have \brief, etc. if you wish, with little effort.) +" +" Ignore code fragment placed in a block defined by #ifdef ... #endif. The +" block name must be given to the function. All of the corresponding blocks +" in all the file will be treated and placed in a new block DOX_SKIP_BLOCK (or +" any other name that you have configured). Then you have to update +" PREDEFINED value in your doxygen configuration file with correct block name. +" You also have to set ENABLE_PREPROCESSING to YES. +" +" Generate a doxygen group (begining and ending). The tag text is +" configurable. +" +" Use: +" - Type of comments ( /// or /** ... */ ) : +" In vim, default comments are : /** ... */. But if you prefer to use /// +" Doxygen comments just add 'let g:DoxygenToolkit_commentType = "C++"' +" (without quotes) in your .vimrc file +" +" - License : +" In vim, place the cursor on the line that will follow doxygen license +" comment. Then, execute the command :DoxLic. This will generate license +" comment and leave the cursor on the line just after. +" +" - Author : +" In vim, place the cursor on the line that will follow doxygen author +" comment. Then, execute the command :DoxAuthor. This will generate the +" skeleton and leave the cursor just after @author tag if no variable +" define it, or just after the skeleton. +" +" - Function / class comment : +" In vim, place the cursor on the line of the function header (or returned +" value of the function) or the class. Then execute the command :Dox. This +" will generate the skeleton and leave the cursor after the @brief tag. +" +" - Ignore code fragment : +" In vim, if you want to ignore all code fragment placed in a block such as : +" #ifdef DEBUG +" ... +" #endif +" You only have to execute the command :DoxUndoc(DEBUG) ! +" +" - Group : +" In vim, execute the command :DoxBlock to insert a doxygen block on the +" following line. +" +" Limitations: +" - Assumes that the function name (and the following opening parenthesis) is +" at least on the third line after current cursor position. +" - Not able to update a comment block after it's been written. +" - Blocks delimiters (header and footer) are only included for function +" comment. +" - Assumes that cindent is used. +" +" +" Example: +" Given: +" int +" foo(char mychar, +" int myint, +" double* myarray, +" int mask = DEFAULT) +" { //... +" } +" +" Issuing the :Dox command with the cursor on the function declaration would +" generate +" +" /** +" * @brief +" * +" * @param mychar +" * @param myint +" * @param myarray +" * @param mask +" * +" * @return +" */ +" +" +" To customize the output of the script, see the g:DoxygenToolkit_* +" variables in the script's source. These variables can be set in your +" .vimrc. +" +" For example, my .vimrc contains: +" let g:DoxygenToolkit_briefTag_pre="@Synopsis " +" let g:DoxygenToolkit_paramTag_pre="@Param " +" let g:DoxygenToolkit_returnTag="@Returns " +" let g:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------" +" let g:DoxygenToolkit_blockFooter="----------------------------------------------------------------------------" +" let g:DoxygenToolkit_authorName="Mathias Lorente" +" let g:DoxygenToolkit_licenseTag="My own license\<enter>" <-- Do not forget +" ending "\<enter>" + + +" Verify if already loaded +if exists("loaded_DoxygenToolkit") + "echo 'DoxygenToolkit Already Loaded.' + finish +endif +let loaded_DoxygenToolkit = 1 +"echo 'Loading DoxygenToolkit...' +let s:licenseTag = "Copyright (C) \<enter>" +let s:licenseTag = s:licenseTag . "This program is free software; you can redistribute it and/or\<enter>" +let s:licenseTag = s:licenseTag . "modify it under the terms of the GNU General Public License\<enter>" +let s:licenseTag = s:licenseTag . "as published by the Free Software Foundation; either version 2\<enter>" +let s:licenseTag = s:licenseTag . "of the License, or (at your option) any later version.\<enter>\<enter>" +let s:licenseTag = s:licenseTag . "This program is distributed in the hope that it will be useful,\<enter>" +let s:licenseTag = s:licenseTag . "but WITHOUT ANY WARRANTY; without even the implied warranty of\<enter>" +let s:licenseTag = s:licenseTag . "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\<enter>" +let s:licenseTag = s:licenseTag . "GNU General Public License for more details.\<enter>\<enter>" +let s:licenseTag = s:licenseTag . "You should have received a copy of the GNU General Public License\<enter>" +let s:licenseTag = s:licenseTag . "along with this program; if not, write to the Free Software\<enter>" +let s:licenseTag = s:licenseTag . "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\<enter>" + +" Common standard constants +if !exists("g:DoxygenToolkit_briefTag_pre") + let g:DoxygenToolkit_briefTag_pre = "@brief " +endif +if !exists("g:DoxygenToolkit_briefTag_post") + let g:DoxygenToolkit_briefTag_post = "" +endif +if !exists("g:DoxygenToolkit_paramTag_pre") + let g:DoxygenToolkit_paramTag_pre = "@param " +endif +if !exists("g:DoxygenToolkit_paramTag_post") + let g:DoxygenToolkit_paramTag_post = " " +endif +if !exists("g:DoxygenToolkit_returnTag") + let g:DoxygenToolkit_returnTag = "@return " +endif +if !exists("g:DoxygenToolkit_blockHeader") + let g:DoxygenToolkit_blockHeader = "" +endif +if !exists("g:DoxygenToolkit_blockFooter") + let g:DoxygenToolkit_blockFooter = "" +endif +if !exists("g:DoxygenToolkit_licenseTag") + let g:DoxygenToolkit_licenseTag = s:licenseTag +endif +if !exists("g:DoxygenToolkit_fileTag") + let g:DoxygenToolkit_fileTag = "@file " +endif +if !exists("g:DoxygenToolkit_authorTag") + let g:DoxygenToolkit_authorTag = "@author " +endif +if !exists("g:DoxygenToolkit_dateTag") + let g:DoxygenToolkit_dateTag = "@date " +endif +if !exists("g:DoxygenToolkit_undocTag") + let g:DoxygenToolkit_undocTag = "DOX_SKIP_BLOCK" +endif +if !exists("g:DoxygenToolkit_blockTag") + let g:DoxygenToolkit_blockTag = "@name " +endif +if !exists("g:DoxygenToolkit_classTag") + let g:DoxygenToolkit_classTag = "@class " +endif + +if !exists("g:DoxygenToolkit_cinoptions") + let g:DoxygenToolkit_cinoptions = "c1C1" +endif +if !exists("g:DoxygenToolkit_startCommentTag ") + let g:DoxygenToolkit_startCommentTag = "/** " + let g:DoxygenToolkit_startCommentBlock = "/* " +endif +if !exists("g:DoxygenToolkit_interCommentTag ") + let g:DoxygenToolkit_interCommentTag = "* " +endif +if !exists("g:DoxygenToolkit_endCommentTag ") + let g:DoxygenToolkit_endCommentTag = "*/" + let g:DoxygenToolkit_endCommentBlock = " */" +endif +if exists("g:DoxygenToolkit_commentType") + if ( g:DoxygenToolkit_commentType == "C++" ) + let g:DoxygenToolkit_startCommentTag = "/// " + let g:DoxygenToolkit_interCommentTag = "/// " + let g:DoxygenToolkit_endCommentTag = "" + let g:DoxygenToolkit_startCommentBlock = "// " + let g:DoxygenToolkit_endCommentBlock = "" + endif +else + let g:DoxygenToolkit_commentType = "C" +endif + +if !exists("g:DoxygenToolkit_ignoreForReturn") + let g:DoxygenToolkit_ignoreForReturn = "inline static virtual void" +else + let g:DoxygenToolkit_ignoreForReturn = g:DoxygenToolkit_ignoreForReturn . " inline static virtual void" +endif + +" Add name of function after pre brief tag if you want +if !exists("g:DoxygenToolkit_briefTag_funcName") + let g:DoxygenToolkit_briefTag_funcName = "no" +endif + + +"""""""""""""""""""""""""" +" Doxygen comment function +"""""""""""""""""""""""""" +function! <SID>DoxygenCommentFunc() + " Store indentation + let l:oldcinoptions = &cinoptions + " Set new indentation + let &cinoptions=g:DoxygenToolkit_cinoptions + + let l:argBegin = "\(" + let l:argEnd = "\)" + let l:argSep = ',' + let l:sep = "\ " + let l:voidStr = "void" + + let l:classDef = 0 + + " Save standard comment expension + let l:oldComments = &comments + let &comments = "" + + " Store function in a buffer + let l:lineBuffer = getline(line(".")) + mark d + let l:count=1 + " Return of function can be defined on other line than the one of the + " function. + while ( l:lineBuffer !~ l:argBegin && l:count < 4 ) + " This is probbly a class (or something else definition) + if ( l:lineBuffer =~ "{" || l:lineBuffer =~ ";" ) + let l:classDef = 1 + break + endif + exec "normal j" + let l:line = getline(line(".")) + let l:lineBuffer = l:lineBuffer . ' ' . l:line + let l:count = l:count + 1 + endwhile + if ( l:classDef == 0 ) + if ( l:count == 4 ) + " Restore standard comment expension + let &comments = l:oldComments + " Restore indentation + let &cinoptions = l:oldcinoptions + return + endif + " Get the entire function + let l:count = 0 + while ( l:lineBuffer !~ l:argEnd && l:count < 10 ) + exec "normal j" + let l:line = getline(line(".")) + let l:lineBuffer = l:lineBuffer . ' ' . l:line + let l:count = l:count + 1 + endwhile + " Function definition seem to be too long... + if ( l:count == 10 ) + " Restore standard comment expension + let &comments = l:oldComments + " Restore indentation + let &cinoptions = l:oldcinoptions + return + endif + endif + + " Start creating doxygen pattern + exec "normal `d" + if ( g:DoxygenToolkit_blockHeader != "" ) + exec "normal O" . g:DoxygenToolkit_startCommentBlock . g:DoxygenToolkit_blockHeader . g:DoxygenToolkit_endCommentBlock + exec "normal o" . g:DoxygenToolkit_startCommentTag . g:DoxygenToolkit_briefTag_pre + else + if ( g:DoxygenToolkit_commentType == "C++" ) + exec "normal O" . g:DoxygenToolkit_startCommentTag . g:DoxygenToolkit_briefTag_pre + else + exec "normal O" . g:DoxygenToolkit_startCommentTag + exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_briefTag_pre + endif + endif + mark d + if ( g:DoxygenToolkit_endCommentTag != "" ) + exec "normal o" . g:DoxygenToolkit_endCommentTag + endif + if ( g:DoxygenToolkit_blockFooter != "" ) + exec "normal o" . g:DoxygenToolkit_startCommentBlock . g:DoxygenToolkit_blockFooter . g:DoxygenToolkit_endCommentBlock + endif + exec "normal `d" + + " Class definition, let's start with brief tag + if ( l:classDef == 1 ) + " Restore standard comment expension + let &comments = l:oldComments + " Restore indentation + let &cinoptions = l:oldcinoptions + + startinsert! + return + endif + + " Replace tabs by space + let l:lineBuffer = substitute(l:lineBuffer, "\t", "\ ", "g") + + " Delete recursively all double spaces + while ( match(l:lineBuffer, "\ \ ") != -1 ) + let l:lineBuffer = substitute(l:lineBuffer, "\ \ ", "\ ", "g") + endwhile + + " Delete space just after and just before parenthesis + " Remove space between function name and opening paenthesis + let l:lineBuffer = substitute(l:lineBuffer, "(\ ", "(", "") + let l:lineBuffer = substitute(l:lineBuffer, "\ )", ")", "") + let l:lineBuffer = substitute(l:lineBuffer, "\ (", "(", "") + + " Delete first space (if any) + if ( match(l:lineBuffer, ' ') == 0 ) + let l:lineBuffer = strpart(l:lineBuffer, 1) + endif + + " Add function name if requiered + if ( g:DoxygenToolkit_briefTag_funcName =~ "yes" ) + let l:beginP = 0 + let l:currentP = -1 + let l:endP = match( l:lineBuffer, l:argBegin ) + while ( l:currentP < l:endP ) + let l:beginP = l:currentP + 1 + let l:currentP = match( l:lineBuffer, '[&*[:space:]]', l:beginP ) + if ( l:currentP == -1 ) + let l:currentP = l:endP + endif + endwhile + let l:name = strpart( l:lineBuffer, l:beginP, l:endP - l:beginP ) + exec "normal A" . l:name + endif + + " Now can add brief post tag + exec "normal A" . g:DoxygenToolkit_briefTag_post + + " Add return tag if function do not return void + let l:beginArgPos = match(l:lineBuffer, l:argBegin) + let l:beginP = 0 " Name can start at the beginning of l:lineBuffer, it is usually between whitespaces or space and parenthesis + let l:endP = 0 + let l:returnFlag = -1 " At least one name (function name) do not correspond to the list of ignored values. + while ( l:endP != l:beginArgPos ) + " look for * or & (pointer or reference) + let l:endP = match(l:lineBuffer, '[&*]', l:beginP ) + if ( l:endP > l:beginArgPos || l:endP == -1 ) + " not found --> look for whitespace + let l:endP = match(l:lineBuffer, '\s', l:beginP ) + if ( l:endP > l:beginArgPos || l:endP == -1 ) + let l:endP = l:beginArgPos + endif + else + " found * or & -- so we have a return value + let l:returnFlag = l:returnFlag + 1 + endif + let l:name = strpart(l:lineBuffer, l:beginP, l:endP - l:beginP) + let l:beginP = l:endP + 1 + " Hack, because of '~' is not correctly interprated by match... if you + " have a solution, send me it ! + if ( l:name[0] != '~' && matchstr(g:DoxygenToolkit_ignoreForReturn, "\\<" . l:name . "\\>") != l:name ) + let l:returnFlag = l:returnFlag + 1 + endif + endwhile + if ( l:returnFlag >= 1 ) + exec "normal o" . g:DoxygenToolkit_interCommentTag + exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_returnTag + endif + + " Looking for argument name in line buffer + exec "normal `d" + let l:argList = 0 " ==0 -> no argument, !=0 -> at least one arg + + let l:beginP = 0 + let l:endP = 0 + let l:prevBeginP = 0 + + " Arguments start after opening parenthesis + let l:beginP = match(l:lineBuffer, l:argBegin, l:beginP) + 1 + let l:prevBeginP = l:beginP + let l:endP = l:beginP + + " Test if there is something into parenthesis + let l:beginP = l:beginP + if ( l:beginP == match(l:lineBuffer, l:argEnd, l:beginP) ) + " Restore standard comment expension + let &comments = l:oldComments + " Restore indentation + let &cinoptions = l:oldcinoptions + + startinsert! + return + endif + + " Enter into main loop + while ( l:beginP > 0 && l:endP > 0 ) + + " Looking for arg separator + let l:endP1 = match(l:lineBuffer, l:argSep, l:beginP) + let l:endP = match(l:lineBuffer, l:argEnd, l:beginP) + if ( l:endP1 != -1 && l:endP1 < l:endP ) + let l:endP = l:endP1 + endif + let l:endP = l:endP - 1 + + if ( l:endP > 0 ) + let l:strBuf = ReturnArgName(l:lineBuffer, l:beginP, l:endP) + " void parameter + if ( l:strBuf == l:voidStr ) + " Restore standard comment expension + let &comments = l:oldComments + " Restore indentation + let &cinoptions = l:oldcinoptions + + startinsert! + break + endif + exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_paramTag_pre . l:strBuf . g:DoxygenToolkit_paramTag_post + let l:beginP = l:endP + 2 + let l:argList = 1 + endif + endwhile + + " Add blank line if necessary + if ( l:argList != 0 ) + exec "normal `do" . g:DoxygenToolkit_interCommentTag + endif + + " move the cursor to the correct position (after brief tag) + exec "normal `d" + + " Restore standard comment expension + let &comments = l:oldComments + " Restore indentation + let &cinoptions = l:oldcinoptions + + startinsert! +endfunction + + +"""""""""""""""""""""""""" +" Doxygen license comment +"""""""""""""""""""""""""" +function! <SID>DoxygenLicenseFunc() + " Store indentation + let l:oldcinoptions = &cinoptions + " Set new indentation + let &cinoptions=g:DoxygenToolkit_cinoptions + + " Test authorName variable + if !exists("g:DoxygenToolkit_authorName") + let g:DoxygenToolkit_authorName = input("Enter name of the author (generally yours...) : ") + endif + mark d + let l:date = strftime("%Y") + exec "normal O/*\<Enter>" . g:DoxygenToolkit_licenseTag + exec "normal ^c$*/" + if ( g:DoxygenToolkit_licenseTag == s:licenseTag ) + exec "normal %jA" . l:date . " - " . g:DoxygenToolkit_authorName + endif + exec "normal `d" + + " Restore indentation + let &cinoptions = l:oldcinoptions +endfunction + + +"""""""""""""""""""""""""" +" Doxygen author comment +"""""""""""""""""""""""""" +function! <SID>DoxygenAuthorFunc() + " Save standard comment expension + let l:oldComments = &comments + let &comments = "" + " Store indentation + let l:oldcinoptions = &cinoptions + " Set new indentation + let &cinoptions=g:DoxygenToolkit_cinoptions + + " Test authorName variable + if !exists("g:DoxygenToolkit_authorName") + let g:DoxygenToolkit_authorName = input("Enter name of the author (generally yours...) : ") + endif + + " Get file name + let l:fileName = expand('%:t') + + " Begin to write skeleton + exec "normal O" . g:DoxygenToolkit_startCommentTag + exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_fileTag . l:fileName + exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_briefTag_pre + mark d + exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_authorTag . g:DoxygenToolkit_authorName + let l:date = strftime("%Y-%m-%d") + exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_dateTag . l:date + if ( g:DoxygenToolkit_endCommentTag == "" ) + exec "normal o" . g:DoxygenToolkit_interCommentTag + else + exec "normal o" . g:DoxygenToolkit_endCommentTag + endif + + " Replace the cursor to the rigth position + exec "normal `d" + + " Restore standard comment expension + let &comments = l:oldComments + " Restore indentation + let &cinoptions = l:oldcinoptions + startinsert! +endfunction + + +"""""""""""""""""""""""""" +" Doxygen undocument function +"""""""""""""""""""""""""" +function! <SID>DoxygenUndocumentFunc(blockTag) + let l:search = "#ifdef " . a:blockTag + " Save cursor position and go to the begining of the file + mark d + exec "normal gg" + + while ( search(l:search, 'W') != 0 ) + exec "normal O#ifndef " . g:DoxygenToolkit_undocTag + exec "normal j^%" + if ( g:DoxygenToolkit_endCommentTag == "" ) + exec "normal o#endif // " . g:DoxygenToolkit_undocTag + else + exec "normal o#endif /* " . g:DoxygenToolkit_undocTag . " */" + endif + endwhile + + exec "normal `d" +endfunction + + + +"""""""""""""""""""""""""" +" DoxygenBlockFunc +"""""""""""""""""""""""""" +function! <SID>DoxygenBlockFunc() + " Save standard comment expension + let l:oldComments = &comments + let &comments = "" + " Store indentation + let l:oldcinoptions = &cinoptions + " Set new indentation + let &cinoptions=g:DoxygenToolkit_cinoptions + + exec "normal o" . g:DoxygenToolkit_startCommentTag + exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_blockTag + mark d + exec "normal o" . g:DoxygenToolkit_interCommentTag . "@{ " . g:DoxygenToolkit_endCommentTag + exec "normal o" . g:DoxygenToolkit_startCommentTag . " @} " . g:DoxygenToolkit_endCommentTag + exec "normal `d" + + " Restore standard comment expension + let &comments = l:oldComments + " Restore indentation + let &cinoptions = l:oldcinoptions + startinsert! +endfunction + + +"function! AppendText(text) +" call append(line("."), a:text) +" exec "normal j" +"endfunction + +" +" Returns the indentations level for a line +" MakeIndent([lineNum]) +" +"function! MakeIndent(...) +" let line = getline(".") +" if a:0 == 1 +" let line = getline(a:1) +" endif +" return matchstr(line, '^\s*') +"endfunction + +"""""""""""""""""""""""""" +" Extract the name of argument +"""""""""""""""""""""""""" +function ReturnArgName(argBuf, beginP, endP) + + " Name of argument is at the end of argBuf if no default (id arg = 0) + let l:equalP = match(a:argBuf, "=", a:beginP) + if ( l:equalP == -1 || l:equalP > a:endP ) + " Look for arg name begining + let l:beginP = a:beginP + let l:prevBeginP = l:beginP + while ( l:beginP < a:endP && l:beginP != -1 ) + let l:prevBeginP = l:beginP + let l:beginP = match(a:argBuf, " ", l:beginP + 1) + endwhile + let l:beginP = l:prevBeginP + let l:endP = a:endP + else + " Look for arg name begining + let l:addPos = 0 + let l:beginP = a:beginP + let l:prevBeginP = l:beginP + let l:doublePrevBeginP = l:prevBeginP + while ( l:beginP < l:equalP && l:beginP != -1 ) + let l:doublePrevBeginP = l:prevBeginP + let l:prevBeginP = l:beginP + l:addPos + let l:beginP = match(a:argBuf, " ", l:beginP + 1) + let l:addPos = 1 + endwhile + + " Space just before equal + if ( l:prevBeginP == l:equalP ) + let l:beginP = l:doublePrevBeginP + let l:endP = l:prevBeginP - 2 + else + " No space just before so... + let l:beginP = l:prevBeginP + let l:endP = l:equalP - 1 + endif + endif + + " We have the begining position and the ending position... + let l:newBuf = strpart(a:argBuf, l:beginP, l:endP - l:beginP + 1) + + " Delete leading '*' or '&' + if ( match(l:newBuf, "*") == 1 || match(l:newBuf, "&") == 1 ) + let l:newBuf = strpart(l:newBuf, 2) + endif + + " Delete tab definition ([]) + let l:delTab = match(newBuf, "[") + if ( l:delTab != -1 ) + let l:newBuf = strpart(l:newBuf, 0, l:delTab) + endif + + " Eventually clean argument name... + let l:newBuf = substitute(l:newBuf, " ", "", "g") + return l:newBuf + +endfunction + + + +"""""""""""""""""""""""""" +" Shortcuts... +"""""""""""""""""""""""""" +command! -nargs=0 Dox :call <SID>DoxygenCommentFunc() +command! -nargs=0 DoxLic :call <SID>DoxygenLicenseFunc() +command! -nargs=0 DoxAuthor :call <SID>DoxygenAuthorFunc() +command! -nargs=1 DoxUndoc :call <SID>DoxygenUndocumentFunc(<q-args>) +command! -nargs=0 DoxBlock :call <SID>DoxygenBlockFunc() diff --git a/vimfiles/plugin/GetLatestVimScripts.vim b/vimfiles/plugin/GetLatestVimScripts.vim new file mode 100644 index 0000000..a2299ba --- /dev/null +++ b/vimfiles/plugin/GetLatestVimScripts.vim @@ -0,0 +1,468 @@ +" --------------------------------------------------------------------- +" GetLatestVimScripts.vim +" Author: Charles E. Campbell, Jr. +" Date: Feb 15, 2006 +" Version: 20 +" Installing: :help glvs-install +" Usage: :help glvs +" +" GetLatestVimScripts: 642 1 :AutoInstall: GetLatestVimScripts.vim +" --------------------------------------------------------------------- +" Initialization: {{{1 +" if you're sourcing this file, surely you can't be +" expecting vim to be in its vi-compatible mode +if &cp + echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" + finish +endif +let s:keepfo = &fo +let s:keepcpo = &cpo +set cpo&vim + +if exists("loaded_GetLatestVimScripts") + finish +endif +let g:loaded_GetLatestVimScripts= "v20" + +" --------------------------------------------------------------------- +" Global Variables: {{{1 +" allow user to change the command for obtaining scripts (does fetch work?) +if !exists("g:GetLatestVimScripts_wget") + let g:GetLatestVimScripts_wget= "wget" +endif +if !exists("g:GetLatestVimScripts_options") + let g:GetLatestVimScripts_options= "-q -O" +endif +if !exists("g:GetLatestVimScripts_allowautoinstall") + let g:GetLatestVimScripts_allowautoinstall= 1 +endif + +"" For debugging: +"let g:GetLatestVimScripts_wget = "echo" +"let g:GetLatestVimScripts_options = "options" + +" check if s:autoinstall is possible +let s:autoinstall= "" +if g:GetLatestVimScripts_allowautoinstall + + if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash" + " windows (but not cygwin/bash) + let s:dotvim= "vimfiles" + if !exists("g:GetLatestVimScripts_mv") + let g:GetLatestVimScripts_mv= "ren" + endif + + else + " unix + let s:dotvim= ".vim" + if !exists("g:GetLatestVimScripts_mv") + let g:GetLatestVimScripts_mv= "mv" + endif + endif + + if exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim) + let s:autoinstall= $HOME."/".s:dotvim + endif +" call Decho("s:autoinstall<".s:autoinstall.">") +else +" call Decho("g:GetLatestVimScripts_allowautoinstall=".g:GetLatestVimScripts_allowautoinstall.": :AutoInstall: disabled") +endif + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +com! -nargs=0 GetLatestVimScripts call <SID>GetLatestVimScripts() +silent! com -nargs=0 GLVS call <SID>GetLatestVimScripts() + +" --------------------------------------------------------------------- +" GetOneScript: (Get Latest Vim Script) this function operates {{{1 +" on the current line, interpreting two numbers and text as +" ScriptID, SourceID, and Filename. +" It downloads any scripts that have newer versions from vim.sf.net. +fun! <SID>GetOneScript(...) +" call Dfunc("GetOneScript()") + + " set options to allow progress to be shown on screen + let t_ti= &t_ti + let t_te= &t_te + let rs = &rs + set t_ti= t_te= nors + + " put current line on top-of-screen and interpret it into + " a script identifer : used to obtain webpage + " source identifier : used to identify current version + " and an associated comment: used to report on what's being considered + if a:0 >= 3 + let scriptid = a:1 + let srcid = a:2 + let cmmnt = a:3 +" call Decho("scriptid<".scriptid.">") +" call Decho("srcid <".srcid.">") +" call Decho("cmmnt <".cmmnt.">") + else + let curline = getline(".") + let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(.\{-}\)$' + try + let scriptid = substitute(curline,parsepat,'\1','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let scriptid= 0 + endtry + try + let srcid = substitute(curline,parsepat,'\2','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let srcid= 0 + endtry + try + let cmmnt = substitute(curline,parsepat,'\3','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let cmmnt= "" + endtry +" call Decho("curline <".curline.">") +" call Decho("parsepat<".parsepat.">") +" call Decho("scriptid<".scriptid.">") +" call Decho("srcid <".srcid.">") +" call Decho("cmmnt <".cmmnt.">") + endif + + if scriptid == 0 || srcid == 0 + " When looking for :AutoInstall: lines, skip scripts that + " have 0 0 scriptname +" call Dret("GetOneScript : skipping a scriptid==srcid==0 line") + return + endif + + let doautoinstall= 0 + if cmmnt =~ ":AutoInstall:" +" call Decho("cmmnt<".cmmnt."> has :AutoInstall:...") + let aicmmnt= substitute(cmmnt,'\s\+:AutoInstall:\s\+',' ','') +" call Decho("aicmmnt<".aicmmnt."> s:autoinstall=".s:autoinstall) + if s:autoinstall != "" + let doautoinstall = g:GetLatestVimScripts_allowautoinstall + endif + else + let aicmmnt= cmmnt + endif +" call Decho("aicmmnt<".aicmmnt.">: doautoinstall=".doautoinstall) + + exe "norm z\<CR>" + redraw! +" call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid) + echomsg 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid + + " grab a copy of the plugin's vim.sf.net webpage + let scriptaddr = 'http://vim.sf.net/script.php?script_id='.scriptid + let tmpfile = tempname() + let v:errmsg = "" + + " make three tries at downloading the description + let itry= 1 + while itry <= 3 +" call Decho("try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr) + if has("win32") || has("win16") || has("win95") +" call Decho("silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".tmpfile.' "'.scriptaddr.'"') + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".tmpfile.' "'.scriptaddr.'"' + else +" call Decho("silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".tmpfile." '".scriptaddr."'") + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".tmpfile." '".scriptaddr."'" + endif + if itry == 1 + exe "silent vsplit ".tmpfile + else + silent! e % + endif + + " find the latest source-id in the plugin's webpage + silent! 1 + let findpkg= search('Click on the package to download','W') + if findpkg > 0 + break + endif + let itry= itry + 1 + endwhile +" call Decho(" --- end downloading tries while loop --- itry=".itry) + + " testing: did finding /Click on the package.../ fail? + if findpkg == 0 || itry >= 4 + silent q! + call delete(tmpfile) + " restore options + let &t_ti = t_ti + let &t_te = t_te + let &rs = rs + let s:downerrors = s:downerrors + 1 +" call Decho("***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">") + echomsg "***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">" +" call Dret("GetOneScript : srch for /Click on the package/ failed") + return + endif +" call Decho('found "Click on the package to download"') + + let findsrcid= search('src_id=','W') + if findsrcid == 0 + silent q! + call delete(tmpfile) + " restore options + let &t_ti = t_ti + let &t_te = t_te + let &rs = rs + let s:downerrors = s:downerrors + 1 +" call Decho("***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">") + echomsg "***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">" +" call Dret("GetOneScript : srch for /src_id/ failed") + return + endif +" call Decho('found "src_id=" in description page') + + let srcidpat = '^\s*<td class.*src_id=\(\d\+\)">\([^<]\+\)<.*$' + let latestsrcid= substitute(getline("."),srcidpat,'\1','') + let fname = substitute(getline("."),srcidpat,'\2','') +" call Decho("srcidpat<".srcidpat."> latestsrcid<".latestsrcid."> fname<".fname.">") + silent q! + call delete(tmpfile) + + " convert the strings-of-numbers into numbers + let srcid = srcid + 0 + let latestsrcid = latestsrcid + 0 +" call Decho("srcid=".srcid." latestsrcid=".latestsrcid." fname<".fname.">") + + " has the plugin's most-recent srcid increased, which indicates + " that it has been updated + if latestsrcid > srcid + let s:downloads= s:downloads + 1 + if fname == bufname("%") + " GetLatestVimScript has to be careful about downloading itself + let fname= "NEW_".fname + endif + + " the plugin has been updated since we last obtained it, so download a new copy +" call Decho("...downloading new <".fname.">") + echomsg "...downloading new <".fname.">" + if has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95") +" call Decho("windows: silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".fname.' "'.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.'"') + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".fname.' "'.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.'"' + else +" call Decho("unix: silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".fname." '".'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid."'") + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".fname." '".'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid."'" + endif + + " AutoInstall: only if doautoinstall is so indicating + if doautoinstall +" call Decho("attempting to do autoinstall: getcwd<".getcwd()."> filereadable(".fname.")=".filereadable(fname)) + if filereadable(fname) +" call Decho("move <".fname."> to ".s:autoinstall) +" call Decho("DISABLED for testing") + exe "silent !"g:GetLatestVimScripts_mv." ".fname." ".s:autoinstall + let curdir= escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #") + exe "cd ".s:autoinstall + if fname =~ '\.bz2$' +" call Decho("attempt to bunzip2 ".fname) + exe "silent !bunzip2 ".fname + let fname= substitute(fname,'\.bz2$','','') + elseif fname =~ '\.gz$' +" call Decho("attempt to gunzip ".fname) + exe "silent !gunzip ".fname + let fname= substitute(fname,'\.gz$','','') + endif + if fname =~ '\.zip$' +" call Decho("attempt to unzip ".fname) + exe "silent !unzip -o".fname + elseif fname =~ '\.tar$' +" call Decho("attempt to untar ".fname) + exe "silent !tar -oxvf ".fname + endif + if fname =~ '.vim$' +" call Decho("attempt to simply move ".fname." to plugin") + exe "silent !".g:GetLatestVimScripts_mv." ".fname." plugin" + endif + exe "helptags ../".s:dotvim."/doc" + exe "cd ".curdir + endif + endif + + " update the data in the <GetLatestVimScripts.dat> file + let modline=scriptid." ".latestsrcid." ".cmmnt + call setline(line("."),modline) +" call Decho("modline<".modline."> (updated GetLatestVimScripts.dat file)") + endif + + " restore options + let &t_ti= t_ti + let &t_te= t_te + let &rs = rs + +" call Dret("GetOneScript") +endfun + +" --------------------------------------------------------------------- +" GetLatestVimScripts: this function gets the latest versions of {{{1 +" scripts based on the list in +" +" (first dir in runtimepath)/GetLatest/GetLatestVimScripts.dat +fun! <SID>GetLatestVimScripts() +" call Dfunc("GetLatestVimScripts() autoinstall<".s:autoinstall.">") + +" insure that wget is executable + if executable(g:GetLatestVimScripts_wget) != 1 + echoerr "GetLatestVimScripts needs ".g:GetLatestVimScripts_wget." which apparently is not available on your system" +" call Dret("GetLatestVimScripts : wget not executable/availble") + return + endif + + " Find the .../GetLatest sudirectory under the runtimepath + let rtplist= &rtp + while rtplist != "" + let datadir= substitute(rtplist,',.*$','','e')."/GetLatest" + if isdirectory(datadir) +" call Decho("found directory<".datadir.">") + break + endif + unlet datadir + if rtplist =~ ',' + let rtplist= substitute(rtplist,'^.\{-},','','e') + else + let rtplist= "" + endif + endwhile + + " Sanity checks: readability and writability + if !exists("datadir") + echoerr "Unable to find a GetLatest subdirectory on your runtimepath" +" call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory") + return + endif + if filewritable(datadir) != 2 + echoerr "Your ".datadir." isn't writable" +" call Dret("GetLatestVimScripts : non-writable directory<".datadir.">") + return + endif + let datafile= datadir."/GetLatestVimScripts.dat" + if !filereadable(datafile) + echoerr "Your data file<".datafile."> isn't readable" +" call Dret("GetLatestVimScripts : non-readable datafile<".datafile.">") + return + endif + if !filewritable(datafile) + echoerr "Your data file<".datafile."> isn't writable" +" call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">") + return + endif +" call Decho("datadir <".datadir.">") +" call Decho("datafile <".datafile.">") + + " don't let any events interfere (like winmanager's, taglist's, etc) + let eikeep= &ei + set ei=all + + " record current directory, change to datadir, open split window with + " datafile + let origdir= getcwd() + exe "cd ".escape(substitute(datadir,'\','/','ge'),"|[]*'\" #") + split + exe "e ".escape(substitute(datafile,'\','/','ge'),"|[]*'\" #") + res 1000 + let s:downloads = 0 + let s:downerrors= 0 + + " Check on dependencies mentioned in plugins +" call Decho(" ") +" call Decho("searching plugins for GetLatestVimScripts dependencies") + let lastline = line("$") + let plugins = globpath(&rtp,"plugin/*.vim") + let foundscript = 0 + +" call Decho("plugins<".plugins."> lastline#".lastline) + while plugins != "" + let plugin = substitute(plugins,'\n.*$','','e') + let plugins= (plugins =~ '\n')? substitute(plugins,'^.\{-}\n\(.*\)$','\1','e') : "" + $ +" call Decho(".dependency checking<".plugin."> line$=".line("$")) + exe "silent r ".plugin + while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0 + let newscript= substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e') + let llp1 = lastline+1 + + if newscript !~ '^"' + " found a "GetLatestVimScripts: # #" line in the script; check if its already in the datafile + let curline = line(".") + let noai_script = substitute(newscript,'\s*:AutoInstall:\s*','','e') + exe llp1 + let srchline = search('\<'.noai_script.'\>','bW') +" call Decho("..newscript<".newscript."> noai_script<".noai_script."> srch=".srchline." lastline=".lastline) + + if srchline == 0 + " found a new script to permanently include in the datafile + let keep_rega = @a + let @a = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','') + exe lastline."put a" + echomsg "Appending <".@a."> to ".datafile." for ".newscript +" call Decho("..APPEND (".noai_script.")<".@a."> to GetLatestVimScripts.dat") + let @a = keep_rega + let lastline = llp1 + let curline = curline + 1 + let foundscript = foundscript + 1 +" else " Decho +" call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")") + endif + + let curline = curline + 1 + exe curline + endif + + endwhile + let llp1= lastline + 1 +" call Decho(".deleting lines: ".llp1.",$d") + exe "silent! ".llp1.",$d" + endwhile + + if foundscript == 0 + set nomod + endif + + " Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat + set lz +" call Decho(" --- end of dependency checking loop --- ") +" call Decho("call GetOneScript on lines at end of datafile<".datafile.">") + 1 + /^-----/,$g/^\s*\d/call <SID>GetOneScript() + + " Final report (an echomsg) + try + silent! ?^-------? + catch /^Vim\%((\a\+)\)\=:E114/ +" call Dret("GetLatestVimScripts : nothing done!") + return + endtry + exe "norm! kz\<CR>" + let s:msg = "" + if s:downloads == 1 + let s:msg = "Downloaded one updated script to <".datadir.">" + elseif s:downloads == 2 + let s:msg= "Downloaded two updated scripts to <".datadir.">" + elseif s:downloads > 1 + let s:msg= "Downloaded ".s:downloads." updated scripts to <".datadir.">" + else + let s:msg= "Everything was already current" + endif + if s:downerrors > 0 + let s:msg= s:msg." (".s:downerrors." downloading errors)" + endif + echomsg s:msg + " save the file + if &mod + wq + else + q + endif + + " restore events and current directory + exe "cd ".escape(substitute(origdir,'\','/','ge'),"|[]*'\" #") + let &ei= eikeep + set nolz +" call Dret("GetLatestVimScripts : did ".s:downloads." downloads") +endfun +" --------------------------------------------------------------------- + +" Restore Options: {{{1 +let &fo = s:keepfo +let &cpo= s:keepcpo + +" vim: ts=4 fdm=marker nowrap diff --git a/vimfiles/plugin/crefvim.vim b/vimfiles/plugin/crefvim.vim new file mode 100644 index 0000000..db0c757 --- /dev/null +++ b/vimfiles/plugin/crefvim.vim @@ -0,0 +1,356 @@ +"***************************************************************************** +"** Name: crefvim.vim - a C-Reference for Vim ** +"** ** +"** Type: global VIM plugin ** +"** ** +"** Author: Christian Habermann ** +"** christian(at)habermann-net(point)de ** +"** ** +"** Copyright: (c) 2002, 2003 by Christian Habermann ** +"** ** +"** License: GNU General Public License 2 (GPL 2) or later ** +"** ** +"** This program is free software; you can redistribute it ** +"** and/or modify it under the terms of the GNU General Public ** +"** License as published by the Free Software Foundation; either ** +"** version 2 of the License, or (at your option) any later ** +"** version. ** +"** ** +"** This program is distributed in the hope that it will be ** +"** useful, but WITHOUT ANY WARRANTY; without even the implied ** +"** warrenty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ** +"** PURPOSE. ** +"** See the GNU General Public License for more details. ** +"** ** +"** Version: 1.0.0 ** +"** tested under Linux (vim, gvim 6.1) and Win32 (gvim 6.1) ** +"** ** +"** History: 0.1.0 12. Dec. 2002 - 23. Feb. 2003 ** +"** initial version, not released ** +"** 1.0.0 6. Apr. 2003 ** +"** no changes, first release ** +"** ** +"** ** +"***************************************************************************** +"** Description: ** +"** This script's intention is to provide a C-reference manual that can ** +"** be accessed from within Vim. ** +"** ** +"** For futher information see crefvim.txt or do :help crefvim ** +"** ** +"** ** +"** Happy viming... ** +"***************************************************************************** + +" allow user to avoid loading this plugin and prevent loading twice +if exists ("loaded_crefvim") + finish +endif + +let loaded_crefvim = 1 + + + + +"***************************************************************************** +"************************** C O N F I G U R A T I O N ************************ +"***************************************************************************** + +" the mappings: +if !hasmapto('<Plug>CRV_CRefVimVisual') + vmap <silent> <unique> <Leader>cr <Plug>CRV_CRefVimVisual +endif +if !hasmapto('<Plug>CRV_CRefVimNormal') + nmap <silent> <unique> <Leader>cr <Plug>CRV_CRefVimNormal +endif +if !hasmapto('<Plug>CRV_CRefVimAsk') + map <silent> <unique> <Leader>cw <Plug>CRV_CRefVimAsk +endif +if !hasmapto('<Plug>CRV_CRefVimInvoke') + map <silent> <unique> <Leader>cc <Plug>CRV_CRefVimInvoke +endif + +vmap <silent> <unique> <script> <Plug>CRV_CRefVimVisual y:call <SID>CRV_CRefVimWord('<c-r>"')<CR> +nmap <silent> <unique> <script> <Plug>CRV_CRefVimNormal :call <SID>CRV_CRefVimWord(expand("<cword>"))<CR> +map <silent> <unique> <script> <Plug>CRV_CRefVimAsk :call <SID>CRV_CRefVimAskForWord()<CR> +map <silent> <unique> <script> <Plug>CRV_CRefVimInvoke :call <SID>CRV_CRefVimShowContents()<CR> + + + + +"***************************************************************************** +"************************* I N I T I A L I S A T I O N *********************** +"***************************************************************************** + + +"***************************************************************************** +"****************** I N T E R F A C E T O C O R E ************************** +"***************************************************************************** + +"***************************************************************************** +"** this function separates plugin-core-function from user ** +"***************************************************************************** +function <SID>CRV_CRefVimWord(str) + call s:CRefVim(a:str) +endfunction + + +"***************************************************************************** +"** this function separates plugin-core-function from user ** +"***************************************************************************** +function <SID>CRV_CRefVimAskForWord() + call s:CRefVimAskForWord() +endfunction + + +"***************************************************************************** +"** this function separates plugin-core-function from user ** +"***************************************************************************** +function <SID>CRV_CRefVimShowContents() + " show contents of C-reference manual + call s:LookUp("") +endfunction + + + + + +"***************************************************************************** +"************************ C O R E F U N C T I O N S ************************* +"***************************************************************************** + +"***************************************************************************** +"** ask for a word/phrase and lookup ** +"***************************************************************************** +function s:CRefVimAskForWord() + let l:strng = input("What to lookup: ") + call s:LookUp(l:strng) +endfunction + + + +"***************************************************************************** +"** input: "str" ** +"** output: empty string: "str" is not an operator ** +"** else: name of tag to go to ** +"** ** +"***************************************************************************** +"** remarks: ** +"** This function tests whether or not "str" is an operator. ** +"** If so, the tag to go to is returned. ** +"** ** +"***************************************************************************** +function s:IsItAnOperator(str) + + " get first character + let l:firstChr = strpart(a:str, 0, 1) + + " is the first character of the help-string an operator? + if stridx("!&+-*/%,.:<=>?^|~(){}[]", l:firstChr) >= 0 + return "crv-operators" + else + return "" + endif + +endfunction + + + +"***************************************************************************** +"** input: "str" ** +"** output: empty string: "str" is not an escape-sequence ** +"** else: name of tag to go to ** +"** ** +"***************************************************************************** +"** remarks: ** +"** This function tests whether or not "str" is an escape-sequence. ** +"** If so, the tag to go to is returned. ** +"** Note: currently \' does not work (="\\\'") ** +"** ** +"***************************************************************************** +function s:IsItAnEscSequence(str) + + if (a:str == "\\") || (a:str == "\\\\") || (a:str == "\\0") || (a:str == "\\x") || + \(a:str == "\\a") || (a:str == "\\b") || (a:str == "\\f") || (a:str == "\\n") || + \(a:str == "\\r") || (a:str == "\\t") || (a:str == "\\v") || (a:str == "\\?") || + \(a:str == "\\\'") || (a:str == "\\\"") + return "crv-lngEscSeq" + else + return "" + endif + +endfunction + + + + +"***************************************************************************** +"** input: "str" ** +"** output: empty string: "str" is not a comment ** +"** else: name of tag to go to ** +"** ** +"***************************************************************************** +"** remarks: ** +"** This function tests whether or not "str" is a comment. ** +"** If so, the tag to go to is returned. ** +"** ** +"***************************************************************************** +function s:IsItAComment(str) + + if (a:str == "//") || (a:str == "/*") || (a:str == "*/") + return "crv-lngComment" + else + return "" + endif + +endfunction + + + + +"***************************************************************************** +"** input: "str" ** +"** output: empty string: "str" is not a preprocessor ** +"** else: name of tag to go to ** +"** ** +"***************************************************************************** +"** remarks: ** +"** This function tests whether or not "str" is a preprocessor command ** +"** or a preprocessor operator. ** +"** If so, the tag to go to is returned. ** +"** ** +"** Nothing is done if the help-string is equal to "if" or "else" ** +"** because these are statements too. For "if" and "else" it's assumed ** +"** that the statements are meant. But "#if" and "#else" are treated ** +"** as preprocessor commands. ** +"** ** +"***************************************************************************** +function s:IsItAPreprocessor(str) + + " get first character + let l:firstChr = strpart(a:str, 0, 1) + + " if first character of the help-string is a #, we have the command/operator + " string in an appropriate form, so append this help-string to "crv-" + if l:firstChr == "#" + return "crv-" . a:str + else + " no # in front of the help string, so evaluate which command/operator + " is meant + if (a:str == "defined") + return "crv-defined" + else + if (a:str == "define") || + \(a:str == "undef") || + \(a:str == "ifdef") || + \(a:str == "ifndef") || + \(a:str == "elif") || + \(a:str == "endif") || + \(a:str == "include") || + \(a:str == "line") || + \(a:str == "error") || + \(a:str == "pragma") + return "\#" . a:str + endif + endif + endif + +endfunction + + + + +"***************************************************************************** +"** input: "str" to lookup in C-reference manual ** +"** output: none ** +"***************************************************************************** +"** remarks: ** +"** Lookup string "str". ** +"** Generally this function calls :help crv-"str" where "str" is the ** +"** word for which the user wants some help. ** +"** ** +"** But before activating VIM's help-system some tests and/or ** +"** modifications are done on "str": ** +"** - if help-string is a comment (//, /* or */), go to section ** +"** describing comments ** +"** - if help-string is an escape-sequence, go to section describing ** +"** escape-sequences ** +"** - if help-string is an operator, go to section dealing with operators ** +"** - if help-string is a preprocessor command/operator, go to section ** +"** that describes that command/operator ** +"** - else call :help crv-"str" ** +"** ** +"** If the help-string is empty, go to contents of C-reference manual. ** +"** ** +"***************************************************************************** +function s:LookUp(str) + + if a:str != "" + + let l:helpTag = s:IsItAComment(a:str) + + if l:helpTag == "" + let l:helpTag = s:IsItAnEscSequence(a:str) + + if l:helpTag == "" + let l:helpTag = s:IsItAnOperator(a:str) + + if l:helpTag == "" + let l:helpTag = s:IsItAPreprocessor(a:str) + + if l:helpTag == "" + let l:helpTag = "crv-" . a:str + endif + + endif + + endif + + endif + + + " reset error message + let v:errmsg = "" + + " activate help-system looking for the appropriate topic + " suppress error messages + silent! execute ":help " . l:helpTag + + " if there was an error, print message + if v:errmsg != "" + echo " No help found for \"" .a:str . "\"" + endif + else + " help string is empty, so show contents of manual + execute ":help crefvim" + endif + + +endfunction + + + +"***************************************************************************** +"** input: "str" to lookup in C-reference manual ** +"** output: none ** +"***************************************************************************** +"** remarks: ** +"** lookup string "str". ** +"** If there is no string, ask for word/phrase. ** +"** ** +"***************************************************************************** +function s:CRefVim(str) + + let s:strng = a:str + + if s:strng == "" " is there a string to search for? + call s:CRefVimAskForWord() + else + call s:LookUp(s:strng) + endif + +endfunction + + + +"*** EOF *** diff --git a/vimfiles/plugin/cscope_macros.vim b/vimfiles/plugin/cscope_macros.vim new file mode 100644 index 0000000..978cfd7 --- /dev/null +++ b/vimfiles/plugin/cscope_macros.vim @@ -0,0 +1,161 @@ +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" CSCOPE settings for vim +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" +" This file contains some boilerplate settings for vim's cscope interface, +" plus some keyboard mappings that I've found useful. +" +" USAGE: +" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a +" 'plugin' directory in some other directory that is in your +" 'runtimepath'. +" +" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from +" your ~/.vimrc file (or cut and paste it into your .vimrc). +" +" NOTE: +" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim +" keeps timing you out before you can complete them, try changing your timeout +" settings, as explained below. +" +" Happy cscoping, +" +" Jason Duell jduell@alumni.princeton.edu 9/12/2001 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + +" This tests to see if vim was configured with the '--enable-cscope' option +" when it was compiled. If it wasn't, time to recompile vim... +if has("cscope") + + """"""""""""" Standard cscope/vim boilerplate + + " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' + set cscopetag + + " check cscope for definition of a symbol before checking ctags: set to 1 + " if you want the reverse search order. + set csto=0 + + " add any cscope database in current directory + if filereadable("cscope.out") + cs add cscope.out + " else add the database pointed to by environment variable + elseif $CSCOPE_DB != "" + cs add $CSCOPE_DB + endif + + " show msg when any other cscope db added + set cscopeverbose + + + """"""""""""" My cscope/vim key mappings + " + " The following maps all invoke one of the following cscope search types: + " + " 's' symbol: find all references to the token under cursor + " 'g' global: find global definition(s) of the token under cursor + " 'c' calls: find all calls to the function name under cursor + " 't' text: find all instances of the text under cursor + " 'e' egrep: egrep search for the word under cursor + " 'f' file: open the filename under cursor + " 'i' includes: find files that include the filename under cursor + " 'd' called: find functions that function under cursor calls + " + " Below are three sets of the maps: one set that just jumps to your + " search result, one that splits the existing vim window horizontally and + " diplays your search result in the new window, and one that does the same + " thing, but does a vertical split instead (vim 6 only). + " + " I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's + " unlikely that you need their default mappings (CTRL-\'s default use is + " as part of CTRL-\ CTRL-N typemap, which basically just does the same + " thing as hitting 'escape': CTRL-@ doesn't seem to have any default use). + " If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all + " of these maps to use other keys. One likely candidate is 'CTRL-_' + " (which also maps to CTRL-/, which is easier to type). By default it is + " used to switch between Hebrew and English keyboard mode. + " + + + " To do the first type of search, hit 'CTRL-\', followed by one of the + " cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope + " search will be displayed in the current window. You can use CTRL-T to + " go back to where you were before the search. + " + + nmap <C-CR>s :cs find s <C-R>=expand("<cword>")<CR><CR> + nmap <C-CR>g :cs find g <C-R>=expand("<cword>")<CR><CR> + nmap <C-CR>c :cs find c <C-R>=expand("<cword>")<CR><CR> + nmap <C-CR>t :cs find t <C-R>=expand("<cword>")<CR><CR> + nmap <C-CR>e :cs find e <C-R>=expand("<cword>")<CR><CR> + nmap <C-CR>f :cs find f <C-R>=expand("<cfile>")<CR><CR> +" nmap <C-CR>i :cs find i <C-R>=expand("<cfile>")<CR><CR> + nmap <C-CR>i :cs find i %:p:t<CR> + nmap <C-CR>d :cs find d <C-R>=expand("<cword>")<CR><CR> + + + " Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type + " makes the vim window split horizontally, with search result displayed in + " the new window. + " + " (Note: earlier versions of vim may not have the :scs command, but it + " can be simulated roughly via: + " nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR> + + nmap <C- >s :scs find s <C-R>=expand("<cword>")<CR><CR> + nmap <C- >g :scs find g <C-R>=expand("<cword>")<CR><CR> + nmap <C- >c :scs find c <C-R>=expand("<cword>")<CR><CR> + nmap <C- >t :scs find t <C-R>=expand("<cword>")<CR><CR> + nmap <C- >e :scs find e <C-R>=expand("<cword>")<CR><CR> + nmap <C- >f :scs find f <C-R>=expand("<cfile>")<CR><CR> +" nmap <C- >i :scs find i <C-R>=expand("<cfile>")<CR><CR> + nmap <C- >i :scs find i %:p:t<CR> + nmap <C- >d :scs find d <C-R>=expand("<cword>")<CR><CR> + + + " Hitting CTRL-space *twice* before the search type does a vertical + " split instead of a horizontal one (vim 6 and up only) + + nmap <C- ><C- >s :vert scs find s <C-R>=expand("<cword>")<CR><CR> + nmap <C- ><C- >g :vert scs find g <C-R>=expand("<cword>")<CR><CR> + nmap <C- ><C- >c :vert scs find c <C-R>=expand("<cword>")<CR><CR> + nmap <C- ><C- >t :vert scs find t <C-R>=expand("<cword>")<CR><CR> + nmap <C- ><C- >e :vert scs find e <C-R>=expand("<cword>")<CR><CR> + nmap <C- ><C- >f :vert scs find f <C-R>=expand("<cfile>")<CR><CR> +" nmap <C- ><C- >i :vert scs find i <C-R>=expand("<cfile>")<CR><CR> + nmap <C- ><C- >i :vert scs find i %:p:t<CR> + nmap <C- ><C- >d :vert scs find d <C-R>=expand("<cword>")<CR><CR> + + + """"""""""""" key map timeouts + " + " By default Vim will only wait 1 second for each keystroke in a mapping. + " You may find that too short with the above typemaps. If so, you should + " either turn off mapping timeouts via 'notimeout'. + " + "set notimeout + " + " Or, you can keep timeouts, by uncommenting the timeoutlen line below, + " with your own personal favorite value (in milliseconds): + " + "set timeoutlen=4000 + " + " Either way, since mapping timeout settings by default also set the + " timeouts for multicharacter 'keys codes' (like <F1>), you should also + " set ttimeout and ttimeoutlen: otherwise, you will experience strange + " delays as vim waits for a keystroke after you hit ESC (it will be + " waiting to see if the ESC is actually part of a key code like <F1>). + " + "set ttimeout + " + " personally, I find a tenth of a second to work well for key code + " timeouts. If you experience problems and have a slow terminal or + " network connection, set it higher. If you don't set ttimeoutlen, the + " value for timeoutlent (default: 1000) is used. + " + "set ttimeoutlen=100 + +endif + + diff --git a/vimfiles/plugin/cscope_quickfix.vim b/vimfiles/plugin/cscope_quickfix.vim new file mode 100644 index 0000000..43c70d1 --- /dev/null +++ b/vimfiles/plugin/cscope_quickfix.vim @@ -0,0 +1,256 @@ +" File: cscope_quickfix.vim +" Author: kino +" Version: 0.1 +" Last Modified: Dec. 30, 2003 +" +" Overview +" ------------ +" This script enables to use cscope with quickfix. +" +" Preparation +" ------------ +" You must prepare cscope and cscope database (cscope.out file). +" cscope is a tag tool like ctags, but unlike ctags, it is a cross referencing +" tool. +" If you don't know about cscope, see: +" :help cscope +" http://cscope.sourceforge.net/ +" +" Feature 1 +" ------------ +" This script adds a command ":Cscope", which is very similar to ":cscope find" +" command. But, this ":Cscope" command can be used with quickfix, and isn't +" needed cscope connection. So, you don't have to install vim with +" --enable-cscope. +" +" Feature 2 +" ------------ +" This script adds keymap macro as follows: +" <C-\> s: Find this C symbol +" <C-\> g: Find this definition +" <C-\> d: Find functions called by this function +" <C-\> c: Find functions calling this function +" <C-\> t: Find this text string +" <C-\> e: Find this egrep pattern +" <C-\> f: Find this file +" <C-\> i: Find files #including this file +" "this" means <cword> or <cfile> on the cursor. +" +" Feature 3 +" -------------- +" This script adds Tools and Popup menu as follows: +" "Symbols": Find this C symbol +" "Defines": Find this definition +" "Calls": Find functions called by this function +" "Globals": Find functions calling this function +" "Texts": Find this text string +" "Egrep": Find this egrep pattern +" "File": Find this file +" "Includes": Find files #including this file +" "Update cscope.out" + +" +" Function +" -------------- +" RunCscope({type}, {pattern} [,{file}]) +" +" Command +" -------------- +" Cscope {type} {pattern} [{file}] +" +" Variables +" -------------- +" g:Cscope_OpenQuickfixWindow +" g:Cscope_JumpError +" g:Cscope_Keymap +" g:Cscope_PopupMenu +" g:Cscope_ToolMenu +" +" Install +" ------------- +" Copy cscope_quickfix.vim file to plugin directory. +" If you don't want to open quickfix window after :Cscope command, put a line +" in .vimrc like: +" let Cscope_OpenQuickfixWindow = 0 +" If you don't want to jump first item after :Cscope command, put a line +" in .vimrc like: +" let Cscope_JumpError = 0 +" If you don't want to use keymap for :Cscope command, put a line in .vimrc +" like: +" let Cscope_Keymap = 0 +" If you want to use Popup menu for :Cscope command, put a line in .vimrc +" like: +" let Cscope_PopupMenu = 1 +" If you don't want to use Tools menu for :Cscope command, put a line in .vimrc +" like: +" let Cscope_ToolsMenu = 0 +" +if !exists("Cscope_OpenQuickfixWindow") + let Cscope_OpenQuickfixWindow = 1 +endif + +if !exists("Cscope_JumpError") + let Cscope_JumpError = 1 +endif + +if !exists("Cscope_Keymap") + let Cscope_Keymap = 1 +endif + +if !exists("Cscope_PopupMenu") + let Cscope_PopupMenu = 0 +endif + +if !exists("Cscope_ToolMenu") + let Cscope_ToolMenu = 1 +endif + +" RunCscope() +" Run the cscope command using the supplied option and pattern +function! s:RunCscope(...) + let usage = "Usage: Cscope {type} {pattern} [{file}]." + let usage = usage . " {type} is [sgdctefi01234678]." + if !exists("a:1") || !exists("a:2") + echohl WarningMsg | echomsg usage | echohl None + return + endif + let cscope_opt = a:1 + let pattern = a:2 + let openwin = g:Cscope_OpenQuickfixWindow + let jumperr = g:Cscope_JumpError + if cscope_opt == '0' || cscope_opt == 's' + let cmd = "cscope -L -0 " . pattern + elseif cscope_opt == '1' || cscope_opt == 'g' + let cmd = "cscope -L -1 " . pattern + elseif cscope_opt == '2' || cscope_opt == 'd' + let cmd = "cscope -L -2 " . pattern + elseif cscope_opt == '3' || cscope_opt == 'c' + let cmd = "cscope -L -3 " . pattern + elseif cscope_opt == '4' || cscope_opt == 't' + let cmd = "cscope -L -4 " . pattern + elseif cscope_opt == '6' || cscope_opt == 'e' + let cmd = "cscope -L -6 " . pattern + elseif cscope_opt == '7' || cscope_opt == 'f' + let cmd = "cscope -L -7 " . pattern + let openwin = 0 + let jumperr = 1 + elseif cscope_opt == '8' || cscope_opt == 'i' + let cmd = "cscope -L -8 " . pattern + else + echohl WarningMsg | echomsg usage | echohl None + return + endif + if exists("a:3") + let cmd = cmd . " " . a:3 + endif + let cmd_output = system(cmd) + + if cmd_output == "" + echohl WarningMsg | + \ echomsg "Error: Pattern " . pattern . " not found" | + \ echohl None + return + endif + + let tmpfile = tempname() + let curfile = expand("%") + + if &modified && (!&autowrite || curfile == "") + let jumperr = 0 + endif + + exe "redir! > " . tmpfile + if curfile != "" + silent echon curfile . " dummy " . line(".") . " " . getline(".") . "\n" + silent let ccn = 2 + else + silent let ccn = 1 + endif + silent echon cmd_output + redir END + + " If one item is matched, window will not be opened. +" let cmd = "wc -l < " . tmpfile +" let cmd_output = system(cmd) +" exe "let lines =" . cmd_output +" if lines == 2 +" let openwin = 0 +" endif + + let old_efm = &efm + set efm=%f\ %*[^\ ]\ %l\ %m + + exe "silent! cfile " . tmpfile + let &efm = old_efm + + " Open the cscope output window + if openwin == 1 + botright copen + endif + + " Jump to the first error + if jumperr == 1 + exe "cc " . ccn + endif + + call delete(tmpfile) +endfunction + +" Define the set of Cscope commands +command! -nargs=* Cscope call s:RunCscope(<f-args>) + +if g:Cscope_Keymap == 1 + nmap <C-\>s :Cscope s <C-R>=expand("<cword>")<CR><CR> + nmap <C-\>g :Cscope g <C-R>=expand("<cword>")<CR><CR> + nmap <C-\>d :Cscope d <C-R>=expand("<cword>")<CR> <C-R>=expand("%")<CR><CR> + nmap <C-\>c :Cscope c <C-R>=expand("<cword>")<CR><CR> + nmap <C-\>t :Cscope t <C-R>=expand("<cword>")<CR><CR> + nmap <C-\>e :Cscope e <C-R>=expand("<cword>")<CR><CR> + nmap <C-\>f :Cscope f <C-R>=expand("<cfile>")<CR><CR> + nmap <C-\>i :Cscope i ^<C-R>=expand("<cfile>")<CR>$<CR> + + nmap <C-@>s :split<CR>:Cscope s <C-R>=expand("<cword>")<CR><CR> + nmap <C-@>g :split<CR>:Cscope g <C-R>=expand("<cword>")<CR><CR> + nmap <C-@>d :split<CR>:Cscope d <C-R>=expand("<cword>")<CR> <C-R>=expand("%")<CR><CR> + nmap <C-@>c :split<CR>:Cscope c <C-R>=expand("<cword>")<CR><CR> + nmap <C-@>t :split<CR>:Cscope t <C-R>=expand("<cword>")<CR><CR> + nmap <C-@>e :split<CR>:Cscope e <C-R>=expand("<cword>")<CR><CR> + nmap <C-@>f :split<CR>:Cscope f <C-R>=expand("<cfile>")<CR><CR> + nmap <C-@>i :split<CR>:Cscope i ^<C-R>=expand("<cfile>")<CR>$<CR> + + nmap <C-@><C-@>s :vert split<CR>:Cscope s <C-R>=expand("<cword>")<CR><CR> + nmap <C-@><C-@>g :vert split<CR>:Cscope g <C-R>=expand("<cword>")<CR><CR> + nmap <C-@><C-@>d :vert split<CR>:Cscope d <C-R>=expand("<cword>")<CR> <C-R>=expand("%")<CR><CR> + nmap <C-@><C-@>c :vert split<CR>:Cscope c <C-R>=expand("<cword>")<CR><CR> + nmap <C-@><C-@>t :vert split<CR>:Cscope t <C-R>=expand("<cword>")<CR><CR> + nmap <C-@><C-@>e :vert split<CR>:Cscope e <C-R>=expand("<cword>")<CR><CR> + nmap <C-@><C-@>f :vert split<CR>:Cscope f <C-R>=expand("<cfile>")<CR><CR> + nmap <C-@><C-@>i :vert split<CR>:Cscope i ^<C-R>=expand("<cfile>")<CR>$<CR> +endif +if has('gui_running') && g:Cscope_PopupMenu == 1 + nmenu PopUp.-SEP3- <Nop> + nmenu PopUp.&Cscope.&Symbols :Cscope s <C-R>=expand("<cword>")<CR><CR> + nmenu PopUp.&Cscope.&Defines :Cscope g <C-R>=expand("<cword>")<CR><CR> + nmenu PopUp.&Cscope.&Calls :Cscope d <C-R>=expand("<cword>")<CR> <C-R>=expand("%")<CR><CR> + nmenu PopUp.&Cscope.&Globals :Cscope c <C-R>=expand("<cword>")<CR><CR> + nmenu PopUp.&Cscope.&Texts :Cscope t <C-R>=expand("<cword>")<CR><CR> + nmenu PopUp.&Cscope.&Egrep :Cscope e <C-R>=expand("<cword>")<CR><CR> + nmenu PopUp.&Cscope.&File :Cscope f <C-R>=expand("<cword>")<CR><CR> + nmenu PopUp.&Cscope.&Includes :Cscope i ^<C-R>=expand("<cword>")<CR>$<CR> + nmenu PopUp.&Cscope.-SEP1- <Nop> + nmenu PopUp.&Cscope.&Update\ cscope\.out :!cscope -b -R<CR> +endif +if has('gui_running') && g:Cscope_ToolMenu == 1 + nmenu &Tools.-SEP3- <Nop> + nmenu &Tools.&Cscope.&Symbols :Cscope s <C-R>=expand("<cword>")<CR><CR> + nmenu &Tools.&Cscope.&Defines :Cscope g <C-R>=expand("<cword>")<CR><CR> + nmenu &Tools.&Cscope.&Calls :Cscope d <C-R>=expand("<cword>")<CR> <C-R>=expand("%")<CR><CR> + nmenu &Tools.&Cscope.&Globals :Cscope c <C-R>=expand("<cword>")<CR><CR> + nmenu &Tools.&Cscope.&Texts :Cscope t <C-R>=expand("<cword>")<CR><CR> + nmenu &Tools.&Cscope.&Egrep :Cscope e <C-R>=expand("<cword>")<CR><CR> + nmenu &Tools.&Cscope.&File :Cscope f <C-R>=expand("<cword>")<CR><CR> + nmenu &Tools.&Cscope.&Includes :Cscope i ^<C-R>=expand("<cword>")<CR>$<CR> + nmenu &Tools.&Cscope.-SEP1- <Nop> + nmenu &Tools.&Cscope.&Update\ cscope\.out :!cscope -b -R<CR> +endif +" vim:set ts=4 sw=4 filetype=vim: diff --git a/vimfiles/plugin/getscriptPlugin.vim b/vimfiles/plugin/getscriptPlugin.vim new file mode 100644 index 0000000..cea6e93 --- /dev/null +++ b/vimfiles/plugin/getscriptPlugin.vim @@ -0,0 +1,38 @@ +" --------------------------------------------------------------------- +" getscriptPlugin.vim +" Author: Charles E. Campbell, Jr. +" Date: Jul 18, 2006 +" Installing: :help glvs-install +" Usage: :help glvs +" +" GetLatestVimScripts: 642 1 :AutoInstall: GetLatestVimScripts.vim +" +" (Rom 15:11 WEB) Again, "Praise the Lord, all you Gentiles! Let +" all the peoples praise Him." +" --------------------------------------------------------------------- +" Initialization: {{{1 +" if you're sourcing this file, surely you can't be +" expecting vim to be in its vi-compatible mode +if &cp || exists("g:loaded_getscriptPlugin") + if &verbose + echo "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" + endif + finish +endif +let g:loaded_getscriptPlugin = 1 +let s:keepfo = &fo +let s:keepcpo = &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts() +com! -nargs=0 GetScripts call getscript#GetLatestVimScripts() +silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts() + +" Restore Options: {{{1 +let &fo = s:keepfo +let &cpo= s:keepcpo + +" --------------------------------------------------------------------- +" vim: ts=8 sts=2 fdm=marker nowrap diff --git a/vimfiles/plugin/matrix.vim b/vimfiles/plugin/matrix.vim new file mode 100644 index 0000000..3128644 --- /dev/null +++ b/vimfiles/plugin/matrix.vim @@ -0,0 +1,307 @@ +" matrix.vim - Don Yang (uguu.org) +" +" Matrix screensaver for VIM. +" +"Usage: +" After loading the script, use :Matrix to start. +" Press any key a few times to exit. +" +" You will need to edit s:mindelay and s:maxdelay below to match your +" machine speed and window size. +" +"Known Issues: +" Sometimes you need to press keys a few times to exit instead of just +" once. Press and hold is another way to go... feels like getchar is +" checking for keypress state instead of keystroke availability. +" +" If the window is too small, script will not run. If the window is +" resized and become too small (less than 8 rows or 10 columns) after +" the script started, script will abort and *buffers may be lost*, so +" don't do that. Resizing the window to most other sizes will be fine. +" +" Doesn't work if multiple windows exist before script started. In +" that case the script will abort with error message. +" +"Other Info: +" Inspired by cmatrix... +" Didn't feel inspired enough to start using pico/nano, of course ^_^; +" +" 12/21/06 - multiwindow support by S. Lockwood-Childs. +" 10/03/05 - added silent! to cursor positioning code to stop drawing +" numbers during animation (thanks to David Eggum for the +" suggestion). +" 10/02/05 - disable showmatch +" 03/16/05 - make new buffer modifiable before running +" 01/27/05 - added sleep to consume less CPU +" removed frame counter +" 01/26/05 - initial version + + +" Speed range, must be positive. Lower delay = faster. +let s:mindelay = 1 +let s:maxdelay = 5 + +" Session file for preserving original window layout +let s:session_file = tempname() + + +function! s:Rand() + let b:seed = b:seed * 22695477 + 1 + if b:seed < 0 + return -b:seed + endif + return b:seed +endfunction + +function! s:CreateObject(i) + while 1 + let b:x{a:i} = s:Rand() % b:columns + if b:reserve{b:x{a:i}} > 4 + break + endif + endwhile + let b:y{a:i} = 1 + let b:t{a:i} = s:Rand() % b:s{b:x{a:i}} + let b:head{a:i} = s:Rand() % 4 + let b:len{a:i} = s:Rand() % b:h + 3 + let b:reserve{b:x{a:i}} = 1 - b:len{a:i} +endfunction + +function! s:DrawObject(i) + let x = b:x{a:i} * 2 + 1 + let y = b:y{a:i} + + " Draw head + if y <= b:h + if b:head{a:i} + silent! exec 'norm! :' . y . nr2char(13) . x . '|R' . b:d[s:Rand()%b:dl] . '_' . nr2char(27) + if y > 1 + silent! exec 'norm! kR' . ((s:Rand() % 2) ? '`' : ' ') . nr2char(27) + endif + else + let a = ((s:Rand() % 2) ? '`' : ' ') . nr2char(27) + silent! exec 'norm! :'. y . nr2char(13) . x . '|R' . b:d[s:Rand() % b:dl] . a + endif + else + if b:head{a:i} && y == b:h + 1 + silent! exec 'norm! :' . b:h . nr2char(13) . (x + 1) . '|R' . ((s:Rand() % 2) ? '`' : ' ') . nr2char(27) + endif + endif + + " Draw tail + let y = y - b:len{a:i} + if 1 <= y && y <= b:h + silent! exec 'norm! :'. y . nr2char(13) . x . '|R ' . nr2char(27) + endif + let b:reserve{b:x{a:i}} = y +endfunction + +function! s:Animate() + let i = 0 + + while i < b:objcount + " Animate object + if b:t{i} <= 0 + if b:y{i} - b:len{i} <= b:h + " Draw + call s:DrawObject(i) + let b:t{i} = b:s{b:x{i}} + let b:y{i} = b:y{i} + 1 + else + " Regenerate + call s:CreateObject(i) + endif + endif + + let b:t{i} = b:t{i} - 1 + let i = i + 1 + endwhile + redraw + if getchar(1) + let b:run = 0 + endif + sleep 20m +endfunction + +function! s:Reset() + " Clear screen + let b:w = winwidth(0) + let b:h = winheight(0) + exec 'norm! gg"_dG' . b:h . 'O' . nr2char(27) . 'gg' + redraw + if b:w < 10 || b:h < 8 + let b:run = 0 + return + endif + + " Set number of columns. This is rounded down due to line wrapping + " at the last column if the screen width is even. So you end up + " seeing the cursor blinking a lot at the right side of the screen. + " Alternatively, ':set rl' before running the script to have it + " blink on the left side. + let b:columns = (b:w - 1) / 2 + + " Initialize columns. + let i = 0 + while i < b:columns + " Set delay time. Each column gets the same delay time. + let b:s{i} = s:Rand() % (s:maxdelay - s:mindelay) + s:mindelay + + " Unreserve column + let b:reserve{i} = b:h + let i = i + 1 + endwhile + + " Initialize objects + let b:objcount = b:columns - 2 + let i = 0 + while i < b:objcount + call s:CreateObject(i) + let i = i + 1 + endwhile +endfunction + +function! s:Init() + " Create new buffer and hide the existing buffers. Hiding the + " existing buffers without switching to a new buffer preserves + " undo history. + exec 'mksession! ' . s:session_file + let s:num_orig_win = winnr("$") + + " move to top window, so created window will become window 1, + " then attempt to create new window + 1 wincmd w + silent! new + + " check that there really is an additional window + if winnr("$") != s:num_orig_win + 1 + return 1 + endif + let s:newbuf = bufnr('%') + + " close all but window 1, which is the new window + only + + setl bh=delete bt=nofile ma nolist nonu noro noswf tw=0 nowrap + + " Set GUI options + if has('gui') + let s:o_gcr = &gcr + let s:o_go = &go + set gcr=a:ver1-blinkon0 go= + endif + if has('cmdline_info') + let s:o_ru = &ru + let s:o_sc = &sc + set noru nosc + endif + if has('title') + let s:o_ts = &titlestring + exec 'set titlestring=\ ' + endif + let s:o_ch = &ch + let s:o_ls = &ls + let s:o_lz = &lz + let s:o_siso = &siso + let s:o_sm = &sm + let s:o_smd = &smd + let s:o_so = &so + let s:o_ve = &ve + set ch=1 ls=0 lz nosm nosmd siso=0 so=0 ve=all + + " Initialize PRNG + let b:seed = localtime() + let b:run = 1 + + " Clear screen and initialize objects + call s:Reset() + + " Set colors. Output looks better if your color scheme has black + " background. I would rather not have the script change the + " current color scheme since there is no good way to restore them + " afterwards. + hi MatrixHidden ctermfg=Black ctermbg=Black guifg=#000000 guibg=#000000 + hi MatrixNormal ctermfg=DarkGreen ctermbg=Black guifg=#008000 guibg=#000000 + hi MatrixBold ctermfg=LightGreen ctermbg=Black guifg=#00ff00 guibg=#000000 + hi MatrixHead ctermfg=White ctermbg=Black guifg=#ffffff guibg=#000000 + sy match MatrixNormal /^.*/ contains=MatrixHidden + sy match MatrixHidden contained /.`/ contains=MatrixBold + sy match MatrixHidden contained /._/ contains=MatrixHead + sy match MatrixBold contained /.\(`\)\@=/ + sy match MatrixHead contained /.\(_\)\@=/ + + " Create random char dictionary + let b:d = '' + let i = 33 + while i < 127 + if i != 95 && i != 96 + let b:d = b:d . nr2char(i) + endif + let i = i + 1 + endwhile + let b:dl = strlen(b:d) + return 0 +endfunction + +function! s:Cleanup() + " Restore options + if has('gui') + let &gcr = s:o_gcr + let &go = s:o_go + unlet s:o_gcr s:o_go + endif + if has('cmdline_info') + let &ru = s:o_ru + let &sc = s:o_sc + unlet s:o_ru s:o_sc + endif + if has('title') + let &titlestring = s:o_ts + unlet s:o_ts + endif + let &ch = s:o_ch + let &ls = s:o_ls + let &lz = s:o_lz + let &siso = s:o_siso + let &sm = s:o_sm + let &smd = s:o_smd + let &so = s:o_so + let &ve = s:o_ve + unlet s:o_ch s:o_ls s:o_lz s:o_siso s:o_sm s:o_smd s:o_so s:o_ve + + " Restore old buffers + exec 'source ' . s:session_file + exec 'bwipe ' . s:newbuf + unlet s:newbuf + + " Clear keystroke + let c = getchar(0) +endfunction + +function! Matrix() + if s:Init() + echohl ErrorMsg + echon 'Can not create window' + echohl None + return + endif + + while b:run + if b:w != winwidth(0) || b:h != winheight(0) + call s:Reset() + else + call s:Animate() + endif + endwhile + + call s:Cleanup() +endfunction + + +if !has('virtualedit') || !has('windows') + echohl ErrorMsg + echon 'Not enough features, need at least +virtualedit and +windows' + echohl None +else + command! Matrix call Matrix() +endif diff --git a/vimfiles/plugin/netrwPlugin.vim b/vimfiles/plugin/netrwPlugin.vim new file mode 100644 index 0000000..9cb9ad5 --- /dev/null +++ b/vimfiles/plugin/netrwPlugin.vim @@ -0,0 +1,180 @@ +" netrwPlugin.vim: Handles file transfer and remote directory listing across a network +" PLUGIN SECTION +" Date: Jan 05, 2007 +" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> +" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim +" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided +" *as is* and comes with no warranty of any kind, either +" expressed or implied. By using this plugin, you agree that +" in no event will the copyright holder be liable for any damages +" resulting from the use of this software. +" +" But be doers of the Word, and not only hearers, deluding your own selves {{{1 +" (James 1:22 RSV) +" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_netrwPlugin") + finish +endif +let g:loaded_netrwPlugin = 1 +let s:keepcpo = &cpo +if v:version < 700 + echohl WarningMsg | echo "***netrw*** you need vim version 7.0 for this version of netrw" | echohl None + finish +endif +let s:keepcpo= &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Public Interface: {{{1 + +" Local Browsing: {{{2 +augroup FileExplorer + au! + au BufEnter * silent! call s:LocalBrowse(expand("<amatch>")) + if has("win32") || has("win95") || has("win64") || has("win16") + au BufEnter .* silent! call s:LocalBrowse(expand("<amatch>")) + endif +augroup END + +" Network Browsing Reading Writing: {{{2 +augroup Network + au! + if has("win32") || has("win95") || has("win64") || has("win16") + au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>")) + else + au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>")) + au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://localhost/\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>")) + endif + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<amatch>")|exe '2Nread "'.expand("<amatch>").'"'|exe "silent doau BufReadPost ".expand("<amatch>") + au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau FileReadPre ".expand("<amatch>")|exe 'Nread "' .expand("<amatch>").'"'|exe "silent doau FileReadPost ".expand("<amatch>") + au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<amatch>")|exe 'Nwrite "' .expand("<amatch>").'"'|exe "silent doau BufWritePost ".expand("<amatch>") + au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau FileWritePre ".expand("<amatch>")|exe "'[,']".'Nwrite "' .expand("<amatch>").'"'|exe "silent doau FileWritePost ".expand("<amatch>") + try + au SourceCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("<amatch>").'"' + catch /^Vim\%((\a\+)\)\=:E216/ + au SourcePre ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("<amatch>").'"' + endtry +augroup END + +" 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! -range=% -nargs=* Nwrite call netrw#NetSavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#NetRestorePosn() +com! -nargs=* NetUserPass call NetUserPass(<f-args>) +com! -nargs=+ Ncopy call netrw#NetObtain(<f-args>) +com! -nargs=* Nsource call netrw#NetSavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#NetRestorePosn() + +" 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 Sexplore call netrw#Explore(<count>,1,0+<bang>0,<q-args>) +com! -nargs=* -bar -bang -count=0 -complete=dir Hexplore call netrw#Explore(<count>,1,2+<bang>0,<q-args>) +com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(<count>,1,4+<bang>0,<q-args>) +com! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(<count>,0,6 ,<q-args>) +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>) + +" Commands: NetrwSettings {{{2 +com! -nargs=0 NetrwSettings :call netrwSettings#NetrwSettings() + +" Maps: +if !exists("g:netrw_nogx") && maparg('g','n') == "" + if !hasmapto('<Plug>NetrwBrowseX') + nmap <unique> gx <Plug>NetrwBrowseX + endif + nno <silent> <Plug>NetrwBrowseX :call netrw#NetBrowseX(expand("<cWORD>"),0)<cr> +endif + +" --------------------------------------------------------------------- +" LocalBrowse: {{{2 +fun! s:LocalBrowse(dirname) + " unfortunate interaction -- debugging calls can't be used here; + " the BufEnter event causes triggering when attempts to write to + " the DBG buffer are made. +" echomsg "dirname<".a:dirname.">" + if has("amiga") + " The check against '' is made for the Amiga, where the empty + " string is the current directory and not checking would break + " things such as the help command. + if a:dirname != '' && isdirectory(a:dirname) + silent! call netrw#LocalBrowseCheck(a:dirname) + endif + elseif isdirectory(a:dirname) +" echomsg "dirname<".dirname."> isdir" + silent! call netrw#LocalBrowseCheck(a:dirname) + endif + " not a directory, ignore it +endfun + +" --------------------------------------------------------------------- +" NetrwStatusLine: {{{1 +fun! NetrwStatusLine() +" let g:stlmsg= "Xbufnr=".w:netrw_explore_bufnr." bufnr=".bufnr("%")." Xline#".w:netrw_explore_line." line#".line(".") + if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") + let &stl= s:netrw_explore_stl + if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif + if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif + return "" + else + return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen + endif +endfun + +" ------------------------------------------------------------------------ +" NetUserPass: set username and password for subsequent ftp transfer {{{1 +" Usage: :call NetUserPass() -- will prompt for userid and password +" :call NetUserPass("uid") -- will prompt for password +" :call NetUserPass("uid","password") -- sets global userid and password +fun! NetUserPass(...) + + " get/set userid + if a:0 == 0 +" call Dfunc("NetUserPass(a:0<".a:0.">)") + if !exists("g:netrw_uid") || g:netrw_uid == "" + " via prompt + let g:netrw_uid= input('Enter username: ') + endif + else " from command line +" call Dfunc("NetUserPass(a:1<".a:1.">) {") + let g:netrw_uid= a:1 + endif + + " get password + if a:0 <= 1 " via prompt +" call Decho("a:0=".a:0." case <=1:") + let g:netrw_passwd= inputsecret("Enter Password: ") + else " from command line +" call Decho("a:0=".a:0." case >1: a:2<".a:2.">") + let g:netrw_passwd=a:2 + endif +" call Dret("NetUserPass") +endfun + +" ------------------------------------------------------------------------ +" NetReadFixup: this sort of function is typically written by the user {{{1 +" to handle extra junk that their system's ftp dumps +" into the transfer. This function is provided as an +" example and as a fix for a Windows 95 problem: in my +" experience, win95's ftp always dumped four blank lines +" at the end of the transfer. +if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp + fun! NetReadFixup(method, line1, line2) +" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") + if method == 3 " ftp (no <.netrc>) + let fourblanklines= line2 - 3 + silent fourblanklines.",".line2."g/^\s*/d" + endif +" call Dret("NetReadFixup") + endfun +endif + +" ------------------------------------------------------------------------ +" Modelines And Restoration: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo +" vim:ts=8 fdm=marker diff --git a/vimfiles/plugin/tComment.vim b/vimfiles/plugin/tComment.vim new file mode 100644 index 0000000..13842ab --- /dev/null +++ b/vimfiles/plugin/tComment.vim @@ -0,0 +1,710 @@ +" tComment.vim +" @Author: Thomas Link (samul AT web.de) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 27-Dez-2004. +" @Last Change: 28-Feb-2006. +" @Revision: 1.5.256 +" +" vimscript #1173 + +if &cp || exists('loaded_tcomment') + finish +endif +let loaded_tcomment = 105 + +fun! <SID>DefVar(name, val) + if !exists(a:name) + " exec "let ". a:name ."='". a:val ."'" + exec 'let '. a:name .'="'. escape(a:val, '"\') .'"' + endif +endf + +" If true, comment blank lines too +call <SID>DefVar('g:tcommentBlankLines', 1) + +" Guess the file type based on syntax names always or for some fileformat only +call <SID>DefVar('g:tcommentGuessFileType', 0) +" In php documents, the php part is usually marked as phpRegion. We thus +" assume that the buffers default comment style isn't php but html +call <SID>DefVar('g:tcommentGuessFileType_dsl', 'xml') +call <SID>DefVar('g:tcommentGuessFileType_php', 'html') +call <SID>DefVar('g:tcommentGuessFileType_html', 1) +call <SID>DefVar('g:tcommentGuessFileType_tskeleton', 1) +call <SID>DefVar('g:tcommentGuessFileType_vim', 1) + +" 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 +" the comment marker. Block comments work only if we explicitly define the +" markup. +" The format for block comments is similar to normal commentstrings with the +" exception that the format strings for blocks can contain a second line that +" defines how "middle lines" (see :h format-comments) should be displayed. + +" I personally find this style rather irritating but here is an alternative +" definition that does this left-handed bar thing +call <SID>DefVar('g:tcommentBlockC', "/*%s */\n * ") +call <SID>DefVar('g:tcommentBlockC2', "/**%s */\n * ") +" call <SID>DefVar('g:tcommentBlockC', "/*%s */\n ") +call <SID>DefVar('g:tcommentInlineC', "/* %s */") + +call <SID>DefVar('g:tcommentBlockXML', "<!--%s-->\n ") +call <SID>DefVar('g:tcommentInlineXML', "<!-- %s -->") + +" Currently this function just sets a variable +fun! TCommentDefineType(name, commentstring) + call <SID>DefVar('g:tcomment_'. a:name, a:commentstring) + let s:tcommentFileTypesDirty = 1 +endf + +fun! TCommentTypeExists(name) + return exists('g:tcomment_'. a:name) +endf + +call TCommentDefineType('ada', '-- %s' ) +call TCommentDefineType('apache', '# %s' ) +call TCommentDefineType('autoit', '; %s' ) +call TCommentDefineType('awk', '# %s' ) +call TCommentDefineType('catalog', '-- %s --' ) +call TCommentDefineType('catalog_block', '--%s--\n ' ) +call TCommentDefineType('cpp', '// %s' ) +call TCommentDefineType('cpp_inline', g:tcommentInlineC ) +call TCommentDefineType('cpp_block', g:tcommentBlockC ) +call TCommentDefineType('css', '/* %s */' ) +call TCommentDefineType('css_inline', g:tcommentInlineC ) +call TCommentDefineType('css_block', g:tcommentBlockC ) +call TCommentDefineType('c', '/* %s */' ) +call TCommentDefineType('c_inline', g:tcommentInlineC ) +call TCommentDefineType('c_block', g:tcommentBlockC ) +call TCommentDefineType('cfg', '# %s' ) +call TCommentDefineType('conf', '# %s' ) +call TCommentDefineType('desktop', '# %s' ) +call TCommentDefineType('docbk', '<!-- %s -->' ) +call TCommentDefineType('docbk_inline', g:tcommentInlineXML) +call TCommentDefineType('docbk_block', g:tcommentBlockXML ) +call TCommentDefineType('dosbatch', 'rem %s' ) +call TCommentDefineType('dosini', '; %s' ) +call TCommentDefineType('dsl', '; %s' ) +call TCommentDefineType('dylan', '// %s' ) +call TCommentDefineType('eiffel', '-- %s' ) +call TCommentDefineType('gtkrc', '# %s' ) +call TCommentDefineType('haskell', '-- %s' ) +call TCommentDefineType('haskell_block', '{-%s-}\n ' ) +call TCommentDefineType('haskell_inline', '{- %s -}' ) +call TCommentDefineType('html', '<!-- %s -->' ) +call TCommentDefineType('html_inline', g:tcommentInlineXML) +call TCommentDefineType('html_block', g:tcommentBlockXML ) +call TCommentDefineType('io', '// %s' ) +call TCommentDefineType('javaScript', '// %s' ) +call TCommentDefineType('javaScript_inline', g:tcommentInlineC ) +call TCommentDefineType('javaScript_block', g:tcommentBlockC ) +call TCommentDefineType('javascript', '// %s' ) +call TCommentDefineType('javascript_inline', g:tcommentInlineC ) +call TCommentDefineType('javascript_block', g:tcommentBlockC ) +call TCommentDefineType('java', '/* %s */' ) +call TCommentDefineType('java_inline', g:tcommentInlineC ) +call TCommentDefineType('java_block', g:tcommentBlockC ) +call TCommentDefineType('lisp', '; %s' ) +call TCommentDefineType('m4', 'dnl %s' ) +call TCommentDefineType('nroff', '.\\" %s' ) +call TCommentDefineType('objc', '/* %s */' ) +call TCommentDefineType('objc_inline', g:tcommentInlineC ) +call TCommentDefineType('objc_block', g:tcommentBlockC ) +call TCommentDefineType('ocaml', '(* %s *)' ) +call TCommentDefineType('ocaml_inline', '(* %s *)' ) +call TCommentDefineType('ocaml_block', '(*%s*)\n ' ) +call TCommentDefineType('pascal', '(* %s *)' ) +call TCommentDefineType('pascal_inline', '(* %s *)' ) +call TCommentDefineType('pascal_block', '(*%s*)\n ' ) +call TCommentDefineType('perl', '# %s' ) +call TCommentDefineType('perl_block', '=cut%s=cut' ) +call TCommentDefineType('php', '// %s' ) +call TCommentDefineType('php_inline', g:tcommentInlineC ) +call TCommentDefineType('php_block', g:tcommentBlockC ) +call TCommentDefineType('php_2_block', g:tcommentBlockC2 ) +call TCommentDefineType('po', '# %s' ) +call TCommentDefineType('prolog', '%% %s' ) +call TCommentDefineType('readline', '# %s' ) +call TCommentDefineType('ruby', '# %s' ) +call TCommentDefineType('ruby_block', '=begin rdoc%s=end') +call TCommentDefineType('ruby_nordoc_block', '=begin%s=end' ) +call TCommentDefineType('r', '# %s' ) +call TCommentDefineType('sbs', "' %s" ) +call TCommentDefineType('scheme', '; %s' ) +call TCommentDefineType('sed', '# %s' ) +call TCommentDefineType('sgml', '<!-- %s -->' ) +call TCommentDefineType('sgml_inline', g:tcommentInlineXML) +call TCommentDefineType('sgml_block', g:tcommentBlockXML ) +call TCommentDefineType('sh', '# %s' ) +call TCommentDefineType('sql', '-- %s' ) +call TCommentDefineType('spec', '# %s' ) +call TCommentDefineType('sps', '* %s.' ) +call TCommentDefineType('tcl', '# %s' ) +call TCommentDefineType('tex', '%% %s' ) +call TCommentDefineType('tpl', '<!-- %s -->' ) +call TCommentDefineType('viki', '%% %s' ) +call TCommentDefineType('viki_inline', '{cmt: %s}' ) +call TCommentDefineType('vim', '" %s' ) +call TCommentDefineType('websec', '# %s' ) +call TCommentDefineType('xml', '<!-- %s -->' ) +call TCommentDefineType('xml_inline', g:tcommentInlineXML) +call TCommentDefineType('xml_block', g:tcommentBlockXML ) +call TCommentDefineType('xslt', '<!-- %s -->' ) +call TCommentDefineType('xslt_inline', g:tcommentInlineXML) +call TCommentDefineType('xslt_block', g:tcommentBlockXML ) +call TCommentDefineType('yaml', '# %s' ) + +let s:tcommentFileTypesDirty = 1 + +fun! <SID>DefaultValue(option) + exec 'let '. a:option .' = &'. a:option + exec 'set '. a:option .'&' + exec 'let default = &'. a:option + exec 'let &'. a:option .' = '. a:option + return default +endf + +let s:defaultComments = <SID>DefaultValue('comments') +let s:defaultCommentString = <SID>DefaultValue('commentstring') +let s:nullCommentString = '%s' + +" TComment(line1, line2, ?commentMode, ?commentAnyway, ?commentBegin, ?commentEnd) +" commentMode: +" G ... guess +" B ... block +" I ... inline +" R ... right +fun! TComment(beg, end, ...) + " save the cursor position + let co = col(".") + let li = line(".") + let commentMode = a:0 >= 1 ? a:1 : 'G' + let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0 + if commentMode ==# 'IG' + let commentMode = line("'<") == line("'>") ? 'I' : 'G' + endif + if commentMode ==# 'R' || commentMode ==# 'I' + let cstart = col("'<") + if cstart == 0 + let cstart = col('.') + endif + if commentMode ==# 'R' + let commentMode = 'G' + let cend = 0 + else + let cend = col("'>") + endif + else + let cstart = 0 + let cend = 0 + endif + " get the correct commentstring + if a:0 >= 3 && a:3 != '' + let cms = <SID>EncodeCommentPart(a:3) .'%s' + if a:0 >= 4 && a:4 != '' + let cms = cms . <SID>EncodeCommentPart(a:4) + endif + else + exec <SID>GetCommentString(a:beg, a:end, commentMode) + endif + let cms0 = <SID>BlockGetCommentString(cms) + let cms0 = escape(cms0, '\') + " make whitespace optional; this conflicts with comments that require some + " whitespace + let cmtCheck = substitute(cms0, '\([ ]\)', '\1\\?', 'g') + " turn commentstring into a search pattern + let cmtCheck = <SID>SPrintF(cmtCheck, '\(\_.\{-}\)') + " set commentMode and indentStr + exec <SID>CommentDef(a:beg, a:end, cmtCheck, commentMode, cstart, cend) + if commentAnyway + let mode = 0 + endif + " go + if commentMode ==# 'B' + " We want a comment block + call <SID>CommentBlock(a:beg, a:end, mode, cmtCheck, cms, indentStr) + else + " We want commented lines + " final search pattern for uncommenting + let cmtCheck = escape('\V\^\(\s\{-}\)'. cmtCheck .'\$', '"/\') + " final pattern for commenting + let cmtReplace = escape(cms0, '"/') + silent exec a:beg .','. a:end .'s/\V'. + \ <SID>StartRx(cstart) . indentStr .'\zs\(\.\*\)'. <SID>EndRx(cend) .'/'. + \ '\=<SID>ProcessedLine('. mode .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge' + endif + " reposition cursor + silent exec 'norm! '. li .'G'. co .'|' +endf + +" :line1,line2 TComment ?commentBegin ?commentEnd +command! -bang -range -nargs=* TComment call TComment(<line1>, <line2>, 'G', "<bang>", <f-args>) + +" :line1,line2 TCommentRight ?commentBegin ?commentEnd +command! -bang -range -nargs=* TCommentRight call TComment(<line1>, <line2>, 'R', "<bang>", <f-args>) + +" :line1,line2 TCommentBlock ?commentBegin ?commentEnd +command! -bang -range -nargs=* TCommentBlock call TComment(<line1>, <line2>, 'B', "<bang>", <f-args>) + +" :line1,line2 TCommentInline ?commentBegin ?commentEnd +command! -bang -range -nargs=* TCommentInline call TComment(<line1>, <line2>, 'I', "<bang>", <f-args>) + +" :line1,line2 TCommentMaybeInline ?commentBegin ?commentEnd +command! -bang -range -nargs=* TCommentMaybeInline call TComment(<line1>, <line2>, 'IG', "<bang>", <f-args>) + +" comment text as if it were of a specific filetype +fun! TCommentAs(beg, end, commentAnyway, filetype) + if a:filetype =~ '_block$' + let commentMode = 'B' + let ft = substitute(a:filetype, '_block$', '', '') + elseif a:filetype =~ '_inline$' + let commentMode = 'I' + let ft = substitute(a:filetype, '_inline$', '', '') + else + let commentMode = 'G' + let ft = a:filetype + endif + exec <SID>GetCommentString(a:beg, a:end, commentMode, ft) + let pre = substitute(cms, '%s.*$', '', '') + let pre = substitute(pre, '%%', '%', 'g') + let post = substitute(cms, '^.\{-}%s', '', '') + let post = substitute(post, '%%', '%', 'g') + call TComment(a:beg, a:end, commentMode, a:commentAnyway, pre, post) +endf + +" :line1,line2 TCommentAs commenttype +command! -bang -complete=custom,TCommentFileTypes -range -nargs=1 TCommentAs + \ call TCommentAs(<line1>, <line2>, "<bang>", <f-args>) + +if !hasmapto(":TComment<cr>") + noremap <silent> <c-_><c-_> :TComment<cr> + vnoremap <silent> <c-_><c-_> :TCommentMaybeInline<cr> + inoremap <silent> <c-_><c-_> <c-o>:TComment<cr> + noremap <silent> <Leader>__ :TComment<cr> + vnoremap <silent> <Leader>__ :TCommentMaybeInline<cr> +endif +if !hasmapto(":TComment ") + noremap <c-_><space> :TComment + inoremap <c-_><space> <c-o>:TComment + noremap <Leader>_<space> :TComment<cr> +endif +if !hasmapto(":TCommentInline<cr>") + vnoremap <silent> <c-_>i :TCommentInline<cr> + vnoremap <silent> <Leader>_i :TCommentInline<cr> +endif +if !hasmapto(":TCommentRight<cr>") + inoremap <silent> <c-_>r <c-o>:TCommentRight<cr> + noremap <silent> <c-_>r :TCommentRight<cr> + noremap <silent> <Leader>_r :TCommentRight<cr> + vnoremap <silent> <c-_>r :TCommentRight<cr> + vnoremap <silent> <Leader>_r :TCommentRight<cr> +endif +if !hasmapto(":TCommentBlock<cr>") + noremap <c-_>b :TCommentBlock<cr> + noremap <Leader>_b :TCommentBlock<cr> + inoremap <c-_>b <c-o>:TCommentBlock<cr> +endif +if !hasmapto(":TCommentAs") + noremap <c-_>a :TCommentAs + noremap <Leader>_a :TCommentAs + inoremap <c-_>a <c-o>:TCommentAs + noremap <c-_>s :TCommentAs <c-r>=&ft<cr>_ + noremap <Leader>_s :TCommentAs <c-r>=&ft<cr>_ + inoremap <c-_>s <c-o>:TCommentAs <c-r>=&ft<cr>_ +endif + + +" ---------------------------------------------------------------- +" collect all variables matching ^tcomment_ +fun! TCommentCollectFileTypes() + if s:tcommentFileTypesDirty + let t = @t + try + redir @t + silent let + redir END + let g:tcommentFileTypes = substitute("\n". @t ."\n", '\n\(tcomment_\(\w\+\)\|\w\+\).\{-}\ze\n', '\n\2', 'g') + let g:tcommentFileTypes = substitute(g:tcommentFileTypes, '\(\n\)\n\+', '\1', 'g') + let g:tcommentFileTypes = strpart(g:tcommentFileTypes, 1, strlen(g:tcommentFileTypes) - 2) + finally + let @t = t + endtry + let g:tcommentFileTypesRx = '\V\^\('. substitute(g:tcommentFileTypes, '\n', '\\|', 'g') .'\)\(\u\.\*\)\?\$' + let s:tcommentFileTypesDirty = 0 + endif +endf + +call TCommentCollectFileTypes() + +" return a list of filetypes for which a tcomment_{&ft} is defined +fun! TCommentFileTypes(ArgLead, CmdLine, CursorPos) + call TCommentCollectFileTypes() + if a:ArgLead == '' + return &filetype ."\n". g:tcommentFileTypes + else + return g:tcommentFileTypes + endif +endf + +fun! <SID>EncodeCommentPart(string) + return substitute(a:string, '%', '%%', 'g') +endf + +" <SID>GetCommentString(beg, end, commentMode, ?filetype="") +" => RecordCMS +fun! <SID>GetCommentString(beg, end, commentMode, ...) + let ft = a:0 >= 1 ? a:1 : '' + if ft != '' + exec <SID>GetCustomCommentString(ft, a:commentMode) + else + let cms = '' + let commentMode = a:commentMode + endif + if cms == '' + if exists('b:commentstring') + let cms = b:commentstring + return <SID>GetCustomCommentString(&filetype, a:commentMode, cms) + elseif exists('b:commentStart') && b:commentStart != '' + let cms = <SID>EncodeCommentPart(b:commentStart) .' %s' + if exists('b:commentEnd') && b:commentEnd != '' + let cms = cms .' '. <SID>EncodeCommentPart(b:commentEnd) + endif + return <SID>GetCustomCommentString(&filetype, a:commentMode, cms) + elseif g:tcommentGuessFileType || (exists('g:tcommentGuessFileType_'. &filetype) + \ && g:tcommentGuessFileType_{&filetype} =~ '[^0]') + if g:tcommentGuessFileType_{&filetype} == 1 + let altFiletype = '' + else + let altFiletype = g:tcommentGuessFileType_{&filetype} + endif + return <SID>GuessFileType(a:beg, a:end, a:commentMode, altFiletype) + else + return <SID>GetCustomCommentString(&filetype, a:commentMode, <SID>GuessCurrentCommentString(a:commentMode)) + endif + endif + return <SID>RecordCMS(cms, commentMode) +endf + +" <SID>SPrintF(formatstring, ?values ...) +" => string +fun! <SID>SPrintF(string, ...) + let n = 1 + let r = '' + let s = a:string + while 1 + let i = match(s, '%\(.\)') + if i >= 0 + let x = s[i + 1] + let r = r . strpart(s, 0, i) + let s = strpart(s, i + 2) + if x == '%' + let r = r.'%' + else + if a:0 >= n + exec 'let v = a:'. n + let n = n + 1 + else + echoerr 'Malformed format string (too many arguments required): '. a:string + endif + if x ==# 's' + let r = r.v + elseif x ==# 'S' + let r = r.'"'.v.'"' + else + echoerr 'Malformed format string: '. a:string + endif + endif + else + return r.s + endif + endwh +endf + +fun! <SID>StartRx(pos) + if a:pos == 0 + return '\^' + else + return '\%'. a:pos .'c' + endif +endf + +fun! <SID>EndRx(pos) + if a:pos == 0 + return '\$' + else + return '\%'. a:pos .'c' + endif +endf + +fun! <SID>GetIndentString(line, start) + let start = a:start > 0 ? a:start - 1 : 0 + return substitute(strpart(getline(a:line), start), '\V\^\s\*\zs\.\*\$', '', '') +endf + +fun! <SID>CommentDef(beg, end, checkRx, commentMode, cstart, cend) + let mdrx = '\V'. <SID>StartRx(a:cstart) .'\s\*'. a:checkRx .'\s\*'. <SID>EndRx(0) + let line = getline(a:beg) + if a:cstart != 0 && a:cend != 0 + let line = strpart(line, 0, a:cend - 1) + endif + let mode = (line =~ mdrx) + let it = <SID>GetIndentString(a:beg, a:cstart) + let il = indent(a:beg) + let n = a:beg + 1 + while n <= a:end + if getline(n) =~ '\S' + let jl = indent(n) + if jl < il + let it = <SID>GetIndentString(n, a:cstart) + let il = jl + endif + if a:commentMode ==# 'G' + if !(getline(n) =~ mdrx) + let mode = 0 + endif + endif + endif + let n = n + 1 + endwh + if a:commentMode ==# 'B' + let t = @t + try + silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"ty' + let mode = (@t =~ mdrx) + finally + let @t = t + endtry + endif + return 'let indentStr="'. it .'" | let mode='. mode +endf + +fun! <SID>ProcessedLine(mode, match, checkRx, replace) + if !(a:match =~ '\S' || g:tcommentBlankLines) + return a:match + endif + if a:mode + " uncomment + let rv = substitute(a:match, a:checkRx, '\1\2', '') + else + " comment + let rv = <SID>SPrintF(a:replace, a:match) + endif + let rv = escape(rv, '\ ') + let rv = substitute(rv, '\n', '\\\n', 'g') + return rv +endf + +fun! <SID>CommentBlock(beg, end, mode, checkRx, replace, indentStr) + let t = @t + try + silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td' + let ms = <SID>BlockGetMiddleString(a:replace) + let mx = escape(ms, '\') + if a:mode + " uncomment + let @t = substitute(@t, '\V\^\s\*'. a:checkRx .'\$', '\1', '') + if ms != '' + let @t = substitute(@t, '\V\n'. a:indentStr . mx, '\n'. a:indentStr, 'g') + endif + let @t = substitute(@t, '^\n', '', '') + let @t = substitute(@t, '\n\s*$', '', '') + else + " comment + let cs = <SID>BlockGetCommentString(a:replace) + let cs = a:indentStr . substitute(cs, '%s', '%s'. a:indentStr, '') + if ms != '' + let ms = a:indentStr . ms + let mx = a:indentStr . mx + let @t = substitute(@t, '^'. a:indentStr, '', 'g') + let @t = ms . substitute(@t, '\n'. a:indentStr, '\n'. mx, 'g') + endif + let @t = <SID>SPrintF(cs, "\n". @t ."\n") + endif + silent norm! "tP + finally + let @t = t + endtry +endf + +" inspired by Meikel Brandmeyer's EnhancedCommentify.vim +" this requires that a syntax names are prefixed by the filetype name +" <SID>GuessFileType(beg, end, commentMode, ?fallbackFiletype) +" => RecordCMS +fun! <SID>GuessFileType(beg, end, commentMode, ...) + if a:0 >= 1 && a:1 != '' + exec <SID>GetCustomCommentString(a:1, a:commentMode) + if cms == '' + let cms = <SID>GuessCurrentCommentString(a:commentMode) + endif + else + let commentMode = 'G' + let cms = <SID>GuessCurrentCommentString(0) + endif + let n = a:beg + while n <= a:end + let m = indent(n) + 1 + let le = col('$') + while m < le + let syntaxName = synIDattr(synID(n, m, 1), 'name') + if syntaxName =~ g:tcommentFileTypesRx + let ft = substitute(syntaxName, g:tcommentFileTypesRx, '\1', '') + return <SID>GetCustomCommentString(ft, a:commentMode, cms) + elseif syntaxName == '' || syntaxName == 'None' || syntaxName =~ '^\u\+$' || syntaxName =~ '^\u\U*$' + let m = m + 1 + else + break + endif + endwh + let n = n + 1 + endwh + return <SID>RecordCMS(cms, commentMode) +endf + +fun! <SID>GuessCurrentCommentString(commentMode) + let valid_cms = (stridx(&commentstring, '%s') != -1) + if &commentstring != s:defaultCommentString && valid_cms + " The &commentstring appears to have been set and to be valid + return &commentstring + endif + if &comments != s:defaultComments + " the commentstring is the default one, so we assume that it wasn't + " explicitly set; we then try to reconstruct &cms from &comments + let cms = <SID>ConstructFromComments(a:commentMode) + if cms != s:nullCommentString + return cms + endif + endif + if valid_cms + " Before &commentstring appeared not to be set. As we don't know + " better we return it anyway if it is valid + return &commentstring + else + " &commentstring is invalid. So we return the identity string. + return s:nullCommentString + endif +endf + +fun! <SID>ConstructFromComments(commentMode) + exec <SID>ExtractCommentsPart('') + if a:commentMode == 'G' && line != '' + return line .' %s' + endif + exec <SID>ExtractCommentsPart('s') + if s != '' + exec <SID>ExtractCommentsPart('e') + " if a:commentMode + " exec <SID>ExtractCommentsPart("m") + " if m != "" + " let m = "\n". m + " endif + " return s.'%s'.e.m + " else + return s.' %s '.e + " endif + endif + if line != '' + return line .' %s' + else + return s:nullCommentString + endif +endf + +fun! <SID>ExtractCommentsPart(key) + " let key = a:key != "" ? a:key .'[^:]*' : "" + let key = a:key . '[bnflrxO0-9-]*' + let val = substitute(&comments, '^\(.\{-},\)\{-}'. key .':\([^,]\+\).*$', '\2', '') + if val == &comments + let val = '' + else + let val = substitute(val, '%', '%%', 'g') + endif + let var = a:key == '' ? 'line' : a:key + return 'let '. var .'="'. escape(val, '"') .'"' +endf + +" <SID>GetCustomCommentString(ft, commentMode, ?default="") +" => RecordCMS +fun! <SID>GetCustomCommentString(ft, commentMode, ...) + let commentMode = a:commentMode + let customComment = exists('g:tcomment_'. a:ft) + if commentMode ==# 'B' && exists('g:tcomment_'. a:ft .'_block') + let cms = g:tcomment_{a:ft}_block + elseif commentMode ==# 'I' && exists('g:tcomment_'. a:ft .'_inline') + let cms = g:tcomment_{a:ft}_inline + elseif customComment + let cms = g:tcomment_{a:ft} + let commentMode = 'G' + elseif a:0 >= 1 + let cms = a:1 + let commentMode = 'G' + else + let cms = '' + let commentMode = 'G' + endif + return <SID>RecordCMS(cms, commentMode) +endf + +fun! <SID>RecordCMS(cms, commentMode) + return 'let cms="'. escape(a:cms, '"') .'" | let commentMode="'. a:commentMode .'"' +endf + +fun! <SID>BlockGetCommentString(cms) + return substitute(a:cms, '\n.*$', '', '') +endf + +fun! <SID>BlockGetMiddleString(cms) + let rv = substitute(a:cms, '^.\{-}\n\([^\n]*\)', '\1', '') + return rv == a:cms ? '' : rv +endf + +finish + + +----------------------------------------------------------------------- +History + +0.1 +- Initial release + +0.2 +- Fixed uncommenting of non-aligned comments +- improved support for block comments (with middle lines and indentation) +- using TCommentBlock for file types that don't have block comments creates +single line comments +- removed the TCommentAsBlock command (TCommentAs provides its functionality) +- removed g:tcommentSetCMS +- the default key bindings have slightly changed + +1.3 +- slightly improved recognition of embedded syntax +- if no commentstring is defined in whatever way, reconstruct one from +&comments +- The TComment... commands now have bang variants that don't act as toggles +but always comment out the selected text +- fixed problem with commentstrings containing backslashes +- comment as visual block (allows commenting text to the right of the main +text, i.e., this command doesn't work on whole lines but on the text to the +right of the cursor) +- enable multimode for dsl, vim filetypes +- added explicit support for some other file types I ran into + +1.4 +- Fixed problem when &commentstring was invalid (e.g. lua) +- perl_block by Kyosuke Takayama. +- <c-_>s mapped to :TCommentAs <c-r>=&ft<cr> + +1.5 +- "Inline" visual comments (uses the &filetype_inline style if +available; doesn't check if the filetype actually supports this kind of +comments); tComment can't currently deduce inline comment styles from +&comments or &commentstring (I personally hardly ever use them); default +map: <c-_>i or <c-_>I +- In visual mode: if the selection spans several lines, normal mode is +selected; if the selection covers only a part of one line, inline mode +is selected +- Fixed problem with lines containing ^M or ^@ characters. +- It's no longer necessary to call TCommentCollectFileTypes() after +defining a new filetype via TCommentDefineType() +- Disabled single <c-_> mappings +- Renamed TCommentVisualBlock to TCommentRight +- FIX: Forgot 'x' in ExtractCommentsPart() (thanks to Fredrik Acosta) + diff --git a/vimfiles/plugin/vimballPlugin.vim b/vimfiles/plugin/vimballPlugin.vim new file mode 100644 index 0000000..9b3b4d3 --- /dev/null +++ b/vimfiles/plugin/vimballPlugin.vim @@ -0,0 +1,36 @@ +" vimballPlugin : construct a file containing both paths and files +" Author: Charles E. Campbell, Jr. +" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. +" The VIM LICENSE applies to Vimball.vim, and Vimball.txt +" (see |copyright|) except use "Vimball" instead of "Vim". +" No warranty, express or implied. +" *** *** Use At-Your-Own-Risk! *** *** +" +" (Rom 2:1 WEB) Therefore you are without excuse, O man, whoever you are who +" judge. For in that which you judge another, you condemn yourself. For +" you who judge practice the same things. +" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_vimballPlugin") + finish +endif +let g:loaded_vimballPlugin = 1 +let s:keepcpo = &cpo +set cpo&vim + +" ------------------------------------------------------------------------------ +" Public Interface: {{{1 +com! -ra -complete=dir -na=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>) +com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>) +com! -na=0 VimballList call vimball#Vimball(0) +com! -na=* -complete=dir RmVimball call vimball#RmVimball(<f-args>) +au BufEnter *.vba.gz,*.vba.bz2,*.vba.zip call vimball#Decompress(expand("<amatch>")) +au BufEnter *.vba set noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)") + +" ===================================================================== +" Restoration And Modelines: {{{1 +" vim: fdm=marker +let &cpo= s:keepcpo +unlet s:keepcpo diff --git a/vimfiles/plugin/visincr.vim b/vimfiles/plugin/visincr.vim new file mode 100644 index 0000000..8361e42 --- /dev/null +++ b/vimfiles/plugin/visincr.vim @@ -0,0 +1,864 @@ +" visincr.vim: Visual-block incremented lists +" Author: Charles E. Campbell, Jr. Ph.D. +" Date: Sep 19, 2006 +" Version: 17 +" +" Visincr assumes that a block of numbers selected by a +" ctrl-v (visual block) has been selected for incrementing. +" This function will transform that block of numbers into +" an incrementing column starting from that topmost number +" in the visual block. Also handles dates, daynames, and +" monthnames. +" +" Fancy Stuff: +" * If the visual block is ragged right (as can happen when "$" +" is used to select the right hand side), the block will have +" spaces appended to straighten it out +" * If the strlen of the count exceeds the visual-block +" allotment of spaces, then additional spaces will be inserted +" * Handles leading tabs by using virtual column calculations +" GetLatestVimScripts: 670 1 :AutoInstall: visincr.vim +" 1Cor 16:14 : Let all that you do be done in love. {{{1 + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_visincr") + finish +endif +let s:keepcpo = &cpo +let g:loaded_visincr = "v17" +set cpo&vim + +" --------------------------------------------------------------------- +" Methods: {{{1 +let s:I = 0 +let s:II = 1 +let s:IMDY = 2 +let s:IYMD = 3 +let s:IDMY = 4 +let s:ID = 5 +let s:IM = 6 +let s:IA = 7 +let s:IX = 8 +let s:IIX = 9 +let s:IO = 10 +let s:IIO = 11 +let s:IR = 12 +let s:IIR = 13 +let s:RI = 14 +let s:RII = 15 +let s:RIMDY = 16 +let s:RIYMD = 17 +let s:RIDMY = 18 +let s:RID = 19 +let s:RIM = 20 + +" ------------------------------------------------------------------------------ +" Options: {{{1 +if !exists("g:visincr_leaddate") + " choose between dates such as 11/ 5/04 and 11/05/04 + let g:visincr_leaddate = '0' +endif +if !exists("g:visincr_datedivset") + let g:visincr_datedivset= '[-./]' +endif + +" ============================================================================== +" Functions: {{{1 + +" ------------------------------------------------------------------------------ +" VisBlockIncr: {{{2 +fun! visincr#VisBlockIncr(method,...) +" call Dfunc("VisBlockIncr(method<".a:method.">) a:0=".a:0) + + " avoid problems with user options {{{3 + call s:SaveUserOptions() + + " visblockincr only uses visual-block! {{{3 +" call Decho("visualmode<".visualmode().">") + if visualmode() != "\<c-v>" + echoerr "Please use visual-block mode (ctrl-v)!" + call s:RestoreUserOptions() +" call Dret("VisBlockIncr") + return + endif + + " save boundary line numbers and set up method {{{3 + let y1 = line("'<") + let y2 = line("'>") + let method = (a:method >= s:RI)? a:method - s:RI : a:method + let leaddate= g:visincr_leaddate + + " get increment (default=1) {{{3 + if a:0 > 0 + let incr= a:1 + if a:method == s:IX || a:method == s:IIX + let incr= s:Hex2Dec(incr) + elseif a:method == s:IO || a:method == s:IIO + let incr= s:Oct2Dec(incr) + endif + else + let incr= 1 + endif +" call Decho("incr=".incr) + + " set up restriction pattern {{{3 + let leftcol = virtcol("'<") + let rghtcol = virtcol("'>") + if leftcol > rghtcol + let leftcol = virtcol("'>") + let rghtcol = virtcol("'<") + endif + let width= rghtcol - leftcol + 1 +" call Decho("width= [rghtcol=".rghtcol."]-[leftcol=".leftcol."]+1=".width) + + if a:method == s:RI + let restrict= '\%'.col(".").'c\d' +" call Decho(":I restricted<".restrict.">") + + elseif a:method == s:RII + let restrict= '\%'.col(".").'c\s\{,'.width.'}\d' +" call Decho(":II restricted<".restrict.">") + + elseif a:method == s:RIMDY + let restrict= '\%'.col(".").'c\d\{1,2}'.g:visincr_datedivset.'\d\{1,2}'.g:visincr_datedivset.'\d\{2,4}' +" call Decho(":IMDY restricted<".restrict.">") + + elseif a:method == s:RIYMD + let restrict= '\%'.col(".").'c\d\{2,4}'.g:visincr_datedivset.'\d\{1,2}'.g:visincr_datedivset.'\d\{1,2}' +" call Decho(":IYMD restricted<".restrict.">") + + elseif a:method == s:RIDMY + let restrict= '\%'.col(".").'c\d\{1,2}'.g:visincr_datedivset.'\d\{1,2}'.g:visincr_datedivset.'\d\{2,4}' +" call Decho(":IDMY restricted<".restrict.">") + + elseif a:method == s:RID + if exists("g:visincr_dow") + let dowlist = substitute(g:visincr_dow,'\(\a\{1,3}\)[^,]*\%(,\|$\)','\1\\|','ge') + let dowlist = substitute(dowlist,'\\|$','','e') + let restrict= '\c\%'.col(".").'c\('.substitute(dowlist,',','\\|','ge').'\)' +" call Decho("restrict<".restrict.">") + else + let restrict= '\c\%'.col(".").'c\(mon\|tue\|wed\|thu\|fri\|sat\|sun\)' + endif +" call Decho(":ID restricted<".restrict.">") + + elseif a:method == s:RIM + if exists("g:visincr_month") + let monlist = substitute(g:visincr_month,'\(\a\{1,3}\)[^,]*\%(,\|$\)','\1\\|','ge') + let monlist = substitute(monlist,'\\|$','','e') + let restrict= '\c\%'.col(".").'c\('.substitute(monlist,',','\\|','ge').'\)' +" call Decho("restrict<".restrict.">") + else + let restrict= '\c\%'.col(".").'c\(jan\|feb\|mar\|apr\|may\|jun\|jul\|aug\|sep\|oct\|nov\|dec\)' + endif +" call Decho(":IM restricted<".restrict.">") + endif + + " determine zfill {{{3 +" call Decho("a:0=".a:0." method=".method) + if a:0 > 1 && ((s:IMDY <= method && method <= s:IDMY) || (s:RIMDY <= method && method <= s:RIDMY)) + let leaddate= a:2 +" call Decho("set leaddate<".leaddate.">") + elseif a:0 > 1 && method + let zfill= a:2 + if zfill == "''" || zfill == '""' + let zfill="" + endif +" call Decho("set zfill<".zfill.">") + else + " default zfill (a single space) + let zfill= ' ' +" call Decho("set default zfill<".zfill.">") + endif + + " IMDY IYMD IDMY ID IM IA: {{{3 + if s:IMDY <= method && method <= s:IA + let rghtcol = rghtcol + 1 + let curline = getline("'<") + + " ID: {{{3 + if method == s:ID + let pat = '^.*\%'.leftcol.'v\(\a\+\)\%'.rghtcol.'v.*$' + let dow = substitute(substitute(curline,pat,'\1','e'),' ','','ge') + let dowlen = strlen(dow) +" call Decho("pat<".pat."> dow<".dow."> dowlen=".dowlen) + + " set up long daynames + if exists("g:visincr_dow") + let dow_0= substitute(g:visincr_dow,'^\([^,]*\),.*$', '\1','') + let dow_1= substitute(g:visincr_dow,'^\%([^,]*,\)\{1}\([^,]*\),.*$','\1','') + let dow_2= substitute(g:visincr_dow,'^\%([^,]*,\)\{2}\([^,]*\),.*$','\1','') + let dow_3= substitute(g:visincr_dow,'^\%([^,]*,\)\{3}\([^,]*\),.*$','\1','') + let dow_4= substitute(g:visincr_dow,'^\%([^,]*,\)\{4}\([^,]*\),.*$','\1','') + let dow_5= substitute(g:visincr_dow,'^\%([^,]*,\)\{5}\([^,]*\),.*$','\1','') + let dow_6= substitute(g:visincr_dow,'^\%([^,]*,\)\{6}\([^,]*\)$', '\1','') + else + let dow_0= "Monday" + let dow_1= "Tuesday" + let dow_2= "Wednesday" + let dow_3= "Thursday" + let dow_4= "Friday" + let dow_5= "Saturday" + let dow_6= "Sunday" + endif + + " if the daynames under the cursor is <= 3, transform + " long daynames to short daynames + if strlen(dow) <= 3 +" call Decho("transform long daynames to short daynames") + let dow_0= strpart(dow_0,0,3) + let dow_1= strpart(dow_1,0,3) + let dow_2= strpart(dow_2,0,3) + let dow_3= strpart(dow_3,0,3) + let dow_4= strpart(dow_4,0,3) + let dow_5= strpart(dow_5,0,3) + let dow_6= strpart(dow_6,0,3) + endif + + " identify day-of-week under cursor + let idow= 0 + while idow < 7 +" call Decho("dow<".dow."> dow_".idow."<".dow_{idow}.">") + if dow =~ '\c\<'.strpart(dow_{idow},0,3) + break + endif + let idow= idow + 1 + endwhile + if idow >= 7 + echoerr "***error*** misspelled day-of-week <".dow.">" + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : unable to identify day-of-week") + return + endif + + " generate incremented dayname list + norm! `< + norm! gUl + norm! `< + let l = y1 + while l < y2 + norm! j +" call Decho("while [l=".l."] < [y2=".y2."]: line=".line(".")." col[".leftcol.",".rghtcol."] width=".width) + if exists("restrict") && getline(".") !~ restrict + let l= l + 1 + continue + endif + let idow= (idow + incr)%7 + exe 's/\%'.leftcol.'v.\{'.width.'\}/'.dow_{idow}.'/e' + let l= l + 1 + endw + " return from ID + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : ID") + return + endif + + " IM: {{{3 + if method == s:IM + let pat = '^.*\%'.leftcol.'v\(\a\+\)\%'.rghtcol.'v.*$' + let mon = substitute(substitute(curline,pat,'\1','e'),' ','','ge') + let monlen = strlen(mon) + if exists("g:visincr_month") + let mon_0 = substitute(g:visincr_month,'^\([^,]*\),.*$', '\1','') + let mon_1 = substitute(g:visincr_month,'^\%([^,]*,\)\{1}\([^,]*\),.*$', '\1','') + let mon_2 = substitute(g:visincr_month,'^\%([^,]*,\)\{2}\([^,]*\),.*$', '\1','') + let mon_3 = substitute(g:visincr_month,'^\%([^,]*,\)\{3}\([^,]*\),.*$', '\1','') + let mon_4 = substitute(g:visincr_month,'^\%([^,]*,\)\{4}\([^,]*\),.*$', '\1','') + let mon_5 = substitute(g:visincr_month,'^\%([^,]*,\)\{5}\([^,]*\),.*$', '\1','') + let mon_6 = substitute(g:visincr_month,'^\%([^,]*,\)\{6}\([^,]*\),.*$', '\1','') + let mon_7 = substitute(g:visincr_month,'^\%([^,]*,\)\{7}\([^,]*\),.*$', '\1','') + let mon_8 = substitute(g:visincr_month,'^\%([^,]*,\)\{8}\([^,]*\),.*$', '\1','') + let mon_9 = substitute(g:visincr_month,'^\%([^,]*,\)\{9}\([^,]*\),.*$', '\1','') + let mon_10= substitute(g:visincr_month,'^\%([^,]*,\)\{10}\([^,]*\),.*$','\1','') + let mon_11= substitute(g:visincr_month,'^\%([^,]*,\)\{11}\([^,]*\)$', '\1','') + else + let mon_0 = "January" + let mon_1 = "February" + let mon_2 = "March" + let mon_3 = "April" + let mon_4 = "May" + let mon_5 = "June" + let mon_6 = "July" + let mon_7 = "August" + let mon_8 = "September" + let mon_9 = "October" + let mon_10= "November" + let mon_11= "December" + endif + + " identify month under cursor + let imon= 0 + while imon < 12 + if mon =~ '\c\<'.strpart(mon_{imon},0,3) + break + endif + let imon= imon + 1 + endwhile + if imon >= 12 + echoerr "***error*** misspelled month <".mon.">" + call s:RestoreUserOptions() +" call Dret("VisBlockIncr") + return + endif + + " if monthname is three or fewer characters long, + " transform monthnames to three character versions + if strlen(mon) <= 3 +" call Decho("transform monthnames to short versions") + let jmon= 0 + while jmon < 12 + let mon_{jmon} = strpart(mon_{jmon},0,3) + let jmon = jmon + 1 + endwhile + endif + + " generate incremented monthname list + norm! `< + norm! gUl + norm! `< + let l = y1 + while l < y2 + norm! j + if exists("restrict") && getline(".") !~ restrict + let l= l + 1 + continue + endif + let imon= (imon + incr)%12 + exe 's/\%'.leftcol.'v.\{'.width.'\}/'.mon_{imon}.'/e' + let l= l + 1 + endw + " return from IM + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : IM") + return + endif + + " IA: {{{3 + if method == s:IA + let pat = '^.*\%'.leftcol.'v\(\a\).*$' + let letter = substitute(curline,pat,'\1','e') + if letter !~ '\a' + let letter= 'A' + endif + if letter =~ '[a-z]' + let alphabet='abcdefghijklmnopqrstuvwxyz' + else + let alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ' + endif + let ilet= stridx(alphabet,letter) + + norm! `< + let l = y1 + while l <= y2 +" call Decho("letter<".letter."> l=".l." ilet=".ilet) + exe 's/\%'.leftcol.'v.*\%'.rghtcol.'v/'.letter.'/e' + let ilet = (ilet + incr)%26 + let letter = strpart(alphabet,ilet,1) + if l < y2 + silent norm! j + endif + let l= l + 1 + endw + " return from IA + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : IA") + return + endif + + let pat = '^.*\%'.leftcol.'v\( \=[0-9]\{1,4}\)'.g:visincr_datedivset.'\( \=[0-9]\{1,2}\)'.g:visincr_datedivset.'\( \=[0-9]\{1,4}\)\%'.rghtcol.'v.*$' + let datediv= substitute(curline,'^.*\%'.leftcol.'v\%( \=[0-9]\{1,4}\)\('.g:visincr_datedivset.'\).*$','\1','') +" call Decho("datediv<".datediv.">") + + " IMDY: {{{3 + if method == s:IMDY + let m = substitute(substitute(curline,pat,'\1',''),' ','','ge')+0 + let d = substitute(substitute(curline,pat,'\2',''),' ','','ge')+0 + let y = substitute(substitute(curline,pat,'\3',''),' ','','ge')+0 + let type = 2 +" call Decho("IMDY: y=".y." m=".m." d=".d." leftcol=".leftcol." rghtcol=".rghtcol) + + " IYMD: {{{3 + elseif method == s:IYMD + let y = substitute(substitute(curline,pat,'\1',''),' ','','ge')+0 + let m = substitute(substitute(curline,pat,'\2',''),' ','','ge')+0 + let d = substitute(substitute(curline,pat,'\3',''),' ','','ge')+0 + let type = 1 +" call Decho("IYMD: y=".y." m=".m." d=".d." leftcol=".leftcol." rghtcol=".rghtcol) + + " IDMY: {{{3 + elseif method == s:IDMY + let d = substitute(substitute(curline,pat,'\1',''),' ','','ge')+0 + let m = substitute(substitute(curline,pat,'\2',''),' ','','ge')+0 + let y = substitute(substitute(curline,pat,'\3',''),' ','','ge')+0 + let type = 3 +" call Decho("IDMY: y=".y." m=".m." d=".d." leftcol=".leftcol." rghtcol=".rghtcol) + else + echoerr "***error*** in <visincr.vim> script" +" call Dret("VisBlockIncr -- method#".method." not supported") + return + endif + + " Julian day/Calendar day calculations {{{3 + try + let julday= calutil#Cal2Jul(y,m,d) + catch /^Vim\%((\a\+)\)\=:E/ + echoerr "***error*** you need calutil.vim! (:help visincr-calutil)" +" call Dret("VisBlockIncr") + return + endtry + norm! `< + let l = y1 + while l <= y2 + if exists("restrict") && getline(".") !~ restrict + norm! j + let l= l + 1 + continue + endif + let doy = calutil#Jul2Cal(julday,type) + + " IYMD: {{{3 + if type == 1 + let doy = substitute(doy,'^\d/',leaddate.'&','e') + let doy = substitute(doy,'/\(\d/\)','/'.leaddate.'\1','e') + let doy = substitute(doy,'/\(\d\)$','/'.leaddate.'\1','e') + + " IMDY IDMY: {{{3 + else + let doy = substitute(doy,'^\d/',' &','e') + let doy = substitute(doy,'/\(\d/\)','/'.leaddate.'\1','e') + let doy = substitute(doy,'/\(\d\)$','/'.leaddate.'\1','e') + endif + + " use user's date divider + if datediv != '/' + let doy= substitute(doy,'/',datediv,'g') + else + let doy= escape(doy,'/') + endif +" call Decho("doy<".doy.">") + + if leaddate != ' ' + let doy= substitute(doy,' ',leaddate,'ge') + endif +" call Decho('exe s/\%'.leftcol.'v.*\%'.rghtcol.'v/'.doy.'/e') + exe 's/\%'.leftcol.'v.*\%'.rghtcol.'v/'.doy.'/e' + let l = l + 1 + let julday= julday + incr + if l <= y2 + norm! j + endif + endw + call s:RestoreUserOptions() +" call Dret("VisBlockIncr : IMDY IYMD IDMY ID IM") + return + endif " IMDY IYMD IDMY ID IM + + " I II IX IIX IO IIO IR IIR: {{{3 + " construct a line from the first line that only has the number in it + let rml = rghtcol - leftcol + let rmlp1 = rml + 1 + let lm1 = leftcol - 1 +" call Decho("rmlp1=[rghtcol=".rghtcol."]-[leftcol=".leftcol."]+1=".rmlp1) +" call Decho("lm1 =[leftcol=".leftcol."]-1=".lm1) + + if lm1 <= 0 + " region beginning at far left +" call Decho("handle visblock at far left") + let lm1 = 1 + let pat = '^\([0-9 \t]\{1,'.rmlp1.'}\).*$' + if method == s:IX || method == s:IIX + let pat = '^\([0-9a-fA-F \t]\{1,'.rmlp1.'}\).*$' + elseif method == s:IR || method == s:IIR + if getline(".") =~ '^\(.\{-}\)\%'.leftcol.'v\([0-9 \t]\{1,'.rmlp1.'}\).*$' + " need to convert arabic notation to roman numeral + let pat = '^\([0-9IVXCLM) \t]\{1,'.rmlp1.'}\).*$' + else + let pat = '^\([IVXCLM) \t]\{1,'.rmlp1.'}\).*$' + endif + else + let pat = '^\([0-9 \t]\{1,'.rmlp1.'}\).*$' + endif + let cnt = substitute(getline("'<"),pat,'\1',"") + + else + " region not beginning at far left +" call Decho("handle visblock not at far left") + if method == s:IX || method == s:IIX + let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-9a-fA-F \t]\{1,'.rmlp1.'}\).*$' + elseif method == s:IO || method == s:IIO + let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-7 \t]\{1,'.rmlp1.'}\).*$' + elseif method == s:IR || method == s:IIR +" call Decho('test: ^\(.\{-}\)\%'.leftcol.'v\([0-9 \t]\{1,'.rmlp1.'}\).*$') + if getline(".") =~ '^\(.\{-}\)\%'.leftcol.'v\([0-9 \t]\{1,'.rmlp1.'}\).*$' + " need to convert arabic notation to roman numeral + let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-9IVXCLM \t]\{1,'.rmlp1.'}\).*$' + else + let pat = '^\(.\{-}\)\%'.leftcol.'v\([IVXCLM \t]\{1,'.rmlp1.'}\).*$' + endif + else + let pat = '^\(.\{-}\)\%'.leftcol.'v\([0-9 \t]\{1,'.rmlp1.'}\).*$' + endif +" call Decho("pat<".pat.">") + let cnt = substitute(getline("'<"),pat,'\2',"") + endif + + let cntlen = strlen(cnt) + let cnt = substitute(cnt,'\s','',"ge") + let ocnt = cnt +" call Decho("cntlen=".cntlen." cnt=".cnt." ocnt=".ocnt." (before I*[XOR] subs)") + + if method == s:IX || method == s:IIX + let cnt= substitute(cnt,'^0*\([1-9a-fA-F]\|0$\)','\1',"ge") + elseif method == s:IO || method == s:IIO + let cnt= substitute(cnt,'^0*\([1-7]\|0$\)','\1',"ge") + elseif method == s:IR || method == s:IIR + let cnt= substitute(cnt,'^\([IVXCLM]$\)','\1',"ge") + else + let cnt= substitute(cnt,'^0*\([1-9]\|0$\)','\1',"ge") + endif +" call Decho("cnt<".cnt."> pat<".pat.">") + + " left-method with zeros {{{3 + " IF top number is zero-mode + " AND we're justified right + " AND increment is positive + " AND user didn't specify a modeding character + if a:0 < 2 && ( method == s:II || method == s:IIX || method == s:IIO) && cnt != ocnt && incr > 0 + let zfill= '0' + endif + + " determine how much incrementing is needed {{{3 + if method == s:IX || method == s:IIX + let maxcnt= s:Dec2Hex(s:Hex2Dec(cnt) + incr*(y2 - y1)) + elseif method == s:IO || method == s:IIO + let maxcnt= s:Dec2Oct(s:Oct2Dec(cnt) + incr*(y2 - y1)) + elseif method == s:IR || method == s:IIR + if cnt =~ '^\d\+$' + let maxcnt= s:Dec2Rom(cnt + incr*(y2 - y1)) + else + let maxcnt= s:Dec2Rom(s:Rom2Dec(cnt) + incr*(y2 - y1)) + endif + else + let maxcnt= printf("%d",cnt + incr*(y2 - y1)) + endif + let maxcntlen= strlen(maxcnt) + if cntlen > maxcntlen + let maxcntlen= cntlen + endif + if method == s:IIR + let maxcntlen= maxcntlen + 2 + endif +" call Decho("maxcnt=".maxcnt." maxcntlen=".maxcntlen) + + " go through visual block incrementing numbers based {{{3 + " on first number (saved in cnt), taking care to + " avoid inadvertently issuing "0h" commands. + " l == current line number, over range [y1,y2] + norm! `< + let l = y1 + if (method == s:IR || method == s:IIR) && cnt =~ '^\d\+$' + let cnt= s:Dec2Rom(cnt) + endif + while l <= y2 +" call Decho("----- while [l=".l."] <= [y2=".y2."]: cnt=".cnt) + if exists("restrict") && getline(".") !~ restrict +" call Decho("skipping <".getline(".")."> (restrict)") + norm! j + let l= l + 1 + continue + endif + let cntlen= strlen(cnt) + + " Straighten out ragged-right visual-block selection {{{3 + " by appending spaces as needed + norm! $ + while virtcol("$") <= rghtcol + exe "norm! A \<Esc>" + endwhile + norm! 0 + + " convert visual block line to all spaces {{{3 + if virtcol(".") != leftcol + exe 'norm! /\%'.leftcol."v\<Esc>" + endif + exe "norm! " . rmlp1 . "r " + + " cnt has gotten bigger than the visually-selected {{{3 + " area allows. Will insert spaces to accommodate it. + if maxcntlen > 0 + let ins= maxcntlen - rmlp1 + else + let ins= strlen(cnt) - rmlp1 + endif + while ins > 0 + exe "norm! i \<Esc>" + let ins= ins - 1 + endwhile + + " back up to left-of-block (plus optional left-hand-side modeling) {{{3 + norm! 0 + if method == s:I || method == s:IO || method == s:IX || method == s:IR + let bkup= leftcol +" call Decho("bkup= [leftcol=".leftcol."] (due to method)") + elseif maxcntlen > 0 + let bkup= leftcol + maxcntlen - cntlen +" call Decho("bkup= [leftcol=".leftcol."]+[maxcntlen=".maxcntlen."]-[cntlen=".cntlen."]=".bkup) + else + let bkup= leftcol +" call Decho("bkup= [leftcol=".leftcol."] ([maxcntlen=".maxcntlen."]<=0)") + endif + if virtcol(".") != bkup + if bkup == 0 + norm! 0 + else + exe 'norm! /\%'.bkup."v\<Esc>" + endif + endif + + " replace with count {{{3 +" call Decho("exe norm! R" . cnt . "\<Esc>") + exe "norm! R" . cnt . "\<Esc>" + if cntlen > 1 + let cntlenm1= cntlen - 1 + exe "norm! " . cntlenm1 . "h" + endif + if zfill != " " + silent! exe 's/\%'.leftcol.'v\( \+\)/\=substitute(submatch(1)," ","'.zfill.'","ge")/e' + endif + + " set up for next line {{{3 + if l != y2 + norm! j + endif + if method == s:IX || method == s:IIX + let cnt= s:Dec2Hex(s:Hex2Dec(cnt) + incr) + elseif method == s:IO || method == s:IIO + let cnt= s:Dec2Oct(s:Oct2Dec(cnt) + incr) + elseif method == s:IR || method == s:IIR + let cnt= s:Dec2Rom(s:Rom2Dec(cnt) + incr) + else + let cnt= cnt + incr + endif + let l = l + 1 + endw + + " restore options: {{{3 + call s:RestoreUserOptions() +" call Dret("VisBlockIncr") +endfun + +" --------------------------------------------------------------------- +" Hex2Dec: convert hexadecimal to decimal {{{2 +fun! s:Hex2Dec(hex) +" call Dfunc("Hex2Dec(hex=".a:hex.")") + let hex= substitute(string(a:hex),"'","","ge") +" call Decho("hex<".hex.">") + if hex =~ '^-' + let n = strpart(hex,1) + let neg = 1 + else + let n = hex + let neg = 0 + endif +" call Decho("n<".n."> neg=".neg) + + let b10 = 0 + while n != "" + let hexdigit= strpart(n,0,1) + if hexdigit =~ '\d' + let hexdigit= char2nr(hexdigit) - char2nr('0') +" call Decho("0-9: hexdigit=".hexdigit) + elseif hexdigit =~ '[a-f]' + let hexdigit= char2nr(hexdigit) - char2nr('a') + 10 +" call Decho("a-f: hexdigit=".hexdigit) + else + let hexdigit= char2nr(hexdigit) - char2nr('A') + 10 +" call Decho("A-F: hexdigit=".hexdigit) + endif + let b10= 16*b10 + hexdigit + let n = strpart(n,1) + endwhile + + if neg + let b10= -b10 + endif +" call Dret("Hex2Dec ".b10) + return b10 +endfun + +" --------------------------------------------------------------------- +" Dec2Hex: convert decimal to hexadecimal {{{2 +fun! s:Dec2Hex(b10) +" call Dfunc("Dec2Hex(b10=".a:b10.")") + if a:b10 >= 0 + let b10 = a:b10 + let neg = 0 + else + let b10 = -a:b10 + let neg = 1 + endif +" call Decho('b10<'.b10.'> neg='.neg) + if v:version >= 700 + let hex= printf("%x",b10) + else + let hex = "" + while b10 + let hex = '0123456789abcdef'[b10 % 16] . hex + let b10 = b10 / 16 + endwhile + endif + if neg + let hex= "-".hex + endif +" call Dret("Dec2Hex ".hex) + return hex +endfun + +" --------------------------------------------------------------------- +" Oct2Dec: convert octal to decimal {{{2 +fun! s:Oct2Dec(oct) +" call Dfunc("Oct2Dec(oct=".a:oct.")") + if a:oct >= 0 + let n = a:oct + let neg= 0 + else + let n = strpart(a:oct,1) + let neg = 1 + endif + + let b10 = 0 + while n != "" + let octdigit= strpart(n,0,1) + if octdigit =~ '[0-7]' + let octdigit= char2nr(octdigit) - char2nr('0') +" call Decho("octdigit=".octdigit) + else + break + endif + let b10= 8*b10 + octdigit + let n = strpart(n,1) + endwhile + + if neg + let b10= -b10 + endif +" call Dret("Oct2Dec ".b10) + return b10 +endfun + +" --------------------------------------------------------------------- +" Dec2Oct: convert decimal to octal {{{2 +fun! s:Dec2Oct(b10) +" call Dfunc("Dec2Oct(b10=".a:b10.")") + if a:b10 >= 0 + let b10 = a:b10 + let neg = 0 + else + let b10 = -a:b10 + let neg = 1 + endif + + if v:version >= 700 + let oct= printf("%o",b10) + else + let oct = "" + while b10 + let oct = '01234567'[b10 % 8] . oct + let b10 = b10 / 8 + endwhile + endif + + if neg + let oct= "-".oct + endif +" call Dret("Dec2Oct ".oct) + return oct +endfun + +" ------------------------------------------------------------------------------ +" Roman Numeral Support: {{{2 +let s:d2r= [ [ 1000000 , 'M)' ],[900000 , 'CM)' ], [500000 , 'D)' ], [400000 , 'CD)' ], [100000 , 'C)' ], [90000 , 'XC)' ], [50000 , 'L)' ], [40000 , 'XL)' ], [10000 , 'X)' ], [9000 , 'IX)'], [5000 , 'V)'], [1000 , 'M' ], [900 , 'CM'], [500 , 'D'], [400 , 'CD'], [100 , 'C'], [90 , 'XC'], [50 , 'L'], [40 , 'XL'], [10 , 'X'], [9 , 'IX'], [5 , 'V'], [4 , 'IV'], [1 , 'I'] ] + +" --------------------------------------------------------------------- +" Rom2Dec: convert roman numerals to a decimal number {{{2 +fun! s:Rom2Dec(roman) +" call Dfunc("Rom2Dec(".a:roman.")") + let roman = substitute(a:roman,'.','\U&','ge') + let dec = 0 + + while roman != '' + for item in s:d2r + let pat= '^'.item[1] + if roman =~ pat + let dec= dec + item[0] + if strlen(item[1]) > 1 + let roman= strpart(roman,strlen(item[1])-1) + endif + break + endif + endfor + let roman= strpart(roman,1) + endwhile + +" call Dret("Rom2Dec ".dec) + return dec +endfun + +" --------------------------------------------------------------------- +" Dec2Rom: convert a decimal number to roman numerals {{{2 +" Note that since there is no zero or negative integers +" using Roman numerals, attempts to convert such will always +" result in "I". +fun! s:Dec2Rom(dec) +" call Dfunc("Dec2Rom(".a:dec.")") + if a:dec > 0 + let roman = "" + let dec = a:dec + let i = 0 + while dec > 0 + while dec >= s:d2r[i][0] + let dec = dec - s:d2r[i][0] + let roman = roman . s:d2r[i][1] + endwhile + let i= i + 1 + endwhile + else + let roman= "I" + endif +" call Dret("Dec2Rom ".roman) + return roman +endfun + +" --------------------------------------------------------------------- +" SaveUserOptions: {{{2 +fun! s:SaveUserOptions() +" call Dfunc("SaveUserOptions()") + let s:fokeep = &fo + let s:gdkeep = &gd + let s:ickeep = &ic + let s:magickeep = &magic + let s:reportkeep= &report + set fo=tcq magic report=9999 noic nogd +" call Dret("SaveUserOptions") +endfun + +" --------------------------------------------------------------------- +" RestoreUserOptions: {{{2 +fun! s:RestoreUserOptions() +" call Dfunc("RestoreUserOptions()") + let &fo = s:fokeep + let &gd = s:gdkeep + let &ic = s:ickeep + let &magic = s:magickeep + let &report= s:reportkeep +" call Dret("RestoreUserOptions") +endfun + +" --------------------------------------------------------------------- +" Restoration: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo +" ------------------------------------------------------------------------------ +" Modelines: {{{1 +" vim: ts=4 fdm=marker diff --git a/vimfiles/plugin/visincrPlugin.vim b/vimfiles/plugin/visincrPlugin.vim new file mode 100644 index 0000000..66c0918 --- /dev/null +++ b/vimfiles/plugin/visincrPlugin.vim @@ -0,0 +1,73 @@ +" visincrPlugin.vim: Visual-block incremented lists +" Author: Charles E. Campbell, Jr. Ph.D. +" Date: Jul 18, 2006 +" Public Interface Only +" +" (James 2:19,20 WEB) You believe that God is one. You do well! +" The demons also believe, and shudder. +" But do you want to know, vain man, that +" faith apart from works is dead? + +" --------------------------------------------------------------------- +" Load Once: {{{1 +if &cp || exists("g:loaded_visincrPlugin") + finish +endif +let g:loaded_visincrPlugin = 1 +let s:keepcpo = &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Methods: {{{1 +let s:I = 0 +let s:II = 1 +let s:IMDY = 2 +let s:IYMD = 3 +let s:IDMY = 4 +let s:ID = 5 +let s:IM = 6 +let s:IA = 7 +let s:IX = 8 +let s:IIX = 9 +let s:IO = 10 +let s:IIO = 11 +let s:IR = 12 +let s:IIR = 13 +let s:RI = 14 +let s:RII = 15 +let s:RIMDY = 16 +let s:RIYMD = 17 +let s:RIDMY = 18 +let s:RID = 19 +let s:RIM = 20 + +" ------------------------------------------------------------------------------ +" Public Interface: {{{1 +com! -ra -complete=expression -na=? I call visincr#VisBlockIncr(s:I , <f-args>) +com! -ra -complete=expression -na=* II call visincr#VisBlockIncr(s:II , <f-args>) +com! -ra -complete=expression -na=* IMDY call visincr#VisBlockIncr(s:IMDY , <f-args>) +com! -ra -complete=expression -na=* IYMD call visincr#VisBlockIncr(s:IYMD , <f-args>) +com! -ra -complete=expression -na=* IDMY call visincr#VisBlockIncr(s:IDMY , <f-args>) +com! -ra -complete=expression -na=? ID call visincr#VisBlockIncr(s:ID , <f-args>) +com! -ra -complete=expression -na=? IM call visincr#VisBlockIncr(s:IM , <f-args>) +com! -ra -complete=expression -na=? IA call visincr#VisBlockIncr(s:IA , <f-args>) +com! -ra -complete=expression -na=? IX call visincr#VisBlockIncr(s:IX , <f-args>) +com! -ra -complete=expression -na=? IIX call visincr#VisBlockIncr(s:IIX , <f-args>) +com! -ra -complete=expression -na=? IO call visincr#VisBlockIncr(s:IO , <f-args>) +com! -ra -complete=expression -na=? IIO call visincr#VisBlockIncr(s:IIO , <f-args>) +com! -ra -complete=expression -na=? IR call visincr#VisBlockIncr(s:IR , <f-args>) +com! -ra -complete=expression -na=? IIR call visincr#VisBlockIncr(s:IIR , <f-args>) + +com! -ra -complete=expression -na=? RI call visincr#VisBlockIncr(s:RI , <f-args>) +com! -ra -complete=expression -na=* RII call visincr#VisBlockIncr(s:RII , <f-args>) +com! -ra -complete=expression -na=* RIMDY call visincr#VisBlockIncr(s:RIMDY, <f-args>) +com! -ra -complete=expression -na=* RIYMD call visincr#VisBlockIncr(s:RIYMD, <f-args>) +com! -ra -complete=expression -na=* RIDMY call visincr#VisBlockIncr(s:RIDMY, <f-args>) +com! -ra -complete=expression -na=? RID call visincr#VisBlockIncr(s:RID , <f-args>) +com! -ra -complete=expression -na=? RIM call visincr#VisBlockIncr(s:RIM , <f-args>) + +" --------------------------------------------------------------------- +" Restoration And Modelines: {{{1 +" vim: ts=4 fdm=marker +let &cpo= s:keepcpo +unlet s:keepcpo diff --git a/vimfiles/syntax/netrw.vim b/vimfiles/syntax/netrw.vim new file mode 100644 index 0000000..6415c46 --- /dev/null +++ b/vimfiles/syntax/netrw.vim @@ -0,0 +1,71 @@ +" Language : Netrw Remote-Directory Listing Syntax +" Maintainer : Charles E. Campbell, Jr. +" Last change: Nov 27, 2006 +" Version : 9 +" --------------------------------------------------------------------- + +" Syntax Clearing: {{{1 +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" --------------------------------------------------------------------- +" Directory List Syntax Highlighting: {{{1 +syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion + +syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify +syn match netrwDir "\.\{1,2}/" contains=netrwClassify +syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify +syn match netrwDir "^\S*/" contains=netrwClassify +syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" contains=netrwDateSep skipwhite nextgroup=netrwTime +syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify +syn match netrwExe "\%(\S\+ \)*\S\+\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify,netrwTreeIgnore +syn match netrwTreeIgnore contained "^\%(| \)*" + +syn match netrwClassify "[*=|@/]\ze\%(\s\{2,}\|$\)" contained +syn match netrwDateSep "/" contained +syn match netrwTime "\d\{1,2}:\d\{2}:\d\{2}" contained contains=netrwTimeSep +syn match netrwTimeSep ":" + +syn match netrwComment '".*\%(\t\|$\)' contains=@NetrwGroup +syn match netrwHide '^"\s*\(Hid\|Show\)ing:' skipwhite nextgroup=netrwHidePat +syn match netrwSlash "/" contained +syn match netrwHidePat "[^,]\+" contained skipwhite nextgroup=netrwHideSep +syn match netrwHideSep "," contained transparent skipwhite nextgroup=netrwHidePat +syn match netrwSortBy "Sorted by" contained transparent skipwhite nextgroup=netrwList +syn match netrwSortSeq "Sort sequence:" contained transparent skipwhite nextgroup=netrwList +syn match netrwList ".*$" contained contains=netrwComma +syn match netrwComma "," contained +syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd keepend contained +syn match netrwHelpCmd "\S\ze:" contained skipwhite nextgroup=netrwCmdSep +syn match netrwCmdSep ":" contained nextgroup=netrwCmdNote +syn match netrwCmdNote ".\{-}\ze " contained +syn match netrwVersion "(netrw.*)" contained + +" --------------------------------------------------------------------- +" Highlighting Links: {{{1 +if !exists("did_drchip_dbg_syntax") + let did_drchip_netrwlist_syntax= 1 + hi link netrwClassify Function + hi link netrwCmdSep Delimiter + hi link netrwComment Comment + hi link netrwDir Directory + hi link netrwHelpCmd Function + hi link netrwHidePat Statement + hi link netrwList Statement + hi link netrwVersion Identifier + hi link netrwSymLink Special + hi link netrwExe PreProc + hi link netrwDateSep Delimiter + + hi link netrwTimeSep netrwDateSep + hi link netrwComma netrwComment + hi link netrwHide netrwComment +endif + +" Current Syntax: {{{1 +let b:current_syntax = "netrwlist" +" --------------------------------------------------------------------- +" vim: ts=8 fdm=marker diff --git a/vimfiles/syntax/scons.vim b/vimfiles/syntax/scons.vim new file mode 100644 index 0000000..0b63f9c --- /dev/null +++ b/vimfiles/syntax/scons.vim @@ -0,0 +1,75 @@ +" Vim syntax file +" Language: SConscript +" Maintainer: Xi Wang <xi.wang@gmail.com> +" Last Change: 2006 Nov 15 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Read the Python syntax to start with +if version < 600 + so <sfile>:p:h/python.vim +else + runtime! syntax/python.vim + unlet b:current_syntax +endif + +" SConscript extentions +syn keyword sconsTarget CFile CXXFile DVI Jar Java JavaH +syn keyword sconsTarget Library LoadableModule M4 Moc +syn keyword sconsTarget MSVSProject MSVSSolution Object +syn keyword sconsTarget PCH PDF PostScript Program +syn keyword sconsTarget RES RMIC RPCGenClient RPCGenHeader +syn keyword sconsTarget RPCGenService RPCGenXDR +syn keyword sconsTarget SharedLibrary SharedObject +syn keyword sconsTarget StaticLibrary StaticObject +syn keyword sconsTarget Tar TypeLibrary Uic Zip +syn keyword sconsEnv Action AddPostAction AddPreAction +syn keyword sconsEnv Alias AlwaysBuild Append AppendENVPath +syn keyword sconsEnv AppendUnique BitKeeper +syn keyword sconsEnv BuildDir Builder CacheDir Clean +syn keyword sconsEnv Command Configure Clone Copy CVS +syn keyword sconsEnv Default DefaultEnvironment +syn keyword sconsEnv Depends Dictionary Dir Dump +syn keyword sconsEnv EnsurePythonVersion EnsureSConsVersion +syn keyword sconsEnv Environment Execute Exit Export +syn keyword sconsEnv File FindFile Flatten +syn keyword sconsEnv GetBuildPath GetLaunchDir GetOption +syn keyword sconsEnv Help Ignore Import Install InstallAs +syn keyword sconsEnv Literal Local MergeFlags NoClean +syn keyword sconsEnv ParseConfig ParseDepends ParseFlags +syn keyword sconsEnv Preforce Platform Precious +syn keyword sconsEnv Prepend PrependENVPath PrependUnique +syn keyword sconsEnv RCS Replace Repository Return +syn keyword sconsEnv Scanner SCCS SConscript SConscriptChdir +syn keyword sconsEnv SConsignFile SetDefault SetOption +syn keyword sconsEnv SideEffect SourceCode SourceSignatures +syn keyword sconsEnv Split TargetSignatures Tool +syn keyword sconsEnv Value WhereIs +syn keyword sconsConf Configure Finish +syn keyword sconsConf CheckCHeader CheckCXXHeader CheckFun +syn keyword sconsConf CheckLib CheckLibWithHeader CheckType +syn keyword sconsOpt Options +syn match sconsVar /\<[A-Z_][A-Z0-9_]\+\>/ + +" Default highlighting +if version >= 508 || !exists("did_scons_syntax_inits") + if version < 508 + let did_scons_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + HiLink sconsTarget Keyword + HiLink sconsEnv Function + HiLink sconsConf Function + HiLink sconsOpt Function + HiLink sconsVar Special + delcommand HiLink +endif + +let b:current_syntax = "scons" +" vim: ts=8 diff --git a/vimfiles/syntax/srec.vim b/vimfiles/syntax/srec.vim new file mode 100644 index 0000000..632975f --- /dev/null +++ b/vimfiles/syntax/srec.vim @@ -0,0 +1,68 @@ +" Vim syntax file +" Language: Motorola S record +" Maintainer: slimzhao <vim2004@21cn.com> +" Last Change: 2004 May 31 +" License: This file is placed in the public domain. + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn case ignore + +" storage types + +"[Addr [DataCount [RecType]] ] +syn match srecChecksum /[0-9a-fA-F]\{2}\r\?$/ +syn match DataCount /^S[0-357-9][0-9a-fA-F]\{2}/ contains=RecType contained +syn match RecType /^S[0-357-9]/ contained +syn match S0Addr /^S0[0-9a-fA-F]\{6}/ contains=DataCount +syn match S1Addr /^S1[0-9a-fA-F]\{6}/ contains=DataCount +syn match S2Addr /^S2[0-9a-fA-F]\{8}/ contains=DataCount +syn match S3Addr /^S3[0-9a-fA-F]\{10}/ contains=DataCount +"syn match S5Addr /^S5[0-9a-fA-F]\{6}/ +syn match S7Addr /^S7[0-9a-fA-F]\{10}/ contains=DataCount +syn match S8Addr /^S8[0-9a-fA-F]\{8}/ contains=DataCount +syn match S9Addr /^S9[0-9a-fA-F]\{6}/ contains=DataCount + +syn case match + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_srec_syntax_inits") + if version < 508 + let did_srec_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + " The default methods for highlighting. Can be overridden later + "Address, Hex link Addr to Comment, while DataCount to Constant, for + "S-record, the RecType and DataCount field is adjacent, and their color is + "similar, so we swap it for more eyeable. + HiLink S1Addr Constant + HiLink S2Addr Constant + HiLink S3Addr Constant + "StartAddress + HiLink S7Addr MoreMsg + HiLink S8Addr MoreMsg + HiLink S9Addr MoreMsg + "Record type + HiLink RecType WarningMsg + "Checksum + HiLink srecChecksum Search + "Data count + HiLink DataCount Comment + + delcommand HiLink +endif + +let b:current_syntax = "srec" + +" vim: ts=8