How to use an external indenter for a specific type of files?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use an external indenter for a specific type of files?

Peng Yu
Hi,

For example, I'd like to use clang-format to indent only .c and .cpp
files. Is there a way to config vim to do so? Thanks.

--
Regards,
Peng

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to use an external indenter for a specific type of files?

Gary Johnson-4
On 2019-02-26, Peng Yu wrote:

> For example, I'd like to use clang-format to indent only .c and .cpp
> files. Is there a way to config vim to do so? Thanks.

Short answer:

    :help =
    :help 'equalprg'

Set 'equalprg' using setlocal in your ~/.vim/after/ftplugin/c.vim
and/or ~/.vim/after/ftplugin/cpp.vim file.

HTH,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.