Compare commits
4 commits
747b50f2e3
...
da7d70ebd0
Author | SHA1 | Date | |
---|---|---|---|
|
da7d70ebd0 | ||
|
01585d4e14 | ||
|
bac21d5b60 | ||
|
905b43b5d4 |
20 changed files with 111 additions and 67 deletions
|
@ -715,37 +715,37 @@ Version 2019-11-04 2021-02-16"
|
|||
;;; Colors
|
||||
|
||||
; https://www.emacswiki.org/emacs/HexColour
|
||||
;;(require 'cl)
|
||||
;;(defun hexcolor-luminance (color)
|
||||
;; "Calculate the luminance of a color string (e.g. \"#ffaa00\", \"blue\").
|
||||
;;This is 0.3 red + 0.59 green + 0.11 blue and always between 0 and 255."
|
||||
;; (let* ((values (x-color-values color))
|
||||
;; (r (car values))
|
||||
;; (g (cadr values))
|
||||
;; (b (caddr values)))
|
||||
;; (floor (+ (* .3 r) (* .59 g) (* .11 b)) 256)))
|
||||
;;(defun hexcolor-add-to-font-lock ()
|
||||
;; (interactive)
|
||||
;; (font-lock-add-keywords nil
|
||||
;; `((,(concat "#[0-9a-fA-F]\\{3\\}[0-9a-fA-F]\\{3\\}?\\|"
|
||||
;; (regexp-opt (x-defined-colors) 'words))
|
||||
;; (0 (let ((color (match-string-no-properties 0)))
|
||||
;; (put-text-property
|
||||
;; (match-beginning 0) (match-end 0)
|
||||
;; 'face `((:foreground ,(if (> 128.0 (hexcolor-luminance color))
|
||||
;; "white" "black"))
|
||||
;; (:background ,color)))))))))
|
||||
(require 'cl)
|
||||
(defun hexcolor-luminance (color)
|
||||
"Calculate the luminance of a color string (e.g. \"#ffaa00\", \"blue\").
|
||||
This is 0.3 red + 0.59 green + 0.11 blue and always between 0 and 255."
|
||||
(let* ((values (x-color-values color))
|
||||
(r (car values))
|
||||
(g (cadr values))
|
||||
(b (caddr values)))
|
||||
(floor (+ (* .3 r) (* .59 g) (* .11 b)) 256)))
|
||||
(defun hexcolor-add-to-font-lock ()
|
||||
(interactive)
|
||||
(font-lock-add-keywords nil
|
||||
`((,(concat "#[0-9a-fA-F]\\{3\\}[0-9a-fA-F]\\{3\\}?\\|"
|
||||
(regexp-opt (x-defined-colors) 'words))
|
||||
(0 (let ((color (match-string-no-properties 0)))
|
||||
(put-text-property
|
||||
(match-beginning 0) (match-end 0)
|
||||
'face `((:foreground ,(if (> 128.0 (hexcolor-luminance color))
|
||||
"white" "black"))
|
||||
(:background ,color)))))))))
|
||||
|
||||
;;(defvar hexcolor-keywords
|
||||
;; '(("#[abcdef[:digit:]]\\{6\\}"
|
||||
;; (0 (put-text-property (match-beginning 0)
|
||||
;; (match-end 0)
|
||||
;; 'face (list :background
|
||||
;; (match-string-no-properties 0)))))))
|
||||
;;(defun hexcolor-add-to-font-lock ()
|
||||
;; (font-lock-add-keywords nil hexcolor-keywords))
|
||||
(defvar hexcolor-keywords
|
||||
'(("#[abcdef[:digit:]]\\{6\\}"
|
||||
(0 (put-text-property (match-beginning 0)
|
||||
(match-end 0)
|
||||
'face (list :background
|
||||
(match-string-no-properties 0)))))))
|
||||
(defun hexcolor-add-to-font-lock ()
|
||||
(font-lock-add-keywords nil hexcolor-keywords))
|
||||
|
||||
;;(add-hook 'web-mode-hook 'hexcolor-add-to-font-lock)
|
||||
(add-hook 'web-mode-hook 'hexcolor-add-to-font-lock)
|
||||
|
||||
(after! eshell
|
||||
; https://stackoverflow.com/questions/63469203/eshell-and-color-output
|
||||
|
@ -924,22 +924,22 @@ Version 2019-11-04 2021-02-16"
|
|||
|
||||
;;; File Editing Modes
|
||||
|
||||
(setq initial-major-mode 'org-mode)
|
||||
(add-to-list 'auto-mode-alist '("/journal/" . org-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.jrnl\\'" . org-mode))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.el##" . emacs-lisp-mode))
|
||||
(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_SHELLS") . sh-mode))
|
||||
;(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_ZSH") . sh-mode))
|
||||
(add-to-list 'auto-mode-alist `("\\.local/bin" . sh-mode))
|
||||
|
||||
;(add-to-list 'auto-mode-alist '("\\.twee\\'" . twee-chapbook-mode))
|
||||
;(add-hook 'twee-chapbook-mode-hook 'twee-mode)
|
||||
;(setq initial-major-mode 'org-mode)
|
||||
;(add-to-list 'auto-mode-alist '("/journal/" . org-mode))
|
||||
;(add-to-list 'auto-mode-alist '("\\.jrnl\\'" . org-mode))
|
||||
;
|
||||
;;(add-to-list 'auto-mode-alist `("\\.scss.erb\\'" . scss-mode))
|
||||
;(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
|
||||
|
||||
(add-hook 'pdf-view-mode-hook 'auto-revert-mode)
|
||||
;(add-to-list 'auto-mode-alist '("\\.el##" . emacs-lisp-mode))
|
||||
;(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_SHELLS") . sh-mode))
|
||||
;;(add-to-list 'auto-mode-alist `(,(getenv "CONFIG_ZSH") . sh-mode))
|
||||
;(add-to-list 'auto-mode-alist `("\\.local/bin" . sh-mode))
|
||||
;
|
||||
;;(add-to-list 'auto-mode-alist '("\\.twee\\'" . twee-chapbook-mode))
|
||||
;;(add-hook 'twee-chapbook-mode-hook 'twee-mode)
|
||||
;;
|
||||
;;;(add-to-list 'auto-mode-alist `("\\.scss.erb\\'" . scss-mode))
|
||||
;;(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
|
||||
;
|
||||
;(add-hook 'pdf-view-mode-hook 'auto-revert-mode)
|
||||
|
||||
(use-package! web-mode
|
||||
:mode "\\.html\\'"
|
||||
|
@ -957,6 +957,26 @@ Version 2019-11-04 2021-02-16"
|
|||
(after! lsp-mode
|
||||
(setq lsp-disabled-clients '(typeprof-ls)))
|
||||
|
||||
(use-package eglot
|
||||
:config
|
||||
(add-hook 'haskell-mode-hook #'eglot-ensure)
|
||||
;; Optionally add keybindings to some common functions:
|
||||
:bind ((:map eglot-mode-map
|
||||
("C-c C-e r" . eglot-rename)
|
||||
("C-c C-e l" . flymake-show-buffer-diagnostics)
|
||||
("C-c C-e p" . flymake-show-project-diagnostics)
|
||||
("C-c C-e C" . eglot-show-workspace-configuration)
|
||||
("C-c C-e R" . eglot-reconnect)
|
||||
("C-c C-e S" . eglot-shutdown)
|
||||
("C-c C-e A" . eglot-shutdown-all)
|
||||
("C-c C-e a" . eglot-code-actions)
|
||||
("C-c C-e f" . eglot-format))))
|
||||
|
||||
;; Optional: Show/pick completions on tab, sane max height:
|
||||
(setq tab-always-indent 'complete
|
||||
completions-max-height 20
|
||||
completion-auto-select 'second-tab)
|
||||
|
||||
(use-package! adoc-mode ; Asciidoc, a md alternative
|
||||
:mode "\\.adoc\\'"
|
||||
)
|
||||
|
@ -1042,6 +1062,12 @@ Version 2019-11-04 2021-02-16"
|
|||
|
||||
(setq eww-search-prefix "https://safe.duckduckgo.com/html/?q=")
|
||||
|
||||
;; Customize word-wrap to break at commas
|
||||
;; https://emacs.stackexchange.com/questions/19027/how-to-wrap-line-at-some-characters-other-than-space/71342#71342
|
||||
(setq-default word-wrap t)
|
||||
(setq-default word-wrap-by-category t)
|
||||
(modify-category-entry ?, ?|)
|
||||
|
||||
(use-package! activity-watch-mode
|
||||
:config
|
||||
(activity-watch--send-heartbeat (activity-watch--create-heartbeat (current-time))
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
(eval +overlay) ; run code, run (also, repls)
|
||||
;;gist ; interacting with github gists
|
||||
lookup ; navigate your code and its documentation
|
||||
lsp
|
||||
(lsp +eglot)
|
||||
magit ; a git porcelain for Emacs
|
||||
make ; run make tasks from Emacs
|
||||
pass ; password manager for nerds
|
||||
|
|
|
@ -193,3 +193,5 @@
|
|||
path = "~/.config/yadm/gitconfig"
|
||||
[safe]
|
||||
directory = /opt/flutter
|
||||
[credential]
|
||||
helper = cache --timeout 1000
|
||||
|
|
|
@ -49,7 +49,7 @@ cd() {
|
|||
# TODO test whether still needed with exa
|
||||
command ls --sort=none --quote-name |
|
||||
head -12 |
|
||||
COLUMNS=$(tput cols) xargs $(which exa >/dev/null 2>&1 && echo "exa --list-dirs --icons --reverse" || echo 'ls --format=vertical --literal --classify --directory') --sort=time --color=always |
|
||||
COLUMNS=$(tput cols) xargs $(which exa >/dev/null 2>&1 && echo "exa --list-dirs --icons --reverse" || echo 'ls --format=vertical --literal --classify --directory') --sort=time --color=always -- |
|
||||
head -3
|
||||
code=$? && test $code -eq 141 || return $code
|
||||
fi
|
||||
|
|
|
@ -8,7 +8,7 @@ pre_sudo = true
|
|||
#assume_yes = ["emacs"]
|
||||
|
||||
# Disable specific steps - same options as the command line flag
|
||||
disable = ["nix", "containers", "config_update", "node", "firmware"]
|
||||
disable = ["containers", "config_update", "node", "firmware"]
|
||||
|
||||
# Ignore failures for these steps
|
||||
#ignore_failures = ["powershell"]
|
||||
|
|
|
@ -190,6 +190,7 @@ source_existing() {
|
|||
}
|
||||
|
||||
source_existing $CONFIG_ZSH/.p10k.zsh # To customize prompt, run `p10k configure` or edit .p10k.zsh.
|
||||
source_existing $CONFIG_ZSH/sgpt.zsh
|
||||
source_existing /usr/share/fzf/key-bindings.zsh /usr/share/fzf/completion.zsh
|
||||
|
||||
source_existing "$NVM_DIR/nvm.sh"
|
||||
|
|
7
.local/bin/scripts/boost
Executable file
7
.local/bin/scripts/boost
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh -e
|
||||
# Install syncthingtray and other things using boost, preventing conflicts
|
||||
# Pass -git as argument to install the git version with dependencies
|
||||
pacman -Qq | grep -E '^(syncthingtray)' | xargs --no-run-if-empty yay -R --noconfirm
|
||||
suffix=$1
|
||||
yay --noconfirm -Syy --nobatchinstall --answerdiff none boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix
|
||||
yay --noconfirm -S syncthingtray$suffix guitarix
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
# Set exec flag on all files that should be executable
|
||||
find -maxdepth 4 -name "*.sh" -o -path '*/githooks/*' "$@" -exec chmod -v +x {} +
|
||||
find -maxdepth 4 \( -name "*.sh" -o -path '*/githooks/*' \) "$@" -exec chmod -v +x {} +
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
set -o pipefail
|
||||
|
||||
# jq if file is valid json, otherwise show parseable lines with bat
|
||||
{ jq --unbuffered '' "$@" ||
|
||||
{ jq --unbuffered '.' "$@" ||
|
||||
# add echo in case file is missing newline at the end
|
||||
{ for arg; do echo "FILE: $arg ─────────────────────────────────────────────────────────────────────────────────────────"; cat "$arg"; done; echo; } |
|
||||
while read -r line
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
typeset -A _clean_map
|
||||
_clean_map=([h]=$XDG_CACHE_HOME [t]=/var/tmp [l]=/var/log [v]=/var/cache)
|
||||
# TODO .mix - outdated version in socha
|
||||
_clean_home=(.ant .autopsy .bundle .cache .cargo .cpanm .docker .electron .electron-gyp .gradle .gradle-kotlin-dsl .hex .java .kscript .konan .m2 .nix-defexpr .node-gyp .nv .openjfx .parallel .stack .surf .texlive
|
||||
.yarn .node_modules .npm .pnpm-store
|
||||
luametatex-cache luatex-cache
|
||||
_clean_home=(.ant .autopsy .bundle .cache .cargo .cpanm .docker .stack .hex .nix-defexpr .parallel .surf
|
||||
.yarn .node_modules .npm .pnpm-store .node-gyp .nv .electron .electron-gyp
|
||||
.gradle .gradle-kotlin-dsl .java .kscript .konan .m2 .openjfx
|
||||
.log luametatex-cache luatex-cache .texlive
|
||||
.lesshst .python_history .rubberband.wisdom.d .yarnrc)
|
||||
|
||||
[[ $1 =~ "." ]] && local=pwd
|
||||
|
|
6
.local/bin/scripts/emacs-line
Executable file
6
.local/bin/scripts/emacs-line
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
# https://ihp.digitallyinduced.com/Guide/editors.html#using-ihp-with-emacs
|
||||
path="${1%%:*}"
|
||||
col="${1##*:}"
|
||||
line="${1%:*}"; line="${line##*:}"
|
||||
emacsclient -n +"${line}:${col}" "${path}"
|
|
@ -22,7 +22,7 @@ case $1 in
|
|||
(*|ftt) host=git@code.ftt.gmbh; user=janek;;
|
||||
esac
|
||||
user=${3:-${user:-$(git config user.name)}}
|
||||
repo=${2:-$(basename $PWD)}
|
||||
repo=${2:-$(basename $(git root))}
|
||||
if test "$http"
|
||||
then echo "$http://${host#git*@}/$user/$repo.git"
|
||||
else echo "$host:$user/$repo.git"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#!/bin/sh -e
|
||||
# open info-page, man-page or command help
|
||||
# open info-page, man-page or command with help flag
|
||||
# depends: unbuffer
|
||||
# optdepends: highlight(dotfiles)
|
||||
# TODO show tldr page
|
||||
# TODO extract help in standard format from scripts
|
||||
paginate="${PAGER:-less} +Gg"
|
||||
case "$1" in
|
||||
(-d) browse=1; shift;;
|
||||
|
@ -25,13 +26,11 @@ showinfo() {
|
|||
|
||||
cmd="$1"
|
||||
case "$cmd" in
|
||||
# TODO extract help in standard format from scripts
|
||||
(fwupdmgr|hunt|rdoc|gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr|docker|jrnl|difft|wiked-diff|qpdf|ninja) unbuffer "$@" --help | sed 's|^[^ ].*:|[1m\0[22m|' | $paginate;;
|
||||
(caddy|stretchly|go|flutter)
|
||||
shift
|
||||
"$cmd" help "$@" | $paginate;;
|
||||
# Non-standard help flags
|
||||
(doom) "$@" --help;; # Doom paginates itself
|
||||
(doom|sgpt) "$@" --help;; # Paginates itself
|
||||
(mpw) "$@" -h 2>&1 | $paginate;;
|
||||
(spectre|plantuml|java) unbuffer "$@" -help | $paginate;;
|
||||
(rails) { "$@" -H && "$@" --help; } | $paginate;;
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
# Lowercase given files
|
||||
#perl-rename 'y/A-Z /a-z-/' "$@"
|
||||
#$(which perl-rename || echo rename) -iv 'y/A-Z /a-z-/' "$@"
|
||||
find "$@" -exec sh -c 'mv -iv "{}" "$(echo "{}" | tr "A-Z " "a-z-" | sed "s|---|_|;s|\.-|.|")" 2>/dev/null' \;
|
||||
sedrename "s| |-|;s|---|_|;s|\.-|.|;s|.*|\L\0|g" "$@"
|
||||
# find "$@" -exec sh -c 'mv -iv "{}" "$(echo "{}" | tr "A-Z " "a-z-" | sed "s|---|_|;s|\.-|.|")" 2>/dev/null' \;
|
||||
|
|
2
.local/bin/scripts/reload-network
Executable file
2
.local/bin/scripts/reload-network
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh -x
|
||||
sudo systemctl restart systemd-resolved systemd-networkd NetworkManager
|
5
.local/bin/scripts/sedrename
Executable file
5
.local/bin/scripts/sedrename
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh -x
|
||||
# Rename files according to a given extended regex sed expression
|
||||
sedexpr="$1"
|
||||
shift
|
||||
find "$@" -exec sh -c 'mv -iv "{}" "$(echo "{}" | sed -E "'$sedexpr'")" 2>/dev/null' \;
|
|
@ -32,7 +32,7 @@ echo "Using offset ${h}x and ${v}y"
|
|||
export TEXMF=""
|
||||
pdfjam $quiet "$signature" --outfile "$sig" --papersize "{595pt, 842pt}" --noautoscale true \
|
||||
--offset "${h}pt ${v}pt" --scale "${4:-1}"
|
||||
rm "$result"
|
||||
rm -f "$result"
|
||||
pdfjam $quiet "$1" ${page:-last} "$sig" --outfile "$tmp_signed" --delta "0 -842pt" --nup "1x2" --fitpaper true
|
||||
# TODO consider pdftk stamp
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh -e
|
||||
# Install syncthingtray, preventing conflicts
|
||||
# Pass -git as argument to install the git version with dependencies
|
||||
pacman -Qq | grep '^syncthingtray' | xargs -r yay --noconfirm -R
|
||||
suffix=$1
|
||||
yay --noconfirm -Syy --nobatchinstall boost c++utilities$suffix qtforkawesome$suffix qtutilities$suffix
|
||||
yay --noconfirm -S syncthingtray$suffix
|
|
@ -2,6 +2,6 @@
|
|||
# xdg-open all given files
|
||||
# TODO handle .desktop-files with gtk-launch/dex/kioclient exec, add selector from xdg-mime-file
|
||||
while test $# -gt 0; do
|
||||
xdg-open "$1"
|
||||
xdg-open "$(case "$1" in (-*) echo './';; esac)$1"
|
||||
shift
|
||||
done
|
||||
|
|
1
.zshenv
1
.zshenv
|
@ -94,6 +94,7 @@ export EDITOR="$(
|
|||
else echo $ALTERNATE_EDITOR
|
||||
fi
|
||||
)"
|
||||
export IHP_EDITOR="$BIN/scripts/emacs-line"
|
||||
|
||||
export LS_OPTIONS='--color=auto --human-readable --si --group-directories-first --file-type --dereference-command-line'
|
||||
export LESS="--raw-control-chars --ignore-case --LONG-PROMPT --jump-target=5 $(test $(less --version | head -1 | cut -f2 -d' ') -ge 590 && echo --incsearch)"
|
||||
|
|
Loading…
Add table
Reference in a new issue