YASnippet is a template system for Emacs. It allows you to type an abbreviation and automatically expand it into function templates. Bundled language templates includes: C, C++, C#, Perl, Python, Ruby, SQL, LaTeX, HTML, CSS and more.
Questions tagged [yasnippet]
107 questions
2
votes
1 answer
YASnippet -- How to create a right-click context menu -- popup-menu
I'm looking for a way to duplicate the YASnippet easy menu-bar entries for the snippets in my library (that appear in the menu automatically based upon whatever mode is being used), and incorporate them into my own custom menu. The entry of…

lawlist
- 13,099
- 3
- 49
- 158
2
votes
2 answers
cannot open load file: /yasnippet
I receive this message every time I start emacs
Emacs 24.2
Win7 64 and Ubuntu 12.10
yasnippet 0.8.0 installed with package-list
If there is a way to fix it ?

simar
- 1,782
- 3
- 16
- 33
2
votes
1 answer
Yasnippet: How to expand on " or" but not on "-or"
Title says it, is it possible to alter yasnippets behavior so that it is not possible to expand on "-or" but it is possible to expand on "[newline]or" or "[tab]or" only?
I would like this because I am trying to expand my yasnippets automatically…

PascalVKooten
- 20,643
- 17
- 103
- 160
2
votes
2 answers
yasnippets don't work for javascript-mode
I have the following code in .emacs:
;yasnippet
;;{{{
(load (concat *my-emacs-lib-dir* "plugins/yasnippet/yasnippet"))
(setq yas/snippet-dirs nil)
(yas/initialize)
;; Develop and keep personal snippets under ~/emacs.d/yasnippets
(setq…

user4035
- 22,508
- 11
- 59
- 94
2
votes
2 answers
Properly handing failed snippet completions
I use TAB to expand snippets from yasnippet, when it doesn't expand a snippet, it usually falls back to indenting (the default command bound to TAB), this is referred to by yasnippets custom variable yas-fallback-behavior which can only be…

Dan LaManna
- 3,431
- 4
- 23
- 35
2
votes
1 answer
emacs smart-tab with yasnippets
I'm trying to get tab complete within all open buffers and yasnippet to both work with the tab key. At the moment I can have one or the other. The following code is how I'm handling the yasnippet expand, but as I'm not a lisp programmer I cannot see…

map7
- 5,096
- 6
- 65
- 128
2
votes
1 answer
How to programmatically include yasnippet snippets in a snippet
I'm looking for a way to write a snippet that would let me include another snippet. Here is an example of a snippet for a python function:
def test(args):
${1:code here}
$(insert-snippet "not_implemented_exception")
In the example, I would…

sp3ctum
- 429
- 6
- 9
2
votes
0 answers
How to make a YASnippet that inserts generated setters and getters at the appropiate place?
In the answers to How to implement a 'generate getter/setter' for a Java Class in emacs? there are several YASnippets that solve the problem of generating setters and getters as you create instance variables in Java. However, neither appropriately…

N.N.
- 8,336
- 12
- 54
- 94
1
vote
1 answer
Emacs Yasnippet install
trying to install yasnippet for emacs 23 from https://github.com/joaotavora/yasnippet
Firstly I attempted the quick install but the yasnippet-bundle.el for the 'quick' install doesn't seem to be in the repository?
Secondly I attempted the full…

bph
- 10,728
- 15
- 60
- 135
1
vote
2 answers
Conditionally skip a field in yasnippet
I'm trying to create a yasnippet for a MOVE statement i COBOL.
Writing MOVE statements is something we do ALOT of and I want to be as fast and efficient as possible with it.
Usual it is something like this:
MOVE variable-1 TO variable-2
but…

Kribbstar
- 13
- 2
1
vote
1 answer
Programming in Python, tab completion in spacemacs not right
the question as follow:
enter image description here
the screen record might be too short, so I upload a longer one:
enter image description here
when I enter the code and press tab, there was print($0) on screen. And the cursor isn't at the right…

Echo
- 11
- 5
1
vote
1 answer
How do I get the Visual Code Studio Yassnippet extension to pick up my snippets?
I've started to experiment with Visual Studio Code.
I've built up a large library of snippets managed by Yassnippet. I want to use them with VSC. A third-party developer, Mads Hartmann has published an extension that offers to connect an existing…

bob
- 753
- 4
- 15
- 27
1
vote
1 answer
Backticks in snippets for Emacs
I am trying to create a code block snippet for Markdown in Emacs.
I tried to create a snippet like so:
# -*- mode: snippet -*-
# name: code-block
# key: cb
# ---
```${1:r}
${2:code}
```
but when I tried to save, it threw an error saying wrong…

TheRimalaya
- 4,232
- 2
- 31
- 37
1
vote
0 answers
Enable auto-fill-mode inside a yasnippet
I have a multiline comment snippet that I would like to enable auto-fill-mode for while inside it, but then disable auto-fill-mode when I exit. Is this possible?
I tried adding a hook but was not able to get it to run properly. I aslo tried adding…

aaron.cimolini
- 123
- 1
- 6
1
vote
1 answer
Dynamics keys for yasnippet
I'm currently learning to define yasnippets but there seems to be a use case that I can't figure out how to use.
For example, let's say I want to define a ruby snippet that expands the key 'def' into a standard function definition. This is very easy…

Y.Khurshid
- 21
- 3