I often take quick notes using vim or any other editor and I would like to easily dump this note to devonthink so that I can manage it later.
At best it would be that this file is moved to devonthink not just copied and it would be nice if the interaction does not involve any mouse movements
Using open with a proper build x-devonthink URL in the terminal might do the trick (if you put that in a shell script or something like it). Check out the section on âURL Commandsâ in the âAutomationâ section of the handbook.
For example, this
open "x-devonthink://createRTF?title=New%20bookmark&location=http%3A%2F%2Fwww.devontechnologies.com&noselector=1"
hm this looks something I can try out.
In fact it would be event better to have a small vim plugin where the current buffer can be saved as a file to devonthinkâŚ
I will have a look if this is somehow possible
I have actually played around with this in the past.
As @rmschne mentioned DT3 provides an Inbox that sits in the filesystem and is monitored for new files. Once a file is in there it gets moved (as in mv) into the Global Inbox.
Hence you cannot have any file persist in the Inbox.
So if you save a vim buffer there without exiting the window, the file will disappear and vim will warn you that the file does not exist. Your buffer will remain intact, so you can actually write to that location again. It will just create a new file (and you will have multiple instances in DT3).
So itâs far better to script to write to file, close file and !mv to the Inbox, if that is what you want to achieve.
I just map a shell env variable (e.g. $INBOX) to that location so I can quickly move files in there from the terminal (or within vim).
The location of the Inbox is ~/Library/Application Support/Devonthink 3/Inbox/.
There is another way if you are willing to use DT3 to âIndexâ a directory.
You make a new directory anywhere in the file system (ie can be on an iCloud folder as well), or can be an existing directory.
In the DT3 database of your choice select File > Index Files and Folders... and choose that directory.
Now you can write your vim buffer to a file in that directory and you should see changes reflected in DT3. And in fact, you can move in the opposite direction as well - changes you make from within DT3 on an indexed file will show up on your vim buffer but you will be warned of noeol (no a big deal).
I donât use this method because there are so many moving and asynchronous parts. And I have suffered from duplicated files in the past due to file version collisions. If you are willing to deal with these issues then this could be a viable workflow.
You can read more about indexed files in DT3 in the Help section.
I know itâs an old issue but perhaps someone will find parts of my workflow useful:
Textfiles written in neovim or helix. As I write in markdown exclusively, all files get a yaml header with a key-value-pair of tags: and - for instance - #itd (import to devonthink).
The directory is watched by hazel which is enormous useful. All markdown files with a date modified older than 10 minutes AND the tag #itd get the MacOS tag itd (or any other exclusive tag or color). After that the files where moved to DT Inbox by hazel.
In DT an automation for removing the tag/color and filing in groups can kick in.
(In production this workflow is a little bit more complicated but I hope you get the picture.)
UPDATE: late addition if you only want to add a MacOS tag via terminal/command line have a look at Brett Terpstraâs cli tool vitag here: https://brettterpstra.com/projects/vitag/