From owner-freebsd-questions@FreeBSD.ORG Sat May 3 18:31:18 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2733337B401 for ; Sat, 3 May 2003 18:31:18 -0700 (PDT) Received: from mail.munk.nu (213-152-51-194.dsl.eclipse.net.uk [213.152.51.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E41A43FAF for ; Sat, 3 May 2003 18:31:17 -0700 (PDT) (envelope-from munk@mail.munk.nu) Received: from munk by mail.munk.nu with local (Exim 4.14) id 19C8Mo-000Iyd-D7; Sun, 04 May 2003 02:32:38 +0100 Date: Sun, 4 May 2003 02:32:38 +0100 From: Jez Hancock To: FreeBSD questions List Message-ID: <20030504013238.GA72718@users.munk.nu> Mail-Followup-To: FreeBSD questions List , William O'Higgins References: <20030503210831.A982@sillyrabbi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030503210831.A982@sillyrabbi> User-Agent: Mutt/1.4.1i Sender: User Munk cc: William O'Higgins Subject: Re: vim isn't working as expected X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 May 2003 01:31:18 -0000 On Sat, May 03, 2003 at 09:08:31PM -0400, William O'Higgins wrote: > I am a new user of FreeBSD migrating from Red Hat Linux. There are a > few differences that I am having trouble with. > > vi - my editor of choice, and it doesn't work in the ways I expect it > to. I am used to vi being aliased to vim (which I have done in FreeBSD) > and having syntax highlighting, arrow keys, and a tell-tale line at the > bottom of the xterm to remind me which mode I'm in, which line and > position, and how much file I'm looking at. All these things are gone in > FreeBSD. Could someone tell me what I'm missing? Thanks. You'll probably want to setup a .vimrc file in your home dir (or in /usr/local/share/vim/vimrc for globally set vim options). For what it's worth here's my .vimrc file: ======================================================================== syn on set autoindent set tabstop=4 set history=1000 set ignorecase set shiftwidth=4 set sc set wmnu " nice status line set ls=2 set ruler set comments=b:#,:%,fb:-,n:>,n:),sr:/*,mb:*,ex:*/,b:// set hidden " Set 'g' substitute flag on. set gdefault " keeps cursor in middle of screen set scrolloff=9999 " set vim to use 'short messages'. "set shortmess=a " showmatch: Show the matching bracket for the last ')'? set showmatch set background=dark " Last Modified map ,e :e =expand("%:p:h") . "/" set textwidth=72 filetype plugin on fun! Replace() let s:word = input("Replace " . expand('') . " with:") :exe 'bufdo! %s/' . expand('') . '/' . s:word . '/ge' :unlet! s:word endfun map \r :call Replace() ======================================================================== although I'm still a newbie to vim (who isn't :). If you want certain options for certain types of file, I believe (take with handful of salt!) you can 'override' options in a extension.vim file inside ~/.vim/ftplugins (which take effect only if you have the 'filetype plugin on' option set). So for example my ~/.vim/ftplugins/sh.vim file looks like: ======================================================================== set textwidth=0 ======================================================================== (to stop shell scripts from breaking at 72 cols whilst I'm working on them). There's stacks of tips at www.vim.org as well - a good idea is to download the whole tips database fle and when you need to find out how to do something just grep in the file for the keyword. Hope that helps, Jez