Search code examples
emacsyasnippet

Positon cursor at a specified location in yasnippet


I have such a snippet

# -*- mode: snippet -*-
# name: test
# key: test
# condition: t
# expand-env: ((yas/indent-line 'fixed) (yas/wrap-around-region 'nil))
# --

*** Expenses ""

After insert this snippet to org doc, the cursor is positioned at the head of next line.

How could place the cursion inside the string "?Cursor" of heading *** Expenses ""?


Solution

  • The cursor ends up in the placeholder $0 when present. So, the snippet body should be

    *** Expenses "$0"
    

    BTW, the yas/... variables are obsolete, having been replaced by yas-... prefixes, eg. yas-indent-line and yas-wrap-around-region.