fix: changes for file paths

This commit is contained in:
2024-12-12 20:25:26 +01:00
parent 78b0172772
commit 30b119e5f9
5 changed files with 24 additions and 63 deletions

View File

@@ -1,13 +1,6 @@
-- lua/chatgpt_nvim/config.lua
-- Changed to use YAML for configuration instead of JSON.
-- Reads from .chatgpt_config.yaml and uses lyaml to parse it.
-- If no config file is found, uses default values.
local M = {}
local uv = vim.loop
-- Attempt to require lyaml for YAML parsing.
-- Make sure lyaml is installed (e.g., via luarocks install lyaml)
local ok_yaml, lyaml = pcall(require, "lyaml")
local function get_config_path()
@@ -18,9 +11,8 @@ end
function M.load()
local path = get_config_path()
local fd = uv.fs_open(path, "r", 438) -- 438 = 0o666
local fd = uv.fs_open(path, "r", 438)
if not fd then
-- Return some default configuration if no file found
return {
initial_prompt = "",
directories = { "." },
@@ -41,7 +33,6 @@ function M.load()
end
end
end
-- Fallback if decode fails
return {
initial_prompt = "",
directories = { "." },