From 07c80f948df52deff38f5b838b4a0dc42b683cdb Mon Sep 17 00:00:00 2001 From: jdhao Date: Sat, 14 Aug 2021 01:23:43 +0800 Subject: Use proper true or false value for boolean variables In lua, 0 and empty string is true, which is counter-intuitive and different from vim script. So we need to use proper boolean type for vim script global variables, instead of numbers. --- lua/utils.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lua/utils.lua') diff --git a/lua/utils.lua b/lua/utils.lua index dedc4af..a4c02f2 100644 --- a/lua/utils.lua +++ b/lua/utils.lua @@ -3,3 +3,15 @@ function inspect(item) print(vim.inspect(item)) end + +local M = {} + +function M.executable(name) + if vim.fn.executable(name) > 0 then + return true + end + + return false +end + +return M -- cgit v1.2.3