fix get_package_path function for paths with trailing slash

This commit is contained in:
Oleg Matrokhin 2020-08-30 23:48:46 +03:00 committed by Thomas Vigouroux
parent 1cdf8bf750
commit cf9df71341

View file

@ -19,8 +19,8 @@ end
function M.get_package_path()
for _, path in pairs(api.nvim_list_runtime_paths()) do
local last_segment = vim.fn.fnamemodify(path, ":t")
local penultimate_segment = vim.fn.fnamemodify(path, ":t:t")
local last_segment = vim.fn.fnamemodify(path, ":p:h:t")
local penultimate_segment = vim.fn.fnamemodify(path, ":p:h:t:t")
if last_segment == "nvim-treesitter" or (last_segment == "" and penultimate_segment == "nvim-treesitter") then
return path
end