diff options
Diffstat (limited to 'lua/telescope/config.lua')
| -rw-r--r-- | lua/telescope/config.lua | 28 |
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 |
