hello, > :!clang-format -i % > > the first time, or > > :! > > followed by arrow-up and Enter on subsequent invocations (persisting > across vim sessions) to tidy it up.
Paul told us he's using vi, not vim, so what vi can instead is to call the last filter or command :!! :%!! > [1]: https://git.sr.ht/~strahinja/dotfiles/tree/master/item/.clang-format when using vim, I really rely on vim itself by default: * filetype indent, 'indentexpr' 'autoindent' * my snippets mappings I wrote like inoremap <buffer> (ca switch ( œ ) {<cr> \<tab>case ……:<cr> \default:……<cr> \}<esc><<3kfœs if you use an eternal filter, you can declare it as a 'equalprg' (:h =) so if clang-format -i can use stdin and stdout instead of a filename (or if you wrap it in a command doing so), :set ep=clang-format = is a command so now you can indent only the current block (for example with =a{ regards -- Marc Chantreux Pôle CESAR (Calcul et services avancés à la recherche) Université de Strasbourg 14 rue René Descartes, BP 80010, 67084 STRASBOURG CEDEX 03.68.85.60.79
signature.asc
Description: PGP signature