Use less git queries for prompt, s/fzf/sk/
This commit is contained in:
parent
1a1895d658
commit
ea64da4901
23
profile
23
profile
@ -22,19 +22,24 @@ export EDITOR="vis"
|
|||||||
export LEDGER_FILE="/data/documents/ledger/all.journal"
|
export LEDGER_FILE="/data/documents/ledger/all.journal"
|
||||||
export LESSHISTFILE=-
|
export LESSHISTFILE=-
|
||||||
export FZF_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files) 2> /dev/null'
|
export FZF_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files) 2> /dev/null'
|
||||||
|
export SKIM_DEFAULT_COMMAND='(git ls-files -co --exclude-standard || rg --files) 2> /dev/null'
|
||||||
export LC_ALL=en_US.utf8
|
export LC_ALL=en_US.utf8
|
||||||
|
|
||||||
# Select Dock sound card if it's there
|
# Select Dock sound card if it's there
|
||||||
if [ -e /proc/asound/Dock ]; then
|
#(it's broken)
|
||||||
export ALSA_CARD=Dock
|
#if [ -e /proc/asound/Dock ]; then
|
||||||
fi
|
# export ALSA_CARD=Dock
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# Nix Shells
|
||||||
|
. /etc/profile.d/nix.sh
|
||||||
|
#export NIX_BUILD_SHELL=yash
|
||||||
|
|
||||||
#stty -ixon # disable <C-s>
|
#stty -ixon # disable <C-s>
|
||||||
|
|
||||||
# Start X if we're in tty1
|
# Start X if we're in tty1
|
||||||
xsession() {
|
if tty | grep -q '/dev/tty1'; then
|
||||||
startx 2>&1 || vlock
|
startx 2>&1 || vlock
|
||||||
#sudo poweroff
|
#sudo poweroff
|
||||||
#sleep infinity
|
#sleep infinity
|
||||||
}
|
fi
|
||||||
if tty | grep -q '/dev/tty1'; then xsession; fi
|
|
||||||
|
32
yashrc
32
yashrc
@ -18,13 +18,14 @@ HISTRMDUP=5000
|
|||||||
# Get ourselves a nice prompt
|
# Get ourselves a nice prompt
|
||||||
ks() { s="$?" ; $* ; return "$s" ; }
|
ks() { s="$?" ; $* ; return "$s" ; }
|
||||||
prompt_git() {
|
prompt_git() {
|
||||||
if git status 2>/dev/null 1>&2; then
|
porcelain="$(git status --branch --porcelain 2>/dev/null)"
|
||||||
local branch="$(git branch | sed -n 's/^\* (*\(.* \)*\([^ )]*\))*$/\2/p')"
|
if test "$?" = 0; then
|
||||||
local behind="$(git status --branch --porcelain=2 | sed -n 's/^# branch\.ab.*-\([^0].*\)$/⇃\1/p')"
|
local branch="$(printf '%s' "$porcelain" | sed -n '1s/## \([^.]*\)\.\.\..*/\1/p')"
|
||||||
local before="$(git status --branch --porcelain=2 | sed -n 's/^# branch\.ab +\([^0].*\) .*$/↿\1/p')"
|
local behind="$(printf '%s' "$porcelain" | sed -n '1s/## .*behind \([0-9]*\).*/⇃\1/p')"
|
||||||
local status="$({ echo OK; git status --porcelain | sed 's/\(..\).*/\1/'; } | tail -1)"
|
local ahead="$(printf '%s' "$porcelain" | sed -n '1s/## .*ahead \([0-9]*\).*/↿\1/p')"
|
||||||
|
local status="$({ echo OK; printf '%s' "$porcelain" | sed '/##/d;s/\(..\).*/\1/'; } | tail -1)"
|
||||||
|
|
||||||
echo " (${branch}${behind}${before}|${status})"
|
echo " (${branch}${behind}${ahead}|${status})"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
prompt_pwd() {
|
prompt_pwd() {
|
||||||
@ -55,10 +56,11 @@ unset GREEN
|
|||||||
unset RESET
|
unset RESET
|
||||||
|
|
||||||
# Color ls
|
# Color ls
|
||||||
ls_() {
|
# ls_() {
|
||||||
lr -1FGG "$@" | git column --mode=dense --padding=3
|
# lr -1FGG "$@" | git column --mode=dense --padding=3
|
||||||
}
|
# }
|
||||||
alias ls="ls_"
|
# alias ls="ls_"
|
||||||
|
alias ls="ls --color=auto"
|
||||||
alias ll="lr -Fl1Ghov"
|
alias ll="lr -Fl1Ghov"
|
||||||
|
|
||||||
# There is only one vis
|
# There is only one vis
|
||||||
@ -70,17 +72,23 @@ alias nano="vis"
|
|||||||
alias agent='eval "$(ssh-agent)" && ssh-add'
|
alias agent='eval "$(ssh-agent)" && ssh-add'
|
||||||
alias unlock='gpg-connect-agent <<<bye'
|
alias unlock='gpg-connect-agent <<<bye'
|
||||||
|
|
||||||
alias weechat="ssh -t weechat@Chatmachine abduco -A weechat"
|
alias weechat="ssh -t weechat@Hetzner abduco -A weechat"
|
||||||
alias agenda="khal list today 7d"
|
alias agenda="khal list today 7d"
|
||||||
|
|
||||||
|
# Ledger
|
||||||
alias haccounts="hledger -I --alias '/.*:Accounts [^:]*:(.*)/=Accounts:\1' bal accounts"
|
alias haccounts="hledger -I --alias '/.*:Accounts [^:]*:(.*)/=Accounts:\1' bal accounts"
|
||||||
alias ladd='ladd -a /data/documents/ledger/2020/main.journal /data/documents/ledger/*/main.journal'
|
alias ladd='ladd -a /data/documents/ledger/2020/main.journal /data/documents/ledger/*/main.journal'
|
||||||
alias is='hledger is -b $(date -d "6 months ago" +%Y-%m) -MTA --tree -2'
|
alias is='hledger is -b $(date -d "6 months ago" +%Y-%m) -MTA --tree -2'
|
||||||
|
alias cf='hledger cf -b $(date -d "6 months ago" +%Y-%m) -MTA --tree -2'
|
||||||
alias bs='hledger bs not:accounts'
|
alias bs='hledger bs not:accounts'
|
||||||
|
|
||||||
|
# Rust debugging
|
||||||
|
alias rustdb="RUST_TEST_THREADS=1 RUST_GDB=cgdb rust-gdb"
|
||||||
|
alias rtdb='rustdb $(cargo test -v 2>&1 | grep "Running.*$(pwd)" | cut -f2 -d"\`")'
|
||||||
|
|
||||||
go() {
|
go() {
|
||||||
dir="$(lr /home /data /etc -t '(name ~~ ".*" && prune || print) && type = d && !(name = ".git")' \
|
dir="$(lr /home /data /etc -t '(name ~~ ".*" && prune || print) && type = d && !(name = ".git")' \
|
||||||
| fzf --height 10 \
|
| sk --height 10 \
|
||||||
)"
|
)"
|
||||||
[ -n "$dir" ] && cd "$dir" || false
|
[ -n "$dir" ] && cd "$dir" || false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user