config: improve rdictcc integration & co

This commit is contained in:
xeruf 2022-06-27 22:21:33 +02:00
parent df08c84b07
commit 3ba0316e7d
3 changed files with 18 additions and 9 deletions

View File

@ -649,7 +649,7 @@ Version 2019-11-04 2021-02-16"
(interactive)
(let* ((file (dired-get-filename nil t))
(mime (get-mimetype file)))
(if (or (string-prefix-p "audio" mime) (string-prefix-p "video" mime) (member mime unsupported-mime-types))
(if (or (string-suffix-p ".desktop" file) (string-prefix-p "audio" mime) (string-prefix-p "video" mime) (member mime unsupported-mime-types))
(call-process "xdg-open" nil 0 nil file)
(find-file file))))
@ -813,6 +813,12 @@ Version 2019-11-04 2021-02-16"
)
(setq ispell-personal-dictionary (expand-file-name "personal-dictionary" custom-emacs-data-dir))
(use-package! rdictcc
:bind (("C-c t". 'rdictcc-translate-word-at-point)
("C-c T". 'rdictcc-translate-word))
:config (setq rdictcc-program-args "--directory $XDG_DATA_HOME/dictcc")
)
(after! tramp
(setq tramp-default-method "scpx")
(add-to-list 'tramp-methods

View File

@ -70,7 +70,7 @@ wh() {
tool="$(echo "$res" | head -1 | cut -d' ' -f$(expr 5 '&' "$res" : ".*to \(sudo\|noglob\) " '|' 4) | cut -d'(' -f2)"
wh $(test $tool = $1 && echo "-p") $tool
# use command which for other shells
else test -r "$res" && b "$res" || echo "$res" | bat --style=plain --language=sh
else test -r "$res" && b -- --language=sh "$res" || echo "$res" | bat --style=plain --language=sh
fi
}
compdef wh=which
@ -294,10 +294,11 @@ alias hx='sudo hexedit --maximize --color'
# Paginated hexyl
hex() { hexyl "$@" | "${PAGER:-less}"; }
alias dic="cat $XDG_DATA_HOME/dictcc/dict.txt | sed '/#/d;/&/d;/^$/d' | fzy"
export DICT="$XDG_DATA_HOME/dictcc"
alias dic="cat $DICT/dict.txt | sed '/#/d;/&/d;/^$/d' | fzy"
#fzf --tiebreak=length --bind='alt-bspace:clear-query'
alias dict="rlwrap rdictcc -d $XDG_DATA_HOME/dictcc"
alias dictu="dict -i $XDG_DATA_HOME/dictcc/dict.txt"
alias dict="rlwrap rdictcc --directory $DICT"
alias dict_update="dict -i $DICT/dict.txt"
npm-reinstall() {
rm -rf $TMPDIR/react-*

View File

@ -24,10 +24,12 @@ case "$cmd" in
(swaymsg) test $# -gt 1 && shift && man sway "$@" || man swaymsg;;
(swaymsg-*) man sway "${1#swaymsg-}";;
(*) {
which info >/dev/null 2>&1 &&
case $EDITOR in
(*vim) info "$@" -w | grep -q . && $EDITOR -R -M -c "Info $*" +only;;
(*) { which info >/dev/null 2>&1 && info -f "$@" 2>/dev/null; } || man "$@";;
esac
(*) info -f "$@" 2>/dev/null;;
esac ||
man "$@"
} ||
if which "$cmd" >/dev/null
then { "$@" --help || { test $? == 1 && "$@" -help; } || { test $? == 1 && "$@" -h; }; } 2>&1 | $paginate