Use spaces instead of tabs

This commit is contained in:
ItsDrike 2021-12-18 18:07:47 +01:00
parent b07404d669
commit d843e90462
No known key found for this signature in database
GPG key ID: FB8CA11A2CF3A843
4 changed files with 134 additions and 138 deletions

View file

@ -26,13 +26,13 @@ function batdiff() {
} }
# Determine size of a file or total size of a directory # Determine size of a file or total size of a directory
function dir-size() { function dirsize() {
if du -b /dev/null > /dev/null 2>&1; then if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh; local arg=-sbh;
else else
local arg=-sh; local arg=-sh;
fi fi
if [[ -n "$@" ]]; then if [[ -n "$*" ]]; then
\du $arg -- "$@"; \du $arg -- "$@";
else else
\du $arg .[^.]* ./*; \du $arg .[^.]* ./*;
@ -47,9 +47,7 @@ function randmac() {
# Go to the root of a git tree # Go to the root of a git tree
cdgit () { cdgit () {
git rev-parse --is-inside-work-tree > /dev/null 2>&1 if [ "$(git rev-parse --is-inside-work-tree > /dev/null 2>&1)" -eq 0 ]; then
if [ $? -eq 0 ]; then
TEMP_PWD=`pwd`
while ! [ -d .git ]; do while ! [ -d .git ]; do
cd .. cd ..
done done
@ -161,6 +159,7 @@ fi
# Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression # Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression
function targz() { function targz() {
# Combine given names spearated with spaces as the filename
local tmpFile="${@%/}.tar"; local tmpFile="${@%/}.tar";
tar -cvf "${tmpFile}" "${@}" || return 1; tar -cvf "${tmpFile}" "${@}" || return 1;

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
if command -v pkgfile > /dev/null; then if command -v pkgfile > /dev/null; then
# Command not found hook that uses `pkgfile` package # Command not found hook that uses `pkgfile` package
@ -7,23 +7,20 @@ if command -v pkgfile > /dev/null; then
# and not found, if there are no such packages, only print # and not found, if there are no such packages, only print
# command not found message # command not found message
command_not_found_handler() { command_not_found_handler() {
local pkgs cmd="$1" files=() cmd="$1"
printf 'zsh: command not found: %s' "$cmd" # print command not found asap, then search for packages printf 'zsh: command not found: %s' "$cmd" # print command not found asap, then search for packages
files=(${(f)"$(pkgfile ${cmd})"}) repos="$(pkgfile "$cmd")"
if (( ${#files[@]} )); then if [ -n "$repos" ]; then
printf '\r%s may be found in the following packages:\n' "$cmd" printf '\r%s may be found in the following packages:\n' "$cmd"
local res=() repo package version file echo "$repos" | while read -r pkg; do
for file in "$files[@]"; do printf ' %s\n' "$pkg"
res=("${(0)file}")
repo="$res[1]"
printf ' %s\n' "$repo"
done done
else else
printf '\n' printf '\n'
fi fi
return 127 return 127
} }
elif [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then elif [ -x /usr/lib/command-not-found ] || [ -x /usr/share/command-not-found/command-not-found ]; then
# Ubuntu handle for bash default command-not-found # Ubuntu handle for bash default command-not-found
# it works similarely to the above arch alternative, # it works similarely to the above arch alternative,
# this is based on the original bash implementation # this is based on the original bash implementation

View file

@ -30,7 +30,7 @@ export PROMPT_EOL_MARK=""
# (unless you change it in kernel), respect this and downgrade # (unless you change it in kernel), respect this and downgrade
# the color scheme accordingly (it won't look best, but it's # the color scheme accordingly (it won't look best, but it's
# still better than no colors) # still better than no colors)
if [ $TERM = "linux" ]; then if [ "$TERM" = "linux" ]; then
GREEN="%F{002}" GREEN="%F{002}"
RED="%F{001}" RED="%F{001}"
ORANGE="%F{003}" ORANGE="%F{003}"
@ -52,7 +52,7 @@ git_prompt() {
ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo -n " $ORANGE${ref#refs/heads/}" echo -n " $ORANGE${ref#refs/heads/}"
if [ ! -z "$(git status --short 2>/dev/null)" ]; then if [ -n "$(git status --short 2>/dev/null)" ]; then
echo "$RED+" echo "$RED+"
fi fi
} }