1

I have a server with vim installed and an empty .vimrc. I open a python file and run :set filetype=python. I then try to indent a line with == and vim complains:

:.!indent
shell returned 2

Press ENTER or type command to continue

Then the line is replaced with

indent: Standard input:2: Error:Unexpected end of file

When I try :help =, the buffer says

E433: No tags file
E149: Sorry, no help for =
Press ENTER or type command to continue

Is there a minimum configuration needed in order for = to work?

6
  • 2
    See :help =. All information to be checked is there.
    – VanLaser
    Commented Dec 10, 2015 at 16:11
  • @VanLaser Thanks for the tip, though that just furthers the mystery.
    – drs
    Commented Dec 10, 2015 at 20:56
  • 1
    You either have a vim configuration that uses indent, or you don't have support for internal indenting with = in Vim (which means, it has to use an external indent program). But, in this way, you seem to loose the ability to only indent a line (probably indent wants an entire file, a valid/complete text as input). Reference: stackoverflow.com/a/19590619/5000478. Also, even if .vimrc is empty, it's still possible that a system-wide vimrc is used/read. Try starting vim as vim -u ~/.vimrc and check how = works (is it still relying on indent?).
    – VanLaser
    Commented Dec 10, 2015 at 21:14
  • 1
    And this is the help your vim should have displayed: pastebin.com/jaCTFB6k Perhaps you could install a "normal" vim version on that server?
    – VanLaser
    Commented Dec 10, 2015 at 23:55
  • I'm not sure how to solve your question, but at least ":help =" ought to be run. So i suggest you reinstall vim!
    – navylover
    Commented Dec 13, 2015 at 8:11

1 Answer 1

2

The warning comes from indent. You may got same warning in command line from indent when feeding some incomplete source lines.

And check your vim's equalprg/formatprg setting if it's global or specific on certain filetype. I never tried indent on python code.

Here is my vim setting for c/cpp filetype, with indent's warning surpressed,

autocmd FileType c,cpp set equalprg=indent\ 2>/dev/null\ -gnu;true

2>/dev/null surpress any warning messages from indent

;true return 0(success) to make vim happy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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