Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relative path and non-existant file to Vifm gives error #12

Open
phinxy opened this issue Nov 4, 2017 · 3 comments
Open

relative path and non-existant file to Vifm gives error #12

phinxy opened this issue Nov 4, 2017 · 3 comments

Comments

@phinxy
Copy link

phinxy commented Nov 4, 2017

When calling Vifm with a relative path and a non-existant file like so:

:EditVifm some/directory/NULL.txt

Vim spits out the error:

Got non-zero code from vifm: 1

On the other hand, when using an absolute path the behavior is much better, Vifm starts and opens the folder.

:EditVifm ~/some/directory/NULL.txt

Thanks

@xaizek
Copy link
Member

xaizek commented Nov 4, 2017

On the other hand, when using an absolute path the behavior is much better, Vifm starts and opens the folder.

Actually, this part looks like a bug. Both kinds of paths should be treated identically, in this case give an error.

Argument should be a directory, why are you trying to pass path to a file?

@phinxy
Copy link
Author

phinxy commented Nov 4, 2017

why are you trying to pass path to a file?

When a file is passed to Vifm the file opens in vim, is this not intended? I have replaced :e and :vs built-in vim commands with the Vifm equivalents. Does not the built-in :e(dit) handle file paths? Vifm - or is it Vifm.vim - should too.

If i had to pick between the two behaviors when a file is not found, I would choose the one where Vifm opens the parent directory of the supposed file. Versus giving an error message. What is your opinion xaizek?

The docs says that file or files is part of the argument. Should it not mention directories as well?

:EditVifm select a file or files to open in the current buffer.

@xaizek
Copy link
Member

xaizek commented Nov 4, 2017

The docs says that file or files is part of the argument. Should it not mention directories as well?

That's description of a command, not its arguments. Arguments are specified below:

Each command accepts up to two arguments: left pane directory and right pane directory.

When a file is passed to Vifm the file opens in vim, is this not intended?

It is intended, but when file exists and therefore user probably meant just that.

Does not the built-in :e(dit) handle file paths? Vifm - or is it Vifm.vim - should too.

Not necessarily. :edit and command-line arguments of vifm don't have to work identically.

The reason why it errors is because when file doesn't exist, you might have made a typo. And if vifm won't fail, user might proceed doing something else without noticing that he's in the wrong directory.

I have replaced :e and :vs built-in vim commands with the Vifm equivalents.

That doesn't seem optimal. Instead of Vim just opening a file, it runs vifm, which returns path and only then Vim opens it. An external process is spawn for no reason. Just to avoid this, it seems to make sense to invoke the plugin only when directory/directories or no arguments are passed. This way you also won't break use of wildcards in arguments for :e (e.g., :EditVifm *.vim won't work).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants