home: vim: add 'ambroisie.utils' lua module

This commit is contained in:
Bruno BELANYI 2022-02-28 11:31:26 +01:00
parent 8b84ab8625
commit 8155f6be4c
2 changed files with 18 additions and 0 deletions

View file

@ -13,6 +13,7 @@ let
"after"
"autoload"
"ftdetect"
"lua"
"plugin"
];
in

View file

@ -0,0 +1,17 @@
local M = {}
--- checks if a given command is executable
---@param cmd string? command to check
---@return boolean executable
M.is_executable = function(cmd)
return cmd and vim.fn.executable(cmd) == 1
end
--- return a function that checks if a given command is executable
---@param cmd string? command to check
---@return fun(cmd: string): boolean executable
M.is_executable_condition = function(cmd)
return function() return M.is_executable(cmd) end
end
return M