<commit_before>#+TITLE: YCMD layer

* Table of Contents                                         :TOC_4_gh:noexport:
 - [[#description][Description]]
 - [[#install][Install]]
   - [[#layer][Layer]]
   - [[#ycmd][YCMD]]
   - [[#other-requirements][Other Requirements]]
 - [[#configuration][Configuration]]
 - [[#key-bindings][Key Bindings]]

* Description

This layer adds [[https://github.com/abingham/emacs-ycmd][emacs-ycmd]] support.

* Install
** Layer
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =ycmd= to the existing =dotspacemacs-configuration-layers= list in this
file.

** YCMD
In order to use this layer you must have a local [[https://github.com/Valloric/ycmd#building][ycmd]] installation and must
set the =ycmd-server-command= variable to reflect the path to that installation.
See the [[https://github.com/abingham/emacs-ycmd][emacs-ycmd]] readme for more instructions on this.

** Other Requirements
This package requires the =auto-completion= layer in order to get actual
completion. The =syntax-checking= layer is required for flycheck support.

* Configuration
By default this layer only activates ycmd for =c++-mode=.

If you want ycmd support in other modes you might just want to add it for
specific languages like:

#+BEGIN_SRC emacs-lisp
(add-hook 'c++-mode-hook 'ycmd-mode)
#+END_SRC

* Key Bindings

Adds ~SPC m g g~ go to definition binding to =c++-mode= as well as ~SPC m g G~
for the more imprecise but faster version.
<commit_msg>Provide more details for ycmd installation and configuration<commit_after>#+TITLE: YCMD layer

* Table of Contents                                         :TOC_4_gh:noexport:
 - [[#description][Description]]
 - [[#install][Install]]
   - [[#layer][Layer]]
   - [[#ycmd][YCMD]]
   - [[#other-requirements][Other Requirements]]
 - [[#configuration][Configuration]]
 - [[#key-bindings][Key Bindings]]

* Description

This layer adds [[https://github.com/abingham/emacs-ycmd][emacs-ycmd]] support.

* Install
** Layer
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =ycmd= to the existing =dotspacemacs-configuration-layers= list in this
file.

** YCMD
1) Install the =ycm= server. Installation instructions can be found [[https://github.com/Valloric/ycmd#building][here]].
2) Set the =ycmd-server-command= variable to reflect the path to the installation:
  #+BEGIN_SRC emacs-lisp
  (setq ycmd-server-command '("python" "/path/to/YouCompleteMe/third_party/ycmd/ycmd"))
  #+END_SRC
3) Instead of =.clang_complete= ycmd [[https://github.com/Valloric/YouCompleteMe/blob/master/README.md#c-family-semantic-completion][uses a .ycm_extra_conf.py file]].
4) Whitelist the file by adding the following to =.spacemacs=:
  #+BEGIN_SRC emacs-lisp
  ;; In this example we whitelist everything in the Develop folder
  (setq ycmd-extra-conf-whitelist '("~/Develop/*"))
  #+END_SRC
5) The completion is not going to work automatically until we actually force it:
  #+BEGIN_SRC emacs-lisp
  (setq ycmd-force-semantic-completion t)
  #+END_SRC


** Other Requirements
This package requires the =auto-completion= layer in order to get actual
completion. The =syntax-checking= layer is required for flycheck support.

* Configuration
By default this layer only activates ycmd for =c++-mode=.

If you want ycmd support in other modes you might just want to add it for
specific languages like:

#+BEGIN_SRC emacs-lisp
(add-hook 'c++-mode-hook 'ycmd-mode)
#+END_SRC

* Key Bindings

Adds ~SPC m g g~ go to definition binding to =c++-mode= as well as ~SPC m g G~
for the more imprecise but faster version.

{'fraction_non_alphanumeric': 0.12112831858407079, 'fraction_numerical': 0.0019358407079646017, 'mean_word_length': 4.115983026874116, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3195268', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1132, 'n_words': 393}