Giter Club home page Giter Club logo

Comments (16)

vivien avatar vivien commented on August 25, 2024 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.

michaelbarlow7 avatar michaelbarlow7 commented on August 25, 2024 15

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.

dagadbm avatar dagadbm commented on August 25, 2024 8

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.

sanrodari avatar sanrodari commented on August 25, 2024 3

bind status D !@?rm %(file)

collide with

'D' toggle-date Toggle date display

so I can't use this :(. thx.

from tig.

dbdr avatar dbdr commented on August 25, 2024 3

I agree "!" would be a natural binding to remove untracked files.

from tig.

psprint avatar psprint commented on August 25, 2024 3

Further refining the binding – require two D-key presses:

bind status DD !@?rm %(file)

from tig.

jonas avatar jonas commented on August 25, 2024 2

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.

jonas avatar jonas commented on August 25, 2024 1

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.

fabioperrella avatar fabioperrella commented on August 25, 2024 1

does anybody knows if it is possible to refresh the status view after deleting the file (in this bind)?

from tig.

fabioperrella avatar fabioperrella commented on August 25, 2024 1

@evmorov you can refresh pressing R

from tig.

dbdr avatar dbdr commented on August 25, 2024

I concur this would be a very useful feature. Thanks for the custom key binding example, that's useful. Some thoughts:

  1. it's probably a good idea to add a manual confirmation, which can be done by using rm -i in the binding

  2. 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?

  3. 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.

dbdr avatar dbdr commented on August 25, 2024

Very neat, thanks @vivien.

Note to others: this requires tig version >= 1.1

from tig.

jonas avatar jonas commented on August 25, 2024

@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.

Schroedingers-Cat avatar Schroedingers-Cat commented on August 25, 2024

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.

evmorov avatar evmorov commented on August 25, 2024

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.

evmorov avatar evmorov commented on August 25, 2024

@fabioperrella oh, ok. It's not that I wanted to hear. Thanks!

from tig.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.