From 07d59bacd8d9db184061388a2d6e736655b7c36b Mon Sep 17 00:00:00 2001 From: xerus2000 <27jf@pm.me> Date: Wed, 14 Oct 2020 14:16:36 +0200 Subject: [PATCH] config/shell: Fix shell startup speed & return code --- .config/shell/arch | 2 +- .config/shell/debian | 2 +- .config/shell/functions | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.config/shell/arch b/.config/shell/arch index 50d7fa1..44644c1 100644 --- a/.config/shell/arch +++ b/.config/shell/arch @@ -1,4 +1,4 @@ -which pacman >/dev/null || return +which pacman >/dev/null || return 0 # Arch aliases alias pac='sudo pacman' diff --git a/.config/shell/debian b/.config/shell/debian index 5732ee2..3f81216 100644 --- a/.config/shell/debian +++ b/.config/shell/debian @@ -1,4 +1,4 @@ -which apt >/dev/null || return +which apt >/dev/null || return 0 addalternative() { sudo update-alternatives --install /usr/bin/$1 $1 "$(which "$1$2")" 1 diff --git a/.config/shell/functions b/.config/shell/functions index f0d1e61..04b50f2 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -24,7 +24,7 @@ edconf() { touch "$conf_cache" # | xargs file | grep text | cut -d':' -f1 # this filters out non-text files, but it's ridiculously slow sel="$({ cat "$conf_cache"; test -f "$conf_extra" && cat "$conf_extra"; fd --type file --size -1m --hidden --exact-depth 1 . ~; fd --type file --size -1m --max-depth 3 . --full-path "$XDG_CONFIG_HOME" /etc } | dedup | fzf -1 -0 --tiebreak=end,length --preview 'bat --color=always --style=numbers --line-range :200 {}' --query="$1" --history "$conf_cache_dir/searches")" - test "$sel" && ((echo "$sel" | cat - "$conf_cache" | head -9 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache") & editright "$sel") + test "$sel" && ((echo "$sel" | cat - "$conf_cache" | head -30 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache") & editright "$sel") } CONFIG_SHELL_FUNCTIONS="${BASH_SOURCE[0]:-${(%):-%x}}" @@ -100,12 +100,13 @@ rpl() { }" } + # Recover stray swap files from neovim alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs -r nvim" alias vrecd="ls $XDG_DATA_HOME/nvim/swap | head -1 | xargs -r rm" # Applications -alias dict="(builtin cd $(dirname $(locate -n 2 /dict.txt)) && rlwrap perl dictcc-helper.pl)" +alias dict="(builtin cd $XDG_DATA_HOME/dictcc && rlwrap perl dictcc-helper.pl)" alias startMinecraftServer='curl https://ipinfo.io/ip | xclip -sel clip && cd ~/daten/games/sharedgames/minecraft/server && java -jar forge-1.12.2-14.23.5.2768-universal.jar -mx 8G' test -d $HOME/.dropbox && dropbox_path="$(cat $HOME/.dropbox/info.json | grep -Po '"'"path"'"\s*:\s*"\K([^"]*)')"