Last active
August 29, 2015 14:04
-
-
Save yulijia/cbfde71da612e58ceb29 to your computer and use it in GitHub Desktop.
A easy way to generate a new souce code file and open it with editor (vim , gedit)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias count='ll -h ./ |grep "^-" |wc -l' | |
alias win7='cd /run/media/root' | |
alias vi='vim' | |
__pl() { /root/bin/codefile.sh $1 "pl"; }; | |
alias pl='__pl' | |
__md() { codefile.sh $1 "md"; }; | |
alias md='__md' | |
__r() { codefile.sh $1 "r"; }; | |
alias r='__r' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
au BufRead,BufNewFile *.md set filetype=markdown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
time=`date` | |
authorname=`whoami` | |
if [[ -z $1 ]] ; then | |
echo $"couldn't find filename, please give a filename" | |
elif [[ "$2" == "pl" ]] ; then | |
touch $1.$2 | |
echo "#!/usr/bin/perl -w" >> $1.$2 | |
echo " " >> $1.$2 | |
echo "# CODE_NAME: $1" >> $1.$2 | |
echo "# DATE: $time" >> $1.$2 | |
echo "# AUTHOR: $authorname" >> $1.$2 | |
echo "# DESCRPTION: " >> $1.$2 | |
echo "# " >> $1.$2 | |
echo "# " >> $1.$2 | |
# gedit $1.$2 | |
vi $1.$2 | |
: | |
elif [[ "$2" == "md" ]] ; then | |
touch $1.$2 | |
echo "<!--" >> $1.$2 | |
echo "# CODE_NAME: $1" >> $1.$2 | |
echo "# DATE: $time" >> $1.$2 | |
echo "# AUTHOR: $authorname" >> $1.$2 | |
echo "# DESCRPTION: " >> $1.$2 | |
echo "# " >> $1.$2 | |
echo "# " >> $1.$2 | |
echo "-->" >> $1.$2 | |
gedit $1.$2 | |
: | |
elif [[ "$2" == "r" ]] ; then | |
touch $1.R | |
echo "# CODE_NAME: $1" >> $1.R | |
echo "# DATE: $time" >> $1.R | |
echo "# AUTHOR: $authorijia" >> $1.R | |
echo "# DESCRPTION: " >> $1.R | |
echo "# " >> $1.R | |
echo "# " >> $1.R | |
# gedit $1.R | |
vi $1.R | |
: | |
#elif [[ "$2" == "py" ]] ; then | |
# touch $1.$2 | |
# echo "<!--" >> $1.$2 | |
# echo "# CODE_NAME: $1" >> $1.$2 | |
# echo "# DATE: $time" >> $1.$2 | |
# echo "# AUTHOR: $authorijia" >> $1.$2 | |
# echo "# DESCRPTION: " >> $1.$2 | |
# echo "# " >> $1.$2 | |
# echo "# " >> $1.$2 | |
codefile.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it works on Fedora.