diff options
| author | jdhao <jdhao@hotmail.com> | 2022-09-11 18:24:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-11 18:24:10 +0800 |
| commit | 40fa9aab1cbd9ce176140d733ec7157fa7e0a5b6 (patch) | |
| tree | 5bd2dd21b365a3e419aad4481493ae9630238153 /lua/utils.lua | |
| parent | 89effe8b172ef871ca38a90ff77003f5a796e521 (diff) | |
| parent | 6e8e61e53ae15af3a9f5a3577ffea424dd95b66d (diff) | |
Merge pull request #104 from jdhao/global
global.vim --> global.lua
Diffstat (limited to 'lua/utils.lua')
| -rw-r--r-- | lua/utils.lua | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lua/utils.lua b/lua/utils.lua index d3198ac..ab1473f 100644 --- a/lua/utils.lua +++ b/lua/utils.lua @@ -1,10 +1,5 @@ local fn = vim.fn --- inspect something -function _G.inspect(item) - vim.pretty_print(item) -end - local M = {} function M.executable(name) @@ -15,6 +10,18 @@ function M.executable(name) return false end +--- check whether a feature exists in Nvim +--- @feat: string +--- the feature name, like `nvim-0.7` or `unix`. +--- return: bool +M.has = function(feat) + if fn.has(feat) == 1 then + return true + end + + return false +end + --- Create a dir if it does not exist function M.may_create_dir(dir) local res = fn.isdirectory(dir) |
