<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>alavi.me - vim/nvim</title>
    <subtitle>My mind on the web</subtitle>
    <link rel="self" type="application/atom+xml" href="https://alavi.me/tags/vim-nvim/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://alavi.me"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-01-21T00:00:00+00:00</updated>
    <id>https://alavi.me/tags/vim-nvim/atom.xml</id>
    <entry xml:lang="en">
        <title>Vim Is Much More Powerful Than You Think: Netrw</title>
        <published>2026-01-21T00:00:00+00:00</published>
        <updated>2026-01-21T00:00:00+00:00</updated>
        
        <author>
          <name>
            Alireza Alavi
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://alavi.me/blog/power-of-netrw/"/>
        <id>https://alavi.me/blog/power-of-netrw/</id>
        
        
        <content type="html" xml:base="https://alavi.me/blog/power-of-netrw/">
            
            &lt;p&gt;I&#39;ve been using Neovim for almost 3 years now, and I only used it&#39;s built-in &lt;kbd&gt;Netrw&lt;/kbd&gt; to navigate my project. I always thought Netrw is just a simple file explorer, allowing you to see directories and move between them. That&#39;s all. No tree, no copy pasting or moving files, no opening files in other applications.&lt;br /&gt;
Man, was I wrong.&lt;/p&gt;
&lt;p&gt;Of course I knew about the &lt;kbd&gt;R&lt;/kbd&gt; key which allows you to rename files/dirs, &lt;kbd&gt;%&lt;/kbd&gt; which allows you to create new file,&lt;kbd&gt;D&lt;/kbd&gt; that removes the file/dir and things like that. But no more to be honest. I would just do &lt;code&gt;!thunar .&amp;amp;&lt;/code&gt; when things got a bit complicated.&lt;/p&gt;
&lt;p&gt;It never amazes me that no matter how much I use and learn about Neovim or Vim, there&#39;s still a lot that I don&#39;t know.&lt;br /&gt;
Today I accidentally pressed &lt;kbd&gt;i&lt;/kbd&gt; in Netrw and saw that it has a tree view of your directories. The thing I was most missing from Netrw and it was right there!&lt;/p&gt;
&lt;p&gt;You can learn everything about it just by pressing &lt;kbd&gt;&amp;lt;F1&amp;gt;&lt;/kbd&gt; and going through the manual, but here&#39;s a quick list.&lt;/p&gt;
&lt;h2 id=&quot;cool-shortcuts&quot;&gt;Cool shortcuts&lt;a class=&quot;zola-anchor&quot; href=&quot;#cool-shortcuts&quot; aria-label=&quot;Anchor link for: cool-shortcuts&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Listing/View
&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;&amp;lt;c-l&amp;gt;&lt;/kbd&gt;	Causes Netrw to refresh the directory listing        |netrw-ctrl-l|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;i&lt;/kbd&gt;   Cycle between thin, long, wide, and tree listings    |netrw-i|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;gn&lt;/kbd&gt;	Make top of tree the directory below the cursor      |netrw-gn|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;I&lt;/kbd&gt;	Toggle the displaying of the banner                  |netrw-I|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;gh&lt;/kbd&gt;	Quick hide/unhide of dot-files                       |netrw-gh|&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Marking
&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;mf&lt;/kbd&gt;	Mark a file                                          |netrw-mf|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;mt&lt;/kbd&gt;	Current browsing directory becomes markfile target   |netrw-mt|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;mu&lt;/kbd&gt;	Unmark all marked files                              |netrw-mu|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;mc&lt;/kbd&gt;	Copy marked files to marked-file target directory    |netrw-mc|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;md&lt;/kbd&gt;	Apply diff to marked files (up to 3)                 |netrw-md|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;mg&lt;/kbd&gt;	Apply &lt;code&gt;vimgrep&lt;/code&gt; to marked files                        |netrw-mg|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;mr&lt;/kbd&gt;	Mark files using a shell-style |regexp|                |netrw-mr|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;mv&lt;/kbd&gt;	Apply arbitrary vim   command to marked files        |netrw-mv|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;mx&lt;/kbd&gt;	Apply arbitrary shell command to marked files        |netrw-mx|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;mz&lt;/kbd&gt;	Compress/decompress marked files                     |netrw-mz|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;p&lt;/kbd&gt;	Preview the file                                     |netrw-p|&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;CRUD
&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;d&lt;/kbd&gt;	Make a directory                                     |netrw-d|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;D&lt;/kbd&gt;	Attempt to remove the file(s)/directory(ies)         |netrw-D|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;R&lt;/kbd&gt;	Rename the designated file(s)/directory(ies)         |netrw-R|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;%&lt;/kbd&gt;  Open a new file in netrw&#39;s current directory         |netrw-%|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;x&lt;/kbd&gt; View file with an associated program (e.g. open HTML file in your browser)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Navigation
&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;-&lt;/kbd&gt;	Makes Netrw go up one directory                      |netrw--|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;cd&lt;/kbd&gt;	Make browsing directory the current directory        |netrw-cd|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;t&lt;/kbd&gt;	Enter the file/directory under the cursor in a new tab  |netrw-t|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;v&lt;/kbd&gt;	Enter the file/directory under the cursor in a new browser window.  A vertical split is used.&lt;/li&gt;
&lt;li&gt;Bookmarking
&lt;ul&gt;
&lt;li&gt;&lt;kbd&gt;mb&lt;/kbd&gt;	Bookmark current directory                           |netrw-mb|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;mB&lt;/kbd&gt;	Delete bookmark of current directory                           |netrw-mB|&lt;/li&gt;
&lt;li&gt;&lt;kbd&gt;qb&lt;/kbd&gt;	List bookmarked directories and history              |netrw-qb|&lt;/li&gt;
&lt;li&gt;&lt;code&gt;{number}&lt;/code&gt;&lt;kbd&gt;gb&lt;/kbd&gt;	Go to previous bookmarked directory (or the bookmark number from &lt;kbd&gt;qb&lt;/kbd&gt;)                  |netrw-gb|&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;remote-files&quot;&gt;Remote Files&lt;a class=&quot;zola-anchor&quot; href=&quot;#remote-files&quot; aria-label=&quot;Anchor link for: remote-files&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;This is honestly so awesome.&lt;br /&gt;
You can just communicate with your remote files from SCP, FTP, SSH, Rsync, curl, dav etc.&lt;/p&gt;
&lt;p&gt;I will mostly use this for working on my servers.&lt;br /&gt;
If you use SSH keys to authenticate to your server, it will be as simple as&lt;/p&gt;
&lt;p&gt;&lt;code&gt;nvim rsync://[user]@[host]/[filepath]&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;nvim scp://[user]@[host]//opt/docker-compose-files/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you want to navigate a dir, add a / at the end of the filepath.&lt;/p&gt;
&lt;p&gt;If your SSH key has a password, in your terminal do:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#4C4F69, #CDD6F4); background-color: light-dark(#EFF1F5, #1E1E2E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#1E66F5, #89B4FA);font-style: italic;&quot;&gt;ssh-agent&lt;/span&gt;&lt;span&gt; $&lt;/span&gt;&lt;span&gt;SHELL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#1E66F5, #89B4FA);font-style: italic;&quot;&gt;ssh-add&lt;/span&gt;&lt;span style=&quot;color: light-dark(#40A02B, #A6E3A1);&quot;&gt; //&lt;/span&gt;&lt;span style=&quot;color: light-dark(#40A02B, #A6E3A1);&quot;&gt; this&lt;/span&gt;&lt;span style=&quot;color: light-dark(#40A02B, #A6E3A1);&quot;&gt; will&lt;/span&gt;&lt;span style=&quot;color: light-dark(#40A02B, #A6E3A1);&quot;&gt; ask&lt;/span&gt;&lt;span style=&quot;color: light-dark(#40A02B, #A6E3A1);&quot;&gt; you&lt;/span&gt;&lt;span style=&quot;color: light-dark(#40A02B, #A6E3A1);&quot;&gt; pass&lt;/span&gt;&lt;span style=&quot;color: light-dark(#40A02B, #A6E3A1);&quot;&gt; once&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#1E66F5, #89B4FA);font-style: italic;&quot;&gt;nvim&lt;/span&gt;&lt;span style=&quot;color: light-dark(#40A02B, #A6E3A1);&quot;&gt; rsync://[host]/[filepath]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you don&#39;t have SSH on your destination but have FTP/SFTP do:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;nvim sftp://[user]@[host]/path/to/file&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;NOTE: To be honest I haven&#39;t been able to actually work with files in remote sessions with nvim.
I haven&#39;t gotten much time to troubleshoot it, but I will update with my experiences.
If you know how to work with remote file systems, &lt;a href=&quot;/contact&quot;&gt;contact me&lt;/a&gt;&lt;/p&gt;

        </content>
        
    </entry>
</feed>
