有人在windows上使用rtags么,求分享编译及配置过程

一直想使用emacs作为c++ ide,目前使用gtags做代码跳转,但是感觉效果不理想,所以想试试rtags。

我用的Mac,但是应该是一样的。基本上都是从github readme上看的。

我用的是company和helm,AC和ivy也是支持的

https://github.com/Andersbakken/rtags#elisp

  ;;================================================================================
  ;;rtags
  ;; https://github.com/Andersbakken/rtags
  ;; https://vxlabs.com/2016/04/11/step-by-step-guide-to-c-navigation-and-completion-with-emacs-and-the-clang-based-rtags/
  ;; https://github.com/Andersbakken/rtags/issues/545

  (add-hook 'c-mode-hook 'rtags-start-process-unless-running)
  (add-hook 'c++-mode-hook 'rtags-start-process-unless-running)
  (add-hook 'objc-mode-hook 'rtags-start-process-unless-running)

  (defun add-rtags-keybinding ()
    (interactive)
    (define-key evil-normal-state-map (kbd "g d") 'rtags-find-symbol-at-point)
    (define-key evil-normal-state-map (kbd "g D") 'rtags-find-references-at-point)
    )

  (add-hook 'c-mode-hook 'add-rtags-keybinding t)
  (add-hook 'c++-mode-hook 'add-rtags-keybinding t)
  (add-hook 'objc-mode-hook 'add-rtags-keybinding t)

  ;; Sets up a ton of standard keybindings under C-c r.
  ;; If you pass a mode to the function it will set it up on that mode,
  ;; otherwise it will use c-mode-base-map)
  (rtags-enable-standard-keybindings)

  ;; rtags complete
  (global-company-mode)
  (setq rtags-autostart-diagnostics t)
  (setq rtags-completions-enabled t)
  (push 'company-rtags company-backends)

  ;; 我的机器上报错所以在注释掉了
  ;; rtags flycheck integration
  ;; (defun flycheck-rtags-setup ()
  ;;   (interactive)
  ;;   (flycheck-select-checker 'rtags)
  ;;   (setq-local flycheck-highlighting-mode nil) ;; RTags creates more accurate overlays.
  ;;   (setq-local flycheck-check-syntax-automatically nil))

  ;; (add-hook 'c-mode-hook 'flycheck-rtags-setup)
  ;; (add-hook 'c++-mode-hook 'flycheck-rtags-setup)
  ;; (add-hook 'objc-mode-hook 'flycheck-rtags-setup)

  ;; rtags helm integration
  (setq rtags-display-result-backend 'helm)
  (setq rtags-use-helm t)

现在唯一的问题是flycheck找不到rtags。每次都报错说there is no syntax checker “rtags”。有谁知道怎么破么。

c/c++ layer 已经有人提交了pull request。 可以在本地先试试。 https://github.com/syl20bnr/spacemacs/pull/9956/files

emacs的配置在各平台都差不多,基本一样,但是windows上编不过rtags,github readme上的编译环境是mac

Mac大法好,退Win保平安

Mac还得剁手,准备Arch搞起

楼主windows上编译搞定了嘛?我真心觉得在windows上玩gnu就是hard模式,真心累

1 个赞

可以试试 https://github.com/cquery-project/cquery/blob/master/.appveyor.yml 里的 cquery 构建命令

如果折腾成功欢迎贡献 https://github.com/cquery-project/cquery/wiki/Build#windows

已经拥抱Arch了,弃了windows这坑

就是这个myrgy……已经抛弃rtags来用我的cquery配置了……(我什么时候去用clangd) https://github.com/myrgy/dotspacemacs.d/tree/master/layers/cquery

也许可以借鉴 Homebrew/Linuxbrew 已有的 formula,整理一份 scoop.sh 到 Windows,不用每个人都折腾一遍。