diff --git a/home/vim/default.nix b/home/vim/default.nix index bb7bdec..ea964cc 100644 --- a/home/vim/default.nix +++ b/home/vim/default.nix @@ -13,6 +13,7 @@ let "after" "autoload" "ftdetect" + "lua" "plugin" ]; in diff --git a/home/vim/lua/ambroisie/utils.lua b/home/vim/lua/ambroisie/utils.lua new file mode 100644 index 0000000..8a6cb0f --- /dev/null +++ b/home/vim/lua/ambroisie/utils.lua @@ -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