Sunday, December 17, 2006

vi tab retab --- space to tab -- tab to space

:set tabstop=4 " Force tabs to be displayed/expanded to 4 spaces (instead of default 8).
:set softtabstop=4 " Make Vim treat key as 4 spaces, but respect hard Tabs.
: " I don't think this one will do what you want.
:set expandtab " Turn Tab keypresses into spaces. Sounds like this is happening to you.
" You can still insert real Tabs as [Ctrl]-V [Tab].
:set noexpandtab " Leave Tab keys as real tabs (ASCII 9 character).
:1,$retab! " Convert all tabs to space or ASCII-9 (per "expandtab"),
" on lines 1_to_end-of-file.
:set shiftwidth=4 " When auto-indenting, indent by this much.
" (Use spaces/tabs per "expandtab".)
:help tabstop " Find out more about this stuff.
:help vimrc " Find out more about .vimrc/_vimrc :-)

No comments: