Search code examples
vimindentationauto-indentslimv

How to disable automatic indentation by Slimv for non-Lisp files?


Non-Slimv Behavior

At first, let me show the normal Vim behavior when Slimv is not enabled.

  1. Create a new file: vim foo.c.
  2. Enter insert mode: i
  3. Enter this code: void f()
  4. Press enter

The cursor is now at position 2,1 (2nd row, 1st column).

Slimv Behavior

After installing Slimv, if I perform the steps above, at the end, I find the cursor at position 2,5 (2nd row, 5th column) with four spaces inserted as indentation before the 5th column automatically.

How can I disable this Slimv behavior for non-Lisp files (such as .c files)?


Solution

  • The issue is caused by this line in paredit.vim:

    filetype indent on
    

    I added the option g:paredit_disable_ftindent to paredit.vim to disable the loading of indent files, please add this line to your .vimrc when using paredit.vim (or slimv that also contains paredit.vim):

    let g:paredit_disable_ftindent=1