💾 Archived View for pub.phreedom.club › ~taxuswc › utils.gmi captured on 2023-11-04 at 11:56:29. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-03-20)
-=-=-=-=-=-=-
Чем проще, тем лучше.
С ней неплохо справляется vim, если его должным образом попросить.
Наколдовал что-то такое:
$ highlight sh < bin/highlight [96m [m[96m#!/bin/sh[m [96m [m[1m[96mCACHEFILE[m=[93m"[m[38;5;81m${XDG_CACHE_HOME[m[93m:-[m[38;5;81m$HOME[m/.cache[38;5;81m}[m[95m/highlight.cache[m[93m"[m [96m [m[1m[96mFILETYPE[m=[38;5;81m${1[m[93m:-[mtxt[38;5;81m}[m [96m [m[93mprintf[m [93m"[m[95m*[m[38;5;224m\n[m[93m"[m [93m>[m [93m"[m[38;5;81m$CACHEFILE[m[93m"[m [96m [m[93mcat[m [93m>>[m [93m"[m[38;5;81m$CACHEFILE[m[93m"[m [96m [m[1m[96mnlines[m=[38;5;81m$([m[38;5;224mwc -l [m[93m<[m[38;5;224m [m[93m"[m[38;5;81m$CACHEFILE[m[93m"[m[38;5;81m)[m [96m [mscript [38;5;224m-qc[m [93m"[m[95mstty rows [m[38;5;81m$(([m[38;5;224m [m[38;5;81m$nlines[m[38;5;224m + [m[95m3[m[38;5;224m [m[38;5;81m))[m[95m cols 1000 && vim -nXZ -u NONE \[m [96m [m[95m '+syn on' \[m [96m [m[95m '+set ls=0 nonu noru nosmd nosc nowrap bg=dark ft=[m[38;5;81m$FILETYPE[m[95m' \[m [96m [m[95m '+set fdc=4' '+hi! FoldColumn ctermbg=NONE' \[m [96m [m[95m '[m[93m"[m[38;5;81m$CACHEFILE[m[93m"[m[95m' \[m [96m [m[95m '+redraw' \[m [96m [m[95m '+quit' [m[93m"[m /dev/null [93m\[m [96m [m | [93mtail[m +[95m2[m [93m\[m [96m [m | head [38;5;224m-n[m [95m-1[m [96m [m[93mtrap[m [93m"[m[95mrm -rf '[m[38;5;81m$CACHEFILE[m[95m'; trap - EXIT; exit[m[93m"[m EXIT INT HUP
Идея со script -qc стырена со stackoverflow
А идея использовать для подсветки Вим — с vpaste.net
https://vpaste.net/index.cgi?ft=sh
Примерное описание как эта магия работает:
--