Commit 73ae21f
xxwhirlpool
·
2025-12-09 08:01:36 -0500 EST
parent 9b8bde2
micro settings; update txttools
2 files changed,
+23,
-2
+1,
-1
| ... | ... | @@ -1,6 +1,6 @@ | |
| 1 | 1 | { | |
| 2 | 2 | "colorscheme": "catppuccin-frappe", | |
| 3 | - | "lsp.formatOnSave": true, | |
| 3 | + | "lsp.formatOnSave": false, | |
| 4 | 4 | "lsp.server": "python=pyls,go=gopls,typescript=deno lsp,nix=nixd", | |
| 5 | 5 | "lsp.tabcompletion": true, | |
| 6 | 6 | "softwrap": true, |
+22,
-1
| ... | ... | @@ -10,10 +10,31 @@ unwraptxt() { | |
| 10 | 10 | rm "$TXTFILE" "$TXTFILE_FIN" | |
| 11 | 11 | } | |
| 12 | 12 | ||
| 13 | + | wraptxt() { | |
| 14 | + | WRTXTFILE="/tmp/$(openssl rand -hex 5).txt" | |
| 15 | + | WRTXTFILE_FIN="${WRTXTFILE%.*}_final.txt" | |
| 16 | + | gum write --header="paste text below" > "$WRTXTFILE" | |
| 17 | + | FOLDNUM=$(gum input --placeholder "number of characters to wrap to") | |
| 18 | + | fold -w "$FOLDNUM" -s "$WRTXTFILE" > "$WRTXTFILE_FIN" | |
| 19 | + | batcat --paging=never "$WRTXTFILE_FIN" | |
| 20 | + | xclip -sel clip "$WRTXTFILE_FIN" | |
| 21 | + | rm "$WRTXTFILE" "$WRTXTFILE_FIN" | |
| 22 | + | } | |
| 23 | + | ||
| 24 | + | wdcount() { | |
| 25 | + | WCTXTFL="/tmp/$(openssl rand -hex 5).txt" | |
| 26 | + | gum write --header="paste text below" > "$WCTXTFL" | |
| 27 | + | WCNUM=$(wc -w "$WCTXTFL" | awk '{print $1}') | |
| 28 | + | echo -e "$(gum style --foreground=#f4b8e4 --border none 'total word count'): $WCNUM" | |
| 29 | + | rm "$WCTXTFL" | |
| 30 | + | } | |
| 31 | + | ||
| 13 | 32 | choice() { | |
| 14 | - | choose=$(gum choose "unwrap") | |
| 33 | + | choose=$(gum choose "unwrap" "wrap" "wordcount") | |
| 15 | 34 | case "$choose" in | |
| 16 | 35 | *unwrap) unwraptxt ;; | |
| 36 | + | *wrap) wraptxt ;; | |
| 37 | + | *wordcount) wdcount ;; | |
| 17 | 38 | *) exit 0;; | |
| 18 | 39 | esac | |
| 19 | 40 | } |