GithubHelp home page GithubHelp logo

nvim-gtd's Introduction

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

---@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<CR>', 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

(Default: enabled)

Find definitions via LSP textDocument/definition.

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' }

nvim-gtd's People

Contributors

hrsh7th avatar uga-rosa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.