From 13c87f365d32d2e7efbc4cba0911fd056d0d4801 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 12 Dec 2023 12:15:07 +0100 Subject: [PATCH 1/7] git: Add difftastic syntax diffing If difft command is installed we can git diff on syntactic changes only using `gdy` (or `gdys` for staged) which will spit out a (treesitter) syntax-aware side by side comparison. Really nice for refactoring diffs. --- git/.config/git/config | 7 +++++++ git/.config/sh/alias.d/git.sh | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/git/.config/git/config b/git/.config/git/config index 8f56266..10b6bd8 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -6,6 +6,8 @@ defaultBranch = main [core] pager = delta +[pager] + difftool = true [interactive] diffFilter = delta --color-only [merge] @@ -23,6 +25,7 @@ pushall = "!git remote | xargs -I R git push R" # push to all connected remotes fetchall = "!git remote | xargs -I R git fetch R" # fetch from all connected remotes diffword = "!git diff --word-diff=color --word-diff-regex='[0-9A-Za-z_]+'" # word-wise diff, good for prose + diffsyn = "!git difftool --tool difftastic" # add syntax-driven diff using treesitter [commit] gpgsign = true # sign commits as me verbose = true # Always show diff when preparing commit message @@ -32,6 +35,10 @@ rebase = true # always rebase on pulling, obviates merge commits [diff] colorMoved = zebra # also color stuff that has simply been moved, in a classy zebra-color +[difftool] + prompt = false +[difftool "difftastic"] + cmd = difft "$LOCAL" "$REMOTE" [color.diff] meta = "9" frag = "magenta bold" diff --git a/git/.config/sh/alias.d/git.sh b/git/.config/sh/alias.d/git.sh index ad465f6..5e84cae 100644 --- a/git/.config/sh/alias.d/git.sh +++ b/git/.config/sh/alias.d/git.sh @@ -38,8 +38,13 @@ alias gdds='git diffword --staged' alias gi='git ignore' +# syntax-based diff +if exist difft; then + alias gdy='git diffsyn' + alias gdys='git diffsyn --staged' +fi # show last committed content -alias gll='git last' +alias gdl='git last' # show quick log overview alias glg='git log --oneline --decorate --graph' alias glgd="git log --graph --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'" From 62ec2799c8afa1d8be7988f7b139f43b8c9831d8 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 12 Dec 2023 12:17:19 +0100 Subject: [PATCH 2/7] git: Add side-by-side diff Added a simple alteration of diff viewing to also be feasible side-by-side in addition to the default (delta) diff viewing mode. Use aliases `gdd` (and `gdds` for staged) to enable. --- git/.config/git/config | 1 + git/.config/sh/alias.d/git.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/git/.config/git/config b/git/.config/git/config index 10b6bd8..6e430d9 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -26,6 +26,7 @@ fetchall = "!git remote | xargs -I R git fetch R" # fetch from all connected remotes diffword = "!git diff --word-diff=color --word-diff-regex='[0-9A-Za-z_]+'" # word-wise diff, good for prose diffsyn = "!git difftool --tool difftastic" # add syntax-driven diff using treesitter + diffside = "!DELTA_FEATURES='+side-by-side' git diff" # add side-by-side diffing [commit] gpgsign = true # sign commits as me verbose = true # Always show diff when preparing commit message diff --git a/git/.config/sh/alias.d/git.sh b/git/.config/sh/alias.d/git.sh index 5e84cae..44dc57b 100644 --- a/git/.config/sh/alias.d/git.sh +++ b/git/.config/sh/alias.d/git.sh @@ -38,6 +38,12 @@ alias gdds='git diffword --staged' alias gi='git ignore' +# word-based diff (with custom word regex) +alias gdw='git diffword' +alias gdws='git diffword --staged' +# side-by-side diff +alias gdd='git diffside' +alias gdds='git diffside --staged' # syntax-based diff if exist difft; then alias gdy='git diffsyn' From b6687145bd96a5fe411f05b6802d69ba5c7799db Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 12 Dec 2023 12:19:41 +0100 Subject: [PATCH 3/7] git: Make git diff termcolor aware Added simple light/dark distinction for git diffs using delta. Will use the TERM_DARK env variable which is set in the base module functionality on opening a new term. This means unfortunately git diffs will have the wrong color when terms recently changed between light-dark but on opening a new one the error is gone and it automatically adapts again to the terminal background color. --- git/.config/git/config | 11 ++++++----- git/.config/sh/alias.d/git.sh | 14 ++++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/git/.config/git/config b/git/.config/git/config index 6e430d9..fa694ae 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -5,17 +5,17 @@ [init] defaultBranch = main [core] - pager = delta + pager = git delta [pager] difftool = true [interactive] - diffFilter = delta --color-only + diffFilter = git delta --color-only [merge] conflictstyle = diff3 [delta] - navigate = true - line-numbers = true - syntax-theme = base16 + navigate = true + line-numbers = true + syntax-theme = base16 [sendemail] smtpserver = "/usr/bin/msmtp" annotate = yes @@ -27,6 +27,7 @@ diffword = "!git diff --word-diff=color --word-diff-regex='[0-9A-Za-z_]+'" # word-wise diff, good for prose diffsyn = "!git difftool --tool difftastic" # add syntax-driven diff using treesitter diffside = "!DELTA_FEATURES='+side-by-side' git diff" # add side-by-side diffing + delta = "![ $TERM_DARK=false ] && delta --light || delta" # Take care that we always display right color scheme [commit] gpgsign = true # sign commits as me verbose = true # Always show diff when preparing commit message diff --git a/git/.config/sh/alias.d/git.sh b/git/.config/sh/alias.d/git.sh index 44dc57b..734f837 100644 --- a/git/.config/sh/alias.d/git.sh +++ b/git/.config/sh/alias.d/git.sh @@ -31,13 +31,11 @@ else fi alias gco='git checkout' -alias gd='git diff' -alias gdd='git diffword' -alias gds='git diff --staged' -alias gdds='git diffword --staged' - alias gi='git ignore' +# normal diff +alias gd='git diff' +alias gds='git diff --staged' # word-based diff (with custom word regex) alias gdw='git diffword' alias gdws='git diffword --staged' @@ -49,12 +47,16 @@ if exist difft; then alias gdy='git diffsyn' alias gdys='git diffsyn --staged' fi +alias gdd='git diffside' +alias gdds='git diffside --staged' # show last committed content alias gdl='git last' + # show quick log overview alias glg='git log --oneline --decorate --graph' -alias glgd="git log --graph --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'" alias glga='git log --oneline --decorate --graph --remotes --all' +# show quick log overview - with dates +alias glgd="git log --graph --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'" alias glgad="git log --graph --remotes --all --pretty=format:'%C(auto)%h%Creset %C(cyan)%ar%Creset%C(auto)%d%Creset %s'" # show detailed log overview alias glog='git log --stat' From b0bcb9dd604d370d8ac9afe831a2dc158edb0af5 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 12 Dec 2023 12:21:01 +0100 Subject: [PATCH 4/7] qutebrowser: Remove wikipedia redirects These are the redirects that made the most trouble for me, and honestly I do not think wikipedia really belongs in the same category of 'necessary to redirect' surveillance pages like reddit,instagram or twitter. --- qutebrowser/config/redirects.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/qutebrowser/config/redirects.py b/qutebrowser/config/redirects.py index 1eb8ef0..c4f6868 100644 --- a/qutebrowser/config/redirects.py +++ b/qutebrowser/config/redirects.py @@ -183,21 +183,6 @@ redirects = { "whoogle.dcs0.hu", ], }, - "wiki-en": { - "source": ["en.wikipedia.org"], - "target": [ - "wiki.slipfox.xyz", - "wikiless.funami.tech", - "wikiless.org", - "wikiless.tiekoetter.com", - ], - }, - "wiki-de": { - "source": ["de.wikipedia.org"], - "target": [ - "wiki.adminforge.de", - ], - }, } From 8c9a233a8b29cf2efbce31a27f1107e4c1e0689a Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 12 Dec 2023 12:21:59 +0100 Subject: [PATCH 5/7] vifm: Improve file preview for tabular data Slightly improved display of csv files and added tsv to same preview. Added nice previews for json and excel files. --- terminal/.config/vifm/vifmrc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/terminal/.config/vifm/vifmrc b/terminal/.config/vifm/vifmrc index 0375b97..55362ad 100644 --- a/terminal/.config/vifm/vifmrc +++ b/terminal/.config/vifm/vifmrc @@ -215,7 +215,7 @@ set viewcolumns=-{name}..,6{}. " Filter-out build and temporary files " -" filter! /^.*\.(lo|o|d|class|py[co])$|.*~$/ +filter! /^.*\.(lo|o|d|class|py[co])$|.*~$/ " }}} " Mappings {{{ @@ -471,13 +471,17 @@ filetype *.sqlite,*.db \ sqlite3 %f, " tabular data -filextype *.csv +filextype *.csv, *.xlsx, *.tsv, *.json \ {Open with visidata} \ vd %f, -fileviewer *.csv - \ tidy-viewer +fileviewer *.tsv,*.csv + \ tidy-viewer --color-always --title %c " \ xsv sample 100 %c | xsv table -c8 -p1 -w1, " \ {cat %c | sed -e 's/,,/, ,/g' | column -s, -t | less -#5 -N -S; } +fileviewer *.xlsx + \ xlsx2csv %c | tidy-viewer --color-always --title %c +fileviewer *.json + \ jq '.' --color-output %c " Mindmap filextype *.vym From 029b38f3682329e54c9e33edf5547026305ea6d3 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 12 Dec 2023 12:22:16 +0100 Subject: [PATCH 6/7] jrnl: Update jrnl version --- writing/.config/jrnl/jrnl.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/writing/.config/jrnl/jrnl.yaml b/writing/.config/jrnl/jrnl.yaml index 28e71d2..35004a3 100644 --- a/writing/.config/jrnl/jrnl.yaml +++ b/writing/.config/jrnl/jrnl.yaml @@ -16,4 +16,4 @@ linewrap: 79 tagsymbols: '#@' template: false timeformat: '%F %r' -version: v4.0.1 +version: v4.1 From 4dadcd5f9f6e73036c65fadaccb1ba99be194fec Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 12 Dec 2023 12:23:21 +0100 Subject: [PATCH 7/7] scripts: Refactor py script Made detection and setup a little more stable, will still have its kinks since it is rather hastily put together but should work for detecting kernels, invoking the right python repl and letting you set it manually with `py -c`. --- scripts/.local/bin/py | 79 ++++++++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/scripts/.local/bin/py b/scripts/.local/bin/py index 5512fdb..2c68f67 100755 --- a/scripts/.local/bin/py +++ b/scripts/.local/bin/py @@ -5,39 +5,64 @@ cur_dir=$(pwd) search_dir="${molten_session_dir}${cur_dir}" if [ "$1" == "-c" ]; then - cmd=$(echo -e "euporie-console\njupyter-console\nptipython\nipython\npython" | fzf) -fi - -# set normal command first -if [ -z "$cmd" ]; then - if exist ptipython; then - cmd=ptipython - elif exist ipython; then - cmd=ipython - elif exist python; then - cmd=python - else - echo "No python found on system, please install." 1>&2 - exit 1 - fi + cmd_explicit=$(echo -e "euporie-console\njupyter-console\nptipython\nipython\npython" | fzf) fi # search for molten session for current dir if [ -n "$(ls -A "${search_dir}" 2>/dev/null)" ]; then - res=$(find "$search_dir" -maxdepth 1 -type f -name "*.json") - if [ "$(echo "$res" | wc -l)" -gt 1 ]; then - session=$(echo "$res" | fzf --prompt "Molten session> ") - fi + session=$(find "$search_dir" -maxdepth 1 -type f -name "*.json") + if [ "$(echo "$session" | wc -l)" -gt 1 ]; then + session=$(echo "$session" | fzf --prompt "Molten session> ") + fi +fi + +if [ -n "$cmd_explicit" ] && not exist "$cmd_explicit"; then + echo "Command $cmd_explicit not found." + exit 1 +elif [ "$cmd_explicit" == "euporie-console" ]; then + if [ -n "$session" ]; then + euporie-console --edit-mode vi --connection-file "$session" + else + echo "Starting euporie without a session to attach to." + euporie-console --edit-mode vi + fi + exit 0 +elif [ "$cmd_explicit" == "jupyter-console" ]; then + if [ -n "$session" ]; then + jupyter-console --existing "$session" + else + echo "Starting jupyter console without a session to attach to." + jupyter-console + fi + exit 0 +elif [ -n "$cmd_explicit" ]; then + "$cmd_explicit" + exit 0 +fi + +# set normal command first +if [ -z "$cmd" ]; then + if exist ptipython; then + cmd=ptipython + elif exist ipython; then + cmd=ipython + elif exist python; then + cmd=python + else + echo "No python found on system, please install." 1>&2 + exit 1 + fi fi # attach to kernel if [ -n "${session}" ]; then - if exist euporie-console || [ "$cmd" == "euporie-console" ]; then - euporie-console --edit-mode vi --connection-file "$session" - elif exist jupyter-console || [ "$cmd" == "jupyter-console" ]; then - jupyter-console --existing "$session" - fi -# or just run normal python -else - $cmd + if exist euporie-console; then + euporie-console --edit-mode vi --connection-file "$session" + exit 0 + elif exist jupyter-console; then + jupyter-console --existing "$session" + exit 0 + fi fi +# or just run normal python +$cmd