Skip to content

Commit

Permalink
Update: Added autocompletion from hrsh7th series of plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
BPowell76 committed Jul 30, 2024
1 parent e415464 commit 5f75526
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
}, {
{ name = 'buffer' },
})
})

-- Configure Nvim-Tree
require('nvim-tree').setup ({
view = {
Expand Down

0 comments on commit 5f75526

Please sign in to comment.