yadm-config/.config/nvim/lua/functions/fs.lua

19 lines
460 B
Lua

local fs = {}
local function startswith(string, start)
return string:sub(1, #start) == start
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
end
return fs