Skip to content

Instantly share code, notes, and snippets.

@shollingsworth
Created July 12, 2017 20:38
Show Gist options
  • Save shollingsworth/6213cbd96d024757e4c7362286944d59 to your computer and use it in GitHub Desktop.
Save shollingsworth/6213cbd96d024757e4c7362286944d59 to your computer and use it in GitHub Desktop.
my vimrc script editing environment wrappers
autocmd FileType * exe('let comp_cmd="!~/.vim/bin/build_' . &filetype . '.sh ' . expand("%:p") . '"')
autocmd FileType * exe('let run_cmd="!~/.vim/bin/build_' . &filetype . '.sh ' . expand("%:p") . ' \|less -cN"')
map z :exec comp_cmd<enter><enter>
map R :exec run_cmd<enter><enter>
#!/bin/bash
export PYTHONDONTWRITEBYTECODE=1
file=$(readlink -e $1)
test -x "${file}" || chmod +x "${file}"
if grep '#!.*python3' ${file}; then
#-B is to disable bycode / pyc files
pver="python3 -B"
else
pver="python -B"
fi
if python -m py_compile ${file} &>/dev/stdout; then
echo "Executing"
echo "BEGIN OUTPUT"
${pver} ${file} &>/dev/stdout
echo "END OUTPUT"
else
echo "Error executing"
fi
#!/bin/bash
file=$(readlink -e $1)
if [[ ! -x ${file} ]]; then
chmod +x ${file}
echo "Making File Executable ${file}"
fi
echo "Executing"
echo "BEGIN"
${file} &> /dev/stdout
echo "END"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment