When working on a git project in vim, I use the fugitive plugin.
I like to open a :Gstatus
split, press -
to add file and then press C
to commit my changes. I also have a git pre-commit hook, it runs some test. In case of an error, it prompts me
to make sure if I still want to commit.
But, when following this pattern, I don't see the output for the tests, neither the final prompt. Instead, vim freezes while the tests are running.
How would I make fugitive and a pre-commit hook get along together smoothly?
Update: This is the prompt in the git pre-commit hook:
#!/bin/bash
exec < /dev/tty
while true; do
read -p "There were some errors in the test, do you still want to commit? (Y/n) " yn
if [ "$yn" = "" ]; then
yn='Y'
fi
case $yn in
[Yy] ) break;;
[Nn] ) exit;;
* ) echo "Answer y or n.";;
esac
done
pre-commit
hook works fine when you just usegit commit
? What happens if you use a very simplepre-commit
hook like onlyexit 0
orexit 1
?C
, Vim goes to the terminal view and there is no output. I will add the part of the script which has the prompt