Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Afourcat/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.
https://github.com/Afourcat/treesitter-terraform-doc.nvim
lsp neovim neovim-plugin plugin terraform
Last synced: 8 days ago
JSON representation
A simple neovim plugin that use treesitter to find resource in context and open the url on your favorite web browser.
- Host: GitHub
- URL: https://github.com/Afourcat/treesitter-terraform-doc.nvim
- Owner: Afourcat
- License: mit
- Created: 2022-09-10T23:19:45.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-21T10:24:02.000Z (over 1 year ago)
- Last Synced: 2024-08-01T16:44:46.689Z (3 months ago)
- Topics: lsp, neovim, neovim-plugin, plugin, terraform
- Language: Lua
- Homepage:
- Size: 23.4 KB
- Stars: 21
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
- git
- [Neovim](https://github.com/neovim/neovim) ≥ 0.5
- [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter) and the hcl parser
- MacOS (by default)## Installation
1. Install from your favorite package manager.
2. Add the following to your terraform lsp config:```lua
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:
```lua
require('treesitter-terraform-doc').setup({
-- The vim user command that will trigger the plugin.
command_name = "OpenDoc",-- The command that will take the url as a parameter.
url_opener_command = "!open"-- If true, the cursor will jump to the anchor in the documentation.
jump_argument = true
})
```For example, on linux you could change it to:
```lua
require('treesitter-terraform-doc').setup({
command_name = "OpenDoc",
url_opener_command = "!firefox"
jump_argument = true
})
```
in order to run the command with firefox.## Custom Provider
You can add or override provider by adding the following to your config:
```lua
require('treesitter-terraform-doc').setup({
...,
provider = {
prefix = "test",
name = "custom-provider-source"
}
})
```