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

Breaks shell redirection and pipes #82

Open
ben-cohen-xs opened this issue Sep 6, 2022 · 3 comments
Open

Breaks shell redirection and pipes #82

ben-cohen-xs opened this issue Sep 6, 2022 · 3 comments

Comments

@ben-cohen-xs
Copy link

The file-line plugin breaks shell redirection: the command below should start vim with a buffer containing its manpage, but instead vim shows an empty buffer with a name like "/proc/65432/fd/63".

vim <(man vim)

The plugin breaks it because it tries to re-read the buffer, which is not possible from a pipe. You can fix the example above like this, though it would be better to do a more general check for pipes (and other special files) because they can also only be read once.

90c90
< if match(expand("%:p"), "^/proc/.*/fd/.*$") < 0 && match(expand("%:p"), "^/dev/fd/.*$") < 0 && !isdirectory(expand("%:p"))
---
> if !isdirectory(expand("%:p"))
@xim
Copy link
Contributor

xim commented Sep 7, 2022

We could just add a test for !filereadable(expand("%")) so startup isn't called if there's already something readable there.

@ben-cohen-xs
Copy link
Author

Yes, this works for me and is neater than the change in my previous comment:

if !filereadable(expand("%:p")) && !isdirectory(expand("%:p"))

xim added a commit to xim/file-line that referenced this issue Sep 7, 2022
@kaddkaka
Copy link

Any progress on this issue?

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

No branches or pull requests

3 participants