2015-12-02 14:23:39 +00:00
#+TITLE : Cscope layer
2015-07-24 01:56:04 +00:00
2019-05-02 21:49:30 +00:00
#+TAGS : layer|tag
2015-11-08 18:04:44 +00:00
[[file:img/cscope.jpg ]]
2015-07-24 01:56:04 +00:00
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description ][Description ]]
2017-12-21 17:27:23 +00:00
- [[#features ][Features: ]]
2017-05-22 14:16:12 +00:00
- [[#install ][Install ]]
- [[#layer ][Layer ]]
- [[#cscope ][Cscope ]]
- [[#pycscope ][PyCscope ]]
- [[#usage ][Usage ]]
- [[#key-bindings ][Key bindings ]]
2015-07-24 01:56:04 +00:00
* Description
This layer provides bindings for using [[http://cscope.sourceforge.net ][Cscope ]] and [[https://github.com/portante/pycscope ][PyCscope ]] in Spacemacs.
2017-12-21 17:27:23 +00:00
See [[https://github.com/OpenGrok/OpenGrok/wiki/Comparison-with-Similar-Tools ][here ]] for a comparison between =Cscope= and other similar tools (such as gtags).
** Features:
- Tag indexing and searching for C-C++ via [[http://cscope.sourceforge.net ][Cscope ]]
- Tag indexing and searching for python via [[https://github.com/portante/pycscope ][PyCscope ]]
2015-07-24 01:56:04 +00:00
* Install
** Layer
2016-01-06 05:21:55 +00:00
To use this configuration layer, add it to your =~/.spacemacs= . You will need to
add =cscope= to the existing =dotspacemacs-configuration-layers= list in this
file.
2015-07-24 01:56:04 +00:00
** Cscope
2017-07-29 18:35:37 +00:00
Enable =c-c++= layer in your =~/.spacemacs= file. Install =Cscope= through your
package manager, or download it from the [[http://cscope.sourceforge.net/#downloads ][website ]] and build it from source.
2015-07-24 01:56:04 +00:00
From package manager (for example, Ubuntu):
#+BEGIN_SRC sh
2018-09-19 03:54:47 +00:00
sudo apt-get install cscope
2015-07-24 01:56:04 +00:00
#+END_SRC
From source:
#+BEGIN_SRC sh
2018-09-19 03:54:47 +00:00
tar xvf cscope-15.8b
cd cscope-15.8b
./configure
make
sudo make install
2015-07-24 01:56:04 +00:00
#+END_SRC
** PyCscope
2017-07-29 18:35:37 +00:00
Enable =python= layer in your =~/.spacemacs= file. Install PyCscope through pip:
2015-07-24 01:56:04 +00:00
#+BEGIN_SRC sh
2018-09-19 03:54:47 +00:00
pip install pycscope
2015-07-24 01:56:04 +00:00
#+END_SRC
* Usage
Before using any helm-cscope commands, remember to create a Cscope index file.
Do it by running the command =cscope-index-files= for C and C++ projects, or the
command =cscope/run-pycscope= for Python projects, bound to ~SPC m g i~ .
* Key bindings
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2015-07-24 01:56:04 +00:00
|-------------+-----------------------------------------------|
2017-06-10 10:13:04 +00:00
| ~SPC m g =~ | Find assignments to a symbol |
2015-07-24 01:56:04 +00:00
| ~SPC m g c~ | find which functions are called by a function |
| ~SPC m g C~ | find where a function is called |
| ~SPC m g d~ | find global definition of a symbol |
| ~SPC m g e~ | search regular expression |
| ~SPC m g f~ | find a file |
| ~SPC m g F~ | find which files include a file |
| ~SPC m g i~ | create Cscope index |
| ~SPC m g r~ | find references of a symbol |
| ~SPC m g x~ | search text |