From a9bf545e0fc76882d99a3539f317155ce6c76d35 Mon Sep 17 00:00:00 2001 From: Lee Marlow Date: Sun, 14 Nov 2021 06:00:59 -0700 Subject: Bugfix: allow LunarVim changelog to work outside the lvim directory (#1952) --- lua/lvim/core/telescope/custom-finders.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lua/lvim/core/telescope/custom-finders.lua') diff --git a/lua/lvim/core/telescope/custom-finders.lua b/lua/lvim/core/telescope/custom-finders.lua index c3347fd0..68fd0b07 100644 --- a/lua/lvim/core/telescope/custom-finders.lua +++ b/lua/lvim/core/telescope/custom-finders.lua @@ -40,7 +40,7 @@ function M.grep_lunarvim_files(opts) end function M.view_lunarvim_changelog() - local opts = {} + local opts = { cwd = get_lvim_base_dir() } opts.entry_maker = make_entry.gen_from_git_commits(opts) pickers.new(opts, { @@ -52,8 +52,6 @@ function M.view_lunarvim_changelog() "log", "--pretty=oneline", "--abbrev-commit", - "--", - ".", }, opts ), -- cgit v1.2.3 From e0336ed029f8368fb1c7a0240f93af1ccf409ffd Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Wed, 1 Dec 2021 21:24:48 +0100 Subject: fix: more accessible changelog (#2019) --- lua/lvim/core/telescope/custom-finders.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lua/lvim/core/telescope/custom-finders.lua') diff --git a/lua/lvim/core/telescope/custom-finders.lua b/lua/lvim/core/telescope/custom-finders.lua index 68fd0b07..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 = { cwd = get_lvim_base_dir() } + 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 { @@ -56,16 +66,13 @@ function M.view_lunarvim_changelog() 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", "", actions._close) - map("n", "", actions._close) + map("i", "", copy_to_clipboard_action) + map("n", "", copy_to_clipboard_action) map("i", "", actions._close) map("n", "", actions._close) map("n", "q", actions._close) -- cgit v1.2.3