mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-29 22:29:57 +02:00
feat: add LvimUpdate command (#1634)
* feat: add prelimenary LvimUpdate command * feat: use native process management * feat: add a telescope change-log utility * fix: update readme to include the new command
This commit is contained in:
parent
52dd273ca9
commit
a273c46eee
7 changed files with 194 additions and 102 deletions
|
@ -114,6 +114,51 @@ function M.grep_lunarvim_files(opts)
|
|||
require("telescope.builtin").live_grep(opts)
|
||||
end
|
||||
|
||||
function M.view_lunarvim_changelog()
|
||||
local finders = require "telescope.finders"
|
||||
local make_entry = require "telescope.make_entry"
|
||||
local pickers = require "telescope.pickers"
|
||||
local previewers = require "telescope.previewers"
|
||||
local actions = require "telescope.actions"
|
||||
local opts = {}
|
||||
|
||||
local conf = require("telescope.config").values
|
||||
opts.entry_maker = make_entry.gen_from_git_commits(opts)
|
||||
|
||||
pickers.new(opts, {
|
||||
prompt_title = "LunarVim changelog",
|
||||
|
||||
finder = finders.new_oneshot_job(
|
||||
vim.tbl_flatten {
|
||||
"git",
|
||||
"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", "<esc>", actions._close)
|
||||
map("n", "<esc>", actions._close)
|
||||
map("n", "q", actions._close)
|
||||
return true
|
||||
end,
|
||||
sorter = conf.file_sorter(opts),
|
||||
}):find()
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
local telescope = require "telescope"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue