Obligatory placeholder commit message

This commit is contained in:
coolnsx
2023-10-06 16:48:11 +05:30
parent c95bcc2e2c
commit 57a9c4211b
26 changed files with 214 additions and 155 deletions

141
.zshrc
View File

@@ -1,141 +0,0 @@
#user-defined functions
gtp(){
[ -z "$*" ] && commit=$(curl -s "https://raw.githubusercontent.com/ngerakines/commitment/master/commit_messages.txt" | shuf -n1) || commit=$*
git add -p
git commit -m "$commit"
git push
unset commit
}
megamind() {
len=$(printf '%s' "$*" | wc -c)
printf "———————————%s———————————
⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝
⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇
⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀
⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀
⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀
⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀
⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
——————————————————————" "$*"
for i in $(seq $len); do
printf '—'
done
printf '\n'
unset len
}
gtb () {
[ -z "$*" ] && br=$(git branch -a | fzf --border=rounded --layout=reverse --height=10 | tr -d ' ') || br=$*
[ -z "$br" ] || git checkout $br
unset br
}
holidays(){
printf 'Day Date Holiday
Tuesday 15th August Independence Day
Wednesday 30th August Rakshabandhan
Monday 2nd October Gandhi Jayanti
Tuesday 24th October Dussehra
Sunday-Tuesday 12-14 November Diwali & Bhai dooj\n' | bat -pp -l tsv
}
b64 () { printf "%s" "$1" | base64 $2 $3; }
url() {
[ -z "$2" ] && duration="1440" || duration=$2
out=$(curl -k https://oshi.at -F shorturl=0 -F "f=@$1" -F "expire=$duration") #1440 means 1 day duration
[ -z "$out" ] && return 1
printf "%s" "$out" | sed -nE 's|DL: (.*)|\1|p' | wl-copy && notify-send "Link copied to clipboard";
wl-paste
#storing only long duration links
[ -z "$2" ] && printf "%s\n%s" "$out" "$(date '+%s')" | tr '\n' '>' | sed 's/>/ | /g' >> $HOME/.cache/oshi-urls
#deleting file uploaded than 1 day ago
for i in $(cut -d'|' -f3 $HOME/.cache/oshi-urls | tr -d ' ');do
curr=$(date '+%s')
[ "$((curr - i))" -gt "86400" ] && sed -i "/$i/d" $HOME/.cache/oshi-urls &
done
echo >> $HOME/.cache/oshi-urls
}
gtd () {
preview="git diff $@ --color=always -- {-1}"
file=$(git diff $@ --name-only --relative | fzf --ansi --preview $preview --preview-window right:65%:wrap -0)
[ -n "$file" ] && nvim $file
unset preview file
}
gtc () { [ -z "$*" ] && [ -p "/dev/stdin" ] && read -r query </dev/stdin || query=$*; git clone "$query"; }
gtr () { [ -z "$*" ] && [ -p "/dev/stdin" ] && read -r query </dev/stdin || query=$*; curl -s "https://api.github.com/users/$query/repos" | sed -nE 's|.*ssh_url": "([^"]*)".*|\1|p' | fzf --border --height=10 --layout=reverse -0; }
gtu () { [ -z "$*" ] || curl -s "https://api.github.com/search/users?q=$*" | sed -nE 's_.*login": "([^"]*)".*_\1_p' | fzf --layout=reverse --border --height=10 -0; }
clshist() {
a=$(cat ~/.histfile | wc -l)
[ "$a" -gt 301 ] && sed -i "1,$((a - 300))d" ~/.histfile
}
v() {
[ -z "$*" ] && nvim -O $(fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}' -m | tr '\n' ' ') || nvim -O $*
}
help() {
"$@" --help 2>&1 | bat --plain --language=help
}
addpkg(){
[ -z "$*" ] && printf "\033[1;31mPlease write the name of package (just some words)..\033[0m" && return 1
paru -Ss "$*" | sed -nE 's|^[a-z]*/([^ ]*).*|\1|p' | fzf --preview 'paru -Si {} | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | paru -S -
}
rmpkg(){
paru -Qq | fzf --preview 'paru -Si {} | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | paru -Rcns -
}
# Lines configured by zsh-newuser-install
export EDITOR="nvim"
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export VISUAL="nvim"
export TERMINAL="foot"
export OPENER="xdg-open"
export VIDEO="mpv"
export WM="hyprland"
export IMAGE="nsxiv"
alias cat="bat -pp --color=always"
alias open="xdg-open"
alias cp="cp -v"
alias art="php artisan"
alias rm="rm -v"
alias mv="mv -v"
alias pgrep="pgrep -a"
alias grep="grep --color=auto"
alias ncdu="ncdu --color dark"
alias ll="ls --color=auto -alh"
alias ls="ls --color=auto"
alias fetch='/bin/*fetch'
alias nchh="nvim ~/.config/hypr/hyprland.conf"
alias shfmt="shfmt -ci -d -w"
clshist
HISTFILE=~/.histfile
HISTSIZE=200
SAVEHIST=200
PROMPT_EOL_MARK=' ⏎ '
setopt autocd
bindkey -e
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit
zstyle ':completion:*' menu select
eval "$(starship init zsh)"
[ -f "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] && source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOME/.config/fzf-tab/fzf-tab.plugin.zsh

View File

@@ -40,7 +40,7 @@
color: #8FBCBB; color: #8FBCBB;
font-size : 24px; font-size : 24px;
font-weight : bold; font-weight : bold;
margin : 20px 0px 0px 0px; margin : 30px 0px 0px 0px;
} }
.artist { .artist {
color: #EBCB8B; color: #EBCB8B;
@@ -50,7 +50,7 @@
} }
.btn_play { .btn_play {
color: #A3BE8C; color: #A3BE8C;
font-family: IosevkaTerm Nerd Font Mono; font-family: IosevkaTerm Nerd Font;
font-size : 70px; font-size : 70px;
} }
.btn_play:hover { .btn_play:hover {
@@ -59,7 +59,7 @@
.btn_controls { .btn_controls {
color: #EBCB8B; color: #EBCB8B;
font-size : 32px; font-size : 32px;
font-family: IosevkaTerm Nerd Font Mono; font-family: IosevkaTerm Nerd Font;
} }
.btn_controls:hover { .btn_controls:hover {
font-size : 50px; font-size : 50px;
@@ -67,6 +67,8 @@
.lyrics { .lyrics {
color: #EBCB8B; color: #EBCB8B;
margin : -20px 0px 0px 0px; margin : -20px 0px 0px 0px;
font-family: IBM Plex Sans Text;
font-size : 18px;
} }
.music_bar { .music_bar {
color: #81A1C1; color: #81A1C1;

View File

@@ -4,7 +4,7 @@ case $1 in
songdata) songdata)
out=$(printf '{ "command": ["get_property", "pause"]}\n' | socat - /tmp/yt-music/yt-music-mpvsocket 2>/dev/null) out=$(printf '{ "command": ["get_property", "pause"]}\n' | socat - /tmp/yt-music/yt-music-mpvsocket 2>/dev/null)
if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then if [ -n "$out" ] && pgrep -f mpvsocket >/dev/null 2>&1;then
printf '{"name":"%s","artist":"%s","cover":"/tmp/yt-music/default.jpg","next":"%s","prev":"%s"}' "$(cut -d'>' -f1 < "/tmp/yt-music/current" | cut -d':' -f2 | sed 's|[^-]*$||;s|-$||;s| $||;s|^ ||')" "$(cut -d'>' -f1 < "/tmp/yt-music/current" | sed 's_.* - __;s| $||')" "$(sed -n "/$(cut -d'>' -f2 < /tmp/yt-music/current )/{n;p}" /tmp/yt-music/next | cut -f1)" "$(sed -n "$(cat /tmp/yt-music/counter)p" /tmp/yt-music/next | cut -f1)" printf '{"name":"%s","artist":"%s","cover":"/tmp/yt-music/default.jpg","next":"%s","prev":"%s"}' "$(cut -d'>' -f1 < "/tmp/yt-music/current" | cut -d':' -f2- | sed 's|[^-]*$||;s|-$||;s| $||;s|^ ||')" "$(cut -d'>' -f1 < "/tmp/yt-music/current" | sed 's_.* - __;s| $||')" "$(sed -n "/$(cut -d'>' -f2 < /tmp/yt-music/current )/{n;p}" /tmp/yt-music/next | cut -f1)" "$(sed -n "$(cat /tmp/yt-music/counter)p" /tmp/yt-music/next | cut -f1)"
else else
printf '{"name":"OFFLINE","artist":"offline","cover":"%s/.config/eww/music.png"}' "$HOME" printf '{"name":"OFFLINE","artist":"offline","cover":"%s/.config/eww/music.png"}' "$HOME"
fi fi
@@ -21,7 +21,7 @@ case $1 in
;; ;;
lyrics) lyrics)
if [ -f "/tmp/yt-music/lyrics" ]; then if [ -f "/tmp/yt-music/lyrics" ]; then
awk -F'\t' -v value="$(echo '{ "command": ["get_property", "time-pos"] }' | socat - /tmp/yt-music/yt-music-mpvsocket | sed -nE 's|.*data":([^,]*).*|\1|p')" '$1 > value*1002 {print $2;exit}' /tmp/yt-music/lyrics awk -F'\t' -v value="$(echo '{ "command": ["get_property", "time-pos"] }' | socat - /tmp/yt-music/yt-music-mpvsocket | sed -nE 's|.*data":([^,]*).*|\1|p')" '$1 > value*1005 {print $2;exit}' /tmp/yt-music/lyrics
else else
printf "Lyrics will show here" printf "Lyrics will show here"
fi fi

View File

@@ -167,7 +167,7 @@ windowrulev2=fullscreen,class:^(org.freedesktop.Xwayland)$
#startup applications #startup applications
exec-once=dbus-update-activation-environment --systemd --all exec-once=dbus-update-activation-environment --systemd --all
exec-once=ssh-agent exec-once=ssh-agent
exec-once=swaybg -i ~/wall/9.png exec-once=swaybg -i $HOME/.config/wall/9.png
exec-once=xrdb -merge $HOME/.config/.Xresource exec-once=xrdb -merge $HOME/.config/.Xresource
exec-once=$hypr_dir/workspace 'focus' exec-once=$hypr_dir/workspace 'focus'
exec-once=sleep 5 && $hypr_dir/workspace exec-once=sleep 5 && $hypr_dir/workspace

View File

@@ -1,3 +1,4 @@
#hwdec=auto #hwdec=auto
profile=gpu-hq profile=gpu-hq
gpu-context=wayland gpu-context=wayland
input-ipc-server=/tmp/mpvsocket

View File

@@ -1,5 +1,5 @@
{ {
"LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" }, "LuaSnip": { "branch": "master", "commit": "c5fb16a934892086d4ba01bac48b77c65435025e" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
@@ -9,17 +9,17 @@
"friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" }, "friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "dfdd771b792fbb4bad8e057d72558255695aa1a7" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" },
"mason.nvim": { "branch": "main", "commit": "ee6a7f179ebf8aa9da9d53b1cf1b57d292ea0182" }, "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
"monokai-pro.nvim": { "branch": "main", "commit": "826d028edbcc7a8aadc0f7a32b32747d97575615" }, "monokai-pro.nvim": { "branch": "main", "commit": "826d028edbcc7a8aadc0f7a32b32747d97575615" },
"nvim-autopairs": { "branch": "master", "commit": "35493556b895f54c129918aca43ae9a63af42a1f" }, "nvim-autopairs": { "branch": "master", "commit": "7b3eb9b5813a22188c4dbb248475fcbaf9f4d195" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-dap": { "branch": "master", "commit": "0e6b7c47dd70e80793ed39271b2aa712d9366dbc" }, "nvim-dap": { "branch": "master", "commit": "b3d4408e29d924fe130c9397a7c3b3630b3ea671" },
"nvim-dap-python": { "branch": "master", "commit": "37b4cba02e337a95cb62ad1609b3d1dccb2e5d42" }, "nvim-dap-python": { "branch": "master", "commit": "37b4cba02e337a95cb62ad1609b3d1dccb2e5d42" },
"nvim-lspconfig": { "branch": "master", "commit": "0517d8522dcec286b1dba47aa3ee1ed8f523aed6" }, "nvim-lspconfig": { "branch": "master", "commit": "4266f9bb36b4fb09edd19b67d95043cf7ff88ddf" },
"nvim-parinfer": { "branch": "master", "commit": "5ca09287ab3f4144f78ff7977fabc27466f71044" }, "nvim-parinfer": { "branch": "master", "commit": "5ca09287ab3f4144f78ff7977fabc27466f71044" },
"nvim-treesitter": { "branch": "master", "commit": "80b4fa7970ee159e5c2c715bbcd386143c48dcb1" }, "nvim-treesitter": { "branch": "master", "commit": "fc93fa5c07df7cd578a3ea82d7c075c0460a6884" },
"packer.nvim": { "branch": "master", "commit": "ea0cc3c59f67c440c5ff0bbe4fb9420f4350b9a3" }, "packer.nvim": { "branch": "master", "commit": "ea0cc3c59f67c440c5ff0bbe4fb9420f4350b9a3" },
"telescope.nvim": { "branch": "master", "commit": "20a37e43bb43c74c6091f9fea6551af0964ad45a" } "telescope.nvim": { "branch": "master", "commit": "40c8d2fc2b729dd442eda093cf8c9496d6e23732" }
} }

BIN
wall/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
wall/10.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

BIN
wall/11.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

BIN
wall/12.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

BIN
wall/13.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
wall/14.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

BIN
wall/15.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
wall/16.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
wall/17.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

BIN
wall/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 KiB

BIN
wall/3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

BIN
wall/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

BIN
wall/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
wall/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

BIN
wall/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
wall/8.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

BIN
wall/9.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

@@ -0,0 +1,2 @@
#compdef url_oshi
_arguments '1:filename:_files' "2:no of days:({1..90})"

41
zsh/completions/_yt-music Normal file
View File

@@ -0,0 +1,41 @@
#compdef yt-music
local -a subcmds
subcmds=(
'search_play:searches first, then plays the music in mpv'
'play:plays the music in mpv'
'play_next:plays the next music in /tmp/yt-music/next file'
'loop:plays the next music after the current is finished (run it as a background process)'
)
local -a play_next_args
play_next_args=(
'menu:menu:Show music list to choose from'
)
local -a loop_args
loop_args=(
'print:print:show what is going on'
)
local subcmd
if (( $#words > 3 )); then
return 1
fi
subcmd=${words[2]}
case $subcmd in
(play_next)
# For 'play_next', add 'menu' as an option
_describe -t play_next_args 'subcommand arguments' play_next_args && return ;;
(loop)
# For 'loop', add 'print' as an option
_describe -t loop_args 'subcommand arguments' loop_args && return ;;
(play|search_play)
return ;;
esac
# Describe the available subcommands
_describe 'command' subcmds

154
zsh/zshrc Normal file
View File

@@ -0,0 +1,154 @@
#user-defined functions
hex_to_string() {
for hex in $(printf '%s' "$1" | sed 's/../&\n/g'); do
[ "$hex" = "00" ] && continue
printf "\x$hex"
done
unset hex
}
gtp() {
[ -z "$*" ] && commit=$(curl -s "https://raw.githubusercontent.com/ngerakines/commitment/master/commit_messages.txt" | shuf -n1) || commit=$*
git add -p
git commit -m "$commit"
git push
unset commit
}
megamind() {
len=$(printf '%s' "$*" | wc -c)
printf "———————————%s———————————
⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝
⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇
⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀
⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀
⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀
⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀
⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
——————————————————————" "$*"
for i in $(seq $len); do
printf '—'
done
printf '\n'
unset len
}
gtb() {
[ -z "$*" ] && br=$(git branch -a | fzf --border=rounded --layout=reverse --height=10 | tr -d ' ') || br=$*
[ -z "$br" ] || git checkout $br
unset br
}
b64() {
# base64 wrapper , also converts url base64
printf "%s" "$1" | tr "._-" '=/+' | base64 -w 0 $2
}
url_oshi() {
days=${2:-1}
out=$(curl -k https://oshi.at -F shorturl=0 -F "f=@$1" -F "expire=$((days * 1440))") #1440 means 1 day duration
[ -z "$out" ] && return 1
printf "%s" "$out" | sed -nE 's|DL: (.*)|\1|p' | wl-copy && notify-send "Link copied to clipboard"
wl-paste
curr=$(date '+%s')
#storing only long duration links
[ -z "$2" ] && printf "%s\n%s" "$out" "$((curr + (86400 * days)))" | tr '\n' '>' | sed 's/>/ | /g' >>$HOME/.cache/oshi-urls
#deleting file uploaded than nth day ago
for i in $(cut -d'|' -f3 $HOME/.cache/oshi-urls | tr -d ' '); do
[ "$curr" -ge "$i" ] && sed -i "/$i/d" $HOME/.cache/oshi-urls &
done
echo >>$HOME/.cache/oshi-urls
}
url_nextcloud() {
[ ! -f "$HOME/.secrets" ] && notify-send "Credentials not found" -u critical && return 1
source "$HOME"/.secrets
curl "$NC_HOST/remote.php/dav/files/${NC_USER}${NC_FOLDER_PATH}/$(basename "$1")" -H "Authorization: Basic $NC_AUTH" -T "$1"
#To enable sharing, the output will be in json containing share link
curl -s -H "Authorization: Basic $NC_AUTH" "$NC_HOST/ocs/v2.php/apps/files_sharing/api/v1/shares" -H 'content-type: application/json' -H 'accept: application/json, text/plain, */*' -H 'OCS-APIRequest: true' --data-raw "{\"path\":\"${NC_FOLDER_PATH}/$(basename "$1")\",\"shareType\":3,\"attributes\":\"[]\"}" | sed -nE 's|.*"url":"([^"]*)".*|\1|p' | sed 's/\\//g' | wl-copy && notify-send "Link copied to clipboard"
unset NC_HOST NC_USER NC_FOLDER_PATH NC_AUTH
}
gtd() {
preview="git diff $@ --color=always -- {-1}"
file=$(git diff $@ --name-only --relative | fzf --ansi --preview $preview --preview-window right:65%:wrap -0)
[ -n "$file" ] && nvim $file
unset preview file
}
gtc() {
[ -z "$1" ] && [ -p "/dev/stdin" ] && read -r query </dev/stdin || query=$1
git clone "$query"
}
gtr() {
[ -z "$1" ] && [ -p "/dev/stdin" ] && read -r query </dev/stdin || query=$1
curl -s "https://api.github.com/users/$query/repos" | sed -nE 's|.*ssh_url": "([^"]*)".*|\1|p' | fzf --border --height=10 --layout=reverse -0
}
gtu() { [ -z "$1" ] || curl -s "https://api.github.com/search/users?q=$1" | sed -nE 's_.*login": "([^"]*)".*_\1_p' | fzf --layout=reverse --border --height=10 -0; }
clshist() {
a=$(cat ~/.histfile | wc -l)
[ "$a" -gt $HISTSIZE ] && sed -i "1,$((a - HISTSIZE))d" ~/.histfile
}
v() {
[ -z "$*" ] && nvim -O $(fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}' -m | tr '\n' ' ') || nvim -O $*
}
help() {
"$@" --help 2>&1 | bat --plain --language=help
}
addpkg() {
[ -z "$*" ] && printf "\033[1;31mPlease write the name of package (just some words)..\033[0m" && return 1
paru -Ss "$*" | sed -nE 's|^([a-z]*)/([^ ]*).*|[\1] \2|p' | fzf --layout=reverse --border --preview 'paru -Si $(echo {} | cut -d" " -f2) | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | cut -d' ' -f2- | paru -S -
}
rmpkg() {
paru -Qq | fzf --preview 'paru -Si {} | bat --language=yaml --color=always -pp' --preview-window right:65%:wrap -m | paru -Rcns -
}
# Lines configured by zsh-newuser-install
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
alias cat="bat -pp --color=always"
alias open="xdg-open"
alias cp="cp -v"
alias lsblk="lsblk -o 'NAME,SIZE,FSAVAIL,FSUSED,FSUSE%,MOUNTPOINTS'"
alias art="php artisan"
alias rm="rm -v"
alias mv="mv -v"
alias pgrep="pgrep -a"
alias grep="grep --color=auto"
alias ncdu="ncdu --color dark"
alias ll="lsd --color=auto -alh"
alias ls="lsd --color=auto"
alias fetch='/bin/*fetch'
alias nchh="nvim ~/.config/hypr/hyprland.conf"
alias shfmt="shfmt -ci -d -w"
HISTFILE=~/.histfile
HISTSIZE=500
SAVEHIST=500
clshist
PROMPT_EOL_MARK=' ⏎ '
setopt autocd
bindkey -e
zstyle :compinstall filename "$0"
fpath=($HOME/.config/zsh/completions $fpath)
autoload -Uz compinit
compinit
zstyle ':completion:*' menu select
eval "$(starship init zsh)"
[ -f "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] && source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOME/.config/fzf-tab/fzf-tab.plugin.zsh