diff options
author | kylo252 <[email protected]> | 2021-12-11 20:18:16 +0100 |
---|---|---|
committer | kylo252 <[email protected]> | 2021-12-11 20:18:16 +0100 |
commit | fc756d8151b2f55044b8049807d199fbfb01b3bf (patch) | |
tree | 54ff77f66315abdc440802ceb535662a5c4eabf4 /lua/lvim/core/telescope/custom-finders.lua | |
parent | 3a2d62ed2510ca05eb6ea87240a86df82338f5aa (diff) | |
parent | f7d883b6b92d66c222fd0d4e3d398c1f4fcea882 (diff) |
Merge remote-tracking branch 'origin/rolling' into release-candidate
Diffstat (limited to 'lua/lvim/core/telescope/custom-finders.lua')
-rw-r--r-- | lua/lvim/core/telescope/custom-finders.lua | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lua/lvim/core/telescope/custom-finders.lua b/lua/lvim/core/telescope/custom-finders.lua index c3347fd0..5ce1485c 100644 --- a/lua/lvim/core/telescope/custom-finders.lua +++ b/lua/lvim/core/telescope/custom-finders.lua @@ -39,12 +39,22 @@ function M.grep_lunarvim_files(opts) builtin.live_grep(opts) end +local copy_to_clipboard_action = function(prompt_bufnr) + local _, action_state = pcall(require, "telescope.actions.state") + local entry = action_state.get_selected_entry() + local version = entry.value + vim.fn.setreg("+", version) + vim.fn.setreg('"', version) + vim.notify("Copied " .. version .. " to clipboard", vim.log.levels.INFO) + actions.close(prompt_bufnr) +end + function M.view_lunarvim_changelog() - local opts = {} + local opts = themes.get_ivy { cwd = get_lvim_base_dir() } opts.entry_maker = make_entry.gen_from_git_commits(opts) pickers.new(opts, { - prompt_title = "LunarVim changelog", + prompt_title = "~ LunarVim Changelog ~", finder = finders.new_oneshot_job( vim.tbl_flatten { @@ -52,22 +62,17 @@ function M.view_lunarvim_changelog() "log", "--pretty=oneline", "--abbrev-commit", - "--", - ".", }, opts ), previewer = { - previewers.git_commit_diff_to_parent.new(opts), - previewers.git_commit_diff_to_head.new(opts), previewers.git_commit_diff_as_was.new(opts), - previewers.git_commit_message.new(opts), }, --TODO: consider opening a diff view when pressing enter attach_mappings = function(_, map) - map("i", "<enter>", actions._close) - map("n", "<enter>", actions._close) + map("i", "<enter>", copy_to_clipboard_action) + map("n", "<enter>", copy_to_clipboard_action) map("i", "<esc>", actions._close) map("n", "<esc>", actions._close) map("n", "q", actions._close) |