brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Vim's :Ex browses the folder of the file you are editing

Vim
~/tips/tip-vim-netrw-explore

:Ex

Opens a file browser inside Vim to pick another file.

Vim ships with a file browser called netrw. When you need a file next to the one you are editing, I find it quicker than quitting.

:Ex

:Ex, short for :Explore, replaces the current window with a listing of the folder that holds your file. Move with j and k and press Enter to open a file or go into a folder. - goes up one level.

A few other keys from the listing:

i
d
R
D

i cycles through listing styles, including a tree. d creates a folder, R renames the file under the cursor, and D deletes it. D asks for confirmation, but there is no undo after that, so read the prompt.

For a browser in a split, :Sex and :Vex open it horizontally or vertically. You can also open Vim on a folder, as in vim ., and netrw shows it.

Press F1 inside the listing for the help page. If :Ex gives “not an editor command”, plugins are disabled, for example because Vim runs with -u NONE or as the minimal vim-tiny package. Netrw is a plugin, even though it comes with Vim.

Further reading: Vim help: netrw :Explore, Vim help: netrw quick help

Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more

More Vim tips :%s/<Ctrl-r><Ctrl-w>/newname/g /oldname find . -name "*.conf" | vim – vim --clean file.txt :set textwidth=72 All Vim tips (45) All topics

Link