Skip to content

Instantly share code, notes, and snippets.

@phanirithvij
Created January 24, 2024 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phanirithvij/5ee6b0d61c1b30a910140811c864c37d to your computer and use it in GitHub Desktop.
Save phanirithvij/5ee6b0d61c1b30a910140811c864c37d to your computer and use it in GitHub Desktop.
go, lsp, minimal nvim
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
local uv = vim.uv or vim.loop
-- Auto-install lazy.nvim if not present
if not uv.fs_stat(lazypath) then
print('Installing lazy.nvim....')
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
})
print('Done.')
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
lazy = true,
config = false,
},
{
'neovim/nvim-lspconfig',
dependencies = {
{'hrsh7th/cmp-nvim-lsp'},
}
},
-- Autocompletion
{
'hrsh7th/nvim-cmp',
dependencies = {
{'L3MON4D3/LuaSnip'}
},
},
})
vim.cmd([[ set t_8f=^[[38;2;%lu;%lu;%lum ]])
vim.cmd([[ set t_8b=^[[48;2;%lu;%lu;%lum ]])
vim.opt.termguicolors = false
local lsp_zero = require('lsp-zero')
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr})
end)
require('mason').setup({})
require('mason-lspconfig').setup({
handlers = {
lsp_zero.default_setup,
},
})
-- https://github.com/williamboman/mason.nvim/issues/635#issuecomment-1304897092
vim.api.nvim_create_autocmd("FileType", {
pattern = "mason",
callback = function ()
vim.api.nvim_set_hl(0, "MasonNormal", { bg = "red" })
end
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "lazy",
callback = function ()
vim.api.nvim_set_hl(0, "LazyNormal", { bg = "red" })
end
})
@phanirithvij
Copy link
Author

Used it with Wezterm Batman colorscheme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment