Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

Change the preexec() function in your .zshrc to

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.