Can drafts have vim mode?

hi, can drafts have vim mode?

Thanks!

10 Likes

I was thinking about the same thing. I hope it has vim mode.

That would be perfect

just came here looking to see if there is a vim keybindings mode for drafts. i definitely am +1 this feature.

I do not think that it is a core feature candidate for Drafts.

Tadpole has a nice command line/prompt action that easily could be mapped to a special key (maybe not Esc I would think)

From there grab the functions you like from a project like http://coolwanglu.github.io/vim.js/streamlinejs/vim.html

Or you could just work with plain files and import them later into drafts…

-1 from me (sorry, there are many things that should integrated to Drafts core
but not…)

1 Like

+1. I spend a lot of time writing notes with snippets of code in them, and as a result I end up more often than not having to create/edit them in my text editor and then copy them to Drafts. If I could edit with vim keybindings (even relatively basic bindings), then it would make Drafts 10x more fluid and useful to me.

To be clear, I think it would only be desirable/necessary to provide this on macOS, since iOS wouldn’t see much benefit from having the capability.

I’m not sure what Drafts currently uses for text editing internally, but assuming its not completely custom, perhaps its possible to pull in a dependency that handles providing different sets of keybindings without having to build it from scratch, e.g. what AceEditor provides for web-based text editors.

The only time - for me - when there is a clear case for editing code in Drafts is when writing action steps in javascript. Then I have automation to copy to BBEdit on Mac. And then to copy back later.

Vim has an awful lot of key bindings varying by mode from what I recall; it’s probably been a couple of decades since I last touched it so I doubt the options decreased in number. As such, I’m not convinced that all of the possible options would make sense to implement in an editor like Drafts. I can’t imagine that given all of the custom development that Greg has put into it that building in such a core piece of Vim would be anything but a major undertaking.

Perhaps binding specific actions to say CMD+ the typical Vim key binding might be sufficient? Not equivalent, but merely sufficient to at least partially scratch the itch?


I don’t know if you would find this useful Martin, but in case you are regularly copying back and forth for testing, you might like to try the approach I take. In the ThoughtAsylum - Power User action group is an action called TAD-Execute Test Function. I use this to trigger an action called TA_test() in a test file. I just add my code into that function or use it to call other functions defined in the file.

The default settings for the group will look for test library files in /Library/Scripts/tad-testlibs.txt. Each test library file to be loaded in is on a separate line. I use tad-test.js as my default file (though I include others in here until I’m ready to build them into the main library), and that’s where I define the TA_test() function.

This means that I can edit the code in the file in iCloud in an external JavaScript code editor with whatever bells and whistles I like. When I save, it is immediately available for me to run in Drafts.

If the code is to go in a Drafts action, I’ll copy it in at the very end. But, because I find it easier to edit (on the Mac at least) in an external editor, I have a tendency to keep most of my code in files, and use the actions to call the code from the file.

1 Like

Thanks for this!

I would probably do this with Textastic.

I’d just like to note that an explicit use case for Neovim (the vim-compatible “alternative”, if you will, to “regular vim”) is to be embeddable so that things like this are possible with no need to emulate functionality. For example, check out the VSCode Neovim extension’s “How it works” section to see exactly how they implement it - the TLDR is that it essentially uses Neovim as a “backend” for the current editor, and commands are just sent to the neovim “backend” which writes to the document itself. Pretty neat actually.

Just figured I’d mention that as an alternative, even though I doubt that it’ll ever get implemented in Drafts. A guy can dream!

3 Likes

As someone who has transitioned my primary work machine to an iPad pro, I disagree. And it doesn’t need to be just code that I’d want to use this for. Markdown and many other text types would be much easier to manipulate with vi-style keybindings.

Just here to add my +1 for a vim mode! After many years using Drafts, it’s the feature I still wish for the most.

+1 for vim mode! Probably only makes sense on Mac app, not so much for mobile/tablet versions.

+1 for this feature!

+1 for this feature.

+1 for me. I use vim everyday for programming, so it’s muscle memory at this point.

+1 also. I’m using vim bindings so much that it’s a pain not to have them

+1 It would be great.