20.05.2025
This commit is contained in:
parent
4bff377885
commit
57fc86a2cc
11 changed files with 126 additions and 86 deletions
39
nvim/lua/plugins/cmp.lua
Normal file
39
nvim/lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
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+)
|
||||
|
||||
-- For `mini.snippets` users:
|
||||
-- local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert
|
||||
-- insert({ body = args.body }) -- Insert at cursor
|
||||
-- cmp.resubscribe({ "TextChangedI", "TextChangedP" })
|
||||
-- require("cmp.config").set_onetime({ sources = {} })
|
||||
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 }), -- 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' },
|
||||
})
|
||||
}
|
|
@ -2,41 +2,25 @@ return require('packer').startup(function(use)
|
|||
use 'wbthomason/packer.nvim'
|
||||
use 'nvim-lua/plenary.nvim'
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'hrsh7th/cmp-buffer'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
requires = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-vsnip',
|
||||
'hrsh7th/vim-vsnip',
|
||||
},
|
||||
config = function()
|
||||
require 'plugins.cmp'
|
||||
end
|
||||
}
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
config = function()
|
||||
require 'plugins.lualine'
|
||||
end
|
||||
}
|
||||
|
||||
-- движок сниппетов
|
||||
use {
|
||||
'L3MON4D3/LuaSnip',
|
||||
after = 'friendly-snippets',
|
||||
config = function()
|
||||
require('luasnip/loaders/from_vscode').load({
|
||||
paths = { '~/.local/share/nvim/site/pack/packer/start/friendly-snippets' }
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
-- автодополнения для сниппетов
|
||||
use 'saadparwaiz1/cmp_luasnip'
|
||||
|
||||
-- набор готовых сниппетов для всех языков, включая go
|
||||
use 'rafamadriz/friendly-snippets'
|
||||
|
||||
-- плагин для простого комментирования кода
|
||||
use {
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
end
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
|
@ -50,12 +34,6 @@ return require('packer').startup(function(use)
|
|||
require 'plugins.telescope'
|
||||
end
|
||||
}
|
||||
use {
|
||||
'olexsmir/gopher.nvim',
|
||||
config = function()
|
||||
-- require 'plugins.gopher'
|
||||
end
|
||||
}
|
||||
use {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
config = function()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue