-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
[Feature] Ability to specify popup arguments from :Neogit
command
#864
Comments
First off, thanks for the idea. However... Neogit isn't a fugitive replacement, in terms of how it's used. The two plugins have different intended modes of interaction. Neogit is a git client in the spirit of https://magit.vc/, driven by popup buffers. You miss out on so much by just invoking the popups directly, I don't want to make it so you can skip THOSE. For example, almost all popups will consume whatever commit(s) are selected or under the cursor. You completely miss this if you invoke a popup directly. Of course, this is not for everyone! So no worries there, but.. If you like fugitive, why not keep using it? Also, there are some technical reasons this would be tough to accomplish, but, if you're really keen, you could call the actions directly |
Hey, thanks for the quick response.
Yeah, absolutely. I usually do use the popups, and I mostly interact with Neogit through the
I started using Fugitive many years ago, and added Neogit about a year ago. I've slowly eliminated my use of Fugitive, and pretty much the only thing I use now are those mappings I mentioned in my previous message. (Tangent: Recently, I installed noice, and now making commits with Fugitive has an annoying compatibility issue due to Fugitive using I still think this is a worthwhile idea, but that's just me.
Thanks for the idea, I'll try this out! |
Got something working, thanks for your help! local function neogit_action(popup, action, args)
return function()
require'plenary.async'.run(function()
require('neogit.popups.' .. popup ..'.actions')[action] {
get_arguments = function()
return args
end
}
end)
end
end
vim.keymap.set('n', '<leader>gcc', neogit_action('commit', 'commit', {'--verbose'}))
vim.keymap.set('n', '<leader>gca', neogit_action('commit', 'commit', {'--verbose', '--all'}))
vim.keymap.set('n', '<leader>gcA', neogit_action('commit', 'commit', {'--verbose', '--amend'})) |
Yes! :) It would also help with briefly displaying popup when I know exactly what I want to do, like @b0o described: |
hmmm. Yeah, populating the popup with a specified state as determined by the flags set is... tricky. Honestly not sure how to go about that with the current API, and I'm not especially keen on rewriting that. But direct access to the actions is super doable, as illustrated above. It won't work for everything, as some args are actually handled internally and never reach the CLI ( |
I have been using Fugitive for years and have developed muscle memory for many of my Fugitive-based mappings. For example:
I would like to transition fully over to Neogit, but I want to keep my workflow more or less the same. I propose being able to pass arguments to Neogit popups directly from the command line, like so:
I imagine it would work like this:
If an argument is passed, it is pre-toggled in the Neogit popup.
If an action is passed, like
c
forcommit
ora
foramend
, the popup would not be displayed at all.The text was updated successfully, but these errors were encountered: