0

How do I make equalprg match my custom indent settings? They are like:

let b:did_indent = 1
set expandtab       
set shiftwidth=2
set softtabstop=2

set autoindent

And they format the code to this (actually I have to add the 2 extra spaces myself):

(. fs (writeFile "test.txt" "some text" (fn [err]
  (. res(send (if err "error" "done")))

And when I use =, this is what I got:

(. fs (writeFile "test.txt" "some text" (fn [err]
                                         (. res(send (if err "error" "done")))

How do I keep the first form?

Also, would it be possible to add the leading spaces automatically then, because I suppose they would be scrapped?

  • This one holds a further requirement not edited into the duplicate. – wbogacz Oct 21 '17 at 14:07
0

equalprg specifies an external program, there is no way for the external program to know your specific indenting settings, except for parsing your various configuration files.

In general it is better to go with the indentexpr setting, which can use various VimScript to perform your indentation (as well as call an external program).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.