2 harith Harith 于 2013.08.01 10:04 提问

Emacs 自动补全 auto-complete yasnippet 光标空白处不显示

我在ubuntu中配置了emacs 的自动补全,现在碰到一个问题,在出现自动补全的时候,光标在有字符的地方会闪烁,在没有字符或者空白处无法看到光标,请问怎么让光标都在空白处也显示

下面的是我自动补全的配置
;; yasnippet
(add-to-list 'load-path "~/.emacs.d/yasnippet-0.6.1c")
(require 'yasnippet);; not yasnippet-bundle
(yas/initialize)
(yas/global-mode 1)
(yas/minor-mode-on)
(yas/load-directory "~/.emacs.d/yasnippet-0.6.1c/snippets")
;;(load-file "~/.emacs.d/yasnippet-bundle.el")

;;f3 为查找字符串,alt+f3 关闭当前缓冲区
(global-set-key [f3] 'grep)
(global-set-key [M-f3] 'kill-buffer-and-window)

;;auto-complete
(add-to-list 'load-path "~/.emacs.d/auto-complete-1.3.1")
;(require 'auto-complete)
(require 'auto-complete-config)

(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete-1.3.1/dict")
(ac-config-default)

(global-auto-complete-mode t)

(setq-default ac-sources '(ac-source-words-in-same-mode-buffers))
(setq-default ac-sources '(ac-source-yasnippet

ac-source-semantic
ac-source-ropemacs
ac-source-imenu
ac-source-functions
ac-source-symbols
ac-source-features
ac-source-dictionary
ac-source-abbrev

ac-source-words-in-buffer

ac-source-files-in-current-dir

ac-source-filename))

(add-hook 'emacs-lisp-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-symbols)))
(add-hook 'auto-complete-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-filename)))
;;下面这句是从auto-complete-config.el中翻出来的
;;加上这句,在python中输入类的 . 就可以提示里面的方法了
(add-hook 'python-mode-hook (lambda () (add-to-list 'ac-omni-completion-sources (cons "\." '(ac-source-ropemacs))) ))

(set-face-background 'ac-candidate-face "lightgray")
(set-face-underline 'ac-candidate-face "darkgray")
(set-face-background 'ac-selection-face "steelblue")

(setq ac-auto-start 2)
(setq ac-dwim t)

1个回答

Harith
Harith   2013.08.01 13:47
已采纳

解决的办法是在.emacs 中添加这个 并修改yasnippet的配置,具体如下:
;; 设置光标不闪
(blink-cursor-mode 1)
;;设置光标为线条状
(setq-default cursor-type 'bar)

;; yasnippet
(add-to-list 'load-path "~/.emacs.d/yasnippet-0.6.1c")
(require 'yasnippet);; not yasnippet-bundle
(yas/initialize)
;;(yas/global-mode 1)
;;(yas/minor-mode-on)
(yas/load-directory "~/.emacs.d/yasnippet-0.6.1c/snippets")
;;(load-file "~/.emacs.d/yasnippet-bundle.el")
(require 'dropdown-list)
(setq yas/prompt-functions '(yas/dropdown-prompt
yas/ido-prompt
yas/completing-prompt))

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!