Vim Tips Wiki

Inserting a prefix in a parameter list

Revision as of 05:28, July 13, 2012 by JohnBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
1,619pages on
this wiki
Tip 387 Printable Monobook Previous Next

created 2002 · complexity Intermediate · author feral · version 6.0

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:


A sample menu entry:

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

An ExampleEdit


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


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



Around Wikia's network

Random Wiki