Compare commits

...

2 commits

Author SHA1 Message Date
vorboyvo 07e09b51ea Added wordcount.kak. 2026-02-07 01:07:11 -05:00
vorboyvo 3958e75e43 Updated flake.lock and made according changes. 2026-02-07 01:06:49 -05:00
5 changed files with 149 additions and 25 deletions

View file

@ -84,11 +84,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1763416652, "lastModified": 1768927746,
"narHash": "sha256-8EBEEvtzQ11LCxpQHMNEBQAGtQiCu/pqP9zSovDSbNM=", "narHash": "sha256-zyMpWHqcpKVmRc1W2NEK7DAuyVJZV62Jdjqudg70b1k=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "ea164b7c9ccdc2321379c2ff78fd4317b4c41312", "rev": "63a87808f5f9b6e4195a1d33f6ea25d23f4aa0df",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -99,11 +99,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1762847253, "lastModified": 1768736227,
"narHash": "sha256-BWWnUUT01lPwCWUvS0p6Px5UOBFeXJ8jR+ZdLX8IbrU=", "narHash": "sha256-qgGq7CfrYKc3IBYQ7qp0Z/ZXndQVC5Bj0N8HW9mS2rM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "899dc449bc6428b9ee6b3b8f771ca2b0ef945ab9", "rev": "d447553bcbc6a178618d37e61648b19e744370df",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -115,11 +115,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1763421233, "lastModified": 1768564909,
"narHash": "sha256-Stk9ZYRkGrnnpyJ4eqt9eQtdFWRRIvMxpNRf4sIegnw=", "narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "89c2b2330e733d6cdb5eae7b899326930c2c0648", "rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -192,8 +192,8 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1759260889, "lastModified": 1767812907,
"narHash": "sha256-EpjnR/SW4qxgfNTQzRc+WHiLaM5/Afo4j35GmAr2uRc=", "narHash": "sha256-/UQlJO13c9agryVdPk1bxFa6/SXRdFsw106TFBjp9LU=",
"path": "/home/alice/projects/tepid-client-services/", "path": "/home/alice/projects/tepid-client-services/",
"type": "path" "type": "path"
}, },

View file

@ -129,10 +129,10 @@
services.printing.enable = true; services.printing.enable = true;
# Enable SANE for scanning. # Enable SANE for scanning.
hardware.sane = { # hardware.sane = {
enable = true; # enable = true;
extraBackends = [ pkgs.epkowa ]; # extraBackends = [ pkgs.epkowa ];
}; # };
# Enable udisks (handles storage devices, e.g. usb flash drives) # Enable udisks (handles storage devices, e.g. usb flash drives)
services.udisks2.enable = true; services.udisks2.enable = true;
@ -190,6 +190,7 @@
# neovim # neovim
greetd.tuigreet greetd.tuigreet
ntfs3g ntfs3g
android-tools
kakoune kakoune
git git
sl sl
@ -221,9 +222,6 @@
# Enable tailscale # Enable tailscale
services.tailscale.enable = true; services.tailscale.enable = true;
# Enable adb
programs.adb.enable = true;
# Enable zsh; necessary to switch # Enable zsh; necessary to switch
programs.zsh.enable = true; programs.zsh.enable = true;

View file

@ -13,12 +13,6 @@
# Install packages # Install packages
home.packages = with pkgs; home.packages = with pkgs;
# [
# hunspell
# hunspellDicts.fr-any
# hunspellDicts.fr-moderne
# hunspellDicts.fr-classique
# ] ++ # Spell checking
[ ] ++ # Temp [ ] ++ # Temp
[ ]; [ ];

View file

@ -84,6 +84,7 @@
remmina remmina
pinta pinta
darktable darktable
gthumb
] ++ # Selection of graphical apps ] ++ # Selection of graphical apps
[ [
prismlauncher prismlauncher
@ -92,7 +93,7 @@
[ marksman nil ] ++ # Language servers for built in languages [ marksman nil ] ++ # Language servers for built in languages
[ texliveFull texlab ] ++ # LaTeX - remove this eventually and put it in dev [ texliveFull texlab ] ++ # LaTeX - remove this eventually and put it in dev
# envs # envs
[ xdg-terminal-exec glib upower xfce.tumbler xfce.ristretto hledger ] ++ [ xdg-terminal-exec glib upower hledger ] ++
(let (let
archivo = callPackage ../pkgs/archivo/archivo.nix { }; archivo = callPackage ../pkgs/archivo/archivo.nix { };
highway-gothic = callPackage ../pkgs/highway-gothic/highway-gothic.nix { }; highway-gothic = callPackage ../pkgs/highway-gothic/highway-gothic.nix { };

View file

@ -0,0 +1,131 @@
# Count characters, words, lines, and paragraphs in selection.
# Author: Francois Tonneau
# VARIABLES
declare-option -hidden int wordcount_non_space_chars 0
declare-option -hidden int wordcount_all_chars 0
declare-option -hidden int wordcount_words 0
declare-option -hidden int wordcount_non_empty_lines 0
declare-option -hidden int wordcount_all_lines 0
declare-option -hidden int wordcount_paragraphs 0
# PUBLIC COMMANDS
define-command \
-docstring 'Count characters - words - lines - paragraphs' \
wordcount-count %{
evaluate-commands %sh{
if expr "$kak_selections_length" : '.* .*' >/dev/null; then
printf %s\\n 'fail multiple selections not allowed'
exit
fi
printf %s\\n wordcount-proceed
}
}
alias global woc wordcount-count
# IMPLEMENTATION
define-command \
-hidden \
wordcount-proceed %{
wordcount-grow-lines
wordcount-count-chars
wordcount-count-words
wordcount-count-lines
wordcount-count-pars
wordcount-summarize
}
define-command \
-hidden \
wordcount-grow-lines %{
execute-keys <a-x>
}
define-command \
-hidden \
wordcount-count-chars %{
evaluate-commands %sh{
bulk=$(printf %s "$kak_selection" \
| tr -d '\n' \
| wc -m \
)
nonspace=$(printf %s "$kak_selection" \
| tr -d '\n' \
| sed 's/[[:space:]]/ /g' \
| tr -d ' ' \
| wc -m \
)
printf %s\\n "set-option window wordcount_all_chars $bulk"
printf %s\\n "set-option window wordcount_non_space_chars $nonspace"
}
}
define-command \
-hidden \
wordcount-count-words %{
evaluate-commands %sh{
words=$( printf %s "$kak_selection" \
| wc -w \
)
printf %s\\n "set-option window wordcount_words $words"
}
}
define-command \
-hidden \
wordcount-count-lines %{
evaluate-commands %sh{
all=$( printf %s "$kak_selection" \
| wc -l \
)
nonempty=$( printf %s "$kak_selection" \
| sed -n /^$/!p \
| wc -l \
)
printf %s\\n "set-option window wordcount_all_lines $all"
printf %s\\n "set-option window wordcount_non_empty_lines $nonempty"
}
}
define-command \
-hidden \
wordcount-count-pars %{
#
# Unless it is empty, consider the selection to be 1 paragraph by default.
# Then count paragraph separations (\n\n [^\n]).
try %{
execute-keys -draft <a-k> [^\n] <ret>
set-option window wordcount_paragraphs 1
} \
catch %{
set-option window wordcount_paragraphs 0
}
evaluate-commands -draft %{
try %{
execute-keys s \n\n [^\n] <ret>
evaluate-commands -itersel %{
set -add window wordcount_paragraphs 1
}
}
}
}
define-command \
-hidden \
wordcount-summarize %{
info -title 'Word Count' \
" Words: %opt(wordcount_words)
Characters, including space: %opt(wordcount_all_chars)
Characters, excluding space: %opt(wordcount_non_space_chars)
Total lines: %opt(wordcount_all_lines)
Non-empty lines: %opt(wordcount_non_empty_lines)
Paragraphs: %opt(wordcount_paragraphs)"
}