I wrote a utility in bash that uses
read -e to provide a prompt for sql-like queries. Sometimes these are long, so I want to be able to open vi, edit the current line and upon exiting, replace the line with the contents in vim. I read lines with
read. Something like:
query> select .... from .... very long... <ctrl-e>
now in vi
select .... from .... very long...
select ... from .... very long ...
query> select ... from .... very long ... <enter>
UPDATE: using 'set -o vi' before the 'read -e' seems to be the way for me, but currently when I click
<esc>v the buffer that opens doesn't contain what is on the line but some other query, from my history (but not the one I typed before).