diff --git a/home/.config/doom/config.el b/home/.config/doom/config.el index 7adef75..512deec 100644 --- a/home/.config/doom/config.el +++ b/home/.config/doom/config.el @@ -178,8 +178,17 @@ (setq lsp-clients-lua-language-server-bin (expand-file-name "lsp/lua-language-server/bin/Linux/lua-language-server" doom-etc-dir) lsp-clients-lua-language-server-main-location (expand-file-name "lsp/lua-language-server/main.lua" doom-etc-dir) lsp-lua-completion-call-snippet "Replace" + lsp-lua-hint-enable t + lsp-lua-runtime-path ["?.lua" + "?/init.lua" + "?/?.lua" + "/home/follie/.luarocks/share/lua/5.3/?.lua" + "/home/follie/.luarocks/share/lua/5.3/?/init.lua" + "/usr/share/lua/5.3/?/init.lua" + "/usr/share/5.3/?.lua"] + lsp-lua-runtime-version "Lua 5.3" lsp-lua-telemetry-enable nil - lsp-lua-hint-enable t)) + lsp-lua-workspace-library '((/home/follie/.luarocks/share/lua/5.3 . t) (/usr/share/lua/5.3 . t)))) ;; Quicker which-key (after! which-key diff --git a/home/.config/nvim/lua/modules/lsp.lua b/home/.config/nvim/lua/modules/lsp.lua index a797842..22b0be6 100644 --- a/home/.config/nvim/lua/modules/lsp.lua +++ b/home/.config/nvim/lua/modules/lsp.lua @@ -89,9 +89,34 @@ function M.lsp_conf() } -- Lua - local runtime_path = vim.split(package.path, ';') - table.insert(runtime_path, 'lua/?.lua') - table.insert(runtime_path, 'lua/?/init.lua') + local lua_lib_path = {} + local lua_runtime_path = {} + + -- lua_lib_path[vim.fn.expand('~/.luarocks/share/lua/5.3')] = true + -- lua_lib_path[vim.fn.expand('/usr/share/lua/5.3')] = true + lua_lib_path[os.getenv('VIMRUNTIME') .. '/lua'] = true + -- local function add(lib) + -- for _, p in pairs(vim.fn.expand(lib .. '/lua', false, true)) do + -- p = vim.loop.fs_realpath(p) + -- if p then lua_lib_path[p] = true end + -- end + -- end + -- for _, site in pairs(vim.split(vim.o.packpath, ',')) do + -- add(site .. '/pack/*/opt/*') + -- add(site .. '/pack/*/start/*') + -- end + + table.insert(lua_runtime_path, 'lua/?.lua') + table.insert(lua_runtime_path, 'lua/?/init.lua') + -- table.insert(lua_runtime_path, '?.lua') + -- table.insert(lua_runtime_path, '?/?.lua') + -- table.insert(lua_runtime_path, '?/init.lua') + + for lib, _ in pairs(lua_lib_path) do + table.insert(lua_runtime_path, lib .. '/?.lua') + table.insert(lua_runtime_path, lib .. '/?/init.lua') + end + lspconf.sumneko_lua.setup { on_attach = on_attach, capabilities = capabilities, @@ -103,10 +128,10 @@ function M.lsp_conf() settings = { Lua = { diagnostics = {globals = {'vim'}}, - runtime = {version = 'LuaJIT', path = runtime_path}, + runtime = {version = 'LuaJIT', path = lua_runtime_path}, workspace = { - library = vim.api.nvim_get_runtime_file('', true), - maxPreload = 1500, + library = lua_lib_path, + maxPreload = 1000, preloadFileSize = 150 }, completion = {callSnippet = 'Replace'}, @@ -144,15 +169,8 @@ function M.lsp_conf() -- Others local servers = { - 'dockerls', - 'bashls', - 'pyright', - 'tsserver', - 'html', - 'jsonls', - 'cmake', - 'sqls', - 'rust_analyzer' + 'dockerls', 'bashls', 'pyright', 'tsserver', + 'html', 'jsonls', 'cmake', 'sqls', 'rust_analyzer' } for _, server in ipairs(servers) do lspconf[server].setup { diff --git a/home/.config/nvim/lua/options.lua b/home/.config/nvim/lua/options.lua index 798a9c3..617e0c7 100644 --- a/home/.config/nvim/lua/options.lua +++ b/home/.config/nvim/lua/options.lua @@ -36,7 +36,7 @@ function M.load_options() opt.mouse = 'nv' opt.errorbells = false opt.visualbell = false - opt.hidden = true + -- opt.hidden = true opt.fileformats = 'unix' opt.magic = true opt.virtualedit = 'block' @@ -45,18 +45,18 @@ function M.load_options() opt.clipboard = 'unnamedplus' opt.wildignorecase = true opt.wildignore = '.git,.hg,.svn,*.pyc,*.o,*.out,*.jpg,*.jpeg,*.png,*.gif,*.zip,**/tmp/**,*.DS_Store,**/node_modules/**' - opt.history = 1000 + -- opt.history = 10000 -- opt.showmode = false opt.jumpoptions = 'stack' opt.formatoptions = '1jcroql' opt.shortmess = 'aoOTIcF' - opt.startofline = false + -- opt.startofline = false opt.wrap = false opt.sidescrolloff = 4 opt.scrolloff = 4 opt.whichwrap = '<,>,[,],~' - opt.ruler = true - opt.display = 'lastline' + -- opt.ruler = true + -- opt.display = 'lastline' -- opt.colorcolumn = '80' -- opt.cursorline = true -- opt.backspace = 'indent,eol,start' @@ -65,7 +65,7 @@ function M.load_options() -- opt.cmdheight = 2 -- opt.cmdwinheight = 6 opt.showtabline = 2 - opt.laststatus = 2 + -- opt.laststatus = 2 -- opt.textwidth = 80 opt.synmaxcol = 2500 -- opt.shell = 'bash' @@ -90,7 +90,7 @@ function M.load_options() opt.infercase = true -- Searching - opt.incsearch = true + -- opt.incsearch = true opt.hlsearch = false -- opt.wrapscan = true @@ -108,7 +108,7 @@ function M.load_options() opt.swapfile = false -- Completion menu - opt.wildmenu = true + -- opt.wildmenu = true opt.wildmode = 'full' opt.complete = '.,w,b,k' opt.completeopt = 'menu,menuone,noselect' @@ -137,7 +137,7 @@ function M.load_options() opt.smarttab = true opt.expandtab = true opt.smartindent = true - opt.autoindent = true + -- opt.autoindent = true opt.shiftround = true -- Trailings, line break @@ -150,7 +150,7 @@ function M.load_options() -- Undo file path opt.undofile = true - opt.undodir = vim.fn.stdpath('data') .. '/undodir' + -- opt.undodir = vim.fn.stdpath('data') .. '/undo' end return M