summaryrefslogtreecommitdiff
path: root/lua/telescope/utils.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-28 17:03:59 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-09-28 17:03:59 -0400
commit3592b1f8b0ca207462bf945af52026e592afda30 (patch)
tree9e522af7e92425e5050a47a8367043a0af844b56 /lua/telescope/utils.lua
parent079773ebee5f18f55c72856049c1a332dabe28e2 (diff)
fix: 126
Diffstat (limited to 'lua/telescope/utils.lua')
-rw-r--r--lua/telescope/utils.lua35
1 files changed, 6 insertions, 29 deletions
diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua
index 28e79e0..9d948ce 100644
--- a/lua/telescope/utils.lua
+++ b/lua/telescope/utils.lua
@@ -1,11 +1,10 @@
+local pathlib = require('telescope.path')
+
local utils = {}
-utils.get_separator = (function()
- local val = package.config:sub(1, 1)
- return function()
- return val
- end
-end)()
+utils.get_separator = function()
+ return pathlib.separator
+end
utils.if_nil = function(x, was_nil, was_not_nil)
if x == nil then
@@ -97,29 +96,7 @@ end
-- return result
-- end or nil)
-utils.path_shorten = (function()
- if jit then
- local ffi = require('ffi')
- ffi.cdef [[
- typedef unsigned char char_u;
- char_u *shorten_dir(char_u *str);
- ]]
-
- return function(path)
- if not path then
- return path
- end
-
- local c_str = ffi.new("char[?]", #path + 1)
- ffi.copy(c_str, path)
- return ffi.string(ffi.C.shorten_dir(c_str))
- end
- else
- return function(path)
- return path
- end
- end
-end)()
+utils.path_shorten = pathlib.shorten
utils.path_tail = (function()
local os_sep = utils.get_separator()