diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 9d194f5..f54ce35 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -8,4 +8,4 @@ require("commands.open") require("commands.CopyToPlayers") require("commands.RandomFile") vim.o.hidden = false -vim.o.mouse = "" +--vim.o.mouse = "" diff --git a/.config/nvim/lua/commands/CopyToPlayers.lua b/.config/nvim/lua/commands/CopyToPlayers.lua index 0cdbed7..3ccfa5e 100644 --- a/.config/nvim/lua/commands/CopyToPlayers.lua +++ b/.config/nvim/lua/commands/CopyToPlayers.lua @@ -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)) diff --git a/.config/nvim/lua/commands/RandomFile.lua b/.config/nvim/lua/commands/RandomFile.lua index 813bd5e..e2dbf8b 100644 --- a/.config/nvim/lua/commands/RandomFile.lua +++ b/.config/nvim/lua/commands/RandomFile.lua @@ -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") diff --git a/.config/nvim/lua/commands/optolith.lua b/.config/nvim/lua/commands/optolith.lua index 6856d9e..f38a61a 100644 --- a/.config/nvim/lua/commands/optolith.lua +++ b/.config/nvim/lua/commands/optolith.lua @@ -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", { diff --git a/.config/nvim/lua/functions/fs.lua b/.config/nvim/lua/functions/fs.lua index 9f4bc43..1ff1c10 100644 --- a/.config/nvim/lua/functions/fs.lua +++ b/.config/nvim/lua/functions/fs.lua @@ -6,14 +6,7 @@ end function fs.getCurrentPath() local currentBuffer = vim.fn.expand("%") - - if not startswith(currentBuffer, "neo-tree") then - return currentBuffer - end - - local filesystemState = require("neo-tree.sources.manager").get_state("filesystem") - local currentLine = vim.fn.getpos(".")[2] - return filesystemState.tree:get_node(currentLine).path + print(currentBuffer) end return fs diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua index 9ab00ba..17e4dcb 100644 --- a/.config/nvim/lua/plugins/snacks.lua +++ b/.config/nvim/lua/plugins/snacks.lua @@ -1,7 +1,7 @@ local explorerConfig = { actions = { openWithApp = function(picker) - local path = picker:selected({ fallback = true })[1].file + local path = picker:current().file local filename = vim.fn.fnamemodify(path, ":t") vim.notify(filename, "info", {