Skip to content

Add Neovim floating chat input (:Augment chat-input)#66

Open
mgmonteleone wants to merge 2 commits into
mainfrom
bot/neovim-floating-chat-input
Open

Add Neovim floating chat input (:Augment chat-input)#66
mgmonteleone wants to merge 2 commits into
mainfrom
bot/neovim-floating-chat-input

Conversation

@mgmonteleone

Copy link
Copy Markdown
Collaborator

Closes #61.

What

Adds a new range-aware :Augment chat-input subcommand that opens a centered floating window with a markdown scratch buffer for composing a chat message before sending it. This upstreams a dependency-free, Neovim-gated version of the floating input the issue author shared (their LazyVim gist), reusing the existing chat plumbing.

Behavior

  • Floating window (Neovim only): nvim_open_win with a scratch buffer (buftype=nofile, bufhidden=wipe), markdown filetype, opened in insert mode.
  • Submit: <C-s> (insert/normal) or <CR> (normal) joins the buffer lines, closes the float, and dispatches to the existing chat flow.
  • Cancel: <Esc> (normal) or <C-c> (insert/normal) closes the float without sending.
  • Range-aware: like :Augment chat, invoking from visual mode (or with a range) includes the selected text. On submit the prior visual selection is restored via gv so it is passed through to the chat request.
  • Vim fallback: the floating window requires Neovim; in Vim (or when a message is supplied directly on the command line) it falls back to the standard input() prompt used by :Augment chat, with no change to existing behavior.
  • No third-party dependencies and no default mappings are added.

Changes

  • autoload/augment.vims:CommandChatInput handler + s:ChatInputSubmit callback; wired into command dispatch and completion.
  • autoload/augment/chat.vimaugment#chat#OpenInputWindow plus submit/cancel helpers and buffer-local mappings.
  • README.md, doc/augment.txt, CHANGELOG.md — document the new command.

Validation

  • Headless Neovim smoke test (nvim --headless): verifies the function and completion entry exist, the float opens with a markdown buffer, a multi-line submit invokes the callback with the joined message and closes the window, and cancel closes the window without firing the callback. Result: SMOKE_OK.

Pull Request opened by Augment Code | View session

Add a new range-aware :Augment chat-input subcommand that opens a centered
floating window with a markdown scratch buffer for composing a chat message.
Submitting joins the buffer lines, closes the float, restores the prior mode
(re-selecting a visual range via gv so the selection is passed through), and
dispatches to the existing chat flow.

The floating window is Neovim-only (nvim_open_win). In Vim, the command falls
back to the standard input() prompt used by :Augment chat, with no change to
existing behavior. No third-party dependencies and no default mappings are
added.

Buffer-local mappings: <C-s> (insert/normal) and <CR> (normal) submit; <Esc>
(normal) and <C-c> (insert/normal) cancel.

Update the command completion list, README.md, doc/augment.txt, and CHANGELOG.md.
@mgmonteleone

Copy link
Copy Markdown
Collaborator Author

PR Author Agent

👋 I've got this PR — here's what I'll handle for you:

  • Review feedback — implement suggestions, answer questions, fix what comes up
  • CI failures — I get pinged when checks fail and try to fix them
  • Merge conflicts — bring the PR back up to date when it falls behind
  • Merge gates — watch CI, reviews, and verification
  • Ping you the moment it's ready to merge

Marking it ready and picking reviewers are your call — I'll leave both alone.

Drop a comment anytime!

Note: opened under @mgmonteleone's identity — the org bot lacks PR write access on this repo, so attribution may differ from other automated PRs.

@mgmonteleone mgmonteleone marked this pull request as ready for review June 9, 2026 09:10
@mgmonteleone mgmonteleone self-assigned this Jun 9, 2026
@mgmonteleone

Copy link
Copy Markdown
Collaborator Author

PR Author Agent

✅ Ready for review on 07df2f8:

  • No CI checks are configured on this repo, so none will run.

Reviewer pick is your call — I won't request anyone myself. I'll respond to any review feedback as it comes in (no merge — that stays a human gate).

@johnny2211

Copy link
Copy Markdown

Minor UX thought: if the user switches out of the float (e.g. <C-w>w) it's orphaned with no clear way back. Worth having :Augment chat-input refocus an existing float instead of opening a new one? Avoids losing typed content on accidental focus loss. Not blocking.

@mgmonteleone

Copy link
Copy Markdown
Collaborator Author

PR Author Agent

Good call on the orphaned-float UX. Implemented in f35f72a: augment#chat#OpenInputWindow now checks for an existing valid input window first and, if found, refocuses it (nvim_set_current_win + startinsert) and returns early instead of opening a new float. The existing buffer and its submit callback are preserved, so typed content survives an accidental focus change (e.g. <C-w>w).

Updated the README and :help doc to note the refocus behavior, and extended the headless smoke test to cover it (re-invoking after moving focus away keeps the same window and its content). All checks pass (SMOKE_OK).

@johnny2211 johnny2211 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin Enhancement

2 participants