If using an external program for formatting, one can use something like :%!program to perform the formatting. Is it possible to use map this from the regular = and == sequences so that any indentation commands invoke the external program?
            Asked
            
        
        
            Active
            
        
            Viewed 107 times
        
    1
            
            
        
        r.v
        
- 4,697
 - 6
 - 35
 - 57
 
- 
                    2See `:help 'equalprg'`. – romainl Aug 26 '16 at 05:26
 
1 Answers
2
            Learn how to look up commands and navigate the built-in :help; it is comprehensive and offers many tips. :help = would have answered your question in no time:
={motion}       Filter {motion} lines through the external program
                        given with the 'equalprg' option.  When the 'equalprg'
                        option is empty (this is the default), use the
                        internal formatting function...
So, the answer is a simple
:set equalprg=program
You can put that in your ~/.vimrc, or (if you only want this for certain buffers), use :setlocal (the option is either global or local, :help 'equalprg' tells you this) and put it in ~/.vim/after/{filetype}.vim.
        Ingo Karkat
        
- 167,457
 - 16
 - 250
 - 324