[Toybox] [PATCH] vi: rename `-s` flag to `-c`

Jarno Mäkipää jmakip87 at gmail.com
Tue Jun 4 22:46:32 PDT 2024


hello

On Wed, Jun 5, 2024 at 2:02 AM Eric Roshan-Eisner
<eric.d.eisner at gmail.com> wrote:
>
> POSIX, busybox vi, vim, and nvim all use -c.

-c is not same as -s {script}. While -c is implemented in few vi
clones its not same as -s since -c reads EX commands. -s {script}
implemeted here is vim spesific and not implemented on regular vi.

taken from vim man page:
       -s {scriptin}
                   The script file {scriptin} is read.  The characters in
                   the  file  are  interpreted  as if you had typed them.
                   The same  can  be  done  with  the  command  ":source!
                   {scriptin}".  If the end of the file is reached before
                   the editor exits, further characters are read from the
                   keyboard.

       -c {command}
                   {command} will be executed after the  first  file  has
                   been read.  {command} is interpreted as an Ex command.
                   If the {command} contains spaces it must  be  enclosed
                   in  double  quotes  (this depends on the shell that is
                   used).  Example: vim "+set si" main.c
                   Note: You can use up to 10 "+" or "-c" commands.

You cannot test against other vi clones with -c after this patch. But
you could have test against vim with -s {script} implementation. I
used vim as reference for testing with original test case files.

Ex command only switch -c could be added as  addition to -s if you
wanna achieve something with ex commands, but maybe dont delete -s
implementation, unless you have better way to test vi mode motions.

> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net

br.
Jarno


More information about the Toybox mailing list