sponsor Vim development Vim logo Vim Book Ad

SourceCodeObedience : Browse source code easily with cscope, ctags and marks system

 script karma  Rating 248/72, Downloaded by 7973  Comments, bugs, improvements  Vim wiki

created by
Mykola Golubyev
script type

Research source code.
Support source code.


Cscope: http://cscope.sourceforge.net/
Ctags: http://ctags.sourceforge.net/

without cscope and ctags you can use only marks.


--NEW--:  mark commands ability added. read sco_command_feature.sco with vim about new feature

First step:
   Create new file with "sco" extension: [g]vim my_name.sco
   Read help.
   Change settings at the beginig of sco file

   Execute one of the commands
       :SCOSymbol 'class' (for example)
       :SCOGlobal 'main'
       :SCOWhoCall 'setValue'
       :SCOFile 'main'
       :SCOInclude 'stdafx.h'
       :SCOText 'Enter password'
       :SCOGrep ' ".*" '
       :SCOTag 'gui'
       :SCOClassInfo 'class[struct]name' (cant take some time)

Second step:
   Unfold result.
   Filter result (:Delete :Leave :Filter commands)
   Preview result (:Preview command or c<Space>p)
   Preview result using :SCOUp :SCODown commands ( map them on keys <C-Up> <C-Down> for example )
   Select appropriate row and press <Enter> to open file for edit.

Third step:
   Move inside file.
   Select interesting line.
   Execute :SCOMark command (c<Space>m) or :SCOMarkSmart (c<Space>n)

   Use :SCOMarkSmart for store results for future
   Change caption of the marks with  :Caption ['sometext'] command or :FileNameCaption

   Use vim search and then :SCOSaveSearch(c<Space>s) to quick overview of find result and to select appropriate one ( To avoid multi n pressing )

   Execute :AppendPlace to select place where new marks will be appear ( example http://groups.google.com/group/SourceCodeObedience/web/content-example )

   Use :SCOReMark for change marks point

Fourth step:
   Add tags and header information to your marks and text description to quick find later with http://www.vim.org/scripts/script.php?script_id=1791

header: creation of database connection
   tags: connection, create, database
some text

Debug step:

  when you are going to understand source code with debugger (gdb) you should to use
    :TransferToMarks command.
Copy backtrace lines to sco file. Select them and :TransferToMarks.

Discuss step:



You don't need to create cscope connection.
What cscope data base to use you can set by adding (added automatically when sco file first created)

% cscope_db: cscope.out

in the begining of sco file.
As a result you can have many sco buffers with different cscope connections.
If your cscope executable installed not in standart place - you can change path to cscope by adding

% cscope_exe: /my_path/cscope

in the begining of sco file.


If you want to use :SCOClassInfo you must have tag file generated with ctags --fields=fks (default settings)

Change % tags_db: path_to_tag_file at the begining of sco file to path for your tag file


g:sco_default_tags in your .vimrc to avoid continual change first lines of newly created .sco files

let g:sco_default_db = /home/ni/cscope.out
let g:sco_default_exe = /home/ni/bin/cscope
let g:sco_default_tags = /home/ni/tags
install details
unzip sco.zip into your plugin folder

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
sco.zip 4.02 2007-08-08 7.0 Mykola Golubyev Mark with command ability added.
open  sco_command_feature.sco from sco.zip arhcive with vim to read about new feature.
Bug fix with sco options parse.
sco.zip 4.01 2007-08-08 7.0 Mykola Golubyev small bug fix. remove error messages that wasn't at previous versions.
sco.zip 4.0 2007-08-08 7.0 Mykola Golubyev Mark with command ability added.
open  sco_command_feature.sco from sco.zip arhcive with vim to read about new feature.
sco.zip 3.3 2007-07-19 7.0 Mykola Golubyev result output headers changed to be with tags: information. SCOSaveSearch rewrited to work faster and  without bugs. changed colors for tag list in tags: line
sco.zip 3.241 2007-05-17 7.0 Mykola Golubyev :SCOSaveSearch bugged on linux. Fixed. Please check.
sco.zip 3.24 2007-05-17 7.0 Mykola Golubyev :SCOMarkSmart changed to work with :g/pattern/SCOMarkSmart. :SCOSaveSearch (c<space>s by default) command added to store all lines with last pattern to sco buffer as marks. create new .sco file and read help.
sco.zip 3.2 2007-04-02 7.0 Mykola Golubyev :AppendPlace added. Select place where you want to add marks in sco file. Execute :AppendPlace on any line in sco buffer. Every :AddMark[Smart]  will add marks staring from that line and exactly in that sco buffer.
sco_keys.vim added to change hot keys.
sco.vim 3 2007-03-30 7.0 Mykola Golubyev :TransferToMarks command to convert back trace ( tested on gdb ) to smart marks. Create new sco file and read help
sco.vim 2.92 2007-03-28 7.0 Mykola Golubyev :SCOReMark added ( c<Space>r ) to point current mark to another place: for repair broken marks
sco.vim 2.9 2007-03-21 7.0 Mykola Golubyev :FileNameCaption added ( create new .sco file ( [g]vim newfile.sco ) and read help )
sco.vim 2.81 2007-02-21 7.0 Mykola Golubyev remove bug with :SCONext in cases when there is only one .sco file in buffer list and it is first
sco.vim 2.8 2007-02-05 7.0 Mykola Golubyev added :header highlight for use with tagscan.vim
sco.vim 2.7 2007-02-02 7.0 Mykola Golubyev Added highlight for records like
tags: tag1, tag2, tag3
tags: create, gui, file
to use with tagscan.vim
sco.vim 2.6 2007-01-29 7.0 Mykola Golubyev :SCOPrevious :SCONext commands added to switch between different sco buffers ( interfaces.sco; bugs.sco; breakpoints.sco; etc.. ) Map them on <C-Left> <C-Right> for example.
Create new sco file and read help.
sco.vim 2.5 2007-01-22 7.0 Mykola Golubyev Select several lines in sco buffer (visual mode) and press 'o'.
Try it.
( Create new .sco file and read help )
sco.vim 2.41 2007-01-15 7.0 Mykola Golubyev Removed bug with smart mark lines with '||' symbol
sco.vim 2.4 2006-12-13 7.0 Mykola Golubyev added useful commands
( create new .sco file and read help )
Map them for example to <C-Up> and <C-Down> for fast browsing
sco.vim 2.3 2006-10-20 7.0 Mykola Golubyev :SCOTag 'tag_regexp' - add tags information to sco buffer.
:SCOTag '' - add information about tag under cursor (c<Space>t)
sco.vim 2.2 2006-10-18 7.0 Mykola Golubyev Command :SCOClassInfo '' generate information about all classes.
Fix Bug with "can't find pattern" (unescape '/' symbol when jump to tag)
sco.vim 2.1 2006-10-16 7.0 Mykola Golubyev Added command :SCOClassInfo 'class[stuct]name' which build tree info (members, methods, inner classes with methods and members) about class. Command used tag file builded with ctags. Tested for c++. Execution of this command can take some time. Create new .sco file and set parametr tags_db equal to path for your tag file.
sco.vim 2.0 2006-10-06 7.0 Mykola Golubyev New appearance of smart marks. New appearance of folds at all.
Added captions to smart marks. Added hot keys to work in visual mode. Create new file with sco extension and read help
sco.vim 1.1.1 2006-10-05 7.0 Mykola Golubyev Fix bug. Smart marks didn't worked at lines with " * [ ] " symbols
sco.vim 1.1 2006-10-03 7.0 Mykola Golubyev New kind of marks added (smart marks).
:Allign command added. (create new sco file and read help for details)
sco.vim 1.0 2006-09-26 7.0 Mykola Golubyev Rewrited in pure vim language. Not need vim's perl support. Not need vim's cscope support.
Added auto align of marks.
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github