diff options
| author | srdusr <trevorgray@srdusr.com> | 2022-10-13 23:52:54 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2022-10-13 23:52:54 +0200 |
| commit | 86628d459cabd0c29f0cdbb699e2e18807b958ed (patch) | |
| tree | 512801524e303fd9485496ed0f1dcd52d62cb38b /nvim/lua/utils.lua | |
| parent | c349d1f7998d97f60d3a3945ce8da166b33bf1c8 (diff) | |
| download | dotfiles-86628d459cabd0c29f0cdbb699e2e18807b958ed.tar.gz dotfiles-86628d459cabd0c29f0cdbb699e2e18807b958ed.zip | |
Removed unnecessary files/lines
Diffstat (limited to 'nvim/lua/utils.lua')
| -rw-r--r-- | nvim/lua/utils.lua | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/nvim/lua/utils.lua b/nvim/lua/utils.lua deleted file mode 100644 index ab1473f..0000000 --- a/nvim/lua/utils.lua +++ /dev/null @@ -1,66 +0,0 @@ -local fn = vim.fn - -local M = {} - -function M.executable(name) - if fn.executable(name) > 0 then - return true - end - - 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) - - if res == 0 then - fn.mkdir(dir, "p") - end -end - -function M.get_nvim_version() - local actual_ver = vim.version() - - local nvim_ver_str = string.format("%d.%d.%d", actual_ver.major, actual_ver.minor, actual_ver.patch) - return nvim_ver_str -end - ---- Generate random integers in the range [Low, High], inclusive, ---- adapted from https://stackoverflow.com/a/12739441/6064933 ---- @low: the lower value for this range ---- @high: the upper value for this range -function M.rand_int(low, high) - -- Use lua to generate random int, see also: https://stackoverflow.com/a/20157671/6064933 - math.randomseed(os.time()) - - return math.random(low, high) -end - ---- Select a random element from a sequence/list. ---- @seq: the sequence to choose an element -function M.rand_element(seq) - local idx = M.rand_int(1, #seq) - - return seq[idx] -end - -function M.add_pack(name) - local status, error = pcall(vim.cmd, "packadd " .. name) - - return status -end - -return M |
