Vim Tips Wiki
(Remove html character entities)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 3: Line 3:
 
|previous=386
 
|previous=386
 
|next=388
 
|next=388
|created=December 13, 2002
+
|created=2002
 
|complexity=Intermediate
 
|complexity=Intermediate
 
|author=feral
 
|author=feral
Line 11: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
This is a way to quickly prefix a character (or characters) to a parameter list, via <tt>:substitute</tt>
+
This is a way to quickly prefix a character (or characters) to a parameter list, via <code>:substitute</code>
   
 
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.
 
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.

Latest revision as of 05:28, 13 July 2012

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:

: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>

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)

References[]

Comments[]