summaryrefslogtreecommitdiff
path: root/lua/telescope/config.lua
diff options
context:
space:
mode:
authorJINNOUCHI Yasushi <me@delphinus.dev>2021-06-15 03:47:33 +0900
committerGitHub <noreply@github.com>2021-06-14 20:47:33 +0200
commit0c1bc129da3f684b04d72530dddaedb5255f12ef (patch)
tree110622ddcdd5faaef686fc87c23a01300626f155 /lua/telescope/config.lua
parent398a0d391aa2afcda1521a8e86b820ffb599b60b (diff)
chore: use plenary.strings and remove strings functions from utils (#690)
Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
Diffstat (limited to 'lua/telescope/config.lua')
-rw-r--r--lua/telescope/config.lua28
1 files changed, 3 insertions, 25 deletions
diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua
index 2c1b463..4ca3d0a 100644
--- a/lua/telescope/config.lua
+++ b/lua/telescope/config.lua
@@ -1,3 +1,5 @@
+local strings = require('plenary.strings')
+
-- Keep the values around between reloads
_TelescopeConfigurationValues = _TelescopeConfigurationValues or {}
_TelescopeConfigurationPickers = _TelescopeConfigurationPickers or {}
@@ -13,30 +15,6 @@ local function first_non_null(...)
end
end
-local dedent = function(str, leave_indent)
- -- find minimum common indent across lines
- local indent = nil
- for line in str:gmatch('[^\n]+') do
- local line_indent = line:match('^%s+') or ''
- if indent == nil or #line_indent < #indent then
- indent = line_indent
- end
- end
- if indent == nil or #indent == 0 then
- -- no minimum common indent
- return str
- end
- local left_indent = (' '):rep(leave_indent or 0)
- -- create a pattern for the indent
- indent = indent:gsub('%s', '[ \t]')
- -- strip it from the first line
- str = str:gsub('^'..indent, left_indent)
- -- strip it from the remaining lines
- str = str:gsub('[\n]'..indent, '\n' .. left_indent)
- return str
-end
-
-
local sorters = require('telescope.sorters')
-- TODO: Add other major configuration points here.
@@ -69,7 +47,7 @@ function config.set_defaults(defaults)
config.values[name] = get(name, default_val)
if description then
- config.descriptions[name] = dedent(description)
+ config.descriptions[name] = strings.dedent(description)
end
end