new laptop and clean up

- instead of vifm use bash and dolphin
This commit is contained in:
2025-09-19 14:47:38 +02:00
parent fe4109c0f1
commit 8f42578e4e
15 changed files with 206 additions and 615 deletions

View File

@@ -1,32 +1,24 @@
# Make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
alias gitdotfiles='/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"'
# enable color support of ls and also add handy aliases
alias ls='ls -pQFh --group-directories-first'
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto -pQFh --group-directories-first'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
if [[ -r "$HOME/.dircolors" ]]; then
eval "$(dircolors -b "$HOME/.dircolors")"
else
eval "$(dircolors -b)"
fi
fi
alias ls='ls --color=auto -pQFh --group-directories-first'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias §rm='rm -vi'
alias §cp='cp -vi'
alias §mv='mv -vi'
alias §df='df -Th'
§du(){
[[ "$1" == '--help' ]] && echo "§du; §du '../*'" && return 0
du -h -x -s -- ${1:-*} | sort -r -h;
}
alias §xclip-copy='xclip -selection clipboard'
alias §xclip-paste='xclip -o -selection clipboard'
CROSS_SESSION="$BASH_DOTFILES/.bash_cross_session"
[ -f "$CROSS_SESSION" ] && . "$CROSS_SESSION"
crossSession() {
@@ -39,80 +31,43 @@ crossSession() {
echo ' Sets cross session variable <name> to <value> (or empty for unset).'
return 0
fi
if [[ '--list' == "$1" ]]; then
if [[ '--list' == "$1" ]]; then
cat "$CROSS_SESSION"
return 0
fi
local name="$1"
local value="$2"
local name="$1"
local value="$2"
# Check if the variable already exists in the file
if grep -q "^export $name=" "$CROSS_SESSION"; then
if [ -z "$value" ]; then
# If new value is empty, remove the variable from the file
sed -i "/^export $name=/d" "$CROSS_SESSION"
else
# If it exists, replace the old value with the new value
sed -i "s|^export $name=.*|export $name=\"$value\"|" "$CROSS_SESSION"
fi
else
if [ -n "$value" ]; then
# If it doesn't exist and new value is not empty, append the new variable to the file
echo "export $name=\"$value\"" >> "$CROSS_SESSION"
fi
fi
# Check if the variable already exists in the file
if grep -q "^export $name=" "$CROSS_SESSION"; then
if [ -z "$value" ]; then
# If new value is empty, remove the variable from the file
sed -i "/^export $name=/d" "$CROSS_SESSION"
else
# If it exists, replace the old value with the new value
sed -i "s|^export $name=.*|export $name=\"$value\"|" "$CROSS_SESSION"
fi
else
if [ -n "$value" ]; then
# If it doesn't exist and new value is not empty, append the new variable to the file
echo "export $name=\"$value\"" >> "$CROSS_SESSION"
fi
fi
}
cd(){
builtin cd "$@" || return $?
crossSession 'OLDPWD' "$(pwd)"
}
cd(){ builtin cd "$@" && crossSession 'OLDPWD' "$(pwd)"; }
history_clean(){ awk '!seen[$0]++ {print $0}' $HOME/.bash_history; }
history_edit(){ vim $HOME/.bash_history; }
history_cat(){ LC_ALL=C cat ~/.bash_history; }
history_most_used(){ LC_ALL=C cat ~/.bash_history | cut -d ';' -f 2- | §awk 1 | sort | uniq -c | sort -r -n | head -n ${1-10}; }
§(){
[[ -z "$1" ]] && clear && return 0
echo "$ [--help]= clear or [print this text]"
alias | grep "alias §" --color=never
declare -F | grep 'declare -f §' --color=never
ls ~/bin | grep -P "^§" | sed 's/^§/~\/bin\/ §/'
\ls ~/.local/bin | grep -P "^§" | xargs -I{} echo '~/.local/bin/'{}
printenv | grep -e '^l' | xargs -I{} echo \${}
}
alias §less='less -R -S'
m(){
if [[ '-d' == "$1" ]]; then
unset "m$2"
crossSession "m$2"
return 0
fi
if [[ -z "$1" ]]; then
printenv | grep -e '^m'
return 0
fi
if [[ "--help" == "$1" ]]; then
echo 'm [--help]'
echo ' Lists all marks or print this help.'
echo 'm -d <name>'
echo ' Deletes mark <name>. Unsets variable and cross session variable.'
echo 'm <name> [path]'
echo ' Sets mark <name> to current directory or [path].'
echo ' The mark is just a bash variable, use `$m<name>`.'
return 0
fi
local n="m$1"
[[ -z "${!n}" ]] || return 1
[[ -z "$2" ]] && local p="$(pwd)" || local p="$(readlink -f $2)"
crossSession "$n" "$p"
export $n="$p"
}
alias cd-vifm='cd `vifm --choose-dir -`'
mkcd(){ mkdir -p -- "$1" && cd -P -- "$1"; }
alias gcalendar-dovolené='gcalendar --account "práce" --calendar "Dovolené"'
alias gcalendar-události='gcalendar --account "default" --calendar "Události"'
alias §find.='find . -maxdepth 1'
alias pdftk='java -jar $HOME/bin/pdftk-all.jar'
bw-session(){
bw logout
@@ -126,12 +81,10 @@ bw-session(){
unset BW_CLIENTID
}
alias §psmem_all='ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem'
alias §psmem='§psmem_all | head -n 10'
alias §pscpu_all='ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu'
alias §pscpu='§pscpu_all | head -n 10'
alias §psnet_all='lsof -P -i -n'
alias §ck-grep='cat /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose | grep -i'
export lps_mem='-eo pid,ppid,cmd,%mem,%cpu --sort=-%mem'
export lps_cpu='-eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu'
export llsoft_all='-P -i -n'
export lgrep_compose='-i /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose'
§ping-test(){ # Pings ip address of noip.com and www.google.com.
ping -c 1 -q 8.23.224.107 | grep --color=never -A 1 -i '\---'
@@ -174,9 +127,17 @@ alias npx-markdown='npx -y markserv'
EOF
}
alias fzf=fzf-carroarmato0.fzf
alias smerge='/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=sublime_merge --file-forwarding com.sublimemerge.App @@u %u @@'
kommit(){ command kommit $* > /dev/null 2>&1 & disown; }
kommit(){
if flatpak info org.kde.kommit > /dev/null 2>&1; then
flatpak run \
--branch=stable --arch=x86_64 \
--file-forwarding \
--command=kommit org.kde.kommit @@u $* @@ > /dev/null 2>&1 & disown;
else
command kommit $* > /dev/null 2>&1 & disown;
fi
}
§url-curl(){ curl --silent -I "$1" | grep -i location; }