Code Monkey home page Code Monkey logo

Comments (8)

qrqiuren avatar qrqiuren commented on May 21, 2024

Cool, but maybe it is decided by the shell?

from thefuck.

nwinkler avatar nwinkler commented on May 21, 2024

To avoid adding the fuck commands to history, you can use the following in Bash:

export HISTIGNORE=' *'

Then any command prefixed with a space will not be added to history. So instead of typing fuck, you would need to type fuck (with a space as the first character), and it will not be added to the shell's history.

from thefuck.

arosetti avatar arosetti commented on May 21, 2024

I use zsh, and It seems that the HISTIGNORE trick it's not working. (but It's not so important I've already set to not save duplicates).

I think thefuck could execute "history" command to update the history. I've not tested it but man says:

history change newValue ?event?
Replaces the value recorded for an event with newValue. Event
specifies the event to replace, and defaults to the current event
(not event -1). This command is intended for use in commands that
implement new forms of history substitution and wish to replace the
current event (which invokes the substitution) with the command
created through substitution.

is it cross-shell compatible? :\

from thefuck.

jmeosbn avatar jmeosbn commented on May 21, 2024

I was just about to suggest this. 👍

Avoiding adding fuck commands can at least be configured per shell, whereas adding the modified commands cannot. Ideally the original command would also be left intact (in case thefuck was wrong). Removing the fuck command from within thefuck could be difficult without some hack.

While fc can work differently in different shells, the example below works great in bash - removing the fc command from history while keeping the original and modified commands in the history. In zsh the example works the same, except the fc command remains in history.

$ ls -l /usr
$ fc -e- /usr=/etc

History in bash afterward:

ls -l /usr
ls -l /etc

from thefuck.

nvbn avatar nvbn commented on May 21, 2024

Implemented for zsh and bash in 1.35+

from thefuck.

scorphus avatar scorphus commented on May 21, 2024

Awesome, @nvbn! Thanks! As soon as I have some spare time I can dig this one and implement it for Fish.

from thefuck.

scorphus avatar scorphus commented on May 21, 2024

The solution to this issue Fish-wise depends on fish-shell/fish-shell#825 available in the upcoming release, [Fish 2.2.0](/fish-shell/fish-shell/milestones/fish 2.2.0). I'll keep an eye on that and update the fuck Fish function as soon as that's released.

from thefuck.

nvbn avatar nvbn commented on May 21, 2024

So now it works.

from thefuck.

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.