Friday, November 23, 2012

Re: expanding tabs while using splits

On 11:45 Fri 23 Nov , Damian Rodriguez Sanchez wrote:
> Hello list,
>
> I have always used the following lines in my .vimrc:
>
> :set tabstop=3
> :set softtabstop=3
> :set shiftwidth=3
> :set expandtab
>
> au FileType make set noexpandtab
>
> so that tabs are replaced by 3 spaces, except for makefiles.
>
> Things work fine most of the time, but if I open files of
> different types in different splits, things will stop going as
> expected after I open the first makefile. Files opened after
> the first makefile will also be treated as makefiles (tabs
> will be inserted) even if they are, say, C source files.
>
> Is there anything I can do so that vim continues
> to expand tabs within one same terminal window (using several
> splits) after it opens a makefile?
>
>
> Thank you,
>
> Damian.

Hi Damian,

First of all there are good reasons no to change the 'tabstop' from the
default 8. Setting 'shiftwidth' to 3 should be enough. For the problem
with 'expandtab' you can either add:

au FileType make set expandtab

to you vimrc file or add

set expandtab

to ~/.vim/after/ftplugin/make.vim file (:help after-directory).

Best,
Marcin

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: