Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Eevee's .zshrc/.tmux.conf.

When I'm running a vim session, and I do Ctrl+z and then ⚘ fg, then it changes my tmux pane title to fg. I'd rather it change back to vim whatever.txt, or whatever I happened to be using.

How can I do this?

share|improve this question

Change the preexec() function in your .zshrc to

function preexec {
  local fg_title
  if [[ $* == fg* ]]; then
     if [[ $* == *%* ]]; then
        fg_title=($(jobs ${${(z)1}[2]}))
        fg_title=($(jobs %%))
     title "${fg_title[5,-1]}"
     title $*

The code is surely not optimal, but it works if you use fg oder fg %2 to put a process into foreground. However I could not figure out to make it work with fg %vi too.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .