Skip to content

Commit

Permalink
nvim: Add cmp plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
scizzorz committed Jul 30, 2024
1 parent 8ec0273 commit 83c57ef
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ plug("JulesWang/css.vim")
plug("NoahTheDuke/vim-just")
plug("cespare/vim-toml", {branch="main"})
plug("hashivim/vim-terraform")
plug("hrsh7th/cmp-nvim-lsp")
plug("hrsh7th/cmp-vsnip")
plug("hrsh7th/nvim-cmp")
plug("hrsh7th/vim-vsnip")
plug("junegunn/fzf", {["do"]=vim.fn["fzf#install"]})
plug("junegunn/fzf.vim")
plug("justinj/vim-pico8-syntax")
Expand All @@ -61,11 +65,50 @@ plug("xtfc/mold.vim")

vim.fn["plug#end"]()

-- LSP config
local lspconfig = require("lspconfig")
lspconfig.pyright.setup({})
-- lspconfig.lua_ls.setup({})

-- disable treesitter for lua files
vim.api.nvim_create_autocmd(
{"BufEnter"},
{pattern = "*.lua", callback = function(ev) vim.treesitter.stop() end}
)


-- autocomplete
local cmp = require("cmp")

cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
-- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
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(),
['<Tab>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
})

0 comments on commit 83c57ef

Please sign in to comment.