开发者

Getting YASnippet and viper-mode to work together in emacs

I use viper-mode in emacs, but I want to use开发者_如何学编程 YASnippet as well. However, when I enable viper-mode and try using tab-completion through YASnippet, nothing happens. How do I get the two of them to work together?


Using an Emacs without any customizations (emacs -q), I got the following to work:

(load-file "c:/cygwin/home/Trey/scratch/yasnippet-bundle.el")
M-x viper-mode
(define-key viper-insert-global-user-map (kbd "<tab>") 'yas/expand)
C-x C-f a.cpp
i
main<TAB>

Try that, see if it works (as in, if there's something in your .emacs that's messing things up). Also, check to see what Emacs thinks your TAB key is. On my windows system, the tab key was bound to <tab> and not TAB - try doing M-x describe-key TAB and see what the *Help* buffer translates it to. yasnippet appears to bind to TAB, so I needed the extra binding for <tab> to get things to work.

For more information about how Emacs handles the TAB, read the documentation for function keys.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜