Disabling "Helpful" Things

How do I disable autoindent? I have tried:

set noautoindent
set nosmartindent
set nocindent

but nothing seems to work.

How do I disable auto updating of a modified file? When I have a file open read-only, if the file is modified in another nvim instance, the read-only file is automatically updated. How do I disable that entirely and without warning?

The indentation design in vim is extraordinarily stupid, I have no idea whatā€™s going on half of the time. Try adding filetype plugin off in your init.vim.

As for the second question: Iā€™m not sure if thatā€™s even possible since the readonly property is only valid for a single buffer. This is a bit of a weird usecase if Iā€™m being honest, couldnā€™t you open a new, empty buffer and just copy the text there?

For the first question, these are all different indentation strategies, and thereā€™s no single ā€œindent offā€ option. What I expect is happening (and @dundargoc already alluded to) is that a filetype plugin is setting them, overriding what you put in your init.vim. filetype plugin off (or just nvim -u NONE) is a good way to check whether that is the case; but itā€™s not a good fix in general. If itā€™s only one filetype, you can override the plugin by putting the command in .config/nvim/after/ftplugin/<filetype>.vim.

For the second (unrelated!) question, look at :h 'autoread'.

1 Like

Unfortunately no progress with either issue. Setting the following in ~/.config/nvim/init.vim:

filetype indent off
set noautoread

The filetype indent off has no effect. Just to be clear, when I type ā€˜oā€™ to open a new line below, the cursor becomes positioned indented. Should I be setting this in combination with other autoindent settings?

The set noautoread does stop it from auto-reading. However instead I now get a warning at the bottom of the page:

W11: Warning: File "setup/ConsoleMenu.java" has changed since e...
See ":help W11" for more info.
[O]K, (L)oad File:

Ironically this warning is why I sought out nvim in the first place.

As for the use case, I will explain:

As a software developer, I frequently want to view the original unmodified file while Iā€™m simultaneously modify it in another terminal. This is a sort of before and after comparison.

I donā€™t want syntax highlighting. I donā€™t want it to warn me that a file that I have open read-only has been modified elsewhere (which doesnā€™t even make sense to me since itā€™s open read-only). I donā€™t want it to autoread files. I donā€™t want it to autoindent lines. I donā€™t want it to ā€œautoā€ anything. Is there was a version of vi that was just absolutely minimal. I want vi like it was in 1996 before George Lucas added CGI scenes to Star Wars.

Iā€™m dumb. I meant to write filetype indent off, not filetype plugin off. Note: this has to be set in your init.vim, doesnā€™t work on the command line.