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") end vim.opt.rtp:prepend(hotpot_path) require("hotpot") require("init") 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 })