vim-rails icon indicating copy to clipboard operation
vim-rails copied to clipboard

Command of editing/creating credentials?

Open bekicot opened this issue 5 years ago • 1 comments
trafficstars

I tried

:Rails credentials:edit

but the editor does some weird stuff, instead of open the buffer for credentials edits.

Maybe commands like:

:Ecredentials

What do you think?

bekicot avatar Apr 15 '20 23:04 bekicot

The way rails credentials:edit works is it decrypts credentials.yml.enc to a temp file, opens that temp file in your editor, and re-encrypts upon exiting the editor. Two rails.vim solutions spring to mind:

  • Make :Rails behave the same as :Git commit in Fugitive: use jobs and a clever value of $EDITOR to support editing temp files. I think this is a good idea with uses beyond credentials:edit, but Fugitive's new functionality is a work in progress and I'm not ready to extract it yet.
  • Upon editing credentials.ymc.enc, load in the unencrypted contents using BufReadCmd, and upon writing, re-encrypt using BufWriteCmd. A command like :Ecredentials could be paired with this, but I tend not to have one off commands for configuration files, as there are just too many of them.

I'll do the former eventually. If you're looking to take action, feel free to investigate the latter. afterimage.vim might provide inspiration.

tpope avatar Apr 19 '20 17:04 tpope