History Report a problem
Article Edit this page Discussion

Inserting a prefix in a parameter list

From Vim Tips Wiki

Jump to: navigation, search

Tip 387 Previous TipNext Tip

Created: December 13, 2002 Complexity: Intermediate Author: feral Minimum version: 6.0 Karma: 92/25 Imported from: Tip#387


This is a way to quickly prefix a character (or characters) to a parameter list, via :substitute

In the thought that others may like the same preferred style as I, here is an easy way to prefix each param with an underscore.

The command:

:s/\<\(\I\i*\s\{-}[,)]\)/_\1/g

A sample menu entry:

amenu Fe&ral's.Prefix\ underscores\ to\ params <Esc><Esc>:s/\<\(\I\i*\s\{-}[,)]\)/_\1/g <bar> :noh<CR>

[edit] An Example

Before:

BOOL CSomeView::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)

After:

BOOL CSomeView::Create(DWORD _dwStyle, const RECT& _rect, CWnd* _pParentWnd, UINT _nID)

[edit] References

[edit] Comments


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Pushing Daisies
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Godzilla
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Inserting a prefix in a parameter list"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation


.