Skip to content
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

Allow link completion for multiple file types #312

Closed
weibeld opened this issue Jun 21, 2023 · 2 comments
Closed

Allow link completion for multiple file types #312

weibeld opened this issue Jun 21, 2023 · 2 comments

Comments

@weibeld
Copy link

weibeld commented Jun 21, 2023

Description

I have a use case where I mix Markdown and YAML files in the same wiki. This can be enabled by setting g:wiki_filetypes = ['md', 'yaml'] so that wiki.vim gets enabled in both types of files.

The problem with this is that the link completion function (which I guess is defined in complete.vim) provides only completion suggestions for files of the same type as the current file. That is, when triggering the completion in a Markdown files, only Markdown files are suggested and when triggering completion in a YAML file, only YAML files are suggested.

This stands in contrast to WikiPages which returns all files of the types defined in g:wiki_filetypes, that is, it returns all Markdown and YAML files in the wiki.

I would like the link completion to include all wiki files (as returned by WikiPages) and not only the files of the same type as the current file. Is there some way to achieve this?

Minimal working example

Consider the following wiki with g:wiki_filetypes = ['md', 'yaml']:

wiki/
├── markdown1.md
├── markdown2.md
├── yaml1.yaml
└── yaml2.yaml

When triggering the link completion in markdown1.md, the suggestions include only markdown1.md and markdown2.md. When triggering link completion in yaml1.yaml, the suggestions include only yaml1 and yaml2. The WikiPages command in both cases includes markdown1, markdown2, yaml1, and yaml2.

@lervag
Copy link
Owner

lervag commented Jun 21, 2023

Fascinating. This is a use case I never thought of.

In my view, a yaml file should represent data, somehow - not text. And so, it should be a file: url, not a wiki url. That is, I would have expected a link like <file:yaml1.yaml> or [my yaml file](file:yaml1.yaml) in this particular case.

I do notice that e.g. GitHub will consider [foo](bar.yaml) as a link to the file bar.yaml in the same directory as the current file. I assume this is "general", i.e. [foo](file) will open file regardless of the extension.

For wiki.vim, it still makes sense to differ between the schemes here, as it makes it easier to handle things. But OK, given the g:wiki_filetypes setting, the links already work as expected already. And I think I can see how you would want completion to work similarly.

lervag added a commit that referenced this issue Jun 21, 2023
@lervag
Copy link
Owner

lervag commented Jun 21, 2023

Ok, I believe this is fixed now.

@lervag lervag closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants