Skip to content
This repository has been archived by the owner on Jul 1, 2018. It is now read-only.

tee3/lsp-clangd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

lsp-clangd

A configuration for an Emacs LSP client for Clang-based languages using clangd as the language server.

Requirements

  • clangd
  • lsp-mode

Installing clangd

Since clangd is part of clang-tools-extra since Clang 5, it can be installed by all the same methods for installing Clang 5 or later.

With macOs, the easiest way is to install via Homebrew.

brew install llvm

Enabling lsp-clangd

Using use-package

(use-package lsp-clangd
  :load-path
  "<path-to-lsp-clangd>"
  :init
  (add-hook 'c-mode--hook #'lsp-clangd-c-enable)
  (add-hook 'c++-mode-hook #'lsp-clangd-c++-enable)
  (add-hook 'objc-mode-hook #'lsp-clangd-objc-enable))

Manually

Install lsp-mode via some suitable method and clone this repository to a suitable path, e.g. <path-to-lsp-clangd>.

(add-to-list 'load-path "<path-to-lsp-clangd>")

(require 'lsp-clangd)

(add-hook 'c-mode--hook #'lsp-clangd-c-enable)
(add-hook 'c++-mode-hook #'lsp-clangd-c++-enable)
(add-hook 'objc-mode-hook #'lsp-clangd-objc-enable)