;;; packages.el --- mycquery layer packages file for Spacemacs. ;; ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors ;; ;; Author: Rongsong Shen ;; 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 `mycquery-packages'. Then, for each package PACKAGE: ;; ;; - If PACKAGE is not referenced by any other Spacemacs layer, define a ;; function `mycquery/init-PACKAGE' to load and initialize the package. ;; - Otherwise, PACKAGE is already referenced by another Spacemacs layer, so ;; define the functions `mycquery/pre-init-PACKAGE' and/or ;; `mycquery/post-init-PACKAGE' to customize the package as it is loaded. ;;; Code: (defconst mycquery-packages '((cquery :location (recipe :fetcher github :repo "cquery-project/emacs-cquery")) (company-lsp :requires company) (flycheck-lsp :requires flycheck :location built-in) lsp-mode lsp-ui (lsp-imenu :requires imenu :location built-in) (lsp-ui-imenu :requires lsp-imenu :location built-in) ) "The list of Lisp packages required by the mycquery layer. Each entry is either: 1. A symbol, which is interpreted as a package to be installed, or 2. A list of the form (PACKAGE KEYS...), where PACKAGE is the name of the package to be installed or loaded, and KEYS are any number of keyword-value-pairs. The following keys are accepted: - :excluded (t or nil): Prevent the package from being loaded if value is non-nil - :location: Specify a custom installation location. The following values are legal: - The symbol `elpa' (default) means PACKAGE will be installed using the Emacs package manager. - The symbol `local' directs Spacemacs to load the file at `./local/PACKAGE/PACKAGE.el' - A list beginning with the symbol `recipe' is a melpa recipe. See: https://github.com/milkypostman/melpa#recipe-format") (defun cquery/enable () (condition-case nil (lsp-cquery-enable) (lsp-ui-imenu) (user-error nil))) (defun mycquery/init-cquery () (use-package cquery :defer t :commands lsp-cquery-enable :init (add-hook 'c-mode-common-hook #'cquery/enable))) (defun mycquery/post-init-cquery () t) (defun mycquery/init-lsp-mode () (use-package lsp-mode :defer t :commands lsp-mode)) (defun mycquery/post-init-lsp-mode () t) (defun mycquery/init-lsp-ui () (use-package lsp-ui :defer t :init (add-hook 'lsp-mode-hook 'lsp-ui-mode) :config (progn (spacemacs//lsp-sync-peek-face) (add-hook 'spacemacs-post-theme-change-hook #'spacemacs//lsp-sync-peek-face) (if lsp-ui-peek-expand-by-default (setq lsp-ui-peek-expand-function (lambda (xs) (mapcar #'car xs)))) (if lsp-remap-xref-keybindings (progn (define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions) (define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references))) (spacemacs/lsp-define-key lsp-ui-peek-mode-map "h" #'lsp-ui-peek--select-prev-file "j" #'lsp-ui-peek--select-next "k" #'lsp-ui-peek--select-prev "l" #'lsp-ui-peek--select-next-file )))) (defun mycquery/post-init-lsp-ui () ) (defun mycquery/init-company-lsp () (use-package company-lsp :defer t :init (setq company-transformers nil company-lsp-async t company-lsp-cache-candidates nil))) (defun mycquery/post-init-company-lsp ()) (defun mycquery/init-flycheck-lsp () (setq lsp-enable-flycheck nil)) (defun mycqury/init-lsp-imenu () (use-package lsp-imenu :defer t :init (add-hook 'lsp-after-open-hook #'lsp-enable-imenu))) (defun mycquery/init-lsp-ui-imenu () (use-package lsp-ui-imenu :defer t :config (evil-make-overriding-map lsp-ui-imenu-mode-map))) ;;; packages.el ends here