mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00

In the README and in the FAQ, mention and link to the list of support issues in the Github issue tracker. Rewrite README.mdown slightly for readability and suggest the GH tracker as primary place for YASnippet discussion. Retire the YASnippet google group. * README.mdown (Manual, issues, etc): Mention docs, support issues and issue tracker separately. Remove reference to the YASnippet google group. (Where are the snippets?): Properly write YASnippet for consistency. * doc/faq.org: Add note and link to support issues.
97 lines
3.6 KiB
Org Mode
97 lines
3.6 KiB
Org Mode
#+SETUPFILE: org-setup.inc
|
|
|
|
#+TITLE: Frequently Asked Questions
|
|
|
|
- *Note*: In addition to the questions and answers presented here,
|
|
you might also with to visit the list of [[https://github.com/joaotavora/yasnippet/issues?q=label%3Asupport][solved support issues]] in
|
|
the Github issue tracker. It might be more up-to-date than this
|
|
list.
|
|
|
|
* Why is there an extra newline?
|
|
|
|
If there is a newline at the end of a snippet definition file,
|
|
YASnippet will add a newline when expanding that snippet. When editing
|
|
or saving a snippet file, please be careful not to accidentally add a
|
|
terminal newline.
|
|
|
|
Note that some editors will automatically add a newline for you. In
|
|
Emacs, if you set =require-final-newline= to =t=, it will add the
|
|
final newline automatically.
|
|
|
|
* Why doesn't TAB navigation work with flyspell
|
|
|
|
A workaround is to inhibit flyspell overlays while the snippet is
|
|
active:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(add-hook 'flyspell-incorrect-hook
|
|
#'(lambda (dummy1 dummy2 dymmy3)
|
|
(and yas-active-field-overlay
|
|
(overlay-buffer yas-active-field-overlay))))
|
|
#+END_SRC
|
|
|
|
This is apparently related to overlay priorities. For some reason, the
|
|
=keymap= property of flyspell's overlays always takes priority over the
|
|
same property in YASnippet's overlays, even if one sets the latter's
|
|
=priority= property to something big. If you know emacs-lisp and can
|
|
solve this problem, drop a line in the
|
|
[[http://groups.google.com/group/smart-snippet][discussion group]].
|
|
|
|
* How do I use alternative keys, i.e. not TAB?
|
|
|
|
Edit the keymaps [[sym:yas-minor-mode-map][=yas-minor-mode-map=]] and
|
|
[[sym:yas-keymap][=yas-keymap=]] as you would any other keymap:
|
|
|
|
#+begin_src emacs-lisp :exports code
|
|
(define-key yas-minor-mode-map (kbd "<tab>") nil)
|
|
(define-key yas-minor-mode-map (kbd "TAB") nil)
|
|
(define-key yas-minor-mode-map (kbd "<the new key>") yas-maybe-expand)
|
|
|
|
;;keys for navigation
|
|
(define-key yas-keymap [(tab)] nil)
|
|
(define-key yas-keymap (kbd "TAB") nil)
|
|
(define-key yas-keymap [(shift tab)] nil)
|
|
(define-key yas-keymap [backtab] nil)
|
|
(define-key yas-keymap (kbd "<new-next-field-key>") 'yas-next-field-or-maybe-expand)
|
|
(define-key yas-keymap (kbd "<new-prev-field-key>") 'yas-prev)
|
|
#+end_src
|
|
|
|
* How do I turn off the minor mode where in some buffers?
|
|
|
|
The best way, since version 0.6.1c, is to set the default value of the
|
|
variable [[sym:yas-dont-activate][=yas-dont-activate=]] to a lambda function like so:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(set-default 'yas-dont-activate
|
|
#'(lambda ()
|
|
(and yas-root-directory
|
|
(null (yas-get-snippet-tables)))))
|
|
#+END_SRC
|
|
|
|
This is also the default value starting for that version. It skips the
|
|
minor mode in buffers where it is not applicable (no snippet tables),
|
|
but only once you have setup your yas-root-directory.
|
|
|
|
* How do I define an abbrev key containing characters not supported by the filesystem?
|
|
|
|
- *Note*: This question applies if you're still defining snippets
|
|
whose key /is/ the filename. This is behavior still provided by
|
|
version 0.6 for backward compatibilty, but is somewhat
|
|
deprecated...
|
|
|
|
For example, you want to define a snippet by the key =<= which is not a
|
|
valid character for filename on Windows. This means you can't use the
|
|
filename as a trigger key in this case.
|
|
|
|
You should rather use the =# key:= directive to specify the key of the
|
|
defined snippet explicitly and name your snippet with an arbitrary valid
|
|
filename, =lt.YASnippet= for example, using =<= for the =# key:=
|
|
directive:
|
|
|
|
#+BEGIN_SRC snippet
|
|
# key: <
|
|
# name: <...></...>
|
|
# --
|
|
<${1:div}>$0</$1>
|
|
#+END_SRC
|