Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save shadmansaleh/e0442fe1d1d8431ecb0019c468dd159a to your computer and use it in GitHub Desktop.

Select an option

Save shadmansaleh/e0442fe1d1d8431ecb0019c468dd159a to your computer and use it in GitHub Desktop.
GSoC 2025 Work Product Submission for Enhancing AI Primitives in Neovim project

GSoC 2025: Enhancing AI Primitives in Neovim

Project Goals

Neovim currently lacks built-in AI support, forcing plugin authors to reimplement common functionality such as inline completion, progress indicators, and chat buffers. The goal of this project was to add general-purpose AI primitives to Neovim’s core, making it easier for plugin developers to build consistent AI-assisted workflows, while keeping Neovim lightweight and extensible.

Key planned features:

  • Enhance prompt buffers (multi-line input, pasting, better editing).
  • Refactor the default statusline to Lua for extensibility.
  • Add a standardized progress API.
  • Add buffer busy state indicators.

Work Completed

Prompt Buffer Enhancements

  • PR: #33371
  • Added support for multi-line submissions (#33371).
  • Added multi-line paste (#33371).
  • Provided editing improvements (oprations: o/O, a/A, etc).
  • Added new api to get the current prompt textprompt_getinput(buf) (#34491).
  • Fixed <C-R> raw-input behavior in insert mode (#35477).
  • Multiple bugfixes and tests (#34583, #34584, #34671, #34736).

Statusline Refactor

  • PR: #33036
  • Refactored the default statusline from C to Lua, making it more extensible.
  • Enables showing AI-related indicators like progress and buffer-busy states.
  • Tracking issue: #28809.

Progress API

  • PR: #34846
  • Added support for progress message in nvim_echo api along with necessary events.
  • Simplified progress ui-event and introduced default formating for progress messages. (#35527)
  • Implemented highlighting and history sync for progress messages (#35533)
  • WIP: Statusline integration (#35428).
  • Tracking: #32537.

Buffer Busy Status

  • PR: #34493
  • Added buffer-specific option to mark “busy” state (useful for AI editing indication).
  • Integrated busy indicator in default statusline.

Current State

  • Merged upstream:
    • Statusline refactor, Prompt buffer enhancements, Buffer busy state, Progress API.
  • In review:
    • Progress API statusline integration (#35428)

What’s Left To Do

  • Finalize progress-api integration and get it merged.

Code Links (Upstream)

  • #33036 - refactor: replace C implementation of default statusline with statusline expression (merged)
  • #33371 - feat(prompt): multiline prompt input (merged)
  • #34491 - feat(prompt): prompt_getinput() gets current input (merged)
  • #34493 - feat: add busy status for buffers (merged)
  • #34583 - test(prompt): add test for multiline paste with nvim_paste (merged)
  • #34584 - fix(prompt): "%" prefix is repeated on multiline input with formatoptions+=r (merged)
  • #34671 - fix(prompt): prompt mark not placed after text edits correctly (merged)
  • #34736 - fix(prompt): cursor on prompt line, disallow ":edit" (merged)
  • #34846 - feat(api): nvim_echo can emit Progress messages/events (merged)
  • #35182 - feat(lua): add vim.project for project specific context management (deprioritized)
  • #35205 - feat: add support for project-root in buffer level (in review)
  • #35428 - feat(progress): add progress message integration for statusline (in review)
  • #35477 - feat(editor)!: insert-mode ctrl-r should work like paste (merged)
  • #35527 - enhance(progress): simplify progress ui-event and introduce default formating (merged)
  • #35477 - feat(progress): better default format + history sync (merged)

Lessons & Challenges

  • Maintaining performance while adding new primitives required careful design.
  • Backward compatibility was critical, new APIs had to be general purpose, not feature specific hacks.
  • Community feedback shaped API design, especially for prompt buffer behavior and progress messages.
  • Learned the importance of incremental refactoring (statusline rewrite first enabled easier progress/busy integration).

Conclusion

This project significantly improves Neovim’s ability to support AI-assisted workflows. By providing standardized core primitives, plugin developers can now build richer, more consistent experiences without duplicating effort. The merged features already deliver long-term value to the Neovim community.

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