branch: master commit c61f81f02d19b248f7a2938f6e16c81c62ef362a Author: Joao Tavora <joaotav...@gmail.com> Commit: Joao Tavora <joaotav...@gmail.com>
Closes #439: add a faq question about redefining keys Also, don't mention yas-trigger-key anymore in the manual --- doc/faq.org | 23 +++++++++++++++++++++-- doc/snippet-development.org | 8 ++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/doc/faq.org b/doc/faq.org index 622a3d7..c025776 100644 --- a/doc/faq.org +++ b/doc/faq.org @@ -65,7 +65,7 @@ As an alternative, you can also try (unless (and (interactive-p) (yas-expand)) ad-do-it))))) - + (yas-advise-indent-function 'ruby-indent-line) #+END_SRC @@ -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 [[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 variable [[sym:yas-dont-activate][=yas-dont-activate=]] to a lambda function like so: diff --git a/doc/snippet-development.org b/doc/snippet-development.org index 8e3b282..a7d653a 100644 --- a/doc/snippet-development.org +++ b/doc/snippet-development.org @@ -78,10 +78,10 @@ Here's a list of currently supported directives: ** =# key:= snippet abbrev -This is the probably the most important directive, it's the abbreviation -you type to expand a snippet just before hitting [[sym:yas-trigger-key][=yas-trigger-key=]]. If -you don't specify this the snippet will not be expandable through the -key mechanism. +This is the probably the most important directive, it's the +abbreviation you type to expand a snippet just before hitting the key +that runs [[sym:yas-expand][=yas-expand=]]. If you don't specify this +the snippet will not be expandable through the trigger mechanism. ** =# name:= snippet name