On Tue, 24 Jan 2012, Guido Van Hoecke wrote:

Hi,

I just experienced some unexpected behaviour with a simple substitution command and wonder if somebody could explain this to me.

Example text lines to be selected for my question:
o.......Open files, directories and bookmarks....................
go......Open selected file, but leave cursor in the NERDTree.....
t.......Open selected node/bookmark in a new tab.................
T.......Same as 't' but keep the focus on the current tab........
i.......Open selected file in a split window.....................
gi......Same as i, but leave the cursor on the NERDTree..........
s.......Open selected file in a new vsplit.......................

I know that
:'<,'>s/\.\+$//
would remove all trailing dots.

But why does
:'<,'>s/\./ /g
only change the first set of '.' of every line and not the trailing '.'?

I can't find any reason why this does not do the job
(: albeit a silly job, but that's irrelevant :)

Are you sure it's not doing the job? If you use the lines you sent, how many substitutions does it report? I get:

151 substitutions on 7 lines

If you navigate to one of the seemingly-unreplaced periods and type ga, what do you get?

For a split-second I thought I was seeing what you reported, but it's just my settings, since I have the 'trail' suboption of 'listchars' set. What does this return:

:verb se lcs?

If that returns something for 'trail:X' (where the X looks like a period), that's the culprit. You could probably set it to show up as a different color, if that helps:

:hi SpecialKey guifg=Red



I am using MacVim 7.3 (patches: 1-390, snapshot 64) dd 02/01/20112 by Bjorn Winckler (thanks Bjorn).

I'll try to check on that version when I'm in to work.

--
Best,
Ben

--
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

Reply via email to