When I indent in VIM with ==, I get the following error:

/bin/bash: indent: command not found
:.!indent shell returned 127.

When I tried to indent a block of code with =i{, nothing is indented, and nothing is changed, and no error is through.

What is wrong with my VIM? I am using Fedora's Gnome 3.4.2 and my vim is 7.3.682


You didn't specify which language or file type you were editing, and that can matter. It also matters what's in your ~/.vimrc (and possibly system-wide vimrc). However, I can offer one bit of advice. Try clearing your 'equalprg' option:

:set equalprg=

Then run your = indent motion again. If that works, you will want to find out what is setting your 'equalprg' option for you so you can stop it from happening. To do this, restart vim and type (with the question mark as part of the command):

:verbose set equalprg?

Vim has very powerful indent features, and usually it is enough to have this line in your ~/.vimrc:

:filetype indent on

This enables per-filetype indent plugins, which generally sets up the necessary indent options (there are a few) for you based on the current language or filetype. You may want to look at:

:help :filetype
:help 'equalprg'
  • i tried ':set equalprg=' and it gave me the exact same error. I'm new to VIM and didn't know the command are different for different language. I'm just using it as a text editor of plain text to practice using VIM – KMC Apr 3 '13 at 4:50
  • Try the :filetype indent on command and reload the file (:edit) then see if the = motion command works. – Heptite Apr 3 '13 at 4:53
  • where to reload the file name (:edit)? is that a hidden file? – KMC Apr 3 '13 at 6:16
  • Just typing ":edit" and pressing enter causes Vim to reload the current file. – Heptite Apr 3 '13 at 6:17

You may install the required package first with command Debian:

apt install indent


yum install indent

After that you may select a code with "Shift+v" and indent selected with "=". Or just type "gg=G" to indent all lines.

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.