Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Joshuto cmd #37

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
15 changes: 10 additions & 5 deletions lua/fm-nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ local config = {
}
}

local fm_nvim_path = "/tmp/fm-nvim"
if vim.fn.has("win32") == 1 then
fm_nvim_path = vim.fn.getenv("TEMP") .. "/fm-nvim"
end

local method = config.edit_cmd
function M.setup(user_options)
config = vim.tbl_deep_extend("force", config, user_options)
Expand All @@ -75,7 +80,7 @@ local function on_exit()
for _, func in ipairs(config.on_close) do
func()
end
checkFile("/tmp/fm-nvim")
checkFile(fm_nvim_path)
checkFile(vim.fn.getenv("HOME") .. "/.cache/fff/opened_file")
vim.cmd [[ checktime ]]
end
Expand Down Expand Up @@ -161,9 +166,9 @@ end
function M.Lf(dir)
dir = dir or "."
if config.ui.default == "float" then
createWin(config.cmds.lf_cmd .. " -selection-path /tmp/fm-nvim " .. dir, "l")
createWin(config.cmds.lf_cmd .. " -selection-path " .. fm_nvim_path .. " " .. dir, "l")
elseif config.ui.default == "split" then
createSplit(config.cmds.lf_cmd .. " -selection-path /tmp/fm-nvim " .. dir, "l")
createSplit(config.cmds.lf_cmd .. " -selection-path " .. fm_nvim_path .. " " .. dir, "l")
end
end
function M.Fm(dir)
Expand Down Expand Up @@ -262,9 +267,9 @@ end
function M.Joshuto(dir)
dir = dir or "."
if config.ui.default == "float" then
createWin(config.cmds.joshuto_cmd .. " --choosefiles /tmp/fm-nvim --path " .. dir, "l")
createWin(config.cmds.joshuto_cmd .. " --output-file /tmp/fm-nvim --file-chooser " .. dir, "l")
elseif config.ui.default == "split" then
createSplit(config.cmds.joshuto_cmd .. " --choosefiles /tmp/fm-nvim --path " .. dir, "l")
createSplit(config.cmds.joshuto_cmd .. " --output-file /tmp/fm-nvim --file-chooser " .. dir, "l")
end
end
function M.Lazygit(dir)
Expand Down