mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 05:04:34 +00:00
Use spaces instead of tabs
This commit is contained in:
parent
b07404d669
commit
d843e90462
|
@ -26,13 +26,13 @@ function batdiff() {
|
|||
}
|
||||
|
||||
# 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
|
||||
local arg=-sbh;
|
||||
else
|
||||
local arg=-sh;
|
||||
fi
|
||||
if [[ -n "$@" ]]; then
|
||||
if [[ -n "$*" ]]; then
|
||||
\du $arg -- "$@";
|
||||
else
|
||||
\du $arg .[^.]* ./*;
|
||||
|
@ -47,9 +47,7 @@ function randmac() {
|
|||
|
||||
# Go to the root of a git tree
|
||||
cdgit () {
|
||||
git rev-parse --is-inside-work-tree > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
TEMP_PWD=`pwd`
|
||||
if [ "$(git rev-parse --is-inside-work-tree > /dev/null 2>&1)" -eq 0 ]; then
|
||||
while ! [ -d .git ]; do
|
||||
cd ..
|
||||
done
|
||||
|
@ -161,6 +159,7 @@ fi
|
|||
|
||||
# Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression
|
||||
function targz() {
|
||||
# Combine given names spearated with spaces as the filename
|
||||
local tmpFile="${@%/}.tar";
|
||||
tar -cvf "${tmpFile}" "${@}" || return 1;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
if command -v pkgfile > /dev/null; then
|
||||
# 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
|
||||
# command not found message
|
||||
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
|
||||
files=(${(f)"$(pkgfile ${cmd})"})
|
||||
if (( ${#files[@]} )); then
|
||||
repos="$(pkgfile "$cmd")"
|
||||
if [ -n "$repos" ]; then
|
||||
printf '\r%s may be found in the following packages:\n' "$cmd"
|
||||
local res=() repo package version file
|
||||
for file in "$files[@]"; do
|
||||
res=("${(0)file}")
|
||||
repo="$res[1]"
|
||||
printf ' %s\n' "$repo"
|
||||
echo "$repos" | while read -r pkg; do
|
||||
printf ' %s\n' "$pkg"
|
||||
done
|
||||
else
|
||||
printf '\n'
|
||||
fi
|
||||
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
|
||||
# it works similarely to the above arch alternative,
|
||||
# this is based on the original bash implementation
|
||||
|
|
|
@ -30,7 +30,7 @@ export PROMPT_EOL_MARK=""
|
|||
# (unless you change it in kernel), respect this and downgrade
|
||||
# the color scheme accordingly (it won't look best, but it's
|
||||
# still better than no colors)
|
||||
if [ $TERM = "linux" ]; then
|
||||
if [ "$TERM" = "linux" ]; then
|
||||
GREEN="%F{002}"
|
||||
RED="%F{001}"
|
||||
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
|
||||
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+"
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue