This is a copy of the emacs.d/ setup I use for C/C++ development.
It installs the following packages from MELPA repository.
cclspackage for this C/C++/ObjC language server (for LSP)centered-windowcenters the text of the window like Zen Mode in Visual Studio Code.companytext completion framework for emacs.company-jedicompany backend for jedi server (python).company-glslcompany backend for GLSL.doom-modelinefast mode-line for emacs.doom-themesthemes for doom.editorconfigsupport for this coding style tool.elpyemacs python development environment (easy way to install a fully featured python dev environment).flycheckalternative to flymake. Syntax checking.helmincremental completion and narrowing selection framework.lsp-uiUI support for LSP (it shows declarations in a box)magit-todosit shows TODOs present in the repository using magit (very powerful git client for emacs).markdown-modesupport for markdown.minimapit shows a minimap of the buffer like vscode.multiple-cursorsadds support for multiple cursors.pdf-toolsadds support to view PDFs.projectileit adds support for code projects in emacs.speedbarit displays information of the current buffer, like the functions and definitions, so you can browse easily.use-packagepackage that facilitates the install and configuration of emacs packages.treemacs-projectilepackage that adds support for tree-like view of projects.virtualenvwrapperadds support for virtualenv on emacs.webpastea package that allows to paste code to dpaste.org.xcscopeadds support for cscope.
It needs some system packages to work:
markdownfor compiling markdown files.bearfor creatingcompile_commands.jsonfiles which are consumed by ccls for projects using make.clangused by lsp if ccls is not present.cscopefor looking for C/C++ definitions and calls.python-jedi,python3-jedi,virtualenvfor python.cclsas C/C++/ObjC language server (for LSP).
For Debian:
$ sudo apt install markdown bear clang python3-jedi virtualenv cscope ccls emacs
For Fedora:
$ sudo dnf install perl-Text-Markdown bear clang python3-jedi virtualenv ccls cscope emacs
To install it:
git clone https://github.com/samuelig/emacs.d.git .emacs.d/
And run emacs. It will automatically install everything.
There are some commands to run after emacs finished installing the packages:
M-x all-the-icons-install-fonts
M-x jedi:install-server
-
Create
compile_commands.jsonfiles for all the projects in the root folder (or create symlinks). See more info. -
Added keybinding
M-Xto set working directory to apply other command. Very useful to executeM-x compile. -
Added support for opening encrypted (*.gpg) files.
-
<F8>toggles treemacs window. -
<F9>shows lsp-treemacs-symbols window. -
<F10>toggles minimap window. -
Webpaste:
C-c C-rsend region to dpaste.org.C-c C-bsend buffer to dpaste.org.
-
S-TABinserts TAB inconditionally (specially useful for indexing code). -
M-ifuzzy search in the same buffer. -
M-.looks for code definitions, using ccls as backend (C/C++ projects). -
M-?finds code references, using ccls as backend (C/C++ projects). -
M-<mouse-1>adds new cursor (multiple-cursors). There are more keybindings in the init.d related to multiple-cursors package. -
There are also keybindings for org-mode. TBD.
