Rail's Neovim setup
I use AstroNvim as my neovim distro.
The up to date config can be found in my dotfiles repo.
The config uses AstroNvim abstraction, but it can be translated into regular neovim config by assigning the variables and functions to their neovim counterparts.
Some snippet are described below.
Use GOPACKAGESDRIVER
to speedup gopls
.
The following LSP config makes gopls
use GOPACKAGESDRIVER to use Bazel (rules_go) to expose package data.
---@type LazySpec
return {
"AstroNvim/astrolsp",
---@type AstroLSPOpts
opts = {
-- Configuration table of features provided by AstroLSP
features = {
inlay_hints = true, -- enable/disable inlay hints on start
},
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
-- clangd = { capabilities = { offsetEncoding = "utf-8" } },
gopls = {
env = {
-- TODO: make GOPACKAGESDRIVER project-specific
GOPACKAGESDRIVER = "./build/bazelutil/gopackagesdriver.sh",
},
directoryFilters = {
"-_bazel",
"-inflight_trace_dump",
},
},
},
},
}
Use crlfmt
to format Go files.
I use mason.nvim to manage crlfmt
and its config. Since this PR, crlfmt
can be managed by mason-tool-installer
and used bu conform.nvim.
---@type LazySpec
return {
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
opts = {
ensure_installed = { "crlfmt" },
},
},
{
"stevearc/conform.nvim",
opts = {
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
formatters = {
crlfmt = {
command = "crlfmt",
},
},
formatters_by_ft = {
go = { "crlfmt" },
},
},
},
}
Copyright (C) Cockroach Labs.
Attention: This documentation is provided on an "as is" basis, without warranties or conditions of any kind, either express or implied, including, without limitation, any warranties or conditions of title, non-infringement, merchantability, or fitness for a particular purpose.