zk-org / zk-nvim

Neovim extension for zk
https://github.com/zk-org/zk
GNU General Public License v3.0
502 stars 40 forks source link

Link incorrectly formated after completion #124

Closed lcmen closed 1 year ago

lcmen commented 1 year ago

Hello! I'm using nvim-lspconfig for LSP without any auto complete plugins. When I type [[ and use v:lua.vim.lsp.omnifunc (LSP completion as omnifunc), then characters that triggered autocompletion ([[) are not removed upon selection.

Is there a way to remove [[ after inserting a link?

# actual text after completion:
[[[Untitled](abc)]]

# expected:
[Untitled](abc)

Thanks for any help!

eric-hansen commented 1 year ago

I believe the expected behavior is for that to be the case though. ZK is a Wiki-style notetaking system similar to Roam, Logseq, etc... (I would call them backlinks but not sure if that would be appropriate in this context).

So I guess my question is why use [[ when you are trying to use a normal Markdown link/reference?

lcmen commented 1 year ago

@eric-hansen how can I change a character that is used for autocomplete? Without typing [[, I'm not able to get notes from omnifunc completion.

eric-hansen commented 1 year ago

I'm an LSP w/ cmpe user myself so I can't answer how to make that happen. But, also, for ZK the use of [[...]] is what links different notes/documents together, as expected.

So essentially are you looking for a Markdown tool or a notetaking tool?

ZK is a notetaking tool with Markdown-supported syntax. But if you're trying to reference other notes then you should use the backlink structure ([[...]]) and not the Markdown structure ([]()).

lcmen commented 1 year ago

From what I know []() is also supported by zk, isn't it?

mickael-menu commented 1 year ago

Yes, [[ is the trigger for both wiki links and markdown links. However, it requires LSP features not always available in the editor.

Try to modify the use-additional-text-edits config property (true or false, I don't remember the default value).

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

lcmen commented 1 year ago

@mickael-menu thanks for suggestion, unfortunately it doesn't work with nvim-lspconfig and v:lua.vim.lsp.omnifunc.

lazywei commented 1 year ago

@lcmen did you solve this eventually or did you end up with using wiki link?

lcmen commented 1 year ago

Unfortunately, I didn't solve it.

lazywei commented 1 year ago

I see. Did you end up just using wiki link? And is using wiki as link-format makes the completion etc. work correctly?

github-actions[bot] commented 1 year ago

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[bot] commented 1 year ago

This issue was closed because it has been stalled for 5 days with no activity.