A fast and minimal Go interface implementation plugin powered by Neovim's built-in LSP client and Treesitter.
go-impl.nvim_Demo.mp4
- Built on Neovim primitives
Leverages the native LSP client (vim.lsp), Treesitter, andvim.system()for async subprocess management. No heavy dependencies. - Fully Asynchronous
Non-blocking LSP requests, interface selection, andimplexecution for a seamless experience. - Smart Receiver Detection
Uses Treesitter to locate the struct under the cursor and predict a sensible receiver abbreviation. - Multi-Picker Support
Works with snacks.nvim (recommended, bundled with LazyVim), fzf-lua, or telescope.nvim. Auto-detected based on availability. - Generic Parameters Support
Interactive input for each type parameter with highlighting and live preview of the interface declaration.
- Neovim >= 0.12.0
- josharian/impl (
go install github.com/josharian/impl@latest) - MunifTanjim/nui.nvim
- A fuzzy finder (choose one):
- folke/snacks.nvim (recommended, bundled with LazyVim)
- ibhagwan/fzf-lua
- nvim-telescope/telescope.nvim
Install with lazy.nvim
{
"fang2hou/go-impl.nvim",
ft = "go",
dependencies = {
"MunifTanjim/nui.nvim",
-- Choose one of the following fuzzy finder
"folke/snacks.nvim",
"ibhagwan/fzf-lua",
"nvim-telescope/telescope.nvim",
},
opts = {},
keys = {
{
"<leader>Gi",
function()
require("go-impl").open()
end,
mode = { "n" },
desc = "Go Impl",
},
},
}- Open a Go file and place the cursor on a struct.
- Run
:GoImplOpenor:lua require("go-impl").open(). - Confirm the receiver, pick an interface, fill in any generic type parameters.
The defaults work out of the box. See config.lua for all options.
require("go-impl").setup({
-- explicitly pick a picker, or leave nil for auto-detection
picker = nil, -- "snacks" | "fzf_lua" | "telescope"
insert = {
position = "after", -- "after" | "before" | "end"
before_newline = true,
after_newline = false,
},
})- edolphin-ydf/goimpl.nvim -- original inspiration. Telescope-based, partial generic support.
- olexsmir/gopher.nvim -- manual argument input, no generic interface support.
- fatih/vim-go -- full-featured Go development plugin for Vim.
- rhysd/vim-go-impl -- thin
implwrapper requiring manual input.
MIT