Add go.nvim + wsl optimizations

main
Gabe Farrell 2 years ago
parent 63046022c9
commit 8e6e367f7a

@ -5,12 +5,12 @@
local M = {}
M.ui = {
theme = "onedark",
theme = "yoru",
-- hl_override = {
-- Comment = { italic = true },
-- ["@comment"] = { italic = true },
-- },
hl_override = {
Comment = { italic = true },
["@comment"] = { italic = true },
},
}
return M

@ -1,15 +1,15 @@
local options = {
formatters_by_ft = {
lua = { "stylua" },
-- css = { "prettier" },
-- html = { "prettier" },
css = { "prettier" },
html = { "prettier" },
},
-- format_on_save = {
-- -- These options will be passed to conform.format()
-- timeout_ms = 500,
-- lsp_fallback = true,
-- },
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_fallback = true,
},
}
require("conform").setup(options)

@ -0,0 +1 @@
require("go").setup()

@ -4,7 +4,7 @@ local on_init = require("nvchad.configs.lspconfig").on_init
local capabilities = require("nvchad.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
local servers = { "html", "cssls" }
local servers = { "html", "cssls", "gopls" }
-- lsps with default config
for _, lsp in ipairs(servers) do

@ -1,12 +1,12 @@
require "nvchad.options"
-- add yours here!
vim.opt.mouse=''
vim.opt.mouse = ""
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
once = true,
callback = function()
if vim.fn.has("win32") == 1 or vim.fn.has("wsl") == 1 then
if vim.fn.has "win32" == 1 or vim.fn.has "wsl" == 1 then
vim.g.clipboard = {
copy = {
["+"] = "win32yank.exe -i --crlf",
@ -17,8 +17,8 @@ vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
["*"] = "win32yank.exe -o --lf",
},
}
elseif vim.fn.has("unix") == 1 then
if vim.fn.executable("xclip") == 1 then
elseif vim.fn.has "unix" == 1 then
if vim.fn.executable "xclip" == 1 then
vim.g.clipboard = {
copy = {
["+"] = "xclip -selection clipboard",
@ -29,7 +29,7 @@ vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
["*"] = "xclip -selection clipboard -o",
},
}
elseif vim.fn.executable("xsel") == 1 then
elseif vim.fn.executable "xsel" == 1 then
vim.g.clipboard = {
copy = {
["+"] = "xsel --clipboard --input",
@ -47,5 +47,16 @@ vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
end,
desc = "Lazy load clipboard",
})
-- local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!
-- go.nvim opts
local format_sync_grp = vim.api.nvim_create_augroup("goimports", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
callback = function()
require("go.format").goimports()
end,
group = format_sync_grp,
})
local o = vim.o
o.cursorlineopt = "both" -- to enable cursorline!

@ -1,31 +1,52 @@
return {
{
"stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save
event = "BufWritePre", -- uncomment for format on save
config = function()
require "configs.conform"
end,
},
{
"ray-x/go.nvim",
lazy = false,
dependencies = { -- optional packages
-- "ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require "configs.go"
end,
event = { "CmdlineEnter" },
ft = { "go", "gomod", "gowork", "gotmpl" },
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
},
-- These are some examples, uncomment them if you want to see them work!
-- {
-- "neovim/nvim-lspconfig",
-- config = function()
-- require("nvchad.configs.lspconfig").defaults()
-- require "configs.lspconfig"
-- end,
-- },
--
-- {
-- "williamboman/mason.nvim",
-- opts = {
-- ensure_installed = {
-- "lua-language-server", "stylua",
-- "html-lsp", "css-lsp" , "prettier"
-- },
-- },
-- },
--
{
"neovim/nvim-lspconfig",
config = function()
require("nvchad.configs.lspconfig").defaults()
require "configs.lspconfig"
end,
},
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"lua-language-server",
"stylua",
"html-lsp",
"css-lsp",
"prettier",
"gopls",
"goimports",
"golines",
"gofumpt",
},
},
},
-- {
-- "nvim-treesitter/nvim-treesitter",
-- opts = {

Loading…
Cancel
Save