15

I'm normally a straight vim user (just out of habit, no particular preference) and I'm giving neovim a spin. So far I like it but...

For the love of all that's holy, how do I disable automatic indentation?

I have noautoindent set, nosmartindent set, filetype indent off, but neovim keeps inserting indentations. The only thing that works is setting paste on, but that's not the right solution to this problem.

Please help. This is driving me nuts!

you are viewing a single comment's thread
view the rest of the comments
[-] ExtremeDullard@lemmy.sdf.org 2 points 2 years ago* (last edited 2 years ago)

Okay so...

I reinstalled Neovim 11 from scratch. ~/.config/nvim/ is empty:

  • I start "nvim Makefile", type "test:<ENTER": Neovim inserts a tab.
  • I start "nvim Makefile", type ":se noautoindent" (or ":se noai") then "test:": Neovim inserts a tab - i.e. Neovim ignores noautoindent
  • I start "nvim Makefile", type ":se indentexpr=" then "test:": Neovim does NOT insert a tab: that works!
  • I put "se indentexpr=" in ~/.config/nvim/init.vim, start "nvim Makefile", type "test:<ENTER": Neovim inserts a tab - i.e. it ignores the statement in init.vim. But it doesn't ignore other statements in init.vim: if I put "se bg=light" in it for instance, the background does indeed show up as light.

So it seems the crux of the issue is that init.vim isn't parsed properly.

EDIT: but putting "filetype indent off" in ~/config/nvim/init.vim seems to do the trick. Thanks for the hint! This is a lot more complicated than it needs to be ๐Ÿ™‚

EDIT #2: ":syntax off" doesn't turn off the syntax either. Well, I've had enough. Back to plain old vim...

this post was submitted on 15 Jun 2024
15 points (89.5% liked)

Neovim

2932 readers
1 users here now

founded 3 years ago
MODERATORS