Update config/nvim/init.lua

This commit is contained in:
Matthew Fisher 2024-08-21 18:09:56 -05:00
parent b4a57204ea
commit 14b2c19ebc

View File

@ -1,36 +1,54 @@
require("plugins")
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" },
require('config')
require('plugins')
local packer_bootstrap = ensure_packer()
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
vim.opt.clipboard = 'unnamed'
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
-- List of parsers to ignore installing (or "all")
ignore_install = { "javascript" },
-- TreeSitter
use ('nvim-treesitter/nvim-treesitter', { run = ":TSUpdate"})
use {'nvim-telescope/telescope.nvim', tag = '0.1.8', requires = { {'nvim-lua/plenary.nvim'} }}
use ({"williamboman/mason.nvim"})
use ({"williamboman/mason-lspconfig.nvim"})
use ({'VonHeikemen/lsp-zero.nvim', branch = 'v4.x'})
use ({'neovim/nvim-lspconfig'})
use ({'hrsh7th/nvim-cmp'})
use ({'hrsh7th/cmp-nvim-lsp'})
use ({"L3MON4D3/LuaSnip"})
use ({"rafamadriz/friendly-snippets"})
use {
'hrsh7th/nvim-cmp',
config = function ()
require'cmp'.setup {
snippet = {
expand = function(args)
require'luasnip'.lsp_expand(args.body)
end
},
highlight = {
enable = true,
}
end
}
use { 'saadparwaiz1/cmp_luasnip' }
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if packer_bootstrap then
require('packer').sync()
end
end)