-
Is it possible to write a custom command that inserts text at the current cursor position? I wanted to write a command to insert the current date: #!/bin/bash
# @parameters file
# I don't want to use the file param, but it doesn't hurt
# Prints the current date in YYYY-MM-DD
date -u +"%Y-%m-%d" I sort of expected the output of my command to stdout to be inserted at the cursor position, but that doesn't seem to be happening. I know the command can receive the current file path, but (a) rewriting the file by hand is complicated and (b) the command doesn't know the current cursor position (or selection range). Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You are not the first to expect that behavior. I'm currently working on writing better docs for the extensibility and in parallel on extensibility improvements. I will try to implement this as it makes a lot of sense. Will keep you posted.
I agree, this will be more complicated. However, I will be a nice addition to support passing the selection.
We're also planning better support for dates. Quick insertions, parsing and highlighting them, daily notes, a calendar (only if daily notes feature is enabled), etc. BTW, have you tried using third-party apps for that? The most common apps people use are:
The benefit of using a third-party app is that it's a universal solution — once you learn it, you can use it in every other app. |
Beta Was this translation helpful? Give feedback.
You are not the first to expect that behavior. I'm currently working on writing better docs for the extensibility and in parallel on extensibility improvements. I will try to implement this as it makes a lot of sense. Will keep you posted.
I agree, this will be more complicated. However, I will be a nice addition to support passing the selection.