Recent Changes - Search:

edit SideBar


Firefox 2
Get Thunderbird!

Vim /

CommentingOutARangeOfLines

Vim.CommentingOutARangeOfLines History

Hide minor edits - Show changes to markup

September 03, 2005, at 04:35 PM by �zg�n
Changed line 10 from:
code lang=vim
)[=
to:

(:code lang=vim:)[=

Changed lines 18-20 from:

map gC :'a,. s/^/ */^M:.
s/\(.*\)/\1^V^V^M **************\//^M:'a
s/\(.*\)/\/**************^V^V^M\1/^M

to:

map gC :'a,. s/^/ */^M:. s/\(.*\)/\1^V^V^M **************\//^M:'a s/\(.*\)/\/**************^V^V^M\1/^M

September 03, 2005, at 04:35 PM by �zg�n
Changed lines 12-13 from:
to:

=]

Changed lines 16-17 from:

For example:

to:

For example: (:code lang=vim:)[=

Changed lines 21-22 from:
to:

=]

Changed lines 24-25 from:
to:

(:code lang=vim:) /************************ * * .... * .... ************************/

September 03, 2005, at 04:34 PM by �zg�n
Changed lines 3-4 from:

Whatever method you use to find the line numbers they can be used as a range for a substitute:
code lang=vim[==

to:

Whatever method you use to find the line numbers they can be used as a range for a substitute: (:code lang=vim:)[=

Changed lines 7-8 from:




to:
Changed lines 9-11 from:

Move to the last line and issue the following ex:
:'a,. s/^/# /

to:

Move to the last line and issue the following ex:

code lang=vim
)[=

:'a,. s/^/# /

September 03, 2005, at 04:33 PM by �zg�n
Changed lines 4-6 from:

:xx,yy s/^/# /

to:

(:code lang=vim:)= :xx,yy s/^/# /

Changed lines 11-23 from:

:'a,. s/^/# /

to:

:'a,. s/^/# /

More elaborate sequences of pure old ex commands can also be used to create boxes around C/C++ blocks; but they are really horrid to type every time so they have to be mapped to some key sequence and entails consistently using the same register every time.

For example: map gC :'a,. s/^/ */^M:.
s/\(.*\)/\1^V^V^M **************\//^M:'a
s/\(.*\)/\/**************^V^V^M\1/^M

maps the sequence gC to a macro which wraps a block of text, from the current line back to the line marked by the "a" in a C style comment like:

September 03, 2005, at 04:15 PM by �zg�n
Changed line 3 from:

Whatever method you use to find the line numbers they can be used as a range for a substitute \\

to:

Whatever method you use to find the line numbers they can be used as a range for a substitute: \\

Changed line 8 from:

Move to the last line and issue the following ex \\

to:

Move to the last line and issue the following ex: \\

September 03, 2005, at 04:15 PM by �zg�n
Changed line 4 from:

command: :xx,yy s/^/# /

to:

:xx,yy s/^/# /

Changed line 9 from:

command: :'a,. s/^/# /

to:

:'a,. s/^/# /

September 03, 2005, at 04:14 PM by �zg�n
Changed line 4 from:

command: :xx,yy s/^/# /

to:

command: :xx,yy s/^/# /

Changed line 9 from:

"command:" :'a,. s/^/# /

to:

command: :'a,. s/^/# /

September 03, 2005, at 04:14 PM by �zg�n
Changed line 9 from:

"command:" :'a,. s/^/# /

to:

"command:" :'a,. s/^/# /

September 03, 2005, at 04:14 PM by �zg�n
Changed line 4 from:

command: :xx,yy s/^/# /

to:

command: :xx,yy s/^/# /

September 03, 2005, at 04:13 PM by �zg�n
Changed line 4 from:

"command:" :xx,yy s/^/# /

to:

command: :xx,yy s/^/# /

September 03, 2005, at 04:08 PM by �zg�n
Changed lines 4-6 from:

command: "":xx,yy s/^/# /""




to:

"command:" :xx,yy s/^/# /


Changed line 9 from:

command: "":'a,. s/^/# /""

to:

"command:" :'a,. s/^/# /

September 03, 2005, at 04:08 PM by �zg�n
Changed lines 5-6 from:


to:






September 03, 2005, at 04:07 PM by �zg�n
Changed lines 4-6 from:

command: :xx,yy s/^/# / \\

to:

command: "":xx,yy s/^/# /""

Changed line 9 from:

command: :'a,. s/^/# /

to:

command: "":'a,. s/^/# /""

September 03, 2005, at 04:06 PM by �zg�n
Added lines 1-9:

Tip #981: Commenting out a range of lines

Whatever method you use to find the line numbers they can be used as a range for a substitute
command: :xx,yy s/^/# / \\
Move to the first line and set a mark with: ma (where "a" is any letter you choose) Move to the last line and issue the following ex
command: :'a,. s/^/# /

Edit - History - Print - Recent Changes - Search
Page last modified on September 03, 2005, at 04:35 PM