Questions tagged [yasnippet]

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.

Filter by
Sorted by
Tagged with
2
votes
1answer
713 views

yasnippet truncates clipboard contents

I have a yasnippet that is intended to create a footnote in org-mode format and automatically insert the contents of the clipboard. # -*- mode: snippet -*- # name: footnote # key: fn # -- [fn:: `(...
22
votes
2answers
8k views

How to make yasnippet and company work nicer?

In my emacs, let's say, I use a "elisp" yasnippet to extend a lisp block in org-mode. But before I extend it, company is triggered first, which gives me a menu like "1. elisp1, 2. elisp2" without an ...
10
votes
2answers
3k views

Is there a yasnippet producing a prepopulated doxygen comment?

For the following C++ function: bool importantStuff(double a, double b); It should output the following snippet, perhaps without the tags: /** * <Insert description of importantStuff> * * @...
3
votes
2answers
1k views

Python docstrings only allow two indent levels

I am trying to write a docstring that follows Google's style guide such that it looks something like: def testFunction(a, b): """ Args: a (str): b (str): Returns: ...
6
votes
1answer
430 views

How to put whitespace into Yasnippet Templates?

When I create a new yasnippet template using the 'yas-new-snippet' command, I'm unable to get the leading whitespace to show when the template is expanded in a new document or even tested using 'yas-...
0
votes
1answer
929 views

How to install/setup yasnippet for buffer-local usage?

The instructions for installing yasnippet globally are set forth in the Github README.mdown -- https://github.com/capitaomorte/yasnippet -- and also in the comments at the top of yasnippet.el library. ...
15
votes
2answers
2k views

One yasnippet snippet for multiple modes

I have the following snippet: # -*- mode: snippet -*- # contributor: Song Qiang <tsiangsung@gmail.com> # key: m # group: Math # name: Inline math \( ... \) # -- \\($1\\)$0 and I want it to be ...
13
votes
1answer
7k views

Get Company to show suggestions for Yasnippet names

I use the packages Company mode and Yasnippet. When I'm typing in a buffer, I get autocompletion suggestions from Company. For Yasnippet, I have a directory which contains the snippets. In that ...
4
votes
1answer
948 views

How bind keys to a specific snippet in yasnippet folder?

Let's say I have a yasnippet snippet called foobar and I have configured it to work it with company-mode (which is not relevant here). Now each time I needed to type foobar I would select it from ...
0
votes
2answers
2k views

Configuring yasnippet and autocomplete to work with C/C++ headers

My computer system and set up are OS: Arch Linux 64bit emacs version: 24.4 alias emacs='emacsclient -t -s server --alternate-editor=' Update: auto complete is working with yasnippet occasionally ...
6
votes
2answers
1k views

Warning (yasnippet): modified buffer in a backquote expression

When I use yasnippet, I keep getting this error: Warning (yasnippet): `foo-snippet' modified buffer in a backquote expression. To hide this warning, add (yasnippet backquote-change) to `warning-...
5
votes
2answers
544 views

read clipboard into yasnippet

I am creating a yasnippet to create org-mode link with content like: [[$1:value-read-from-clipboard][$0]] I wish the $1 read value from clipboard (the use-case is: I copy the URL from chrome browser ...
4
votes
1answer
661 views

yasnippet configuration does not persist across emacs runs

yasnippet does not complete snippets that I add to yas/root-directory (typing the key and hitting tab does not complete). If I remove .yas-compiled-snippets.el from an affected directory, then run ...
3
votes
1answer
181 views

Expand yasnippet only when it's at beginning of the line

How to write snippet condition to expand it only when it's positioned at the beginning of the line?
2
votes
2answers
328 views

Find files interactively with a snippet

It should be nice to write yasnippets, which ask for filepath interactively using helm, predefining starting directory should be fine too.
1
vote
0answers
315 views

Remove strange keybindings from YASnippet

I have YASnippet installed in emacs 24.5, which wasn't working and after a lot of different attempts at a fix, I now have the basics working, however - somewhere along the way - I have collected the ...
1
vote
0answers
135 views

Using auto-insert and yasnippet to insert variables into template

I've been reading this and this, trying to figure out how to have an org-mode in-buffer settings template such as this: # # -*- mode: org -*- # # -*- coding: utf-8 -*- #+TITLE: $1 #+AUTHOR: `(user-...
1
vote
1answer
224 views

Org subtree from yasnippet

Can yasnippet be used to insert an org subtree of the same level as the last? For example, if one often writes ***** $1 #+BEGIN_SRC latex \paragraph{$1.} $0 #+END_SRC how might one avoid ...
1
vote
2answers
176 views

Yasnippets won't expand in git-commit-mode?

I have written a snippet for git-commit-mode. However when I'm writing a commit message (from Magit), the snippet won't trigger. Does anyone know how to fix this? I have yasnippet version 20160924....