emacs 支持C++
用 eglot
https://github.com/joaotavora/eglot
emacs自带了
server端可以用clangd 也可以用 ccls
安装 clangd
https://clangd.llvm.org/installation.html
sudo apt-get install clangd
安装 ccls
sudo apt-get install ccls
配置 clangd
(require 'eglot) (add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")) (add-hook 'c-mode-hook 'eglot) (add-hook 'c++-mode-hook 'eglot)
使用project.el
eglot 是依赖project的工具, project在emacs29开始内置
在代码根目录生成一个mark标志
git init
启动
打开文件之后
M-x eglot
跳转命令
https://joaotavora.github.io/eglot/
M . M ? M-x eglot-find-xxxx
配置bazel
https://github.com/hedronvision/bazel-compile-commands-extractor?tab=readme-ov-file#usage
一
参考文档,修改 WORKSPACE 或者 MOUDEL.bazel 文件
二
在工程下跑一下这命令
bazel run @hedron_compile_commands//:refresh_all -- --config=my_important_flags_or_toolchains --compilation_mode=dbg
浙公网安备 33010602011771号