HIGHLY EXPERIMENTAL, AI WRITTEN, YET TO BE REVIEWED and if you already viewing this file in neovim with bsh installed, call :Bsh!
Buffer SHell: a shell that lives in a Neovim buffer instead of a terminal.

Point at a % command, press <CR>, and bsh runs it — writing the result into
an owned out fence right below. The whole session is an ordinary, editable
buffer: search it, fold it, edit the output in place, and save it as a file.
% cmd runs in place; output lands in an out fence below,
and re-running rewrites that fence idempotently.%% cmd keeps a shell session across cells (cwd,
env, variables); a plain % is one-shot.user@host (e.g. user@host% cmd,
user@host: ~/dir) to run over ssh; listings and files work remotely too.<C-CR> (or g<CR>) sends long output to a scratch
buffer, leaving a linkable log reference; <C-c> cancels a running command.: path lists a directory; add -T for a foldable tree;
<CR> drills into folders and opens files (remote paths included).lang % (e.g. python %) to run it;
lang %% shares one interpreter session across blocks (python today, more
language drivers planned).>> asks an llm with the previous cell(s) as context (>
none, >> one, >>> two, …); a [template] before the >s picks the llm
template; a trailing ! shows tool calls.demo.reverse maps to a script
under $BSH_HOME; directories list as navigable menus, and name! edits or
scaffolds the source.*.bsh / *.bsh.md files;
:BshReplay re-runs a saved session's cells (typst export planned).I'm frustrated with how uneditable the regular shell interface is, and one must rely on terminal creators to support any form of intractability with the shell outputs (highlighting urls, reverse output search, scroll). What if my shell, was an nvim buffer, where i can search, edit, do all the nvim magic my heart desires? I want to edit my terminal window however I like, and that's what this project provides me. (although I do lose... interactive commands, shell history, and... many other things, alas.. hopefully temporarily.. temporarily..)
(A secondary benefit is that I can share my shell sessions as markdown files (and hopefully soon, nicely formatted typst documents (pdf, html (maybe), etc))
-- lazy.nvim
{ "mktip/bsh.nvim", config = true } -- or just drop the repo on your runtimepath
bsh attaches automatically to *.bsh/*.bsh.md files. Turn any buffer into a shell on
demand with :Bsh!; :Bsh opens a fresh scratch one.
Optional prerequisites (i think, i didn't review it): otter.nvim (for lsp in codeblocks), conform.nvim (for formatting in codebooks), llm (for LLM integration, but any other harness with a print/headless mode should work)
Xiki (seems dead), Plan9, Emacs nerds
Lua
90.3%
Typst
6.8%
Shell
2.7%
HIGHLY EXPERIMENTAL, AI WRITTEN, YET TO BE REVIEWED and if you already viewing this file in neovim with bsh installed, call :Bsh!
Buffer SHell: a shell that lives in a Neovim buffer instead of a terminal.

Point at a % command, press <CR>, and bsh runs it — writing the result into
an owned out fence right below. The whole session is an ordinary, editable
buffer: search it, fold it, edit the output in place, and save it as a file.
% cmd runs in place; output lands in an out fence below,
and re-running rewrites that fence idempotently.%% cmd keeps a shell session across cells (cwd,
env, variables); a plain % is one-shot.user@host (e.g. user@host% cmd,
user@host: ~/dir) to run over ssh; listings and files work remotely too.<C-CR> (or g<CR>) sends long output to a scratch
buffer, leaving a linkable log reference; <C-c> cancels a running command.: path lists a directory; add -T for a foldable tree;
<CR> drills into folders and opens files (remote paths included).lang % (e.g. python %) to run it;
lang %% shares one interpreter session across blocks (python today, more
language drivers planned).>> asks an llm with the previous cell(s) as context (>
none, >> one, >>> two, …); a [template] before the >s picks the llm
template; a trailing ! shows tool calls.demo.reverse maps to a script
under $BSH_HOME; directories list as navigable menus, and name! edits or
scaffolds the source.*.bsh / *.bsh.md files;
:BshReplay re-runs a saved session's cells (typst export planned).I'm frustrated with how uneditable the regular shell interface is, and one must rely on terminal creators to support any form of intractability with the shell outputs (highlighting urls, reverse output search, scroll). What if my shell, was an nvim buffer, where i can search, edit, do all the nvim magic my heart desires? I want to edit my terminal window however I like, and that's what this project provides me. (although I do lose... interactive commands, shell history, and... many other things, alas.. hopefully temporarily.. temporarily..)
(A secondary benefit is that I can share my shell sessions as markdown files (and hopefully soon, nicely formatted typst documents (pdf, html (maybe), etc))
-- lazy.nvim
{ "mktip/bsh.nvim", config = true } -- or just drop the repo on your runtimepath
bsh attaches automatically to *.bsh/*.bsh.md files. Turn any buffer into a shell on
demand with :Bsh!; :Bsh opens a fresh scratch one.
Optional prerequisites (i think, i didn't review it): otter.nvim (for lsp in codeblocks), conform.nvim (for formatting in codebooks), llm (for LLM integration, but any other harness with a print/headless mode should work)
Xiki (seems dead), Plan9, Emacs nerds
Lua
90.3%
Typst
6.8%
Shell
2.7%