Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crusj/structrue-go.nvim

A better structured display of golang symbols information
https://github.com/crusj/structrue-go.nvim

go lua neovim nvim-plugin structures vim

Last synced: 13 days ago
JSON representation

A better structured display of golang symbols information

Awesome Lists containing this project

README

        

# structrue-go.nvim
A more intuitive display of the symbol structure of golang files.

## Description
Fast, asynchronous, intuitive, collapsible, automatic, show all methods even if they are not in the same file as the corresponding type and more.

## Screenshots

## Install

### Requirement

**neovim >= 0.7**

**gotags**

```shell
go get -u github.com/jstemmer/gotags
```

### Installation

**Use your favorite package management tool**

**With Packer**

```lua
use {
'crusj/structrue-go.nvim',
branch = "main"
}
```

**Or**

```shell
git clone https://github.com/crusj/structrue-go.nvim.git ~/.local/share/nvim/site/pack/plugins/start/structrue-go.nvim
```

## Usage

### Start

```lua
require"structrue-go".setup()
```

### Default config

```lua
require"structrue-go".setup({
show_others_method = true, -- bool show methods of struct whose not in current file
show_filename = true, -- bool
number = "no", -- show number: no | nu | rnu
fold_open_icon = " ",
fold_close_icon = " ",
cursor_symbol_hl = "guibg=Gray guifg=White", -- symbol hl under cursor,
indent = "┠", -- Hierarchical indent icon, nil or empty will be a tab
position = "botright", -- window position,default botright,also can set float
symbol = { -- symbol style
filename = {
hl = "guifg=#0096C7", -- highlight symbol
icon = " " -- symbol icon
},
package = {
hl = "guifg=#0096C7",
icon = " "
},
import = {
hl = "guifg=#0096C7",
icon = " ◈ "
},
const = {
hl = "guifg=#E44755",
icon = " π ",
},
variable = {
hl = "guifg=#52A5A2",
icon = " ◈ ",
},
func = {
hl = "guifg=#CEB996",
icon = "  ",
},
interface = {
hl = "guifg=#00B4D8",
icon = "❙ "
},
type = {
hl = "guifg=#00B4D8",
icon = "▱ ",
},
struct = {
hl = "guifg=#00B4D8",
icon = "❏ ",
},
field = {
hl = "guifg=#CEB996",
icon = " ▪ "
},
method_current = {
hl = "guifg=#CEB996",
icon = " ƒ "
},
method_others = {
hl = "guifg=#CEB996",
icon = "  "
},
},
keymap = {
toggle = "m", -- toggle structure-go window
show_others_method_toggle = "H", -- show or hidden the methods of struct whose not in current file
symbol_jump = "", -- jump to then symbol file under cursor
center_symbol = "\\f", -- Center the highlighted symbol
fold_toggle = "\\z",
refresh = "R", -- refresh symbols
preview_open = "P", -- preview symbol context open
preview_close = "\\p" -- preview symbol context close
},
fold = { -- fold symbols
import = true,
const = false,
variable = false,
type = false,
interface = false,
func = false,
},
})

```

### keymap

| Keymap | Action | Description |
| ----------------------- | ------------------------------------------------------------------------ | --------------------------------------------------------------- |
| ```m``` | ```:lua require'structrue-go'.toggle()``` | Toggle structure-go |
| | ```:lua require'structrue-go'.close()``` | Close structrue-go |
| | ```:lua require'structrue-go'.open()``` | Open structrue-go |
| ```H``` | ```:lua require'structrue-go'.hide_others_methods_toggle()``` | Show or hidden the methods of struct whose not in current file|
| `````` | ```:lua require'structrue-go'.jump()``` | Jump to the symbol file under cursor |
| ```R``` | ```:lua require'structrue-go'.refresh()``` | Refresh symbols |
| ```z``` | ```:lua require'structrue-go'.fold_toggle()``` | Toggle fold |
| ```P``` | ```:lua require'structrue-go'.preview_open()``` | Preview symbol context |
| ```\p``` | ```:lua require'structrue-go'.preview_close()``` | Close preview symbol context |
| ```f``` | ```:lua require'structrue-go'.center_symbol()``` | Center the highlighted symbol |

## Thanks

JetBrains Logo (Main) logo.