Skip to content

Instantly share code, notes, and snippets.

@acid-bong
Created August 9, 2022 08:07
Show Gist options
  • Save acid-bong/e23c5f0421b49b72df311e7b7efb14be to your computer and use it in GitHub Desktop.
Save acid-bong/e23c5f0421b49b72df311e7b7efb14be to your computer and use it in GitHub Desktop.
VCC: edit the .c file (without the extension) and instantly recompile it and run. POSIX-compliant
#!/bin/sh
vcc () {
vim "${1}.c" &&
mkdir -p "$(dirname "${1}".c)"/bin &&
cc -Wall -Wextra -o "$(dirname "${1}".c)"/bin/"$(basename "$1")" "${1}".c &&
./"$(dirname "${1}".c)"/bin/"$(basename "$1")"
}
# Uncomment this if you intend to make it a script. Comment it/leave it commented if you source it in your .*shrc
#vcc "${1}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment