config/shell: adjust to bash

This commit is contained in:
xeruf 2022-04-28 13:02:26 +02:00
parent a98ac98de4
commit e5ed1e7fa8
3 changed files with 7 additions and 5 deletions

View File

@ -53,7 +53,7 @@ cd() {
# LOCATE {{{1 # LOCATE {{{1
# TODO no double heading with bat # TODO no double heading with bat
alias fselect='fzf -0 -1 --reverse --height=30% | while read f; do test -d "$f" && cd "$f" || { highlight "$f" && print -s "b $f" && b "$f" }; done' alias fselect='fzf -0 -1 --reverse --height=30% | while read f; do test -d "$f" && cd "$f" || { highlight "$f" && print -s "b $f" && b "$f"; }; done';
loci() { loci() {
locate --all --ignore-case --basename --existing "$@" | locate --all --ignore-case --basename --existing "$@" |
command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') | command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') |
@ -87,7 +87,7 @@ locate-zox() {
} }
# Switch directory heuristically using zoxide and locate # Switch directory heuristically using zoxide and locate
d() { d() {
test "$1" != "-" -a ! -d "$1" -a $# -eq 1 || { cd "$@" && return } test "$1" != "-" -a ! -d "$1" -a $# -eq 1 || { cd "$@" && return; }
local query="$(zoxide-list "$@")" local query="$(zoxide-list "$@")"
# First find out whether there is an obvious match # First find out whether there is an obvious match
# (score at least ten times above runner-up and score above 20) # (score at least ten times above runner-up and score above 20)

View File

@ -12,7 +12,7 @@ xo() {
if which jrnl >/dev/null; then if which jrnl >/dev/null; then
alias j='jrnl' alias j='jrnl'
jn() { jrnl -to today "$@" | less +G } jn() { jrnl -to today "$@" | less +G; }
compdef jn=jrnl compdef jn=jrnl
alias jnc='jn -contains' alias jnc='jn -contains'
alias jne='jrnl --edit' alias jne='jrnl --edit'

View File

@ -19,7 +19,7 @@ listprojects() {
find $1 -mindepth 1 -maxdepth $_projects_subfolder_level -type d \ find $1 -mindepth 1 -maxdepth $_projects_subfolder_level -type d \
-path "${1:-.}/*/.git" -exec dirname {} \; -o \ -path "${1:-.}/*/.git" -exec dirname {} \; -o \
-name "_*" -o -name ".*" -prune || -name "_*" -o -name ".*" -prune ||
{ test $# -eq 0 && listprojects $PROJECTS } { test $# -eq 0 && listprojects $PROJECTS; }
} }
# Underline the project names # Underline the project names
@ -75,7 +75,8 @@ projects() {
listprojects $all | while read d; do listprojects $all | while read d; do
builtin cd $d builtin cd $d
if [[ $com != gradle* ]] || (( $(f1 -name "*gradle*" | wc -l) > 0 )); then if [[ $com != gradle* ]] || (( $(f1 -name "*gradle*" | wc -l) > 0 )); then
local st=() #local st=()
declare -a st
local ahead=$(command git rev-list "${branch_name}"@{upstream}..HEAD 2>/dev/null | wc -l) local ahead=$(command git rev-list "${branch_name}"@{upstream}..HEAD 2>/dev/null | wc -l)
test $ahead -gt 0 && st+=("ahead $ahead") test $ahead -gt 0 && st+=("ahead $ahead")
local behind=$(command git rev-list HEAD.."${branch_name}"@{upstream} 2>/dev/null | wc -l) local behind=$(command git rev-list HEAD.."${branch_name}"@{upstream} 2>/dev/null | wc -l)
@ -90,3 +91,4 @@ projects() {
esac esac
builtin cd $PROJECTS builtin cd $PROJECTS
} }