aboutsummaryrefslogtreecommitdiff
path: root/files/.zsh/rc
diff options
context:
space:
mode:
authorAnton Bobov <anton@bobov.name>2022-09-15 19:27:54 +0200
committerAnton Bobov <anton@bobov.name>2022-09-15 19:30:02 +0200
commitafc7b47498cbbca7a4df45c46eb92b5a8a94cbaf (patch)
treeab103eb64c155ed8b35076a7d939c760808b7d77 /files/.zsh/rc
parent14473dced350f23fe83ec3cd3df06dc9c2637183 (diff)
zsh updates
- add python venv marker to prompt - add aliasses and functions
Diffstat (limited to 'files/.zsh/rc')
-rw-r--r--files/.zsh/rc/S06_grml_extension10
l---------files/.zsh/rc/S10_forgit (renamed from files/.zsh/rc/S90_forgit)0
-rw-r--r--files/.zsh/rc/S50_aliases1
-rw-r--r--files/.zsh/rc/S50_functions48
4 files changed, 59 insertions, 0 deletions
diff --git a/files/.zsh/rc/S06_grml_extension b/files/.zsh/rc/S06_grml_extension
new file mode 100644
index 0000000..ba106f0
--- /dev/null
+++ b/files/.zsh/rc/S06_grml_extension
@@ -0,0 +1,10 @@
+function virtual_env_prompt () {
+ REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) }
+}
+
+grml_theme_add_token \
+ virtual-env -f virtual_env_prompt '%F{magenta}' '%f'
+zstyle ':prompt:grml:left:setup' items \
+ rc virtual-env change-root user at host path vcs percent
+
+# vim: ft=zsh :
diff --git a/files/.zsh/rc/S90_forgit b/files/.zsh/rc/S10_forgit
index cfcc0b3..cfcc0b3 120000
--- a/files/.zsh/rc/S90_forgit
+++ b/files/.zsh/rc/S10_forgit
diff --git a/files/.zsh/rc/S50_aliases b/files/.zsh/rc/S50_aliases
index 1688550..c0a6d1b 100644
--- a/files/.zsh/rc/S50_aliases
+++ b/files/.zsh/rc/S50_aliases
@@ -196,6 +196,7 @@ alias ocrmypdf='ocrmypdf --clean --deskew --rotate-pages'
alias ocrmypdf-rus='ocrmypdf --language rus'
alias ocrmypdf-eng='ocrmypdf --language eng'
alias ocrmypdf-rus-eng='ocrmypdf --language rus+eng'
+alias ocrmypdf-swe-eng='ocrmypdf --language swe+eng'
alias display_off='xset dpms force off'
alias cclip='xclip -selection clipboard'
diff --git a/files/.zsh/rc/S50_functions b/files/.zsh/rc/S50_functions
index 9ce889b..12611c2 100644
--- a/files/.zsh/rc/S50_functions
+++ b/files/.zsh/rc/S50_functions
@@ -77,13 +77,61 @@ edit-which() {
}
compdef edit-which=which
+which-package() {
+ whence -p "$1" | xargs --no-run-if-empty apt-file search --fixed-string
+}
+compdef which-package=which
+
ipinfo() {
curl ipinfo.io/json
}
+docker-images-clean() {
+ docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.Size}}" |
+ fzf --multi --header-lines=1 |
+ awk '{print $1}' |
+ xargs -r docker rmi -f
+}
+
transfer() {
curl --progress-bar --upload-file "$1" https://transfer.sh/$(basename "$1") | tee /dev/null;
echo
}
+web-bookmarks() {
+ local bookmarks_path="$HOME/.config/chromium/Default/Bookmarks"
+ local jq_script='def ancestors: while(. | length >= 2; del(.[-1,-2])); . as $in | paths(.url?) as $key | $in | getpath($key) | {name,url, path: [$key[0:-2] | ancestors as $a | $in | getpath($a) | .name?] | reverse | join("/") } | .path + "/" + .name + "\t" + .url'
+ jq -r $jq_script < "$bookmarks_path" |
+ sed -E $'s/(.*)\t(.*)/\\1\t\x1b[36m\\2\x1b[m/g' |
+ fzf --ansi --multi |
+ cut -d$'\t' -f2 |
+ xargs xdg-open >/dev/null 2>&1
+}
+
+vpn-up() {
+ name="$1"
+ nmcli connection up "$name" >/dev/null
+}
+
+vpn-down() {
+ name="$1"
+ if nmcli connection show "$name" | grep 'GENERAL.STATE' >/dev/null ; then
+ nmcli connection down "$name" >/dev/null
+ fi
+}
+
+vpn-toggle() {
+ name="$1"
+ if nmcli connection show "$name" | grep 'GENERAL.STATE' >/dev/null ; then
+ vpn-down "$name"
+ else
+ for vpn in "WG Home" "wgDe" "riga.bobov.name" "bobov.name" ; do
+ if [ "$name" != "$vpn" ] ; then
+ vpn-down "$vpn"
+ fi
+ done
+ vpn-up "$1"
+ fi
+}
+
# vim: ft=zsh :