Skip to content

Commit

Permalink
Version 3.17
Browse files Browse the repository at this point in the history
- FIX: g:vikiOpenUrlWith_ANY for Windows
- Moved definition of fold related variables to ftplugin/viki.vim
- viki_viki: Anchors in URLs can start with an upper case character
- viki#RestoreCursorPosition(): use winrestview() (reported by Marko Mahnic)
  • Loading branch information
tomtom authored and vim-scripts committed Nov 14, 2010
1 parent 402051c commit a8f14b0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 31 deletions.
13 changes: 8 additions & 5 deletions autoload/viki.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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: 2010-02-20.
" @Revision: 0.614
" @Last Change: 2010-03-09.
" @Revision: 0.621

" call tlog#Log('Load: '. expand('<sfile>')) " vimtlib-sfile

Expand Down Expand Up @@ -427,7 +427,8 @@ endif
if !exists("g:vikiOpenUrlWith_ANY") "{{{2
" let g:vikiOpenUrlWith_ANY = "exec 'silent !". g:netrw_browsex_viewer ." '. escape('%{URL}', ' &!%')"
if has("win32")
let g:vikiOpenUrlWith_ANY = "exec 'silent !rundll32 url.dll,FileProtocolHandler '. shellescape('%{URL}')"
" let g:vikiOpenUrlWith_ANY = "exec 'silent !rundll32 url.dll,FileProtocolHandler '. shellescape('%{URL}')"
let g:vikiOpenUrlWith_ANY = "exec 'silent ! RunDll32.EXE URL.DLL,FileProtocolHandler '. shellescape('%{URL}', 1)"
elseif has("mac")
let g:vikiOpenUrlWith_ANY = "exec 'silent !open '. escape('%{URL}', ' &!%')"
elseif $GNOME_DESKTOP_SESSION_ID != ""
Expand Down Expand Up @@ -1189,8 +1190,9 @@ function! viki#RestoreCursorPosition(...) "{{{3
if has_key(s:positions, bn)
let ve = &virtualedit
set virtualedit=all
exe 'keepjumps norm! '. s:positions[bn].w0 .'zt'
call setpos('.', s:positions[bn].pos)
" exe 'keepjumps norm! '. s:positions[bn].w0 .'zt'
" call setpos('.', s:positions[bn].pos)
call winrestview(s:positions[bn].view)
let &virtualedit = ve
endif
endf
Expand All @@ -1205,6 +1207,7 @@ function! viki#SaveCursorPosition() "{{{3
let bn = bufnr('%')
let s:positions[bn] = {
\ 'pos': getpos('.'),
\ 'view': winsaveview(),
\ 'w0': line('w0'),
\ }
" \ 'eol': (col('.') == col('$')),
Expand Down
12 changes: 8 additions & 4 deletions autoload/viki_viki.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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-09-03.
" @Last Change: 2010-01-03.
" @Revision: 0.0.124
" @Last Change: 2010-02-28.
" @Revision: 0.0.127

let s:save_cpo = &cpo
set cpo&vim
Expand Down Expand Up @@ -128,10 +128,14 @@ function! viki_viki#SetupBuffer(state, ...) "{{{3

if viki#IsSupportedType("u") && !(dontSetup =~# "u")
let urlChars = 'A-Za-z0-9.,:%?=&_~@$/|+-'
" let b:vikiUrlRx = '\<\(\('.b:vikiSpecialProtocols.'\):['. urlChars .']\+\)'.
" \ '\(#\('. b:vikiAnchorNameRx .'\)\)\?'. b:vikiUrlRestRx
" let b:vikiUrlSimpleRx = '\<\('. b:vikiSpecialProtocols .'\):['. urlChars .']\+'.
" \ '\(#'. b:vikiAnchorNameRx .'\)\?'. b:vikiUrlRestRx
let b:vikiUrlRx = '\<\(\('.b:vikiSpecialProtocols.'\):['. urlChars .']\+\)'.
\ '\(#\('. b:vikiAnchorNameRx .'\)\)\?'. b:vikiUrlRestRx
\ '\(#\(['. b:vikiLowerCharacters . b:vikiUpperCharacters .'_0-9%]\+\)\)\?'. b:vikiUrlRestRx
let b:vikiUrlSimpleRx = '\<\('. b:vikiSpecialProtocols .'\):['. urlChars .']\+'.
\ '\(#'. b:vikiAnchorNameRx .'\)\?'. b:vikiUrlRestRx
\ '\(#['. b:vikiLowerCharacters . b:vikiUpperCharacters .'_0-9%]\+\)\?'. b:vikiUrlRestRx
let b:vikiUrlNameIdx = 0
let b:vikiUrlDestIdx = 1
let b:vikiUrlAnchorIdx = 4
Expand Down
23 changes: 21 additions & 2 deletions ftplugin/viki.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
" @Author: Tom Link (micathom AT gmail com?subject=vim)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 12-Jän-2004.
" @Last Change: 2009-12-26.
" @Revision: 416
" @Last Change: 2010-02-28.
" @Revision: 418

" if !g:vikiEnabled
" finish
Expand All @@ -21,8 +21,27 @@ let b:did_ftplugin = 1
let b:vikiCommentStart = "%"
let b:vikiCommentEnd = ""
let b:vikiHeadingMaxLevel = -1


if !exists("b:vikiMaxFoldLevel") | let b:vikiMaxFoldLevel = 5 | endif "{{{2
if !exists("b:vikiInverseFold") | let b:vikiInverseFold = 0 | endif "{{{2
" Consider fold levels bigger that this as text body, levels smaller
" than this as headings
" This variable is only used if g:vikiFoldMethodVersion is 1.
if !exists("g:vikiFoldBodyLevel") | let g:vikiFoldBodyLevel = 6 | endif "{{{2

" Choose folding method version
if !exists("g:vikiFoldMethodVersion") | let g:vikiFoldMethodVersion = 4 | endif "{{{2

" What is considered for folding.
" This variable is only used if g:vikiFoldMethodVersion is 1.
if !exists("g:vikiFolds") | let g:vikiFolds = 'hf' | endif "{{{2

" Context lines for folds
if !exists("g:vikiFoldsContext") "{{{2
let g:vikiFoldsContext = [2, 2, 2, 2]
endif


exec "setlocal commentstring=". substitute(b:vikiCommentStart, "%", "%%", "g")
\ ."%s". substitute(b:vikiCommentEnd, "%", "%%", "g")
Expand Down
29 changes: 9 additions & 20 deletions plugin/viki.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
" @Author: Tom Link (micathom AT gmail com?subject=vim)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 08-Dec-2003.
" @Last Change: 2010-02-20.
" @Revision: 2678
" @Last Change: 2010-03-09.
" @Revision: 2686
"
" GetLatestVimScripts: 861 1 viki.vim
"
Expand Down Expand Up @@ -40,7 +40,7 @@ if !exists('g:loaded_tlib') || g:loaded_tlib < 32
finish
endif
endif
let loaded_viki = 316
let loaded_viki = 317


" Configuration {{{1
Expand All @@ -65,23 +65,6 @@ if !exists('g:vikiMenuLevel')
let g:vikiMenuLevel = 1 "{{{2
endif

" Consider fold levels bigger that this as text body, levels smaller
" than this as headings
" This variable is only used if g:vikiFoldMethodVersion is 1.
if !exists("g:vikiFoldBodyLevel") | let g:vikiFoldBodyLevel = 6 | endif "{{{2

" Choose folding method version
if !exists("g:vikiFoldMethodVersion") | let g:vikiFoldMethodVersion = 4 | endif "{{{2

" What is considered for folding.
" This variable is only used if g:vikiFoldMethodVersion is 1.
if !exists("g:vikiFolds") | let g:vikiFolds = 'hf' | endif "{{{2

" Context lines for folds
if !exists("g:vikiFoldsContext") "{{{2
let g:vikiFoldsContext = [2, 2, 2, 2]
endif

" if !exists("g:vikiBasicSyntax") | let g:vikiBasicSyntax = 0 | endif "{{{2
" If non-nil, display headings of different levels in different colors
if !exists("g:vikiFancyHeadings") | let g:vikiFancyHeadings = 0 | endif "{{{2
Expand Down Expand Up @@ -719,5 +702,11 @@ VikiDefine()) in order to reduce startup time
3.16
- FIX: Handling of cursor positions (reported by Marko Mahnic)

3.17
- FIX: g:vikiOpenUrlWith_ANY for Windows
- Moved definition of fold related variables to ftplugin/viki.vim
- viki_viki: Anchors in URLs can start with an upper case character
- viki#RestoreCursorPosition(): use winrestview() (reported by Marko Mahnic)


" vim: ff=unix

0 comments on commit a8f14b0

Please sign in to comment.