summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/custom/plugins/TODO-completions.lua
diff options
context:
space:
mode:
authorKyren223 <ulmliad223@gmail.com>2024-07-06 20:07:41 +0300
committerKyren223 <ulmliad223@gmail.com>2024-07-06 20:07:41 +0300
commit39d19909525940cc16695ad3e7fcdb5812f744ac (patch)
tree8d5ff9c51113eb02333597be8ec240fd150cf83a /.config/nvim/lua/custom/plugins/TODO-completions.lua
parent7166c238e8160fbffc219744b0fc96b96e889bd7 (diff)
Neovim: started rework on the conifg, changed a bunch of stuff
Diffstat (limited to '.config/nvim/lua/custom/plugins/TODO-completions.lua')
-rw-r--r--.config/nvim/lua/custom/plugins/TODO-completions.lua50
1 files changed, 50 insertions, 0 deletions
diff --git a/.config/nvim/lua/custom/plugins/TODO-completions.lua b/.config/nvim/lua/custom/plugins/TODO-completions.lua
new file mode 100644
index 0000000..0699e9b
--- /dev/null
+++ b/.config/nvim/lua/custom/plugins/TODO-completions.lua
@@ -0,0 +1,50 @@
+return {
+ {
+ 'hrsh7th/cmp-nvim-lsp',
+ },
+ {
+ 'L3MON4D3/LuaSnip',
+ dependencies = {
+ 'saadparwaiz1/cmp_luasnip',
+ 'rafamadriz/friendly-snippets',
+ },
+ },
+ {
+ 'hrsh7th/nvim-cmp',
+ opts = function(_, opts)
+ -- Setup options for lazydev.nvim
+ opts.sources = opts.sources or {}
+ table.insert(opts.sources, {
+ name = 'lazydev',
+ group_index = 0,
+ })
+ end,
+ config = function()
+ local cmp = require('cmp')
+ require('luasnip.loaders.from_vscode').lazy_load()
+
+ cmp.setup({
+ snippet = {
+ expand = function(args)
+ require('luasnip').lsp_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-k>'] = cmp.mapping.abort(),
+ ['<CR>'] = cmp.mapping.confirm({ select = true }),
+ }),
+ sources = cmp.config.sources({
+ { name = 'nvim_lsp' },
+ { name = 'luasnip' },
+ }, { { name = 'buffer' } }),
+ })
+ end,
+ },
+}