title: VI editor "ESC" key and "Ctrl + [" do not work correctly
body: <p>I am a complete beginner with VI editor.</p>
  
  <p>I had a chance of using the VI editor by typing <code>git commit</code> instead of <code>git commit -m "my comment"</code> when commenting my commit to my git repository.</p>
  
  <p>I learned that I would go into "edit" mode by pressing <code>i</code> in the VI command line. And I also learned that I go back to the command mode by pressing either <code>ESC</code> key or <code>Ctrl + [</code> key combination. However, neither keys get me out of the "edit" mode.</p>
  
  <p>What happens is that pressing either keys do the same thing, something that seems like accumulating ESC key. Each time I press either key, I see something like below in the bottom line of the screen:</p>
  
  <ul>
  <li>Pressed once:</li>
  </ul>
  
  <p><code>ESC-</code></p>
  
  <ul>
  <li>Pressed twice:</li>
  </ul>
  
  <p><code>ESC ESC-</code></p>
  
  <ul>
  <li>Pressed three times:</li>
  </ul>
  
  <p><code>ESC ESC ESC</code></p>
  
  <p>Since I know that the command to save and exit is <code>:wq</code>, when I press <code>ESC</code> one time and followed by <code>:</code>, the command line immediately turns into to <code>Eval:</code>. It seems like <code>ESC + :</code> is the key combination for such command.</p>
  
  <p>This seems weird. What would be the problem and how could I fix it?</p>
  
  <p>Thanks in advance for your help.</p>
  
  <p><img src="https://i.stack.imgur.com/hf1WY.png" alt="my screen"></p>
  
  <hr>
  
  <p>Edit</p>
  
  <p>I found the below codes from <code>.gitconfig</code> file in my root directory. Is this causing the problem?</p>
  
  <pre><code>[core]
          autocrlf = input
          safecrlf = true
          editor = emacs
  </code></pre>
  
  <p>SOLVED! My problem was due to the <code>[core] editor</code> part of the global settings of <code>.gitconfig</code>. Once I changed it to <code>editor = vi</code> I was able to exit out using VI's shortcuts. Thanks everybody for helping me out.</p>