On 2009-09-16, Hoss wrote:
> Okay, now that I'm playing with my settings im getting really
> inconsistent results that I cant really explain.
That's OK. We'll handle the explanation of results.
> If I open up a new buffer, with the following two lines in it
>
> <tab>good tabs
> #<tab>bad tabs
>
> the command seems to work exactly correctly, whether my ":set et", or
> my ":set noet" is active
So it works and you understand the behavior in the simple case.
That's a good start.
> However, in the actual buffer where I'm trying to do this (its been up
> for several hours) this isn't the case.
>
> Like I said, it wasnt working here at all. But after I toggled my
> ":set et" and ":set noet" it seems to operate the same way regardless
> of which one is set. But it isnt doing quite what I want. Its only
> replacing the tabs on the lines I want it to; however, the new tabstop
> seems to be applied first. So, if the line opens with "#<tab>text",
> after the command I have "#<100 spaces>text"
At this point it would help very much if you would explain exactly
what you are seeing, not just that "it doesn't work". Show us
exactly the lines that you're having the problem with. Tell us
exactly what commands you executed, exactly what results you got,
and exactly what results you expected.
":help retab" seems to explain when the old tabstop is used and when
the new tabstop is used.
All that being said, I did some experimenting and I think I found a
behavior of the ':g/re/.retab new_tabstop' combination that might
explain your confusion. The behavior could even be considered a
bug.
I started vim like this:
vim -N -u NONE -c 'set listchars+=tab:>- list'
and entered four lines of x's and y's, separated by tabs, so that
the result looked like this:
x>------x>------x>------x>------x$
y>------y>------y>------y>------y$
x>------x>------x>------x>------x$
y>------y>------y>------y>------y$
I then executed
:g/^x/.retab! 16
What I expected to see was this:
x x>------x x>------x$
y>--------------y>--------------y>--------------y>--------------y$
x x>------x x>------x$
y>--------------y>--------------y>--------------y>--------------y$
Instead, the result I got was this:
x x>------x x>------x$
y>--------------y>--------------y>--------------y>--------------y$
x>--------------x>--------------x>--------------x>--------------x$
y>--------------y>--------------y>--------------y>--------------y$
In other words, I was expecting the :retab operation to be applied
to all matching lines, and then the 'tabstop' setting changed to 16.
Instead, the :retab operation was applied to the first matching
line, the 'tabstop' setting changed to 16, then the :retab operation
applied to the rest of the matching lines. 'tabstop' was probably
set to 16 after each :retab operation, but that doesn't affect the
results.
Does that explain the results you're observing? It certainly isn't
what I expected.
Regards,
Gary
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---