From 5e6025db97f182b74bd6648608c3a7a6f01c1701 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 24 Apr 2023 01:27:42 +0200 Subject: removed error messages on grep --- config/essentials/zsh/.zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'config/essentials/zsh') diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 6fc601c..0850b94 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -28,7 +28,8 @@ zle -N add-surround surround zle -N change-surround surround compinit -if grep -qi "debian\|ubuntu" /etc/os-release; then +if grep -qi "debian\|ubuntu" /etc/os-release 2> /dev/null +then sfiles=( /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh @@ -36,8 +37,7 @@ if grep -qi "debian\|ubuntu" /etc/os-release; then else sfiles=( /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh - /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - ) + /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh) fi sfiles+=( ~/.config/zsh/functions.zsh -- cgit v1.2.3 From afbf46a5ae8248a1718e3abe801bc87f88838bae Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 24 Apr 2023 12:42:10 +0200 Subject: added action to window title --- config/essentials/zsh/.zshrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'config/essentials/zsh') diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 6fc601c..ef11748 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -83,9 +83,14 @@ add-zsh-hook -Uz precmd rehash_precmd PS1=' %B%(#.%F{1}.%F{13})[%n%b%f@%B%F{6}%m]%b%f %3~ ' RPROMPT='%F{blue}$(parse_git_remote)%f%F{red}$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)' -precmd () { +set_wt_action () { + print -Pn "\e]0;$USER@$HOST on ${PWD//$HOME/\~} | $1\a" +} +add-zsh-hook -Uz preexec set_wt_action +set_wt () { print -Pn "\e]0;$USER@$HOST on ${PWD//$HOME/\~}\a" } +add-zsh-hook -Uz precmd set_wt setopt prompt_subst parse_git_remote() { -- cgit v1.2.3 From a95eb39726cadb56e9fed8825c170118c8d69116 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 24 Apr 2023 12:43:30 +0200 Subject: moved hooks together --- config/essentials/zsh/.zshrc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'config/essentials/zsh') diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 3f9bd76..5ce6d01 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -65,7 +65,7 @@ bindkey "^Xe" edit-command-line bindkey "^[." insert-last-word bindkey "^['" quote-line -# pacman synced rehash +# rehash hook zshcache_time="$(date +%s%N)" autoload -Uz add-zsh-hook rehash_precmd() { @@ -77,12 +77,8 @@ rehash_precmd() { fi fi } +# window title hooks add-zsh-hook -Uz precmd rehash_precmd - -# prompt -PS1=' %B%(#.%F{1}.%F{13})[%n%b%f@%B%F{6}%m]%b%f %3~ ' -RPROMPT='%F{blue}$(parse_git_remote)%f%F{red}$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)' - set_wt_action () { print -Pn "\e]0;$USER@$HOST on ${PWD//$HOME/\~} | $1\a" } @@ -92,6 +88,11 @@ set_wt () { } add-zsh-hook -Uz precmd set_wt + +# prompt +PS1=' %B%(#.%F{1}.%F{13})[%n%b%f@%B%F{6}%m]%b%f %3~ ' +RPROMPT='%F{blue}$(parse_git_remote)%f%F{red}$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)' + setopt prompt_subst parse_git_remote() { b="$(git branch -v 2> /dev/null | grep "^*" | sed 's/.\+\[\([^ ]\+\).*$/\1/')" -- cgit v1.2.3 From c6ac8de4715bd4d005bbcc190784e1b4133db47b Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 24 Apr 2023 13:55:49 +0200 Subject: quote googoo aliases --- bin/common/goo | 2 +- config/essentials/zsh/functions.zsh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'config/essentials/zsh') diff --git a/bin/common/goo b/bin/common/goo index 442f25c..cfd03ec 100755 --- a/bin/common/goo +++ b/bin/common/goo @@ -18,6 +18,6 @@ arduino15" for dir in $exclude; do dirs="$dirs -name \"$dir\" -o " done -cmd="find ${2:-$HOME} \(${dirs} -false \) -prune -o -type ${1:-f} -print" +cmd="find ${2:-$HOME} \(${dirs} -false \) -prune -o -type ${1:-f} -mindepth 1 -print" eval "$cmd" 2>/dev/null diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 64761d9..808f4bf 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -11,9 +11,9 @@ nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit } ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit } # googoo aliases -ff () { goo f $1 | fzf } -fd () { goo d $1 | fzf } -fdf () { goo f $1 | fzf | xargs dirname } +ff () { goo f "$1" | fzf } +fd () { goo d "$1" | fzf } +fdf () { goo f "$1" | fzf | xargs -I {} dirname "{}" } o () { f="$(ff $1)" -- cgit v1.2.3 From b3aedded4af502c063b3fdc60989266e8b3f6dac Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 24 Apr 2023 20:05:43 +0200 Subject: added alias for connecting bluetooth --- config/essentials/zsh/aliases.zsh | 1 + 1 file changed, 1 insertion(+) (limited to 'config/essentials/zsh') diff --git a/config/essentials/zsh/aliases.zsh b/config/essentials/zsh/aliases.zsh index 21bc5d8..a1c2f22 100644 --- a/config/essentials/zsh/aliases.zsh +++ b/config/essentials/zsh/aliases.zsh @@ -112,6 +112,7 @@ alias vidlen='ffprobe -show_entries format=duration -v quiet -of csv="p=0" -i' alias whatsmyip='curl -s "ifconfig.co"' alias icognito='unset HISTFILE' alias webcam='v4l2-ctl --set-fmt-video=width=1280,height=720; mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0 --profile=low-latency --untimed --no-resume-playback' +alias airpods='bluetoothctl connect 60:93:16:24:00:10' alias hotpsot='nmcli dev wifi hotspot ifname wlan0 ssid wiefie password "peepeepoopoo"' alias wtip='wt ip -c -brief addr' alias qrclipo='qrencode -s 16 "$(clipo)" -io - | imv -w "imv - $(clipo)" -' -- cgit v1.2.3 From 2279a765fb2c9b15792ab9e33454091071fc004a Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Mon, 24 Apr 2023 20:07:05 +0200 Subject: added comment --- config/essentials/zsh/.zshrc | 1 + 1 file changed, 1 insertion(+) (limited to 'config/essentials/zsh') diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 5ce6d01..f0c1cbf 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -113,6 +113,7 @@ parse_git_status() { export REPORTTIME=2 export TIMEFMT="-> %*E" +# override built-in time command alias time='/usr/bin/time' export MENUCMD='fzf' -- cgit v1.2.3