Hi Tim,
thanks a lot, I tried the ":set ts=2 sw=2 et" and it worked perfectly
but only on the new tabs inserted by MacVim.
I tried to select all the text and to apply the command:
:'<, '>retab!4
or also without the number value (since accordingly to the manual it
should set it the ts value) but it didn't change.
I don't know if I invoked in the right way the command, did I?
Anyway, thanks a lot, I am going to set them in my .vimrc file for
next files. :)
Is it right in the following way?
set ts=2 sw=2 et
One last question. Can I set different values for different file
types? E.g. 4 spaces for html, 8 for php and 2 for Ruby?
Thanks a lot. :)
On 3 Ott, 17:35, Tim Chase <[email protected]> wrote:
> > I just started to use Vim (actually, MacVim) and I really love it. :)
>
> Welcome aboard!
>
> > I would like to ask you how to re-indent old files I edited in
> > TextMate. They use spaces instead of tabs, set to two spaces.
> > Now I have some rows rightly indented to the Vim default and some
> > stick to two spaces like in TextMate.
> > Which is the command to reformat them?
>
> The settings are controlled by various correlated settings:
>
> :set ts=2 sw=2 et
>
> which you can learn about at
>
> :help 'tabstop'
> :help 'shiftwidth'
> :help 'expandtab'
> :help :retab
>
> Setting the 'tabstop' to 2 changes your tab-stops to
> 2-visual-spaces-per-tab. I like to keep my 'shiftwidth' in sync
> with my 'tabstop' setting just so things like the ">"/"<"
> operators and ^D/^T work as expected in insert-mode.
>
> If Vim is inserting real tabs instead of expanding spaces, the
> 'expandtab' setting will change future insertions. To change
> past insertions of real-tabs, once you have the above ":set"
> command, you can then use ":retab" to force vim to change
> existing tabs to the spaces you defined.
>
> > And, which are the settings to add to my .vimrc file?
>
> You should be able to just add the above "set" (minus the colon)
> to your vimrc to get this behavior by default. Alternatively, if
> you allow modelines, you can include a modeline in your files
> that specifies these settings:
>
> :help modeline
> :help 'modeline'
>
> which would allow you to put something like
>
> /* vim: set tw=2 sw=2 et */
>
> at the top or bottom of your file, and vim will set them on a
> per-file basis.
>
> Hope this helps,
>
> -tim
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---