Permalink
Browse files

Version 2.4

- The shortcuts automatically defined by VikiDefine may now take an
optional argument (the file on an interviki) (:WIKI thus is the same as
:VikiEdit WIKI:: and supports the same command-line completion)
- Read ".vikiWords" in parent directories (top-down);
g:vikiHyperWordsFiles: Changed order (read global words first)
- In .vikiWords: destination can be an interviki name (if not, it is
assumed to be a relative filename); if destination is -, the word will
be removed from the jump table; blanks in "hyperwords" will be replaced
with \s\+ in the regular expression.
- New :VikiBrowse command.
- FIX: wrong value for &comments
- FIX: need to reset filetype on color-scheme change (because of viki's
own styles)
- FIX: Caching of inexistent viki names.
- In minor mode, don't map keys that trigger a check for inexistent
links.
- Don't highlight textstyles (emphasized, typewriter) in comments.
- Removed configuration by: VikiInexistentColor(),
g:vikiInexistentColor, VikiHyperLinkColor(), g:vikiHyperLinkColor; use
g:viki_highlight_hyperlink_light, g:viki_highlight_hyperlink_dark,
g:viki_highlight_inexistent_light, g:viki_highlight_inexistent_dark
instead. By default, links are no longer made bold.
- The new default fold expression (g:vikiFoldMethodVersion=4) support
only hH folds (normal and inverse headings based; see g:vikiFolds).
Previous fold methods can be used by setting g:vikiFoldMethodVersion.
  • Loading branch information...
1 parent 14f0d29 commit ade2a0ee2bce1604f3a775c076caaa84c5f7696d @tomtom tomtom committed with Aug 26, 2007
Showing with 418 additions and 165 deletions.
  1. +88 −16 ftplugin/viki.vim
  2. +3 −2 indent/viki.vim
  3. +323 −144 plugin/viki.vim
  4. +4 −3 syntax/viki.vim
View
@@ -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: 2007-07-10.
-" @Revision: 316
+" @Last Change: 2007-08-26.
+" @Revision: 364
" if !g:vikiEnabled
" finish
@@ -20,19 +20,20 @@ let b:did_ftplugin = 1
let b:vikiCommentStart = "%"
let b:vikiCommentEnd = ""
-let b:vikiHeadingMaxLevel = 0
+let b:vikiHeadingMaxLevel = -1
if !exists("b:vikiMaxFoldLevel") | let b:vikiMaxFoldLevel = 5 | endif "{{{2
if !exists("b:vikiInverseFold") | let b:vikiInverseFold = 0 | endif "{{{2
-exe "setlocal commentstring=". substitute(b:vikiCommentStart, "%", "%%", "g")
+exec "setlocal commentstring=". substitute(b:vikiCommentStart, "%", "%%", "g")
\ ."%s". substitute(b:vikiCommentEnd, "%", "%%", "g")
-exe "setlocal comments=:". b:vikiCommentStart
+exec "setlocal comments=fb:-,fb:+,fb:*,fb:#,fb:?,fb:@,:". b:vikiCommentStart
setlocal foldmethod=expr
setlocal foldexpr=VikiFoldLevel(v:lnum)
setlocal foldtext=VikiFoldText()
setlocal expandtab
-setlocal iskeyword+=#,{
+" setlocal iskeyword+=#,{
+setlocal iskeyword+={
let &include='\(^\s*#INC.\{-}\(\sfile=\|:\)\)'
" let &include='\(^\s*#INC.\{-}\(\sfile=\|:\)\|\[\[\)'
@@ -76,27 +77,99 @@ function! VikiFoldText() "{{{3
if synIDattr(synID(v:foldstart, 1, 1), 'name') =~ '^vikiFiles'
let line = fnamemodify(viki#VikiFilesGetFilename(line), ':h')
else
+ let context = v:foldstart + get(tlib#var#Get('vikiFoldsContext', 'wbg'), v:foldlevel, 0)
let line = matchstr(line, '^\s*\zs.*$')
+ for li in range(v:foldstart + 1, context)
+ if li > v:foldend
+ break
+ endif
+ let lp = matchstr(getline(li), '^\s*\zs.\{-}\ze\s*$')
+ if !empty(lp)
+ let line .= ' | '. lp
+ endif
+ endfor
endif
return v:folddashes . line
endf
-if g:vikiFoldMethodVersion == 3
+function! s:VikiFolds() "{{{3
+ let vikiFolds = tlib#var#Get('vikiFolds', 'bg')
+ " TLogVAR vikiFolds
+ if vikiFolds == 'ALL'
+ let vikiFolds = 'hlsfb'
+ " let vikiFolds = 'hHlsfb'
+ elseif vikiFolds == 'DEFAULT'
+ let vikiFolds = 'hf'
+ endif
+ return vikiFolds
+endf
+
+function! s:SetMaxLevel() "{{{3
+ let pos = getpos('.')
+ let vikiHeadingRx = '\V\^'. b:vikiHeadingStart .'\+\ze\s'
+ let b:vikiHeadingMaxLevel = 0
+ exec 'keepjumps g/'. vikiHeadingRx .'/let l = matchend(getline("."), vikiHeadingRx) | if l > b:vikiHeadingMaxLevel | let b:vikiHeadingMaxLevel = l | endif'
+ " TLogVAR b:vikiHeadingMaxLevel
+ call setpos('.', pos)
+endf
+
+if g:vikiFoldMethodVersion == 4
function! VikiFoldLevel(lnum) "{{{3
+ let vikiFolds = s:VikiFolds()
+ if vikiFolds !~# '[hH]'
+ " TLogDBG 'no folds'
+ return
+ endif
let lt = getline(a:lnum)
+ " if lt !~ '\S'
+ " return '='
+ " endif
+ if vikiFolds =~# 'h'
+ let fh = matchend(lt, '\V\^'. b:vikiHeadingStart .'\+\ze\s')
+ if fh != -1
+ " TLogVAR fh
+ if b:vikiHeadingMaxLevel = -1
+ call s:SetMaxLevel()
+ endif
+ if fh > b:vikiHeadingMaxLevel
+ let b:vikiHeadingMaxLevel = fh
+ endif
+ if vikiFolds =~# 'H'
+ " TLogDBG 'inverse folds'
+ let fh = b:vikiHeadingMaxLevel - fh + 1
+ endif
+ " TLogVAR fh, lt
+ return '>'.fh
+ endif
+ return '='
+ endif
+ " let li = indent(a:lnum)
+ " let tf = b:vikiHeadingMaxLevel + 1 + (li / &sw)
+ " " TLogVAR tf
+ " return tf
+ endf
+
+elseif g:vikiFoldMethodVersion == 3
+
+ function! VikiFoldLevel(lnum) "{{{3
+ let lt = getline(a:lnum)
+ if lt !~ '\S'
+ return '='
+ endif
let fh = matchend(lt, '\V\^'. b:vikiHeadingStart .'\+\ze\s')
if fh != -1
+ " let fh += 1
+ if b:vikiHeadingMaxLevel = -1
+ call s:SetMaxLevel()
+ endif
if fh > b:vikiHeadingMaxLevel
let b:vikiHeadingMaxLevel = fh
" TLogVAR b:vikiHeadingMaxLevel
endif
" TLogVAR fh
return fh
endif
- if lt !~ '\S'
- return '='
- endif
let li = indent(a:lnum)
let tf = b:vikiHeadingMaxLevel + 1 + (li / &sw)
" TLogVAR tf
@@ -136,15 +209,14 @@ else
let lr = &lazyredraw
set lazyredraw
try
- let vikiFolds = tlib#var#Get('vikiFolds', 'bg')
- if vikiFolds == 'ALL'
- let vikiFolds = 'hHlsfb'
- elseif vikiFolds == 'DEFAULT'
- let vikiFolds = 'hf'
- elseif vikiFolds == ''
+ let vikiFolds = s:VikiFolds()
+ if vikiFolds == ''
" TLogDBG 'no folds'
return
endif
+ if b:vikiHeadingMaxLevel = -1
+ call s:SetMaxLevel()
+ endif
if vikiFolds =~# 'f'
let idt = indent(a:lnum)
if synIDattr(synID(a:lnum, idt, 1), 'name') =~ '^vikiFiles'
View
@@ -3,8 +3,8 @@
" @Website: http://members.a1.net/t.link/
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 16-Jän-2004.
-" @Last Change: 2007-07-17.
-" @Revision: 0.258
+" @Last Change: 2007-07-19.
+" @Revision: 0.260
if !g:vikiEnabled
finish
@@ -21,6 +21,7 @@ if !exists("g:vikiIndentDesc") | let g:vikiIndentDesc = 'sw' | endif "{{{2
setlocal indentexpr=VikiGetIndent()
" setlocal indentkeys&
setlocal indentkeys=0=#\ ,0=?\ ,0=<*>\ ,0=-\ ,0=+\ ,0=@\ ,=::\ ,!^F,o,O
+" setlocal indentkeys=0=#<space>,0=?<space>,0=<*><space>,0=-<space>,=::<space>,!^F,o,O
" setlocal indentkeys=0=#<space>,0=?<space>,0=<*><space>,0=-<space>,=::<space>,!^F,o,O,e
" Define the function only once.
Oops, something went wrong.

0 comments on commit ade2a0e

Please sign in to comment.