title: How to force filename completion under oh-my-zsh?
body: <p><strong>The problem:</strong></p>
  
  <p>Sometimes, when I try to do things in zsh, it won't complete the filenames I want because they don't apply to the current context. Two examples:</p>
  
  <ol>
  <li>I want to force-add a file which is currently ignored in hg or git. oh-my-zsh tries to help me by only completing non-ignored files, but in this case it is a hindrance. I'm forced to type the full path to the file manually.</li>
  <li>I want to use <code>git diff</code> to diff two arbitrary files on my hard drive. These files do not reside in any repository, but who cares?! <code>git diff --no-index</code> is a really nice way to diff any two files. But because they aren't in a repo, zsh won't complete them.</li>
  </ol>
  
  <p><strong>The proposed solution:</strong></p>
  
  <p>I <em>could</em> simply edit the source control context to complete all filenames, regardless of their source control status. But there are a couple limitations:</p>
  
  <ol>
  <li>I don't know how to do that.</li>
  <li>It might be nice to have an "escape hatch" whereby I could <em>force</em> file completion, no matter what the context.</li>
  </ol>
  
  <p>So, I decided instead to bind a key shortcut to force normal, context-free file completion.</p>
  
  <p><strong>What I have so far:</strong></p>
  
  <p>Zsh apparently has an easy way of doing this, as detailed in <a href="https://stackoverflow.com/questions/2658534/bind-key-to-complete-filename-wherever-the-context-is-in-zsh">this question</a>. So I've added the following lines to my <code>.zshrc</code>:</p>
  
  <pre><code>zle -C complete complete-word complete-files
  bindkey '^[[Z' complete
  complete-files () { compadd - $PREFIX* }
  </code></pre>
  
  <p>This causes <em>shift-tab</em> to initiate file completion. It works beautifully in standard zsh! But boo-hoo, for some reason it doesn't work when I source oh-my-zsh. :-(</p>
  
  <p><strong>So is there a way to get this to work with oh-my-zsh, or is there an alternative solution I might find satisfying?</strong></p>