Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
commenting out large masks in package.mask with vim
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
TheHaas
n00b
n00b


Joined: 13 Jun 2002
Posts: 61

PostPosted: Wed Jul 03, 2002 6:02 pm    Post subject: commenting out large masks in package.mask with vim Reply with quote

To comment out large blocks of masks in the package.mask file:

1.) make sure you have Vim 6.1 emerged in.
2.) As root:
Code:
 
mkdir ~/.vim
mkdir ~/.vim/plugin

3.) Download EnchanceCommentify.vim from this link:
http://vim.sourceforge.net/scripts/download.php?src_id=879
and save it to ~root/.vim/plugin

Now, every time you want to edit package.mask:
1.) Add the following to the top of the file:
Code:

#!/bin/sh

than type:
Code:

:syn on

This will fool vim into thinking that package.mask is a shell script.
(if you don't like the syntax coloring, you can do ":syn off" to turn it off).
2.) on a line, hit "\c", which will toggle the line into a comment or uncomment.

To do a group of lines, hit "v", move the cursor to highlight the lines, than do a "\c", which will toggle all the lines (ie, if it was a comment, now it's not. If it was active, now it's a comment). Obviously, care should be used when doing groups of lines.

This probably sounds more complicated than it is. Just try it and find out!
Back to top
View user's profile Send private message
Scandium
Retired Dev
Retired Dev


Joined: 22 Apr 2002
Posts: 340
Location: Germany

PostPosted: Thu Jul 04, 2002 9:40 am    Post subject: Reply with quote

Although I am not using vim (although I have emerged it ^_^) this sounds cool :)
Back to top
View user's profile Send private message
hilker
n00b
n00b


Joined: 26 Jun 2002
Posts: 3

PostPosted: Fri Jul 05, 2002 5:42 pm    Post subject: Another way in vim: Reply with quote

Move the cursor to the first line you want you comment out, using hjkl keys, the mouse, searching with / or ?, whatever.

Mark that line:
Code:
ma

Move the cursor to the last line you want to comment out. Mark that line:
Code:
mb

Use the :substitute command on that range:
Code:
:'a,'bs/^/#/

If you prefer, you can use any letters you wish, case-sensitive, in place of a and b when marking lines.

I'm not a vim wizard by any stretch; I won't be surprised if someone with more skills than me suggests a simpler method.
Back to top
View user's profile Send private message
TheHaas
n00b
n00b


Joined: 13 Jun 2002
Posts: 61

PostPosted: Sat Jul 06, 2002 4:16 am    Post subject: Reply with quote

that's even better.

thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum