Comments (16)
@dbdr sure, here you go:
bind status D !@?rm %(file)
As described in the tigrc
manpage, ?
asks for confirmation and @
prevents tig to display the command output, making things more integrated.
I've updated the Bindings wiki page with that example.
from tig.
I use "!" a lot to revert changes to files, and I find myself naturally wanting to use the same key to remove new files. Not sure if anyone else feels the same way, but I feel like this would require more than a line in .tigrc to implement, so I might have a go at changing this myself to see how it feels :)
from tig.
why not just implement the status-revert action to also delete files behind a prompt?
! is used everywhere for destructive behavior... makes no sense to add a new D keybinding for it
from tig.
bind status D !@?rm %(file)
collide with
'D' toggle-date Toggle date display
so I can't use this :(. thx.
from tig.
I agree "!" would be a natural binding to remove untracked files.
from tig.
Further refining the binding – require two D
-key presses:
bind status DD !@?rm %(file)
from tig.
Some users have already raised concerns about tig's support of destructive commands. Since it is easy to add support for this in ~/.tigrc I won't add delete functionality to the status view.
from tig.
Add the following line to you ~/.tigrc and press 'D' after highlighting the file in tig's status view:
bind status D !rm %(file)
from tig.
does anybody knows if it is possible to refresh the status view after deleting the file (in this bind)?
from tig.
@evmorov you can refresh pressing R
from tig.
I concur this would be a very useful feature. Thanks for the custom key binding example, that's useful. Some thoughts:
-
it's probably a good idea to add a manual confirmation, which can be done by using rm -i in the binding
-
however it would be nicer and more consistent to have the confirmation step inside the tig interface. Is that possible (could not find it)? If not, would you consider this feature?
-
wouldn't a confirmation prompt answer the "destructive command" objection? For instance: "Are you sure you want to delete file? [YyNn]". This is already the case for ! (revert). Actually, making revert delete untracked files (after confirmation) could be a consistent solution, since this is a similar concept adapted to the context at hand (revert the addition of a file).
from tig.
Very neat, thanks @vivien.
Note to others: this requires tig version >= 1.1
from tig.
@sanrodari The proposed binding is only active in the status view and since it doesn't show any dates, there shouldn't be any need for toggling the date display.
from tig.
Yes, files should be removed if untracked when pressing "!". You have to confirm that action, so I wouldn't be concerned about it, I'd rather expect it.
from tig.
does anybody knows if it is possible to refresh the status view after deleting the file (in this bind)?
@fabioperrella have you found the way to do that?
from tig.
@fabioperrella oh, ok. It's not that I wanted to hear. Thanks!
from tig.
Related Issues (20)
- file-filter crashes with tig --follow HOT 2
- Error when executing `:!git commit --amend` HOT 3
- Distinguish git-lfs staged files
- start view at specific commit/rev HOT 1
- How to show file status in diff view? HOT 1
- tig is slow to start in large repo HOT 3
- Terminal mouse focus reporting glitching tig since ncurses 6.4-20230514 HOT 5
- Chinese (utf-8) character display problem HOT 2
- Error opening terminal xyz HOT 2
- Setting main-options to --follow doesn't work well with commit graph
- [Feature Request] Show modified timestamps (mtime) for files in the Unstaged view HOT 1
- [Bug] `tig blame --reverse` get the wrong revision of file HOT 2
- [Question] Is there any way to override options from configuration files and pass them via command-line arguments? HOT 1
- [Feature Request] Add a way to overwrite default git options HOT 2
- [Question] Is it possible to show current branch name in the Title Window HOT 2
- [Error] character used in tig interface broken HOT 2
- FR: blame view for a diff
- getting in stuck closing editor in tmux
- default view does not honour diff.orderFile for Staged/Unstaged changes HOT 1
- SIGSEGV or assertion failure on search HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tig.