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
1
vote
0 answers
ess - how to make file templates (boiler plate texts)
I've been using r-autoyas 'as-is' from what I got after installation. How do I customize it or install any other plugins that let me have templates for R documents (i.e. .R, .Rmd) whenever I create a new file?
For example, I want to put some boiler…

biocyberman
- 5,675
- 8
- 38
- 50
1
vote
0 answers
avoid exiting yasnippet with escape while in evil mode's insert state
Is it possible to change yasnippet so it won't exit on escape during evil mode's insert state? I would like to be able to manipulate the text while still editing the snippet.
Thanks!

Haj
- 21
- 2
1
vote
0 answers
yasnippet weird-input when org-mode :tag: on same line
I am trying to create a yasnippet for new projects in org-mode.
The beginning of the yasnippet looks like this.
# -*- mode: snippet -*-
# name: project
# key: project
# --
#+TAGS: project(p)
* $1
* $2 …

samlaf
- 425
- 4
- 9
1
vote
0 answers
Autocomplete randomly working / not working with yasnippet, why?
I have configured yasnippet and auto-complete bindings so it won't collide, auto complete uses and yasnippet uses :
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
;;…

Fabman
- 333
- 5
- 20
1
vote
1 answer
Yasnippet snippet for C/C++ while doesn't work correctly
I have just installed yasnippet package for emacs and am trying to configure snippets. Everything works fine except one particular snipet.
File: ~/.emacs.d/elpa/yasnippet-20150212.240/snippets/cc-mode/while
# -*- mode: snippet -*-
# name: while
#…

TheCrafter
- 1,909
- 2
- 23
- 44
1
vote
0 answers
Yasnippet installing with cask in Emacs error
I've been trying to install Yasnippet using Cask, but I can't get it to work. I've installed other packages using Cask and they seem to work, but Yasnippet won't load. I get this error when I opened Emacs and have added (yas-global-mode 1) to my…

Crablicious
- 11
- 2
1
vote
0 answers
Bind C-f to next-field only when expanding a snippet in yasnippet
Is it possible to bind C-f and C-b to yasnippet's next-field and prev-field functions only when currently inside of a snippet expansion? I've tried looking for something like a yas-snippet-map. yas-minor-mode-map won't work because it'll remap C-f…
user3594595
1
vote
0 answers
For emacs snippet, how to expand another snippet inside one snippet
I want to expand another snippet which is predefined into the current template file, how can I realize it?
For example:
Say I already have a snippet called 'snippet1', and I hope I can write snippet like this:
# -*- mode: snippet -*-
# name:…

ruanhao
- 4,663
- 6
- 28
- 43
1
vote
1 answer
How to write a snippet which content is depended on some expanded field?
I try to write a snippet to achieve this:
Expandable field:
(my_class#($1))
Expected result:
If $1 is empty:
`my_factory_utils(my_class)
If $1 is not empty:
`my_factory_param_utils(my_class#(<$1…

enchanter
- 884
- 8
- 20
1
vote
0 answers
Symbol's function definition is void: yas/initialize (emacs yasnippet)
I am trying to configure Emacs with yasnippet and a few templates for JavaScript according to this tutorial .
I am new to Emacs and I can't figure out why the yas function doesn't exist. The error I get is:
Symbol's function definition is void:…

JuanPabloMF
- 397
- 1
- 3
- 14
1
vote
1 answer
Wrong indentation in python-mode with yasnippet, Emacs
Even when I open pure emacs -Q and a python file in it:
| - cursor
if smth:
| print("asd") # press TAB and cursor moves to "p" symbol, it's ok
if smth:
|print("asd") # press TAB and I get this:
if smth:
print("asd") #…

Sergey
- 19,487
- 13
- 44
- 68
1
vote
1 answer
How to configure Emacs 24 to K&R(or Stroutrup) style?
I want the code like this.
for (;;) {
}
But YASnippet always output this.
for (;;)
{
}
Is there a way to change the C++ style?
This is my .emacs file.
(setq c-default-style "stroustrup")
(add-to-list 'load-path
…

Ian Zhou
- 13
- 2
1
vote
2 answers
Remove Yasnippet from the menu bar
How to remove the YASnippet category from the Emacs menu bar?

deprecated
- 5,142
- 3
- 41
- 62
1
vote
1 answer
How to expand yasnippet snippet inside html file
I have a lisp script that creates an empty html file:
(let ((mode "html-mode"))
(funcall (intern mode)))
(write-region "" nil "index.html")
Then i'm using yasnippet to generate the basic html file:
I have a snippet named "base" (i hit TAB key…

Goulven
- 13
- 5
1
vote
1 answer
Yasnippet (0.6.1c and 0.8) seems to "hide" autocomoplete (1.3.1) help in emacs
I'm trying to use Yasnippet and Autocomplete Mode in Emacs 24.1 (built from sources) on a RHEL5. Here is my .emacs.d/init.el:
;; yasnippet
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
(require…

petrux
- 1,743
- 1
- 17
- 30