5 ms·
Vim has this nice feature where you can edit directories as well as files. Just say: vi dir Now you're looking at a directory listing, and you can move dow
by fexl 17y ago
Vim has this nice feature where you can edit directories as well as files. Just say:
vi dir
Now you're looking at a directory listing, and you can move down to an entry and press Enter to go there.
When you're inside a file, you can go back up with:
:e ..
You can also use wildcards and tab completion. I suppose for finding routines you can use ctags, though I haven't bothered with that in quite a while.
- blasdel 17y agoThat's for browsing directories (to edit the contents of the files), and it's a vim feature not a vi one. If you want to edit directories, as in edit the file metadata they contain, try out vidir from the moreutils project.
- chewbranca 17y agoI use this all the time. Its the best way I've found to deal with the hassle of the rails migrations naming scheme. vim db/migrate then I can easily find the file I'm looking for and quickly open other migration files for reference.
- silentbicycle 17y agoThat didn't work for me with nvi or vim, it just says, "/usr is a directory". Does it require an extension? (I'm assuming your 'vi' is a symlink to 'vim', which is not always the case.) Similarly, Emacs has dired, and in some extensions you can edit the file metadata in place and hit save to rename files, chmod, etc.
- fexl 17y agoRight, I'm talking about vim. On Ubuntu, by default, my "vi" is vim. I'm surprised it didn't work for you using vim explicitly. It works for me using versions 7.1.138 and 7.2.245, from fresh installs, by default, with no fancy configuration or add-ons. When I run vim on /usr, it shows me a directory listing which I can browse and edit. I can create, delete, and rename directories and files right there.
- silentbicycle 17y agoI probably just don't have the relevant plugins installed. I installed vim on this computer for some reason or another, but I usually use Emacs or nvi.
- sapphirecat 17y agoThe behavior seems to be part of vim's netrw plugin. Aside from the obvious `:help netrw` you may find `:help standard-plugin-list` interesting. (netrw has always been enabled-by-default for me, but I've spent most of my time on desktop-oriented Linux distros.)