show cheatsheet in floating window

pull/135/head
ray-x 2 years ago
parent 9d7845707d
commit fc928a40e9

@ -39,14 +39,17 @@ Also Run `TSInstall go` to install the go parser if not installed yet.
```vim
Plug 'ray-x/go.nvim'
Plug 'ray-x/guihua.lua' ; recommanded if need floating window support
```
### [packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use 'ray-x/go.nvim'
use 'ray-x/guihua.lua' -- recommanded if need floating window support
```
Make sure the `$GOPATH/bin` path is added to your `$PATH` environment variable. To check this you can run
```bash
@ -70,27 +73,6 @@ To startup/setup the plugin
```lua
require('go').setup()
```
## Project setup
`go.nvim` allow you override your setup by a project file. Put `.gonvim/init.lua` in your root folder. It is a small lua
script and will be run durning go.setup(). The return value is used to override `go.nvim` setup. The sample project
setup. You can check the youtube video [here](https://www.youtube.com/watch?v=XrxSUp0E9Qw) on how to use this feature.
```lua
-- .gonvim/init.lua project config
vim.g.null_ls_disable = true
return {
go = "go", -- set to go1.18beta1 if necessary
goimport = "gopls", -- if set to 'gopls' will use gopls format, also goimport
fillstruct = "gopls",
gofmt = "gofumpt", -- if set to gopls will use gopls format
max_line_len = 120
null_ls_document_formatting_disable = true
}
```
This will override your global `go.nvim` setup
## Screenshots
@ -578,6 +560,28 @@ e.g
```
## Project setup
`go.nvim` allow you override your setup by a project file. Put `.gonvim/init.lua` in your root folder. It is a small lua
script and will be run durning go.setup(). The return value is used to override `go.nvim` setup. The sample project
setup. You can check the [youtube video here](https://www.youtube.com/watch?v=XrxSUp0E9Qw) on how to use this feature.
```lua
-- .gonvim/init.lua project config
vim.g.null_ls_disable = true
return {
go = "go", -- set to go1.18beta1 if necessary
goimport = "gopls", -- if set to 'gopls' will use gopls format, also goimport
fillstruct = "gopls",
gofmt = "gofumpt", -- if set to gopls will use gopls format
max_line_len = 120
null_ls_document_formatting_disable = true
}
```
This will override your global `go.nvim` setup
## Text object
I did not provide textobject support in the plugin. Please use treesitter textobject plugin.
@ -768,6 +772,8 @@ EOF
This will setup gopls with non default configure provided by go.nvim (Includes lspconfig default keymaps)
Q & A:
## Q & A:
Q: What is `Toggle gc annotation details`
A: This is a codelens message, please run codelens `GoCodeLenAct` and get more info

@ -18,11 +18,24 @@ local run = function(...)
-- log(data)
if #data > 0 then
data = vim.list_slice(data, 4, #data)
local name = vim.fn.tempname() .. ".go"
vim.fn.writefile(data, name)
cmd = " silent exe 'e " .. name .. "'"
vim.cmd(cmd)
vim.cmd("e")
local TextView = utils.load_plugin("guihua.lua", "guihua.textview")
if TextView then
local win = TextView:new({
loc = "top_center",
syntax = "go",
rect = { height = #data, pos_x = 0, pos_y = 4 },
data = data,
enter = true,
})
log("draw data", data)
win:on_draw(data)
else
local name = vim.fn.tempname() .. ".go"
vim.fn.writefile(data, name)
cmd = " silent exe 'e " .. name .. "'"
vim.cmd(cmd)
vim.cmd("e")
end
end
end
return { run = run }

Loading…
Cancel
Save