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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
function Dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. Dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
-- Neotree
local neotree = require("neo-tree")
neotree.setup({
close_if_last_window = false,
enable_git_status = true,
enable_refresh_on_write = true,
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "",
folder_empty_open = "",
-- The next two settings are only a fallback,
-- if you use nvim-web-devicons and configure default icons there
-- then these will never be used.
default = "*",
highlight = "NeoTreeFileIcon"
},
default_component_configs = {
git_status = {
symbols = {
-- Change type
added = "", -- or "✚"
modified = "", -- or ""
deleted = "✖",
renamed = "",
-- Status type
untracked = "",
ignored = "",
unstaged = "",
staged = "",
conflict = "",
}
},
},
filesystem = {
filtered_items = {
hide_dotfiles = false,
}
},
event_handlers = {}
})
-- LSP
local mason = require("mason")
local mason_lspconfig = require("mason-lspconfig")
local lspconfig = require("lspconfig")
local cmp = require("cmp")
mason.setup()
mason_lspconfig.setup()
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](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-e>'] = cmp.mapping.abort(),
-- Accept currently selected item.
-- Set `select` to `false` to only confirm explicitly selected items.
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
}, {
{ name = 'buffer' },
})
})
local lsp_capabilibies = require('cmp_nvim_lsp').default_capabilities(
vim.lsp.protocol.make_client_capabilities()
)
local servers = mason_lspconfig.get_installed_servers()
local configs_custom = {
lua_ls = {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using
-- (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
},
diagnostics = {
-- Get the language server to recognize the `vim` global
-- globals = {'vim'},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = {
"/etc/xdg/nvim",
"/home/rayhammer/.local/share/nvim/site",
"/usr/share/nvim/runtime",
"/usr/lib/nvim",
"/usr/share/vim/vimfiles",
}
},
},
}
}
}
for _, server in ipairs(servers) do
local config = {
capabilities = lsp_capabilibies
}
if configs_custom[server] then
for k, v in pairs(configs_custom[server]) do
config[k] = v
end
end
--print(server, ":")
--print(dump(config))
lspconfig[server].setup(config)
end
require('lspconfig').gdscript.setup {
capabilities = lsp_capabilibies
}
|