moll / vim-node

Tools and environment to make Vim superb for developing with Node.js. Like Rails.vim for Node.
http://www.vim.org/scripts/script.php?script_id=4674
Other
807 stars 59 forks source link

Make opened modules read-only by default #30

Open nfischer opened 8 years ago

nfischer commented 8 years ago

To me, it makes a lot of sense to make some modules open in read-only when opened by gf or :Nedit and the like. It doesn't make much sense to be able to edit the fs module, which is a standard module.

On the other hand, it makes more sense to be allowed to edit locally downloaded modules. The distinction of course can be easily made, since standard modules such as fs must be curled, while local modules are found locally. So the same logic could be used to set readonly and set nomodifiable.

nfischer commented 8 years ago

This is resolved by #31.

Core modules are opened in readonly mode, and local files are opened with standard permissions.

A possible extension to this would be to open dependencies (things inside node_modules/ and the equivalent for global packages) in readonly as well.

moll commented 8 years ago

Surprising that Netrw itself doesn't set them readonly... I can understand not doing so for protocols that have a standard for uploading files, but for HTTP...