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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
lua << EOF
vim.o.termguicolors = true
local on_attach = function(client, bufnr)
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
end
vim.api.nvim_create_autocmd("FileType", {
pattern = { "lua" },
callback = function()
vim.lsp.start({
name = "lua_ls",
cmd = { "lua-language-server" },
on_attach = on_attach,
})
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "python" },
callback = function()
vim.lsp.start({
name = "pyright",
cmd = { "pyright-langserver", "--stdio" },
on_attach = on_attach,
})
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "c", "cpp" },
callback = function()
vim.lsp.start({
name = "clangd",
cmd = { "clangd" },
on_attach = on_attach,
})
end,
})
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "buffer" },
}),
})
vim.diagnostic.config({
virtual_text = true,
signs = true,
underline = true,
update_in_insert = false,
severity_sort = true,
float = {
border = "rounded",
source = true,
},
})
vim.cmd([[
highlight clear
syntax reset
highlight Normal guibg=NONE
highlight NormalNC guibg=NONE
highlight SignColumn guibg=NONE
highlight FoldColumn guibg=NONE
highlight VertSplit guibg=NONE
highlight StatusLine guibg=NONE
highlight StatusLineNC guibg=NONE
highlight LineNr guibg=NONE
highlight CursorLine guibg=#151515
highlight CursorLineNr guibg=NONE gui=bold
highlight Pmenu guibg=#121212
highlight PmenuSel guibg=#2a2a2a
highlight PmenuSbar guibg=#121212
highlight PmenuThumb guibg=#4a4a4a
highlight NormalFloat guibg=NONE
highlight FloatBorder guibg=NONE
highlight DiagnosticError guifg=#ff6b6b
highlight DiagnosticWarn guifg=#ffd08a
highlight DiagnosticInfo guifg=#9fe7ff
highlight DiagnosticHint guifg=#7dff9a
highlight DiagnosticVirtualTextError guifg=#ff6b6b guibg=NONE
highlight DiagnosticVirtualTextWarn guifg=#ffd08a guibg=NONE
highlight DiagnosticVirtualTextInfo guifg=#9fe7ff guibg=NONE
highlight DiagnosticVirtualTextHint guifg=#7dff7a guibg=NONE
highlight DiagnosticUnderlineError gui=undercurl guisp=#ff6b6b
highlight DiagnosticUnderlineWarn gui=undercurl guisp=#ffd08a
highlight DiagnosticUnderlineInfo gui=undercurl guisp=#9fe7ff
highlight DiagnosticUnderlineHint gui=undercurl guisp=#7dff7a
highlight LspReferenceText guibg=#1f1f1f
highlight LspReferenceRead guibg=#1f1f1f
highlight LspReferenceWrite guibg=#1f1f1f
]])
--autopairs?
require("nvim-autopairs").setup()
EOF
|