title: Remap <C-n> and <C-p> for popup menu in vim
body: <p>There are two ways to select candidate in popup-menu.</p>
  
  <p>1 <code>&lt;C-n&gt; or &lt;C-p&gt;</code> can select candidate and auto fill keyword.</p>
  
  <p><img src="https://i.stack.imgur.com/klibL.png" alt="enter image description here"></p>
  
  <p>2 <code>&lt;Up&gt; or &lt;Down&gt;</code> to select candidate need to press enter to finish the completion.</p>
  
  <p>You can also read this link about up and down in popupmenu-keys.(<a href="http://vimdoc.sourceforge.net/htmldoc/insert.html#popupmenu-keys" rel="nofollow noreferrer">this</a>)</p>
  
  <p><img src="https://i.stack.imgur.com/WVBDC.png" alt="enter image description here"></p>
  
  <p>I prefer to the behavior of <code>&lt;Up&gt; or &lt;Down&gt;</code>, but I don't like to press arrows in vim.</p>
  
  <p>I decide to remap <code>&lt;C-n&gt; or &lt;C-p&gt;</code>, and let <code>&lt;C-n&gt; or &lt;C-p&gt;</code> to do the same behavior.</p>
  
  <p>This is my config.</p>
  
  <p><code>imap &lt;expr&gt;&lt;C-n&gt; pumvisible() ? "\&lt;Down&gt;" : "    \&lt;C-n&gt;"</code></p>
  
  <p><code>imap &lt;expr&gt;&lt;C-p&gt; pumvisible() ? "\&lt;Up&gt;" : "    \&lt;C-p&gt;"</code></p>
  
  <hr>
  
  <p>I change my config with the answer.</p>
  
  <p>There are two cases that I meet.</p>
  
  <p>1.To trigger the popup menu with <code>&lt;c-n&gt;</code>, and it works well.</p>
  
  <p>2.To trigger the popup menu with <code>&lt;c-x&gt;&lt;c-p&gt;</code>, and it doesn't. <code>&lt;C-n&gt; or &lt;C-p&gt;</code> works by default.</p>