2014-12-14 04:08:55 +00:00
|
|
|
# C/C++ contribution layer for Spacemacs
|
|
|
|
|
2014-12-24 06:03:49 +00:00
|
|
|
![cc++](img/ccpp.jpg)
|
|
|
|
![cmake](img/cmake.png)
|
2014-12-14 04:08:55 +00:00
|
|
|
|
|
|
|
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc/generate-toc again -->
|
|
|
|
**Table of Contents**
|
|
|
|
|
|
|
|
- [C/C++ contribution layer for Spacemacs](#cc-contribution-layer-for-spacemacs)
|
|
|
|
- [Description](#description)
|
|
|
|
- [Install](#install)
|
|
|
|
|
|
|
|
<!-- markdown-toc end -->
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
|
|
|
This layer adds configuration for C/C++ language as well support for [CMake][]
|
|
|
|
scripts.
|
|
|
|
|
2015-03-09 13:26:13 +00:00
|
|
|
## Features
|
|
|
|
|
|
|
|
- Support syntax checking with Clang.
|
|
|
|
- Display function or variable definition at the bottom.
|
2015-03-12 09:16:14 +00:00
|
|
|
- Display current function cursor is in at the top. See [this page][stickyfunc-demos]
|
|
|
|
for demos in some programming languages.
|
|
|
|
- Support common refactoring with [semantic-refactor][]. See [this page][srefactor-demos]
|
2015-03-09 13:26:13 +00:00
|
|
|
for demonstration of refactoring features.
|
|
|
|
|
2015-04-03 04:28:13 +00:00
|
|
|
### Clang Fanciness
|
|
|
|
|
|
|
|
This layer adds some fancy improvements to `company-clang`.
|
|
|
|
It includes a hook to load a projects `.clang_complete` file, which is
|
|
|
|
just a text file with one clang flag per line, a format also used by
|
|
|
|
other text editor clang plugins.
|
|
|
|
|
|
|
|
Not only does this allow proper autocomplete on projects with extra
|
|
|
|
includes and flags, but there is also support for flycheck so that it
|
|
|
|
doesn't complain about missing header files.
|
2014-12-14 04:29:23 +00:00
|
|
|
|
2015-03-18 17:58:29 +00:00
|
|
|
## Key Bindings
|
|
|
|
|
|
|
|
Key Binding | Description
|
|
|
|
----------------------|------------------------------------------------------------
|
|
|
|
<kbd>SPC m g o</kbd> | open matching file (e.g. switch between .cpp and .h)
|
|
|
|
<kbd>SPC m g O</kbd> | open matching file in another window (e.g. switch between .cpp and .h)
|
|
|
|
<kbd>SPC m r</kbd> | srefactor: refactor thing at point.
|
|
|
|
|
|
|
|
|
2014-12-14 04:08:55 +00:00
|
|
|
## Install
|
|
|
|
|
|
|
|
To use this contribution add it to your `~/.spacemacs`
|
|
|
|
|
|
|
|
```elisp
|
2015-02-18 03:36:12 +00:00
|
|
|
(setq-default dotspacemacs-configuration-layers '(c-c++))
|
2014-12-14 04:08:55 +00:00
|
|
|
```
|
|
|
|
|
2015-03-11 00:25:20 +00:00
|
|
|
** Note: ** [semantic-refactor][] is only available for Emacs 24.4+
|
|
|
|
|
2014-12-14 04:08:55 +00:00
|
|
|
[CMake]: http://www.cmake.org/
|
2015-03-11 00:25:20 +00:00
|
|
|
[semantic-refactor]: https://github.com/tuhdo/semantic-refactor
|
2015-03-12 09:16:14 +00:00
|
|
|
[srefactor-demos]: https://github.com/tuhdo/semantic-refactor/blob/master/srefactor-demos/demos.org
|
|
|
|
[stickyfunc-demos]: https://github.com/tuhdo/semantic-stickyfunc-enhance
|