summaryrefslogtreecommitdiffstats
path: root/.vim/doc/cecscope.txt
blob: 46e7121987de5113fa3f58ee5d044569322b5149 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
*cecscope.txt*	Charles E Campblell's Cscope Plugin		Nov 12, 2008

Author:  Charles E. Campbell, Jr.  <NdrOchip@ScampbellPfamily.AbizM>
	 (remove NOSPAM from Campbell's email first)
Copyright: (c) 2004-2008 by Charles E. Campbell, Jr.	*cecscope-copyright*
           The VIM LICENSE applies to cecscope.vim and cecscope.txt
           (see |copyright|) except use "cecscope" instead of "Vim".
	   No warranty, express or implied.  Use At-Your-Own-Risk.
Note:    Required:
         * your :version of vim must have +cscope
         * vim 7.0aa snapshot#188 or later for the "quickfix" display

==============================================================================
1. Contents						*cecscope-contents*

  1. Contents............................: |cecscope-contents|
  2. Installing cecscope.................: |cecscope-install|
  3. Cescope Manual......................: |cecscope-manual|
  3. Cescope Tutorial....................: |cecscope-tutorial|
  5. Cescope History.....................: |cecscope-history|
   	

==============================================================================
2. Installing cecscope					*cecscope-install*

    1. vim cecscope.vba.gz
    2. :so %
    3. :q

    Cecscope now requires vim 7.2 or later; it uses the fnameescape() function
    to avoid certain security problems.  It is possible to use "carefully
    crafted filenames" to cause vim to execute arbitrary commands otherwise.
    Admittedly, most such filenames are obviously bad apples.

    Using vim 7.2 also means that your vimball plugin is reasonably
    up-to-date, which is used by the install process.

==============================================================================
3. Cescope Manual				*cecscope-manual*
						*:CS* *:CSL* *:CSS* *:CSH*
    :CS     [cdefgist]   : cscope command handler
    :CSL[!] [cdefgist]   : locallist style (! restores efm)
    :CSS[!] [cdefgist]   : split window and use cscope
    :CSH                 : give quick help
    :CSR                 : cscope reset

    !            split vertically
    c (calls)    find functions calling function under cursor
    d (called)   find functions called by function under cursor
    e (egrep)    egrep search for the word under cursor
    f (file)     open the file named under cursor
    g (global)   find global definition(s) of word under cursor
    i (includes) find files that #include file named under cursor
    s (symbol)   find all references to the word under cursor
    t (text)     find all instances of the word under cursor

    A simple >
        :CS
<   will initialize cscope, building its database if necessary.  What
    :CS will do: >

        if cscope.out exists in the current directory, cs add it.
        if $CSCOPE_DB (an environment variable) exists and the
           file it references exists, cs add it.
        if cscope.out exists in any directory from the current
           directory or in any parent directory up to but not
           including the $HOME directory, cs add it.
        if cscope is executable, apply cscope -b to the current file.
<
    Thus :CS will search for and attempt to use a cscope database,
    building one if necessary.

    In addition, when using gvim, there is a menu interface under the
    "DrChip" label with all of the above options mentioned.  The first
    four items are taken from:

        Help
        Use Messages Display
        Use Horiz Split Display
        Use Vert Split Display
        Use Quickfix Display

    The "Use" method that's currently active will not be present (initially,
    that's the "Use Messages Display").

    *g:cecscope_dboptions*
    For special options to be passed to cscope for database building, set
    g:cecscope_dboptions to the desired string.  For example, to use all
    source files in a so-called namefile: >
        let g:cecscope_dboptions= "-inamefile"
<   One must explicitly list *.cpp, *.c++, and *.C files, for example, in
    such a file.


==============================================================================
4. Cescope Tutorial					*cecscope-tutorial*

   GETTING STARTED
    To use this plugin you'll need to have vim 7.0aa, snapshot#188 or later,
    and your version should have +cscope.  To check that latter condition,
    either look for +cscope through the output of >
        :version
<   or type >
        :echo has("cscope")
<   You'll need to recompile your vim if you don't have +cscope.

    BUILDING CSCOPE DATABASE
    Once you have your cscope-enabled vim, then change directory to wherever
    you have some C code.  Type >
        cscope -b *.[ch]
<   and the cscope database will be generated (<cscope.out>).  If you don't
    have a cscope database, the file specified by the environment variable
    named >
        $CSCOPE_DB
<   will be used.  Sadly, otherwise cecscope.vim will issue a warning message.

    SELECTING A DISPLAY MODE

    Assuming you're using gvim: Select >
        DrChip:Cscope:Use Quickfix Display
<   This will make the information from cscope show up in a local quickfix
    window (see |:lopen|).  The other modes allow one to see cscope messages
    as regular messages (which will shortly disappear) or in another window.

    USING THE QUICKFIX DISPLAY
    Place your cursor atop some function that you've written: >
        DrChip:Cscope:Find function which calls word under cursor
<   and you'll see a locallist window open up which tells you something like >
        xgrep.c|410 info| <<sprt>> Edbg(("xgrep(%s)",sprt(filename)));
<   To jump to that entry, type >
        :ll
<   To jump to the next entry, type >
        :lne
<   To jump to the previous entry, type >
        :lp
<   You can also switch windows (ex. <ctrl-w>j, see |window-move-cursor|)
    to the locallist window, move the cursor about normally, then hit the
    <cr> to jump to the selection.

    USING THE COMMAND LINE
    You could've done the above using the command line!  Again, just
    place your cursor atop some function that you've written, then type: >
        :CSL c
<   You may use the :ll, :lne, and :lp commands as before.

    HELP
    Just type >
        :CSH
<   for a quick help display.  Of course, you can always type : >
        :help CS
<   too.


==============================================================================
5. Cescope History					*cecscope-history*

   v4 Nov 12, 2008 * csqf kept if has("quickfix") is true
                   * vim 7.2 required, and warning message is issued if
                     vim isn't 7.2 (or later)
                   * fnameescape() used for security purposes (thus vim 7.2)
                   * help menu fixed
   v3 Oct 12, 2006 : removed "silent" from cscope calls; it prevented the
                     selector from appearing.
   v1 Jan 30, 2006 : initial release

=====================================================================
vim:tw=78:ts=8:ft=help:sts=4:et:ai