commit 56cb06e73e9850e60b6eb53bad8bb98ded1ab872
parent 88405934f1dfa48576a29e87fa7d290cebbda0a3
Author: Daniel Schemala <daniel.schemala@baselabs.de>
Date: Wed, 1 Mar 2017 21:38:14 +0100
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.
Diffstat:
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim
@@ -247,7 +247,7 @@ function! vimwiki#base#resolve_link(link_text, ...) "{{{
let source_file = a:1
else
let source_wiki = g:vimwiki_current_idx
- let source_file = expand('%:p')
+ let source_file = vimwiki#path#current_wiki_file()
endif
let link_text = a:link_text
@@ -406,7 +406,7 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
\ || link_infos.scheme =~# 'diary'
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 = []
" update previous link for wiki pages
@@ -414,7 +414,7 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
if a:0
let vimwiki_prev_link = [a:1, []]
elseif &ft ==# 'vimwiki'
- let vimwiki_prev_link = [expand('%:p'), getpos('.')]
+ let vimwiki_prev_link = [vimwiki#path#current_wiki_file(), getpos('.')]
endif
endif
diff --git a/autoload/vimwiki/path.vim b/autoload/vimwiki/path.vim
@@ -75,7 +75,7 @@ function! vimwiki#path#path_common_pfx(path1, path2) "{{{
endfunction "}}}
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()
let result = substitute(result, '\\', '/', 'g')
endif
@@ -83,6 +83,12 @@ function! vimwiki#path#wikify_path(path) "{{{
return result
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
function! vimwiki#path#relpath(dir, file) "{{{
let result = []