rogual / neovim-dot-app

Mac OS X GUI for Neovim
1.13k stars 62 forks source link

gnvim script opens the target file twice #204

Closed hakamadare closed 8 years ago

hakamadare commented 8 years ago

here's the output of the current gnvim helper script when run with set -o xtrace:

$ gnvim doc/hierarchy.md
+ OPTIND=1
+ opt_blocking=
+ getopts f opt
+ shift 0
+ '[' doc/hierarchy.md = -- ']'
+ open -n -a Neovim --args --cwd <the current directory> doc/hierarchy.md

in particular, note the last call to open, which passes in a single argument, doc/hierarchy.md.

now, inside the Neovim session, running :args shows:

[doc/hierarchy.md] doc/hierarchy.md

so it looks like Neovim.app has created two buffers, both editing the same file. running nvim doc/hierarchy.md for comparison only opens a single buffer, :args outputs [doc/hierarchy.md].

seemethere commented 8 years ago

I'm having this issue as well. +1

rogual commented 8 years ago

Confirmed. gnvim script is still very half-baked.

tvon commented 8 years ago

Note that open -n -a Neovim ~/.bashrc works as expected, but passing --args and anything else to open results in the file seeming to be opened multiple times. I also get odd behavior with the bundled gnvim script in that the editor window will sometimes appear undrawn until I press enter, and then the file is opened RO.

dearrrfish commented 8 years ago

Per @tvon observation, I tried to resort the parameter order and run open -n -a Neovim ~/.bashrc --args --cwd "$PWD", then run :args, problem solved likely.

bambu commented 8 years ago

This is not a problem with gnvim. the problem is that app.mm is providing the file which we are putting into the arguments vector and then adding any arguments as well.

https://github.com/rogual/neovim-dot-app/blob/master/src/app.mm#L226-240