TiddlyWiki5, Raspberry Pi and Vim: A guide for the command line aficionado

181 views
Skip to first unread message

Precious Chicken

unread,
Jul 4, 2021, 9:27:35 AMJul 4
to TiddlyWiki
I hesitate slightly in posting to this group as my use case covers such a niche audience, I'm not sure how much utility there is in sharing it.  However in short I wanted to host a TiddlyWiki on a Raspberry Pi, create tiddlers from the command line and edit them with vim.  Once I figured out how to do that I thought I'd blog about it (mostly so I can retrace my steps later on):

https://www.preciouschicken.com/blog/posts/tiddlywiki5-raspberry-pi-guide/

I'm not sure the nodemon hack will be required in future, I think I read another thread suggesting that this form of updating functionality might be built in (though I could have got that wrong)?

Many thanks to the creator and the maintainers of TiddlyWiki.  Really enjoy using and playing around with it.

Saq Imtiaz

unread,
Jul 4, 2021, 1:41:32 PMJul 4
to TiddlyWiki
That is a very interesting setup, thank you for taking the time to share it.

My use case for notes also involves interacting with them via text editors and other tools as well as  having them in TiddlyWiki. What I set up a few years back was a combo of fswatch + cURL + the tiddlywiki server API. Watching for file system changes wasn't as reliable at the time so the setup was a bit finicky and tricky to get it right. So I've never fiddled with the config or even upgraded the wiki once I had it working.

The next version of TW includes a server sent events feature with which tiddlers propagate from the server to client almost instantly, so that will be my queue to upgrade that wiki. I will need to consider if moving to nodemon might make sense as well, I use it for TW dev at the moment and it does seem to work well enough.

Cheers,
Saq 

Precious Chicken

unread,
Jul 6, 2021, 4:21:56 PMJul 6
to TiddlyWiki
Sorry for delay in response, my first attempt seemed not to get picked up by Google Groups.

Anyway, I appreciate the reply; your set up sounds a lot more sophisticated.  I too will use the new version as a prompt to see if I can refine how I'm doing this, nodemon is fine but definitely feels slightly kludgy.

NB - I've added a video to my original blog post, realised my description of creating tiddlers from the command line is clearer when you can see it.

Yours
Gene

Saq Imtiaz

unread,
Jul 7, 2021, 4:50:39 AMJul 7
to TiddlyWiki
Hi Gene,

For the specific use case that your video demonstrates, i.e. creating short new tiddlers rather than editing existing ones, have you considered the following workflow:

- don't write your newly created tiddler files to the wiki directory.
- instead have vim do a PUT request with cURL to the tiddlywiki to save the tiddler.

Example:

curl -X PUT -i 'http://192.168.0.12:8080/recipes/default/tiddlers/NewTiddlerTitle' --data '{
 "tags": "firstTag anotherTag",
 "creator": "gene",
 "modifier": "gene",
 "text": "The use of knowledge in society"
}' -H "X-Requested-With: TiddlyWiki"


I don't use VIM myself but as far as I know it can execute bash scripts so you could set one up to do the PUT with cURL. Alternatively there seem to be VIM plugins specifically for interacting with APIs.

Cheers,
Saq

David Shaw

unread,
Jul 7, 2021, 5:22:19 AMJul 7
to tiddl...@googlegroups.com
Like Saq, I'm no Vim expert, but there's also the built in VimL language that might be able to do this without having to invoke external scripts.

And thanks for the original post - very interesting and possibly of use to me.

Many thanks,
David Shaw

Precious Chicken

unread,
Jul 7, 2021, 2:01:46 PMJul 7
to TiddlyWiki
@Saq - Ha yes, that's a neat way of getting around the need for nodemon, that I hadn't considered (mostly as I was ignorant of the API / focussed on writing to the folder).  And you could call a bash script from Vim, or as @David Shaw points out an even tidier way would be to write it with VimL. 

If I have time for a project prior to the next release, I might give it a whirl.  Thanks for the suggestion / education.

Yours,
Gene

Saq Imtiaz

unread,
Jul 9, 2021, 5:24:15 AMJul 9
to TiddlyWiki
@Gene this plugin might be worth a look too:

"This plugin enables TiddlyWiki to watch the change in your disk, and if you edit one of your tiddler using editor likes VSCode and save it on the disk, the change will immediately reflected in the browser."

Precious Chicken

unread,
Jul 10, 2021, 10:20:39 AMJul 10
to TiddlyWiki
Thank you, interesting, I hadn't seen this plugin previously.  I've put a link to this thread in the addendum; but I will enlarge the section and put an explicit link to the plugin and include your code snippet too.  Incidentally do you have a home page / social media profile so I can attribute you correctly (assuming you wanted that)? 

Incidentally my blog posts are always like this - it is only when I've finished them I find half a dozen interesting new ways of approaching the problem :)

Yours
Gene

Saq Imtiaz

unread,
Jul 10, 2021, 10:51:46 AMJul 10
to TiddlyWiki
Hi Gene,

No attribution needed from my end, if you feel its necessary a link to Github would do: https://github.com/saqimtiaz
Cheers,
Saq

Precious Chicken

unread,
Jul 10, 2021, 4:25:28 PMJul 10
to TiddlyWiki
👍
Reply all
Reply to author
Forward
0 new messages