From 5f75526ed51e2b68e6d4e21c5d0b986fc39edd38 Mon Sep 17 00:00:00 2001 From: Brian Powell Jr Date: Mon, 29 Jul 2024 23:49:05 -0400 Subject: [PATCH] Update: Added autocompletion from hrsh7th series of plugins --- init.lua | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/init.lua b/init.lua index aef77e7..ec7d975 100644 --- a/init.lua +++ b/init.lua @@ -37,6 +37,16 @@ Plug('nvim-treesitter/nvim-treesitter', { ['do'] = ':TSUpdate'}) -- Install Mason.nvim Plug('williamboman/mason.nvim') +-- Install linting +Plug('mfussenegger/nvim-lint') + +-- Install autocomplete +Plug('hrsh7th/nvim-cmp') +Plug('hrsh7th/cmp-nvim-lsp') +Plug('hrsh7th/cmp-buffer') +Plug('hrsh7th/cmp-path') +Plug('hrsh7th/cmp-cmdline') + vim.call('plug#end') -- call custom config files for plugins @@ -62,6 +72,35 @@ require('lspconfig').clangd.setup{} require('lspconfig').bashls.setup{} require('lspconfig').html.setup{} +-- Linting +require('lint') + +-- Configure autocomplete +local cmp = require('cmp') +cmp.setup({ + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + }, { + { name = 'buffer' }, + }) +}) + -- Configure Nvim-Tree require('nvim-tree').setup ({ view = {