Fix <BS> under Windows

It didn't do anything after you hit a link which jumps inside a buffer.
This makes me realize that there are probably a lot more issues under
Windows.
This commit is contained in:
Daniel Schemala 2017-03-01 21:38:14 +01:00
parent 88405934f1
commit 56cb06e73e
2 changed files with 10 additions and 4 deletions

View File

@ -247,7 +247,7 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{
let source_file = a:1 let source_file = a:1
else else
let source_wiki = g:vimwiki_current_idx let source_wiki = g:vimwiki_current_idx
let source_file = expand('%:p') let source_file = vimwiki#path#current_wiki_file()
endif endif
let link_text = a:link_text let link_text = a:link_text
@ -406,7 +406,7 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
\ || link_infos.scheme =~# 'diary' \ || link_infos.scheme =~# 'diary'
let update_prev_link = is_wiki_link && let update_prev_link = is_wiki_link &&
\ !vimwiki#path#is_equal(link_infos.filename, expand('%:p')) \ !vimwiki#path#is_equal(link_infos.filename, vimwiki#path#current_wiki_file())
let vimwiki_prev_link = [] let vimwiki_prev_link = []
" update previous link for wiki pages " update previous link for wiki pages
@ -414,7 +414,7 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
if a:0 if a:0
let vimwiki_prev_link = [a:1, []] let vimwiki_prev_link = [a:1, []]
elseif &ft ==# 'vimwiki' elseif &ft ==# 'vimwiki'
let vimwiki_prev_link = [expand('%:p'), getpos('.')] let vimwiki_prev_link = [vimwiki#path#current_wiki_file(), getpos('.')]
endif endif
endif endif

View File

@ -75,7 +75,7 @@ function! vimwiki#path#path_common_pfx(path1, path2) "{{{
endfunction "}}} endfunction "}}}
function! vimwiki#path#wikify_path(path) "{{{ function! vimwiki#path#wikify_path(path) "{{{
let result = resolve(expand(a:path, ':p')) let result = resolve(fnamemodify(a:path, ':p'))
if vimwiki#u#is_windows() if vimwiki#u#is_windows()
let result = substitute(result, '\\', '/', 'g') let result = substitute(result, '\\', '/', 'g')
endif endif
@ -83,6 +83,12 @@ function! vimwiki#path#wikify_path(path) "{{{
return result return result
endfunction "}}} endfunction "}}}
function! vimwiki#path#current_wiki_file()
return vimwiki#path#wikify_path(expand('%:p'))
endfunction
" Returns: the relative path from a:dir to a:file " Returns: the relative path from a:dir to a:file
function! vimwiki#path#relpath(dir, file) "{{{ function! vimwiki#path#relpath(dir, file) "{{{
let result = [] let result = []