Replies: 5 comments 57 replies
-
At the moment, it is not super clear / complete what I have in mind for tags. Obviously: syntax coloring. That should be easy for normal Bringing up telescope grep searches for tags is another obvious one: find notes containing tags (considering all tags, specific tag), insert tags, 'follow' tags: find notes containing tag under the cursor. Tag searches with multiple tags: This is where it gets really interesting: There is option number one, which is telescope. Telescope, I just found out, lets you select multiple items. Standard binding for that is Another question leading to where I want to go: When you select multiple tags, do you want to search for notes containing all of them ( What about finding all notes that contain This is where my other idea comes in: a special buffer type, handily dockable somewhere like the calendar, that can be used for both user input (searches) and output (results). For instance, that buffer could always automatically be populated with actual Here is a fictional example of it showing details about the current note - which could be templated; another template could show just the backlinks. # Title
The title of the note
# Tags in this note
#asdfsadf
#tag234
# Links in this note
[[asfdasdfsdf]]
[[asfdasdfsdf]]
[[asfdasdfsdf]]
[[asfdasdfsdf]]
# Back-links to this note
[[asfdasdfsdf]]
[[asfdasdfsdf]]
# citekeys in this note
@renerocksai2021
# notes citing the same sources
[[The invention of the wheel]] It could also be populated with # Search results for: #that_tag
[[first matching note]]
[[another matching note]]
[[third matching note]] Once we have that buffer type where results can be placed, why not have a second buffer that can be saved to disk? With that, we could implement features like 'favorites' and 'saved searches'. See also: Saved Searches in Sublimeless_ZK. Consider this: # My favorites (totally made up)
[[Projects]]
[[Shopping list]]
[[Goals]]
# Useful searches
most recent notes : [! {sortby: mtime, order: desc}
most-referenced notes : =refcounts(min:1, max:1000) {sortby: refcount, order: desc}
unfinished projects: #project & !#finished Here is a screenshot of what that could look like (from Sublimeless_ZK): In the above example you see the saved searches at the bottom, and the search results at the top, after the Obviously I would aim for an easier syntax in the form of I think telescope is super awesome for quickly showing the results of a search, with preview - and then picking one. But a special buffer for search results makes them less transient, more persistent. From there you can yank and paste entire lists of interesting links into your notes... And saved searches can be live-savers (well, time and quality (consistency)) savers for workflows that rely on complex searches that have to be repeated frequently. So, this is the direction in which I want to take things, loosely related to tags. 😄 |
Beta Was this translation helpful? Give feedback.
-
Just another thought: bringing up telescope for tag insertion is certainly possible. Inserting tags from there would be easy. If you use multiple selections, all selected tags would be inserted. But we could also leave the picker running after insertion, so one would be able to insert multiple tags one by one. An additional approach would certainly be: auto completion. I know nothing about how to implement that yet but having a 'completion source' would be super cool for:
I know there is a 'null-lsp' thing that lets one feed things like completions into nvim, lsp-style. Maybe that is an option. |
Beta Was this translation helpful? Give feedback.
-
We are 1 step further! I just pushed initial tag syntax support! You can now highlight your You can learn more in the README. Check out "Tag notation", and also the Telekasten supports the following tag notations:
---
title: My awesome note
date: 2021-12-06
tags: [ example, note-taking, foo, bar ]
--- Tag syntax: I kept this identical to what Obsidian supports. I know how super complex 'tag regexes' can get. So,
The only symbols allowed are:
Numbers are allowed in tags, as long as a tag is not purely numeric. For example, #1984 is not a valid tag, but Note: For proper highlighting, the Regarding colors: " colors for tags: (use magenta or a more gruvbox-friendly purple like below)
hi tkTag ctermfg=175
" tag separator is only relevant in the following syntax:
" tags: [ tag1, tag2, tag3 ]
hi tkTagSep ctermfg=gray``` I learned a lot about syntax, telescope, and plenary: syntaxWhat had been bugging me for a while, was that After a while, I figured out: if I load the telekasten syntax a second time ( So eventually, I worked it out: To avoid mixing markdown syntaxes in strange orders (depending on what other plugins one uses), I had to define a With the new parameter pre-viewing the new syntaxTelescope does not use conventional vim methods to figure out the file type of a file. That would be too slow for the Its only drawback, I thought, was: that it looks into But then I looked into the code: it uses The only drawback is: The file supplied to plenary is fixed. This fixes the markdown file extension to So, right now I don't know what the best option is: put all expected file extensions into the new file - and a note in the README where to change it (which could lead to trouble after plugin updates by the plugin manager: overwriting or refusing to update). Or - I could try if anyone has a problem when the file gets auto-generated with only the configured extension. I lean strongly towards the latter. |
Beta Was this translation helpful? Give feedback.
-
Check out : Config option: Supports BTW it shows how many matches there are in your notes, per tag: |
Beta Was this translation helpful? Give feedback.
-
So far the tag searching isn't working on my machine. I have rg installed, but I get this error:
|
Beta Was this translation helpful? Give feedback.
-
I just saw that you added "add support for #tags" in the backlog. This would be a fantastic feature indeed!
What do you have in mind for that? I also thought about it and was planning to make a feature request issue, but I could not find a way that would work with telescope. That being said, I am not a Telescope expert...
The features that would be awesome for me are mostly
It might also be useful to consider the variety of tag styles directly when implementing this. Some people like to use
#tag
, some:tag:
. Some also have tag hierarchy like#topic/subtopic
or#topic.subtopic
. There may be other styles as well (not sure if it is necessary to support all, but at least one or two of the most common ones).Beta Was this translation helpful? Give feedback.
All reactions