1
Fork 0
dots/zsh/zsh-functions

43 lines
1,005 B
Text
Raw Normal View History

2023-08-21 09:56:16 +00:00
function cc() python -c "from math import *; print($*)"
function mkcd() mkdir -p -- $1 && cd -- $1
2023-08-22 23:42:42 +00:00
function save-ssh-key() {
2024-04-14 03:02:45 +00:00
mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
2023-08-22 23:42:42 +00:00
mv "$1" "$HOME/.ssh/${1}_${2}"
2024-04-14 03:02:45 +00:00
if [ -e "$1.pub" ]; then
mv -n "$1.pub" "$HOME/.ssh/${1}_${2}.pub"
fi
2023-08-22 23:42:42 +00:00
}
2023-08-24 23:03:02 +00:00
function eik() {
kitten edit-in-kitty "$1"
}
2023-08-30 02:00:57 +00:00
function find-directory() {
2024-05-05 00:57:59 +00:00
FOLDER=$(fd -t d --hidden | fzf --height="~50%" --reverse)
2023-08-30 02:00:57 +00:00
if [ -n "$FOLDER" ]; then
2023-11-10 10:58:01 +00:00
BUFFER="cd $FOLDER; l"
2023-08-30 02:00:57 +00:00
zle .accept-line
else
zle reset-prompt
fi
}
zle -N find-directory
2024-05-05 00:57:59 +00:00
function forgejo_clone() {
local repo_name
repo_name=$(curl -X GET "https://git.hadeedahmad.xyz/api/v1/user/repos" \
-H "Authorization: token ${FORGEJO_API_KEY}" \
--silent | jq -r ".[].name" | fzf --height="~50%" --reverse)
if [ -n "$repo_name" ]; then
git clone "forgejo:hadeed/$repo_name"
fi
}
zle -N forgejo_clone
2023-08-21 09:56:16 +00:00
# vim: filetype=zsh