Updated zshrc

This commit is contained in:
JirR02 2023-12-17 18:32:21 +01:00
parent d343fc9d36
commit 5535757e4f

124
.zshrc
View File

@ -142,9 +142,6 @@ alias gcm="git checkout master"
alias config="/usr/bin/git --git-dir=/home/jirayu/Projects/Private/dotfiles --work-tree=/home/jirayu" alias config="/usr/bin/git --git-dir=/home/jirayu/Projects/Private/dotfiles --work-tree=/home/jirayu"
alias Nvimconfig="/usr/bin/git --git-dir=/home/jirayu/Projects/Private/NeoVim_Setup/ --work-tree=/home/jirayu/.config/nvim"
function gc () { function gc () {
git commit -m $1 git commit -m $1
} }
@ -165,58 +162,10 @@ function gmb () {
git branch -d $1 git branch -d $1
} }
# Rclone shortcuts
function mOneDrive {
rclone --vfs-cache-mode writes mount OneDrive: ~/OneDrive &>/dev/null &
disown
}
function mTheorie {
rclone --vfs-cache-mode writes mount Theorie_cNP: ~/Theorie_cNP &>/dev/null &
disown
}
function mEF {
rclone --vfs-cache-mode writes mount Theorie_EF: ~/Theorie_EF &>/dev/null &
disown
}
function mAB {
rclone --vfs-cache-mode writes mount Aufgabenbearbeitung: ~/Aufgabenbearbeitung &>/dev/null &
disown
}
function umOneDrive {
fusermount -uz ~/OneDrive &>/dev/null &
disown
}
function umTheorie {
fusermount -uz ~/Theorie_cNP &>/dev/null &
disown
}
function umEF {
fusermount -uz ~/Theorie_EF &>/dev/null &
disown
}
function umAB {
fusermount -uz ~/Aufgabenbearbeitung &>/dev/null &
disown
}
# Directory Shortcuts # Directory Shortcuts
alias KSBG="cd ~/Nextcloud/Bildung/KSBG" alias KSBG="cd ~/Nextcloud/Bildung/KSBG"
alias Theorie="cd ~/Theorie_cNP"
alias EF="cd ~/Theorie_EF"
alias OneDrive="cd ~/OneDrive"
alias TechLab="cd ~/Nextcloud/TechLab" alias TechLab="cd ~/Nextcloud/TechLab"
alias Layout="cd ~/Nextcloud/Layouts" alias Layout="cd ~/Nextcloud/Layouts"
@ -232,6 +181,7 @@ function Theoryen {
cp ~/Nextcloud/Layouts/Theory_Notebook_English/macros.tex . cp ~/Nextcloud/Layouts/Theory_Notebook_English/macros.tex .
cp ~/Nextcloud/Layouts/Theory_Notebook_English/preamble.tex . cp ~/Nextcloud/Layouts/Theory_Notebook_English/preamble.tex .
cp ~/Nextcloud/Layouts/Theory_Notebook_English/Theory.tex . cp ~/Nextcloud/Layouts/Theory_Notebook_English/Theory.tex .
mv Theory.tex main.tex
} }
function Theoryde { function Theoryde {
@ -241,40 +191,76 @@ function Theoryde {
cp ~/Nextcloud/Layouts/Theory_Notebook_German/macros.tex . cp ~/Nextcloud/Layouts/Theory_Notebook_German/macros.tex .
cp ~/Nextcloud/Layouts/Theory_Notebook_German/preamble.tex . cp ~/Nextcloud/Layouts/Theory_Notebook_German/preamble.tex .
cp ~/Nextcloud/Layouts/Theory_Notebook_German/Theory.tex . cp ~/Nextcloud/Layouts/Theory_Notebook_German/Theory.tex .
mv Theory.tex main.tex
} }
alias Facharbeit="cp ~/Nextcloud/Layouts/Facharbeit/Facharbeit.tex ." alias Facharbeit="cp ~/Nextcloud/Layouts/Facharbeit/Facharbeit.tex ."
alias Layout="cp ~/Nextcloud/Layouts/Layout/layout.tex ." alias Layout="cp ~/Nextcloud/Layouts/Layout/layout.tex ."
alias Poster="cp ~/Nextcloud/Layouts/Poster/Poster.tex ."
alias Presentation="cp ~/Nextcloud/Layouts/Presentation/Presentation.tex ."
function graph () { function graph () {
cp ~/Nextcloud/Layouts/Graph/template.py fig/$1.py cp ~/Nextcloud/Layouts/Graph/template.py fig/$1.py
echo "plt.savefig($1.pdf)" >> fig/$1.py echo "plt.savefig($1.pdf)" >> fig/$1.py
code fig/$1.py --wait nvim fig/$1.py --wait
rm fig/$1.py rm fig/$1.py
} }
function importpdf () { function importpdf () {
i=1
l=$(qpdf --show-npages "$1") # Define a function to sanitize filenames
while [ $i -le $l ] sanitize_filename() {
do echo $1 | tr -c '[:alnum:]' '_'
echo "\\\begin{minipage}{0.5\\\textwidth}" >> $2 }
echo " \\includegraphics[height=\\\textheight,page=$i]{$1}" >> $2
echo "\\\end{minipage}" >> $2 # Rename Word documents, PowerPoint presentations, and PDF files
echo "\\\begin{minipage}{0.5\\\textwidth}" >> $2 for file in *.docx *.pptx *.pdf; do
echo "" >> $2 if [[ -e $file ]]; then
echo "\\\end{minipage}" >> $2 new_name=$(sanitize_filename $file)
i=$(( $i + 1 )) mv "$file" "$new_name"
fi
done done
# Convert Word documents and PowerPoint presentations to PDF
for file in *.docx *.pptx; do
if [[ -e $file ]]; then
pdf_name="${file%.*}.pdf"
pandoc "$file" -o "$pdf_name"
fi
done
# Move PDF files to the specified folder
for pdf_file in *.pdf; do
if [[ -e $pdf_file ]]; then
mv "$pdf_file" pdf/
fi
done
# Import PDF files into LaTeX file (assuming LaTeX file is named main.tex)
for pdf_file in "$pdf_folder"/*.pdf; do
if [[ -e $pdf_file ]]; then
# Check if the PDF file is already imported in the LaTeX file
grep -q "$(basename "$pdf_file")" main.tex
if [ $? -ne 0 ]; then
# If not imported, add the import statement to LaTeX file
echo "\\includepdf[pages=-]{$pdf_file}" >> main.tex
fi
fi
done
} }
function importfig () { function importimg {
echo "\\\includegraphics[]{$1}" >> $2 for image_file in *.png *.jpg; do
if [[ -e $image_file ]]; then
# Check if the image file is already imported in the LaTeX file
grep -q "$(basename "$image_file")" main.tex
if [ $? -ne 0 ]; then
# If not imported, add the import statement to LaTeX file
echo "\\includegraphics[width=\\textwidth]{$(sanitize_filename "$image_file")}" >> main.tex
fi
fi
done
} }
# Zathura # Zathura