config: little shortcut adjustments

This commit is contained in:
xerus2000 2021-04-19 10:39:08 +02:00
parent 07e7109fa9
commit c647431f4e
4 changed files with 35 additions and 14 deletions

View File

@ -148,6 +148,7 @@
(let ((current-prefix-arg '(4))) (call-interactively 'org-export-dispatch))
)
;; TODO name file according to subtree headline
(defun org-export-dispatch-custom-date ()
(interactive)
(let ((org-time-stamp-custom-formats
@ -176,6 +177,7 @@
"t" 'org-todo-or-insert
"e" 'org-export-dispatch-custom-date
"E" 'org-export-repeat
"n" 'org-add-note
"d=" 'org-timestamp-up-week
"rt" 'org-change-todo-in-region
"ra" 'org-change-tag-in-region

View File

@ -1,11 +1,14 @@
.Trash-1000/
.*Trash-1000/
lost+found/
.sync/
.stversions/
.stfolder/
.gradle/
cache/
cmake_build/
dist_newstyle/
node_modules/
build/
generated/
out/

View File

@ -26,10 +26,16 @@ which lsb_release >/dev/null && export DIST=$(lsb_release --id | cut -d' ' -f2)
unalias rd 2>/dev/null
rd() {
test -d "$1" && find "$1" -type d -empty -printf "Removing %p\n" -delete || rm "$@"
while test $# -gt 0
do
test -d "$1" && find "$1" -maxdepth 1 -type d -empty -printf "Removing %p\n" -delete || rm -iv "$@"
shift
done
}
rr() { mv "$@" /tmp }
calc='rlwrap -a bc -l'
alias j='jrnl'
jn() { jrnl -to today "$@" | bat --style=plain --pager="less +G" }
alias jnc='jn -contains'
@ -51,6 +57,12 @@ alias edpart='sudoedit /etc/fstab && sudo findmnt --verify'
highlight() { echo "$1" }
alias dedup='awk '"'"'!a[$0]++'"'"
listconf() {
{ cat "$conf_cache"; test -f "$conf_extra" && cat "$conf_extra";
fd --hidden --type file --size -1m --max-depth 1 . ~;
fd --hidden --type file --size -1m --max-depth 3 . --full-path "$XDG_CONFIG_HOME" /etc } | dedup
}
edconf() {
conf_cache_dir="$XDG_CACHE_HOME/edconf"
conf_cache="$conf_cache_dir/files"
@ -58,11 +70,8 @@ edconf() {
conf_extra="$XDG_CONFIG_HOME/edconf-extra"
mkdir -p "$conf_cache_dir"
touch "$conf_cache"
sel=$(listconf | fzf -1 -0 --tiebreak=end,length --preview 'bat --color=always --style=numbers --line-range :200 {}' --query="$1" --history "$conf_cache_dir/searches")
# | 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 --hidden --type file --size -1m --max-depth 1 . ~;
fd --hidden --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 -30 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache") & edit "$sel")
}
@ -88,7 +97,7 @@ edbin() {
alias l="ls -l --almost-all --human-readable --group-directories-first --file-type"
cd() {
test ! -d "$1" && test $# -eq 1 && dir=$(find "$DATA" -maxdepth 2 -type d -name "$1*" | head -1) &&
test ! -d "$1" && test $# -eq 1 && dir=$(f --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) &&
test -n "$dir" && cd "$dir" && return
builtin cd $1 &&
command ls --file-type --group-directories-first --color=always --format=vertical -w $COLUMNS | head -3
@ -269,7 +278,7 @@ cl() {
# FILES
alias f="noglob $(test -x "$(which fd)" && echo fd || echo "fdfind") --hidden --no-ignore-vcs --one-file-system"
alias f="noglob $(which fd >/dev/null && echo fd || echo fdfind) --hidden --no-ignore-vcs --one-file-system"
#alias f='find -not -path "*.sync*" -and -not \( -name daten -prune \)'
#alias f1='find -mindepth 1 -maxdepth 1'

View File

@ -1,6 +1,13 @@
#!/bin/sh
if test "$#" -gt 0
then
dif "$(st-unarchive "$1")" "$@"
test "$?" -eq "2" && exit 1
echo "y to restore"
read answer
test "$answer" = "y" && st-restore "$1" || exit 0
echo "y|r to restore, n|d to delete"
read reply
case "$reply" in
(y|r) st-restore "$1";;
(n|d) rm -v "$1";;
esac
else find -name '*sync-conflict*' -exec st-diff '{}' \;
fi