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

A way to hide history (save and restore) commands from panel #278

Open
informafix opened this issue Oct 31, 2018 · 12 comments
Open

A way to hide history (save and restore) commands from panel #278

informafix opened this issue Oct 31, 2018 · 12 comments

Comments

@informafix
Copy link

informafix commented Oct 31, 2018

Hello

This is not an issue but a behavior i'd like to change.

When saving history, tmux-resurrect shows its command in each tmux panes

I've found in SAVE.SH line 158 local history_w='fc -lLn -64 >'
                              also line 159 local history_r='fc -R'
and in RESTORE.SH line 285 local read_command="fc -R '$history_file'; clear"

So I ask myself if there's a way to hide those commands showing very frequently in tmux panes, like adding > /dev/null at the end of those commands ?
or using the SILENT flag
thanks

@leseb
Copy link

leseb commented Nov 4, 2018

I have the exact same problem, all my panes are filled with fc -lLn -64 > '/Users/leseb/.tmux/resurrect/zsh_history-leseb:7.0. I didn't have this until recently and it's quite annoying :(

@vifreefly
Copy link

vifreefly commented Nov 13, 2018

Yes, I found that annoying too. Even if it's not possible to do not print these command to the panes, it is possible to clear the pane output after command execution. For example I have following binding to clear window pane:

bind C-l send-keys -R \; send-keys C-l \; clear-history

BTW, great plugin, thanks a lot!

@tonywoode
Copy link

tonywoode commented Nov 13, 2018

everything is amazing with my resurrect life! (macOS 10.12.6, Iterm2 3.2.5, tmux 2.8, latest ressurect and continuum)

Apart from this. I updated my tmux plugins after 'some time' today to find that these things happen at the continuum interval:

  1. multiple fc -R commands appear in each terminal
  2. some of those commands echo back things like:
    ^E fc -R '/Users/twoode/.tmux/resurrect/zsh_history-0:1.2', so quickly take up the whole pane
  3. the running of those commands messes up my history, so if i'm relying on repeated up-cursor running of the same command, I can't run it any longer. For example, It seems that if i have half-typed a command, and the fc command runs, it will send the entire error message produced by the result to my history making tens of lines of bad history entries!
  4. A large message regarding the fc command sometimes totally replaces my vim session, requiring multiple presses of the return key to clear and get back to all the vim windows
  5. the tmux command line sometimes gets activated with the message displayed (jump forward), and text like:
'cd [some path on my pc]; open [some file on my pc] > /dev/null' returned 1                                                                    
'cd [some path on my pc]; open "s" > /dev/null' returned 1

it overwrites the entire tmux window, again requiring interaction to clear

I see this is a very similar issue to #86, but with zsh. I also see this: https://github.com/AdrieanKhisbe/zsh-quiet-accept-line - Adriene says that he made this plugin to help ease this issue, but he doesn't say how he modded, I don't see a fork he's made, nor interaction with the issues here...

Having these issues with interval at 15 minutes is not doable. I didn't even notice zsh wasn't saving my history previously. Is there any better solution than set -g @resurrect-save-shell-history 'off' ?

@bruno-
Copy link
Member

bruno- commented Nov 17, 2018

Hi guys,

I'm sorry that saving shell history isn't working flawlessly for you. As you know, this feature is marked "experimental" so yea, not perfect.

I thought hard if this downside could be avoided (for bash) and found no solution. I personally gave up on using this feature and was considering removing it altogether because it cannot be made right. At this point, I'm at most accepting improvements for it.

I'd also be ok with honestly writing downsides upfront in this doc so that new users don't get too excited about it https://github.com/tmux-plugins/tmux-resurrect/blob/master/docs/restoring_shell_history.md

@nickjj
Copy link

nickjj commented Dec 12, 2018

@bruno-, if this feature is on its way to being abandoned, do you have any ideas on how to approach this problem with a different strategy all together?

For example, there's this fork of your project (https://github.com/markeissler/tmux-resurrect-ng#why) that says it integrates with your bash prompt directly and runs some commands in the background. I'd rather stick to your plugin because it's well maintained and works with newer versions of tmux.

Any thoughts on using that type of strategy (or similar) in your plugin? Thanks for the great plugin btw!

@bruno-
Copy link
Member

bruno- commented Dec 12, 2018

Hey,

I'm open to accepting a PR with another working strategy that's not too hacky.

@nickjj
Copy link

nickjj commented Dec 12, 2018

I'm new to the tmux ecosystem beyond just using it, so I wouldn't really know where to begin with that when it comes to plugin development. Do you have any general ideas on how it could be implemented in a non-hacky way?

Currently I'm running Windows 10 with WSL and tmux works great there, but Windows is Windows, which means quite a few of unplanned reboots (forced patches that are automated by Microsoft), so losing my sessions is a real problem. Your plugin is a fantastic fix for that, but history is important too.

@roachsinai
Copy link

Hi @bruno- . It seems once I set set -g @resurrect-save-shell-history 'on' on .tmux.conf, I have to set set -g @resurrect-save-shell-history 'off' to unset the saving history function which means comment set -g @resurrect-save-shell-history 'on' on .tmux.conf doesn't work.

And after restore, I always got a % on the shell, though it's not an so annoying problem, I want to know it's my setting error or I got same with everyone.

image

@macandchief
Copy link

I'm not a long time tmux-resurrection user but really like it. History is kind of crucial for me, without history I suppose using a tiling wm with pre-configured terminals opening at start might an alternative. At least history would be available from the shell. Actually I intended to ask whether there is a chance to get history working with ksh but I suppose I know the answer. Anyhow, this is a very useful tool, thank you for your work.

@bruno-
Copy link
Member

bruno- commented Apr 23, 2019

@macandchief history feature is very buggy, and honestly not recommended as it just does not work. I'd like to remove it from this plugin.

@liamaharon
Copy link

I've found another way to keep history of commands I make inside my tmux panes:

https://askubuntu.com/a/339925

You have to preserve bash history in multiple bash shells. To do this, be sure that you have the following lines in your ~/.bashrc file:

# avoid duplicates..
export HISTCONTROL=ignoredups:erasedups

# append history entries..
shopt -s histappend

# After each command, save and reload history
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

it's not perfect as all panes share the same history, but it's much better than nothing

hope this helps someone

@pdecat
Copy link

pdecat commented Oct 30, 2020

Maybe sending signals to trigger a bash helper function could make this work without invoking history commands from the terminal?

http://blog.nqzero.com/2016/02/save-bash-history-remotely-by-sending.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants