The primary goal of netrw is to access remote files (over a variety of network protocols). Vim doesn't have any native handling for directories: if you run vim -noplugin on a directory, Vim complains that "foo" is a directory and won't save the buffer for that same reason. When you open a directory in Vim, it doesn't load its contents, the way it would for a file. Software that reads a directory must use the directory-specific interfaces. When it comes to the operating system interfaces, there are separate system calls to access directories and regular files: opendir, readdir, rewinddir, closedir corresponding to open, read, rewind, close respectively. When it comes to the on-disk structures, a directory may or may not be represented as a file-like blob of storage, depending on the filesystem. This is no longer true on many modern filesystems and operating systems. In the historical Unix system, directories were implemented as normal files with a special mode indicating that they were directories. Since directories are "mostly" normal files, can't they just be opened as a normal file without any intermediary layer? Aka why all the fanciness? Is this just the component that vim uses for uniform local/network directory access? " =ġ) Why is netrw used in the context of this example?Īccording to, netrw "supports reading and writing files across networks". " Quick Help: :help -:go up dir D:delete R:rename s:sort-by x:exec Vim shows the contents of the foo directory-file as: " = When I execute the following bash commands: mkdir foo touch foo/f1.txt touch foo/f2.txt vim foo 'rm' a file is ok 'rm' a dir will complain w/o -r). As I understand, in Linux directories are mostly normal files w/ some special handling (e.g.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |