title: Call compinit manually in zsh as part of a bindkey function
body: <p>So, I have setup my <code>.zshrc</code> to have a basic level of syntax checking by creating <code>bindkey</code> lines for basically all character generating keys and pointing them to respective functions that both generate the character and then call the syntax checker.</p>
  <p>It is otherwise working perfectly, however I want to apply it to tab so that it will take into account <code>$BUFFER</code> changes from <code>compinit</code>, however calling <code>compinit</code> manually within the <code>trap_tab</code> function I created doesn't even call <code>compinit</code>.</p>
  <p>Any help is much appreciated!</p>
  <p>Below is the relevant bit. Just uncomment and recomment the <code>bindkey</code> and <code>zle -N</code> lines. When uncommented, even though <code>compinit</code> is called, I do not receive any autofill options when hitting tab.</p>
  <pre><code># Setup basic config stuff for history size, Vim keybindings, and the like
  HISTFILE=~/.histfile
  HISTSIZE=1000
  SAVEHIST=1000
  setopt  extendedglob notify
  unsetopt nomatch
  
  # Auto-completion (double-tab tab)
  zstyle :compinstall filename '/home/terminus/.zshrc'
  autoload -Uz compinit
  compinit
  zstyle ':completion:*' menu select
  
  function trap_tab
  {
      compinit
  }
  
  #bindkey '  ' trap_tab
  #zle -N trap_tab
  
  export EDITOR='vim
  </code></pre>