vimgolf E20

31 views
Skip to first unread message

Neil Earnshaw

unread,
May 6, 2020, 2:13:03 PM5/6/20
to vim_use
This command works fine in vim on my chromebook:

:*s/)/);/

It appends a ';' to each line that ends with a ')'.

But when I try it in vimgolf I get E20 Mark not set.

Can anyone clue me in to what's going on, please?

-Neil (noob)

Niels Kobschätzki

unread,
May 6, 2020, 2:38:21 PM5/6/20
to vim...@googlegroups.com

On 6. May 2020, at 20:13, Neil Earnshaw <neil.e...@gmail.com> wrote:


This command works fine in vim on my chromebook:

:*s/)/);/


What is *s?

Cheers,

Niels

Neil Earnshaw

unread,
May 6, 2020, 2:54:44 PM5/6/20
to vim...@googlegroups.com
's' is substitute and the '*' applies it to all matching lines in the file

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/A5939E6B-D427-41C1-BEF2-7844676071CB%40kobschaetzki.net.

Chris Willis

unread,
May 6, 2020, 3:05:52 PM5/6/20
to vim...@googlegroups.com
 
 
Sent: Wednesday, May 06, 2020 7:44 PM
Subject: Re: vimgolf E20
 
's' is substitute and the '*' applies it to all matching lines in the file
 
On Wed, May 6, 2020 at 7:38 PM Niels Kobschätzki <ni...@kobschaetzki.net> wrote:
 
On 6. May 2020, at 20:13, Neil Earnshaw <neil.e...@gmail.com> wrote:


This command works fine in vim on my chromebook:
 
:*s/)/);/
 
 
What is *s?
 
Cheers,
 
Niels
--
--
really? I’ve always used :%s
 
Chris

Niels Kobschätzki

unread,
May 6, 2020, 3:15:47 PM5/6/20
to vim...@googlegroups.com

On 6. May 2020, at 21:05, 'Chris Willis' via vim_use <vim...@googlegroups.com> wrote:


 
 
Sent: Wednesday, May 06, 2020 7:44 PM
Subject: Re: vimgolf E20
 
's' is substitute and the '*' applies it to all matching lines in the file

So the same as :%s/foo/bar/g but saving one char?

 
On Wed, May 6, 2020 at 7:38 PM Niels Kobschätzki <ni...@kobschaetzki.net> wrote:
 
On 6. May 2020, at 20:13, Neil Earnshaw <neil.e...@gmail.com> wrote:


This command works fine in vim on my chromebook:
 
:*s/)/);/
 
 
What is *s?
 
Cheers,
 
Niels
--
--
really? I’ve always used :%s

Niels

Tim Chase

unread,
May 6, 2020, 3:27:12 PM5/6/20
to Neil Earnshaw, vim...@googlegroups.com
On 2020-05-06 11:12, Neil Earnshaw wrote:
> :*s/)/);/
>
> It appends a ';' to each line that ends with a ')'.
>
> But when I try it in vimgolf I get E20 Mark not set.

Assuming you haven't changed your 'cpo' to include "*"

:help cpo-star

the "*" is the same as the range

'<,'>

so

:*s/)/);

appends a semicolon after parens in the previously selected range.

The error suggests that you haven't yet visually-selected anything to
set those marks.

Hope this helps,

-tim

Neil Earnshaw

unread,
May 7, 2020, 1:51:09 AM5/7/20
to vim_use
Ah ha,

So * on my machine is doing the same % in the standard install.  I got my config from somewhere in internet space, hence the difference.

:%s/)/);

...does the job and doesn't complain about marks.

The idea with vimgolf is to achieve the required edit in a few keystrokes as possible. I've got this down to 11 (including ESC, CR and ZZ to save), but the best in the rankings is 10 keystrokes, and I just can't figure out how to get rid of that last keypress.  : P

Thanks for the help with '%',
-N

Christian Brabandt

unread,
May 7, 2020, 2:03:28 AM5/7/20
to vim_use
Check your compatibility options, :h cpo-*


Best,
Christian
--
Man darf das Schiff nicht an einen einzigen Anker und das Leben nicht
an eine einzige Hoffnung binden.
-- Epiktet (griechischer Stoiker, 50-138 n.Chr.)

Neil Earnshaw

unread,
May 7, 2020, 1:58:42 PM5/7/20
to vim_use
My basic.vim config file has the following:

    "Make search act like search in modern browsers
    set incsearch

Might this be why '*' is applying the s// expression to all lines?

Or is it this:

    "For regular expressions turn magic on
    set magic

???

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.

Christian Brabandt

unread,
May 7, 2020, 2:06:28 PM5/7/20
to vim_use

On Do, 07 Mai 2020, Neil Earnshaw wrote:

> My basic.vim config file has the following:
>
>     "Make search act like search in modern browsers
>     set incsearch

See the help what this does: :h 'incsearch'

> Might this be why '*' is applying the s// expression to all lines?

Are you sure, that your :*s is the same as :%s?

>     "For regular expressions turn magic on
>     set magic

That is the default and should not be set to a different value. See
:h 'magic'

Best,
Christian
--
Chuck Norris hat bis Unendlich gezählt – zwei Mal.
Reply all
Reply to author
Forward
0 new messages