rushjs1 / nuxt-goto.nvim

'Go to Definition' on a vue component from within a nuxt project to the correct definition source.
7 stars 1 forks source link
lua neovim-plugin nuxt vue

Nuxt-goto.nvim

Similar to this vscode plugin but for neovim.

Purpose

Using lsp Go to Definition on a vue component in nuxt will take you to a .d.ts file. This plugin will redirect you to the correct definition source instead.

Please see Anthonys readme here for a better explanation on why this is necessary.

Installation

--Packer
use("rushjs1/nuxt-goto.nvim")

Usage

-- lspconfig.lua -- or wherever your lsp keymaps are set

-- enable keybinds for available lsp server
local on_attach = function(client, bufnr)
    local opts = { noremap = true, silent = true, buffer = bufnr }

    --set keybind for go to definition
    keymap.set("n", "gd", vim.lsp.buf.definition, opts)
end

Please ensure the .nuxt directory is present in your project