Skip to main content
added 313 characters in body
Source Link
Drew
  • 615
  • 4
  • 9

You can change vim - to vim -R -. From the manual:

Read-only mode. The 'readonly' option will be set. You can still edit the buffer, but will be prevented from accidently overwritingoverwriting a file. If you do want to overwrite a file, add an exclamation mark to the Ex command, as in ":w!". The -R option also implies the -n option (see below). The 'readonly' option can be reset with ":set noro". See ":help 'readonly'".

[The implied -n option disables the swap file.]

(The implied -n option disables It doesn't explicitly state it, but read-only mode also implies "+nomodified". That is, you won't be prompted to save upon exiting if you don't make any changes. If you attempt to make changes, it will first warn you that you are modifying a readonly file, and then prompt you to save the swap file upon exiting.) Depending

Depending on your system, view may also be a symlink to vim that is equivalent to vim -R.

You can change vim - to vim -R -. From the manual:

Read-only mode. The 'readonly' option will be set. You can still edit the buffer, but will be prevented from accidently overwriting a file. If you do want to overwrite a file, add an exclamation mark to the Ex command, as in ":w!". The -R option also implies the -n option (see below). The 'readonly' option can be reset with ":set noro". See ":help 'readonly'".

(The implied -n option disables the swap file.) Depending on your system, view may also be a symlink to vim that is equivalent to vim -R.

You can change vim - to vim -R -. From the manual:

Read-only mode. The 'readonly' option will be set. You can still edit the buffer, but will be prevented from accidently overwriting a file. If you do want to overwrite a file, add an exclamation mark to the Ex command, as in ":w!". The -R option also implies the -n option (see below). The 'readonly' option can be reset with ":set noro". See ":help 'readonly'".

[The implied -n option disables the swap file.]

It doesn't explicitly state it, but read-only mode also implies "+nomodified". That is, you won't be prompted to save upon exiting if you don't make any changes. If you attempt to make changes, it will first warn you that you are modifying a readonly file, and then prompt you to save the file upon exiting.

Depending on your system, view may also be a symlink to vim that is equivalent to vim -R.

Source Link
Drew
  • 615
  • 4
  • 9

You can change vim - to vim -R -. From the manual:

Read-only mode. The 'readonly' option will be set. You can still edit the buffer, but will be prevented from accidently overwriting a file. If you do want to overwrite a file, add an exclamation mark to the Ex command, as in ":w!". The -R option also implies the -n option (see below). The 'readonly' option can be reset with ":set noro". See ":help 'readonly'".

(The implied -n option disables the swap file.) Depending on your system, view may also be a symlink to vim that is equivalent to vim -R.