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

[feature] Organization of Pages with Categories or Tags #19

Closed
jounathaen opened this issue Feb 27, 2019 · 11 comments
Closed

[feature] Organization of Pages with Categories or Tags #19

jounathaen opened this issue Feb 27, 2019 · 11 comments

Comments

@jounathaen
Copy link

This plugin is actually quite nice!
I started a wiki and it feels like a very good system to take notes.
But now I stumbled over the problem, that I want to create some kind of overview pages.
Example: all notes about/related to ProjA. At the moment, I have to track them manually.

I don't have a final idea of how it should look like, but I think of some kind of category or tag system.
I imagine adding [[Tag:ProjA]] to a Wiki page and then inserting/updating a list of all the pages with this tag in the ProjA overview automatically or at least manually.
(Simmilar to the journal functionality)

Bonus Idea: Maybe even organizing the files in folders according to the categories? But I guess this does not work (or is at least complicated - symlinks) if a page can have more than one category...

@jounathaen jounathaen changed the title [feature-request] Organization of Pages with Categories or Tags [feature] Organization of Pages with Categories or Tags Feb 27, 2019
@lervag
Copy link
Owner

lervag commented Feb 28, 2019

This plugin is actually quite nice!

Thanks!

I personally don't need any such system of organization. The reason is simply that I generally keep track of everything manually. That said, I'm not against adding such a system. But if we do, then I think it should be well thought through. In the sense that it will add value that is not easily brought from other tools.

As an example: If I want to find notes related to a particular topic, I use one of the following methods:

  • ctrlsf: A very good Vim plugin for searching. I use it with ripgrep as a backend, which makes it very fast. This way I can find almost anything worth finding very quickly.
  • CtrlP: I've added :CtrlPWiki as a command in the plugin, which relies on CltrP (of course). It makes it easy to search and open notes by name.

So, say we added a tag system that allows one to add tags to notes. We would need to do several things:

  • Specify a tag syntax (or more than one); it should be "compatible" to the filetype one wants to use.
  • Decide if the tags should be specific to a particular note (i.e. file), or if it can be local to a section of a note. If the latter, it should be clearly justified.
  • Add functionality that utilizes the tags. Would we need more than the possibility to list all notes that contain a given tag? If so, what?

Before I implement anything, I want to finish this discussion and to clearly specify how it should work. Preferably, I should be able to write the documentation and some tests before I implement. That way I will waste less time redoing things after the initial implementation.

@jounathaen
Copy link
Author

Thanks for your reply. I'll dump my ideas here 😉

As an example: If I want to find notes related to a particular topic, I use one of the following methods

Yes that is possible, but I think the point of having wiki.vim is to add some comfort to this. It would be possible to maintain a wiki completely without this plugin in pure vim, but that is not what I want 😄

My usecase would probably be solved by something like a combination of the behaviour of WikiGraphFindBacklinks function and the WikiPageToc.

Let's say, I add something like [[Tag:ProjA]] to a file (which is apparently not supportet at the moment).
Then in my overview page i could call something like :WikiGraphFindTag ProjA which has behaviour like WikiPageToc i.e. it can create or update a sorted list of the results.

  • Specify a tag syntax (or more than one); it should be "compatible" to the filetype one wants to use.

What about [[Tag:mytag]]? Does this collide with something? I don't have a full overview about the link syntax yet. But this would allow to create a "special meaning text object" with the already existing and very comfortable method of pressing enter.
It could also create a tag page (maybe in a seperate folder) with a backlink to the current wiki page.
But it doesn't have to be solved with a link.

  • Decide if the tags should be specific to a particular note (i.e. file), or if it can be local to a section of a note. If the latter, it should be clearly justified.

I'd say file specific. If I'm thinking about something like Wikipedia, you have links which can point to pages and sections, which is already possible in wiki.vim. But you also have "Categories" for a page which will automatically add the page to the category's page.

  • Name: I'd rather go for Tag instead of "Category" because it is faster to type and more clear that a page can have multiple tags. (Some systems only allow one category for one kind of thing).
  • Automatically update: Might by comfortable, but I don't know if this is "vim spirit". But having a command for manually updating a tag collection would be great.
  • Add functionality that utilizes the tags. Would we need more than the possibility to list all notes that contain a given tag? If so, what?

For my usecase that is enough, but maybe some plugins which generate websites from a vim wiki could utilize it/already have such a feature

Before I implement anything, I want to finish this discussion and to clearly specify how it should work. Preferably, I should be able to write the documentation and some tests before I implement. That way I will waste less time redoing things after the initial implementation.

👍
It would be great to hear other ideas!

@lervag
Copy link
Owner

lervag commented Mar 5, 2019

Yes that is possible, but I think the point of having wiki.vim is to add some comfort to this. It would be possible to maintain a wiki completely without this plugin in pure vim, but that is not what I want smile

Agreed (and good point).

It seems to me that the tag feature of Vimwiki [0, 1] is close to what you want. And due to the already close relationship, it seems sensible to make something similar to this.

For a first implementation, I propose the following:

  • Syntax: :tag-one:tag-two:...:. Tags can not contain spaces. This is the same as the Vimwiki syntax.
  • Tags are file specific. If desired, we may consider to expand on it later. This differs from Vimwiki, where tags may also be section specific. If we could restrict the tags to eiher be at the top and/or the bottom of a wiki page/file, then searching would probably be very fast.
  • :WikiTagSearch - a command that searches for the specified tag. I think it should allow :WikiTagSearch -output=<arg>, where <arg> can be specified to direct the output to e.g.
    • location list (default)
    • below the cursor
    • scratch buffer
    • simple echo
      The function would basically first collect a list of the matching wiki pages, then it would output the list at the desired location.
  • Possibly: If searching for tags turns out to be slow, then we could consider to implement a tag cache.

I'll refine this list with the continued discussion, and when we agree I'll begin implementing.

@jounathaen
Copy link
Author

I agree with all points.
I'd suggest to add an alias function WikiTagInsertListwhich is basically the same as WikiTagSearch -output=cursor.
The latter is a long command and might scare beginners (like me 😄) but I like the Idea of beeing able to search for the Tags. It'd be great if that function would update a current tag list, if exists (like the TOC).

lervag added a commit that referenced this issue Mar 29, 2019
@lervag
Copy link
Owner

lervag commented Mar 29, 2019

I've begun to work on this now. It is not fully functional, but the ideas are progressing.

@lervag
Copy link
Owner

lervag commented Mar 29, 2019

Now it is getting closer to ready, and I'd be happy to get some feedback.

@kwrobert
Copy link
Contributor

kwrobert commented Mar 30, 2019 via email

@lervag
Copy link
Owner

lervag commented Mar 30, 2019

@kwrobert I don't mind considering something like that, but I think it is smart to polish the initial version of this feature first. So, please open a new issue with this suggestion, then we can further discuss it there and I can consider to implement it later.

@lervag
Copy link
Owner

lervag commented Mar 30, 2019

I think the current implementation now covers the basics. It would be convenient if further enhancement requests are described in separate issues. Feel free to give general feedback and/or notice of bugs related to the "basic" mechanisms here. In the meantime, I'll take the liberty of closing this issue.

@lervag lervag closed this as completed Mar 30, 2019
@edrex
Copy link

edrex commented Nov 7, 2019

I just want to drop a note here that I am plotting a markdown macro-expansion preprocessor that can output link lists matching a query string. Haven't decided on a final syntax but I think the POC will expand

## My List | linksTo:somePage

appending

* [Each](Each.md)
* [Match](Match.md)

The idea being that you could have it run on editor focus/save to update. Inspired by TiddlyWiki macros and https://github.com/tbabej/taskwiki.

POC # 2 might be to automatically append a backlinks list to each file if there are backlinks.

@lervag
Copy link
Owner

lervag commented Nov 7, 2019

@edrex Thanks. If you want to collaborate, e.g. couple what you are doing with wiki.vim, then feel free to open a new issue for a full discussion.

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

4 participants