Merge branch 'master' into serverCapcities

This commit is contained in:
ray-x 2022-05-02 08:49:06 +10:00
commit 8cc8337343
4 changed files with 23 additions and 4 deletions

View File

@ -81,6 +81,12 @@ require('go').setup()
![gotest](https://user-images.githubusercontent.com/1681295/143160335-b8046ffa-82cd-4d84-af3e-3b0dbb4c609e.png) ![gotest](https://user-images.githubusercontent.com/1681295/143160335-b8046ffa-82cd-4d84-af3e-3b0dbb4c609e.png)
Use:
```vim
:GoTermClose
```
To close the floating term.
## refactor gorename ## refactor gorename
gorename as an alternative to gopls rename as it supports rename across packages gorename as an alternative to gopls rename as it supports rename across packages
@ -190,16 +196,17 @@ first run of `GoFmt` may fail. It is recommended to run `GoInstallBinaries` to i
| GoBuild | | | GoBuild | |
| GoGenerate | | | GoGenerate | |
| GoRun | e.g. GoRun equal to `go run .`; or `GoRun ./cmd` equal to `go run ./cmd` | | GoRun | e.g. GoRun equal to `go run .`; or `GoRun ./cmd` equal to `go run ./cmd` |
| GoStop {job_id} | `stop the job started with GoRun | | GoStop {job_id} | `stop the job started with GoRun` |
| GoTest | go test ./... | | GoTest | go test ./... |
| GoTest -c | go test -c current_file_path | | GoTest -c | go test -c current_file_path |
| GoTest -tags=yourtags | go test ./... -tags=yourtags | | GoTest -tags=yourtags | go test ./... -tags=yourtags |
| GoTest package_path -tags=yourtags | go test packagepath -tags=yourtags | | GoTest package_path -tags=yourtags | go test packagepath -tags=yourtags |
| GoTest package_path -tags=yourtags other_args | go test packagepath -tags=yourtags other_args | | GoTest package_path -tags=yourtags other_args | go test packagepath -tags=yourtags other_args |
| GoLint | golangci-lint | | GoLint | golangci-lint |
| GoGet {package_url} | go get package_url and restart gopls. Note1 | | GoGet {package_url} | go get package_url and restart gopls. Note1 |
| GoVet | go vet | | GoVet | go vet |
| GoCoverage | go test -coverprofile | | GoCoverage | go test -coverprofile |
| GoTermClose | `closes the floating term` |
Note1: if package_url not provided, will check current line is a valid package url or not, if it is valid, will Note1: if package_url not provided, will check current line is a valid package url or not, if it is valid, will
fetch current url fetch current url
@ -497,8 +504,8 @@ require('go').setup({
build_tags = "tag1,tag2", -- set default build tags build_tags = "tag1,tag2", -- set default build tags
textobjects = true, -- enable default text jobects through treesittter-text-objects textobjects = true, -- enable default text jobects through treesittter-text-objects
test_runner = 'go', -- richgo, go test, richgo, dlv, ginkgo test_runner = 'go', -- richgo, go test, richgo, dlv, ginkgo
run_in_floaterm = false, -- set to true to run in float window. run_in_floaterm = false, -- set to true to run in float window. :GoTermClose closes the floatterm
--float term recommand if you use richgo/ginkgo with terminal color -- float term recommand if you use richgo/ginkgo with terminal color
}) })
``` ```

View File

@ -270,6 +270,9 @@ COMMANDS *go-nvim-commands*
e.g. GoImpl {receiver} {interface}, will check if cursor is a valid e.g. GoImpl {receiver} {interface}, will check if cursor is a valid
receiver, if you park cursor on struct name, receiver can be omitted. receiver, if you park cursor on struct name, receiver can be omitted.
e.g ":GoImpl io.Reader", or "GoImpl f *File io.Reader" e.g ":GoImpl io.Reader", or "GoImpl f *File io.Reader"
:GoTermClose
Closes the floating term.
============================================================================== ==============================================================================
OPTIONS *go-nvim-options* OPTIONS *go-nvim-options*

View File

@ -117,6 +117,7 @@ function go.setup(cfg)
[[command! -nargs=* -complete=custom,v:lua.package.loaded.go.package_complete GoTest lua require('go.gotest').test(<f-args>)]] [[command! -nargs=* -complete=custom,v:lua.package.loaded.go.package_complete GoTest lua require('go.gotest').test(<f-args>)]]
) )
vim.cmd( vim.cmd(
[[command! -nargs=* -complete=custom,v:lua.package.loaded.go.package_complete GoCoverage lua require'go.coverage'.run(<f-args>)]] [[command! -nargs=* -complete=custom,v:lua.package.loaded.go.package_complete GoCoverage lua require'go.coverage'.run(<f-args>)]]
) )
@ -195,6 +196,12 @@ function go.setup(cfg)
vim.cmd([[command! GoDbgStop lua require'go.dap'.stop()]]) vim.cmd([[command! GoDbgStop lua require'go.dap'.stop()]])
end end
if _GO_NVIM_CFG.run_in_floaterm then
vim.cmd(
[[command! -nargs=* GoTermClose lua require("go.term").close()]]
)
end
if _GO_NVIM_CFG.lsp_cfg then if _GO_NVIM_CFG.lsp_cfg then
require("go.lsp").setup() require("go.lsp").setup()
if _GO_NVIM_CFG.lsp_diag_hdlr then if _GO_NVIM_CFG.lsp_diag_hdlr then

View File

@ -20,6 +20,8 @@ local function close_float_terminal()
end end
local term = function(opts) local term = function(opts)
close_float_terminal()
local columns = api.nvim_get_option("columns") local columns = api.nvim_get_option("columns")
local lines = api.nvim_get_option("lines") local lines = api.nvim_get_option("lines")