0

If I issue the following command:

ls sb.ovpn | xargs vim

The classic vim opens the sb.ovpn file.

However if I do the same but with neovim:

ls sb.ovpn | xargs nvim -

That does not work as I expected, opens a new file instead (without dash does not work either). ¿Why? ¿Is that the expected behavior of nvim?

sebelk
  • 325
  • 2
  • 10
  • 2
    xargs vim isn't known to work all that well either: https://superuser.com/q/336016/334516, https://vi.stackexchange.com/questions/410/terminal-borked-after-invoking-vim-with-xargs, https://unix.stackexchange.com/questions/77395/grep-l-xargs-vim-generates-a-warning-why – muru Jul 19 '18 at 06:03
  • 2
    https://github.com/neovim/neovim/issues/8561 – Christian Brabandt Jul 19 '18 at 06:14

1 Answers1

2

This is a (side?)effect of the changes from nvim v0.2.2 -> v0.3. Nvim did switch the default behaviour for text that is piped into it via stdin. Before it was used as commands (unless - was given as an argument), now it is used as text in the initial buffer (even without the -).

Your file argument should be there just as the next buffer in the internal argument list of neovim. Try :ls inside neovim.

You can verify that this behaviour is new with neovim v0.3 when you download the appimage for v0.2.2 and try the same with that.

EDIT: I confirmed that for version 0.3.1 it works as expected, you get file in the first buffer. You can download v0.3.1 from the release page. (thanks @jamessan for mentioning)

Lucas
  • 1,629
  • 10
  • 21
  • There was no 0.2.3 release. :) 0.3.1 has the fix. – jamessan Jul 19 '18 at 16:47
  • @jamessan I have a nvim.appimage which reports v0.2.3-1-gd6f9d1df0 for --version. I don't remember where I got it. – Lucas Jul 19 '18 at 17:52
  • 2
    That's a nightly build, not an official release. Initially, the release after 0.2.2 was going to be 0.2.3, but then it was decided to change to 0.3.0. – jamessan Jul 19 '18 at 18:11