我是关于emac的新人。我在youtube上关注了emacs的教程,作为c / c ++的ide 但有一些步骤对我来说无法完全发挥作用:c-header的自动完成。
我为C / C ++标题安装了yasnippet并自动完成。
我获得了#include <stdio.h
的正常自动完成行为,但即使我在>
h
关闭挂钩
其他人#include <float
未使用.h>
完成,
#include <ctype.h>
根据我的要求isdig
而不是isdigit
来调用
; start package.el with emacs
(require 'package)
;add MELPA to repository list
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
;initialize package.el
(package-initialize)
;start auto-complete with emacs
(require 'auto-complete)
;do default config for auto-complete
(require 'auto-complete-config)
(ac-config-default)
;start yasineppet with emacs
(require 'yasnippet)
(yas-global-mode 1)
;let's define a function which initializes auto-complete-c-headers and gets called for c/c++ headers hooks
(defun my:ac-c-header-init ()
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers)
(add-to-list 'achead:include-directories '"/usr/include/c++/5
/usr/include/x86_64-linux-gnu/c++/5
/usr/include/c++/5/backward
/usr/lib/gcc/x86_64-linux-gnu/5/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include")
)
;now let's call this function from c/c++ hooks
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)
缺少什么?
标头的路径来自gcc -xc++ -E -v -
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/5
/usr/include/x86_64-linux-gnu/c++/5
/usr/include/c++/5/backward
/usr/lib/gcc/x86_64-linux-gnu/5/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
由于
答案 0 :(得分:0)
我不确定C的配置。但是,我看到你在init文件中使用auto-complete
模式。你能试试company-mode吗?在我看来,它比auto-complete
模式