From b7b1ab29c53f5eff1258ecf39c429b33d8de3623 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 2 Nov 2022 09:05:01 +0000 Subject: [PATCH] Add lua LSP --- lua/config_lsp.lua | 23 +++++++++++++++++++++++ lua/keymaps.lua | 6 +++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lua/config_lsp.lua b/lua/config_lsp.lua index 4db1871f..77ff4022 100644 --- a/lua/config_lsp.lua +++ b/lua/config_lsp.lua @@ -125,6 +125,29 @@ require('lspconfig')['fortls'].setup{ capabilities = capabilities } +require('lspconfig')['sumneko_lua'].setup { + 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 = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, +} + require'nvim-treesitter.configs'.setup { highlight = { ensure_installed = {"python", "markdown", "lua", "yaml", "bash"}, diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 8ef7abc6..d25bb643 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -1,12 +1,12 @@ -function map(mode, shortcut, command) +local function map(mode, shortcut, command) vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true }) end -function nmap(shortcut, command) +local function nmap(shortcut, command) map('n', shortcut, command) end -function imap(shortcut, command) +local function imap(shortcut, command) map('i', shortcut, command) end