Skip to content
Back to search

nvim-gemini-companion

A Neovim plugin to integrate Gemini CLI well (+ Qwen-code now)

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/gutsavgupta--nvim-gemini-companion/badge.svg)](/listings/gutsavgupta--nvim-gemini-companion)

HTML

<a href="/listings/gutsavgupta--nvim-gemini-companion"><img src="/api/listings/gutsavgupta--nvim-gemini-companion/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Pre-requisites

Install any (or all) of these CLI tools and ensure they're in your system's `PATH`:

* [gemini-cli](https://github.com/google-gemini/gemini-cli) * [qwen-code](https://github.com/QwenLM/qwen-code) * [claude-code](https://github.com/anthropics/claude-code)

The plugin auto-detects which of these are installed, so no extra configuration is needed to get started.

Installation

Install with your favorite plugin manager:

{
  "gutsavgupta/nvim-gemini-companion",
  dependencies = { "nvim-lua/plenary.nvim" },
  event = "VeryLazy",
  config = function()
    require("gemini").setup()
  end,
  keys = {
    { "<leader>gg", "<cmd>GeminiToggle<cr>", desc = "Toggle Gemini sidebar" },
    { "<leader>gc", "<cmd>GeminiSwitchToCli<cr>", desc = "Spawn or switch to AI session" },
    { '<leader>gS', '<cmd>GeminiSend<cr>', mode = { 'x' }, desc = 'Send selection to Gemini' },

  }
}

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 172 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # nvim-gemini-companion
  2. 🚀 Now with Triple Agent Support (Gemini, Qwen & Claude Code)! 🤖
  3. `nvim-gemini-companion` brings the power of AI agents like Gemini, Qwen and Claude Code directly into your Neovim workflow. 🌟 Enjoy seamless diff views, agent management, and smart file modifications without leaving your editor. **Inspired by the vscode-gemini-companion extension**
  4. Unlike other Gemini plugins for Neovim, nvim-gemini-companion is built around the MCP backend, which keeps your editor session tightly integrated with your IDE for much better experience ✨
  5. https://github.com/user-attachments/assets/90370aa6-1ae2-477c-8529-0f26e32bdff8
  6. ## 🚀 Quick Start
  7. ### Pre-requisites
  8. Install any (or all) of these CLI tools and ensure they're in your system's `PATH`:
  9. * [gemini-cli](https://github.com/google-gemini/gemini-cli)
  10. * [qwen-code](https://github.com/QwenLM/qwen-code)
  11. * [claude-code](https://github.com/anthropics/claude-code)
  12. The plugin auto-detects which of these are installed, so no extra configuration is needed to get started.
  13. ### Installation
  14. Install with your favorite plugin manager:
  15. ```lua
  16. {
  17. "gutsavgupta/nvim-gemini-companion",
  18. dependencies = { "nvim-lua/plenary.nvim" },
  19. event = "VeryLazy",
  20. config = function()
  21. require("gemini").setup()
  22. end,
  23. keys = {
  24. { "<leader>gg", "<cmd>GeminiToggle<cr>", desc = "Toggle Gemini sidebar" },
  25. { "<leader>gc", "<cmd>GeminiSwitchToCli<cr>", desc = "Spawn or switch to AI session" },
  26. { '<leader>gS', '<cmd>GeminiSend<cr>', mode = { 'x' }, desc = 'Send selection to Gemini' },
  27. }
  28. }
  29. ```
  30. ## 🛠️ Essential Commands & Features
  31. ### Core Commands
  32. - `:GeminiToggle` - Toggle the AI sidebar
  33. - `:GeminiSwitchToCli` - Spawn or Switch to tmux/sidebar sessions
  34. - `:GeminiSend` - Send selected text to AI (use in visual mode)
  35. - `:GeminiSendLineDiagnostic` - Send line diagnostics to AI
  36. - `:GeminiSendFileDiagnostic` - Send file diagnostics to AI
  37. - `:GeminiSwitchSidebarStyle` - Switch the appearance/style of the sidebar
  38. ### Sidebar Terminal Switching
  39. When multiple commands are configured (e.g., both `gemini` and `qwen`), you can switch between active sidebar terminals using default key mappings:
  40. - `<M-]>` - Switch to the next active terminal (Alt + ])
  41. - `<M-[>` - Switch to the previous active terminal (Alt + [)
  42. To customize these key bindings, you can override the default mappings in your setup function:
  43. ```lua
  44. require("gemini").setup({
  45. cmds = { "gemini", "qwen" },
  46. -- Override default key mappings
  47. on_buf = function(buf)
  48. -- Add your own custom mappings
  49. vim.api.nvim_buf_set_keymap(buf, 't', '<Tab>',
  50. '<Cmd>lua require("gemini.ideSidebar").switchSidebar()<CR>',
  51. { noremap = true, silent = true }
  52. )
  53. vim.api.nvim_buf_set_keymap(buf, 't', '<S-Tab>',
  54. '<Cmd>lua require("gemini.ideSidebar").switchSidebar("prev")<CR>',
  55. { noremap = true, silent = true }
  56. )
  57. end
  58. })
  59. ```
  60. **Note:** Be aware that `<Tab>` and `<S-Tab>` may already be mapped to other functionality by the Gemini/Qwen CLIs themselves, so using these keys for terminal switching might interfere with their built-in features. Consider using alternative key bindings such as `<C-Tab>` and `<C-S-Tab>` or the default Alt-based mappings instead.
  61. ### Diff Management
  62. When AI suggests changes, you can:
  63. - `:w` or `:wq` - Accept changes
  64. - `:q` or `:q!` - Reject changes
  65. - `:GeminiAccept` / `:GeminiReject` - Plugin-specific commands
  66. ### Tmux Integration (Optional)
  67. Run AI agents in persistent tmux sessions:
  68. - `:GeminiSwitchToCli tmux gemini` - Use Gemini in tmux
  69. - `:GeminiSwitchToCli sidebar qwen` - Use Qwen in sidebar
  70. ## 🎛️ Customization Options
  71. ### Sidebar Styles
  72. Choose from multiple sidebar presets:
  73. ```lua
  74. require("gemini").setup({
  75. win = {
  76. preset = "floating", -- Options: "right-fixed", "left-fixed", "bottom-fixed", "floating"
  77. width = 0.8,
  78. height = 0.8,
  79. }
  80. })
  81. ```
  82. ### Multi-Agent Support
  83. By default the plugin **auto-detects** which agents are installed (`gemini`, `qwen`, `claude`) and enables all of them — so most users don't need to set `cmds` at all. An explicit `cmds`/`cmd` always takes precedence over auto-detection:
  84. ```lua
  85. require("gemini").setup() -- auto-detect installed agents (recommended)
  86. require("gemini").setup({ cmds = { "claude" } }) -- use only Claude Code
  87. require("gemini").setup({ cmds = { "gemini", "qwen", "claude" } }) -- pin all three
  88. ```
  89. > **Claude Code:** the Claude integration uses a WebSocket MCP server with lock-file discovery (under `~/.claude/ide/`) and a per-session auth token. It starts automatically only when `claude` is both installed **and** part of the effective `cmds`. Launch `claude` from the sidebar/tmux and it connects on its own — diffs, selection, open editors, and diagnostics all work out of the box.
  90. ## ⚙️ Advanced Configuration
  91. ### Enhanced Picker Integration
  92. Replace default selection UI with fzf-lua/telescope:
  93. ```lua
  94. -- For fzf-lua integration
  95. vim.ui.select = function(items, opts, onChoice)
  96. require('fzf-lua').fzf_exec(items, {
  97. prompt = opts.prompt or 'Select from items',
  98. actions = {
  99. ['default'] = function(selected) onChoice(selected[1]) end,
  100. },
  101. winopts = { height = math.min(0.2 + #items * 0.05, 0.6) },
  102. })
  103. end
  104. ```
  105. ### Key Mappings for Quick Access
  106. ```lua
  107. keys = {
  108. { "<leader>g1", "<cmd>GeminiSwitchToCli tmux gemini<cr>", desc = "Tmux Gemini" },
  109. { "<leader>g2", "<cmd>GeminiSwitchToCli tmux qwen<cr>", desc = "Tmux Qwen" },
  110. { "<leader>gs", "<cmd>GeminiSwitchSidebarStyle<cr>", desc = "Switch sidebar style" },
  111. }
  112. ```
  113. ## 📸 Screenshots
  114. ![Gemini](https://raw.githubusercontent.com/gutsavgupta/nvim-gemini-companion/main/assets/Gemini-20250928.png)
  115. -------
  116. ![Qwen](https://raw.githubusercontent.com/gutsavgupta/nvim-gemini-companion/main/assets/Qwen-20250928.png)
  117. ## ✨ Key Features
  118. * **Diff Control:** Auto diff views, accept or reject suggestions directly from vim using `:wq` or `:q`.
  119. * **CLI Agent:** Dedicated terminal session for interacting with AI agents
  120. * **Multi-Agent Support:** Run `gemini`, `qwen-code`, and `claude-code` agents simultaneously
  121. * **Claude Code Integration:** WebSocket MCP transport with lock-file discovery + auth; auto-connects, native diffs, live context
  122. * **Tmux Integration:** Persistent sessions with state across nvim restarts
  123. * **Context Management:** Tracks open files, cursor position, and selections for AI context
  124. * **LSP Diagnostics:** Send file/line diagnostics to AI agents for enhanced debugging
  125. * **Visual Selection:** Send selected text + prompt directly to AI agents using `:GeminiSend`
  126. * **Flexible Sidebar:** Choose between `right-fixed`, `left-fixed`, `bottom-fixed`, or `floating` styles
  127. * **Highly Customizable:** Configure commands, window styles, and key bindings to your liking
  128. ## 🔧 For Developers
  129. Run tests with:
  130. ```bash
  131. XDG_CONFIG_HOME=./tests nvim --headless -c "PlenaryBustedDirectory tests"
  132. ```
  133. ## 🔄 Roadmap
  134. * **Amazon-cli** agent
  135. * **More cli-agents** (similar to gemini-cli or forked versions)
  136. * **ACP Protocol:** Implement ACP protocol support for deeper integration.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.