Skip to content

Feature: Allow to specify default schemes per link type and filetype #301

@lervag

Description

@lervag

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions