I systematically place a comment at the bottom of files that establishes
tabular format:
/* vim: set tabstop=2 shiftwidth=2: */
and even in scripts and other files:
# This enforces this script's tab settings...
# /* vim: set tabstop=2 shiftwidth=2: */
That way, the problem is solved for everyone who visits the file as long
as they're using God's own editor.
Good luck,
Russ
P.S. I might be superstitious about keeping the C comment delimiters in
the script file. Since it worked the first time I pasted it in, I have
just never looked into whether it would work without them. Vim probably
doesn't care; it's your file's consumer that needs the appropriate
comment character.
mal content wrote:
Hello.
I'm relatively new to VIM, I wondered if there was a
way to mimic the style used in the current file. I use
two spaces to indent my code (two real spaces, not
tab characters) but I know that many people use
real tabs. I would like to be able to automatically
mimic the style of the file that I am editing.
My current .vimrc:
--
"$Id: vimrc,v 1.6 2006/01/17 06:38:02 anm Exp $
:set textwidth=72
:set nowrap
:syntax on
:set hls
:set tabstop=2
:set noautoindent
:set expandtab
:set softtabstop=2
:set nomodeline
:set ruler
:set showcmd
:set encoding=utf-8
au FileType make setlocal noexpandtab
au Filetype Mkfile- setlocal noexpandtab
au FileType c,cpp,cxx setlocal tw=79
au FileType htm,html,php setlocal tw=9999
au FileType txt setlocal tw=80
:set nocompatible
--
thanks,
MC