Skip to content

Instantly share code, notes, and snippets.

@scturtle scturtle/packages.el
Last active Dec 4, 2017

Embed
What would you like to do?
lsp-cquery layer
;;; packages.el --- lsp-cquery layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Shen Chao <scturtle@Enigma.lan>
;; 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
You can’t perform that action at this time.