diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-02-27 16:26:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-27 16:26:25 +0100 |
| commit | ca92ec1a830a61a0b88fff925f2146ab46e0f7c9 (patch) | |
| tree | 4d30266573d6a009280ba9c31348b9ea76f3daec /lua/telescope/previewers/buffer_previewer.lua | |
| parent | 84732d1d780f1aecb799502be97ec3a403066268 (diff) | |
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
Diffstat (limited to 'lua/telescope/previewers/buffer_previewer.lua')
| -rw-r--r-- | lua/telescope/previewers/buffer_previewer.lua | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/lua/telescope/previewers/buffer_previewer.lua b/lua/telescope/previewers/buffer_previewer.lua index a6e2322..6fa25de 100644 --- a/lua/telescope/previewers/buffer_previewer.lua +++ b/lua/telescope/previewers/buffer_previewer.lua @@ -466,40 +466,23 @@ previewers.git_branch_log = defaulter(function(opts) end end - local remotes = utils.get_os_command_output({ 'git', 'remote' }, opts.cwd) return previewers.new_buffer_previewer { get_buffer_by_name = function(_, entry) return entry.value end, define_preview = function(self, entry, status) - local current_remote = 1 + local cmd = { 'git', '--no-pager', 'log', '--graph', '--pretty=format:%h -%d %s (%cr)', + '--abbrev-commit', '--date=relative', entry.value } - local gen_cmd = function(v) - return { 'git', '--no-pager', 'log', '--graph', '--pretty=format:%h -%d %s (%cr)', - '--abbrev-commit', '--date=relative', v } - end - - local handle_results - handle_results = function(bufnr, content) - if content and table.getn(content) == 0 then - if current_remote <= table.getn(remotes) then - local value = 'remotes/' .. remotes[current_remote] .. '/' .. entry.value - current_remote = current_remote + 1 - putils.job_maker(gen_cmd(value), bufnr, { cwd = opts.cwd, callback = handle_results }) - else - vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "No log found for branch: " .. entry.value }) - end - elseif content and table.getn(content) > 1 then - highlight_buffer(bufnr, content) - end - end - - putils.job_maker(gen_cmd(entry.value), self.state.bufnr, { + putils.job_maker(cmd, self.state.bufnr, { value = entry.value, bufname = self.state.bufname, cwd = opts.cwd, - callback = handle_results + callback = function(bufnr, content) + if not content then return end + highlight_buffer(bufnr, content) + end }) end } |
