Skip to content

tomtom/viki_vim

Repository files navigation

NOTE: This plugin is superseded by the vikibase_vim plugin (see 
https://github.com/tomtom/vikibase_vim).

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 LaTeX, HTML, or DocBook. On its homepage 
(http://deplate.sf.net) you can read a more detailed 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 (on a terminal use <LocalLeader>vf). Pressing 
<LocalLeader>vb brings you back to the original document. Alternatively, you 
can use <m-leftmouse> and <m-rightmouse> to jump back and forth. (NOTE: In 
minor mode, it's possible that viki words and URLs are not highlighted when 
they are included in some syntactic regions.)

FULL WIKI MODE:
In full mode, viki becomes a personal wiki 
(http://c2.com/cgi/wiki?PersonalWiki). 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).

BUT HEY, WHAT IS A WIKI ANYWAY:
Among the vast amount of possible definitions, I prefer this one, which is my 
own anyway :-): a wiki is a simple way of creating hypertexts. In its basic 
form creating a hyperlink is as easy as writing a word in CamelCase (although 
this sometimes turn out to be more annoying than useful) or by a rather 
minimalist markup -- in the case of viki, this would be [[destination]] or 
[-destination-].

You begin by creating a directory where your wiki files should go to and by 
creating a wiki index -- a master file that contains references to sub-pages. 
After a while you end up with many small, tightly interlinked files/notes.

Wikis also come with a rather subtle markup. Here is a simple comparison of 
two examples of LaTeX and viki markup so that you get the idea of what it 
looks like:

    LaTeX: \section{Title}
    Viki:  * Title

    LaTeX: \emph{text}
    Viki:  __text__

And some wikis provide tools for translating this markup to other formats 
(like viki does in the form of the "deplate" program, which can translate viki 
markup to LaTeX, HTML, and Docbook). Unfortunately, just about every wiki has 
its own markup. 

                                                    *viki-support*
VIKI Forum (questions, feature requests):
http://sourceforge.net/projects/deplate/forums/forum/700962

Bug tracker:
https://github.com/tomtom/deplate/issues

Demo:
http://vimsomnia.blogspot.com/2010/11/vikitasks-viki-demonstration-personal.html 


-----------------------------------------------------------------------
Install~

In order to install the vba, open the vba file in VIM and type: >

    :so %

See :help vimball for details.

This script requires tlib (vimscript #1863) to be installed.

Also available via git: http://github.com/tomtom/viki_vim/

                                                    *viki-requirements*
Requirements:
- tlib (vimscript #1863)

                                                    *viki-related-plugins*
Optional enhancements:
- vikitasks (vimscript #2894): Distributed TODO lists
- hookcursormoved (vimscript #2037): Enhanced detection of hyperlinks to 
  inexistent destinations.
- vxfold (vimscript #3004): Provides org-mode like fold cycling
- VOoM (vimscript #2657): A two-pane outliner with support for viki
- kpsewhich (not a vim plugin :-) for LaTeX support


Post-Install~

Viki requires the following minimal lines to be added to |vimrc|: >

    :set nocompatible
    :filetype plugin indent on
    :syntax on

You might also want to set 'expandtab' (local to buffer) in 
after/ftplugin/viki.vim: >

    setlocal expandtab

Viki will be automatically loaded when starting vim. In case you have vim 
already running and don't want to restart it, you can also type: >

    :runtime plugin/viki.vim

Viki doesn't set the viki filetype for you. How you set the filetype is up to 
you to decide. Basically, there are two possibilities: based on a suffix or 
based on the location. See |viki-filetype-detection|.


Customization:                                      *viki-customization*
It's probably a good idea to check the values of the following variables:

    - |g:vikiUpperCharacters| and |g:vikiLowerCharacters|; for the most 
      commonly used foreign language characters in a Western European 
      context set these variables to something like (this refers to the 
      characters allowed in simple viki names and in anchors; for East Asian 
      languages you probably prefer to use quoted viki names anyway): >

        " this is in iso-latin-1
        let g:vikiLowerCharacters = "a-zäöüßáàéèíìóòçñ"
        let g:vikiUpperCharacters = "A-ZÄÖÜ"
<
    - |vikiNameTypes| (see |viki-names|): control which type of viki names you 
      want to use (this allows you to turn off, e.g., simple viki names)

You might also need to configure some external programs (use the variables 
g:vikiOpenUrlWith_{PROTOCOL} and g:vikiOpenFileWith_{SUFFIX}) like in this 
example: >

    let g:vikiOpenUrlWith_mailto = 'thunderbird -compose %{URL}'
    let g:vikiOpenFileWith_html  = "silent !firefox %{FILE}"
    let g:vikiOpenFileWith_ANY   = "silent !start %{FILE}"

You should at least check the definitions of |g:vikiOpenFileWith_ANY| 
and |g:vikiOpenUrlWith_ANY|.

This way, if you had, e.g., pdftotext (from the xpdf distribution) installed, 
you could make viki to open references to pdf files right in VIM: >

    fun! ConvertPDF()
        if !exists("b:convertedPDF")
            exec "cd ". expand("%:p:h")
            exec "%!pdftotext ". expand("%:t") ." -"
            :%!par 72w
            cd -
            setlocal noswapfile buftype=nowrite
            let b:convertedPDF = 1
        endif
    endf
    let g:vikiOpenFileWith_pdf = 'call viki#OpenLink("%{FILE}", "", 1)|silent call ConvertPDF()'

                                                    *viki-intervikis*
Later on, you probably want to define some intervikis. A |interviki| is a 
shortcut to a different viki directory/namespace, so that you have to care 
less about page names.

There are two ways to define an interviki:

    1. Use |VikiDefine()|: >

       call VikiDefine('SCI', $HOME."/Projects/Sci/Ideas", ".txt")

<      This command will automatically define a menu for each interviki 
       (unless g:vikiMenuPrefix is empty) and it will also define a command 
       with the name of the interviki that can be used to quickly access viki 
       files from the vim command line.

       The disadvantage of this approach is that you can define 
       intervikis only after plugin/viki.vim was loaded -- e.g. in 
       after/plugin/viki.vim.

    2. Use |g:viki_intervikis| (a dictionary). The values can be either a list 
       (arguments for |VikiDefine()|) or a string. >

       let g:viki_intervikis = {}
       let g:viki_intervikis['SCI']  = [$HOME."/Projects/Sci/Ideas", ".txt"]
       let g:viki_intervikis['PROJ'] = $HOME."/Projects"

<      This variable has to be set in vimrc before loading the vim 
       plugin.

Your newly defined interviki can then be accessed as SCI::ThisIdea, 
which would refer to the file "~/Projects/Sci/Ideas/ThisIdea.txt".

VikiDefine also defines a command (:SCI in this example) that opens a wiki's 
index file (an optional 4th argument or "${g:vikiIndex}.${suffix}").

Intervikis can also be defined as patterns or functions as in the following 
example: >

    fun! GetAddress(vikiname)
        let surname = substitute(a:vikiname, '^\(\u.\{-}\)\(\u\U*\)\?$', '\1', '')
        let firstname  = substitute(a:vikiname, '^\(\u.\{-}\)\(\u\U*\)\?$', '\2', '')
        return 'https://www.example.com/cgi/search.cgi?search='. surname .','. firstname
    endf

    call VikiDefine('CONTACT', '*GetAddress("%s")')
    call VikiDefine('INDEX', '%/foo/%s/index.html')

CONTACT::JohnDoe would the refer to 
https://www.example.com/cgi/search.cgi?search=Dow,John and [[INDEX::bar]] 
would refer to /foo/bar/index.html

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

                                                    *viki-filetype-detection*
By default, the filetype of files matching the suffix defined in 
|g:vikiNameSuffix| will be set to viki.

You can also use |:autocmd| to set the filetype depending on the path: >

    autocmd BufRead,BufNewFile $HOME/MyWiki/* set filetype=viki

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 
viki definition is an array of the three elements name, destination, anchor.

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 variables:

    - |g:vikiTypewriterFont| (see |viki-textstyles|)
    - |g:vikiHeadingFont| (see |viki-headings|)
    - |g:vikiHyperLinkColor|
    - |g:vikiInexistentColor|

                                                    *viki-indent-disable*
In order to disable the indentation plugin, define the variable g:vikiNoIndent 
and set it to whatever you want.


-----------------------------------------------------------------------
                                                    *viki-names*
Viki Names~

A viki name is either:

                                                    *viki-simple-names*
    1. Simple wiki names -- these refer to files in the same directory as the 
       current file:

        a. a word in CamelCase
            VikiName
            VikiName#anchor

            NOTE: A simple viki name may include characters from 
            |g:vikiUpperCharacters| and |g:vikiLowerCharacters|.

        b. some text between "[-" and "-]"
            [-name-]
            [-some name-]#there

            NOTE: "[--]" refers to the current file.

            NOTE: Anyways, the characters []:*&?<>/|\" are not allowed in 
            names as they usually cause trouble when included in file names.

                                                    *interviki*
         c. an "inter wiki" name, where the first part (in upper-case letters) 
         is a shortcut to some other viki, so that you have to care less about 
         page names

            OTHERVIKI::VikiName
            OTHERVIKI::VikiName#there
            OTHERVIKI::[-some name-]
            OTHERVIKI::[-some name-]#there

            E.g., if you had two intervikis defined, say SCI and COMP, you 
            could the refer to their pages as in: >

                Couldn't SCI::ThisIdeaOfMine be combined with COMP::ThisIdeaOfMine?
<
            NOTE: You can define intervikis with the VikiDefine command: >

                VikiDefine OTHERVIKI /home/t/Wiki .vik

<           Then OTHERVIKI::VikiName points to the file "/home/t/Wiki/VikiName.vik".

            NOTE: Set the string variable g:vikiInter{NAME}_suffix (see 
            |curly-braces-names|) in order to override the settings of 
            |b:vikiNameSuffix| and |g:vikiUseParentSuffix| for references to 
            the other viki.

        NOTE: If the variable |b:vikiNameSuffix| is defined, it will be added to 
        simple wiki names so that the simple wiki name "OtherFile" refers to 
        "OtherFile.suffix" -- e.g. for interlinking LaTeX-files.  
        Alternatively, you can set |g:vikiUseParentSuffix| to non-zero in order 
        to make viki always append the "parent" file's suffix to the 
        destination file.

                                                    *viki-extended-names*
    2. an extended wiki name of the form:

            [[destination]]
            [[OTHERVIKI::destination]]
            [[destination][name]]
            [[destination#anchor][name]]
            [[#anchor]]
            [[#anchor][name]]

        NOTE: The destination name is taken literally, i.e. variables like 
        |g:vikiUseParentSuffix| or |b:vikiNameSuffix| have no effect.

        NOTE: Opening extended wiki names referring to files with suffixes 
        matching one of |vikiSpecialFiles| (e.g. [[test.jpg]]) can be 
        delegated to the operating system -- see |VikiOpenSpecialFile()|. The 
        same is true for names matching |vikiSpecialProtocols|, which will be 
        opened with |VikiOpenSpecialProtocol()|.

        NOTE: In extended wiki names, destination path is relative to the 
        document's current directory if it doesn't match 
        "^\(\/\|[a-z]:\|[a-z]\+://\)". I.e.  [[../test]] refers to the 
        directory parent to the document's directory. A tilde at the beginning 
        will be replaced with $HOME.

                                                    *viki-urls*
    3. an URL
        It is assumed that these URLs should be opened with an external 
        program; this behaviour can be changed by redefining the function 
        |VikiOpenSpecialProtocol()|.

    4. Hyperwords (not supported by deplate)
        Hyperwords are defined in either ./.vikiWords or 
        &rtp[0]/vikiWords.txt each word in a line in the form 
        "word<tab>destination", where <tab> is the tab character (code 
        9). Lines beginning  with '%' are ignored. These words are 
        automatically highlighted.  Depending on your setting of 
        |vikiNameTypes|, viki may try to make hyperwords out of the 
        filenames in the current buffer's directory.  I.e. if 
        |vikiNameSuffix| is '.viki' and there is a file 'example.viki' 
        in the same directory as the current buffer's file, then each 
        occurrence of the word 'example' will be turned into a clickable 
        link. You can prevent a file name from being highlighted as 
        hyperword by defining an entry in the vikiWords file with "-" as 
        destination.

Adding #[a-z0-9]\+ to the wiki name denotes a reference to a specific anchor.  
Examples for wiki names referring to an anchor: >

	ThatPage#there
	[[anyplace/filename.viki#there]]
	[[anyplace/filename.viki#there][Filename]]

A anchor is marked as "^".b:commentStart."\?#[a-z0-9]\+" in the destination
file. If |b:commentStart| is not defined, the EnhancedCommentify-variables or
|&commentstring| will be used instead.  Examples ('|' = beginning of line):

    - LaTeX file, b:commentStart is set to "%"
      |%#anchor
      |#anchor
    - C file, |&commentstring| is set to "/*%s*/"
      |/*#anchor */
    - Text file, b:commentStart is undefined
      |#anchor

NOTE: If "#" is the comment character (as in ruby), a space should follow the
comment character in order to distinguish comments from anchors.

NOTE: In "full" viki mode (when invoked via VikiMode) comments are marked 
with "%" by default (see g:vikiCommentStart). An anchor has thus to be 
written as in the LaTeX example.

NOTE: |deplate| attaches an anchor to the previous element (e.g. |viki-tables|).


-----------------------------------------------------------------------
                                                    *viki-markup*
Pseudo Markup~

The pseudo markup is to some degree compatible with emacs-wiki, which in turn  
is to some degree compatible with some other wiki -- i.e., it's compatible 
enough to edit and work with files in emacs-wiki markup, but in some aspects 
it's more restrictive. To convert viki markup to other formats, see the
|deplate|.


                                                    *viki-headings*
Headings~
* Level 1
** Level 2
...

    NOTE: Headings can span more than one line by putting a backslash ('\') at 
    the end of the line.

    NOTE: If |g:vikiHeadingFont| is defined, the heading will be set in this 
    font.


                                                    *viki-lists*
Lists: (indented)~

    - Item
        * Item
            + Item
                1. Item 1
                    a. Item a
                    B. Item B
        # Item
            # Item 1
            # Item 2
                @ Item A
                @ Item B

NOTE: "@" (unordered lists) and "#" (ordered lists) are the preferred markers.


                                                    *viki-descriptions*
Descriptions: (indented)~

    Item :: Description


                                                    *viki-tasks*
Tasks: (indented)~
Viki supports some markup for task/priority lists. Basic syntax: >

    #C9 DATE TAGS CONTACTS MESSAGE

where:

    C        ... category (a single upper case letter)
    9        ... priority (a number from 0 to 9)
    DATE     ... a date or date range formatted as YEAR-MONTH-DAY or 
                 YEAR-MONTH-DAY..YEAR-MONTH-DAY
    TAGS     ... a list of tags formatted as :tag1 :tag2
    CONTACTS ... a list of tags formatted as @contact1 @contact2
    MESSAGE  ... some text

Examples: >

    #A1 _           Important task
    #A2 x           Less important task (done)
    #A2 90%         Less important task (mostly completed)
    #B2 2005-10-30  Less important task with deadline
    #B2 x2005-10-25 Less important task (completed)
    #X2 2005-10-25  Task (completed)
    #A2 2005-10-25..2005-11-25 Task with date range
    #A2 2005-10-25 :garden Task with a tag
    #A2 2005-10-25 :garden @Anne Task with a tag & contact

You can switch category, priority, and date: >

    #1A _           Important task
    #2A x           Less important task (done)

    #2005-10-30  2A Important task
    #2005-11-11  1A Most important task
    #x2005-10-30 3A Less important task (done)


                                                    *viki-tables*
Tables~
|| Head || Category ||
|  Row  |  Value     |
#CAPTION: This Table
#label

NOTE: Rows can span more than one line by putting a backslash ('\') at the end 
of the line.


                                                    *viki-symbols*
Symbols~
<-, ->, <=, =>, <~, ~>, <->, <=>, <~>, !=, ~~, ..., --, ==


                                                    *viki-markers*
Markers~
+++, ###, ???, !!!


                                                    *viki-strings*
Strings~
"Text in \"quotes\""

NOTE: See also |g:vikiMarkupEndsWithNewline|.


                                                    *viki-textstyles*
Textstyles~

    __emphasized__, ''typewriter''

<   NOTE: There must not be a whitespace after the opening mark.

    NOTE: For the word styles, there must be a non-word character (|/\W|) 
    before the opening mark, i.e. a__b__c will be highlighted as normal text -- 
    it won't be highlighted. You could use the continuous markup for putting 
    the "b" in the example in italic.

    NOTE: If |g:vikiTypewriterFont| is defined, this font will be used to 
    highlight text in typewriter style.

    NOTE: See also |g:vikiMarkupEndsWithNewline|.


                                                    *viki-comments*
Comments (whole lines)~
%Comment


                                                    *viki-regions*
Regions~
#Type [OPTIONS] <<EndOfRegion
Text ...
EndOfRegion

For a list of supported regions see the |deplate| documentation.


                                                    *viki-sharp-commands*
One-line commands~
#COMMAND [OPTIONS]: ARGS

OPTIONS have the form
    - OPTION! ... set option to true
    - OPTION=VALUE
    - the characters "!" and "=" have to be escaped with a backslash

Commands are applied only if the option "fmt" isn't given or if it matches the 
formatter regexp.

Short list of available COMMANDS "COMMAND" (see also |deplate|):
    - INC: INCLUDED FILENAME
    - FIG [here!|top!|bottom!]: FILENAME
    - CAP [above!|below!]: TEXT
    - TITLE: TEXT
    - AUTHOR: TEXT
    - AUTHORNOTE: TEXT
    - DATE: [TEXT|now|today]
    - MAKETITLE [page!]
    - LIST [page!]: [contents|tables|figures|index]
    - PAGE

It depends on the formatter if these options have any effect.
    - DOC ... document options
    - OPT ... element options (applies to the previous element)


                                                   *viki-macros*
Curly braces~
Curly braces should be escaped with a backslash (i.e., \{ and \}), as they 
usually mark macros: >

    {MACRO [OPTIONS]: ARGS...}
<
Short list of available macros (see also |deplate|):
    - {fn: ID}
        - inserts a footnote as defined by in a Fn or Footnote region. 
        - output depends on the formatter
        - Example: >
            Foo bar{fn: x} foo bar.

            #Fn: x <<EOF
                Bla bla.
            EOF
<   - {cite: ID}
        - output depends on the formatter
    - {date: [format string|now|today]}
        - the format string uses ruby's strftime method.
    - {ins: LITERALLY INSERTED TEXT}
        - Example: {ins fmt=html: &lt;&lt;}
    - {doc: ID}
        - access document options, e.g. {opt: author}
    - {opt: ID}
        - access element (paragraph, table etc.) options
    - {ruby [alt=ALTERNATIVE OUTPUT]: RUBY CODE}
        - if the evaluation of ruby code is disabled, the text given in the 
          alt option or an empty string will be inserted
        - a sequence of ruby commands must be separated by semicolons

Common options:
    - fmt=FORMATTER, nofmt=UNMATCHED FORMATTER

NOTE: Macros cannot cross paragraph borders, i.e., they must not contain empty 
lines. Using newlines in a macro argument is useless, as the macro text will 
be collapsed to one single line.


                                                    *viki-backslash*
Backslashes~
    - A backslash at the end of the line should make a pattern include the 
      next line.
    - In general, a backslash should be an escape character that prevents the 
      vikification of the following character.
    - A backslash should itself be escaped by a backslash.

\_nounderline_, \NoVikiName


-----------------------------------------------------------------------
                                                    *viki-key-bindings*
Default Key Binding~

<c-cr> ... |viki#MaybeFollowLink()|: Usually only works when the cursor is over 
a wiki syntax group -- if the second argument is 1 it tries to interpret the 
text under the cursor as a wiki name anyway. (NOTE: If you're working on a 
terminal, <c-cr> most likely won't work. Use <LocalLeader>vf instead.)

<LocalLeader>vf ... Open in window
<LocalLeader>vt ... Open in a new tab
<LocalLeader>vs ... Open in a new window
<LocalLeader>vv ... Open in a new window but split vertically
    - see also |vikiSplit|

<LocalLeader>v1 - <LocalLeader>v4 ... Open in window 1-4

<LocalLeader>ve ... |:VikiEdit| edit a viki page

<LocalLeader>vb <LocalLeader>v<left> ... |viki#GoBack()|
<LocalLeader>v<bs> <LocalLeader>v<up> ... |viki#GoParent()|

<LocalLeader>vq ... |:VikiQuote| mark selected text a quoted viki name

<LocalLeader>vd ... |:VikiMarkInexistent| in the whole document
<LocalLeader>vp ... |:VikiMarkInexistent| in the current paragraph

If |g:vikiMapMouse| is true then these mappings are active, too:
<m-leftmouse> ... |viki#MaybeFollowLink()|
<m-leftmouse> ... |viki#GoBack()| (always jumps to the last known entry point)


Additional Key Binding In Full Viki Mode

<c-tab>, <LocalLeader>vn   ... |:VikiFindNext|
<s-c-tab>, <LocalLeader>vN ... |:VikiFindPrev|
                                                    *viki-highlight*
Highlighting~

Viki.vim defines several new highlight groups. Precaution is taken to select 
different colours depending on the background, but colour schemes are ignored. 
The colors are tested using color scheme with a white background.

    - vikiHyperLink
    - vikiHeading
    - vikiList
    - vikiTableHead
    - vikiTableRow
    - vikiSymbols
    - vikiMarkers
    - vikiAnchor
    - vikiString
    - vikiBold
    - vikiItalic
    - vikiUnderline
    - vikiTypewriter
    - vikiCommand


-----------------------------------------------------------------------
Generated regions~

Viki provides the following region types with programmatically generated 
contents:

    #Files ... List files matching a pattern
    #Grep  ... List lines in files matching a pattern

Default Key Binding~

    <LocalLeader>vu ... Update the current #Files or #Grep region
    <LocalLeader>vU ... Update all #Files or #Grep regions

                                                    *viki-files*
Files Region~

Viki knows a special #Files region that allows users to quickly generate 
catalogs for viki files in a directory.

Example: >
    #Files glob=lib/** types=f <<
    [[example1.rb]!]     This is an example file
    [[example2.rb]!]     This is another example
    [[lib/example1.rb]!]
    [[lib/example2.rb]!]

    #Files glob=*.viki types=f <<
    [[example.viki]!] The manual

Multiple patterns are separated by a pipe ("|") character. The filenames 
are stored as extended viki names. Each line can take a comment that is 
restored upon automatic update.

For a list of available arguments, see |viki#DirListing()|.

The following arguments can be used to deal with #Files regions. An 
additional <bang> ("!") makes these command work on just files in the 
same directory or a subdirectory as the file on the current line.

Default Key Binding~

    <LocalLeader>vx ... :VikiFilesExec
    <LocalLeader>vX ... :VikiFilesExec!

Example: >
    Use ":VikiFilesExec! e" (<LocalLeader>vXe<cr>) to edit all the files in 
    the same directory or a subdirectory of the current file under the cursor.

                                                    *viki-grep*
Grep Region~

#Grep regions can be used to list files matching a pattern.

Example: >
#Grep glob=*.viki rx=test <<
  [[/home/user/Wiki/Tester.viki#l=53][Tester.viki]] :: How to test!
  [[/home/user/Wiki/Tests.viki#l=12][Tests.viki]] :: This is another test.

The #Grep region can e.g. be used get a list of back-references.


-----------------------------------------------------------------------
                                                    *viki-compile*
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*
Viki LaTeX~

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}
 	- \input
 	- \include
 	- \usepackage
 	- \psfig
 	- \includegraphics
    - \bibliography
    - \label (as anchors)
    - \ref (in the current file only)

Limitations: There must not be spaces between between the leading backslash, 
the command name, and its arguments. A command must not span several lines.

Simple viki names (including |interviki|, CamelCase, and quoted viki names) 
are disabled -- as they wouldn't be of much use in a LaTeX document anyway. 
(Well, as a matter of fact they aren't disabled but LaTeX commands are defined 
as simple viki names.)

This plugin also highlights a hypothetical \viki[anchor]{name} command, which
could be defined as: \newcommand{\viki}[2][]{#2}

If b:vikiFamily is set to "latex", then calling |:VikiMinorMode| will use 
these commands instead of normal viki names. This change can be made permanent 
by adding this line to your |vimrc| file: >

    au FileType tex let b:vikiFamily="latex"
<
LaTeX support is switched on with the command |:VikiMinorModeLaTeX|. This 
command sets b:vikiFamily to "latex" and calls |:VikiMinorMode|. This
command relies on the external kpsewhich tool, which has to be installed on
your computer.

                                                    *vikiLatex-UserCommands*
You can extend the list of supported commands by listing your commands in
g:vikiLaTeXUserCommands and by defining a corresponding function called 
VikiLaTeX_{YourCommand}(args, opts). VikiLaTeX assumes that a command looks 
like this: \latexcommand[opts]{args}. This function should return a string 
that defines the variable dest (=destination file) as well as, optionally, 
anchor and name -- see |:return| for an explanation of how this works. A 
simple minded example: >

    let g:vikiLaTeXUserCommands = 'other\|self'

    fun! VikiLaTeX_other(args, opts)
        return 'let dest="'.a:args.'.tex" | let anchor="'.a:opts.'"'
    endfun

    fun! VikiLaTeX_self(args, opts)
        return 'let dest="'.g:vikiSelfRef.'" | let anchor="'.a:opts.'"'
    endfun


-----------------------------------------------------------------------
                                                    *viki-anyword*
Viki Any Word~

If b:vikiFamily or g:vikiFamily is set to "anyword", then any word becomes a 
potential viki link.

This feature conflicts with the highlighting of links to inexistent files. 
Links to inexistent files are displayed as normal text.


-----------------------------------------------------------------------
                                                    *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: >

    call VikiDefine('BIB', $HOME ."/local/share/texmf/bibtex/bib/tml", ".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 *.viki files are in viki mode; you have to adjust the 
file suffix if you choose a different suffix): >

    --langdef=deplate
    --langmap=deplate:.viki
    --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.


-----------------------------------------------------------------------
                                                    *deplate*
Deplate~

deplate is a ruby script/library that converts viki markup to:

    - html
    - htmlslides
    - latex
    - docbook

Download the latest version from http://sourceforge.net/projects/deplate/.

deplate's markup is not 100% identical with the standard viki mode's one.  
E.g., it doesn't support underline, italic markup. deplate sometimes failes 
with cryptic error messages and it doesn't always give the results one would 
expect. On the other hand, it features inclusion of LaTeX snippets, footnotes, 
references, an autogenerated index etc.


-----------------------------------------------------------------------


Dependencies:
  setsyntax :: http://github.com/tomtom/setsyntax_vim
  tlib (>= 1.16) :: http://github.com/tomtom/tlib_vim

License: GPLv3 or later
Install: See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
See http://github.com/tomtom for related plugins.