Jim wrote:
Hello,

I am using VIM on RH 9.0, is it possible to have automatic indent for linux bash "if then ... fi"? If yes, could you please explain how?

Thank you.

Jim


1. To activate $VIMRUNTIME/indent/sh.vim (and also indent scripts for other filetypes), make sure that your vimrc contains one of

        filetype plugin indent on
or
        source $VIMRUNTIME/vimrc_example.vim
or
        runtime vimrc_example.vim

2. A file with extension .sh will be recognised as a shell script. Also an existing file whose first line is #!/bin/bash

3. To have Vim recognise a new file with no .sh extension as a shell script, either:

3a. Enter #!/bin/bash then reload the file with :w followed with :e

or

3b. :setlocal ft=sh



Best regards,
Tony.

Reply via email to