I have been using keepassx as a partial solution. keepassx runs on Linux, Macs, and Micro$oft operating systems, and allows you to lock the file not only with a password, but also a key file. A really nice piece of software. But I was looking for something command-line oriented, that I could access via SSH on one of my servers with a public IP.
The very simplest solution seems to be vim, a turbo-charged version of the venerable Unix "vi" editor that includes a gnupg plugin (enabled by default on Debian).
To create an encrypted file with vim, just type:
vi -x test.gpg
and you will be prompted for the password that will be used to lock the file. Edit and save. Thereafter, if you
vi test.gpg -or-
to edit or view the file, you will have to give your password to decrypt it.
Don't be afraid of vi! You only need to know a few keystrokes to get the basic stuff done. When you first open a file for editing, most keystrokes will be ignored because you are in view mode:
"i" to enter insert mode
"R" to enter overwrite mode
Esc key to return to read-only mode
"r" to overwrite just one character under the cursor
"x" or Delete key to delete the character under the cursor
"dd" to delete the line under the cursor
"ndd" to delete "n" lines under the cursor
"yy" to copy ("yank") the line under the cursor
"p" to past the last the last block of line(s) copied or deleted
"/text" to search for the string "text"
"zz" to exit and save
":q!" to exit without saving.
I have been using vi fairly hard for years, and I rarely stray from this short list of keystrokes.