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

• edited April 2018

Great suggestions. I would be interested in hearing what anyone else who uses mmd citation style thinks.

For me, the 48[ approach would be the most streamlined, even if not the most intuitive, since it doesn't require having to move (or even touch) the cursor after inserting the citation---the cursor would move automatically to the end of the citekey after insertion and you're on your way.

Of the two methods you suggest, though, the first (ie, placing the cursor into the first pair of brackets on insertion) seems like a significant improvement. It would still require one to shift the cursor outside the citekey in order to continue writing, but that's just a quick cmd+right arrow. I could totally live with that

Of course, I can understand how others, and new users, might be thrown off by any alterations to the behavior of the current citation mechanism.

Any thoughts from other mmd-citation users?

Also: Is there a reason why pandoc style citation does not automatically include the parentheses in the inserted citation? Do you type out your page reference in parentheses (ie (48)) before invoking ZK: Insert Citation?

• @argonsnorts said:
Also: Is there a reason why pandoc style citation does not automatically include the parentheses in the inserted citation? Do you type out your page reference in parentheses (ie (48)) before invoking ZK: Insert Citation?

In pandoc @citekey just cites the source, which is often exactly what I need, i.e. no page number needed (e.g. when citing papers).

• # Thanks Rene

## for your approach and development.

Till last year I was using only simplenote and nvpy in linux. Sublime text 3 with two windows option, markdown preview and your implementation of

• images,
• bibtex file,
• tag search
• and many other utilities added great value. I am new to sublime text and I wonder is there any way that fuzzysearch ctrl shift f display titles in sidebar at the some time I input first characters and after opening in sidebar I can key title which opens article with added color of word search. I already found goto anything and pluggins find in project. Your tag search is doing this with the tags.

Thanks Very much

• The SublimeText Zettelkasten just became more useful...

## Introducing: Zettelkasten Mode

For a sublime Zettelkasten experience, you can enter the Zettelkasten mode:

• bring up the command palette by pressing [cmd]+[shift]+[p] on macOS ([ctrl]+[shift]+[p] on Windows and Linux).
• type zk to list the Zettelkasten commands.
• select 'ZK: Enter Zettelkasten Mode'

This will:

• split your SublimeText window into 3 parts:
• the left part where your tabbed notes are displayed
• the top right part where search results are displayed
• the bottom right part where your saved searches (see below) are displayed

The Zettelkasten Mode allows for easy mouse navigation through your note archive.

Remember: ALT + DOUBLECLICK is sometimes more convenient than CTRL + ENTER

If your search results are empty, a little welcome text with some useful keyboard shortcuts will be displayed. If you don't have any saved searches yet, a few sample searches will be created. This is shown in the screen-shot below:

Note: If you have upgraded this package and entered the Zettelkasten Mode for the first time, SublimeText may be confused about the syntax of your notes. In that case, open a note and use the menu: 'View' -> 'Syntax' -> 'Open all with current extension as...', and select 'sublime_zk > Markdown Zettelkasten'.

### Saved Searches

The Zettelkasten mode introduces a saved searches file. This is a simple Text file where you can name and store search terms.

Its syntax is very simple; to define a search, you just add a line, consisting of the following parts:

• an optional search name
• a colon :
• #! (all tags) and [! (all notes) are also valid search-specs

The search-spec will be highlighted in the file, so you know exactly what will be searched for.

You can place Markdown headings anywhere in the file, too, like this:

# Tag Searches
just one  tag:          #tag
tag1 or  tag2:          #tag1  #tag2
tag1 and tag2:          #tag1, #tag2

# A bit more complex
tag1 but not tag2:                 #tag1, !#tag2
tag1 or anything that's not tag2 : #tag1 !#tag2

# Wildcard searches
anything starting with auto : #auto*
anything starting with auto but nothing starting with plane: #auto*, !#plane*


You can execute the search in one of two ways:

• Place the cursor on a search line (no need to hit the search spec) and press ctrl + enter
• Press ALT and double-click in a search line

In the animation below, the mouse was used.

• edited April 2018

# Thanks Very much Rene!

### "ctrl shift alt f" add fuzzy search for words in all articles.

• Awesome!! Thanks @rene

• edited April 2018

Just want to chime in with my MMD affection to make sure MMD's super features are honored properly and we're all on the same page

• making 45[# expand to a citation like [48][#Ahrens2017] won't work with references that contain spaces, e.g. [See p. 48 and 78][#Ahrens2017], while the "move the cursor afterwards" thing wouldn't distinguish between these cases. (I'd prefer the latter.)
• I detest the other way 'round, like [#foo][123] I don't know why. Both are valid syntax, though.
• MMD will link to a reference item as a whole when you use [][#citekey] or [#citekey][]1; If you want to add an entry to the list of references without placing a footnote/citation anywhere, there also is the special string [Not Cited][#citekey], by the way.

1. I use the version with the empty bracket pair last, [#citekey][], to denote "this is a whole-reference citation" while preferring to put page numbers first if needed, [123][#citekey], if anyone is interested. Maybe this convention is why I don't like to put page numbers last: I then cannot infer from looking at the 2nd character what kind of citation that is. As if that ever mattered. (It didn't.)  ↩︎

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

• @ctietze said:
Just want to chime in with my MMD affection to make sure MMD's super features are honored properly and we're all on the same page

• making 45[# expand to a citation like [48][#Ahrens2017] won't work with references that contain spaces, e.g. [See p. 48 and 78][#Ahrens2017], while the "move the cursor afterwards" thing wouldn't distinguish between these cases. (I'd prefer the latter.)
• I detest the other way 'round, like [#foo][123] I don't know why. Both are valid syntax, though.
• MMD will link to a reference item as a whole when you use [][#citekey] or [#citekey][][^fn1]; If you want to add an entry to the list of references without placing a footnote/citation anywhere, there also is the special string [Not Cited][#citekey], by the way.

[^fn1]: I use the version with the empty bracket pair last, [#citekey][], to denote "this is a whole-reference citation" while preferring to put page numbers first if needed, [123][#citekey], if anyone is interested. Maybe this convention is why I don't like to put page numbers last: I then cannot infer from looking at the 2nd character what kind of citation that is. As if that ever mattered. (It didn't.)

Thank you @ctietze , your MMD affection, expertise, and practice are really valuable here.

At the moment, I am in a bit of a Faust situation:

And here, poor fool, I stand once more,
No wiser than I was before

But, as always, will get there ... eventually

• Good call, @ctietze, in distinguishing between single- and multi-page citations.

I tend to cite single pages or page ranges, such as [48-51], so I neglected to consider more complicated possibilities.

So, I agree with you both that the "move the cursor afterwards" option (if we want to call it that) could certainly work.

• edited May 2018

I am currently using the View All Notes window as a sidebar navigation tool (after hiding Sublime's default sidebar).

How to open additional notes as single detached panes? setting pane to -1 or 0 won't do. I already have three panes in use so I need some extra.

Post edited by Nhaps on
• I have just implemented pane -1: create a new pane. However, I find, this does get crammed pretty quickly. I currently have no idea how to detach the panes (if you mean them becoming separate, floating windows)... But you can detach them manually

So, in short:

    "pane_for_opening_notes": -1,     // open notes in new panes
"pane_for_opening_results": 0,    // keep [! and search results always leftmost


• @Nhaps said:
I am currently using the View All Notes window as a sidebar navigation tool (after hiding Sublime's default sidebar).

How to open additional notes as single detached panes? setting pane to -1 or 0 won't do. I already have three panes in use so I need some extra.

forgot to quote. See above

• edited May 2018

# Can anyone come up with a better name for Sublimeless_ZK?

As Sublimeless_ZK is maturing, I think it can do with a better, maybe more descriptive (as in, possibly, Markdown Zettelkasten) name. New users might not get the whole SublimeMore/Less business.

Does anyone have a good idea? Do you need incentives? Does anyone have a good idea for an incentive?

What about being prominently named in the about dialog: "Named by ..."

Maybe, if the name is cool enough, the then-not-sublimeless_zk-anymore might even make it into the tools section --- that would be awesome!

## oh shoot! wrong thread sorry!

• See, that happens when you name your stuff more and less

• edited May 2018

The feature 'ZK:Auto Bib' is not working at the moment. I maintain the bib file in my ZK folder. The message I get in the SB console is this: "using local /Users/.../Zettelkasten/Bibliography.bib" and at the end of the note there is the comment with the cite key and "no bib generated"

• @Nhaps said:
The feature 'ZK:Auto Bib' is not working at the moment. I maintain the bib file in my ZK folder. The message I get in the SB console is this: "using local /Users/.../Zettelkasten/Bibliography.bib" and at the end of the note there is the comment with the cite key and "no bib generated"

It's not working for you. 'No bib generated' is an indicator that pandoc couldn't generate a bibliography entry from your citekey. There could be many reasons for that, but let's start with the simplest:

Do you have pandoc installed?

• edited May 2018

Yes, I have pandoc version 2.1.3

• @Nhaps said:
Yes, I have pandoc version 2.1.3

Now we're getting somewhere. It is probably the worst timing ever but this is what's often bugging me with, probably most of the time well-meant "bug reports", that unwantedly come across a bit rude. If you just said "Autobib doesn't work", there's not a lot I could do other than check if it works for me, which it does.

The more specific you get, the easier it is for me or anyone else who might have had a similar problem, to help you.

Worse, as an example, if someone only says "X doesn't work", and implicitly or explicitly asks to get it fixed, in my head this often translates to "Yo, fix my problem!". At which stage my mind automatically starts to reason that here someone demands his problem to be fixed, knowing that it can't be fixed, because the problem isn't even stated clearly. "Doesn't work" can mean a lot of things, even in this context (crash (what's a crash?), no autobib generated, a bib generated like you describe now (with error message "no bib generated"), ...). With no clear description of the error, all I can do is try myself, on my system, with my version of the plugin, with my bib file, with my selection of cite-keys, and come to the conclusion that it works.

Automatically then, if I'm in the right mood, the back of my head starts formulating a response like this: "You demand your problem to be solved but don't provide any details. Look, this is free software. I am doing this in my very spare spare time. I prefer to spend my spare time on things that are important (to me), and ideally: fun. . If you want to make demands, please get yourself some commercial software. Its authors will (hopefully) go out of their ways and spend all the time necessary to pull every bit of information needed to fix your problem from you. People are willing to help, in general. With no further information, they just can't. Please provide more details..."

You get the idea.

The best way to get people to help you is by making them feel your pain, like this:

I am using the latest version of the plugin on a Mac. I have a file called Bibliography.bib in my Zettelkasten folder and pandoc version 1.2.3 installed. When I run Autobib, the following is generated:
<!-- references (auto)
[@hahne2011]: (no bib generated)
-->
The citation-key I used was hahne2011 and here is the relevant section of my bib file:
...
...

So, I don't accuse you of having been impolite or even rude. But your issue is a case where we just need more details (the pandoc version number is a start) or else there's no hope to get your issue resolved.

Back to your issue: It seems like either pandoc doesn't like your bib file or that specific entry, or the plugin cannot parse the output from pandoc in this case. Given that people with enormous bib files use the plugin, I am really curious what's so special about yours.

So, can you please provide an example like above? You can of course try to anonymize your bib file entry but then make sure it doesn't work by accident

As an alternative, or even better, in addition, you can try the following, in a terminal:

• cd /path/to/Zettelkasten
• echo "@citekey" | pandoc -t plain --bibliography Bibliography.bib

• just replace citekey with your citation key
• post the full output, including empty lines (especially empty lines)

With that information, it should be easy enough for anyone to reproduce your problem, which is the first step to coming up with a fix or workaround by a fellow user.

I hope I haven't hurt any feelings, I really don't mean to.

• edited May 2018

I hope I haven't hurt any feelings, I really don't mean to.

Let me start with your last sentence, and hopefully I will be short in my response and to the point. You have not hurt my feelings in any way, but I feel that I have hurt yours based on your detailed explanation. The situation that led you to feel this way can be explained as follows.

I have very little knowledge of the technology, and I have been using your professional tools like Sublime_ZK for a few weeks only, with success for the most part. The reason that I was not able to be specific enough about the Auto-Bib is because I have never used pandoc before, so I cannot troubleshoot it correctly. I only use extension .md and pandoc within SB_ZK because of the features, not for output. And I may even later switch to .txt or tex if I can without losing any benefit.

When you created SB_ZK you assumed users would have enough background to use the software right off the bat. But I'm a newbie, and newbies can be confused with people who have knowledge but are sloppy and lazy, and want to take advantage of your precious time. So this is the reason my post came off "across a bit rude," as in "yo, fix my problem!" Please know that this is not the case here. I don't know if you recognize me from other posts, but I always thank you and appreciate your willingness to help and improve the app.

So I should say sorry that my ignorance caused you to profile me as you did. Sometimes I simply cannot give further details because I don't understand the technology well enough. Also, I cannot get myself another software because there is no other app like it for me. I hope I have provided a clearer perspective.

Back to the issue. In terminal I receive the echo ok. Problem must be in my SB settings. This is not an urgent matter for me, but I in this case I will also try to find solutions outside the forum given that some of my problems are too basic for the benefit of other more seasoned users.

• @Nhaps said:

I hope I haven't hurt any feelings, I really don't mean to.

Let me start with your last sentence, and hopefully I will be short in my response and to the point. You have not hurt my feelings in any way, but I feel that I have hurt yours based on your detailed explanation. The situation that led you to feel this way can be explained as follows.

@Nhaps Thanks for your kind response. I am glad I didn't. And you haven't either. Everything's fine on my end. We all have our moments, haven't we? The length of my response just ... happened.

I have very little knowledge of the technology, and I have been using your professional tools like Sublime_ZK for a few weeks only, with success for the most part. The reason that I was not able to be specific enough about the Auto-Bib is because I have never used pandoc before, so I cannot troubleshoot it correctly. I only use extension .md and pandoc within SB_ZK because of the features, not for output. And I may even later switch to .txt or tex if I can without losing any benefit.

I cannot and do not want to blame you for not being a seasoned pandoc user. That would be unfair. The idea was that the plugin only needs pandoc installed to be able to call it in order to create bibliography entries (so I don't have to write code that does that). A user should not have to worry about how that works. What I wanted to point out was that I need more information about your bib file so I can see what pandoc is doing with it -> what the plugin is doing with pandoc's output -> what's going wrong -> fix it. As for .md vs .txt, I think that's your personal preference and either is fine. There is a strong case for using Markdown mark-up, though. I would argue that it gets less in your way than LaTeX. Hence, most tools you see here are based on the concept of notes formatted in Markdown. I use markdown to produce, via pandoc and intermediate LaTeX, really cool PDFs from beautiful reports to scientific papers. Sometimes I keep and tweak the LaTeX (e.g. for table and figure tuning), but that's only at the last stages before submitting / publishing. Based on my experience with that, I would never start with LaTeX from scratch now, except if I needed super-sophisticated formatting of my text that Markdown just has no mark-up for, and where embedding LaTeX is not sufficient.

When you created SB_ZK you assumed users would have enough background to use the software right off the bat. But I'm a newbie, and newbies can be confused with people who have knowledge but are sloppy and lazy, and want to take advantage of your precious time. So this is the reason my post came off "across a bit rude," as in "yo, fix my problem!" Please know that this is not the case here. I don't know if you recognize me from other posts, but I always thank you and appreciate your willingness to help and improve the app.

Yes, you're right there, and it's somehow in the nature of the plugin. SublimeText is not an easy editor, especially with all its plugins, JSON files for settings, etc. So by creating a plugin, I assumed that someone who is using SublimeText already, probably has enough experience to deal with my little plugin. As the plugin grew, that assumption got less and less valid. I get that.

You make a very important point with confusing newbies with "lazy bastards" (paraphrased). Maybe that's even more the case with me when I "have no time" (to judge). This is something I can try to be more careful/mindful about. I do recognize you from other posts but, to be honest, I don't want to rely on my memories about who is who and who said what because of the many posts, issues, and comments I receive, I am sure sometimes I probably confuse people. I agree, you are a nice person, judged by your posts. I realized that, which is why I didn't want to and put in writing that I didn't want to hurt your feelings by what I had written, which was meant to read: Please gimme more details....

So I should say sorry that my ignorance caused you to profile me as you did. Sometimes I simply cannot give further details because I don't understand the technology well enough. Also, I cannot get myself another software because there is no other app like it for me. I hope I have provided a clearer perspective.

I don't profile. No need to be sorry. If I profiled you, you're in the nice person category - and we have a common understanding that you're neither a SublimeText developer nor a pandoc guru, which is fine, nobody really is. Thank you for your perspective. I like it. I am especially flattered that there's just no other app like SB_ZK . Well, I would argue, just for the sake of keeping the shameless bragging going, that SL_ZK comes pretty close

Back to the issue. In terminal I receive the echo ok. Problem must be in my SB settings. This is not an urgent matter for me, but I in this case I will also try to find solutions outside the forum given that some of my problems are too basic for the benefit of other more seasoned users.

Yeah, back to the issue. Since you describe you get the echo OK, I doubt settings are the problem here. Can you please, please, please post (or send to me via message, this board has a send message facility) the output you get? I think this needs to be fixed in the plugin.

Here is what the plugin expects from pandoc:

Short-form citation, most of the times a single line

Bibliography entry, longer text; this goes into the autobib



That is: One line for the citation, a blank line, a longer bibliography entry spanning multiple lines, two empty lines.

Concrete example:

rs$echo "@kaiser2016" | pandoc -t plain --bibliography test.bib Kaiser (2016) Kaiser, C. 2016. “Ein Bild Sagt Mehr Als Tausend Worte.” _Markenartikel_ 10: 62–63. rs$ _


(I have included the shell prompt rs\$ and the cursor _, just for illustration).

So, if there is no blank line separating the two outputs, for instance, the plugin doesn't recognize pandoc's output. It expects that empty line to be there. But maybe there's another reason that confuses the code, so please, if you can just post / send the output from your terminal like I just did, that should help me get a better understanding.

Ideally, if you could find the section of your bib file that contains the entry for the source you are citing, I could try to figure out why pandoc is converting it to a format that the plugin doesn't understand, and make the plugin more robust / capable of dealing with different pandoc output formats...

This is a long post, but don't let that fool you. I still think you're a nice person

• edited May 2018

Thanks for the long post, always helpful. The concrete example was superb, now I have it working!

It is best to use Terminal (or iTerm) to troubleshoot things, SB error messages are not accurate enough. Echo in Terminal picked up all the errors in my bib file. Basically they were some German umlaut, and other fields that were empty. From the line number in Terminal I used the Goto, Goto Line in Sublime to quickly locate the errors. Thanks very much for your patience, @rene!

• @Nhaps said:
Thanks for the long post, always helpful. The concrete example was superb, now I have it working!

It is best to use Terminal (or iTerm) to troubleshoot things, SB error messages are not accurate enough. Echo in Terminal picked up all the errors in my bib file. Basically they were some German umlaut, and other fields that were empty. From the line number in Terminal I used the Goto, Goto Line in Sublime to quickly locate the errors. Thanks very much for your patience, @rene!

Awesome! Great you got it to work! I disabled printing of pandoc error messages to the ST console. Didn't want to spam it... Maybe that was a bad decision.

Yeah, classic bibtex wants Umlauts to be in Latex notation, and important fields shouldn't be empty. Now you know what's important

And cool you found an efficient way to navigate to the error lines

• edited May 2018

Thanks. Yes, for me it would be useful to have all errors displayed in SB but that's not a must as I can use terminal for troubleshooting. As an aside, I use BibLaTeX which is not compatible, or simple to use with Pandoc.

• @Rene, I have noticed a bug: Auto-Bib does not work well with folded text in ST, it will mess up your running text. The temporary solution is to expand all folded text for Auto-Bib to work. Let us know if you can reproduce the bug.

• @rene ... Hi - I‘m just in progress of testing/migrating from zkn to sublime. However: is it possible to have lumannˋs ID-Style? I know the question is somewhat religious but I have a few reasons why I need his numbering scheme?

• @Nhaps said:
@Rene, I have noticed a bug: Auto-Bib does not work well with folded text in ST, it will mess up your running text. The temporary solution is to expand all folded text for Auto-Bib to work. Let us know if you can reproduce the bug.

I don't ever keep text folded. AFAIK Auto-Bib replaces the entire text with new text that consists o the old text with the (replaced) BIB appended. Mayyybe (well, probably) there is a better way to do that, that doesn't mess with folded text.

I what way does it mess up the running text? I would suppose it just unfolds it (since ST treats it as new text)? It doesn't cut off paragraphs or shuffles your lines or sth serious, does it?

• @oal100 said:
@rene ... Hi - I‘m just in progress of testing/migrating from zkn to sublime. However: is it possible to have lumannˋs ID-Style? I know the question is somewhat religious but I have a few reasons why I need his numbering scheme?

Hi @oal100 hmmm. That plugin is super-non-flexible when it comes to IDs. While some of the stuff would work with generic IDs or even just [[links with just text]], the numeric note ID scheme is relatively deeply ingrained into the plugin. It also has the advantage of being relatively unambiguous, as potentially opposed to 1/1a/2b... On top of that, having the file names contain the IDs is a big plus. With Luhmann style IDs they would get cumbersome to deal with on the shell, for some other tools, as '/' also serves as directory separator.

So, mayyybe it could be done, but there is no quick fix for the plugin I fear.

Maybe you will find some workaround...? Like using numeric IDs for (new) links but naming the notes with Luhmann IDs ...? Something in that direction.

• @rene Thanks for your answer. I’d have no issues if the timestamps are used internally and not visible - because I think this is a great concept. As for the IDs I should be able to generate files and filenames „1a22b Topic.md“, the topic be #1a22b Topic and the link be [[1a22b Topic]]... no „/„ needed. Would that be possible?

• @rene said:

@Nhaps said:
@Rene, I have noticed a bug: Auto-Bib does not work well with folded text in ST, it will mess up your running text. The temporary solution is to expand all folded text for Auto-Bib to work. Let us know if you can reproduce the bug.

I don't ever keep text folded. AFAIK Auto-Bib replaces the entire text with new text that consists o the old text with the (replaced) BIB appended. Mayyybe (well, probably) there is a better way to do that, that doesn't mess with folded text.

I what way does it mess up the running text? I would suppose it just unfolds it (since ST treats it as new text)? It doesn't cut off paragraphs or shuffles your lines or sth serious, does it?

No text gets lost, but at first text folds in wrong location. Upon folding and expanding again with the mouse it corrects itself.

• Positive feedback: Auto-Bib references are searchable under ST's Find in Files (shift-cmd-F). Very good @rene