bash, geany, vim, README.md

This commit is contained in:
2025-11-19 15:56:21 +01:00
parent 8f42578e4e
commit f249171d50
51 changed files with 196 additions and 3977 deletions

View File

@@ -50,7 +50,7 @@ crossSession() {
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"
echo "export $name='$value'" >> "$CROSS_SESSION"
fi
fi
}
@@ -68,7 +68,6 @@ cd(){
printenv | grep -e '^l' | xargs -I{} echo \${}
}
alias pdftk='java -jar $HOME/bin/pdftk-all.jar'
bw-session(){
bw logout
# login=`kwallet-query kdewallet -f accounts -r Bitwarden 2> /dev/null`
@@ -81,10 +80,10 @@ bw-session(){
unset BW_CLIENTID
}
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'
alias §ps-mem='ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem'
alias §ps-cpu='ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu'
alias §lsoft-all='lsoft -P -i -n'
alias §grep-compose='grep -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 '\---'
@@ -138,8 +137,10 @@ kommit(){
command kommit $* > /dev/null 2>&1 & disown;
fi
}
export SVN_CONFIG_DIR="$HOME/.config/subversion"
alias svn='svn --config-dir "$SVN_CONFIG_DIR"'
§url-curl(){ curl --silent -I "$1" | grep -i location; }
§curl-location(){ curl --silent -I "$1" | grep -i location; }
rpg(){
rpg-cli "$@"

View File

@@ -9,7 +9,7 @@ complete -F _complete_alias gitdotfiles
alias C--brew='\. "$BASH_DOTFILES/brew.completion"'
alias C--pnpm='\. "$BASH_DOTFILES/pnpm.completion"'
alias C--uu='eval "$($HOME/.loacl/bin/uu --completion-bash)"'
alias C--uu='eval "$($HOME/.local/bin/uu --completion-bash)"'
alias C--jc='eval "$(jc -B)" … newer version needed'
\. <(bs .completion bash)
\. "$BASH_DOTFILES/cordova.completion"

View File

@@ -1,66 +1,87 @@
function setPromt {
setPrompt() {
if [ "$color_prompt" != yes ]; then
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND}"
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
return
fi
case "$TERM" in
xterm*|rxvt*)
;;
*)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
return
;;
xterm*|rxvt*)
;;
*)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
return
;;
esac
PROMPT_COMMAND=updatePromt
PROMPT_COMMAND="updatePrompt${PROMPT_COMMAND:+; $PROMPT_COMMAND}"
PS2="|"
}
function updatePromt {
updatePrompt() {
local prev_exit="$?"
# history -n; history -w; history -c; history -r;
# color_helper_>>color<< (Note: \[\]= escaping)
local chR="\[\e[1;91m\]" #red
local chR="\[\033[1;91m\]" #red
local chW="\[\033[00m\]" #white
local chG="\[\033[01;32m\]" #green
local chB="\[\033[0;34m\]" #blue
local chP="\[\033[0;35m\]" #purple
local chY="\[\033[0;33m\]" #yellow
PS1=""
if [ $prev_exit == 0 ]; then
if [ "$prev_exit" -eq 0 ]; then
PS1+="$chG$chW"
else
PS1+="$chR$chW"
fi
local jobs="$(jobs | wc -l)"
if [ $jobs != 0 ]; then
local jobs
jobs="$(jobs -p | wc -w)"
[ "$jobs" -ne 0 ] && \
PS1+="${chY}$jobs$chW"
fi
PS1+="${debian_chroot:+($debian_chroot)}"
PS1+=" At ${chG}\A${chW}"
PS1+=" by ${chP}\u${chW}"
if sudo -n true 2>/dev/null; then
sudo -n true 2>/dev/null && \
PS1+="${chR} (sudo)${chW}"
fi
PS1+=" in "
if \git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
local branch="$(\git symbolic-ref -q HEAD)"
local branch
branch="$(\git symbolic-ref -q HEAD)"
PS1+="[${branch#refs/heads/}"
local status="$(git for-each-ref --format='%(upstream:trackshort)' refs/heads | awk '!seen[$1]++ {printf $1}')"
status+="$(git status --porcelain | awk '!seen[$1]++ {printf $1}')"
if [ "$statua"s ]; then
local status
status="$(git for-each-ref --format='%(upstream:trackshort)' "$branch" 2>/dev/null | awk '!seen[$1]++ {printf $1}')"
status+="$(git status --porcelain 2>/dev/null | awk '!seen[$1]++ {printf $1}')"
[ "$status" != "" ] && \
PS1+="|$chY$status$chW"
fi
PS1+="] "
fi
PS1+="${chB}\w${chW}"
if [ ! -z ${PS1_jaaENV+x} ]; then
PS1+="\n$PS1_jaaENV"
else
PS1+="\n:"
fi
history -a
PS1+="\n${PS1_jaaENV:-:}"
}
setPromt
setPrompt
unset color_prompt
unset -f setPromt
unset -f setPrompt
# vim: set filetype=sh tabstop=4 shiftwidth=4 textwidth=250 expandtab :
PROMPT_COMMAND+='; history -a'
§p() { # toggle promt
if [[ "$1" == '--help' ]]; then
\cat <<- "HELP"
§p [--help]
§p <…cmd>
Toggle <…cmd> in $PROMPT_COMMAND
- history v1: `history -a`
- history v2: `history -n; history -w; history -c; history -r`
HELP
return 0
fi
local cmd="$*"
if [[ -z "$cmd" ]]; then
declare -p PROMPT_COMMAND
return 0
fi
if [[ "$PROMPT_COMMAND" == *"; $cmd"* ]]; then
PROMPT_COMMAND="${PROMPT_COMMAND/; $cmd}"
else
PROMPT_COMMAND+="; $cmd"
fi
}
complete -A command -A variable §p
# vim: set filetype=sh tabstop=4 shiftwidth=4 textwidth=250 :

View File

@@ -1,26 +1,34 @@
[[ $(command -v crossSession) ]] || source "$BASH_DOTFILES/.bash_aliases"
vifm() {
echo 'Use bash build-in:'
echo ' - cd (ch dir), ls or tree (list), find'
echo ' - mkdir (make dir), touch (make file), rm (remove)'
echo ' - cp (copy), mv (move+rename)'
echo ' - cat (print file), head (print first lines), tail (print last lines)'
echo ' - info (print file info), file (print file type), mimetype'
echo ' - ln (link), chmod (change perm), chown (change owner)'
echo ' - cd stack: pushd, popd, dirs -v'
echo 'Use helpers:'
echo ' - rsync (copy), fd (verbo-less find)'
echo ' - m (marks, `cd "$m<name>"`), cd-kdialog'
echo ' - trash-* (trash)'
echo 'Use bash/terminal features:'
echo ' - history search (`cd …`)'
echo ' - tab completion'
echo ' - substitution: `!#:`, `!!:`'
echo 'Use GUI:'
echo ' - open . or open <file/dir>'
echo ' - dolphin'
echo 'Use VIM:'
echo ' - ls > <batch>.sh → vim <batch>.sh → :wq → bash <batch>.sh'
\cat <<- "HELP"
Use bash build-in:
- cd (ch dir), ls or tree (list), find
- mkdir (make dir), touch (make file), rm (remove)
- cp (copy), mv (move+rename)
- cat (print file), head (print first lines), tail (print last lines)
- ln (link), chmod (change perm), chown (change owner)
- file/dir info: stat , file , mimetype
- cd stack: pushd, popd, dirs -v
Use helpers:
- rsync (copy), fd (verbo-less find)
- m (marks, `cd "$m<name>"`), cd-kdialog
- trash-* (trash)
Use bash/terminal features:
- history search (`cd`)
- tab completion
- substitution: `!#:`, `!!:`
- globbing: `*`, `?`, `{}``for file in *; do; done`
Use GUI:
- open . or open <file/dir>
- dolphin
Use VIM:
- ls > <batch>.sh → vim <batch>.sh → :wq → bash <batch>.sh
Use vim aliases?:
- y (yank), p (paste), P (paste and clear)
- y [file(s)|dir(s)]; p | xargs -I{} <cp|mv|…> {}; P
Use `$PROMPT_COMMAND`:
- `PROMPT_COMMAND+='; ls -A'; PROMPT_COMMAND="${PROMPT_COMMAND/; ls -A}"`
HELP
}
m(){
if [[ '-d' == "$1" ]]; then
@@ -33,15 +41,17 @@ 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>`.'
echo 'cd $m<name>'
echo ' cd to mark <name>.'
\cat <<- "HELP"
m [--help]
Lists all marks or print this help.
m -d <name>
Deletes mark <name>. Unsets variable and cross session variable.
m <name> [path]
Sets mark <name> to current directory or [path].
The mark is just a bash variable, use `$m<name>`.
cd $m<name>
cd to mark <name>.
HELP
return 0
fi
local n="m$1"

1
.bash/vimv Submodule

Submodule .bash/vimv added at 901e6e9c13