diff options
author | luxagraf <sng@luxagraf.net> | 2023-06-05 08:40:16 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-06-05 08:40:16 -0500 |
commit | 5869f1e4d220dd020113deade66ea01790d2023e (patch) | |
tree | c364ba0de819b6b1c68ea599670d19ecb39342ae | |
parent | 87fbfbf4b1feaf352bc145a0530b0dfeab34b46b (diff) |
added some git-annex helpers and an offline spellchecker
-rw-r--r-- | .aliases | 12 | ||||
-rw-r--r-- | .bashrc | 49 |
2 files changed, 54 insertions, 7 deletions
@@ -14,10 +14,10 @@ alias cp='cp -v' alias mv='mv -v' # i like ls alias ls='ls --color -h --group-directories-first' -alias ll='ls -l --group-directories-first ' +alias ll='ls -lh --group-directories-first ' alias lt='ls -lt ' alias lsh='ls -lh' -alias la='ls -lah' +alias la='ls -lah --group-directories-first' alias count='ls -l | wc -l' alias sizes=' du --summarize --human-readable *' @@ -41,19 +41,17 @@ alias mopen='tmux attach-session -t' alias mnew='tmux new -s' #Git aliases +alias g="git " alias gs="git status" -alias ga="git add" alias gc="git commit -S " alias gl="git log" +alias ga="git annex" +alias gaa="git annex add" #apps alias music='ncmpcpp' alias write='countdown $((60*20))' -# rsync/s3cmd aliases -alias syncw="rsync -vv --recursive --delete --checksum -P --ignore-times --exclude-from=/home/lxf/.rsync-exclude-weekly $1 $2" -alias s3pics="s3cmd sync --rr --exclude '*.*' pictures/ s3://lxfpictures" - # rename files etc alias reraw="~/./bin/rename_raw_files.sh" alias regoproraw="~/./bin/rename_gopro_raw.sh" @@ -625,6 +625,55 @@ yt () { yt-dlp -S height:1080 https://www.youtube.com/watch?v="$1" } +spell() { + local candidates oldifs word array_pos + oldifs="$IFS" + IFS=':' + + # Parse the apsell format and return a list of ":" separated words + read -a candidates <<< "$(printf "%s\n" "$1" \ + | aspell -a \ + | awk -F':' '/^&/ { + split($2, a, ",") + result="" + for (x in a) { + gsub(/^[ \t]/, "", a[x]) + result = a[x] ":" result + } + gsub(/:$/, "", result) + print result + }')" + + # Reverse number and print the parsed bash array because the list comes + # out of gawk backwards + for item in "${candidates[@]}"; do + printf '%s\n' "$item" + done \ + | tac \ + | nl \ + | less -FirSX + + printf "[ $(tput setaf 2)?$(tput sgr0) ]\t%s" \ + 'Enter the choice (empty to cancel, 0 for input): ' + read index + + [[ -z "$index" ]] && return + [[ "$index" == 0 ]] && word="$1" + + [[ -z "$word" ]] && { + array_pos=$(( ${#candidates[@]} - index )) + word="${candidates[$array_pos]}" + } + + [[ -n "$word" ]] && { + printf "$word" | xsel -p + printf "Copied '%s' to clipboard!\n" "$word" + } || printf "[ $(tput setaf 1):($(tput sgr0) ] %s\n" 'No match found' + + + IFS="$oldifs" +} + RIPGREP_CONFIG_PATH=~/.ripgreprc GPG_TTY=$(tty) export GPG_TTY |