So right now I've got ctrl-E mapped to "edit" the current line in my prompt via neovim. So if I've got a line like
$ cp -r path/with/typo a/really/really/really/long/path/name
then I can press ^e, edit out the typo, exit neovim, and run the fixed command.
This is great, except (and I'll admit this is a nitpick) I don't really like that neovim takes up the whole screen. Sometimes the edit I'll want to make is based off of the output of a previous command, in which case it's a bit annoying that the full-screen neovim obscures this information.
For example, if I had the terminal history looking like:
$ cat requirements.txt absl-py==1.2.0 affine==2.4.0 aiohttp==3.8.4 aiosignal==1.3.1 alembic==1.10.3 anyio==3.6.1 apply-defaults==0.1.6 appnope==0.1.3 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 [...] $ cat .venv/lib/python3.10/site-packages/absl/__init__.py
But then I realised that instead of
absl library, I wanted to
cat a different library that was in the output of the first command
cat requirements.txt . Maybe the spelling of that command is weird. Right now I could edit the second command with a full-screen neovim window but I wouldn't be able to see the output of my previous command to check the spelling.
To clarify some things I'm not looking for:
- I'm not interested in a solution that somehow copies the history into the vim buffer.
- I'm not interested in a solution that doesn't let me see the output of the previous commands.
- I'm not interested in a solution that's offering some pseudo vim-mode for editing the current command with "vim-style" commands without actually opening vim.
Ideally the result should look like I've got a "mini-vim" (or neovim) instance that only takes up the lower 5 or so lines of the terminal, like:
-shell- $ cat requirements.txt absl-py==1.4.0 alembic==1.10.3 [...] $ cat .venv/lib/python3.10/site-packages/absl/__init__.py__init__.py --vim-- 1 cat .venv/lib/python3.10/site-packages/**edits made here***/__init__.py ~ ~ /private/tmp/zshbASRss 1,55 All :wq -shell- $ cat .venv/lib/python3.10/site-packages/**edits made here***/__init__.py
--vim-- are just used to indicate which parts are shell and which parts are vim)