title: Can't open file for writing when vim recover file with swp file
body: <p>I want to recover the <code>/home/lufei/market/resources/views/user.blade.php</code>, here is the place of <code>swp</code> file.</p>
  
  <pre><code>&gt; lufei@localhost:~/market$ ls resources/views/.user.blade.php.swp 
  &gt; resources/views/.user.blade.php.swp
  </code></pre>
  
  <p>I use <code>vim -r resources/views/.user.blade.php.swp</code> to recover the file, I get this,</p>
  
  <blockquote>
    <p>E306: Cannot open resources/views/.user.blade.php.swp Press ENTER or
    type command to continue</p>
  </blockquote>
  
  <p>When I use <code>sudo vim -r resources/views/.user.blade.php.swp</code> I can open the file, but when I use <code>:wq</code> in the vim I get </p>
  
  <blockquote>
    <p>"/root/market/resources/views/user.blade.php"<br>
    "/root/market/resources/views/user.blade.php" E212: Can't open file
    for writing Press ENTER or type command to continue</p>
  </blockquote>
  
  <p>From the info above I think vim want to save the file to the root directory. From the <a href="https://stackoverflow.com/q/15898593/6521116">vi - getting an error E212: Can't open file for writing</a>, I guess if I create path <code>/root/market/resources/views/</code> may work. But I want to directly save the file to the right place <code>/home/lufei/market/resources/views/user.blade.php</code>. So I use <code>su &amp;&amp; cd /home/lufei/market</code> then <code>vim -r resources/views/.user.blade.php.swp</code>. But when I <code>:wq</code> in vim , I also get </p>
  
  <pre><code>"~/market/resources/views/user.blade.php"                                                        
  "~/market/resources/views/user.blade.php" E212: Can't open file for writing
  Press ENTER or type command to continue
  </code></pre>
  
  <p>From above trying, no matter I use normal user or the root user, when I recover the file, vim  will try to save the file to the wrong place which path is not exist.</p>
  
  <p><strong>Can I directly recover the file to the right place</strong>, without create a temp path and then copy the recoveried file back to the right path.</p>