[lug] vi/vim HOWTO, part 2

Carl Wagner carl.wagner at level3.com
Tue Apr 4 11:18:53 MDT 2000

Here is my .vimrc, just put it in your home directory.  There are many types
of auto indenting
and I have chosen one of the simplest ones. This .vimrc file has a lot of
features set, you may want to edit to your tastes.

Good things to know:
  (with my .vimrc)  F7 turns off (actually toggles) color syntax highlighting
  in command mode type ":help" or ":help syntax"  (without the quotes)
  also try ":set all" this will show what is turned on and off.  If it has a
no in front of the 
     flag, then it is off.  To turn on something just type ":set x", like
":set autoindent"

Things to look at are autoindent, smartindent, cindent, ??.

One thing to be aware of with my .vimrc if you use the mouse to paste in to
the editor, you 
should turn off autoindent (":set noai" the short form of noautoindent) before
pasting or you will
get a barber poll effect.
There is a "mouse=" option that should fix this but I could never get it to
work the way I wanted.


Kyle Moore wrote:
> Carl, could you point me in the direction of how to do both sytax
> high-lighting and auto-indentation with vim? I might like to take a look
> at this today. I assume you can set it in the .vimrc file?
> Carl Wagner wrote:
> >
> > I know the question was about emacs... but vim has color syntax high-lighting
> > (for all sorts of
> > languages) and auto indention. (and best of all multiple undo-s!!)
> >
> > Carl.
> --
> ----
> Kyle Moore
> UNIX Systems Administrator
> ---------------------------------------
> Trust Company of America / Gemisys
> 7103 South Revere Parkway
> Englewood, CO 80112
> ---------------------------------------
> Email: kmoore at trustamerica.com
> Voice: 303-705-6212
> Pager: 303-656-1131
> Fax: 303-705-6171
> Web Site: http://www.trustamerica.com
> ---------------------------------------
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
-------------- next part --------------
set autoindent
set backspace=2
set backup
" set cindent
" set smartindent
" set cinkeys=
" set cinoptions=>1s
" set cinwords="public:,private:"
set confirm
set expandtab
set ignorecase
set incsearch
" set linebreak
" set list
set modified
" set mouse=a
" set mousefocus
" set mousehide
" set paste
set ruler
set shiftwidth=3
set showcmd
set showmatch
set showmode
set smartcase
set smarttab
set softtabstop
set tabstop=3
set visualbell
set writebackup
set whichwrap=b,s,<,>,[,]

set background=dark
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch

" map f7 to allow turning on and off of syntax on/off
map <F7> :if has("syntax_items") <Bar> syntax off <Bar> else <Bar> syntax on <Bar> endif <CR>

More information about the LUG mailing list