Skip to content

Commit

Permalink
Version 1.6.3
Browse files Browse the repository at this point in the history
- file type URLs (file://) are now treated like special files
- indent: if g:vikiIndentDesc is '::', align a definition's description to the
first non-blank position after the '::' separator
- b:vikiDisableType
- Put AnyWord-related stuff into a file of its own.
- indentation for notices (!!!, ??? etc.)
- When creating a new file by following a link, the desired window number was ignored
- (VikiOpenSpecialFile) Escape blanks in the filename
- Set &include and &define (ftplugin)
- Set g:vikiFolds to '' to avoid using Headings for folds (which may cause a
major slowdown on slower machines)
- renamed <SID>DecodeFileUrl(dest) to VikiDecomposeUrl()
- fixed problem with table highlighting
  • Loading branch information
tomtom authored and vim-scripts committed Nov 14, 2010
1 parent 79ed8cf commit 8243b04
Show file tree
Hide file tree
Showing 8 changed files with 452 additions and 295 deletions.
8 changes: 8 additions & 0 deletions doc/viki.txt
Expand Up @@ -834,6 +834,14 @@ Etc:
b:vikiMaxFoldLevel. I.e., if you set |foldlevel| to 1, you will see only
the text at level b:vikiMaxFoldLevel.

- b:vikiNoSimpleNames *b:vikiNoSimpleNames*
Default: 0
If non-nil, simple viki names are disabled.

- b:vikiDisableType *b:vikiDisableType*
Disable certain viki name types (see |vikiNameTypes|).
E.g., in order to disable CamelCase names only, set this variable to 'c'.


================================================================================
*viki-highlight*
Expand Down
1 change: 1 addition & 0 deletions etc/Viki.lst
Expand Up @@ -5,5 +5,6 @@
./ftplugin/viki.vim
./indent/viki.vim
./plugin/viki.vim
./plugin/vikiAnyWord.vim
./plugin/vikiLatex.vim
./syntax/viki.vim
54 changes: 36 additions & 18 deletions ftplugin/viki.vim
Expand Up @@ -2,8 +2,12 @@
" @Author: Thomas Link (samul AT web.de)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 12-Jän-2004.
" @Last Change: 26-Jän-2005.
" @Revision: 34
" @Last Change: 01-Okt-2005.
" @Revision: 89

if !g:vikiEnabled
finish
endif

if exists("b:did_ftplugin")
finish
Expand All @@ -26,30 +30,44 @@ exe "setlocal comments=:". b:vikiCommentStart
setlocal foldmethod=expr
setlocal foldexpr=VikiFoldLevel(v:lnum)
setlocal expandtab
setlocal iskeyword+=#

let &include='\(^\s*#INC.\{-}\(\sfile=\|:\)\)'
" let &include='\(^\s*#INC.\{-}\(\sfile=\|:\)\|\[\[\)'
" set includeexpr=substitute(v:fname,'\].*$','','')

let &define='^\s*\(#Def.\{-}id=\|#\(Fn\|Footnote\).\{-}\(:\|id=\)\|#VAR.\{-}\s\)'

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
if b:vikiInverseFold
if b:vikiMaxFoldLevel > head
return ">". (b:vikiMaxFoldLevel - head)
if stridx(g:vikiFolds, 'h') >= 0
let head = <SID>MatchHead(a:lnum)
if head > 0
if b:vikiInverseFold
if b:vikiMaxFoldLevel > head
return ">". (b:vikiMaxFoldLevel - head)
else
return ">0"
end
else
return ">0"
end
else
return ">". head
return ">". head
endif
endif
else
" return foldlevel(a:lnum - 1)
return "="
endif
return 0
endfun

if !hasmapto(":VikiFind")
nnoremap <buffer> <c-tab> :VikiFindNext<cr>
nnoremap <buffer> <c-s-tab> :VikiFindPrev<cr>
endif
fun! <SID>MatchHead(lnum)
" let head = matchend(getline(a:lnum), '\V\^'. escape(b:vikiHeadingStart, '\') .'\ze\s\+')
return matchend(getline(a:lnum), '\V\^'. b:vikiHeadingStart .'\+\ze\s\+')
endf

" if !hasmapto(":VikiFind")
" nnoremap <buffer> <c-tab> :VikiFindNext<cr>
" nnoremap <buffer> <LocalLeader>vn :VikiFindNext<cr>
" nnoremap <buffer> <c-s-tab> :VikiFindPrev<cr>
" nnoremap <buffer> <LocalLeader>vN :VikiFindPrev<cr>
" endif

" compiler deplate

Expand Down
55 changes: 38 additions & 17 deletions indent/viki.vim
Expand Up @@ -3,14 +3,21 @@
" @Website: http://members.a1.net/t.link/
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 16-Jän-2004.
" @Last Change: 05-Feb-2005.
" @Revision: 0.189
" @Last Change: 01-Okt-2005.
" @Revision: 0.216

if !g:vikiEnabled
finish
endif

if exists("b:did_indent") || exists("g:vikiNoIndent")
finish
endif
let b:did_indent = 1

" Possible values: 'sw', '::'
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,e
Expand All @@ -35,12 +42,18 @@ fun! VikiGetIndent()

let cnum = v:lnum
let cind = indent(cnum)
let cline = getline(cnum)

" Do not change indentation in regions
if VikiIsInRegion(cnum)
return cind
endif

let cHeading = matchend(cline, '^\*\+\s\+')
if cHeading >= 0
return 0
endif

let pnum = v:lnum - 1
let pind = indent(pnum)

Expand All @@ -49,21 +62,16 @@ fun! VikiGetIndent()

if plCont >= 0
let plHeading = matchend(pline, '^\*\+\s\+')
if plHeading >= 0
" echo "DBG continuation plHeading=". plHeading
return plHeading
else
" echo "DBG continuation pind=". pind
" if plHeading >= 0
" " echo "DBG continuation plHeading=". plHeading
" return plHeading
" else
" " echo "DBG continuation pind=". pind
return pind
endif
" endif
end

if cind > 0
let listRx = '^\s\+\([-+*#?@]\|[0-9#]\+\.\|[a-zA-Z?]\.\)\s'
let descRx = '^\s\+.\{-1,}\s::\s'

let cline = getline(cnum) " current line

" Do not change indentation of:
" - commented lines
" - headings
Expand All @@ -72,17 +80,26 @@ fun! VikiGetIndent()
return ind
endif


let markRx = '^\s\+\([#?!+]\)\1\{2,2}\s\+'
let listRx = '^\s\+\([-+*#?@]\|[0-9#]\+\.\|[a-zA-Z?]\.\)\s\+'
let descRx = '^\s\+.\{-1,}\s::\s\+'

let clMark = matchend(cline, markRx)
let clList = matchend(cline, listRx)
let clDesc = matchend(cline, descRx)
let cln = clList >= 0 ? clList : clDesc
" let cln = clList >= 0 ? clList : clDesc

if clList >= 0 || clDesc >= 0
if clList >= 0 || clDesc >= 0 || clMark >= 0
let spaceEnd = matchend(cline, '^\s\+')
let rv = (spaceEnd / &sw) * &sw
" echom "DBG clList=". clList ." clDesc=". clDesc
return rv
else
let plMark = matchend(pline, markRx)
if plMark >= 0
return plMark
endif

let plList = matchend(pline, listRx)
" echom "DBG plList=". plList ." plDesc=". plDesc
if plList >= 0
Expand All @@ -93,7 +110,11 @@ fun! VikiGetIndent()
let plDesc = matchend(pline, descRx)
if plDesc >= 0
" echom "DBG plDesc ". pind + (&sw / 2)
return pind + (&sw / 2)
if plDesc >= 0 && g:vikiIndentDesc == '::'
return plDesc
else
return pind + (&sw / 2)
endif
endif

if cind < ind
Expand Down

0 comments on commit 8243b04

Please sign in to comment.