| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Vimini is a Vim plugin that provides seamless integration with Google's Gemini (Generative AI) models, allowing you to interact with AI directly from your Vim editor. You can chat, generate code, get code reviews, and even receive real-time autocomplete suggestions without leaving your coding environment.
pip install google-genaiYou can install Vimini using your preferred Vim plugin manager.
Using Vim-Plug:
call plug#begin()
Plug 'your-github-username/vimini.vim' " Replace with the actual repo path
call plug#end()Using Packer.nvim:
use 'your-github-username/vimini.vim' " Replace with the actual repo path(Note: Replace your-github-username/vimini.vim with the actual repository path once published.)
Vimini requires your Google Gemini API key and allows for several customizations.
API Key (~/.config/gemini.token): Vimini loads your Google Gemini API key from ~/.config/gemini.token. Place your API key (and nothing else) into that file:
# ~/.config/gemini.token YOUR_API_KEY_HERE
Default Model (g:vimini_model): Specify the default Gemini model you want to use. The default is gemini-2.5-flash. You can list available models using :ViminiListModels.
let g:vimini_model = 'gemini-2.5-flash' " Or 'gemini-2.5-pro', etc.Generation Temperature (g:vimini_temperature): Control the creativity of the AI's responses for commands like :ViminiCode, :ViminiCommit, and :ViminiReview. The temperature is a value between 0.0 and 2.0. Higher values (e.g., 1.0) make the output more random and creative, while lower values (e.g., 0.2) make it more focused and deterministic. By default, it is not set, allowing the model to use its default temperature.
" Set a specific temperature for generation
let g:vimini_temperature = 0.7Thinking Display (g:vimini_thinking): Control whether the AI's "thinking" process is displayed in a separate buffer during code generation and reviews.
" Show the 'Vimini Thoughts' buffer. (Default)
let g:vimini_thinking = 'on'
" Hide the 'Vimini Thoughts' buffer.
let g:vimini_thinking = 'off'This can also be controlled with the :ViminiThinking command.
Autocomplete (g:vimini_autocomplete): Enable or disable the real-time autocomplete feature. It is disabled by default.
" Enable autocomplete feature
let g:vimini_autocomplete = 'on'
" Disable autocomplete feature (Default)
let g:vimini_autocomplete = 'off'This can also be controlled with the :ViminiToggleAutocomplete command.
Logging (g:vimini_logging and g:vimini_log_file): Control whether Vimini logs its activity to a file, which can be useful for debugging. Logging is disabled by default.
" Enable logging (Default is 'off')
let g:vimini_logging = 'on'
" Set a custom path for the log file (Default is '~/.var/vimini/vimini.log')
let g:vimini_log_file = '/path/to/your/vimini.log'Logging can also be controlled at runtime with the :ViminiToggleLogging command.
Commit Author (g:vimini_commit_author): Customize the Co-authored-by trailer used in :ViminiCommit.
" Set a custom author trailer (Default is 'Co-authored-by: Gemini <gemini@google.com>')
let g:vimini_commit_author = 'Co-authored-by: My AI Assistant <ai@example.com>'Context Files (g:context_files): In addition to all files currently open in Vim buffers, you can specify a list of files to always include as context for AI commands like :ViminiCode. This is useful for providing the AI with important project files (like configurations, core utilities, or type definitions) without needing to have them open. Note: The total size of all uploaded context files combined is strictly limited to 1MB; if this limit is exceeded, the largest files will automatically be excluded.
" Always include these files as context for code generation tasks
let g:context_files = ['package.json', 'src/main.js', 'src/utils/api.js']Build and Test Commands: Configure per-project settings such as whether compilation is needed and shell commands for compiling/building code and running tests when invoked by chat tools (build_code and test_code). Project configuration is stored in ~/.var/vimini/projects/<project_name>:
{
"version": "0.1",
"configuration": {
"build-command": "make -j$(nproc)",
"test-command": "pytest",
"compilation-needed": false
},
"files": []
}Vimini exposes several commands for interacting with the Gemini API:
Lists all available Gemini models in a new split window. This is useful for knowing which models you can set for g:vimini_model.
:ViminiListModelsOpens the chat buffer for interactive mode with Gemini.
:ViminiChatToggles or sets the display of the AI's real-time thought process during code generation and reviews. When enabled, a Vimini Thoughts buffer will appear alongside the main result buffer.
" Toggle the current setting (on -> off, off -> on)
:ViminiThinking
" Explicitly turn the thinking display on
:ViminiThinking on
" Explicitly turn the thinking display off
:ViminiThinking offToggles or sets the logging feature. When enabled, Vimini will log API requests, responses, and other internal actions to the file specified by g:vimini_log_file. This is primarily useful for debugging.
" Toggle the current setting (on -> off, off -> on)
:ViminiToggleLogging
" Explicitly turn logging on
:ViminiToggleLogging on
" Explicitly turn logging off
:ViminiToggleLogging offTakes the content of all open buffers (and any files specified in g:context_files, up to a total of 1MB) as context, along with your prompt, and asks the Gemini model to generate code. The result is streamed into a new buffer named [{job_id}] Vimini Code. This buffer contains:
This command is ideal for asking the AI to refactor, debug, or extend your current code.
:ViminiCode Please refactor this function to be more conciseAfter running :ViminiCode, you can use the following command to apply the changes:
This command will close the temporary Vimini Code buffer.
Opens an interactive file manager in a new split window to easily manage the list of files in g:context_files. This allows you to add or remove files that should always be included as context for AI commands, without manually editing your .vimrc.
How to use the manager:
When you are done, simply close the window (e.g., with :q). A popup will ask you to confirm whether to save the changes to g:context_files for the current Vim session.
:ViminiContextFilesOpens an interactive configuration editor in a new split window to configure project-specific settings (such as build-command and test-command).
How to use the configuration manager:
:ViminiConfigSends content to the Gemini model for a code review. This command has two main modes:
You can add an optional {prompt} to guide the AI's review. The review will be displayed in a new vertical split buffer. If g:vimini_thinking is on, an additional buffer showing the AI's thought process will also be opened.
Additional Options:
Examples:
" Review the current buffer for performance issues
:ViminiReview Check for performance issues.
" Perform a general review of the current buffer
:ViminiReview
" Review the changes in the latest commit
:ViminiReview -c HEAD
" Review changes from two commits ago, focusing only on security
:ViminiReview -c HEAD~2 --security
" Review the last 3 commits and save each review to a file
:ViminiReview -c HEAD~3..HEAD --save
" Review the last 3 commits and save each review to a specific directory
:ViminiReview -c HEAD~3..HEAD --save=./reviewsVimini can provide real-time, context-aware code completions as you type in insert mode. This feature is disabled by default.
Note: The autocomplete command is experimental and still a little buggy and should be enabled with care.
Toggles or sets the real-time autocomplete feature. When enabled, Vimini will automatically request a completion after you stop typing in insert mode for a short period. The suggestion will be displayed as ghost text.
" Toggle the current setting (on -> off, off -> on)
:ViminiToggleAutocomplete
" Explicitly turn autocomplete on
:ViminiToggleAutocomplete on
" Explicitly turn autocomplete off
:ViminiToggleAutocomplete offVimini offers commands to integrate with your Git workflow.
Shows the output of git diff for the current repository in a new split window. This allows you to see unstaged changes without leaving Vim.
:ViminiDiffAutomates the commit process using AI. This command has three main modes:
Default Mode (Creating a new commit):
When run without flags (or with -n), it automates the creation of a new commit:
Regenerate Mode (-r):
When run with the -r flag, it regenerates the commit message for the last commit (HEAD) and amends it:
Amend Code and Regenerate Mode (-a):
When run with the -a flag, it amends the current working tree changes into the last commit (HEAD) and regenerates the commit message:
You can also provide optional [instructions] at the end of the command to guide the AI's message generation (e.g., "Mention issue #123" or "Keep it very brief").
Options:
Examples:
" Stage changes and generate a commit message for a new commit
:ViminiCommit
" Provide instructions for the commit message
:ViminiCommit Include details about the bug fix
" Do the same, but without the co-author trailer
:ViminiCommit -n
" Regenerate the message for the HEAD commit and amend it
:ViminiCommit -r
" Regenerate with instructions
:ViminiCommit -r Make it shorter
" Amend current changes into HEAD and regenerate commit message
:ViminiCommit -aNote: The ViminiRipGrep command is basically an AI-assisted translation of the code at https://gitlab.com/aarcange/ripgrep-edit. Credit for the original project goes to Andrea Arcangeli.
This powerful feature combines ripgrep's fast searching with Gemini's AI-powered code modification capabilities, allowing you to perform project-wide refactoring from a single prompt.
This command initiates an AI-assisted search and replace workflow:
Example: To rename old_function_name to new_function_name across your entire project:
:ViminiRipGrep 'old_function_name' 'rename this function to new_function_name'Once you are satisfied with the AI-generated changes in the ViminiRipGrep buffer, run this command. It will apply the modifications to the actual files on disk and close the temporary buffer.
:ViminiRipGrepApplyCommands like :ViminiCode automatically upload files to Google to provide context for the AI. These files persist on the server. :ViminiFiles opens an interactive buffer to manage these remotely stored files, allowing you to view details or delete them when they are no longer needed.
The command opens a Vimini Files buffer that lists all your uploaded files.
How to use the manager:
:ViminiFilesOpens a read-only buffer showing the status of currently running asynchronous jobs (e.g., code generation, chat, review). This is useful for monitoring long-running tasks.
:ViminiStatusReloads the Vimini Python modules from disk. This is primarily useful for developers working on the plugin, allowing them to test changes and achieve faster development iterations without having to restart Vim.
:ViminiReloadOpens a help buffer listing all available Vimini commands and their descriptions. You can optionally provide a command name to jump directly to its help entry.
:ViminiHelp
:ViminiHelp ViminiCodeMost of the code here is generated by Gemini itself, I only provide guidance and occasionally edit some small bit where it is easier than asking
Also, it's important to remember that AI, much like a well-fed cat, requires a steady stream of attention and high-quality prompts to perform its best tricks. Neglect it, and you might just find it napping on your keyboard when you need it most.
-- Simo.
| Back | FazBrowse Home | New Git URL |