A Neovim plugin to copy the Fully Qualified Name (FQN) of the symbol under cursor to clipboard.
Similar to the "Copy Reference" feature in JetBrains IDEs (PHPStorm, IntelliJ, etc.).
- 📋 Copy fully qualified method/function/class names to clipboard
- 🌍 Multi-language support via LSP (PHP, Python, Rust, Go, TypeScript)
- 🔧 Language-aware separators (e.g.,
\for PHP namespaces,::for Rust) - 📢 Optional notification on copy
- ⌨️ Customizable keymaps
- Neovim >= 0.8.0
- A working LSP server for your language
{
'your-username/fqn.nvim',
config = function()
require('fqn').setup()
end,
}use {
'your-username/fqn.nvim',
config = function()
require('fqn').setup()
end,
}require('fqn').setup({
-- Keymap to copy FQN (set to false to disable)
keymap = '<leader>fy',
-- Show notification after copying
notify = true,
-- Language-specific settings (optional, these are defaults)
languages = {
php = {
namespace_separator = '\\',
method_separator = '::',
},
python = {
separator = '.',
},
rust = {
separator = '::',
},
go = {
separator = '.',
},
typescript = {
separator = '.',
},
},
}):FqnCopy- Copy the FQN of the symbol under cursor
-- Copy FQN to clipboard and show notification
require('fqn').copy()
-- Get FQN as string (without copying)
local fqn = require('fqn').get()<leader>fy- Copy FQN (mnemonic: "fully qualified yank")
| Language | Symbol Location | Result |
|---|---|---|
| PHP | Method save in App\User |
App\User::save() |
| Python | Method run in myapp.tasks.Task |
myapp.tasks.Task.run |
| Rust | Function parse in crate::parser |
crate::parser::parse |
| Go | Method Run in pkg.Service |
pkg.Service.Run |
| TypeScript | Method fetch in api.Client |
api.Client.fetch |
- Queries the LSP server for document symbols (
textDocument/documentSymbol) - Finds the symbol hierarchy at the cursor position
- Builds the FQN using language-specific separators
- Copies to system clipboard and optionally shows a notification
| Language | LSP Server | Status |
|---|---|---|
| PHP | intelephense / phpactor | ✅ |
| Python | pyright / pylsp | ✅ |
| Rust | rust-analyzer | ✅ |
| Go | gopls | ✅ |
| TypeScript | typescript-language-server | ✅ |
Create a new file in lua/fqn/languages/ following this template:
local M = {}
M.filetypes = { 'yourlang' }
M.config = {
separator = '.',
}
function M.build_fqn(symbols, config)
-- Custom FQN building logic
return table.concat(symbols, config.separator)
end
return MThen register it in lua/fqn/languages/init.lua.
MIT