Last active
December 4, 2017 17:17
-
-
Save scturtle/7dae878f72c810c63d6aa033c5773335 to your computer and use it in GitHub Desktop.
lsp-cquery layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; packages.el --- lsp-cquery layer packages file for Spacemacs. | |
;; | |
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors | |
;; | |
;; Author: Shen Chao <[email protected]> | |
;; URL: https://github.com/syl20bnr/spacemacs | |
;; | |
;; This file is not part of GNU Emacs. | |
;; | |
;;; License: GPLv3 | |
;;; Commentary: | |
;; See the Spacemacs documentation and FAQs for instructions on how to implement | |
;; a new layer: | |
;; | |
;; SPC h SPC layers RET | |
;; | |
;; | |
;; Briefly, each package to be installed or configured by this layer should be | |
;; added to `lsp-cquery-packages'. Then, for each package PACKAGE: | |
;; | |
;; - If PACKAGE is not referenced by any other Spacemacs layer, define a | |
;; function `lsp-cquery/init-PACKAGE' to load and initialize the package. | |
;; - Otherwise, PACKAGE is already referenced by another Spacemacs layer, so | |
;; define the functions `lsp-cquery/pre-init-PACKAGE' and/or | |
;; `lsp-cquery/post-init-PACKAGE' to customize the package as it is loaded. | |
;;; Code: | |
(defconst lsp-cquery-packages | |
'( | |
lsp-mode | |
(company-lsp :toggle (configuration-layer/package-usedp 'company)) | |
(cquery :location local) | |
)) | |
(defun lsp-cquery/init-lsp-mode () | |
(use-package lsp-mode | |
:defer t | |
:config (use-package lsp-flycheck) | |
)) | |
(defun lsp-cquery/init-company-lsp () | |
(use-package company-lsp | |
:defer t | |
:init (push 'company-lsp company-backends-c-mode-common) | |
)) | |
(defun lsp-cquery/init-cquery () | |
(use-package cquery | |
:init | |
(progn | |
(setq cquery_root "/Users/scturtle/code/github/cquery") | |
(spacemacs/add-to-hooks #'lsp-cquery-enable '(c-mode-hook c++-mode-hook)) | |
(dolist (mode '(c-mode c++-mode)) | |
(evil-leader/set-key-for-mode mode | |
"r." 'xref-find-definitions | |
"r," 'xref-find-references | |
"rl" 'helm-imenu | |
))))) | |
;;; packages.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment