[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to change indent in vim



Boyd Stephen Smith Jr. wrote:
In <[🔎] 20090610160715.GA22215@tomgeorge.info>, Thomas H. George wrote:
I want indent set to 3, the default setting 8 uses up too much space.

There is a plethora of information in /usr/share/vim/vim71 but it all
seems to relate to turning indent on for various situations.  Somewhere
there must be a simple line indent=8 that I can change but I haven't
found it.

Your ~/.vimrc, ~/.virc, or ~/.exrc (the first one that exists) can be used to run any command each time vim is started.

Ben gives possibly correct commands. Use ":help 'tabstop'" and ":help 'shiftwidth'" from within vim to determine is those are the settings you want.

The settings Ben gives are the ones I use.

One caveat is that the tab character is still used for the indentation, which means when you or someone else looks at the text using a different tabstop setting, things may indent in odd ways.

I add "set expandtab" in my Vim rc file, which forces tabs to expand to spaces. This keeps the relative indentation the same no matter what an application's tab stop setting is.

The down side of this is if a file is edited by someone else, with the same settings but no expandtab, you get all spaces on some lines and mixed spaces/tabs on others, which can get really messy in appearance.

--
Bob McGowan

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Reply to: