Giter VIP home page Giter VIP logo

Comments (9)

bruno- avatar bruno- commented on August 10, 2024

Hey Mark, thanks for reporting.
I think one of the solutions for this would be to have this in .bashrc:

# commands that don't show in history
export HISTIGNORE="history:some_other_command"

Other than the above, I'd be happy to accept a pull request for this.

@rburny do you have any idea how to fix this?

from tmux-resurrect.

rburny avatar rburny commented on August 10, 2024

Have you noticed that our history write command has a leading space? If you have HISTCONTROL variable set either to ignorespace or ignoreboth, this will cause Bash history to ignore it. These settings are default on Ubuntu, not sure about other distros. If you don't have it yet, just add this to your .bashrc:

export HISTCONTROL=ignoreboth

To learn more, search for HISTCONTROL in man bash.

from tmux-resurrect.

markeissler avatar markeissler commented on August 10, 2024

So that's what the space is for... I added this to my .bashrc:

if [[ -n "${TMUX}" ]]; then
  # do not record the tmux save bash history command
  export HISTCONTROL=ignorespace
fi

That should take care of it the next time I restart tmux's parent terminal session.

@bruno I think adding a note in the README (under Restoring bash history (experimental)) advising non-Ubuntu users to add this to their .bashrc would be the easiest fix.

from tmux-resurrect.

rburny avatar rburny commented on August 10, 2024

Yeah, we should note in a README that HISTCONTROL=ignoreboth is helpful.

BTW, you can safely apply this setting unconditionally, it is pretty convenient (ignoreboth also includes ignoredups, which prevents saving dupicates to history).

from tmux-resurrect.

bruno- avatar bruno- commented on August 10, 2024

Hi guys,
I'm glad you figured out the issue, @rburny thanks for the help.

Before asking for actions on behalf of the users in the readme, is there a way for us to automate this?
@rburny can we prepend the history command with HISTCONTROL=ignoreboth so that commands with space are automatically and always ignored?

from tmux-resurrect.

bruno- avatar bruno- commented on August 10, 2024

So, would updating this line like this work?

local write_command=" HISTCONTROL=ignoreboth history -w '$(resurrect_history_file "$pane_id")'"

from tmux-resurrect.

bruno- avatar bruno- commented on August 10, 2024

Sorry for the number of comments here.. but if the above command won't work, can you please submit a PR for the proposed README update? (please make it terse)

I'm asking this because I just found about the HISTCONTROL from this thread and I'm afraid if I wrote it I might make some basic mistake in the description.

from tmux-resurrect.

rburny avatar rburny commented on August 10, 2024

Prepending the option does not work. I couldn't find a way to achieve this, and I'm not even sure whether we should use such hacks. Since the write command is visibile to the user, I would rather keep it simple and understandable at a glance.

I have added a few lines to README, see #55 .

from tmux-resurrect.

bruno- avatar bruno- commented on August 10, 2024

Thanks for the investigation on this @rburny

Closing the issue as your pull request #55 fixes this!

from tmux-resurrect.

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.