diff --git a/lua/kulala/globals/init.lua b/lua/kulala/globals/init.lua index b9e2ee2..f687a4d 100644 --- a/lua/kulala/globals/init.lua +++ b/lua/kulala/globals/init.lua @@ -2,7 +2,7 @@ local FS = require("kulala.utils.fs") local M = {} -M.VERSION = "2.8.0" +M.VERSION = "2.8.1" M.UI_ID = "kulala://ui" M.HEADERS_FILE = FS.get_plugin_tmp_dir() .. "/headers.txt" M.BODY_FILE = FS.get_plugin_tmp_dir() .. "/body.txt" diff --git a/lua/kulala/utils/fs.lua b/lua/kulala/utils/fs.lua index 11fcd2f..bbfa9b7 100644 --- a/lua/kulala/utils/fs.lua +++ b/lua/kulala/utils/fs.lua @@ -5,7 +5,11 @@ local M = {} --- @return string|nil --- @usage local p = fs.find_file_in_parent_dirs('Makefile') M.find_file_in_parent_dirs = function(filename) - return vim.fs.find({filename}, {upward=true, limit=1})[1] + return vim.fs.find({ filename }, { + upward = true, + limit = 1, + path = vim.fn.expand("%:p:h"), + })[1] end -- Writes string to file @@ -15,7 +19,7 @@ end --- @return boolean --- @usage local p = fs.write_file('Makefile', 'all: \n\t@echo "Hello World"') M.write_file = function(filename, content) - local f = io.open(filename, 'w') + local f = io.open(filename, "w") if f == nil then return false end @@ -47,9 +51,9 @@ end --- @return string --- @usage local p = fs.get_plugin_tmp_dir() M.get_plugin_tmp_dir = function() - local dir = vim.fn.stdpath('data') .. '/tmp/kulala' + local dir = vim.fn.stdpath("data") .. "/tmp/kulala" if vim.fn.isdirectory(dir) == 0 then - vim.fn.mkdir(dir, 'p') + vim.fn.mkdir(dir, "p") end return dir end @@ -67,11 +71,11 @@ end --- @return string --- @usage local p = fs.read_file('Makefile') M.read_file = function(filename) - local f = io.open(filename, 'r') + local f = io.open(filename, "r") if f == nil then return nil end - local content = f:read('*a') + local content = f:read("*a") f:close() return content end diff --git a/package.json b/package.json index 3164bee..16d7f68 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,4 @@ { "name": "kulala.nvim", - "version": "2.8.0" + "version": "2.8.1" }