Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 1 | *if_cscop.txt* For Vim version 7.3. Last change: 2010 Sep 29 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
| 3 | |
| 4 | VIM REFERENCE MANUAL by Andy Kahn |
| 5 | |
| 6 | *cscope* *Cscope* |
| 7 | This document explains how to use Vim's cscope interface. |
| 8 | |
| 9 | Cscope is a tool like ctags, but think of it as ctags on steroids since it |
| 10 | does a lot more than what ctags provides. In Vim, jumping to a result from |
| 11 | a cscope query is just like jumping to any tag; it is saved on the tag stack |
| 12 | so that with the right keyboard mappings, you can jump back and forth between |
| 13 | functions as you normally would with |tags|. |
| 14 | |
| 15 | 1. Cscope introduction |cscope-intro| |
| 16 | 2. Cscope related commands |cscope-commands| |
| 17 | 3. Cscope options |cscope-options| |
| 18 | 4. How to use cscope in Vim |cscope-howtouse| |
| 19 | 5. Limitations |cscope-limitations| |
| 20 | 6. Suggested usage |cscope-suggestions| |
| 21 | 7. Availability & Information |cscope-info| |
| 22 | |
| 23 | This is currently for Unix and Win32 only. |
| 24 | {Vi does not have any of these commands} |
| 25 | |
| 26 | ============================================================================== |
| 27 | 1. Cscope introduction *cscope-intro* |
| 28 | |
| 29 | The following text is taken from a version of the cscope man page: |
| 30 | |
| 31 | ----- |
| 32 | |
| 33 | Cscope is an interactive screen-oriented tool that helps you: |
| 34 | |
| 35 | Learn how a C program works without endless flipping through a thick |
| 36 | listing. |
| 37 | |
| 38 | Locate the section of code to change to fix a bug without having to |
| 39 | learn the entire program. |
| 40 | |
| 41 | Examine the effect of a proposed change such as adding a value to an |
| 42 | enum variable. |
| 43 | |
| 44 | Verify that a change has been made in all source files such as adding |
| 45 | an argument to an existing function. |
| 46 | |
| 47 | Rename a global variable in all source files. |
| 48 | |
| 49 | Change a constant to a preprocessor symbol in selected lines of files. |
| 50 | |
| 51 | It is designed to answer questions like: |
| 52 | Where is this symbol used? |
| 53 | Where is it defined? |
| 54 | Where did this variable get its value? |
| 55 | What is this global symbol's definition? |
| 56 | Where is this function in the source files? |
| 57 | What functions call this function? |
| 58 | What functions are called by this function? |
| 59 | Where does the message "out of space" come from? |
| 60 | Where is this source file in the directory structure? |
| 61 | What files include this header file? |
| 62 | |
| 63 | Cscope answers these questions from a symbol database that it builds the |
| 64 | first time it is used on the source files. On a subsequent call, cscope |
| 65 | rebuilds the database only if a source file has changed or the list of |
| 66 | source files is different. When the database is rebuilt the data for the |
| 67 | unchanged files is copied from the old database, which makes rebuilding |
| 68 | much faster than the initial build. |
| 69 | |
| 70 | ----- |
| 71 | |
| 72 | When cscope is normally invoked, you will get a full-screen selection |
| 73 | screen allowing you to make a query for one of the above questions. |
| 74 | However, once a match is found to your query and you have entered your |
| 75 | text editor to edit the source file containing match, you cannot simply |
| 76 | jump from tag to tag as you normally would with vi's Ctrl-] or :tag |
| 77 | command. |
| 78 | |
| 79 | Vim's cscope interface is done by invoking cscope with its line-oriented |
| 80 | interface, and then parsing the output returned from a query. The end |
| 81 | result is that cscope query results become just like regular tags, so |
| 82 | you can jump to them just like you do with normal tags (Ctrl-] or :tag) |
| 83 | and then go back by popping off the tagstack with Ctrl-T. (Please note |
| 84 | however, that you don't actually jump to a cscope tag simply by doing |
| 85 | Ctrl-] or :tag without remapping these commands or setting an option. |
| 86 | See the remaining sections on how the cscope interface works and for |
| 87 | suggested use.) |
| 88 | |
| 89 | |
| 90 | ============================================================================== |
| 91 | 2. Cscope related commands *cscope-commands* |
| 92 | |
| 93 | *:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560* |
| 94 | All cscope commands are accessed through suboptions to the main cscope |
| 95 | command ":cscope". The shortest abbreviation is ":cs". The ":scscope" |
| 96 | command does the same and also splits the window (short: "scs"). |
| 97 | |
| 98 | The available subcommands are: |
| 99 | |
| 100 | *E563* *E564* *E566* *E568* *E569* *E622* *E623* |
| 101 | *E625* *E626* *E609* |
| 102 | add : Add a new cscope database/connection. |
| 103 | |
| 104 | USAGE :cs add {file|dir} [pre-path] [flags] |
| 105 | |
| 106 | [pre-path] is the pathname used with the -P command to cscope. |
| 107 | |
| 108 | [flags] are any additional flags you want to pass to cscope. |
| 109 | |
| 110 | EXAMPLES > |
| 111 | :cscope add /usr/local/cdb/cscope.out |
| 112 | :cscope add /projects/vim/cscope.out /usr/local/vim |
| 113 | :cscope add cscope.out /usr/local/vim -C |
| 114 | < |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 115 | *cscope-find* *cs-find* *E567* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 116 | find : Query cscope. All cscope query options are available |
| 117 | except option #5 ("Change this grep pattern"). |
| 118 | |
| 119 | USAGE :cs find {querytype} {name} |
| 120 | |
| 121 | {querytype} corresponds to the actual cscope line |
| 122 | interface numbers as well as default nvi commands: |
| 123 | |
| 124 | 0 or s: Find this C symbol |
| 125 | 1 or g: Find this definition |
| 126 | 2 or d: Find functions called by this function |
| 127 | 3 or c: Find functions calling this function |
| 128 | 4 or t: Find this text string |
| 129 | 6 or e: Find this egrep pattern |
| 130 | 7 or f: Find this file |
| 131 | 8 or i: Find files #including this file |
| 132 | |
Bram Moolenaar | 80b6a0e | 2009-03-18 13:32:24 +0000 | [diff] [blame] | 133 | For all types, except 4 and 6, leading white space for {name} is |
| 134 | removed. For 4 and 6 there is exactly one space between {querytype} |
| 135 | and {name}. Further white space is included in {name}. |
| 136 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 137 | EXAMPLES > |
| 138 | :cscope find c vim_free |
Bram Moolenaar | 80b6a0e | 2009-03-18 13:32:24 +0000 | [diff] [blame] | 139 | :cscope find 3 vim_free |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 140 | < |
Bram Moolenaar | 80b6a0e | 2009-03-18 13:32:24 +0000 | [diff] [blame] | 141 | These two examples perform the same query: functions calling |
| 142 | "vim_free". > |
| 143 | |
| 144 | :cscope find t initOnce |
| 145 | :cscope find t initOnce |
| 146 | < |
| 147 | The first one searches for the text "initOnce", the second one for |
| 148 | " initOnce". > |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 149 | |
| 150 | :cscope find 0 DEFAULT_TERM |
| 151 | < |
| 152 | Executing this example on the source code for Vim 5.1 produces the |
| 153 | following output: |
| 154 | |
| 155 | Cscope tag: DEFAULT_TERM |
| 156 | # line filename / context / line |
| 157 | 1 1009 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 158 | #define DEFAULT_TERM (char_u *)"amiga" |
| 159 | 2 1013 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 160 | #define DEFAULT_TERM (char_u *)"win32" |
| 161 | 3 1017 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 162 | #define DEFAULT_TERM (char_u *)"pcterm" |
| 163 | 4 1021 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 164 | #define DEFAULT_TERM (char_u *)"ansi" |
| 165 | 5 1025 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 166 | #define DEFAULT_TERM (char_u *)"vt52" |
| 167 | 6 1029 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 168 | #define DEFAULT_TERM (char_u *)"os2ansi" |
| 169 | 7 1033 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 170 | #define DEFAULT_TERM (char_u *)"ansi" |
| 171 | 8 1037 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 172 | # undef DEFAULT_TERM |
| 173 | 9 1038 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 174 | #define DEFAULT_TERM (char_u *)"beos-ansi" |
| 175 | 10 1042 vim-5.1-gtk/src/term.c <<GLOBAL>> |
| 176 | #define DEFAULT_TERM (char_u *)"mac-ansi" |
| 177 | 11 1335 vim-5.1-gtk/src/term.c <<set_termname>> |
| 178 | term = DEFAULT_TERM; |
| 179 | 12 1459 vim-5.1-gtk/src/term.c <<set_termname>> |
| 180 | if (STRCMP(term, DEFAULT_TERM)) |
| 181 | 13 1826 vim-5.1-gtk/src/term.c <<termcapinit>> |
| 182 | term = DEFAULT_TERM; |
| 183 | 14 1833 vim-5.1-gtk/src/term.c <<termcapinit>> |
| 184 | term = DEFAULT_TERM; |
| 185 | 15 3635 vim-5.1-gtk/src/term.c <<update_tcap>> |
| 186 | p = find_builtin_term(DEFAULT_TERM); |
| 187 | Enter nr of choice (<CR> to abort): |
| 188 | |
| 189 | The output shows several pieces of information: |
| 190 | 1. The tag number (there are 15 in this example). |
| 191 | 2. The line number where the tag occurs. |
| 192 | 3. The filename where the tag occurs. |
| 193 | 4. The context of the tag (e.g., global, or the function name). |
| 194 | 5. The line from the file itself. |
| 195 | |
| 196 | help : Show a brief synopsis. |
| 197 | |
| 198 | USAGE :cs help |
| 199 | |
Bram Moolenaar | 4a74803 | 2010-09-30 21:47:56 +0200 | [diff] [blame] | 200 | *E261* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 201 | kill : Kill a cscope connection (or kill all cscope connections). |
| 202 | |
| 203 | USAGE :cs kill {num|partial_name} |
| 204 | |
| 205 | To kill a cscope connection, the connection number or a partial |
| 206 | name must be specified. The partial name is simply any part of |
| 207 | the pathname of the cscope database. Kill a cscope connection |
| 208 | using the partial name with caution! |
| 209 | |
| 210 | If the specified connection number is -1, then _ALL_ cscope |
| 211 | connections will be killed. |
| 212 | |
| 213 | reset : Reinit all cscope connections. |
| 214 | |
| 215 | USAGE :cs reset |
| 216 | |
| 217 | show : Show cscope connections. |
| 218 | |
| 219 | USAGE :cs show |
| 220 | |
Bram Moolenaar | c7453f5 | 2006-02-10 23:20:28 +0000 | [diff] [blame] | 221 | *:lcscope* *:lcs* |
| 222 | This command is same as the ":cscope" command, except when the |
| 223 | 'cscopequickfix' option is set, the location list for the current window is |
| 224 | used instead of the quickfix list to show the cscope results. |
| 225 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 226 | *:cstag* *E257* *E562* |
| 227 | If you use cscope as well as ctags, |:cstag| allows you to search one or |
| 228 | the other before making a jump. For example, you can choose to first |
| 229 | search your cscope database(s) for a match, and if one is not found, then |
| 230 | your tags file(s) will be searched. The order in which this happens |
| 231 | is determined by the value of |csto|. See |cscope-options| for more |
| 232 | details. |
| 233 | |
| 234 | |:cstag| performs the equivalent of ":cs find g" on the identifier when |
| 235 | searching through the cscope database(s). |
| 236 | |
| 237 | |:cstag| performs the equivalent of |:tjump| on the identifier when searching |
| 238 | through your tags file(s). |
| 239 | |
| 240 | |
| 241 | ============================================================================== |
| 242 | 3. Cscope options *cscope-options* |
| 243 | |
| 244 | Use the |:set| command to set all cscope options. Ideally, you would do |
| 245 | this in one of your startup files (e.g., .vimrc). Some cscope related |
| 246 | variables are only valid within |.vimrc|. Setting them after vim has |
| 247 | started will have no effect! |
| 248 | |
| 249 | *cscopeprg* *csprg* |
| 250 | 'cscopeprg' specifies the command to execute cscope. The default is |
| 251 | "cscope". For example: > |
| 252 | :set csprg=/usr/local/bin/cscope |
| 253 | < |
| 254 | *cscopequickfix* *csqf* *E469* |
| 255 | {not available when compiled without the |+quickfix| feature} |
| 256 | 'cscopequickfix' specifies whether to use quickfix window to show cscope |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 257 | results. This is a list of comma-separated values. Each item consists of |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 258 | |cscope-find| command (s, g, d, c, t, e, f or i) and flag (+, - or 0). |
| 259 | '+' indicates that results must be appended to quickfix window, |
| 260 | '-' implies previous results clearance, '0' or command absence - don't use |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 261 | quickfix. Search is performed from start until first command occurrence. |
| 262 | The default value is "" (don't use quickfix anyway). The following value |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 263 | seems to be useful: > |
| 264 | :set cscopequickfix=s-,c-,d-,i-,t-,e- |
| 265 | < |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 266 | *cscopetag* *cst* |
| 267 | If 'cscopetag' set, the commands ":tag" and CTRL-] as well as "vim -t" will |
| 268 | always use |:cstag| instead of the default :tag behavior. Effectively, by |
| 269 | setting 'cst', you will always search your cscope databases as well as your |
| 270 | tag files. The default is off. Examples: > |
| 271 | :set cst |
| 272 | :set nocst |
| 273 | < |
| 274 | *cscopetagorder* *csto* |
| 275 | The value of 'csto' determines the order in which |:cstag| performs a search. |
| 276 | If 'csto' is set to zero, cscope database(s) are searched first, followed |
| 277 | by tag file(s) if cscope did not return any matches. If 'csto' is set to |
| 278 | one, tag file(s) are searched before cscope database(s). The default is zero. |
| 279 | Examples: > |
| 280 | :set csto=0 |
| 281 | :set csto=1 |
| 282 | < |
| 283 | *cscopeverbose* *csverb* |
| 284 | If 'cscopeverbose' is not set (the default), messages will not be printed |
| 285 | indicating success or failure when adding a cscope database. Ideally, you |
| 286 | should reset this option in your |.vimrc| before adding any cscope databases, |
| 287 | and after adding them, set it. From then on, when you add more databases |
| 288 | within Vim, you will get a (hopefully) useful message should the database fail |
| 289 | to be added. Examples: > |
| 290 | :set csverb |
| 291 | :set nocsverb |
| 292 | < |
| 293 | *cscopepathcomp* *cspc* |
| 294 | The value of 'cspc' determines how many components of a file's path to |
| 295 | display. With the default value of zero the entire path will be displayed. |
| 296 | The value one will display only the filename with no path. Other values |
| 297 | display that many components. For example: > |
| 298 | :set cspc=3 |
| 299 | will display the last 3 components of the file's path, including the file |
| 300 | name itself. |
| 301 | |
| 302 | ============================================================================== |
| 303 | 4. How to use cscope in Vim *cscope-howtouse* |
| 304 | |
| 305 | The first thing you need to do is to build a cscope database for your |
| 306 | source files. For the most basic case, simply do "cscope -b". Please |
| 307 | refer to the cscope man page for more details. |
| 308 | |
| 309 | Assuming you have a cscope database, you need to "add" the database to Vim. |
| 310 | This establishes a cscope "connection" and makes it available for Vim to use. |
| 311 | You can do this in your .vimrc file, or you can do it manually after starting |
| 312 | vim. For example, to add the cscope database "cscope.out", you would do: |
| 313 | |
| 314 | :cs add cscope.out |
| 315 | |
| 316 | You can double-check the result of this by executing ":cs show". This will |
| 317 | produce output which looks like this: |
| 318 | |
| 319 | # pid database name prepend path |
| 320 | 0 28806 cscope.out <none> |
| 321 | |
| 322 | Note: |
| 323 | Because of the Microsoft RTL limitations, Win32 version shows 0 instead |
| 324 | of the real pid. |
| 325 | |
| 326 | Once a cscope connection is established, you can make queries to cscope and |
| 327 | the results will be printed to you. Queries are made using the command |
| 328 | ":cs find". For example: |
| 329 | |
| 330 | :cs find g ALIGN_SIZE |
| 331 | |
| 332 | This can get a little cumbersome since one ends up doing a significant |
| 333 | amount of typing. Fortunately, there are ways around this by mapping |
| 334 | shortcut keys. See |cscope-suggestions| for suggested usage. |
| 335 | |
| 336 | If the results return only one match, you will automatically be taken to it. |
| 337 | If there is more than one match, you will be given a selection screen to pick |
| 338 | the match you want to go to. After you have jumped to the new location, |
| 339 | simply hit Ctrl-T to get back to the previous one. |
| 340 | |
| 341 | |
| 342 | ============================================================================== |
| 343 | 5. Limitations *cscope-limitations* |
| 344 | |
| 345 | Cscope support for Vim is only available on systems that support these four |
| 346 | system calls: fork(), pipe(), execl(), waitpid(). This means it is mostly |
| 347 | limited to Unix systems. |
| 348 | |
| 349 | Additionally Cscope support works for Win32. For more information and a |
| 350 | cscope version for Win32 see: |
| 351 | |
| 352 | http://iamphet.nm.ru/cscope/index.html |
| 353 | |
Bram Moolenaar | 5eb86f9 | 2004-07-26 12:53:41 +0000 | [diff] [blame] | 354 | The DJGPP-built version from http://cscope.sourceforge.net is known to not |
| 355 | work with Vim. |
| 356 | |
Bram Moolenaar | 9fa49da | 2009-07-10 13:11:26 +0000 | [diff] [blame] | 357 | Hard-coded limitation: doing a |:tjump| when |:cstag| searches the tag files |
| 358 | is not configurable (e.g., you can't do a tselect instead). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 359 | |
| 360 | ============================================================================== |
| 361 | 6. Suggested usage *cscope-suggestions* |
| 362 | |
| 363 | Put these entries in your .vimrc (adjust the pathname accordingly to your |
| 364 | setup): > |
| 365 | |
| 366 | if has("cscope") |
| 367 | set csprg=/usr/local/bin/cscope |
| 368 | set csto=0 |
| 369 | set cst |
| 370 | set nocsverb |
| 371 | " add any database in current directory |
| 372 | if filereadable("cscope.out") |
| 373 | cs add cscope.out |
| 374 | " else add database pointed to by environment |
| 375 | elseif $CSCOPE_DB != "" |
| 376 | cs add $CSCOPE_DB |
| 377 | endif |
| 378 | set csverb |
| 379 | endif |
| 380 | |
| 381 | By setting 'cscopetag', we have effectively replaced all instances of the :tag |
| 382 | command with :cstag. This includes :tag, Ctrl-], and "vim -t". In doing |
| 383 | this, the regular tag command not only searches your ctags generated tag |
| 384 | files, but your cscope databases as well. |
| 385 | |
| 386 | Some users may want to keep the regular tag behavior and have a different |
| 387 | shortcut to access :cstag. For example, one could map Ctrl-_ (underscore) |
| 388 | to :cstag with the following command: > |
| 389 | |
| 390 | map <C-_> :cstag <C-R>=expand("<cword>")<CR><CR> |
| 391 | |
| 392 | A couple of very commonly used cscope queries (using ":cs find") is to |
| 393 | find all functions calling a certain function and to find all occurrences |
| 394 | of a particular C symbol. To do this, you can use these mappings as an |
| 395 | example: > |
| 396 | |
| 397 | map g<C-]> :cs find 3 <C-R>=expand("<cword>")<CR><CR> |
| 398 | map g<C-\> :cs find 0 <C-R>=expand("<cword>")<CR><CR> |
| 399 | |
| 400 | These mappings for Ctrl-] (right bracket) and Ctrl-\ (backslash) allow you to |
| 401 | place your cursor over the function name or C symbol and quickly query cscope |
| 402 | for any matches. |
| 403 | |
| 404 | Or you may use the following scheme, inspired by Vim/Cscope tutorial from |
| 405 | Cscope Home Page (http://cscope.sourceforge.net/): > |
| 406 | |
| 407 | nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR> |
| 408 | nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR> |
| 409 | nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR> |
| 410 | nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR> |
| 411 | nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR> |
| 412 | nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR> |
| 413 | nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> |
| 414 | nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR> |
| 415 | |
| 416 | " Using 'CTRL-spacebar' then a search type makes the vim window |
| 417 | " split horizontally, with search result displayed in |
| 418 | " the new window. |
| 419 | |
| 420 | nmap <C-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR> |
| 421 | nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR> |
| 422 | nmap <C-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR> |
| 423 | nmap <C-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR> |
| 424 | nmap <C-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR> |
| 425 | nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR> |
| 426 | nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> |
| 427 | nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR> |
| 428 | |
| 429 | " Hitting CTRL-space *twice* before the search type does a vertical |
| 430 | " split instead of a horizontal one |
| 431 | |
| 432 | nmap <C-Space><C-Space>s |
| 433 | \:vert scs find s <C-R>=expand("<cword>")<CR><CR> |
| 434 | nmap <C-Space><C-Space>g |
| 435 | \:vert scs find g <C-R>=expand("<cword>")<CR><CR> |
| 436 | nmap <C-Space><C-Space>c |
| 437 | \:vert scs find c <C-R>=expand("<cword>")<CR><CR> |
| 438 | nmap <C-Space><C-Space>t |
| 439 | \:vert scs find t <C-R>=expand("<cword>")<CR><CR> |
| 440 | nmap <C-Space><C-Space>e |
| 441 | \:vert scs find e <C-R>=expand("<cword>")<CR><CR> |
| 442 | nmap <C-Space><C-Space>i |
| 443 | \:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> |
| 444 | nmap <C-Space><C-Space>d |
| 445 | \:vert scs find d <C-R>=expand("<cword>")<CR><CR> |
| 446 | |
| 447 | ============================================================================== |
| 448 | 7. Cscope availability and information *cscope-info* |
| 449 | |
| 450 | If you do not already have cscope (it did not come with your compiler |
| 451 | license or OS distribution), then you can download it for free from: |
| 452 | http://cscope.sourceforge.net/ |
| 453 | This is released by SCO under the BSD license. |
| 454 | |
| 455 | If you want a newer version of cscope, you will probably have to buy it. |
| 456 | According to the (old) nvi documentation: |
| 457 | |
| 458 | You can buy version 13.3 source with an unrestricted license |
| 459 | for $400 from AT&T Software Solutions by calling +1-800-462-8146. |
| 460 | |
| 461 | Also you can download cscope 13.x and mlcscope 14.x (multi-lingual cscope |
| 462 | which supports C, C++, Java, lex, yacc, breakpoint listing, Ingres, and SDL) |
| 463 | from World-Wide Exptools Open Source packages page: |
| 464 | http://www.bell-labs.com/project/wwexptools/packages.html |
| 465 | |
| 466 | In Solaris 2.x, if you have the C compiler license, you will also have |
| 467 | cscope. Both are usually located under /opt/SUNWspro/bin |
| 468 | |
| 469 | SGI developers can also get it. Search for Cscope on this page: |
| 470 | http://freeware.sgi.com/index-by-alpha.html |
| 471 | https://toolbox.sgi.com/toolbox/utilities/cscope/ |
| 472 | The second one is for those who have a password for the SGI toolbox. |
| 473 | |
| 474 | There is source to an older version of a cscope clone (called "cs") available |
| 475 | on the net. Due to various reasons, this is not supported with Vim. |
| 476 | |
| 477 | The cscope interface/support for Vim was originally written by |
| 478 | Andy Kahn <ackahn@netapp.com>. The original structure (as well as a tiny |
| 479 | bit of code) was adapted from the cscope interface in nvi. Please report |
| 480 | any problems, suggestions, patches, et al., you have for the usage of |
| 481 | cscope within Vim to him. |
| 482 | *cscope-win32* |
Bram Moolenaar | 8ae39d8 | 2009-09-11 09:30:34 +0000 | [diff] [blame] | 483 | For a cscope version for Win32 see: |
| 484 | http://code.google.com/p/cscope-win32/ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 485 | |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 486 | Win32 support was added by Sergey Khorev <sergey.khorev@gmail.com>. Contact |
Bram Moolenaar | b23c338 | 2005-01-31 19:09:12 +0000 | [diff] [blame] | 487 | him if you have Win32-specific issues. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 488 | |
| 489 | vim:tw=78:ts=8:ft=help:norl: |