Closes #439: add a faq question about redefining keys

Also, don't mention yas-trigger-key anymore in the manual
This commit is contained in:
Joao Tavora 2013-12-02 19:27:35 +00:00
parent 6927f6943e
commit c61f81f02d
2 changed files with 25 additions and 6 deletions

View File

@ -99,7 +99,26 @@ same property in yasnippet's overlays, even if one sets the latter's
solve this problem, drop a line in the solve this problem, drop a line in the
[[http://groups.google.com/group/smart-snippet][discussion group]]. [[http://groups.google.com/group/smart-snippet][discussion group]].
* How do I turn off the minor mode where in some buffers * How to 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-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 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: variable [[sym:yas-dont-activate][=yas-dont-activate=]] to a lambda function like so:

View File

@ -78,10 +78,10 @@ Here's a list of currently supported directives:
** =# key:= snippet abbrev ** =# key:= snippet abbrev
This is the probably the most important directive, it's the abbreviation This is the probably the most important directive, it's the
you type to expand a snippet just before hitting [[sym:yas-trigger-key][=yas-trigger-key=]]. If abbreviation you type to expand a snippet just before hitting the key
you don't specify this the snippet will not be expandable through the that runs [[sym:yas-expand][=yas-expand=]]. If you don't specify this
key mechanism. the snippet will not be expandable through the trigger mechanism.
** =# name:= snippet name ** =# name:= snippet name