ranger_tmux icon indicating copy to clipboard operation
ranger_tmux copied to clipboard

Feature request: Also clear when changing directories

Open excited-bore opened this issue 2 years ago • 4 comments

Hi

It's really annoying to see the terminal clutter up with cd's, could there be anything done about this?

Thank you in advance

excited-bore avatar Jan 16 '23 13:01 excited-bore

Hi,

I agree it's a bit annoying.

I've not found a clean way to do this which works across different shells. Things I've explored:

  • Forcibly change the shell's cwd using gdb (see here) This causes some shells to behave unexpectedly (e.g. zsh does not update the prompt)

  • Create a background task for each shell session which listens for change directory commands sent to a socket, and change the current directory when a command is received. This should work pretty well, but would require the user to configure their shell in addition to ranger & tmux.

The second option might be the way to go.

If you have any more ideas how this could be achieved, let me know!

joouha avatar Jan 18 '23 10:01 joouha

I've had another idea - it might be possible to clear the previous line in the terminal by sending escape sequences

joouha avatar Jan 18 '23 11:01 joouha

The above works pretty well actually.

I've implemented this in a branch so you can test it if you like: https://github.com/joouha/ranger_tmux/tree/feature/quiet-cd

joouha avatar Jan 18 '23 11:01 joouha

Ow that's ok, I've actually managed to make it work on my own pretty easily by adding a clear at the end of the send-keys in utils.py

tmux("send-keys", "-t", pane_id, ' cd "{}"'.format(path), "Enter", "clear" , "Enter")' worked for me, after i got it to reinstall

excited-bore avatar Jan 18 '23 20:01 excited-bore