Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hrsh7th/nvim-gtd
LSP's Go to definition plugin for neovim.
https://github.com/hrsh7th/nvim-gtd
neovim neovim-plugins
Last synced: 1 day ago
JSON representation
LSP's Go to definition plugin for neovim.
- Host: GitHub
- URL: https://github.com/hrsh7th/nvim-gtd
- Owner: hrsh7th
- Created: 2022-11-28T17:11:13.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-18T01:06:22.000Z (5 months ago)
- Last Synced: 2024-11-09T05:14:04.410Z (9 days ago)
- Topics: neovim, neovim-plugins
- Language: Lua
- Homepage:
- Size: 85.9 KB
- Stars: 36
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nvim-gtd
LSP's Go To Definition plugin for neovim.
This plugin is highly experimental.
The breaking changes will be applied without notice.# Concept
- Run `textDocument/definition` and `gf` in one mapping.
- Open the path as much as possible# Usage
```lua
---@class gtd.kit.App.Config.Schema
---@field public sources { name: string, option?: table }[] # Specify the source that will be used to search for the definition
---@field public get_buffer_path fun(): string # Specify the function to get the current buffer path. It's useful for searching path from terminal buffer etc.
---@field public on_event fun(event: gtd.Event)
---@field public on_context fun(context: gtd.Context) # Modify context on user-land.
---@field public on_cancel fun(params: gtd.Params)
---@field public on_nothing fun(params: gtd.Params)
---@field public on_location fun(params: gtd.Params, location: gtd.kit.LSP.LocationLink)
---@field public on_locations fun(params: gtd.Params, locations: gtd.kit.LSP.LocationLink[])-- The `findup` and `lsp` source are enabled by default (at the moment).
require('gtd').setup {
... gtd.kit.App.Config.Schema ...
}vim.keymap.set('n', 'gf', function()
require('gtd').exec({ command = 'edit' })
end)
vim.keymap.set('n', 'gfs', function()
require('gtd').exec({ command = 'split' })
end)
vim.keymap.set('n', 'gfv', function()
require('gtd').exec({ command = 'vsplit' })
end)
```# Sources
The following sources are built-in.
#### lsp_definition
(Default: enabled)
Find definitions via LSP `textDocument/definition`.
#### lsp_type_definition
(Default: enabled)
Find definitions via LSP `textDocument/typeDefinition`.
#### lsp_implementation
(Default: enabled)
Find definitions via LSP `textDocument/implementation`.
#### findup
(Default: enabled)
Find definitions via `vim.fn.findfile` with `;` flag.
#### walk
(Default: disabled)
Traverse all filepaths under project.
|option-name|type|description|
|-----------|----|-----------|
|root_markers|string[]|Specify root markers like `{ '.git', 'tsconfig.json' }`.|
|ignore_patterns|string[]|Specify ignore patterns like `{ '/node_modules', '/.git' }`|