-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathrepro_cmp.lua
More file actions
87 lines (87 loc) · 2.66 KB
/
Copy pathrepro_cmp.lua
File metadata and controls
87 lines (87 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
-- do not remove the colorscheme!
"folke/tokyonight.nvim",
"neovim/nvim-lspconfig",
{
"hrsh7th/nvim-cmp",
lazy = false,
dependencies = {
"hrsh7th/cmp-nvim-lsp",
{
"xzbdmw/colorful-menu.nvim",
config = function()
require("colorful-menu").setup({})
end,
},
},
config = function(_, opts)
local cmp = require("cmp")
require("cmp").setup({
mapping = cmp.mapping.preset.insert({
["<cr>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.confirm()
end
end, { "i" }),
}),
completion = {
completeopt = "menu,menuone,noinsert",
},
formatting = {
format = function(entry, vim_item)
local highlights_info = require("colorful-menu").cmp_highlights(entry)
if highlights_info ~= nil then
vim_item.abbr_hl_group = highlights_info.highlights
vim_item.abbr = highlights_info.text
end
return vim_item
end,
},
sources = require("cmp").config.sources({
{ name = "nvim_lsp" },
}, {}),
})
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
require("lspconfig").lua_ls.setup({
settings = {
capabilities = require("cmp_nvim_lsp").default_capabilities(),
Lua = {
runtime = {
version = "LuaJIT",
},
workspace = {
library = {
"/usr/local/share/nvim/runtime",
},
},
completion = {
callSnippet = "Replace",
},
},
},
})
vim.cmd([[colorscheme tokyonight]])