title: Pycharm edit a file in a tab opened with ansible-vault
body: <p>I have ansible files that are encrypted using <strong>ansible-vault</strong>. I want to decrypt, edit, and save encrypted these files from within an IDEA IDE, in this case, pycharm.</p>
  
  <p>I have created an external tool in pycharm that will decrypt the files and open them in a run window in the IDE in what appears to be a tmp file. I need the output of the tool to be placed in an edit tab and save it to same file.</p>
  
  <p>Here is how I created the external tool:</p>
  
  <p><strong>Preferences -> External Tools -> New</strong></p>
  
  <pre><code>Name: Vault Edit
  Group: Ansible
  Options: Synchronise files after execution, Open console
  Show in: Main menu, Editor Menu
  Tool Settings:
    Programs: /path/to/vault_edit.sh
    Parameters: edit $FileName$
    workding directory: $FileDir$
  </code></pre>
  
  <p><strong>vault_edit.sh</strong></p>
  
  <pre><code>#!/bin/sh
  
  EDITOR=charm
  ansible-vault --vault-password-file=~/.vault/vault_password.txt "$@"
  </code></pre>
  
  <p>The <code>run</code> window is showing the decrypted output, but it of course is not allowing me to edit the file, let alone save it. I can't find any documentation on how to push the output of the ansible-vault to a tabbed edit window in pycharm. </p>
  
  <p>It is showing output like:</p>
  
  <pre><code>/path/to/vault_edit.sh edit hosts
  Vim: Warning: Output is not to a terminal
  Vim: Warning: Input is not from a terminal
  </code></pre>
  
  <p>If I can get this working, I plan on doing something similar to allow for encryption of a file as well.</p>