vim isn't working as expected

Jez Hancock jez.hancock at
Sat May 3 18:31:18 PDT 2003

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 <C-R>=expand("%:p:h") . "/" <CR>

set textwidth=72

filetype plugin on

fun! Replace()
    let s:word = input("Replace " . expand('<cword>') . " with:")
    :exe 'bufdo! %s/' . expand('<cword>') . '/' . s:word . '/ge'
    :unlet! s:word
map \r :call Replace()<CR>

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

There's stacks of tips at 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,

More information about the freebsd-questions mailing list