still edit the buffer, but will
be prevented from accidentally overwriting a file. If you
forgot that you are in View mode and did make some changes,
you can overwrite a file by adding an exclamation mark to
the Ex command, as in ":w!". The 'readonly' option can be
reset with ":set noro" (see the options chapter, |options|).
Subsequent edits will not be done in readonly mode.
The 'updatecount' option will be set to 10000, meaning that
the swap file will not be updated automatically very often.
See |-M| for disallowing modifications.
*-m*
-m Modifications not allowed to be written. The 'write' option
will be reset, so that writing files is disabled. However,
the 'write' option can be set to enable writing again.
*-M*
-M Modifications not allowed. The 'modifiable' option will be
reset, so that changes are not allowed. The 'write' option
will be reset, so that writing files is disabled. However,
the 'modifiable' and 'write' options can be set to enable
changes and writing.
-e *-e* *-E*
-E Start Nvim in Ex mode |gQ|, see |Ex-mode|.
If stdin is not a TTY:
-e reads/executes stdin as Ex commands.
-E reads stdin as text (into buffer 1).
-es *-es* *-Es* *-s-ex* *silent-mode*
-Es Script mode, aka "silent mode", aka "batch mode". No UI,
disables most prompts and messages. Unrelated to |-s|.
See also |-S| to run script files.
-es reads/executes stdin as Ex commands. >
printf "put ='foo'\n%%print\n" | nvim -es
< -Es reads stdin as text (into buffer 1). Use |-c| or "+" to
send commands. >
printf "foo\n" | nvim -Es +"%print"
< These commands display on stdout:
:list
:number
:print
:set
With |:verbose| or 'verbose', other commands display on stderr: >
nvim -es +"verbose echo 'foo'"
nvim -V1 -es +"echo 'foo'"
<
Skips user |config| unless |-u| was given.
Disables |shada| unless |-i| was given.
Disables swapfile (like |-n|).
*-l*
-l {script} [args]
Executes Lua {script} non-interactively (no UI) with optional
[args] after processing any preceding Nvim |cli-arguments|,
then exits. Exits 1 on Lua error. See |-S| to run multiple Lua
scripts without args, with a UI.
*lua-args*
All [args] are treated as {script} arguments and stored in the
Lua `_G.arg` global table, thus "-l" ends processing of Nvim
arguments. The {script} name is stored at `_G.arg[0]`.
Sets 'verbose' to 1 (like "-V1"), so Lua `print()` writes to
output, as well as other message-emitting functions like
|:echo|.
If {script} prints messages and doesn't cause Nvim to exit,
Nvim ensures output ends with a newline.
Arguments before "-l" are processed before executing {script}.
This example quits before executing "foo.lua": >
nvim +q -l foo.lua
< This loads Lua module "bar" before executing "foo.lua": >
nvim +"lua require('bar')" -l foo.lua
< *lua-shebang*
You can set the "shebang" of the script so that Nvim executes
the script when called with "./" from a shell (remember to
"chmod u+x"): >
#!/usr/bin/env -S nvim -l
<
Skips user |config| unless |-u| was given.
Disables plugins unless 'loadplugins' was set.
Disables |shada| unless |-i| was given.
Disables swapfile (like |-n|).
*-ll*
-ll {script} [args]
Executes a Lua script, similarly to |-l|, but the editor is not
initialized. This gives a Lua environment similar to a worker
thread. See |lua-loop-threading|.
Unlike `-l` no prior arguments are allowed.
*-b*
-b Binary mode. File I/O will only recognize <NL> to separate
lines. The 'expandtab' option will be reset. The 'textwidth'
option is set to 0. 'modeline' is reset. The 'binary' option
is set. This is done after reading the |vimrc| but before
reading any file in the arglist. See also |edit-binary|.
*-A*
-A Arabic mode. Sets the 'arabic' option on.
*-H*
-H Hebrew mode. Sets the 'rightleft' option on and the 'keymap'
option