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.
cu-vim-VERSION.tgz and the content of extracted
code_upstairs-VERSION directory move
~/.vim/ or whole directory to Pathogen corner.
Current version Code Upstairs works only with C and Python.
For C you need to have installed
for Python you need
cscope along with
Vim has to be compiled with
Open some file of your project and call:
<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:
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
XXis a number) layer shows children functions in distance
XXfrom current function. Those are not pure child functions, they have more than one parent and therefore theirs calls are distributed over code. Distance
XXtells how far they are distributed. Further functions distances can mean not clear implementation or code design.
Default keybindings can be change using variables given in parenthesis.
<space>,will switch layer forward and backward. (
<space>nwill switch function in a layer forward and backward. (
<space>bwill jump to function definition (
<space>vwill jump back (
<space>/will highlight function name in vim window (
Gedit and Geany editors plugin
As for today Vim plugin is the only one which (somehow) works... Plugins for Gedit and Geany are under development. They are graphical widgets, so should be much more user friendly.