sponsor Vim development Vim logo Vim Book Ad

Code Upstairs : A plugin for browsing source code at functions level.

 script karma  Rating 5/2, Downloaded by 1526  Comments, bugs, improvements  Vim wiki

created by
Tomasz Wyderka
 
script type
ftplugin
 
description
Readability of source code is decreasing when project is getting bigger. The
aim of this tool is to make code more easily readable and understandable.
In other words it is trying to put big projects more under control.

Normally readability of long single function is preserved by using indentation of
code lines. This plugin provides kind of *indentation* at higher level -
*indentation* of whole functions.

User can see fairly easily how current function is dependent upon others. He
will also get structure of all functions in code in a tree layout if code is clearly
implemented. So therefor _Code Upstairs_ is also kind of quality controller.

_Code Upstairs_ is a programmer editors plugins.

## Vim plugin ##

### Usage ###
Open some file of your project and call:

    :CUinit <directory>

where `<directory>` is the root of your project.
If skipped current directory will be used.

Statusline will appear if it was disabled, and you can see
functions structure there,
but only when cursor is in some function body.

To turn off _Code Upstairs_ use:

    :CUshutdown

### Statusline ###
Functions structure is shown in statusline.
Because of limited space statusline is divided to layers.
Following layers are shown in order from left to right:

+ __(-)__ layer showing original vim statusline (like filename and cursor position)
+ __(P)__ layer with parents of current function. Parent is a function from
    which current function is called.
+ __(S)__ siblings layer shows functions which are on the same level with
   current function looking from parent perspective (Frankly saying siblings are
   __pure child functions__ of parent function, check out next layer!)
+ __(C)__ children layer shows __pure child functions__ of current function.
   __Pure child function__ is a function which is called only from one parent.
+ __(XX)__ (where `XX` is a number) layer shows children functions in distance
   `XX` from current function. Those are not __pure child
   functions__, they have more than one parent and therefore theirs calls are
   distributed over code. Distance `XX` tells how far they are distributed.
   Further functions distances can mean not clear implementation or code design.

### Keybindings ###
Default keybindings can be change using variables given in parenthesis.

+ `<space>.` and `<space>,` will switch layer forward and backward.
  (`CUkeyNextLayer` and `CUkeyPrevLayer`)
+ `<space>m` and `<space>n` will switch function in a layer forward and
  backward. (`CUkeyNextFunction` and `CUkeyPrevFunction`)
+ `<space>b` will jump to function definition (`CUkeyJumpToFunction`)
+ `<space>v` will jump back (`CUkeyJumpBack`)
+ `<space>/` will highlight function name in vim window (`CUkeyHighlightFunction`)

## _Code Upstairs_ Project Houses ##

* [vim plugin at vim.org](http://www.vim.org/scripts/script.php?script_id=4498)
* [at github](http://github.com/wyderkat/code_upstairs)
* [at my website](http://www.cofoh.com/code_upstairs)
 
install details
### Installation ###
Unpack `cu-vim-VERSION.tgz` and the content of extracted `code_upstairs-VERSION` directory move
to your `~/.vim/` or whole directory to Pathogen corner.

Current version _Code Upstairs_ works only with **C** and **Python**.
For **C** you need to have installed `cscope` and
for **Python** you need `cscope` along with `pycscope`

Vim has to be compiled with `python` support.
 

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
cu-vim-0.4.tgz 0.4 2013-04-03 7.0 Tomasz Wyderka New functionality remembering last layer and function. JumpBack keybinding.
cu-vim-0.3.tgz 0.3 2013-04-01 7.0 Tomasz Wyderka Auto-enabling status line. Proper failures handling (when cscope missing, etc).
cu-vim-0.2.tgz 0.2 2013-03-31 7.0 Tomasz Wyderka Fixed missing "plugin" directory
cu-vim-0.1.tgz 0.1 2013-03-30 7.0 Tomasz Wyderka Initial upload
ip used for rating: 44.220.184.63

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