<h2 id="using-the-gnupg-vim-plugin-to-edit-encrypted-files.">Using the GnuPG vim plugin to edit encrypted files.</h2>
<ul>
<li><p>See show hpr3476 My mutt email setup<br />
<a href="https://www.hackerpublicradio.org/eps.php?id=3476" class="uri">https://www.hackerpublicradio.org/eps.php?id=3476</a></p></li>
<li><p>GnuPG Vim Plugin on vim.org<br />
<a href="https://www.vim.org/scripts/script.php?script_id=3645" class="uri">https://www.vim.org/scripts/script.php?script_id=3645</a></p></li>
<li><p>GnuPG Vim Plugin on Github<br />
<a href="https://github.com/vim-scripts/gnupg.vim" class="uri">https://github.com/vim-scripts/gnupg.vim</a></p></li>
</ul>
<p><em>Line to directly clone from github</em></p>
<pre><code>  git clone https://github.com/vim-scripts/gnupg.vim</code></pre>
<p>From <code>man 1 gpg-agent</code>:</p>
<blockquote>
<p>You should always add the following lines to your <code>.bashrc</code> or whatever initialization file is used for all shell invocations:</p>
<pre><code>GPG_TTY=`tty`
export GPG_TTY</code></pre>
<p>It is important that this environment variable always reflects the output of the tty command.</p>
</blockquote>
<p><em>.bashrc snippet</em></p>
<pre><code>  ## GPG Vim
  GPG_TTY=`tty`
  export GPG_TTY
  export EDITOR=vim</code></pre>
<p><em>GnuPG folder structure</em></p>
<pre><code>  [mark@fedora-lt ~]$ tree .vim
  .vim
  &#x251C;&#x2500;&#x2500; plugin
  &#x2502;   &#x2514;&#x2500;&#x2500; vim-gnupg
  &#x2502;       &#x251C;&#x2500;&#x2500; autoload
  &#x2502;       &#x2502;   &#x2514;&#x2500;&#x2500; gnupg.vim
  &#x2502;       &#x251C;&#x2500;&#x2500; doc
  &#x2502;       &#x2502;   &#x2514;&#x2500;&#x2500; gnupg.txt
  &#x2502;       &#x251C;&#x2500;&#x2500; plugin
  &#x2502;       &#x2502;   &#x2514;&#x2500;&#x2500; gnupg.vim
  &#x2502;       &#x2514;&#x2500;&#x2500; README.md
  &#x2514;&#x2500;&#x2500; spell
      &#x251C;&#x2500;&#x2500; en.utf-8.add
      &#x2514;&#x2500;&#x2500; en.utf-8.add.spl</code></pre>
<p><em>vimrc</em></p>
<pre><code>set tabstop=2 softtabstop=0 expandtab shiftwidth=2 smarttab textwidth=80
syntax on
autocmd BufRead,BufNewFile   *.log set filetype=logtalk
set spell spelllang=en_us</code></pre>
<p>Generate gpg full key<br />
<code>gpg --full-generate-key</code></p>
<p>or just a regular one, with less options<br />
<code>gpg --gen-key</code></p>
<p>Encrypt the file in question, with -r as the recipient<br />
In this case, I used part of the comment as the recipient</p>
<p><em>Picture 1</em><br />
<a href="https://hackerpublicradio.org/eps/hpr3484/picture001.png"><img src="https://hackerpublicradio.org/eps/hpr3484/picture001_thumbnail.png" alt="Picture 1" /></a> <br/><small><small><em>Click the thumbnail to see the full-sized image</em></small></small></p>
<p>This is more like it.<br />
<code>gpg -e -r test thisIsMyTestFile.txt</code></p>
<p>Now test edit the file<br />
<code>vim thisIsMyTestFile.txt.gpg</code></p>
<p><em>Picture 2</em><br />
<img src="https://hackerpublicradio.org/eps/hpr3484/picture002.png" alt="Picture 2" /></p>
<p>It is a good idea to shred the original text file</p>
<pre><code>      shred - overwrite a file to hide its contents, and optionally delete it
      -u deallocate and remove file after overwriting
      -v, --verbose, show progress</code></pre>
<p>Example: <code>shred -u -v foo.txt</code></p>
