Insert capture at the end of an existing line #505
|
Is it possible to use "Insert After" to insert a capture at the end of an existing line, rather than on a new line below the existing line? |
Replies: 4 comments
|
With a capture, you have the option to "insert at the end of the file". If you leave that unselected (and leave "insert after" unselected), then the text will be inserted at the current cursor position. In your case, that's probably what I'd do: open the not in edit mode, place your cursor in the right place, and run the capture. Note, QuickAdd offers a lot of different ways to solve this problem, so if you want any other ideas let me know. One more note, if you're trying to modify the value of a data field you might want to take a look at MetaEdit. The QuickAdd docs has examples of calling MetaEdit from QuickAdd. |
|
Hi Nico, thanks for your reply. What I'm looking for in this case is a capture that will insert text into a file without that file being open, at the end of a line where there is already other text. For example, I might have a file where I record daily health information, and that file might have a line in the frontmatter to record my weight each day:
What I'm looking for is a capture that I can run to input a weight measurement at the end of that line, from anywhere in my vault, without having to open the file. The end result would look like this:
Sounds like maybe I need to look into MetaEdit. |
|
so hard…… |
|
Coming back to this very late - sorry about that. The answer has changed since 2023: Capture can do exactly this now, and MetaEdit has been archived, so here's the current way. For your weight example, set up the Capture choice like this:
Run it from anywhere in the vault and Shipped in v2.10.0. Docs: https://quickadd.obsidian.guide/docs/Choices/CaptureChoice#insert-after Closing as resolved. |
Coming back to this very late - sorry about that. The answer has changed since 2023: Capture can do exactly this now, and MetaEdit has been archived, so here's the current way.
For your weight example, set up the Capture choice like this:
Health/{{DATE:YYYY-MM-DD}}.md)weight:{{VALUE:weight}}(leading space so the value sits after the colon)Run it from anywhere in the vault and
weight:becomesweight: 62.7without the file ever opening. If yo…