2023-07-27 13:11:43 +00:00
|
|
|
local hotpot_path = vim.fn.stdpath('data') .. '/lazy/hotpot.nvim'
|
|
|
|
if vim.fn.empty(vim.fn.glob(hotpot_path)) > 0 then
|
|
|
|
print("Could not find hotpot.nvim, cloning new copy to", hotpot_path)
|
|
|
|
vim.fn.system({'git', 'clone',
|
|
|
|
'https://github.com/rktjmp/hotpot.nvim', hotpot_path})
|
|
|
|
vim.cmd("helptags " .. hotpot_path .. "/doc")
|
2023-06-03 19:27:29 +00:00
|
|
|
end
|
2023-07-27 14:36:27 +00:00
|
|
|
vim.opt.rtp:prepend(hotpot_path)
|
2023-06-03 19:27:29 +00:00
|
|
|
|
2023-07-27 13:11:43 +00:00
|
|
|
require("hotpot")
|
2023-07-27 13:16:03 +00:00
|
|
|
require("init")
|
2023-07-27 14:36:27 +00:00
|
|
|
|
|
|
|
local servers =
|
|
|
|
{lua_ls = {Lua = {workspace = {checkThirdParty = false}, telemetry = {enable = false}}}
|
|
|
|
-- TODO :fennel_language_server {}
|
|
|
|
-- TODO :bash_language_server {}
|
|
|
|
-- TODO :jq {}
|
|
|
|
}
|
|
|
|
|
|
|
|
local on_attach = function (_, bufnr)
|
|
|
|
local nmap = function (keys, fn, desc)
|
|
|
|
vim.keymap.set(keys, fn, {buffer = bufnr, desc = desc})
|
|
|
|
end
|
|
|
|
local telescope = require("telescope.builtin")
|
|
|
|
|
|
|
|
nmap("gd", vim.lsp.buf.definition, "[G]o to [D]efiniton")
|
|
|
|
nmap("gr", telescope.lsp_references, "[G]o to [R]eferences")
|
|
|
|
nmap("gI", vim.lsp.buf.implementation, "[G]o to [I]mplementation")
|
|
|
|
vim.api.nvim_buf_create_user_command(bufnr, "Format", function ()
|
|
|
|
vim.lsp.buf.format()
|
|
|
|
end, "Format current buffer with LSP")
|
|
|
|
end
|
|
|
|
|
|
|
|
require("neodev").setup()
|
|
|
|
require("mason").setup()
|
|
|
|
|
|
|
|
local mason_lspconfig = require("mason-lspconfig")
|
|
|
|
mason_lspconfig.setup({ensure_installed = vim.tbl_keys(servers)})
|
|
|
|
mason_lspconfig.setup_handlers({
|
|
|
|
function (server_name)
|
|
|
|
local server = require(server_name)
|
|
|
|
server.setup({
|
|
|
|
capabilities = vim.lsp.protocol.make_client_capabilities(),
|
|
|
|
on_attach = on_attach,
|
|
|
|
settings = servers[server_name],
|
|
|
|
filetypes = (servers[server_name] or {}).filetypes,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
})
|