Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
created 2005 · complexity basic · author Frans · version 6.0
Developers and users will often have a need to change one pattern of text to match a different pattern. This can be completed using a key map and a regular expression. For example some development requires developers to be MISRA compliant. One of the MISRA rules is
//-style-comments are not acceptable. These occurrences must be replaced by
/*-style-comments-*/. Adding the following mapping to the vimrc file will do this per line.
:map <F5> /\/\/<CR>xxi/*<Esc>A*/<Esc>
This will do the action per found line. Start at the beginning of the file, and repeatedly press <F5>. Alternatively, this regular expression can be used:
:map <F5> %s,//\(.*\),/*\1 */,