# Tag Info

## Hot answers tagged yasnippet

2

You need to put the snippet into a folder with the name of the mode to use it in as follows: snippets/org-mode/diary_template Check out the documentation: Organizing snippets > Basic structure: . |-- c-mode | -- printf |-- java-mode | -- println -- text-mode |-- email -- time Expanding snippets > ... > Eligible snippets : YASnippet ...

2

Probably just change $1 to$0. That will just put the cursor there to start typing. From the documentation: Tab stops are fields that you can navigate back and forth by TAB and S-TAB. They are written by $followed with a number.$0 has the special meaning of the exit point of a snippet. That is the last place to go when you've traveled all the fields. ...

2

(setq ac-auto-start nil) ac-auto-start Specify how completion will be started. t means always starting completion automatically. nil means never started automatically. An integer means completion will not be started until the value is more than a length of the completion target string. It's described in the Auto-Complete User Manual.

2

Your source code block has text set as the mode. Try changing that to read #+BEGIN_SRC snippet :tangle ~/org/snippets/bibtex-mode/article

2

You can set header arguments in Org mode properties (see (org) Using Header Arguments) to avoid repeating, for example, all code blocks in this org file will have :dir /tmp #+PROPERTY: header-args :dir /tmp #+BEGIN_SRC sh pwd #+END_SRC #+RESULTS: : /private/tmp I also have the following command in my init file, it duplicates the last src block's header, ...

1

I think what you're looking for is to treat the underscore as part of the word, as Vim does. The best answer is probably this one - look at the solution adding advice around evil-inner-word

1

You can disable pairing of <..> as follows: (add-function :before-until electric-pair-inhibit-predicate (lambda (c) (eq c ?<)))

1

You can delete chars from the buffer during expansion, but modifying the buffer during expansion is dicouraged. Deleting chars is pretty easy, because yasnippet allows to eval elisp code during expansion. You have to put this code into back-quotes Read more about it here. Your snippet would then look like this example (you need to refine this crude example,...

1

You can do this with an extra step (see "Nested placeholder fields" in the manual): \sum${1:_{${2:}}}^{$3}$0 With the optional field: TAB, TAB, insert field 1, TAB, insert field 2, TAB to exit. Without the optional field: TAB, C-d, insert field 2, TAB to exit. Another option is to use a function that deletes the empty field in case it finds one: \sum_{\$...

1

Yasnippets can execute arbitrary lisp code writing it inside back quotes In your case you can write something like (if (re-search-forward "regex" nil t) "some text" "another one")

1

In your buffer, M-x yas-visit-snippet-file, then type the name of the snippet you want to edit, or choose from a prompted list. Then it will open a buffer for you to edit. From the buffer you can M-: buffer-file-name to see the path of the file containing the snippet.

Only top voted, non community-wiki answers of a minimum length are eligible