Last matching text was not replaced by %s

Ernst de Hart ernstdehart at gmail.com
Sun May 24 12:57:48 CEST 2015


Xiaogang,

As Linus already noted, you propably forgot the `/g` flag. The g flag means
global – each occurrence in the line is changed, rather than just the
first.
I guess you got this, because you're accustomed to have the default setting
for the 'gdefault' option on in your Vimrc configuration. Without the
`gdefault`  option, it requires that the g flag should be included in
%s///g to perform a global substitute. I recommend to set your gdefault to
be turned off, it creates confusion because then %s/// is global, whereas
%s///g is not (that is, g reverses its meaning). Thus as expected, Evil is
showing the correct behaviour of a Vim implementation.



2015-05-24 4:35 GMT+02:00 LiuXiaogang <xiaogang_liu at hotmail.com>:

> Hi,
>
> I isntalled evil-mode version 20150511.146 from melpa yesterday. I tried
> the following command line
>
> *:%s/get-line/getLine/*
>
> As you can see from the attached picture, the last match was not
> highlighted (and not replaced when I hit Enter). I have haskell-mode
> installed and was editing a simple haskell file. Below is the source code.
> The green text was the one missed by the command.
>
> *getLines :: (Num a) => [String] -> a -> [String]*
> *getLines [] n = []*
> *getLines xs@(x:_) n*
> *  | length xs < n = [] -- Ignore remainder*
> *  | otherwise     = (get-line (take n xs)) : (getLines (drop n xs))*
>
> *get-line :: [String] -> String*
> *get-line [] = "\n"*
> *get-line (x:xs) = (show x) + "," + (get-line xs)*
>
>
> Best regards,
> Xiaogang
>
>
>
> _______________________________________________
> implementations-list mailing list
> implementations-list at lists.ourproject.org
> https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
>
>


-- 
Sent from my Vmail client. <http://danielchoi.com/software/vmail.html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ourproject.org/pipermail/implementations-list/attachments/20150524/b4edbac4/attachment.htm 


More information about the implementations-list mailing list