Skip to content

Commit

Permalink
update neovim config
Browse files Browse the repository at this point in the history
  • Loading branch information
contrun committed Oct 19, 2024
1 parent 4b2dfd8 commit a274e93
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
46 changes: 29 additions & 17 deletions dot_config/nvim/lua/lsp/sumneko.lua
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
local fn = vim.fn
local common_on_attach = require('lsp.utils').common_on_attach

local system_name
if fn.has('mac') == 1 then
system_name = 'macOS'
elseif fn.has('unix') == 1 then
system_name = 'Linux'
elseif fn.has('win32') == 1 then
system_name = 'Windows'
else
print('Unsuported system for sumneko')
end

local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")

require 'lspconfig'.lua_ls.setup {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc') then
return
end
end

client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
-- Tell the language server which version of Lua you're using
-- (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT'
},
-- Make the server aware of Neovim runtime files
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
-- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
}
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
-- library = vim.api.nvim_get_runtime_file("", true)
}
})
end,
settings = {
Lua = {
runtime = { version = 'LuaJIT', path = runtime_path },
diagnostics = { globals = { 'vim' } },
workspace = { library = vim.api.nvim_get_runtime_file("", true) },
telemetry = { enable = false }
}
Lua = {}
},
on_attach = common_on_attach
}
2 changes: 1 addition & 1 deletion dot_config/nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ require("lazy").setup({

{
'glacambre/firenvim',
build = function() vim.fn["firenvim#install"](0) end,
build = ":call firenvim#install(0)",
config = function()
if vim.g.started_by_firenvim == true then
vim.cmd [[
Expand Down

0 comments on commit a274e93

Please sign in to comment.