Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version 1.3

- basic ctags support (see |viki-tags|)
- mini-ftplugin for bibtex files (use record labels as anchors)
- added mapping <LocalLeader><c-cr>: follow link in other window (if any)
- disabled the highlighting of italic char styles (i.e., /text/)
- the ftplugin doesn't set deplate as the compiler; renamed the compiler plugin to deplate
- fix: VikiFoldLevel()
  • Loading branch information...
commit b357c6c3e145a9a81a97009a45cddbe4c466b847 1 parent 35d05ce
@tomtom tomtom authored committed
View
36 compiler/deplate.vim
@@ -0,0 +1,36 @@
+" viki.vim
+" @Author: Thomas Link (samul AT web.de)
+" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
+" @Created: 25-Apr-2004.
+" @Last Change: 20-Mai-2004.
+" @Revision: 0.28
+"
+" Description:
+" Use deplate as the "compiler" for viki files.
+"
+
+let g:current_compiler="deplate"
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+fun! DeplateSetCompiler(options)
+ if exists("b:deplatePrg")
+ exec "setlocal makeprg=".escape(b:deplatePrg ." ". a:options, " ")."\\ $*\\ %"
+ elseif exists("g:deplatePrg")
+ exec "setlocal makeprg=".escape(g:deplatePrg ." ". a:options, " ")."\\ $*\\ %"
+ else
+ exec "setlocal makeprg=deplate ".escape(a:options, " ")."\\ $*\\ %"
+ " setlocal makeprg=deplate\ $*\ %
+ endif
+endfun
+command! -nargs=* DeplateSetCompiler call DeplateSetCompiler(<q-args>)
+
+DeplateSetCompiler
+
+setlocal errorformat=%f\ %l:%m,%f\ %l-%*\\d:%m
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: ff=unix
View
28 compiler/viki.vim
@@ -1,28 +0,0 @@
-" viki.vim
-" @Author: Thomas Link (samul AT web.de)
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 25-Apr-2004.
-" @Last Change: 02-Mai-2004.
-" @Revision: 0.20
-"
-" Description:
-" Use deplate as the "compiler" for viki files.
-"
-
-let g:current_compiler="viki"
-
-let s:cpo_save = &cpo
-set cpo&vim
-
-if exists("g:deplatePrg")
- exec "setlocal makeprg=".escape(g:deplatePrg, " ")."\\ $*\\ %"
-else
- setlocal makeprg=deplate\ $*\ %
-endif
-
-setlocal errorformat=%f\ %l:%m,%f\ %l-%*\\d:%m
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
-
-" vim: ff=unix
View
132 doc/viki.txt
@@ -8,15 +8,30 @@
*viki-description*
Description~
-This plugin adds wiki-like hypertext capabilities to any document. Just
-type |:VikiMinorMode| and all wiki names will be highlighted. If you press
-<c-cr> when the cursor is over a wiki name, you jump to (or create) the
-referred page.
-
-When invoked as a "minor" mode, viki is just an addon to other filetypes. If
-you want to write a viki-only document, set |'filetype'| to "viki". The "full"
-mode provides folding support, additional highlighting for headings, lists,
-tables, textstyles etc.
+This plugin adds wiki-like hypertext capabilities to Vim. You can use viki as
+a "minor" mode (i.e., as an add-on to any other mode) or as a full-fledged
+wiki mode. There is also an add-on plugin for "wikifying" latex documents by
+turning some latex commands into wiki names. If viki is properly configured,
+activating a reference to an image, a webpage etc. will view that resource in
+an external viewer.
+
+From http://sourceforge.net/projects/deplate/ you can download a ruby based
+tool to convert viki markup to html or latex. On its homepage
+(http://deplate.sf.net) you can read a more detailled specification of the
+markup.
+
+MINOR WIKI MODE:
+Just type |:VikiMinorMode| and all wiki names and URLs will be highlighted.
+When the cursor is over a wiki name, you can press <c-cr> to jump to (or
+create) the referred page. Pressing <LocalLeader>vb brings you back to the
+original document. Alternatively, you can use <m-leftmouse> and <m-rightmouse>
+to jump back and forth.
+
+FULL WIKI MODE:
+Set 'filetype' to viki or execute |:VikiMode|. The full wiki mode is like the
+minor mode but with folding support, syntax highlighting (for headings, lists,
+tables, textstyles etc.), and additional key bindings (i.e., you can press
+<c-tab> or <s-c-tab> to move the cursor to the next/previous viki name).
================================================================================
@@ -28,14 +43,41 @@ and run |:helptags| on that directory.
Customization: *viki-customization*
It's probably a good idea to check the values of the following variables:
- - |g:vikiTypewriterFont| (see |viki-textstyles|)
- - |g:vikiHeadingFont| (see |viki-headings|)
- - |g:vikiUpperCharacters| and |g:vikiLowerCharacters|
-as well as:
- - |g:vikiUseParentSuffix| (see |viki-names|)
+
+ - |g:vikiUpperCharacters| and |g:vikiLowerCharacters|; for German
+ character set these variables to something like: >
+
+ " this is in iso-latin-1
+ let g:vikiLowerCharacters = "a-z��������������"
+ let g:vikiUpperCharacters = "A-Z���"
+<
+ - |g:vikiUseParentSuffix| (see |viki-names|); I personally prefer this to
+ be ON >
+
+ let g:vikiUseParentSuffix = 1
+<
- |vikiNameTypes|
-Additionally, you can use the following variables to change viki's behaviour:
+Also, you might need to configure some external programs like in this example:
+>
+ let g:vikiOpenUrlWith_mailto = 'thunderbird -compose %{URL}'
+ let g:vikiOpenFileWith_ANY = "silent !start %{FILE}"
+
+Later on, you might also like to define some intervikis: >
+
+ let g:vikiInterSCI = $HOME ."/Projects/Sci/Ideas"
+ let g:vikiInterSCI_suffix = ".txt"
+
+In order to use the LaTeX enabled viki variant, add this to your .vimrc file: >
+
+ au FileType tex let b:vikiFamily="LaTeX"
+
+In order to automatically set |deplate| as the compiler for viki files: >
+
+ " we want to allow deplate to execute ruby code and external helper
+ " application
+ let g:deplatePrg = "deplate -x -X "
+ au FileType viki compiler deplate
If the variables b:getVikiLink or b:getExtVikiLink exist, their values are
used as function names for returning the current viki name's definition. A
@@ -46,6 +88,11 @@ If the variables b:editVikiPage or b:createVikiPage exist, their values are
interpreted as _command_ names for editing readable or creating new wiki
pages.
+For a better highlighting of viki files, also check out these two variables:
+
+ - |g:vikiTypewriterFont| (see |viki-textstyles|)
+ - |g:vikiHeadingFont| (see |viki-headings|)
+
===============================================================================
*viki-requirements*
@@ -326,7 +373,7 @@ Short list of available macros (see also |deplate|):
- Example: >
Foo bar{fn: x} foo bar.
- #Fn x <<EOF
+ #Fn: x <<EOF
Bla bla.
EOF
< - {cite: ID}
@@ -360,7 +407,7 @@ Backslashes~
vikification of the following character.
- A backslash should itself be escaped by a backslash.
-\_nounderline_, No\Viki\Name
+\_nounderline_, \NoVikiName
================================================================================
@@ -597,6 +644,16 @@ Viki Compile~
The compile plugin simply defines |deplate| as the current file's |makeprg|.
It also provides basic support for |deplate|'s error messages.
+The compiler plugin provides a command for setting compiler options:
+
+ - DeplateSetCompiler [FLAGS]
+
+E.g. when using the lvimrc plugin, you could put something like this into the
+current directorie's .lvimrc-file for putting the output into a dedicated
+directory: >
+
+ DeplateSetCompiler -d ../html
+
================================================================================
*viki-latex* *vikiLatex*
@@ -606,7 +663,7 @@ The archiv includes an experimental add-on for using LaTeX commands as simple
wiki names. Among the commands that are to some degree used as hyperlinks or
anchors:
- - \viki[anchor]{name]
+ - \viki[anchor]{name}
- \input
- \include
- \usepackage
@@ -657,6 +714,43 @@ simple minded example: >
================================================================================
+ *viki-bibtex*
+Viki BibTeX~
+
+The bibtex ftplugin defines record labels as anchors. Thus, if make an
+interviki definition point to your bib files you can refer to bib entries as
+viki names. Example: >
+
+ let g:vikiInterBIB = $HOME ."/local/share/texmf/bibtex/bib/tml"
+ let g:vikiInterBIB_suffix = ".bib"
+
+ Then, activating the following viki name
+ BIB::[-monos-]#rec02
+ would open the file monos.bib and search for the record rec02.
+
+
+================================================================================
+ *viki-tags*
+Ctags~
+
+For ctags support (e.g. in conjunction with taglist) add this to your .ctags
+file (this assumes that *.txt files are in viki mode or modify the file suffix
+if necessary): >
+
+ --langdef=deplate
+ --langmap=deplate:.txt
+ --regex-deplate=/^(\*+ .+)/\1/s,structure/
+ --regex-deplate=/^(#[a-z][a-z0-9]+)/\1/s,structure/
+ --regex-deplate=/\[\[[^\]]+\]\[([^\]]+)\]\]/\1/r,reference/
+ --regex-deplate=/\[\[([^\]]+)\]\]/\1/r,reference/
+ --regex-deplate=/([A-Z][a-z]+([A-Z][a-z]+)+)/\1/r,reference/
+ --regex-deplate=/([a-z]+:\/\/[A-Za-z0-9.:%?=&_~@\/|-]+)/\1/u,url/
+
+For use with taglist, the variable "tlist_viki_settings" is already set for
+you -- references are not displayed by default.
+
+
+================================================================================
*deplate*
Deplate~
@@ -678,6 +772,6 @@ references, an autogenerated index etc.
--
(the following is adapted from latex-suite.txt)
-vim:ft=help:fdm=expr:tw=78:ff=unix
+vim:ft=help:fdm=expr:tw=78
vim:foldexpr=getline(v\:lnum-2)=~"=\\\\{80,}"?"a1"\:(getline(v\:lnum+1)=~"=\\\\{80,}"?"s1"\:"=")
vim:foldtext=v\:folddashes.substitute(getline(v\:foldstart),"\\\\s*\\\\*.*","","")
View
10 ftplugin/bib/viki.vim
@@ -0,0 +1,10 @@
+" viki.vim -- Make adaptions for bibtex
+" @Author: Thomas Link (samul AT web.de)
+" @Website: http://members.a1.net/t.link/
+" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
+" @Created: 28-Jul-2004.
+" @Last Change: 28-Jul-2004.
+" @Revision: 0.7
+
+let b:vikiAnchorRx = '\^\c\s\*@\[a-z]\+\s\*{\s\*%{ANCHOR}\s\*,\.\*\$'
+
View
17 ftplugin/viki.vim
@@ -2,8 +2,8 @@
" @Author: Thomas Link (samul AT web.de)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 12-Jän-2004.
-" @Last Change: 02-Mai-2004.
-" @Revision: 10
+" @Last Change: 17-Mai-2004.
+" @Revision: 13
if exists("b:did_ftplugin")
finish
@@ -19,12 +19,23 @@ exe "setlocal comments=:". b:vikiCommentStart
setlocal foldmethod=expr
setlocal foldexpr=VikiFoldLevel(v:lnum)
+fun! VikiFoldLevel(lnum)
+ " let head = matchend(getline(a:lnum), '\V\^'. escape(b:vikiHeadingStart, '\') .'\ze\s\+')
+ let head = matchend(getline(a:lnum), '\V\^'. b:vikiHeadingStart .'\+\ze\s\+')
+ if head > 0
+ return ">". head
+ else
+ " return foldlevel(a:lnum - 1)
+ return "="
+ endif
+endfun
+
if !hasmapto(":VikiFind")
nnoremap <buffer> <c-tab> :VikiFindNext<cr>
nnoremap <buffer> <c-s-tab> :VikiFindPrev<cr>
endif
-compiler viki
+" compiler viki
let b:vikiEnabled = 2
View
164 plugin/viki.vim
@@ -2,8 +2,8 @@
" @Author: Thomas Link (samul AT web.de)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 08-Dec-2003.
-" @Last Change: 04-Mai-2004.
-" @Revision: 1.2.103
+" @Last Change: 03-Aug-2004.
+" @Revision: 1.3.67
"
" Short Description:
" This plugin adds wiki-like hypertext capabilities to any document. Just type
@@ -23,7 +23,7 @@
" Change Log: (See bottom of file)
"
-if &cp || exists("s:loaded_viki")
+if &cp || exists("s:loaded_viki") "{{{2
finish
endif
let s:loaded_viki = 1
@@ -34,45 +34,49 @@ let g:vikiDefSep = '
let s:vikiSelfEsc = '\'
let g:vikiSelfRef = '.'
-if !exists("g:vikiLowerCharacters")
+if !exists("tlist_viki_settings") "{{{2
+ let tlist_viki_settings="deplate;s:structure"
+endif
+
+if !exists("g:vikiLowerCharacters") "{{{2
let g:vikiLowerCharacters = "a-z"
endif
-if !exists("g:vikiUpperCharacters")
+if !exists("g:vikiUpperCharacters") "{{{2
let g:vikiUpperCharacters = "A-Z"
endif
-if !exists("g:vikiSpecialProtocols")
+if !exists("g:vikiSpecialProtocols") "{{{2
let g:vikiSpecialProtocols = 'https\?\|ftps\?\|nntp\|mailto\|mailbox'
endif
-if !exists("g:vikiSpecialProtocolsExceptions")
+if !exists("g:vikiSpecialProtocolsExceptions") "{{{2
let g:vikiSpecialProtocolsExceptions = ""
endif
-if !exists("g:vikiSpecialFiles")
+if !exists("g:vikiSpecialFiles") "{{{2
let g:vikiSpecialFiles = 'jpg\|gif\|bmp\|pdf\|dvi\|ps\|eps\|png\|jpeg\|wmf'
endif
-if !exists("g:vikiSpecialFilesExceptions")
+if !exists("g:vikiSpecialFilesExceptions") "{{{2
let g:vikiSpecialFilesExceptions = ""
endif
-if !exists("g:vikiMapMouse") | let g:vikiMapMouse = 1 | endif
-if !exists("g:vikiUseParentSuffix") | let g:vikiUseParentSuffix = 0 | endif
-if !exists("g:vikiAnchorMarker") | let g:vikiAnchorMarker = "#" | endif
-if !exists("g:vikiNameTypes") | let g:vikiNameTypes = "csSeui" | endif
-if !exists("g:vikiSaveHistory") | let g:vikiSaveHistory = 0 | endif
-if !exists("g:vikiExplorer") | let g:vikiExplorer = "Sexplore" | endif
+if !exists("g:vikiMapMouse") | let g:vikiMapMouse = 1 | endif "{{{2
+if !exists("g:vikiUseParentSuffix") | let g:vikiUseParentSuffix = 0 | endif "{{{2
+if !exists("g:vikiAnchorMarker") | let g:vikiAnchorMarker = "#" | endif "{{{2
+if !exists("g:vikiNameTypes") | let g:vikiNameTypes = "csSeui" | endif "{{{2
+if !exists("g:vikiSaveHistory") | let g:vikiSaveHistory = 0 | endif "{{{2
+if !exists("g:vikiExplorer") | let g:vikiExplorer = "Sexplore" | endif "{{{2
-if !exists("g:vikiOpenFileWith_ANY") && has("win32")
+if !exists("g:vikiOpenFileWith_ANY") && has("win32") "{{{2
let g:vikiOpenFileWith_ANY = "silent !cmd /c start %{FILE}"
endif
-if !exists("*VikiOpenSpecialFile")
- fun! VikiOpenSpecialFile(file)
+if !exists("*VikiOpenSpecialFile") "{{{2
+ fun! VikiOpenSpecialFile(file) "{{{3
let proto = tolower(matchstr(a:file, '\c\.\zs[a-z]\+$'))
- let prot = "g:vikiOpenFileWith_". proto
+ let prot = "g:vikiOpenFileWith_". proto
let protp = exists(prot)
if !protp
let prot = "g:vikiOpenFileWith_ANY"
@@ -87,9 +91,9 @@ if !exists("*VikiOpenSpecialFile")
endfun
endif
-if !exists("g:vikiOpenUrlWith_mailbox")
+if !exists("g:vikiOpenUrlWith_mailbox") "{{{2
let g:vikiOpenUrlWith_mailbox="call VikiOpenMailbox('%{URL}')"
- fun! VikiOpenMailbox(url)
+ fun! VikiOpenMailbox(url) "{{{3
exec <SID>DecodeFileUrl(strpart(a:url, 10))
let idx = matchstr(args, 'number=\zs\d\+$')
if filereadable(filename)
@@ -100,9 +104,9 @@ if !exists("g:vikiOpenUrlWith_mailbox")
endfun
endif
-if !exists("g:vikiOpenUrlWith_file")
+if !exists("g:vikiOpenUrlWith_file") "{{{2
let g:vikiOpenUrlWith_file="call VikiOpenFileUrl('%{URL}')"
- fun! VikiOpenFileUrl(url)
+ fun! VikiOpenFileUrl(url) "{{{3
exec <SID>DecodeFileUrl(strpart(a:url, 6))
if filereadable(filename)
call <SID>VikiOpenLink(filename, anchor)
@@ -112,12 +116,12 @@ if !exists("g:vikiOpenUrlWith_file")
endfun
endif
-if !exists("g:vikiOpenUrlWith_ANY") && has("win32")
+if !exists("g:vikiOpenUrlWith_ANY") && has("win32") "{{{2
let g:vikiOpenUrlWith_ANY = "silent !rundll32 url.dll,FileProtocolHandler %{URL}"
endif
-if !exists("*VikiOpenSpecialProtocol")
- fun! VikiOpenSpecialProtocol(url)
+if !exists("*VikiOpenSpecialProtocol") "{{{2
+ fun! VikiOpenSpecialProtocol(url) "{{{3
let proto = tolower(matchstr(a:url, '\c^[a-z]\{-}\ze:'))
let prot = "g:vikiOpenUrlWith_". proto
let protp = exists(prot)
@@ -134,7 +138,7 @@ if !exists("*VikiOpenSpecialProtocol")
endfun
endif
-fun! <SID>AddToRegexp(regexp, pattern)
+fun! <SID>AddToRegexp(regexp, pattern) "{{{3
if a:pattern == ""
return a:regexp
elseif a:regexp == ""
@@ -144,7 +148,7 @@ fun! <SID>AddToRegexp(regexp, pattern)
endif
endfun
-fun! <SID>VikiFind(flag)
+fun! <SID>VikiFind(flag) "{{{3
let rx = <SID>AddToRegexp("", b:vikiSimpleNameSimpleRx)
let rx = <SID>AddToRegexp(rx, b:vikiExtendedNameSimpleRx)
let rx = <SID>AddToRegexp(rx, b:vikiUrlSimpleRx)
@@ -156,7 +160,7 @@ endfun
command! VikiFindNext call <SID>VikiFind("")
command! VikiFindPrev call <SID>VikiFind("b")
-fun! VikiSetBufferVar(name, ...)
+fun! VikiSetBufferVar(name, ...) "{{{3
if !exists("b:".a:name)
if a:0 > 0
let i = 1
@@ -178,7 +182,7 @@ fun! VikiSetBufferVar(name, ...)
endif
endfun
-fun! <SID>VikiLetVar(name, var)
+fun! <SID>VikiLetVar(name, var) "{{{3
if exists("b:".a:var)
return "let ".a:name." = b:".a:var
elseif exists("g:".a:var)
@@ -188,7 +192,7 @@ fun! <SID>VikiLetVar(name, var)
endif
endfun
-fun! VikiDispatchOnFamily(fn, ...)
+fun! VikiDispatchOnFamily(fn, ...) "{{{3
if exists("b:vikiFamily")
let fam = b:vikiFamily
elseif exists("g:vikiFamily")
@@ -218,7 +222,7 @@ fun! VikiDispatchOnFamily(fn, ...)
exe "return ". cmd . "(" . args . ")"
endfun
-fun! VikiSetupBuffer(state, ...)
+fun! VikiSetupBuffer(state, ...) "{{{3
" let noMatch = '\%0l' "match nothing
let noMatch = ""
let dontSetup = a:0 > 0 ? a:1 : ""
@@ -300,7 +304,7 @@ fun! VikiSetupBuffer(state, ...)
endif
endfun
-fun! VikiDefineMarkup(state)
+fun! VikiDefineMarkup(state) "{{{3
if b:vikiNameTypes =~# "s" && b:vikiSimpleNameRx != ""
exe "syn match vikiLink /" . b:vikiSimpleNameRx . "/"
endif
@@ -312,7 +316,7 @@ fun! VikiDefineMarkup(state)
endif
endfun
-fun! VikiDefineHighlighting(state)
+fun! VikiDefineHighlighting(state) "{{{3
if version < 508
command! -nargs=+ VikiHiLink hi link <args>
else
@@ -340,7 +344,7 @@ fun! VikiDefineHighlighting(state)
endfun
"state ... 0, +/-1, +/-2
-fun! VikiMinorMode(state)
+fun! VikiMinorMode(state) "{{{3
if exists("b:VikiEnabled") && b:VikiEnabled
if a:state == 0
throw "Viki can't be disabled (not yet)."
@@ -372,6 +376,8 @@ fun! VikiMinorMode(state)
"inoremap <buffer> <c-cr> <c-r>=VikiMaybeFollowLink(0)<cr>
nnoremap <buffer> <silent> <c-cr> :call VikiMaybeFollowLink(0,1)<cr>
inoremap <buffer> <silent> <c-cr> <c-o>:call VikiMaybeFollowLink(0,1)<cr>
+ nnoremap <buffer> <silent> <LocalLeader><c-cr> :call VikiMaybeFollowLink(0,1,1)<cr>
+ inoremap <buffer> <silent> <LocalLeader><c-cr> <c-o>:call VikiMaybeFollowLink(0,1,1)<cr>
if g:vikiMapMouse
nnoremap <buffer> <silent> <m-leftmouse> <leftmouse>:call VikiMaybeFollowLink(0,1)<cr>
inoremap <buffer> <silent> <m-leftmouse> <leftmouse><c-o>:call VikiMaybeFollowLink(0,1)<cr>
@@ -396,17 +402,7 @@ endfun
command! VikiMinorMode call VikiMinorMode(1)
command! VikiMinorModeMaybe call VikiMinorMode(-1)
-fun! VikiFoldLevel(lnum)
- let head = matchend(getline(a:lnum), '\V\^'. escape(b:vikiHeadingStart, '\') .'\ze\s\+')
- if head > 0
- return ">". head
- else
- " return foldlevel(a:lnum - 1)
- return "="
- endif
-endfun
-
-fun! VikiMode(state)
+fun! VikiMode(state) "{{{3
if exists("b:VikiEnabled")
if a:state == 0
throw "Viki can't be disabled (not yet)."
@@ -421,7 +417,7 @@ endfun
command! VikiMode call VikiMode(2)
command! VikiModeMaybe call VikiMode(-2)
-fun! <SID>AddVarToMultVal(var, val)
+fun! <SID>AddVarToMultVal(var, val) "{{{3
if exists(a:var)
exe "let i = MvIndexOfElement(". a:var .", '". g:vikiDefSep ."', ". a:val .")"
exe "let ". a:var ."=MvPushToFront(". a:var .", '". g:vikiDefSep ."', ". a:val .")"
@@ -432,7 +428,7 @@ fun! <SID>AddVarToMultVal(var, val)
endif
endfun
-fun! <SID>VikiSetBackRef(file, li, co)
+fun! <SID>VikiSetBackRef(file, li, co) "{{{3
let i = <SID>AddVarToMultVal("b:VikiBackFile", "'". a:file ."'")
if i >= 0
let b:VikiBackLine = MvPushToFrontElementAt(b:VikiBackLine, g:vikiDefSep, i)
@@ -443,7 +439,7 @@ fun! <SID>VikiSetBackRef(file, li, co)
endif
endfun
-fun! VikiSelect(array, seperator, queryString)
+fun! VikiSelect(array, seperator, queryString) "{{{3
let n = MvNumberOfElements(a:array, a:seperator)
if n == 1
return 0
@@ -474,13 +470,13 @@ fun! VikiSelect(array, seperator, queryString)
return -1
endfun
-fun! <SID>VikiSelectThisBackRef(n)
+fun! <SID>VikiSelectThisBackRef(n) "{{{3
return "let vbf = '". MvElementAt(b:VikiBackFile, g:vikiDefSep, a:n) ."'".
\ " | let vbl = ". MvElementAt(b:VikiBackLine, g:vikiDefSep, a:n) .
\ " | let vbc = ". MvElementAt(b:VikiBackCol, g:vikiDefSep, a:n)
endfun
-fun! <SID>VikiSelectBackRef(...)
+fun! <SID>VikiSelectBackRef(...) "{{{3
if exists("b:VikiBackFile") && exists("b:VikiBackLine") && exists("b:VikiBackCol")
if a:0 >= 1
let s = a:1
@@ -494,12 +490,12 @@ fun! <SID>VikiSelectBackRef(...)
return ""
endfun
-if g:vikiSaveHistory && exists("*GetPersistentVar") && exists("*PutPersistentVar")
- fun! VikiGetSimplifiedBufferName()
+if g:vikiSaveHistory && exists("*GetPersistentVar") && exists("*PutPersistentVar") "{{{2
+ fun! VikiGetSimplifiedBufferName() "{{{3
return substitute( expand("%:p"), "[^a-zA-Z0-9]", "_", "g")
endfun
- fun! VikiSaveBackReferences()
+ fun! VikiSaveBackReferences() "{{{3
if exists("b:VikiBackFile") && b:VikiBackFile != ""
call PutPersistentVar("VikiBackFile", VikiGetSimplifiedBufferName(), b:VikiBackFile)
call PutPersistentVar("VikiBackLine", VikiGetSimplifiedBufferName(), b:VikiBackLine)
@@ -507,7 +503,7 @@ if g:vikiSaveHistory && exists("*GetPersistentVar") && exists("*PutPersistentVar
endif
endfun
- fun! VikiRestoreBackReferences()
+ fun! VikiRestoreBackReferences() "{{{3
if exists("b:VikiEnabled") && !exists("b:VikiBackFile")
let b:VikiBackFile = GetPersistentVar("VikiBackFile", VikiGetSimplifiedBufferName(), "")
let b:VikiBackLine = GetPersistentVar("VikiBackLine", VikiGetSimplifiedBufferName(), "")
@@ -519,7 +515,7 @@ if g:vikiSaveHistory && exists("*GetPersistentVar") && exists("*PutPersistentVar
au BufLeave * call VikiSaveBackReferences()
endif
-fun! VikiGoBack(...)
+fun! VikiGoBack(...) "{{{3
let s = (a:0 >= 1) ? a:1 : -1
let br = <SID>VikiSelectBackRef(s)
if br == ""
@@ -540,7 +536,7 @@ fun! VikiGoBack(...)
endif
endfun
-fun! VikiSubstituteArgs(str, ...)
+fun! VikiSubstituteArgs(str, ...) "{{{3
let i = 1
let rv = a:str
while a:0 >= i
@@ -554,7 +550,7 @@ fun! VikiSubstituteArgs(str, ...)
return rv
endfun
-fun! VikiFindAnchor(anchor)
+fun! VikiFindAnchor(anchor) "{{{3
if a:anchor != g:vikiDefNil
let anchorRx = '\^'. b:vikiCommentStart .'\?'. b:vikiAnchorMarker . a:anchor
if exists("b:vikiAnchorRx")
@@ -565,9 +561,10 @@ fun! VikiFindAnchor(anchor)
endif
endfun
-fun! <SID>VikiOpenLink(filename, anchor, ...)
+fun! <SID>VikiOpenLink(filename, anchor, ...) "{{{3
let create = a:0 >= 1 ? a:1 : 0
let postcmd = a:0 >= 2 ? a:2 : ""
+ let split = a:0 >= 3 ? a:3 : 0
let li = line(".")
let co = col(".")
@@ -576,6 +573,9 @@ fun! <SID>VikiOpenLink(filename, anchor, ...)
" let buf = bufnr("^". simplify(a:filename) ."$")
let buf = bufnr("^". a:filename ."$")
" let buf = bufnr(a:filename)
+ if split
+ wincmd s
+ endif
if buf >= 0
exe "buffer ".buf
call <SID>VikiSetBackRef(fi, li, co)
@@ -597,7 +597,7 @@ fun! <SID>VikiOpenLink(filename, anchor, ...)
endif
endfun
-fun! <SID>DecodeFileUrl(dest)
+fun! <SID>DecodeFileUrl(dest) "{{{3
let dest = substitute(a:dest, '^\c/*\([a-z]\)|', '\1:', "")
let rv = ""
let i = 0
@@ -625,7 +625,8 @@ fun! <SID>DecodeFileUrl(dest)
return "let filename='". rv ."'|let anchor='". anchor ."'|let args='". args ."'"
endfun
-fun! <SID>VikiFollowLink(def)
+fun! <SID>VikiFollowLink(def, ...) "{{{3
+ let split = a:0 >= 1 ? a:1 : 0
let name = MvElementAt(a:def, g:vikiDefSep, 0)
let dest = MvElementAt(a:def, g:vikiDefSep, 1)
let anchor = MvElementAt(a:def, g:vikiDefSep, 2)
@@ -649,7 +650,7 @@ fun! <SID>VikiFollowLink(def)
\ !(dest =~ g:vikiSpecialFilesExceptions))
call VikiOpenSpecialFile(dest)
elseif filereadable(dest) "reference to a local, already existing file
- call <SID>VikiOpenLink(dest, anchor)
+ call <SID>VikiOpenLink(dest, anchor, 0, "", split)
elseif isdirectory(dest)
exe g:vikiExplorer ." ". dest
elseif input("File doesn't exists. Create '".dest."'? (Y/n) ") != "n"
@@ -660,7 +661,7 @@ fun! <SID>VikiFollowLink(def)
return ""
endfun
-fun! <SID>MakeVikiDefPart(txt)
+fun! <SID>MakeVikiDefPart(txt) "{{{3
if a:txt == ""
return g:vikiDefNil
else
@@ -668,7 +669,7 @@ fun! <SID>MakeVikiDefPart(txt)
endif
endfun
-fun! VikiMakeDef(name, dest, anchor)
+fun! VikiMakeDef(name, dest, anchor) "{{{3
if a:name =~ g:vikiDefSep || a:dest =~ g:vikiDefSep || a:anchor =~ g:vikiDefSep
throw "Viki: A viki definition must not include ".g:vikiDefSep
\ .": ".a:name.", ".a:dest.", ".a:anchor
@@ -680,7 +681,7 @@ fun! VikiMakeDef(name, dest, anchor)
endif
endfun
-fun! <SID>GetVikiNamePart(txt, erx, idx, errorMsg)
+fun! <SID>GetVikiNamePart(txt, erx, idx, errorMsg) "{{{3
if a:idx
let rv = substitute(a:txt, '^\C'. a:erx ."$", '\'.a:idx, "")
if rv == ""
@@ -693,7 +694,7 @@ fun! <SID>GetVikiNamePart(txt, erx, idx, errorMsg)
endif
endfun
-fun! <SID>GetVikiLink(erx, nameIdx, destIdx, anchorIdx, ignoreSyntax)
+fun! <SID>GetVikiLink(erx, nameIdx, destIdx, anchorIdx, ignoreSyntax) "{{{3
if a:erx != ""
let ebeg = -1
let col = col(".") - 1
@@ -725,7 +726,7 @@ fun! <SID>GetVikiLink(erx, nameIdx, destIdx, anchorIdx, ignoreSyntax)
endif
endfun
-fun! VikiExpandSimpleName(dest, name, suffix)
+fun! VikiExpandSimpleName(dest, name, suffix) "{{{3
if exists("b:vikiNameSuffix") && a:suffix == g:vikiDefSep
let dest = a:dest ."/". a:name.b:vikiNameSuffix
elseif g:vikiUseParentSuffix && a:suffix == g:vikiDefSep
@@ -741,7 +742,7 @@ fun! VikiExpandSimpleName(dest, name, suffix)
return dest
endfun
-fun! VikiCompleteSimpleNameDef(def)
+fun! VikiCompleteSimpleNameDef(def) "{{{3
let name = MvElementAt(a:def, g:vikiDefSep, 0)
if name == g:vikiDefNil
throw "Viki: Malformed simple viki name (no name): ".a:def
@@ -787,7 +788,7 @@ fun! VikiCompleteSimpleNameDef(def)
return VikiMakeDef(name, rdest, anchor)
endfun
-fun! VikiCompleteExtendedNameDef(def)
+fun! VikiCompleteExtendedNameDef(def) "{{{3
let name = MvElementAt(a:def, g:vikiDefSep, 0)
let dest = MvElementAt(a:def, g:vikiDefSep, 1)
let anchor = MvElementAt(a:def, g:vikiDefSep, 2)
@@ -811,7 +812,7 @@ fun! VikiCompleteExtendedNameDef(def)
return VikiMakeDef(name, dest, anchor)
endfun
-fun! <SID>VikiLinkNotFoundEtc(oldmap, ignoreSyntax)
+fun! <SID>VikiLinkNotFoundEtc(oldmap, ignoreSyntax) "{{{3
if a:oldmap == ""
echomsg "Viki: Show me the way to the next viki name or I have to ... ".a:ignoreSyntax.":".getline(".")
elseif a:oldmap == 1
@@ -828,7 +829,8 @@ endfun
" ignoreSyntax: If there isn't a viki syntax group under the cursor:
" 0 ... no viki name found
" 1 ... try to find a viki name matching a the viki regexp
-fun! VikiMaybeFollowLink(oldmap, ignoreSyntax)
+fun! VikiMaybeFollowLink(oldmap, ignoreSyntax, ...) "{{{3
+ let split = a:0 >= 1 ? a:1 : 0
let synName = synIDattr(synID(line('.'),col('.'),0),"name")
if synName ==# "vikiLink"
let vikiType = 1
@@ -852,7 +854,7 @@ fun! VikiMaybeFollowLink(oldmap, ignoreSyntax)
\ b:vikiSimpleNameDestIdx, b:vikiSimpleNameAnchorIdx, a:ignoreSyntax)
endif
if def != ""
- return <SID>VikiFollowLink( VikiDispatchOnFamily("VikiCompleteSimpleNameDef", def) )
+ return <SID>VikiFollowLink( VikiDispatchOnFamily("VikiCompleteSimpleNameDef", def), split )
endif
elseif vikiType == 2 && b:vikiNameTypes =~# "e"
if exists("b:getExtVikiLink")
@@ -862,7 +864,7 @@ fun! VikiMaybeFollowLink(oldmap, ignoreSyntax)
\ b:vikiExtendedNameDestIdx, b:vikiExtendedNameAnchorIdx, a:ignoreSyntax)
endif
if def != ""
- return <SID>VikiFollowLink( VikiDispatchOnFamily("VikiCompleteExtendedNameDef", def) )
+ return <SID>VikiFollowLink( VikiDispatchOnFamily("VikiCompleteExtendedNameDef", def), split )
endif
elseif vikiType == 3 && b:vikiNameTypes =~# "u"
if exists("b:getURLViki")
@@ -872,7 +874,7 @@ fun! VikiMaybeFollowLink(oldmap, ignoreSyntax)
\ b:vikiUrlDestIdx, b:vikiUrlAnchorIdx, a:ignoreSyntax)
endif
if def != ""
- return <SID>VikiFollowLink( VikiDispatchOnFamily("VikiCompleteExtendedNameDef", def) )
+ return <SID>VikiFollowLink( VikiDispatchOnFamily("VikiCompleteExtendedNameDef", def), split )
endif
endif
if tryNext && vikiType > 0 && vikiType < 3
@@ -892,15 +894,23 @@ ________________________________________________________________________________
- improve use of g:vikiNameTypes
- don't know how to deal with viki names spanning several lines
- Recheck the key binding of c-cr
-- A variable with file patterns (directories) for which viki is turned on by
- default (or simply use localvimrc instead, which works well for me).
-- Different highlighting for existing and non-existing wiki pages (efficiency???)
+- Different highlighting for existing and non-existing wiki pages
- ...
* Change Log
+1.3
+- basic ctags support (see |viki-tags|)
+- mini-ftplugin for bibtex files (use record labels as anchors)
+- added mapping <LocalLeader><c-cr>: follow link in other window (if any)
+- disabled the highlighting of italic char styles (i.e., /text/)
+- the ftplugin doesn't set deplate as the compiler; renamed the compiler plugin to deplate
+- syntax: sync minlines=50
+- fix: VikiFoldLevel()
+
1.2
+- syntax file: fix nested regexp problem
- deplate: conversion to html/latex; download from
http://sourceforge.net/projects/deplate/
- made syntax a little bit more restrictive (*WORD* now matches /\*\w+\*/
View
41 syntax/viki.vim
@@ -2,8 +2,8 @@
" @Author: Thomas Link (samul AT web.de)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 30-Dez-2003.
-" @Last Change: 04-Mai-2004.
-" @Revision: 0.317
+" @Last Change: 06-Aug-2004.
+" @Revision: 0.354
if version < 600
syntax clear
@@ -16,6 +16,10 @@ let b:VikiEnabled = 0
VikiMinorModeMaybe
let b:VikiEnabled = 2
+syntax sync minlines=50
+syntax sync maxlines=200
+" linebreaks=1
+
syn match vikiEscape /\\/ contained containedin=vikiEscapedChar
syn match vikiEscapedChar /\\\_./ contains=vikiEscape,vikiChar
@@ -37,9 +41,10 @@ syn region vikiContinousTypewriter start=/\(^\|\W\zs\)==[^ =]/ end=/==\|\n\{2,}
syn cluster vikiTextstyles contains=vikiBold,vikiContinousBold,vikiItalic,vikiContinousItalic,vikiTypewriter,vikiContinousTypewriter,vikiUnderline,vikiContinousUnderline,vikiEscapedChar
-exe 'syn region vikiComment start=/^\s*'. escape(b:vikiCommentStart, '\/.*^$~[]') .'/ end=/$/ contains=ALL'
+exe 'syn match vikiComment /^\s*'. escape(b:vikiCommentStart, '\/.*^$~[]') .'.*$/ contains=vikiTextstyles,vikiLink,vikiExtendedLink,vikiURL'
+
-syn region vikiString start=+"+ end=+"+ contains=@vikiTextstyles
+syn region vikiString start=+^\s\+"\|"\|„+ end=+"[.?!]\?\s\+$\|"\|“+ contains=@vikiTextstyles
let b:vikiHeadingStart = '*'
exe 'syn region vikiHeading start=/\V\^'. escape(b:vikiHeadingStart, '\') .'\+\s\+/ end=/\n/ contains=@vikiTextstyles'
@@ -48,18 +53,19 @@ syn match vikiList /^\s\+\([-
syn match vikiDescription /^\s\+.\{-1,}\s::\ze\s/
syn match vikiTableRowSep /||\?/ contained containedin=vikiTableRow,vikiTableHead
-syn match vikiTableHead /^||\s\(.\|\\\n\)\+\s||$/ contains=ALL transparent
-syn match vikiTableRow /^|\s\(.\|\\\n\)\+\s|$/ contains=ALL transparent
+syn match vikiTableHead /^||[ ]\(.\{-}\(\\\n\|[ ]\)\)\+||$/ contains=ALL transparent
+" syn match vikiTableRow /^|\s\(.\|\\\n\)\+\s|$/ contains=ALL transparent
+syn match vikiTableRow /^|[ ]\(.\{-}\(\\\n\|[ ]\)\)\+|$/ contains=ALL transparent
" syn match vikiLayoutMarker /[/|%_^]/ containedin=vikiLayout contained
" syn match vikiLayout /|\S.\{-}\S|/
- " \ contains=vikiLayoutMarker,@vikiTextstyles,vikiEscape,vikiEscapedChar,vikiCommand
+ " \ contains=vikiLayoutMarker,@vikiTextstyles,vikiEscape,vikiEscapedChar,vikiMacro
-syn region vikiCommand matchgroup=vikiCommandDelim start=/{[^:{}]\+:\?/ end=/}/ transparent
+syn region vikiMacro matchgroup=vikiMacroDelim start=/{[^:{}]\+:\?/ end=/}/ transparent
-syn match vikiOption /^\C#\([A-Z]\+\)\>.*$/
-syn region vikiRegion matchgroup=vikiCommandDelim
- \ start=/#\([A-Z][a-z]\+\>\|!!!\).\{-}<<\z(.\+\)$/ end=/^\z1$/ contains=ALL
+syn match vikiCommand /^\C\s*#\([A-Z]\+\)\>\(\\\n\|.\)*/
+syn region vikiRegion matchgroup=vikiMacroDelim
+ \ start=/^\s*#\([A-Z][a-z]*\>\|!!!\).\{-}<<\z(.\+\)$/ end=/^\z1$/ contains=ALL
" Define the default highlighting.
@@ -108,18 +114,17 @@ if version >= 508 || !exists("did_viki_syntax_inits")
HiLink vikiString String
hi vikiBold term=bold cterm=bold gui=bold
HiLink vikiContinousBold vikiBold
- hi vikiItalic term=italic cterm=italic gui=italic
- HiLink vikiContinousItalic vikiItalic
+ " hi vikiItalic term=italic cterm=italic gui=italic
+ " HiLink vikiContinousItalic vikiItalic
hi vikiUnderline term=underline cterm=underline gui=underline
HiLink vikiContinousUnderline vikiUnderline
exe "hi vikiTypewriter term=underline ctermfg=". s:cm1 ."Grey guifg=". s:cm1 ."Grey". s:twfont
HiLink vikiContinousTypewriter vikiTypewriter
" hi vikiLayout term=standout cterm=standout gui=standout
- HiLink vikiLayoutMarker PreProc
- HiLink vikiCommandHead Statement
- HiLink vikiCommandDelim Identifier
-
- HiLink vikiOption Statement
+ " HiLink vikiLayoutMarker PreProc
+ HiLink vikiMacroHead Statement
+ HiLink vikiMacroDelim Identifier
+ HiLink vikiCommand Statement
HiLink vikiRegion Statement
delcommand HiLink
Please sign in to comment.
Something went wrong with that request. Please try again.