我使用 elpy 和 yasnippet 让 emacs 成为一个 python 编辑器。
然后我使用 yasnipprt 构建一个类对象,但我发现我不能像 sublime text 那样快地退出字段,在双重“返回”内。这意味着我必须在类对象的末尾一个接一个地移动光标在使用的选项卡或键盘的行首,然后输入新代码,然后我可以退出 yasnippet 支持的类字段。
有没有人对出口领域有同样的困惑?
我在下面推送 init.el 代码,yasnippet 的退出字段的关键是什么?
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
;;;(add-to-list 'package-archives
;;; '("elpy" . "http://jorgenschaefer.github.io/packages/"))
(package-initialize)
(elpy-enable)
(add-to-list 'load-path
"~/.emacs.d/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
(c-add-style
"python-new"
'((indent-tabs-mode . 4)
(fill-column . 78)
(c-basic-offset . 4)
(c-offsets-alist . ((substatement-open . 0)
(inextern-lang . 0)
(arglist-intro . +)
(knr-argdecl-intro . +)))
(c-hanging-braces-alist . ((brace-list-open)
(brace-list-intro)
(brace-list-close)
(brace-entry-open)
(substatement-open after)
(block-close . c-snug-do-while)))
(c-block-comment-prefix . "* "))
)
;; This is a very crude hook that auto-selects the C style depending on
;; whether it finds a line starting with tab in the first 3000 characters
;; in the file
(defun c-select-style ()
(save-excursion
(if (re-search-forward "^\t" 3000 t)
(c-set-style "python")
(c-set-style "python-new"))))
(add-hook 'c-mode-hook 'c-select-style)