unix-config/.config/nvim/init.lua

101 lines
2.4 KiB
Lua

-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Basic Vim config
vim.cmd("autocmd!")
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
vim.scriptencoding = 'utf-8'
vim.opt.encoding = 'utf-8'
vim.opt.fileencoding = 'utf-8'
vim.wo.relativenumber = true
vim.wo.number = true
vim.opt.title = true
vim.opt.autoindent = true
vim.opt.smartindent = true
vim.opt.smarttab = true
vim.opt.expandtab = true
vim.opt.breakindent = true
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.mouse = "a"
vim.opt.undofile = true
vim.opt.undodir = vim.fn.expand('~/.vim/undodir')
vim.opt.wrap = true
vim.opt.linebreak = true
vim.opt.breakindent = true
vim.opt.breakindentopt = "shift:2,min:40,sbr"
-- Plugin setup
require("lazy").setup({
spec = {
{
"catppuccin/nvim",
name = "catppuccin",
lazy = false,
priority = 1000
},
{ "neovim/nvim-lspconfig" },
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-buffer" }
},
install = {},
checker = { enabled = true }
})
-- Colour setup
require("catppuccin").setup({
flavour = "mocha", -- latte, frappe, macchiato, mocha
background = {
light = "latte",
dark = "mocha",
},
transparent_background = false,
no_italic = false,
no_bold = false,
styles = {
comments = { "italic" },
},
color_overrides = {},
integrations = {
cmp = true,
},
})
vim.cmd('colorscheme catppuccin')
vim.api.nvim_set_hl(0, "Normal", { guibg = NONE, ctermbg = NONE })
-- LSP Setup
local nvim_lsp = require("lspconfig")
local capabilities = require('cmp_nvim_lsp').default_capabilities()
nvim_lsp.lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false
},
},
},
}