Zettelkasten Forum


Rene's SublimeText for Zettelkasten - Package, Talk and more

edited November 2017 in Software & Gadgets

Sorry for spamming but SublimeText users, you might find this useful: https://github.com/renerocksai/sublime_zk

It handles links and notes with (automatic) timestamp-based IDs well.

I should probably mention that I am the author and derived this from Dan Sheffler's MyWiki package.

Post edited by Sascha on
«13456711

Comments

  • just in case anyone has downloaded it already, i made a little fix and also added automatic insertion of the note title upon note creation.
    it is now considered v1.0 :-)

  • Awesome!

    Sublime Text is one of my favourite alternatives to the archive. For the upcoming course on knowledge work there should be definitely a segment on how to make use of sublime.

    If your package fits in it gets a big shoutout.

    I am a Zettler

  • Sascha, that would be super awesome!

    Working with my own tool, I realized I had introduced a stupid regression which causes new notes being created when following links.

    BUGFIX: Replace sublime_zk.py with the latest version on github :-|

    I have tested it now and it works again as intended. Sorry for the inconvenience.

  • Sublime_ZK just became more awesome! It now supports multiple note archives via SublimeText projects! :)

    As a consequence, you don't even need to configure the location of your archive anymore.

    Download it from GitHub: https://github.com/renerocksai/sublime_zk

    ... and if anyone is trying it, tell me what you think.

  • We're approaching a stable release!

    • Things got a bit simpler: no more dependencies on the Bracketeer plugin!
    • New setting to automatically insert the note ID into the note's title, when creating a new note.

    This should enable you to start quickly with the Zettelkasten method, and no more copy/paste of note IDs...

    :-)

    I might be the only one using this, but I'm super happy with it :-D

  • Highlighting of note links is in there; I think this makes it easier on they eyes :)

  • I think, I've got it all covered now.

    sublime_zk, now with even more highlighting ;-)

    I hope you don't mind my spamming. But so far, every time I thought it's finished, it didn't take long until I found something else that's missing.
    :#o:)

  • No, its fine. I'll rename the thread so it will be easier to identify: Your outpost for your sublime Zettelkasten. :smile:

    I am a Zettler

  • Great work, @rene! The updated "Tools" page will be up in a few minutes :)

    Author at Zettelkasten.de • https://christiantietze.de/

  • Thanks a lot @Sascha and @ctietze!!! I hope I'll have the time soon to spam even more :), describing how I use it for my (beginner-level, I guess it takes years to achieve "ZK Mastery") Zettelkasten work.

    I really enjoy it a lot, this Zettelkasten method. And my little plugin now feels like a major upgrade to SublimeText. My editor has just gotten more useful - a lot!

    Non-sublime-specific: "Fragmented writing" really boosts my productivity. And knowing that every thought, every note, has a place now and can be retrieved when I need it, pointing me to further notes and thoughts, branching off into related thoughts and topics -- just makes it perfect! Had I only known this ... years ago. Why did nobody tell me??? :p

    Now I feel confident of being able to write a substantial amount of text about a topic of my liking, going into depth, because I've been collecting all these notes, like, all the time :)

    Thinking of it, this is similar to how I worked when I was a (very curious) kid, exploring and researching stuff. I read and made notes about how I would describe it, I wrote paper notes about related topics and carried them around in a "folder" :). I could always pull them out, flip through them, re-arrange them... In a way that was a very natural way of working with elaborated thoughts. I used my paper notes a lot to get back into the flow when I wanted to pick up something I had worked on, after a break, to go even deeper into the matter. And it was very easy to come up with really good texts about my "research".

    So, in short: Yeyyy, I'm feeling young again :)
    (I am 40, very old judged by my younger self; very young judged by my fictional older self)

  • Can you please commit it to package control, since it's been bundled into Sublime Text as the official plugin manager?

  • edited November 2017

    @rene Thanks for making this great plugin! You've done a good job. I like how it works.

    I opened some issues on your repository, and also some pull requests to help improve the plugin. Sublime has lots of nifty features that your plugin can take advantage of, for example the completions API to auto-fill zettel notes without leaving the flow of text entry!

    Check out my pull requests and I look forward to your thoughts!

    Thanks

  • edited November 2017

    @yee said:
    Can you please commit it to package control, since it's been bundled into Sublime Text as the official plugin manager?

    You can install a plugin straight from Github using Package Control. I submitted a pull request for @rene to add the instructions to the package readme. until then, you can view the instructions here:

    https://github.com/toolboxen/sublime_zk/tree/package-control#automatic-installation--updates

    hope that helps

  • Woooha! What happened "over night"? :) Well, @toolboxen -- how awesome is that?!?!? Thanks a million for your most valuable contributions!!!
    I am not a SublimeText expert and you know some details I simply don't. Thank you for all the issues (very thought provoking and sensible) and your pull requests (which means you've provided source code I can merge - awesome!). I already merged your pull requests!

    Will look at the issues and check how to commit it directly to package control (thx @yee for the reminder!).

    Thanks for all the valuable feedback! I really appreciate it! That's how we make progress :D

  • thanks @rene but I know just enough stuff about sublime to be dangerous. ;) but it's cool to have a package for sublime to develop into a useful foundation for zettel-related work.

  • @toolboxen looking forward to creating a useful foundation then :)

  • edited November 2017

    Time for an update... A lot has changed under the hood of this little plugin. Special thanks goes out to @toolboxen for all those good ideas and help B) :thumbs up: !!!

    I hope I don't forget anything, but the news (details are in the README on GitHub) are...:

    • package control installable (not perfect yet, you have to add https://github.com/renerocksai/sublime_zk to your package control repositories)
    • we support both [[double]] and [single] bracket links :smile:
    • (we are also back underlining only IDs and not the brackets)
    • an additional way to insert links to existing notes: auto-completion with ctrl+space
    • automatic 'save project as...' when creating a new note in an empty window -> gets you started with a new archive super quickly
    • most things now even work without a project: just open a file from your archive and following links, creating links should work

    Here are the latest screen-shots:

  • Wow, a lot of progress in so short of time! good work!

  • Aaaand now we're more in line with the usual way syntax coloring etc is handled in SublimeText. This makes it a tiny bit more involved to install/configure but it will be more flexible in the long run, avoiding potential conflicts / issues with other Markdown packages or color schemes, etc.

  • @rene thanks for letting me assist improving the plugin. It works quite smoothly and I think it will help a lot of people!

  • Your contributions are highly appreciated! Two minds are better than one! :wink:

  • Oh, we have an experimental new feature, especially for people with not-so-many notes :smile: . Tag search. Triggered by entering [#]+[?] :wink:

  • And while we're at it, we can produce a sorted tag list that doesn't go away on demand with [#][!]. It's not self-updating (permanently scanning for tags is a waste of energy) but can be updated every time you need to, by pressing [#][!] again :smile:

    Thanks again to @toolboxen for his suggestions and hints. :smile:

  • What use is a list of tags if you can't find your notes by tag?

    Just press [ctrl]+[enter] on a tag (like following a note-link) and it will pre-fill a find-in-files panel for you. All you need to do is press [enter] to accept it in order to bring up the search results :smile:

    tagsearch

    Results:

    From this results window you can open the resulting notes by simply clicking on them :smile:

    This is quite a smooth workflow:

    • point-and-click
    • [ctrl]+[enter]
    • [enter]
  • Hi Rene,

    Thanks so much for making this remarkable package! I've been a user of Dan Sheffler's wikilink package for a while and this really extends that functionality in promising directions.

    The one issue I've been having is with the syntax underlining and gutter bookmarks for the links. I have the links set to the default double square brackets and the sublime search field acts properly in being initiated by my pressing two open brackets. It then inserts the file name and two closing brackets. The issue is that the link is not then underlined or bookmarked. If I make the link single brackets, however, by deleting one on each side, it underlines the link and puts a bookmark in the gutter as it should. All of my settings are default, so I assume this should not be the default behavior?

    I've uninstalled and reinstalled the package and still get the same result. I've also double-checked all of the user settings and everything seems fine. Finally, I did have it installed manually prior to it being available via package control (and prior to single-bracket links being an option) and the double-bracket syntax worked exactly as expected at that time.

    Do you by chance know what might be causing this?

    Either way, thank you so much again for your efforts! This has been so much fun to play with.

  • @zverhope Thanks! Feedback is always appreciated! :smile:

    It then inserts the file name and two closing brackets. The issue is that the link is not then underlined or bookmarked.

    One thing that comes to mind is that the underlining and bookmarking only happens if the text between the brackets is a 12-digit number. The plugin is intended to work with notes following this ID convention. If you have arbitrary filenames not containing spaces (or where the 1st word makes them unique) they would work, too, in terms of inserting and following links but the "highlighting" via underlining and gutter symbol will not work.

    This is intentional, especially since we support single bracket links now, too. The plugin should stay away from ordinary texts in brackets or other markdown constructs that use square brackets.

    If I make the link single brackets, however, by deleting one on each side, it underlines the link and puts a bookmark in the gutter as it should.

    This I cannot explain. Maybe some other plugin is doing that?

    All of my settings are default, so I assume this should not be the default behavior?

    Correct, this is not the desired behavior! However, I cannot really explain it. The setting regarding double brackets is only used when links are inserted by the plugin and has nothing to do with the highlighting (underline, gutter). I have notes, see the README screenshots that contain both [links] and [[links]]. They get highlighted correctly.

    Maybe it's possible that your manual install and your Package Control install are interfering with each other? Can you delete the manual install or move it outside of any SublimeText folder?

    If you provide more details (screenshot / test file / anything that helps) I should be able to help you better.

    Ah, and did you select Markdown Zettelkasten as syntax? That's sort of required now to get the syntax coloring right.

    Hope we can fix your issue so you can have even more fun playing with it :smile:

  • @zverhope Some more info & background: I just checked. One of the changes I made recently was introducing the syntax file. In older versions I 'manually' searched for [[ and ]] to find note-links. Now I do it differently: I let SublimeText mark up the text according to the syntax (coloring and assigning it a "scope"). Then in the plugin I ask SublimeText to return to me all the regions of text with that specific scope.

    This has a few advantages, like users can now change the style and coloring of note links more easily, and theoretically it's also faster to let SublimeText do more of the work (plugin code is bound to be slower).

    But it also means, underlining and gutter symbol will only work if the MardownZettelkasten syntax is selected. You can see & change the active syntax in the bottom right of the SublimeText window.

  • @rene Thank you again for the thorough response. This is all exactly as I had thought--and I made sure to thoroughly read the README before bringing the issue to you. So it's vexing me as to what could be causing the issue, as I believe everything is as it should be. Just to go through the list to verify:

    • my links are 12 digits (time-stamped UIDs as generated by your package, which corresponds with what I had been using earlier)
    • I removed the manual install prior to installing via Package Control
    • and I have selected Markdown Zettelkasten as my syntax (and set it to default for .md files in my .sublime-project file)

    I do see the syntax, but only when either single square brackets are used or (even more strangely) when double brackets are used to open and a single bracket is used to close. I'll attach a screenshot here for reference:

    So, I'm a bit puzzled. It's possible that another package is conflicting with yours, but I can't imagine where that conflict might be occurring. And as the double brackets were working properly on the manually installed version of your package, it's strange to me why it's stopped working since.

    It is, however, almost certainly a problem on my end (as it seems to work properly on yours), so it may not be possible for you to guide me to its correction. I really do appreciate all of your help though, as well as the time and effort you've put into this for all of our benefits.

  • Hi Rene,

    I seem to have fixed it by going in and altering the syntax file just slightly. I went in and altered the regex in line 25 to:

        - match: '(\[\[)([0-9]{12})(\]\])'
    

    My additions are (obviously) one outer and inner square bracket, which I escaped appropriately. The syntax is now adding brackets and bookmarks as expected.

    I'm uncertain if I've simply altered the portion meant to apply to the double bracket being set to false, but it's no matter if so, as I don't need that option available.

    Thanks again for all of your help!

  • @zverhope thx for the clarifications... when I made "major" modifications to the plugins, sometimes it was useful to restart SublimeText but I guess that won't help you.

    Seeing your screenshot, I more and more think that something else is messing with your [[ double ]] brackets. Especially when closing with a single bracket you can see that whatever is interfering does not get triggered.

    This might be a syntax file you are using (I vaguely remember that in the early days of the plugin I had issues with MarkdownEditing), which overrides terms in brackets that themselves are enclosed in brackets. See the different coloring inside the first pair of brackets.

    The reason why it used to work before is because at that time my plugin did not care about syntax, it just looked out for note-ids in brackets applied a scope, underlining, etc to them. This has changed slightly now. Now it relies that the note-ids are correctly identified by SublimeText itself.

    You can use Tools->Developer->Show scope name (make sure the cursor is inside the note-ID) to verify that you get different scopes for single and double brackets. The underlined ones contain markup.zettel.link and the other ones very likely don't. But they should. Because, as per syntax file any [ followed by a 12-digit number and a ] should be marked as markup.zettel.link. So single or double shouldn't make a difference.

    That's why I think some other syntax is messing with your setup. When I get back to it I can try to put a fallback mode into the plugin, together with a parameter to enable it, so that you can switch back to syntax-agnostic and then it should work. Text color and underline color will most likely differ then, but at least you'd get underlines and gutter symbols :smile:

Sign In or Register to comment.