andrewferrier / treesitter-terraform-doc.nvim

A simple neovim plugin that use treesitter to find resource in context and open the url on your favorite web browser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Treesitter Terraform Doc

This is a simple plugin to open documentation of the current Terraform resource.

Features

Add the "OpenDoc" user command that opens the documentation of the resource targeted by the cursor in a terraform "hcl" file, directly into your default browser.

Requirements

Installation

  1. Install from your favorite package manager.
  2. Add the following to your terraform lsp config:
require('lspconfig').terraformls.setup {
    on_attach = function()
        -- This register the user command "OpenDoc" that you are able to bind to any key.
        require('treesitter-terraform-doc').setup()
        ...
    end,
    ...
}

Here is another example with the default config:

require('treesitter-terraform-doc').setup({
    command_name       = "OpenDoc",
    url_opener_command = "!open"
})

For example, on linux you could change it to:

require('treesitter-terraform-doc').setup({
    command_name       = "OpenDoc",
    url_opener_command = "!firefox"
})

in order to run the command with firefox.

Custom Provider

You can add or override provider by adding the following to your config:

require('treesitter-terraform-doc').setup({
    ...,
    provider = {
        prefix = "test",
        name   = "custom-provider-source"
    }
})

About

A simple neovim plugin that use treesitter to find resource in context and open the url on your favorite web browser.

License:MIT License


Languages

Language:Lua 100.0%