-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MRU on Branch #38
Comments
does git track this information? i think maybe you could write something that lists files in a directory sorted by their modified by date, which would track with each branch, but then it wouldn't track files which were opened but not modified. |
This command all the files that were edited in the last 5 commits. { git diff --name-only && git log --pretty=format: --name-only HEAD~5..HEAD; } | sort | uniq Is there a way to pipe this to alpha ? So it shows the list of files like the MRU ones? |
I sort of found a way with easypick, telescope and alpha combined: return {
"axkirillov/easypick.nvim",
dependencies = {"nvim-telescope/telescope.nvim"},
config = function()
local easypick = require "easypick"
easypick.setup {
pickers = {
-- Show changed files in the last 5 commits
{
name = "changed_files",
command = "{ git diff --name-only && git log --pretty=format: --name-only HEAD~5..HEAD; } | sort | uniq",
previewer = easypick.previewers.branch_diff {
base_branch = "HEAD~5",
},
}
}
}
vim.keymap.set("n", "<leader>cf", "<cmd>Easypick changed_files<CR>")
end
} And then in alpha.nvim I have a button like this: startify.button("cf", "changed files", "<cmd>Easypick changed_files<cr>") But it would be nice to pipe command, or the results of lua functions, directly to alpha and show the result like the MRU list. |
@marcelarie Adding this action = function(prompt_bufnr, _)
telescope_actions.select_default:replace(function()
telescope_actions.close(prompt_bufnr)
local selection = telescope_action_state.get_selected_entry()
local git_root_path = require("plenary.job"):new({ command = "git", args = { "rev-parse", "--show-toplevel" } }):sync()[1]
vim.cmd(string.format("e %s/%s", git_root_path, selection[1]))
end)
return true
end,
Thanks for sharing your snippet, I find myself use it often! |
It's possible to alpha-stratify be aware of MRU files in the current branch?
The text was updated successfully, but these errors were encountered: