Fixes issues with switching to snacks explorer
This commit is contained in:
parent
1699bd2574
commit
8892845c03
6 changed files with 12 additions and 17 deletions
|
|
@ -18,7 +18,8 @@ vim.api.nvim_create_user_command("CopyToPlayers", function()
|
|||
|
||||
os.execute(string.format("mkdir -p '%s'", targetPath))
|
||||
|
||||
local localPath = fs.getCurrentPath()
|
||||
local picker = Snacks.picker.get({ source = "explorer" })
|
||||
local localPath = picker[1]:current().file
|
||||
local targetFilePath = vim.fs.joinpath(targetPath, vim.fn.fnamemodify(localPath, ":t"))
|
||||
os.execute(string.format("ln -s '%s' '%s'", localPath, targetFilePath))
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ vim.api.nvim_create_user_command("CreateRandomFile", function()
|
|||
wordsFinal = wordsFinal .. tocamel(word)
|
||||
end
|
||||
|
||||
local currentPath = fs.getCurrentPath()
|
||||
|
||||
local directory = currentPath
|
||||
if vim.fn.isdirectory(currentPath) == 0 then
|
||||
directory = vim.fs.dirname(currentPath)
|
||||
local picker = Snacks.picker.get({ source = "explorer" })
|
||||
local currentFile = picker[1]:current().file
|
||||
local directory = currentFile
|
||||
if vim.fn.isdirectory(directory) == 0 then
|
||||
directory = vim.fs.dirname(directory)
|
||||
end
|
||||
|
||||
local path = vim.fs.joinpath(directory, wordsFinal .. ".md")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ vim.api.nvim_create_user_command("Optolith", function()
|
|||
local LAUNCH_COMMAND = vim.fs.normalize("~/.local/share/appimages/OptolithInsider.AppImage")
|
||||
local OPTOLITH_DIRECTORY = "~/.config/Optolith Insider"
|
||||
|
||||
local currentHeroFile = fs.get_current_path()
|
||||
local picker = Snacks.picker.get({ source = "explorer" })
|
||||
local currentHeroFile = picker[1]:current().file
|
||||
|
||||
if currentHeroFile:find(".opto$") == nil then
|
||||
vim.notify("Invalid hero", "error", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue