5

Tabyasnippet 的键绑定通常会覆盖其他有用的键。

有没有办法禁用TabYasnippet 的绑定以启用其他Tab用途?

4

4 回答 4

9

这些将删除 yasnippet 的键绑定:

(define-key yas-minor-mode-map [(tab)] nil)
(define-key yas-minor-mode-map (kbd "TAB") nil)

应该管用。或者您可以绑定tab到另一个命令。

于 2012-12-28T08:19:43.530 回答
4

我参加聚会迟到了,但在这个问题中得到了公认的答案……没有用。

试验了一下,终于找到了解决办法。认为我应该提供一个有效的答案:

;; It is crucial you first activate yasnippet's global mode.
(yas/global-mode 1)

;; The following is optional.
(define-key yas-minor-mode-map [backtab]     'yas-expand)

;; Strangely, just redefining one of the variations below won't work.
;; All rebinds seem to be needed.
(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)
于 2015-02-12T20:35:09.460 回答
2

use-package

(use-package yasnippet
  :demand t
  :bind (:map yas-minor-mode-map
         ("TAB" . nil)
         ("<tab>" . nil))
  :config
  (yas-global-mode))
于 2017-08-20T05:19:38.453 回答
-1
(setq yas-minor-mode-map ;This MUST before (require 'yasnippet)
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "M-i") 'yas-expand)
    (define-key map "\C-c&\C-n" 'yas-new-snippet)
    (define-key map "\C-c&\C-v" 'yas-visit-snippet-file)
    map)) 

(require 'yasnippet)
于 2014-03-25T16:35:45.373 回答