如何打开一些文件/目录读写,其他只读

时间:2022-09-11 16:52:59

This is similar to "Split vim window with one file read/write and one file read-only".

这类似于“Split vim window with one file read / write and one file read-only”。

From the command line, I want to open files in one directory as read-write, and files in another directory as read-only. How do I do this?

从命令行,我想打开一个目录中的文件作为读写,另一个目录中的文件作为只读。我该怎么做呢?

For example:

例如:

vim read-write-dir/**/* read-only-dir/**/* # zsh

Listing the files individually isn't an option, there's a large number of files under each directory (I use bufExplorer).

单独列出文件不是一个选项,每个目录下都有大量文件(我使用bufExplorer)。

My motivation is, I'm editing two programs in different OSX Terminal tabs, and Vim gets unhappy about a file being edited twice.

我的动机是,我正在不同的OSX终端选项卡中编辑两个程序,而Vim对正在编辑两次的文件感到不满。

1 个解决方案

#1


0  

If you want to open a read-only file and read-write file while starting Vim, you can use the -c option in your terminal:

如果要在启动Vim时打开只读文件和读写文件,可以在终端中使用-c选项:

vim -c ":view file_read_only" file_read_write

Then you can switch between them using :e #

然后你可以使用以下方式切换它们:e#

#1


0  

If you want to open a read-only file and read-write file while starting Vim, you can use the -c option in your terminal:

如果要在启动Vim时打开只读文件和读写文件,可以在终端中使用-c选项:

vim -c ":view file_read_only" file_read_write

Then you can switch between them using :e #

然后你可以使用以下方式切换它们:e#