如何取消设置yasnippet的tab键默认行为,甚至重新定义它?
我遇到问题让yasnippet和自动完成一起玩得很好,特别是发现 Tab 键行为有时会出现问题,因为自动完成会导致yasnippet无法扩展片段
答案 0 :(得分:1)
尝试了一下,最后找到了一个有效的解决方案。
;; It is crucial you first activate yasnippet's global mode.
(yas/global-mode 1)
;; This illustrates how to redefine yas-expand to S-TAB.
(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)