Click to See Complete Forum and Search --> : A more useful thread: how do you configure VIM?


carrja99
07-12-2004, 09:25 AM
Vim shows it's stregnth through the various configuration options and scripts you can use to configure it. I've seen some people who have 100 line long .vimrc's!

Anyway, just finished installing vim on my freebsd box and did the obligatory


rm -f /usr/bin/vi
ln -s /usr/local/bin/vim /usr/bin/vi


and set about configuring it a little. Anyway, here's my current config:


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Rules
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
filetype on " Detect the type of the file
set nocompatible " get out of horrible vi-compatible mode
set history=1000 " How many lines of history to remember

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Themes/Colors
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax on
set background=dark

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Visual Cues
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set showmatch " show matching brackets
set mat=5 " how many tenths of a second to blink matching brackets for
set nohlsearch " do not highlight searched for phrases (it's annoying)
set incsearch " BUT do highlight as you type you search phrase

""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim UI
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ai " Set auto-indent
set si " Use smart indent
set cindent " do c-style indenting
set backspace=indent,eol,start " Backspace work right dammit
set noexpandtab " real tabs please!
set tabstop=3 " Make tabs only 3 spaces, not 8!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Perl
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let perl_extended_vars=1 " highlight advanced perl vars inside strings

""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Other useful crap
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
iab xname James R. Carr

iab xq $result = mysql_query($query) or die(mysql_error());
iab xr $row = mysql_fetch_assoc($result)


So... where's yours?

sharth
07-18-2004, 02:05 PM
don't have mine anymore, but it consisted of...
syntax on

fatTrav
07-18-2004, 02:39 PM
here's what i use

"set autoindent
"set number
set nocompatible
set showmatch
set incsearch
set ignorecase
set showmode
set tabstop=8
set noexpandtab
set shiftwidth=8
set backspace=2
set nowrap
syntax on
set ruler
set magic
set dictionary=/usr/share/dict/words
" Slackware fscked up the backspace in xterm, this fixes it.
if &term == "xterm"
set t_kb=^?
fixdel
endif

vi is just annoying when compared to vim...

bryan.6
07-18-2004, 05:20 PM
on my shell account for work (into the webserver) i have one very useful command (to me at least) set up. i don't have the code for it right now, but i call it :FoldAll, and it finds any instance of 'sub functionname {' (for Perl, obviously), then finds the matching '}' (actually this should be fixed, currently it just finds the next '^}$', i'm sure there's a way to match that {... you would think so, right, because the '%' key does it. anyway, once it finds those two, it folds that range. it's really nice, because i can find a given segment of code quite quickly knowing what function it is in. sometime soon i'm also going to make some sort of indent function, because I always end up doing stuff like:
:.,.+4s:.\+:\t&: when hopefully i can do something like :.,.+4Ind or something.