aligrudi / neatvi

A small vi/ex editor for editing UTF-8 text
http://litcave.rudi.ir/
305 stars 25 forks source link

Document command line arguments #75

Open lobre opened 9 months ago

lobre commented 9 months ago

I see that you parse 3 command line arguments in the main logic of vi: -s, -e and -v.

https://github.com/aligrudi/neatvi/blob/master/vi.c#L1653

I am struggling to understand what they do exactly, and I can't find this info in the README either.

Do you mind explaining their meaning? And if so, does it make sense to document that in the README?

lobre commented 9 months ago

I saw you just added them with -h. Thank you!

Maybe I can suggest also to mention that a file can be provided.

vi [options] [file]

And as neatvi supports multiple buffers, maybe having it take multiple files as input could also be nice.

vi [options] [file ...]

I did not know that neatvi has ex mode. That is great.

aligrudi commented 9 months ago

Loric Brevet @.***> wrote:

I saw you just added them with -h. Thank you!

Maybe I can suggest also to mention that a file can be provided.

vi [options] [file]

Done.

And as neatvi supports multiple buffers, maybe having it take multiple files as input could also be nice.

vi [options] [file ...]

As Neatvi does not support next and prev commands, I just added the first form.

Ali
lobre commented 9 months ago

As Neatvi does not support next and prev commands, I just added the first form.

Would this make sense now that neatvi supports next and prev? (b+/b-)

aligrudi commented 9 months ago

Loric Brevet @.***> wrote:

As Neatvi does not support next and prev commands, I just added the first form.

Would this make sense now that neatvi supports next and prev? (b+/b-)

These work for open buffers only. Argument list and next/prev commands are not supported yet.

Thanks, Ali

aligrudi commented 9 months ago

Loric Brevet @.***> wrote:

As Neatvi does not support next and prev commands, I just added the first form.

Would this make sense now that neatvi supports next and prev? (b+/b-)

I have just added a basic implementation prev/next.

Ali
lobre commented 9 months ago

That is nice!

I am trying to open neatvi with some files filtered in a pipe with it seems neatvi does not like it though.

find | grep yml | xargs neatvi
aligrudi commented 9 months ago

Loric Brevet @.***> wrote:

That is nice!

I am trying to open neatvi with some files filtered in a pipe with it seems neatvi does not like it though.

find | grep yml | xargs neatvi

It needs to read from the tty. Try this:

find | grep yml | xargs sh -c 'neatvi "$@" </dev/tty'
Ali
lobre commented 8 months ago

It needs to read from the tty.

Is there a technical reason why this is the case? What is blocking from having xargs working "normally"?

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

It needs to read from the tty.

Is there a technical reason why this is the case? What is blocking from having xargs working "normally"?

Programs like vi need the standard input to be a TTY. Please see the description of -o option in freebsd's xargs.

Ali