larkery / zsh-histdb

A slightly better history for zsh
MIT License
1.27k stars 75 forks source link

Track tty in histdb #73

Closed withnale closed 4 years ago

withnale commented 4 years ago

Can we have tty tracking in histdb as well?

Sometimes I want to find the current tab I'm using based on the command. If I know what tab I'm in, I can send a bell to it, and easily find it.

larkery commented 4 years ago

If you write a pull request I might accept it. If I don't, I can promise that I will make few changes so it will be easy to keep merged on your end.

Alternatively you can probably cobble a tiny thing together yourself like this (untested, entirely off the top of my head)

# .. rest of your rc file ..
_histdb_init
mkdir -p ~/.zsh/tty-for
echo "$TTY" > "~/.zsh/tty-for/${HISTDB_SESSION}"
zshexit () { rm -f "~/.zsh/tty-for/${HISTDB_SESSION}" }
alert-session () { echo -e "\a\a" > $(cat ~/.zsh/tty-for/$1) }

or something.

Then you can just use the existing session numbers.

withnale commented 4 years ago

Actually I think this is better than putting it in the DB. Thanks