From owner-freebsd-questions@FreeBSD.ORG Tue Jul 17 03:03:43 2012 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 43D16106566C for ; Tue, 17 Jul 2012 03:03:43 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) Received: from relay2.tomsk.ru (relay2.tomsk.ru [212.73.124.8]) by mx1.freebsd.org (Postfix) with ESMTP id 7E4FF8FC16 for ; Tue, 17 Jul 2012 03:03:42 +0000 (UTC) X-Virus-Scanned: by clamd daemon 0.93.1 for FreeBSD at relay2.tomsk.ru Received: from admin.sibptus.tomsk.ru (account sudakov@sibptus.tomsk.ru [212.73.125.240] verified) by relay2.tomsk.ru (CommuniGate Pro SMTP 5.1.16) with ESMTPSA id 27668701 for freebsd-questions@freebsd.org; Tue, 17 Jul 2012 10:03:40 +0700 Received: from admin.sibptus.tomsk.ru (sudakov@localhost [127.0.0.1]) by admin.sibptus.tomsk.ru (8.14.5/8.14.5) with ESMTP id q6H33eaE074218 for ; Tue, 17 Jul 2012 10:03:40 +0700 (NOVT) (envelope-from vas@mpeks.tomsk.su) Received: (from sudakov@localhost) by admin.sibptus.tomsk.ru (8.14.5/8.14.5/Submit) id q6H33djl074217 for freebsd-questions@freebsd.org; Tue, 17 Jul 2012 10:03:39 +0700 (NOVT) (envelope-from vas@mpeks.tomsk.su) X-Authentication-Warning: admin.sibptus.tomsk.ru: sudakov set sender to vas@mpeks.tomsk.su using -f Date: Tue, 17 Jul 2012 10:03:39 +0700 From: Victor Sudakov To: freebsd-questions@freebsd.org Message-ID: <20120717030339.GA74052@admin.sibptus.tomsk.ru> References: <20120716100210.GA32860@admin.sibptus.tomsk.ru> <20120716163700.GA60274@admin.sibptus.tomsk.ru> <91F2F4DCF7B24892B865B0A42FEFEBFB@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91F2F4DCF7B24892B865B0A42FEFEBFB@gmail.com> Organization: AO "Svyaztransneft", SibPTUS X-PGP-Key: http://www.livejournal.com/pubkey.bml?user=victor_sudakov X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: enable modeline in vim 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: Tue, 17 Jul 2012 03:03:43 -0000 Patrick wrote: > > > > > > > > Do you know how to enable modelines in vim running from root? Even if > > > > I put "set modeline" in /root/.vimrc, the output of ":set modeline?" > > > > still shows "nomodeline". At the same time, "set modeline" in ~/.vimrc > > > > works for all other accounts except root. > > > > > > > > Someone has protected the root account so tightly that I cannot even > > > > shoot myself in the leg. Do you know how I could override this > > > > protection? > > > > > > > > > > In my vimrc i have next: > > > set modeline > > > set modelines=3 > > > > > > > > > As I said, in /root/.vimrc I have: > > > > set modeline > > set modelines=5 > > > > > And it works, no matter from root or normal user. Hope this helps. > > > > And it does not work for root. vim-7.3.556_1 > > > > Surely I am doing something stupid but I cannot figure out what. > Assuming you've installed vim from the ports tree, > /usr/local/share/vim/vimrc is the shared vimrc file amongst all > users. Have you tried setting it in there? I have finally found the cause of the trouble. There was a "set nocompatible" command in ~/.vimrc after the "set modeline" command. According to the documentation, the "compatible" option modifies many other options, including the "modeline" options. The solution is to put the "set nocompatible" command at the very start of the ~/.vimrc file (as the documentation recommends) or to remove it altogether. -- Victor Sudakov, VAS4-RIPE, VAS47-RIPN sip:sudakov@sibptus.tomsk.ru