I want to run clang-format on all open windows.
What I currently do, is:
- for each open window:
- :!clang-format --style=file -i %
I have 2 issues:
- the clang-format runs in shell, so it doesn't return to Vim until I press ENTER - how can I fix that? (tried fiddeling with
terminal
but couldn't make it work - How to run this on all open windows / all
git diff
-ed files? (I have a shell script I would very much like to bind to a Vim shortcut
clang-format shell script:
# unstaged
for FILE in $(git diff --name-only --relative)
do
clang-format --style=file -i $FILE
done
# staged
for FILE in $(git diff --cached --name-only --relative)
do
clang-format --style=file -i $FILE
done
:h :windo
. For the rest, as Rich suggested, post one question for one problem; don't make it a thread.