Today I Learned

A Hashrocket project

Ready to join Hashrocket? Find Openings here and apply today.

Move a File with Netrw

Today I tried to move a file into a subdirectory using only Netrw commands, and it kind of worked.

Here’s my abridged Netrw window as an example:

ilike-for-case-insensitive-data/
intro-to-hstore/
lateral-joins/
lateral_joins.md

My goal was to move the lateral_joins.md file into the lateral-joins/ directory.

First, I placed the cursor over the target directory and entered mt. This makes that directory the ‘markfile target’.

Next, I moved the cursor over the markdown file, and entered mf to mark the file, followed by mc to copy the file to the marked target directory.

Finally, I deleted the original file with D.

Since this was a little confusing, I tracked my changes with watch git status running in a separate Tmux window. I haven’t found a way to do this as a straight-up move.

Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.