直到前两天才通过Most useful Emacs features – Stack Overflow知道hippie-expand这么好用的东西,然后抄了一段Alex Schroeder的配置,也就是根据可能性重新排列一下补全的规则,如将补全文件名放到链表的后面。另外还从wiki页上抄了一段用tag做补全的配置。
虽然补全文件或路径很少用到,但是在添加load-path
的时候就很方便了,感觉就像在mini-buffer里输入路径一样。当然用得最多的还是在写程序的时候了。下面是我的配置:
(global-set-key (kbd "M-/") 'hippie-expand) (defun he-tag-beg () (let ((p (save-excursion (backward-word 1) (point)))) p)) (defun try-expand-tag (old) (unless old (he-init-string (he-tag-beg) (point)) (setq he-expand-list (sort (all-completions he-search-string 'tags-complete-tag) 'string-lessp))) (while (and he-expand-list (he-string-member (car he-expand-list) he-tried-table)) (setq he-expand-list (cdr he-expand-list))) (if (null he-expand-list) (progn (when old (he-reset-string)) ()) (he-substitute-string (car he-expand-list)) (setq he-expand-list (cdr he-expand-list)) t)) (setq hippie-expand-try-functions-list '(try-expand-all-abbrevs try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-lisp-symbol-partially try-complete-lisp-symbol try-complete-file-name-partially try-complete-file-name try-expand-tag))
我来支持一个!~要记得回顶啊!~~
很早就开始用 hippie-expand 了,可是相当地好用,感觉关于 cc++ 的 tag,emacs 下 gtags 很好用,速度要比 cscope 来得快
gtags是google写的那个吗?我现在都是用etags的……