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

Editing .asc file through scp #19

Closed
noteed opened this issue Jul 28, 2014 · 4 comments
Closed

Editing .asc file through scp #19

noteed opened this issue Jul 28, 2014 · 4 comments
Assignees

Comments

@noteed
Copy link

noteed commented Jul 28, 2014

Editing an existing .asc file with vim correctly prompts for a passphrase and decrypt the file.

Trying to edit the same file through scp (using the vim scp:// syntax), opens the file as-is (i.e. without prompting for a passphrase and decrypting the file) in the top window of a horizontal split (the bottome window is blank). The top window seems to be expected to contain recipients.

I would like to know if there is something to do to decrypt the file on-the-fly, just like in the local edit case, or if there is a command I could type within Vim to decrypt the file after it is displayed encrypted.

Thanks!

@jamessan jamessan self-assigned this Jul 28, 2014
@jamessan
Copy link
Owner

The problem here is that NetRW handles the file retrieval from the remote system and populating Vim's buffer with the contents of the file. Once it has done that, it sets the buffer's "filename" to a special name (e.g., scp://host/path/to/file) and that's the file that vim-gnupg sees when it gets a chance to run. Obviously, this isn't something that gnupg can access, so it fails to do anything useful with that filename.

NetRW doesn't provide any hooks to allow plugins like vim-gnupg to be part of the process, so I don't think there's really much that I can do. You're better off just transferring the file locally and doing the edit or using something like sshfs, although that has its own issues.

@noteed
Copy link
Author

noteed commented Jul 29, 2014

Thank you.

Syntax highlighting plugins seem to inspect, say, the shabang line to discover the language a file is written in when the extension is missing. Couldn't vim-gnupg do something similar ?

@jamessan
Copy link
Owner

The problem isn't that vim-gnupg doesn't know it needs to run. The plugin is trying to do its job, but there's isn't a local file for it to work with, nor a way to ensure that its BufReadCmd/BufWriteCmd autocommands and NetRW's autocommands are called in the proper order.

Basically, NetRW would need to define an API where other plugins could register themselves as a filter for NetRW's read/write commands. Currently, NetRW hardcodes its own set of filters instead of providing a way for any plugin to hook into the process.

@noteed
Copy link
Author

noteed commented Jul 29, 2014

Ok, thank you again for your answer.

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

No branches or pull requests

2 participants