Skip to content
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

Binding to throw away all (Unstaged / Untracked) changes #2063

Closed
TamaMcGlinn opened this issue Oct 11, 2022 · 6 comments · May be fixed by #2079
Closed

Binding to throw away all (Unstaged / Untracked) changes #2063

TamaMcGlinn opened this issue Oct 11, 2022 · 6 comments · May be fixed by #2079

Comments

@TamaMcGlinn
Copy link

When I want to throw away all changes, I intuitively moved my cursor to the header 'Unstaged' and pressed 'X' but was disappointed that it did not work. Instead, we currently need to enter visual mode, ] to the end of the paragraph and then 'X' - but it will take a long time (for example 20 seconds for about 300 files in my case) because it is saving each file.

It would be nice to have a quick way to do this.

TamaMcGlinn added a commit to TamaMcGlinn/vim-fugitive that referenced this issue Oct 11, 2022
This irreversibly throws away the changes.

Fixes tpope#2063
@tpope
Copy link
Owner

tpope commented Oct 11, 2022

:Git checkout :/ or :Git clean. Not everything needs to be a single character map, and a massive foot bazooka like this is the last thing that should be one.

@tpope tpope closed this as completed Oct 11, 2022
@TamaMcGlinn
Copy link
Author

But but... X is intuitive, and those commands are long to type and remember. And there is no hook at the moment to define this in my own vimrc without clobbering the normal fugitive behaviour. And, like I said in the PR, we can add a dialog asking if you are sure. You're just closing both immediately? Does that mean you don't want discussion or improvement at all?

@tpope
Copy link
Owner

tpope commented Oct 12, 2022

It's such a nonstarter I don't even know where to begin. Why are you deleting hundreds of changed files so often? Whatever you're doing sounds incredibly weird and niche. You might be the only person on the planet that wants it.

Taking the safe, undoable X operator and making it unsafe and permanent when used on a section header is about as far from intuitive as you can get.

@TamaMcGlinn
Copy link
Author

I can make it safe and undoable by just treating it as if X was done on everything inside that header; this would just obviate the V] to select the whole section. To satisfy my need, we could also ask when the number of files is more than some constant (200?) whether we want to do it quickly but without undo. Sound good?

@tpope
Copy link
Owner

tpope commented Oct 12, 2022

I can make it safe and undoable by just treating it as if X was done on everything inside that header; this would just obviate the V] to select the whole section.

I could live with this, but ideally it would come in the form of improving the abstraction, and not more special cases.

To satisfy my need, we could also ask when the number of files is more than some constant (200?) whether we want to do it quickly but without undo.

Absolutely not.

TamaMcGlinn added a commit to TamaMcGlinn/vim-fugitive that referenced this issue Oct 13, 2022
This reversibly throws away the changes.

Fixes tpope#2063
@TamaMcGlinn
Copy link
Author

After using it for two days, I am quite happy with it saving everything. Anything else I need to modify to get this merged?

TamaMcGlinn added a commit to TamaMcGlinn/vim-fugitive that referenced this issue May 2, 2023
This irreversibly throws away the changes.

Fixes tpope#2063
TamaMcGlinn added a commit to TamaMcGlinn/vim-fugitive that referenced this issue Mar 28, 2024
This irreversibly throws away the changes.

Fixes tpope#2063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants