Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Writers Mode & Model Selection
Intro
This PR introduces Writers Mode, an alternative operating mode focused on text editing and improvement, along with complementary features like dynamic model selection. The 99 plugin was exclusively focused on code assistance. This update expands its utility to text correction, enabling:
Changes Implemented
1. Mode System (Code/Writer)
Files:
lua/99/init.lua,lua/99/prompt-settings.luaRefactoring of the prompt system to support multiple modes:
Public API Added:
require("99").toggle_mode()- Toggle between code/writerrequire("99").set_mode("writer")- Set specific moderequire("99").set_writer_language("pt-BR")- Set language2. Automatic Language Detection
File:
lua/99/init.luaNew function that automatically detects the user's language:
Priority order:
:set spelllang$LANGenvironment variable"en"3. Specialized Writing Prompts
File:
lua/99/prompt-settings.luaNew prompt set optimized for text editing, prompts are dynamic and incorporate the detected language:
4. Dynamic Model Selection
File:
lua/99/init.luaNew
select_model()function that lists all available models viaopencode. This is the largest addition in this PR.Step 1: Async System Call to OpenCode
Uses
vim.systemfor async execution, preventing UI blocking.Step 2: Parse Model List from stdout
Parses each line from stdout, trims whitespace, and builds model list.
Step 3: Fallback Input Function
Safety fallback when
vim.ui.selectfails or list is too large.Step 4: Small List - Use vim.ui.select
For lists under 50 items, uses native
vim.ui.selectwithpcallprotection.Step 5: Large List - Custom Buffer Picker
Custom buffer picker that avoids
snacks.nvimintegral height bug with large lists.Usage:
5. Temporary File Management Fix
File:
lua/99/utils.luaMotivation:
tmp/directory inside the project/tmp/99directoryHow to Test
.md,.txt):lua require("99").set_mode("writer")<leader>9vand wait.For model selection (default is claude-sonnet-4.5):
Design Decisions
Unified
contextParameter in Prompt FunctionsThe
contextargument was added to all prompt functions (implement_function,fill_in_function,visual_selection) to enable dynamic language detection viaget_lang(context):Why pass
contextto code mode if it doesn't use language?The
code_promptsuse fixed strings whilewriter_promptsuse functions that receivelang:context?writerf(lang)codelangis ignoredThe
resolve()function handles this transparently:Decision: Pass
contextto all prompt functions to maintain a unified API. This avoids having two different function signatures and simplifies the calling code in operations likeimplement-fn.luaandover-range.lua. The overhead is negligible sinceget_lang()short-circuits when the value isn't used.Known Issues