Files
telescope.nvim/lua/telescope/init.lua
Simon Hauser ca92ec1a83 fix: a lot of small things and adds more customization for caret (#554)
Attention:
prompt_prefix will no longer add a space at the end. So if you still want a space at the end make sure your configuration has one.
The default should not be changed. So if you haven't copied prompt_prefix in your config this doesn't affect you.

Feat:
- prompt prefix does no longer always end with space
- selection_caret configurable. Default: `> `
- result_prefix configurable. Default: `  `
- more actions for git_branches
  - <c-t> does track the branch
  - <c-r> does rebase branch
  - also added delete branch action but not configured. See readme on how to do that

Fixes:
- fix docgen ci
- Better error for lsp_workspace_symbols
- better formatting for CONTRIBUTING.md
- move from systemlist to plenary.job
- git branch now supports checkout on remote branches
2021-02-27 16:26:25 +01:00

77 lines
2.1 KiB
Lua

require('telescope._compat')
local _extensions = require('telescope._extensions')
local telescope = {}
-- TODO: Add pre to the works
-- ---@pre [[
-- ---@pre ]]
---@brief [[
--- Telescope.nvim is a plugin for fuzzy finding and neovim. It helps you search,
--- filter, find and pick things in Lua.
---
--- To find out more:
--- https://github.com/nvim-telescope/telescope.nvim
---
--- :h telescope.setup
--- :h telescope.builtin
--- :h telescope.layout
--- :h telescope.actions
---@brief ]]
---@tag telescope.nvim
--- Setup function to be run by user. Configures the defaults, extensions
--- and other aspects of telescope.
---@param opts table: Configuration opts. Keys: defaults, extensions
---@eval { ["description"] = require('telescope').__format_setup_keys() }
function telescope.setup(opts)
opts = opts or {}
if opts.default then
error("'default' is not a valid value for setup. See 'defaults'")
end
require('telescope.config').set_defaults(opts.defaults)
_extensions.set_config(opts.extensions)
end
--- Register an extension. To be used by plugin authors.
---@param mod table: Module
function telescope.register_extension(mod)
return _extensions.register(mod)
end
--- Load an extension.
---@param name string: Name of the extension
function telescope.load_extension(name)
return _extensions.load(name)
end
--- Use telescope.extensions to reference any extensions within your configuration.
--- While the docs currently generate this as a function, it's actually a table. Sorry.
telescope.extensions = require('telescope._extensions').manager
telescope.__format_setup_keys = function()
local descriptions = require('telescope.config').descriptions
local names = vim.tbl_keys(descriptions)
table.sort(names)
local result = { "", "", "Valid keys for {opts.defaults}" }
for _, name in ipairs(names) do
local desc = descriptions[name]
table.insert(result, "")
table.insert(result, string.format("%s*telescope.defaults.%s*", string.rep(" ", 70 - 20 - #name), name))
table.insert(result, string.format("%s: ~", name))
table.insert(result, string.format(" %s", desc))
end
return result
end
return telescope