Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 2653

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.

8 votes
Accepted

Multiple occurrences of variable in yasnippet snippet

Try this snippet: # -*- mode: snippet -*- # name: cout variable # key: cvar # -- cout << "${1:var} = " << $1 << endl;$0 I believe the main problem is that yasnippet doesn't recognize the second ${1: …
Xaldew's user avatar
  • 1,281
3 votes
Accepted

Why is this snippet working properly, and not here?

I guess the name was too generic so in later versions of yasnippet it was replaced with the variable yas-text instead. You should try replacing it with that and see if that helps. …
Xaldew's user avatar
  • 1,281
3 votes
Accepted

Python docstrings only allow two indent levels

I had this issue for quite a while and I couldn't figure out how to change it. It didn't affect me much during my day to day work however, so I usually fixed it manually. I did however find a fix rec …
Xaldew's user avatar
  • 1,281
3 votes
Accepted

How can I define a Yasnippet for #if AND if?

The main issue here is understanding the priorities yasnippet uses to determine what snippet it should expand. … This might look rather cryptic if you're not familiar with Emacs syntax classes, but it should be rather clear from the following description: Yasnippet wants to skip an unknown number of characters backwards …
Xaldew's user avatar
  • 1,281
3 votes
Accepted

Can I create a yasnippet with a repeating variable length list

I guess something like this might work: # -*- mode: snippet -*- # name: angctl # key: angctl # -- $1.controller('$2', [${3:$(mapconcat (lambda (x) (format "'%s'" x)) …
Xaldew's user avatar
  • 1,281
2 votes

Iterate over string in YAS Snippet?

With the exception of the pluralization feature I managed to get it to work: First, add this to your .emacs (or .yas-setup.el in your snippet directory): (defun dmitry-enum (beg end) "Transform th …
Xaldew's user avatar
  • 1,281