dotfiles/nvim/lua/helper/init.lua
2024-10-06 21:50:07 -04:00

33 lines
566 B
Lua

local M = {}
function M.get_cmake_project_file()
return vim.fn.findfile('CMakeLists.txt', '.;')
end
function M.in_cmake_project()
return M.get_cmake_project_file() ~= ''
end
function M.get_cargo_project_file()
return vim.fn.findfile('Cargo.toml', '.;')
end
function M.in_cargo_project()
return M.get_cargo_project_file() ~= ''
end
function M.in_git_project()
return vim.fn.finddir('.git', '.;') ~= ''
end
function M.contains(tbl, v)
for i, value in ipairs(tbl) do
if value == v then
return true
end
end
return false
end
return M