title: How can I make a variable have different value for different tab
body: <p>I'm trying to display the git branch in my status line and I have these code:</p>
  
  <pre><code>function! GitBranch()
      let current_path = expand('%:p:h')
      let cd = "cd " . current_path
      let branch = system(cd . "&amp;&amp; git rev-parse --abbrev-ref HEAD 2&gt;/dev/null | tr -d '\n'")
      return strlen(branch) &gt; 0 ? '  '. branch . ' ' : ''
  endfunction
  
  " Customize status line
  set statusline=
  set statusline+=%#Normal#
  set statusline+=%=
  set statusline+=%#CursorColumn#
  set statusline+=%{GitBranch()}
  set statusline+=%#Normal#
  set statusline+=\ 
  set statusline+=\%y
  set statusline+=\ %p%%
  set statusline+=\ %l:%c
  set statusline+=\
  </code></pre>
  
  <p>Now it calls the function GitBranch() every time I input something, which makes it quite laggy. So I decide to put the branch name in a variable instead of calling the function every time.</p>
  
  <pre><code>let status_git = GitBranch()
  ...
  ...
  set statusline+=%{status_git}
  </code></pre>
  
  <p>Now the question is, if I open a new tab, the variable won't change. So all tabs have the same branch name. Is there any way I can fix this?</p>
  
  <p>I know there's some good plugins like Vim-airline which can do this perfectly. I just want to do this in my way.</p>