Skip to content
Browse files

Version 3.5

- Don't try to append an empty anchor to an url (Thanks RM Schmid).
- New variable g:viki_interviki to define intervikis in ~/.vimrc without loading autoload/viki.vim
- Minor updates to the help file.
  • Loading branch information...
1 parent 33d2a3a commit 283f0dc7abda4b15912a210a13c7f5fb1d022f5b @tomtom tomtom committed with
Showing with 60 additions and 11 deletions.
  1. +22 −3 autoload/viki.vim
  2. +30 −5 doc/viki.txt
  3. +8 −3 plugin/viki.vim
View
25 autoload/viki.vim
@@ -3,8 +3,8 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-03-25.
-" @Last Change: 2007-12-23.
-" @Revision: 0.447
+" @Last Change: 2008-01-10.
+" @Revision: 0.457
if &cp || exists("loaded_viki_auto") "{{{2
finish
@@ -81,6 +81,15 @@ function! viki#Define(name, prefix, ...) "{{{3
endif
endf
+for [s:iname, s:idef] in items(g:viki_intervikis)
+ " viki#Define(name, prefix, ?suffix="*", ?index="Index.${suffix}")
+ if type(s:idef) == 1
+ call call('viki#Define', [s:iname, s:idef])
+ else
+ call call('viki#Define', [s:iname] + s:idef)
+ endif
+ unlet! s:iname s:idef
+endfor
function! s:AddToRegexp(regexp, pattern) "{{{3
if a:pattern == ''
@@ -1300,7 +1309,17 @@ function! s:OpenLink(dest, anchor, winNr)
endtry
endf
-function! viki#MakeUrl(dest, anchor) "{{{3
+function! viki#MakeUrl(dest, anchor) "{{{3
+ if a:anchor == ""
+ return a:dest
+ else
+ " if a:dest[-1:-1] != '/'
+ " let dest = a:dest .'/'
+ " else
+ " let dest = a:dest
+ " endif
+ " return join([dest, a:anchor], '#')
+ return join([a:dest, a:anchor], '#')
endif
endf
View
35 doc/viki.txt
@@ -144,11 +144,37 @@ you could make viki to open references to pdf files right in VIM: >
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: >
+less about page names.
- call viki#Define('SCI', $HOME."/Projects/Sci/Ideas", ".txt")
+There are two ways to define an interviki:
+
+ *viki#Define()*
+ 1. Use viki#Define(name, prefix, ?suffix="*", ?index="Index.${suffix}")
+
+ call viki#Define('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.
+
+ *g:viki_interviki*
+ 2. Use g:viki_interviki (a dictionary). The values can be either a list
+ (arguments for |viki#Define()|) or a string.
+
+ let g:viki_interviki['SCI'] = [$HOME."/Projects/Sci/Ideas", ".txt"]
+ let g:viki_interviki['PROJ'] = $HOME."/Projects"
+
+Intervikis added to g:viki_interviki will be defined via |viki#Define()| when
+first loading ~/vimfiles/autoload/viki.vim. I.e. you cannot use automatically
+defined commands or menus before loading the autoload file. So, if you don't
+use the menus and the interviki commands to open files from the command line,
+use the variable. Otherwise, calling |viki#Define()| from
+~/vimfiles/after/plugin/viki.vim might be the better solution (which would
+also load autoload/viki.vim on startup though).
This could then be accessed as SCI::ThisIdea, which would refer to the file
"~/Projects/Sci/Ideas/ThisIdea.txt".
@@ -661,7 +687,7 @@ Commands~
Open the |viki-homepage|.
- VikiDefine NAME BASE ?SUFFIX *:VikiDefine*
- Define an interviki.
+ Define an interviki. See also |viki#Define()|.
================================================================================
*viki-functions*
@@ -1115,8 +1141,7 @@ 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"
+ call viki#Define('BIB', $HOME ."/local/share/texmf/bibtex/bib/tml", ".bib")
Then, activating the following viki name
BIB::[-monos-]#rec02
View
11 plugin/viki.vim
@@ -2,8 +2,8 @@
" @Author: Thomas Link (micathom AT gmail com?subject=vim)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 08-Dec-2003.
-" @Last Change: 2007-12-23.
-" @Revision: 3.4.2536
+" @Last Change: 2008-01-10.
+" @Revision: 3.5.2539
"
" GetLatestVimScripts: 861 1 viki.vim
"
@@ -38,7 +38,7 @@ if !exists('loaded_tlib') || loaded_tlib < 15
echoerr 'tlib >= 0.15 is required'
finish
endif
-let loaded_viki = 304
+let loaded_viki = 305
" This is what we consider nil, in the absence of nil in vimscript
let g:vikiDefNil = ''
@@ -968,5 +968,10 @@ it can be included from other syntax files.
- Cascade menu of intervikis
- FIX: don't register viki names as known/unknown more than once
+3.5
+- Don't try to append an empty anchor to an url (Thanks RM Schmid).
+- New variable g:viki_interviki to define intervikis in ~/.vimrc.
+- Minor updates to the help file.
+
" vim: ff=unix

0 comments on commit 283f0dc

Please sign in to comment.
Something went wrong with that request. Please try again.