From owner-freebsd-questions@FreeBSD.ORG Fri Feb 20 14:52:49 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00599106564A for ; Fri, 20 Feb 2009 14:52:48 +0000 (UTC) (envelope-from doug@polands.org) Received: from hrndva-omtalb.mail.rr.com (hrndva-omtalb.mail.rr.com [71.74.56.125]) by mx1.freebsd.org (Postfix) with ESMTP id 97DE48FC14 for ; Fri, 20 Feb 2009 14:52:48 +0000 (UTC) (envelope-from doug@polands.org) Received: from haran.polands.org ([75.87.219.217]) by hrndva-omta04.mail.rr.com with ESMTP id <20090220145247.NKIQ10127.hrndva-omta04.mail.rr.com@haran.polands.org>; Fri, 20 Feb 2009 14:52:47 +0000 Received: from [172.16.1.33] (jericho.polands.org [172.16.1.33]) by haran.polands.org (8.14.3/8.14.3) with ESMTP id n1KEqkgb013657; Fri, 20 Feb 2009 08:52:47 -0600 (CST) (envelope-from doug@polands.org) Message-ID: <499EC3BE.7020105@polands.org> Date: Fri, 20 Feb 2009 08:52:46 -0600 From: Doug Poland User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Johan Hendriks References: <57200BF94E69E54880C9BB1AF714BBCB5DE58A@w2003s01.double-l.local> In-Reply-To: <57200BF94E69E54880C9BB1AF714BBCB5DE58A@w2003s01.double-l.local> Content-Type: text/plain; charset=windows-1250; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: vi set comment # X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2009 14:52:49 -0000 Johan Hendriks wrote: > How can i in vi set a # on multiple Lines to comment out some text. > > I know it must be a simple thing but i can not seem to get it right. > > Like in a config file i have the following > > define service{ > use generic-service > host_name w2003hk03 > service_description Explorer > check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe > } > > And now i want to set a # to all the 6 lines. > > Thanks for your time > Regards, > Johan > This question is really more germane to a VIm mail list (http://www.vim.org/) , but I'll tell you how'd I'd do it. First, turn on line numbers -- :set nu The you'd see something like -- 1 2 3 define service{ 4 use generic-service 5 host_name w2003hk03 6 service_description Explorer 7 check_command check_nt!PROCSTATE!-d SHOWALL -l 8 } 9 10 Then replace the beginning of a line with a # symbol -- :3,8s/^/#/ That's all there is too it. BTW, VIm help is your friend :help replace -- Regards, Doug