On Friday, February 28, 2020 at 8:49:45 AM UTC-5, Thomas Passin wrote:

> On Thursday, February 27, 2020 at 10:51:42 PM UTC-5, andyjim wrote:
>
>>  Sorry to bring it up again, but one of the key things for me is to be 
>> able to launch a new zettel in an instant, without required steps before I 
>> can start writing.  I am suspicious that if I have to type in three or four 
>> headings, decide upon titles, etc, in order to create a new zettel, that I 
>> might end up not using the system.  Currently all I do to start a new 
>> thought is skip a line and write.
>>
>
I revised the command to insert an ID, so that it also inserts the creating 
date.  Here's the new script:

"""Insert a node id/tomestamp string at the cursor."""
undoType = 'zettel-insert-id'
w = c.frame.body.wrapper
oldSel = w.getSelectionRange()
w.deleteTextSelection()
s = ':id: ' + p.gnx
id_label = f':id: {p.gnx}\n'
time_string = ':created: ' + c.getTime(body=True) + '\n'

i = w.getInsertPoint()
w.insert(i, f'{id_label}{time_string}')

c.frame.body.onBodyChanged(undoType, oldSel=oldSel)

Now to create a new node for a zettel, create a node, type in its name, 
click the mouse in the body, and hit <ALT>-F8 (or bind it to any other key 
you like).  You get both the id line and a second line that starts with 
:created:.

The headline of the node for this command in MyLeoSettings would be

@command zettel-insert-id @key=Alt+F8

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/8571db29-b399-4c7c-828b-0cae838fadce%40googlegroups.com.

Reply via email to