问题描述
我对于默认行为autocomplete
覆盖了yasnippets
所使用的键绑定感到沮丧.
I'm frustrated with the default behavior of autocomplete
overriding key bindings used by yasnippets
.
有没有一种设置优先级的方法,以便制表符在尝试自动完成单词之前尝试扩展代码段?
Is there a way to set a precedence so that tab will try to expand a snippet before trying to autocomplete the word?
快速披露:我正在使用邪恶模式.
Quick disclosure: I'm using evil-mode.
推荐答案
如果它们都是次要模式,则优先级由minor-mode-map-alist
中的元素顺序确定,除非明确操作,否则仅由顺序确定在其中加载了库.
If they're both minor modes, then precedence is determined by the order of elements in minor-mode-map-alist
which, unless explicitly manipulated, is simply determined by the order in which the libraries were loaded.
确保在之前 yasnippet
加载autocomplete
,并且yasnippet的次要模式映射将具有优先级.
Ensure that autocomplete
is loaded before yasnippet
, and yasnippet's minor mode map would have precedence.
您也可以在加载autocomplete
之后使用eval-after-load
调整minor-mode-map-alist
,检查yasnippet条目,并在必要时重新排列列表.
You could also use eval-after-load
to adjust minor-mode-map-alist
after loading autocomplete
, to check for a yasnippet entry, and re-order the list if necessary.
(不过,autocomplete
可以使用其他方法.例如,临时覆盖的键映射仍将优先于次要模式映射.)
(autocomplete
may use other methods, though. A temporary overriding keymap would still have precedence over the minor mode maps, for instance.)
这篇关于Emacs密钥绑定优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!