A Neovim plugin for interacting with the Devin AI API.
- Create and manage Devin AI sessions
- Send messages to Devin sessions
- View session details and responses
- Send visual selections or entire files as messages
- Customizable keybindings
- View API responses in separate buffers
Using lazy.nvim
return {
"yourusername/devin.nvim",
config = function()
require("devin").setup({
-- Optional custom configuration
mappings = {
visual = "<Leader>dv", -- Send visual selection to Devin
file = "<Leader>df", -- Send entire file to Devin
},
dotenv_path = vim.fn.stdpath("config") .. "/.env" -- Path to .env file containing DEVIN_API_KEY
})
end,
}
Using packer.nvim
use {
'yourusername/devin.nvim',
config = function()
require('devin').setup()
end
}
You can customize the plugin by passing configuration options to the setup function:
require('devin').setup({
api_key = "your-devin-api-key", -- Optional: Set your API key here (not recommended for shared configs)
snapshot_id = "your-custom-snapshot-id",
playbook_id = "your-custom-playbook-id",
mappings = {
visual = "<Leader>dv",
file = "<Leader>df",
},
create_commands = true, -- Whether to create commands
dotenv_path = "path/to/your/.env" -- Custom path to .env file
})
You have three options to set your Devin API key:
-
Environment variable (recommended): Set the
DEVIN_API_KEY
environment variableexport DEVIN_API_KEY="your_api_key_here"
-
Neovim global variable: Set it in your config before calling setup
vim.g.devin_api_key = "your_api_key_here" require('devin').setup()
-
Configuration option: Pass it directly in setup (not recommended for shared configs)
require('devin').setup({ api_key = "your_api_key_here", })
-
Using dotenv.nvim: Store your API key in a
.env
fileDEVIN_API_KEY=your_api_key_here
And make sure to install and configure dotenv.nvim
-
Create a new session:
:DevinCreateSession Write a script to analyze log files
-
Get session details (uses active session if none specified):
:DevinGetSession :DevinGetSession devin-session-id
-
Set the active session:
:DevinSetActiveSession devin-session-id
-
Send a message to the active session:
:DevinSendMessage Let's focus on performance optimization
-
Send visually selected text to the active session:
- Select text in visual mode (v)
- Press
<Leader>dv
(default)
-
Send the entire current file to the active session:
- Press
<Leader>df
(default)
- Press
-
Set your API key:
:DevinSetApiKey your-api-key-here
-
Set custom snapshot and playbook IDs:
:DevinSetIds snapshot-id playbook-id
MIT