home: vim: add 'ambroisie.utils' lua module
This commit is contained in:
parent
8b84ab8625
commit
8155f6be4c
2 changed files with 18 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ let
|
|||
"after"
|
||||
"autoload"
|
||||
"ftdetect"
|
||||
"lua"
|
||||
"plugin"
|
||||
];
|
||||
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…
Add table
Add a link
Reference in a new issue