←back to thread

1062 points mixto | 1 comments | | HN request time: 0s | source
Show context
beej71 ◴[] No.42942594[source]
Hey all--if you find things wrong, post 'em. I'll clean 'em up. :)

Love, Beej

replies(30): >>42942620 #>>42942694 #>>42942736 #>>42943486 #>>42943604 #>>42944525 #>>42945585 #>>42945722 #>>42946123 #>>42946210 #>>42946648 #>>42946913 #>>42947174 #>>42947352 #>>42947971 #>>42948270 #>>42948388 #>>42948408 #>>42949187 #>>42949195 #>>42949987 #>>42950982 #>>42952060 #>>42953388 #>>42953692 #>>42955126 #>>42959191 #>>42961534 #>>42974297 #>>42978137 #
aidos ◴[] No.42946123[source]
Not wrong, but since you’re mentioning vim in the context of git, might be worth adding :cq as a way to exit with a non-zero status to prevent git from finishing the commit / operation.
replies(7): >>42947682 #>>42948679 #>>42948693 #>>42950588 #>>42952635 #>>42954667 #>>43021805 #
1. rstuart4133 ◴[] No.43021805[source]
:cq is useful in a shell loop that compares two directory trees that invokes vim to let you see what's changed in every file that's different. I use it often:

    ((cd /tmp/t; find . -type f -print) | sort | while read f; do cmp -s {/tmp/t,/tmp/t1}/$f || vim -f -d {/tmp/t,/tmp/x1}/$f 0<&9 || break; done) 9<&0
Typing ^C to vim doesn't get you very far, so if you make a mistake causing the loop to return 1000's of files you are in for a bit of pain without :cq. The :cq triggers the break, exiting the loop.