Skip to content

Instantly share code, notes, and snippets.

View dsedivec's full-sized avatar

Dale Sedivec dsedivec

View GitHub Profile
@dsedivec
dsedivec / vimkill.sh
Last active August 29, 2015 13:57
vimkill command: pgrep + vim + kill
vimkill () {
local temp_file
temp_file=$(mktemp -t vimkillXXXXXXXXXX)
if [ $? -ne 0 ]; then
echo "mktemp failed" >&2
return 1
fi
if ! pgrep -fl "$@" > "$temp_file"; then
rm "$temp_file"
echo "no matching processes found" >&2