]> code.delx.au - gnu-emacs-elpa/commitdiff
Closes #439: add a faq question about redefining keys
authorJoao Tavora <joaotavora@gmail.com>
Mon, 2 Dec 2013 19:27:35 +0000 (19:27 +0000)
committerJoao Tavora <joaotavora@gmail.com>
Mon, 2 Dec 2013 19:27:35 +0000 (19:27 +0000)
Also, don't mention yas-trigger-key anymore in the manual

doc/faq.org
doc/snippet-development.org

index 622a3d70d566e4a24192b88b8065dd23bfb1a000..c02577658413124dd224bd3b1f1fa8441bc8a5c9 100644 (file)
@@ -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:
index 8e3b282204d855a863aaa3b8a833f614d512dffb..a7d653a81f5148705d5abbae4b5f822397a39aec 100644 (file)
@@ -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