Subject: Re: (yasnippet) how to disable TAB <tab> C-i?

From: [email-masked]
Date: Mon, 18 Jul 2022 15:32:41 +0000

Of course:
- yasnippet-snippets             20220401.1534   
c5bf4c4085aa61b9c07563de89f7aacc2a357db5
- GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.17.6) of 2022-04-28

On 2022-07-18 15:29, [email-masked] wrote:
> Hello,
> 
> as per: https://github.com/joaotavora/yasnippet, I am sending an
> e-mail to you to ask for help.
> 
> I really like yasnippets, because it makes my workflow more
> productive, but I have not been able to disable the autocompletion
> with the TAB key:
> 
> * What I have tried
> (use-package yasnippet :defer t :commands (yas-minor-mode)
>   :bind
>   (:map
>    yas-minor-mode-map
>    ("TAB" . nil)
>    ("<tab>" . nil)
>    ;; Expand with C-c m
>    ;; (how?? yas--direct-{keymaps,org-mode})
>    ("C-c m". yas-expand)
>    ;; Change C-S-i to navigate back
>    ("ESC TAB" . yas-prev-field)
>    :map
>    esc-map
>     ;; Disable this to enable C-S-i to navigate back
>     ;; (previously defined in bindings.el)
>     ("\t" . nil)))
> 
> (with-eval-after-load 'yasnippet
>   (setq yas-snippet-dirs (list "~/snippets/"))
>   (yas--load-snippet-dirs)
>   ;; allow to insert a snippet within a snippet
>   (setq yas-triggers-in-field t)
>   ;; Testing (above)
>   ;; ;; Change trigger key
>   ;; (define-key yas-minor-mode-map (kbd "C-i") nil)
>   ;; (define-key yas-minor-mode-map (kbd "C-c m") 'yas-expand)
>   ;; (define-key yas-minor-mode-map [(tab)]        nil)
>   ;; (define-key yas-minor-mode-map (kbd "TAB")    nil)
>   ;; (define-key yas-minor-mode-map (kbd "<tab>")  nil)
>   )
> 
> * Current behaviour
> 1. I launch a snippet with C-c m
> 2. Inside, I type the name of another snippet, for clarity, assume it 
> is tuk
> 3. I type [TAB], C-i
> 4. tuk gets expandedtuk
> 
> * Expected behaviour
> 1. I launch a snippet with C-c m
> 2. Inside, I type the name of another snippet, for clarity, assume it 
> is tuk
> 3. I type [TAB], C-i
> 4. I get out of ttukhe first snippet (tuk does not get expanded).
> 
> tuk is this:
> # -*- mode: snippet -*-
> # name: latex-inline
> # key: tuk
> # expand-env: ((yas-indent-line 'fixed))
> # --
> \\($1\\)$0
> 
> How do I configure yasnippet so that snippets get expended with C-c m
> *only*? Thanks!

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to [email-masked]
 
ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!