-
-
Notifications
You must be signed in to change notification settings - Fork 58
/
init_paq.lua
105 lines (94 loc) · 3.45 KB
/
init_paq.lua
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
local fn = vim.fn
local localpath = vim.fn.expand("$HOME") .. "/github/"
local install_path = fn.stdpath("data") .. "/site/pack/paqs/start/paq-nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ "git", "clone", "--depth=1", "https://github.com/savq/paq-nvim.git", install_path })
end
require("paq")({
"savq/paq-nvim", -- Let Paq manage itself
"neovim/nvim-lspconfig", -- Mind the semi-colons
"hrsh7th/nvim-cmp", -- Use braces when passing options
"ray-x/lsp_signature.nvim",
"hrsh7th/cmp-nvim-lsp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"windwp/nvim-autopairs",
})
vim.cmd([[colorscheme darkblue]])
vim.opt.runtimepath:append("~/github/lsp_signature.nvim")
local cmp = require("cmp")
cmp.setup({
mapping = {
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.close(),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
end,
},
sources = { { name = "nvim_lsp" }, { name = "luasnip" } },
completion = { completeopt = "menu,menuone,noinsert" },
experimental = { ghost_text = true },
})
require("luasnip").config.set_config({ history = true, updateevents = "TextChanged,TextChangedI" })
require("luasnip.loaders.from_vscode").load()
require("nvim-autopairs").setup()
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
--
cmp_autopairs.lisp[#cmp_autopairs.lisp + 1] = "racket"
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = { "documentation", "detail", "additionalTextEdits" },
}
local sumneko_root_path = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server"
local sumneko_binary = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server/bin/macOS/lua-language-server"
local lua_cfg = {
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
settings = {
Lua = {
runtime = { version = "LuaJIT", path = vim.split(package.path, ";") },
diagnostics = { enable = true },
},
},
capabilities = capabilities,
}
local signature_config = {
log_path = vim.fn.expand("$HOME") .. "/tmp/sig.log",
debug = true,
hint_enable = false,
handler_opts = { border = "single" },
max_width = 80,
}
require("lsp_signature").setup(signature_config)
require("lspconfig").sumneko_lua.setup(lua_cfg)
require("lspconfig").gopls.setup({ capabilities = capabilities })
require("lspconfig").clangd.setup({ capabilities = capabilities })
vim.cmd([[set mouse=a]])