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

Use virtual text to show titles of linked pages #41

Closed
voidus opened this issue Feb 19, 2022 · 10 comments
Closed

Use virtual text to show titles of linked pages #41

voidus opened this issue Feb 19, 2022 · 10 comments

Comments

@voidus
Copy link

voidus commented Feb 19, 2022

Especially when generating filenames, links aren't easy to follow, so this would be nice.

https://github.com/pyrho/nerveux.nvim does this for neuron, so maybe we can scavenge some code from there.

@mickael-menu
Copy link
Member

Did you try setting the LSP diagnostics in zk's config? It should display the note title next to a link.

https://github.com/mickael-menu/zk/blob/main/docs/config-lsp.md#diagnostics

[lsp.diagnostics]
# Report titles of wiki-links as hints.
wiki-title = "hint"
# Warn for dead links between notes.
dead-link = "error"

@kabouzeid
Copy link
Collaborator

I guess what is meant here is showing the note title instead (as an overlay "on top") of the link as virtual text.
Like this: https://raw.githubusercontent.com/pyrho/static-imgs/c4ed4fd7844b2306d228128540dc290e75b221ff/nerveux.jpeg

Might be worth exploring.

@kabouzeid
Copy link
Collaborator

For what it's worth, I'm currently using the [title](noteid) syntax + vim's conceal feature to display it as just title.
The added benefit is that I can make the title something different than the literal note title, which often reads better. Wikipedia pages also do this.

See also: https://github.com/mickael-menu/zk-nvim#syntax-highlighting-tips


Handling this at the plugin level with virtual text like nerveux does would be even better though because it would also work for [[wikilinks]] and plays nicer with treesitter highlighting.

@voidus
Copy link
Author

voidus commented Feb 19, 2022

I missed the config setting, so this definitely helps with my ux need. That said, I think this can be left open, because the virtual text.

The conceal setting looks nice, I use wiki links for neuron/emanote compatibility though. I think it should still be possible with [[file|link title]] syntax, maybe I'll look into that at some point.

Thanks a lot for the quick replies!

@kabouzeid
Copy link
Collaborator

Ah I didn't know about the [[id|title]] syntax. Don't know if zk can even handle this syntax.

I'll look into the virtual text feature once I find some time.

@mickael-menu
Copy link
Member

Ah I didn't know about the [[id|title]] syntax. Don't know if zk can even handle this syntax.

Yes it's supported.

@kabouzeid
Copy link
Collaborator

There's no good way to do this right now. The virtual text can't add or remove any columns.

References:
neovim/neovim#15706
neovim/neovim#9496

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 5 days.

@github-actions github-actions bot added the stale label Mar 22, 2022
@voidus
Copy link
Author

voidus commented Mar 22, 2022

not stale

@github-actions github-actions bot removed the stale label Mar 23, 2022
@mickael-menu
Copy link
Member

I don't think we can implement this currently in NeoVim. Personally I'm not a fan of the result with https://github.com/pyrho/nerveux.nvim as the titles are cropped when they exceed the length of the link. I assume it's also awkward when it's too short.

The feature itself is handled with LSP diagnostics which show the full title.

We can reopen this issue if there's a better way to answer this need.

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

3 participants