go.nvim
go.nvim copied to clipboard
The plugin causes the Neovim start screen to flicker.
Thanks for making a good Go plugin for neovim, but here i found before loading the plugin, when opening neovim, the start screen is fixed in place. However, if the plugin is loaded, the start screen flickers and becomes a blank screen. How to fix ?
start screen:
blank screen
Here is config
require('go').setup()
vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').goimport() ]], false)
I have not see this before. Could you provide more context? e.g. your OS, nvim version. a minium config. Also the plugin has a default minium config in playground folder. Is the issue reproducible with https://github.com/ray-x/go.nvim/blob/master/playground/init_lazy.lua ?
@ray-x thanks for your reply, this is my environment:
- OS: macOS 13.3.1
- nvim: 0.9.0
- plugin config:
require('go').setup()
vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').goimport() ]], false)
my full config: https://github.com/MrZhang123/dotfiles/tree/master/nvim
maybe lazy load go.nvim for filetype go
, gomod
intead of all filetypes? I think one reason might be gopls starup time and startup check slow down the nvim.
In my case i had a similar issue with this plugin. Similar to what ray-x mentioned, the workaround for me that worked for me was lazy loading go.nvim and my gopls lsp config, although I'm not sure if this isn't ideal
{
"ray-x/go.nvim",
ft = "go",
config = function()
require("go").setup({
lsp_cfg = true,
goimport = "gopls", -- goimport command, can be gopls[default] or goimport
lsp_gofumpt = true, -- true: set default gofmt in gopls format to gofumpt
lsp_on_attach = require("lsp.on_attach").setup, -- use on_attach from go.nvim
lsp_diag_virtual_text = false, -- DO NOT overwrite my virtual text settings
luasnip = true,
lsp_inlay_hints = {
parameter_hints_prefix = "",
},
})
local cfg = require("go.lsp").config() -- config() return the go.nvim gopls setup
require("lspconfig").gopls.setup(cfg)
local format_sync_grp = vim.api.nvim_create_augroup("GoImport", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
callback = function()
require("go.format").goimport()
end,
group = format_sync_grp,
})
end,
lazy = true,
}