Move home_cache_dir helper to custom mod
- Id
- 26448498d2225963fadd8a16763a519d65fcae17
- Author
- Caio
- Commit time
- 2025-04-15T08:37:58+02:00
Modified config/nvim/lua/config/lsp.lua
}
})
-local function home_cache_dir(tail)
- local base = vim.env.XDG_CACHE_HOME
- if not base and vim.env.HOME then
- base = vim.env.HOME .. "/.cache"
- end
- -- fallback to a hidden dir on cwd
- if not base then
- return '.' .. tail
- end
-
- return base .. '/' .. tail
-end
-
vim.lsp.config("ccls", {
cmd = { "ccls" },
filetypes = { "c", "cpp", "objc", "objcpp", "cuda" },
root_markers = { "compile_commands.json" },
init_options = {
cache = {
- directory = home_cache_dir('ccls'),
+ directory = require("custom").home_cache_dir('ccls'),
},
},
})
Modified config/nvim/lua/custom/init.lua
end
end
+function M.home_cache_dir(tail)
+ local base = vim.env.XDG_CACHE_HOME
+ if not base and vim.env.HOME then
+ base = vim.env.HOME .. "/.cache"
+ end
+ -- fallback to a hidden dir on cwd
+ if not base then
+ return '.' .. tail
+ end
+
+ return base .. '/' .. tail
+end
+
return M