home: vim: add 'ambroisie.utils' lua module
This commit is contained in:
parent
8b84ab8625
commit
8155f6be4c
|
@ -13,6 +13,7 @@ let
|
||||||
"after"
|
"after"
|
||||||
"autoload"
|
"autoload"
|
||||||
"ftdetect"
|
"ftdetect"
|
||||||
|
"lua"
|
||||||
"plugin"
|
"plugin"
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
|
|
17
home/vim/lua/ambroisie/utils.lua
Normal file
17
home/vim/lua/ambroisie/utils.lua
Normal 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
|
Loading…
Reference in a new issue