You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a expansion is run I want to be able to check the entire line and if it is not prefixed then replace the entire line plus expansion and if it already has the prefix just expand.
Example:
shortcut : ^t$ which executes the below to add a date stamp.
let date = moment();
return date.format('HH:mm') + ' - '
I want it to check the line it is executing on to see if it has a '-' starting it somewhere..
This works. - ;;t;
becomes - 12:34 -
This does not have a - prefixing the line so I want to add the '- ' as a prefix and then add the expansion. ;;t;
becomes - 12:34 -
or some data already ;;t;
becomes - some data already 12:34 -
Something like this is what I want to do. I found expansionInfo.line in my hunt which would be currentLineExpansionIsRunningOn in the code below.
let date = moment();
if(currentLineExpansionIsRunningOn.trim().startsWith('-')) {
// All good, continue with normal append.
return date. Format('HH:mm') + ' - '
} else {
// Replace the line or prefix the line as needed.
someFunctionReplaceExpansionLineWith(' - ' + date.Format('HH:mm') + ' - ')
someFunctionReplaceExpansionLineWith(' - ' + currentLineExpansionIsRunningOn + date. Format('HH:mm') + ' - ')
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When a expansion is run I want to be able to check the entire line and if it is not prefixed then replace the entire line plus expansion and if it already has the prefix just expand.
Example:
shortcut : ^t$ which executes the below to add a date stamp.
I want it to check the line it is executing on to see if it has a '-' starting it somewhere..
This works.
- ;;t;
becomes
- 12:34 -
This does not have a - prefixing the line so I want to add the '- ' as a prefix and then add the expansion.
;;t;
becomes
- 12:34 -
or
some data already ;;t;
becomes
- some data already 12:34 -
Something like this is what I want to do. I found
expansionInfo.line
in my hunt which would becurrentLineExpansionIsRunningOn
in the code below.Beta Was this translation helpful? Give feedback.
All reactions