tags:

views:

540

answers:

6

Hi!,

From past 9 years i have been using vi as my editor and have found few things which i haven't seen simple and non-stupid solutions, could any of you have better solutions.

  1. when-ever i open a fresh file to code.. getting by default the header description.. with date,time and author name etc...basic things in place.
  2. When-ever i open a file for edit (update mode) i want to see that a new line in introduced by default which will help me to enter the description for change.
  3. When-ever i introduce a func/method i get basic description of function in place, were in i have to just introduce the description and not specify what are the params and return types..etc.

If i can get some solution to the above for vi only, it would be great. Otherwise also please do comment of how can i get it done using emacs or similar editors.

-thanks harish

+2  A: 

Cream:: a modern configuration of the Vim text editor

Cream shapes Vim into an interface you probably already know (sometimes called Common User Access [ext.link] ). Whether you are writing emails or developing large software applications, Cream saves you time and gets you up and running quickly.

From the list of basic features:

  • Insert current date/time (F11 opens a menu of possible formats, F11 x2 inserts the last format used).

Programmer Features

  • Context sensitive completion (Vim's Omni completion feature) (Ctrl+Enterh, Ctrl+Shift+Enter).
    • Block comment and un-comment selections (F6 and Shift+F6).
    • Ctags navigation. (Requires installation of the free Exuberant ctags [ext.link] or other similar tag navigation program.) Through Alt+arrow keys, move back and forth between previously visited tags (Alt+Left/Right), move to function or variable's definition (Alt+Down), or close referenced file and return (Alt+Up).
    • Function and variable list available for the current file (Ctrl+Alt+Down). (Requires Ctags)
    • Template completion based on file type (Esc+Space). (See Tools menu for list of available templates.)
    • Line folding intuitively hides entire sections with a keystroke (F9 and combinations).
    • Pop up prototype and information menu ( Alt+( ). View the function's prototype under the cursor without having to open the file with the definition.
    • Insert line numbers for current selection, begin with any value.
    • Soft Tabstop setting allows existing text to be displayed by Tabstop Width while new editing uses this alternate setting, inserting tabs and spaces to accomplish the new indention.
    • Diff mode to see differences between two files.
    • Terminal mode menus (console menus) (F12, console only).
    • Cream, Cream Lite, Vim or Vi editing behavior setting.
    • Expert mode, an option to use the Esc key to toggle back and forth between Vim's normal and insert modes.
    • Multiple user configuration from a single installation. (FAQ)
gimel
+9  A: 

Use csupport plugin ... very useful for c++. it works on Vim, Might not work in original Vi

http://www.vim.org/scripts/script.php?script_id=213

tmahmood
This script is really helpful. You can also customize the template comments you want for new file, function, class to suite to your needs.
Canopus
Useful script. It definitely doesn't work with the original Vi though, since the original Vi doesn't have plugin support.
skinp
+1  A: 

I constantly tune my .vimrc file and add new functionality for such kind of things.

Right now I can think of these:

1) Templates

2) Use abbreviations, so when you introduce a function it expands it into text with the description.

alvatar
A: 

0- May be you should first consider a migration from vi to vim.

1- There are many template expander plugins. I'm maintaining muTemplate. C++ template-files for muTemplate are available in lh-cpp.

2- You will have to play with autocommands. Listen for a BufRead, then if the buffer is modifiable search where the changelog-line need to be inserted. However I don't think this is the best way to proceed. SVN/GIT/... are a better solution.

3- I don't understand what you are looking for. How can the editor know what the function is doing? BTW, lh-cpp provides a :DOX command where the parameters-list, the @return tag (if applicable), the @throw tag, etc are inserted and ready to be filled. If you don't want all these doxygen tags, but just a caption header (is it English ?) any template expander plugin will do (see 1-).

Luc Hermitte
+1  A: 

I've used CDT for Eclipse lately, not bad.

http://www.eclipse.org/cdt/

Greg Noe