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

feat: auto complete links #1295

Merged
merged 2 commits into from
Feb 8, 2024
Merged

Conversation

benlubas
Copy link
Contributor

@benlubas benlubas commented Feb 6, 2024

Adds auto completion for links to the completion module.

closes #752

screen_cap.mp4

Here's a list of the completions:

  • {:|} workspace relative file paths
  • {#|} all headings in the current file
  • {*|} level 1 headings in current file (TODO status is removed)
  • {**|} level 2 headings in current file (and so on)
  • {^|} footnotes in the current file
  • {:path:#} headings from the file at path
  • {:path:*} level n headings from the file at path
  • {:path:^} footnotes from the file at path. Will find ^ footnote and ^^ long footnote

All of these should work with spaces after the item (ie. {# |} will still complete correctly).

All of them should close the link correctly if it's not closed (ie. selecting a completion when the text looks like this: {:| will close the link with :}).


  • Currently the completion source shows as text. I'm not sure how to change that. It would be nice to change them to like Keyword or Symbol or something so that it's more clear that these are valid headings/paths being suggested by neorg, not just text from the buffer.

  • There might be more links that I'm missing, I want to make sure I've covered them all.

  • this might be really slow in large workspaces. It's not a problem for me though, but admittedly I don't have a ton of notes.

@vhyrro vhyrro merged commit bd12dac into nvim-neorg:main Feb 8, 2024
1 of 2 checks passed
vhyrro pushed a commit that referenced this pull request Feb 17, 2024
sahinf pushed a commit to sahinf/neorg that referenced this pull request May 15, 2024
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

Successfully merging this pull request may close these issues.

completions for links
2 participants