-
Notifications
You must be signed in to change notification settings - Fork 66
Feature: Allow to specify default schemes per link type and filetype #301
Description
wiki.vim is all about links in various filetypes. A link as a concept is the combination of an URL with a description. For some link types, the description is not mandatory. A URL starts with a scheme that can be used to recognize how the URL should be handled; e.g. wiki in wiki:page or http in http://example.com. However, if there is no preceding scheme, then wiki.vim will assume some default scheme - usually the wiki scheme.
I believe it would be good to add an option that specifies the default scheme for all supported link types. The option would look something like this:
*g:wiki_link_default_schemes*
A dictionary to configure the default URL scheme for the various link types.
The default scheme is the implied scheme for a link URL when the URL lacks
a scheme.
The keys represent a link type and the values are either strings, in which
case they specify the default scheme, or dictionaries between |filetype|s and
default schemes.
Default: >vim
let g:wiki_link_default_schemes = {
\ 'wiki': {'wiki: 'wiki', 'adoc': 'adoc'},
\ 'md': 'wiki',
\ 'md_img': 'file',
\ 'ref': '',
\ 'org': 'wiki',
\ 'date': 'journal',
\ 'adoc_xref_inline': 'adoc',
\ 'adoc_xref_bracket': 'adoc',
\ 'adoc_link': 'file',
\ 'shortcite': 'zot',
\}To implement this, we would need to ensure that the wiki.vim representation of the URL object is enriched with the scheme based on the link type context and the new option (if the URL does not have a scheme already).