New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hyper link for openning local file in Windows System #71
Comments
That's the purpose ;) I hope I can strike you with the information that this is already possible. Have a look at |
|
Great to know that this had been already implemented. Thanks for pointing out the available source. However, I did not find a way to let Vimwiki know that I am using a windows machine and therefore the format of absolute path would be different (i.e. not starting with ///). What should the syntax be if I want to open the following: I tried Lastly, are spaces permitted in the directory? All the best,
|
|
I can't really test this issue, because I have only limited access to a windows machine, but I noticed that a backslash is apparently not allowed in links. Does |
|
Great, thanks! This fixes the problem on my end. |
|
Yes, the fix had been testified to work well. Here is what I found that is handy to do the conversion: http://vim.wikia.com/wiki/Change_between_backslash_and_forward_slash I used the version with the "ToggleSlash" function. |
|
Reporting another issue: While the |
|
@llinfeng: a link like |
|
@EinfachToll: thank you for pointing to the The restriction: I cannot use Nor would the following work (without the double quotes) Is there a way to "call the absolute path" of a directory? I thinks this will improve the functionality of Vimwiki by a great extent. This is not a problem with the (For Thanks again. |
|
|
|
I don't understand why one needs to have two labels for files. That is, it seems trivial to me to distinguish a relative and an absolute path, so why would you need a label to distinguish this? |
|
You're right. It wasn't my idea ;) |
|
Haha, ok. :) |
|
@einfach; thanks for that clarification of local: vs. file: and :Explore is On 2 December 2014 at 03:41, Karl Yngve Lervåg notifications@github.com
|
|
@EinfachToll, thank you for clarifying the usage for
Thanks again, |
|
Since not everybody has the netrw plugin loaded (me, for example) and this is a rather special demand, I think we leave this functionality to an extra function which the users can write themselves (see function! VimwikiLinkHandler(link)
let link = a:link
if link =~ '^local:.*/'
let local_dir = matchstr(link, '^local:\zs.*')
let abs_dir = expand('%:p:h').'/'.local_dir
" open dolphin in the desired directory. Sorry, I don't know how to open Windows explorer
call system("dolphin " . shellescape(abs_dir) . " &")
return 1
elseif link =~ '^file:.*/'
let dir = matchstr(link, '^file:\zs.*')
" open the directory with netrw
exe "Texplore " . dir
return 1
else
return 0
endif
endfunction
|
|
The function does not work so well. Thank you though. Found:
However, please ignore my request. The relative path worked greatly and I am absolutely satisfied. I appreciate your time and great help. |
|
Firstly I would like to thank you for this amazing plugin. P.S. I'm using OS X Yosemite. |
|
Here is a modified version of the script that works for me. The other suggestions didn't.
function! VimwikiLinkHandler(link)
let link = a:link
let islink = 0
if link =~ '^local:.*'
let islink = 1
let local_dir = matchstr(link, '^local:\zs.*')
let abs_dir = expand('%:p:h').'/'.local_dir
" open dolphin in the desired directory. Sorry, I don't know how to open Windows explorer
" call system("cmd " . shellescape(abs_dir) . " &")
" exe "!explorer '" . substitute(abs_dir,"/","\\\\",'g') . "'"
" return 1
elseif link =~ '^file:.*'
let islink = 1
let abs_dir = matchstr(link, '^file:\zs.*')
" open the directory with netrw
" call system("cmd " . substitute(dir,"/","\\",'g'))
" return 1
endif
if islink == 1
exe "!explorer '" . substitute(abs_dir,"/","\\\\",'g') . "'"
return 1
else
return 0
endif
endfunction |
Remove vfile version. Add vimwiki/vimwiki#71 (comment) based version.
Remove vfile version. Add vimwiki/vimwiki#71 (comment) based version.
It struck me this morning that Vimwiki could be turned into a real knowledge base if it could conduct the action of opening files from local directory.
The ideal thing would be to enable opening of directory and files by a string of directory. For those without file extension, we open it up as a directory (i.e. opening a new folder); for those with certain file extension, we open it up using the default setting by the operating system.
[["Directory"]]might be a reasonable syntax for this purpose.I wish this would be doable.
All the best,
-Linfeng
The text was updated successfully, but these errors were encountered: