From bf22e791d1cd0715d8730f1693f00daad00a0267 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Wed, 4 Mar 2026 00:02:30 -0500 Subject: [PATCH] updated to use new shed module schema --- flake.lock | 112 ++++---- flake.nix | 3 +- modules/home/environment/hyprland.nix | 4 + modules/home/environment/shed/complete.nix | 15 + modules/home/environment/shed/default.nix | 3 + modules/home/environment/shed/extraconfig.nix | 214 +-------------- modules/home/environment/shed/functions.nix | 256 ++++++++++++++++++ modules/home/environment/shed/keymaps.nix | 205 ++++++++++++++ modules/home/environment/userpkgs.nix | 10 +- modules/home/programs/git.nix | 5 + modules/home/programs/nixvim/autocmd.nix | 25 ++ modules/home/programs/nixvim/default.nix | 8 - modules/home/programs/nixvim/keymaps.nix | 5 + modules/home/programs/nixvim/options.nix | 14 +- .../home/programs/nixvim/plugins/default.nix | 2 + .../home/programs/nixvim/plugins/otter.nix | 10 + .../programs/nixvim/plugins/treesitter.nix | 16 ++ 17 files changed, 625 insertions(+), 282 deletions(-) create mode 100644 modules/home/environment/shed/complete.nix create mode 100644 modules/home/environment/shed/functions.nix create mode 100644 modules/home/environment/shed/keymaps.nix create mode 100644 modules/home/programs/nixvim/plugins/otter.nix create mode 100644 modules/home/programs/nixvim/plugins/treesitter.nix diff --git a/flake.lock b/flake.lock index f9e8d26..a6f8f87 100755 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ ] }, "locked": { - "lastModified": 1771610171, - "narHash": "sha256-+DeInuhbm6a6PpHDNUS7pozDouq2+8xSDefoNaZLW0E=", + "lastModified": 1772292445, + "narHash": "sha256-4F1Q7U313TKUDDovCC96m/Za4wZcJ3yqtu4eSrj8lk8=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "7f9eb087703ec4acc6b288d02fa9ea3db803cd3d", + "rev": "1dbbba659c1cef0b0202ce92cadfe13bae550e8f", "type": "github" }, "original": { @@ -107,11 +107,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1771979194, - "narHash": "sha256-X3yVu1sGIItgDUZcSh59CO1Pxfr9HHdbBGYy64+9jvQ=", + "lastModified": 1772039265, + "narHash": "sha256-3TR+B2DmkkkIi/b0CE8PuKkmb2jgzdKrOPsIwdWhsM0=", "owner": "9001", "repo": "copyparty", - "rev": "9951e0333dae457f88e607eafb3418fcf7535d5d", + "rev": "7c60adc69c977fb4b75e31c576131b1379498c3f", "type": "github" }, "original": { @@ -125,11 +125,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1771881364, - "narHash": "sha256-A5uE/hMium5of/QGC6JwF5TGoDAfpNtW00T0s9u/PN8=", + "lastModified": 1772420042, + "narHash": "sha256-naZz40TUFMa0E0CutvwWsSPhgD5JldyTUDEgP9ADpfU=", "owner": "nix-community", "repo": "disko", - "rev": "a4cb7bf73f264d40560ba527f9280469f1f081c6", + "rev": "5af7af10f14706e4095bd6bc0d9373eb097283c6", "type": "github" }, "original": { @@ -309,11 +309,11 @@ ] }, "locked": { - "lastModified": 1771851181, - "narHash": "sha256-gFgE6mGUftwseV3DUENMb0k0EiHd739lZexPo5O/sdQ=", + "lastModified": 1772569491, + "narHash": "sha256-bdr6ueeXO1Xg91sFkuvaysYF0mVdwHBpdyhTjBEWv+s=", "owner": "nix-community", "repo": "home-manager", - "rev": "9a4b494b1aa1b93d8edf167f46dc8e0c0011280c", + "rev": "924e61f5c2aeab38504028078d7091077744ab17", "type": "github" }, "original": { @@ -415,11 +415,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1771959711, - "narHash": "sha256-vfvvuUu6X6bF4z6Wagcd5dz+EtPdkPo+9FZLj1JieMI=", + "lastModified": 1772571633, + "narHash": "sha256-KjJ/Wttx+V9l2nx8Z+PNW0su6XuC0OyLL6dX70Rsx0c=", "ref": "refs/heads/main", - "rev": "c60b3cb2ed0404d9573b2801b51ba7be1da999d9", - "revCount": 6923, + "rev": "c11cadd8d6f7b8ea0dc3d49424dd7c4f7efa4bd7", + "revCount": 6979, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" @@ -538,11 +538,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1770751064, - "narHash": "sha256-Q9t7TR05XwLnOFDxsExVjiL3337zs99jqhvcqIzgc8o=", + "lastModified": 1772469529, + "narHash": "sha256-MU+qYyk/imRJTl9MXnfaA22EnYqZNXxdNpZAe4vrfWA=", "owner": "hyprwm", "repo": "hyprpicker", - "rev": "089dd8a448c12e1066486892de096590cddb4195", + "rev": "7ba3edd96702ab6897cdaa82547894589a553e4f", "type": "github" }, "original": { @@ -640,11 +640,11 @@ ] }, "locked": { - "lastModified": 1749135356, - "narHash": "sha256-Q8mAKMDsFbCEuq7zoSlcTuxgbIBVhfIYpX0RjE32PS0=", + "lastModified": 1772459870, + "narHash": "sha256-xxkK2Cvqxpf/4UGcJ/TyCwrvmiNWsKsJfFzHMp2bxis=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "e36db00dfb3a3d3fdcc4069cb292ff60d2699ccb", + "rev": "e63f3a79334dec49f8eb1691f66f18115df04085", "type": "github" }, "original": { @@ -690,11 +690,11 @@ ] }, "locked": { - "lastModified": 1749145760, - "narHash": "sha256-IHaGWpGrv7seFWdw/1A+wHtTsPlOGIKMrk1TUIYJEFI=", + "lastModified": 1772459835, + "narHash": "sha256-978jRz/y/9TKmZb/qD4lEYHCQGHpEXGqy+8X2lFZsak=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "817918315ea016cc2d94004bfb3223b5fd9dfcc6", + "rev": "0a692d4a645165eebd65f109146b8861e3a925e7", "type": "github" }, "original": { @@ -749,11 +749,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1771207753, - "narHash": "sha256-b9uG8yN50DRQ6A7JdZBfzq718ryYrlmGgqkRm9OOwCE=", + "lastModified": 1772173633, + "narHash": "sha256-MOH58F4AIbCkh6qlQcwMycyk5SWvsqnS/TCfnqDlpj4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d1c15b7d5806069da59e819999d70e1cec0760bf", + "rev": "c0f3d81a7ddbc2b1332be0d8481a672b4f6004d6", "type": "github" }, "original": { @@ -781,11 +781,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1771848320, - "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", + "lastModified": 1772198003, + "narHash": "sha256-I45esRSssFtJ8p/gLHUZ1OUaaTaVLluNkABkk6arQwE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2fc6539b481e1d2569f25f8799236694180c0993", + "rev": "dd9b079222d43e1943b6ebd802f04fd959dc8e61", "type": "github" }, "original": { @@ -797,11 +797,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1748929857, - "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=", + "lastModified": 1772433332, + "narHash": "sha256-izhTDFKsg6KeVBxJS9EblGeQ8y+O8eCa6RcW874vxEc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4", + "rev": "cf59864ef8aa2e178cccedbe2c178185b0365705", "type": "github" }, "original": { @@ -813,17 +813,17 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1771998210, - "narHash": "sha256-k1Qa2FLY/Bh64V+3s9CliTWAdLv0Lv8Qy7I/cgXMsjU=", + "lastModified": 1772554988, + "narHash": "sha256-8Kb+MSE6QYVX1S96aZOluOMVfvSEOs70vgX980qVUaY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a5ebaf35f8930361787bb491d49fc2e807e6d51e", + "rev": "87f6b6e02cb3f87a1be4f939326c94c8af9d55d8", "type": "github" }, "original": { "owner": "nixos", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", - "rev": "a5ebaf35f8930361787bb491d49fc2e807e6d51e", "type": "github" } }, @@ -845,11 +845,11 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1771369470, - "narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=", + "lastModified": 1771848320, + "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0182a361324364ae3f436a63005877674cf45efb", + "rev": "2fc6539b481e1d2569f25f8799236694180c0993", "type": "github" }, "original": { @@ -882,11 +882,11 @@ "systems": "systems_3" }, "locked": { - "lastModified": 1771135771, - "narHash": "sha256-wyvBIhDuyCRyjB3yPg77qoyxrlgQtBR1rVW3c9knV3E=", + "lastModified": 1772402258, + "narHash": "sha256-3DmCFOdmbkFML1/G9gj8Wb+rCCZFPOQtNoMCpqOF8SA=", "owner": "nix-community", "repo": "nixvim", - "rev": "ed0424f0b08d303a7348f52f7850ad1b2704f9ba", + "rev": "21ae25e13b01d3b4cdc750b5f9e7bad68b150c10", "type": "github" }, "original": { @@ -930,11 +930,11 @@ ] }, "locked": { - "lastModified": 1771858127, - "narHash": "sha256-Gtre9YoYl3n25tJH2AoSdjuwcqij5CPxL3U3xysYD08=", + "lastModified": 1772024342, + "narHash": "sha256-+eXlIc4/7dE6EcPs9a2DaSY3fTA9AE526hGqkNID3Wg=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "49bbbfc218bf3856dfa631cead3b052d78248b83", + "rev": "6e34e97ed9788b17796ee43ccdbaf871a5c2b476", "type": "github" }, "original": { @@ -964,11 +964,11 @@ "nixpkgs": "nixpkgs_8" }, "locked": { - "lastModified": 1771999992, - "narHash": "sha256-nBntlK2HHywIwd2tC3jRTS5n8cekjn/e1Ci1DpYMe1E=", + "lastModified": 1772599456, + "narHash": "sha256-WOO10Cb0gcZJhf2ZLL6VC93Hfw55nguWdC8cmpLdLig=", "owner": "km-clay", "repo": "shed", - "rev": "9c8a5713db1b1d9783d78d66551eb8a8f81304ae", + "rev": "210b57b9924363852687e7aae3ec0f3864a4742a", "type": "github" }, "original": { @@ -985,11 +985,11 @@ "systems": "systems_5" }, "locked": { - "lastModified": 1771737804, - "narHash": "sha256-7wn9qbzIQQgH8tnq4VwzuWEqEWpekuymlLyhY3vM/j8=", + "lastModified": 1772494187, + "narHash": "sha256-6ksgNAFXVK+Cg/6ww7bB2nJUPZlnS75UwZC7G+L03EE=", "owner": "gerg-l", "repo": "spicetify-nix", - "rev": "6dd43010ac2458cc56a6ac5250349b9217a7a2ae", + "rev": "915ab06b046d05613041780c575c62a32fe67cea", "type": "github" }, "original": { @@ -1017,11 +1017,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1771787992, - "narHash": "sha256-Vg4bGwwenNYI8p3nJTl9FRyeIyrjATeZrZr+GyUSDrw=", + "lastModified": 1772296853, + "narHash": "sha256-pAtzPsgHRKw/2Kv8HgAjSJg450FDldHPWsP3AKG/Xj0=", "owner": "danth", "repo": "stylix", - "rev": "30054cca073b49b42a71289edec858f535b27fe9", + "rev": "c4b8e80a1020e09a1f081ad0f98ce804a6e85acf", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 629c8ec..d5d09d5 100755 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,8 @@ description = "pagedMov's NixOS and Home Manager configuration"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/a5ebaf35f8930361787bb491d49fc2e807e6d51e"; + #nixpkgs.url = "github:nixos/nixpkgs/a5ebaf35f8930361787bb491d49fc2e807e6d51e"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; hypr-contrib.url = "github:hyprwm/contrib"; copyparty.url = "github:9001/copyparty"; hyprpicker.url = "github:hyprwm/hyprpicker"; diff --git a/modules/home/environment/hyprland.nix b/modules/home/environment/hyprland.nix index efe531d..54b3f10 100755 --- a/modules/home/environment/hyprland.nix +++ b/modules/home/environment/hyprland.nix @@ -142,6 +142,10 @@ in { "move 100%-470 15, match:title ^(Firefox — 共有インジケーター)$" ] ++ smartGapsWindowrules; + cursor = { + no_hardware_cursors = true; + }; + input = { kb_layout = "us"; follow_mouse = 1; diff --git a/modules/home/environment/shed/complete.nix b/modules/home/environment/shed/complete.nix new file mode 100644 index 0000000..3468caf --- /dev/null +++ b/modules/home/environment/shed/complete.nix @@ -0,0 +1,15 @@ +{ lib, config, ... }: +{ + programs.shed = { + extraCompletion = { + cargo = { + wordList = [ + "build" + "test" + "run" + "clippy" + ]; + }; + }; + }; +} diff --git a/modules/home/environment/shed/default.nix b/modules/home/environment/shed/default.nix index 9c590c8..fced860 100644 --- a/modules/home/environment/shed/default.nix +++ b/modules/home/environment/shed/default.nix @@ -3,8 +3,11 @@ { imports = [ ./env.nix + ./complete.nix ./aliases.nix ./extraconfig.nix ./options.nix + ./keymaps.nix + ./functions.nix ]; } diff --git a/modules/home/environment/shed/extraconfig.nix b/modules/home/environment/shed/extraconfig.nix index e0c8e6e..49812e0 100644 --- a/modules/home/environment/shed/extraconfig.nix +++ b/modules/home/environment/shed/extraconfig.nix @@ -6,221 +6,9 @@ let in { programs.shed = { - settings.extraPreConfig = '' - prompt_topline() { - local user_and_host="\e[0m\e[1m$USER\e[1;36m@\e[1;31m$HOST\e[0m" - echo -n "\e[1;34m┏━ $user_and_host\n" - } - - prompt_stat_line() { - local last_exit_code="$?" - local last_cmd_status - local last_cmd_runtime - if [ "$last_exit_code" -eq "0" ]; then - last_cmd_status="\e[1;32m\e[0m" - else - last_cmd_status="\e[1;31m\e[0m" - fi - local last_runtime_raw="$(echo -p "\t")" - if [ -z "$last_runtime_raw" ]; then - return 0 - else - last_cmd_runtime="\e[1;38;2;249;226;175m󰔛 $(echo -p "\T")\e[0m" - fi - - echo -n "\e[1;34m┃ $last_cmd_runtime ($last_cmd_status)\n" - } - - prompt_git_line() { - git rev-parse --is-inside-work-tree > /dev/null 2>&1 || return - - local gitsigns - local status="$(git status --porcelain 2>/dev/null)" - - [ -n "$status" ] && echo "$status" | command grep -q '^ [MADR]' && gitsigns="$gitsigns!" - [ -n "$status" ] && echo "$status" | command grep -q '^??' && gitsigns="$gitsigns?" - [ -n "$status" ] && echo "$status" | command grep -q '^[MADR]' && gitsigns="$gitsigns+" - - local ahead="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)" - local behind="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)" - [ $ahead -gt 0 ] && gitsigns="$gitsigns↑" - [ $behind -gt 0 ] && gitsigns="$gitsigns↓" - - local branch="$(git branch --show-current 2>/dev/null)" - - if [ -n "$gitsigns" ] || [ -n "$branch" ]; then - if [ -n "$gitsigns" ]; then - gitsigns="\e[1;31m[$gitsigns]" - fi - echo -n "\e[1;34m┃ \e[1;35m ''${branch}$gitsigns\e[0m\n" - fi - } - - prompt_jobs_line() { - local job_count="$(echo -p '\j')" - if [ "$job_count" -gt 0 ]; then - echo -n "\e[1;34m┃ \e[1;33m󰒓 $job_count job(s) running\e[0m\n" - fi - } - - prompt_pwd_line() { - echo -p "\e[1;34m┣━━ \e[1;36m\W\e[1;32m/" - } - - prompt_dollar_line() { - local dollar="$(echo -p "\$ ")" - local dollar="$(echo -e "\e[1;32m$dollar\e[0m")" - echo -n "\e[1;34m┗━ $dollar " - } - - prompt() { - local statline="$(prompt_stat_line)" - local topline="$(prompt_topline)" - local gitline="$(prompt_git_line)" - local jobsline="$(prompt_jobs_line)" - local pwdline="$(prompt_pwd_line)" - local dollarline="$(prompt_dollar_line)" - local prompt="$topline$statline$gitline$jobsline$pwdline\n$dollarline" - - echo -en "$prompt" - } - - shed_ver() { - shed --version - } - + settings.extraPostConfig = /* bash */ '' export PS1="\!prompt " export PSR='\e[36;1m$\!shed_ver\e[0m' - ''; - settings.extraPostConfig = '' - encrypt() { - if [ -z "$1" ]; then - echo "Usage: encrypt [recipient]" - return 1 - fi - if [ -z "$2" ]; then - gpg --encrypt --armor -r "$1" - else - echo "$1" | gpg --encrypt --armor -r "$2" - fi - } - decrypt() { - if [ -z "$1" ]; then - gpg --decrypt --quiet 2>/dev/null - else - echo "$1" | gpg --decrypt --quiet - fi - } - - viflake() { - filename="$(upfind flake.nix)" - if [ -n "$filename" ]; then - nvim "$filename" - else - echo "No flake.nix found in this directory or any parent directories." - return 1 - fi - } - - upfind() { - until [ "$#" -eq 0 ]; do - filename="$1" - ( - until [ -f "./$filename" ]; do - builtin cd .. - if [ "$PWD" = "/" ]; then - echo "upsearch: failed to find file '$filename' in this directory or any parent directories." 1>&2 - break - fi - done - if [ -f "./$filename" ]; then - realpath "./$filename" - fi - ) - shift 1 - done - } - - nvim() { - ${shellsound} ${sndpath}/nvim.wav - command nvim "$@" - } - neovide() { - ${shellsound} ${sndpath}/nvim.wav - command neovide "$@" - } - grimblast() { - if command grimblast "$@"; then - ${shellsound} ${sndpath}/screenshot.wav - fi - } - gitcheckout_sfx() { - if git checkout "$@"; then - ${shellsound} ${sndpath}/gitcheckout.wav - else - ${shellsound} ${sndpath}/error.wav - fi - } - gitrebase_sfx() { - if git rebase "$@"; then - ${shellsound} ${sndpath}/gitrebase.wav - else - ${shellsound} ${sndpath}/error.wav - fi - } - gitcommit_sfx() { - local output="$(git commit "$@")" - if [ "$?" -eq "0" ]; then - ${shellsound} ${sndpath}/gitcommit.wav - echo "$output" | ${color-commit} - return 0 - else - ${shellsound} ${sndpath}/error.wav - echo "$output" - return 1 - fi - } - gitpush_sfx() { - if git push "$@"; then - ${shellsound} ${sndpath}/gitpush.wav - else - ${shellsound} ${sndpath}/error.wav - fi - } - gitpull_sfx() { - if git pull "$@"; then - ${shellsound} ${sndpath}/gitpull.wav - else - ${shellsound} ${sndpath}/error.wav - fi - } - - ls() { - eza -1 --group-directories-first --icons "$@" - ${shellsound} ${sndpath}/ls.wav - } - - mkcd() { - command mkdir -p "$1" && builtin cd "$1" - } - - cd() { - eza -1 --group-directories-first --icons "$@" 2> /dev/null - builtin cd "$@" - ${shellsound} ${sndpath}/cd.wav - } - - hyprsock() { - socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - } - - vipe() { - local tmp=$(mktemp) - $EDITOR "$tmp" >/dev/tty /dev/null 2>&1 || return + + local gitsigns + local status="$(git status --porcelain 2>/dev/null)" + local branch="$(git branch --show-current 2>/dev/null)" + + [ -n "$status" ] && echo "$status" | command grep -q '^ [MADR]' && gitsigns="$gitsigns!" + [ -n "$status" ] && echo "$status" | command grep -q '^??' && gitsigns="$gitsigns?" + [ -n "$status" ] && echo "$status" | command grep -q '^[MADR]' && gitsigns="$gitsigns+" + + local ahead="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)" + local behind="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)" + [ $ahead -gt 0 ] && gitsigns="$gitsigns↑" + [ $behind -gt 0 ] && gitsigns="$gitsigns↓" + + local diff="$(git diff --shortstat)" + local add="" + local del="" + local changed="" + i=0 + while read -d "," part; do + if [ $i -ge 3 ]; then break; fi + case $i in + 0) + changed="$(echo $part | cut -d' ' -f1)" + ;; + 1) + add="$(echo $part | cut -d' ' -f1)" + ;; + 2) + del="$(echo $part | cut -d' ' -f1)" + ;; + esac + i=$(($i + 1)) + done < <(echo "$diff,") + + if [ -n "$gitsigns" ] || [ -n "$branch" ]; then + if [ -n "$gitsigns" ]; then + gitsigns="\e[1;31m[$gitsigns]" + fi + if [ -n "$changed" ] && [ "$changed" -gt 0 ]; then + changed="\e[1;34m~$changed \e[0m" + fi + if [ -n "$add" ] && [ "$add" -gt 0 ]; then + add="\e[1;32m+$add \e[0m" + fi + if [ -n "$del" ] && [ "$del" -gt 0 ]; then + del="\e[1;31m-$del\e[0m" + fi + echo -n "\e[1;34m┃ \e[1;35m $branch$gitsigns\e[0m $changed$add$del\n" + fi + ''; + + prompt_jobs_line = /* bash */ '' + local job_count="$(echo -p '\j')" + if [ "$job_count" -gt 0 ]; then + echo -n "\e[1;34m┃ \e[1;33m󰒓 $job_count job(s) running\e[0m\n" + fi + ''; + + prompt_ssh_line = /* bash */ '' + local ssh_server="$(echo $SSH_CONNECTION | cut -f3 -d' ')" + [ -n "$ssh_server" ] && echo -n "\e[1;34m┃ \e[1;39m🌐 $ssh_server\e[0m\n" + ''; + + prompt_pwd_line = /* bash */ '' + echo -p "\e[1;34m┣━━ \e[1;36m\W\e[1;32m/" + ''; + + prompt_dollar_line = /* bash */ '' + local dollar="$(echo -p "\$ ")" + local dollar="$(echo -e "\e[1;32m$dollar\e[0m")" + echo -n "\e[1;34m┗━ $dollar " + ''; + + prompt = /* bash */ '' + local statline="$(prompt_stat_line)" + local topline="$(prompt_topline)" + local gitline="$(prompt_git_line)" + local jobsline="$(prompt_jobs_line)" + local sshline="$(prompt_ssh_line)" + local pwdline="$(prompt_pwd_line)" + local dollarline="$(prompt_dollar_line)" + local prompt="$topline$statline$gitline$jobsline$sshline$pwdline\n$dollarline" + + echo -en "$prompt" + ''; + + shed_ver = '' + shed --version + ''; + + encrypt = /* bash */ '' + if [ -z "$1" ]; then + echo "Usage: encrypt [recipient]" + return 1 + fi + if [ -z "$2" ]; then + gpg --encrypt --armor -r "$1" + else + echo "$1" | gpg --encrypt --armor -r "$2" + fi + ''; + decrypt = /* bash */ '' + if [ -z "$1" ]; then + gpg --decrypt --quiet 2>/dev/null + else + echo "$1" | gpg --decrypt --quiet + fi + ''; + + viflake = /* bash */ '' + filename="$(upfind flake.nix)" + if [ -n "$filename" ]; then + nvim "$filename" + else + echo "No flake.nix found in this directory or any parent directories." + return 1 + fi + ''; + + upfind = /* bash */ '' + until [ "$#" -eq 0 ]; do + filename="$1" + ( + until [ -f "./$filename" ]; do + builtin cd .. + if [ "$PWD" = "/" ]; then + echo "upsearch: failed to find file '$filename' in this directory or any parent directories." 1>&2 + break + fi + done + if [ -f "./$filename" ]; then + realpath "./$filename" + fi + ) + shift 1 + done + ''; + + nvim = /* bash */ '' + ${shellsound} ${sndpath}/nvim.wav + command nvim "$@" + ''; + neovide = /* bash */ '' + ${shellsound} ${sndpath}/nvim.wav + command neovide "$@" + ''; + grimblast = /* bash */ '' + if command grimblast "$@"; then + ${shellsound} ${sndpath}/screenshot.wav + fi + ''; + gitcheckout_sfx = /* bash */ '' + if git checkout "$@"; then + ${shellsound} ${sndpath}/gitcheckout.wav + else + ${shellsound} ${sndpath}/error.wav + fi + ''; + gitrebase_sfx = /* bash */ '' + if git rebase "$@"; then + ${shellsound} ${sndpath}/gitrebase.wav + else + ${shellsound} ${sndpath}/error.wav + fi + ''; + gitcommit_sfx = /* bash */ '' + local output="$(git commit "$@")" + if [ "$?" -eq "0" ]; then + ${shellsound} ${sndpath}/gitcommit.wav + echo "$output" | ${color-commit} + return 0 + else + ${shellsound} ${sndpath}/error.wav + echo "$output" + return 1 + fi + ''; + gitpush_sfx = /* bash */ '' + if git push "$@"; then + ${shellsound} ${sndpath}/gitpush.wav + else + ${shellsound} ${sndpath}/error.wav + fi + ''; + gitpull_sfx = /* bash */ '' + if git pull "$@"; then + ${shellsound} ${sndpath}/gitpull.wav + else + ${shellsound} ${sndpath}/error.wav + fi + ''; + + ls = /* bash */ '' + eza -1 --group-directories-first --icons "$@" + ${shellsound} ${sndpath}/ls.wav + ''; + + mkcd = /* bash */ '' + command mkdir -p "$1" && builtin cd "$1" + ''; + + cd = /* bash */ '' + eza -1 --group-directories-first --icons "$@" 2> /dev/null + builtin cd "$@" + ${shellsound} ${sndpath}/cd.wav + ''; + + hyprsock = /* bash */ '' + socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock + ''; + + vipe = /* bash */ '' + local tmp=$(mktemp) + $EDITOR "$tmp" -R - >/dev/tty &2 + fi + if [ -z "$_CURSOR" ]; then + echo "No cursor" + fi + if [ "$_ANCHOR" -lt "$_CURSOR" ]; then + start=$_ANCHOR + end=$_CURSOR + else + start=$_CURSOR + end=$_ANCHOR + fi + end=$((end + 1)) + + delta=$((end - start)) + + left="''${_BUFFER:0:$start}" + mid="''${_BUFFER:$start:$delta}" + right="''${_BUFFER:$end}" + echo "sl = $_sl sr = $_sr start = $start end = $end delta = $delta left = $left mid = $mid right = $right" 1>&2 + _BUFFER="$left$_sl$mid$_sr$right" + _CURSOR=$start + ''; + + _get_surround_target = /* bash */ '' + read_key -v _s_ch + case "$_s_ch" in + \(|\)) _sl='('; _sr=')' ;; + \[|\]) _sl='['; _sr=']' ;; + \{|\}) _sl='{'; _sr='}' ;; + \<|\>) _sl='<'; _sr='>' ;; + *) _sl="$_s_ch"; _sr="$_s_ch" ;; + esac + ''; + + _surround_del = /* bash */ '' + _get_surround_target + local left_buf="''${_BUFFER:0:$_CURSOR}" + local right_buf="''${_BUFFER:$left}" + local left="" + local right="" + _scan_left $_sl "$left_buf" + + if [ "$?" -ne 0 ]; then + _scan_right $_sl "$right_buf" + + [ "$?" -ne 0 ] && echo "No match found in left or right scan for char '$_sl' on $left_buf" 1>&2 && return 1 + left=$right + fi + + mid_start=$((left + 1)) + right="" + left_buf="''${_BUFFER:0:$left}" + right_buf="''${_BUFFER:$mid_start}" + _scan_right $_sr "$right_buf" + + [ "$?" -ne 0 ] && echo "No match found in right scan for char '$_sr'" 1>&2 && return 1 + + mid_end=$((mid_start + right)) + right_start=$((mid_end + 1)) + new_left_buf="''${_BUFFER:0:$left}" + new_mid_buf="''${_BUFFER:$mid_start:$right}" + new_right_buf="''${_BUFFER:$right_start}" + + + _BUFFER="$new_left_buf$new_mid_buf$new_right_buf" + ''; + + _scan_left = /* bash */ '' + local needle="$1" + local haystack="$2" + local i=$((''${#haystack} - 1)) + + + while [ "$i" -ge 0 ]; do + ch="''${haystack:$i:1}" + if [ "$ch" = "$needle" ]; then + left=$i + return 0 + fi + i=$((i - 1)) + done + + return 1 + ''; + + _scan_right = /* bash */ '' + local needle="$1" + local haystack="$2" + local i=0 + + + while [ "$i" -lt "''${#haystack}" ]; do + ch="''${haystack:$i:1}" + if [ "$ch" = "$needle" ]; then + right="$i" + return 0 + fi + i=$((i + 1)) + done + + return 1 + ''; + + _enum_chars = /* bash */ '' + local i=0 + [ -z "$1" ] && return 1 + [ "''${#1}" -eq 1 ] && echo "0 $1" && return 0 + + while [ "$i" -lt ''${#1} ]; do + echo -n "$i ''${1:$i:1} " + i=$((i + 1)) + [ $i -ge "''${#1}" ] && break + echo -n " " + done + echo + ''; + + _enum_chars_rev = /* bash */ '' + local i=$((''${#1} - 1)) + [ -z "$1" ] && return 1 + [ "''${#1}" -eq 1 ] && echo "0 $1" && return 0 + + while [ "$i" -ge 0 ]; do + echo -n "$i ''${1:$i:1} " + i=$((i - 1)) + [ $i -lt 0 ] && break + echo -n " " + done + echo + ''; + + _edit_line = /* bash */ '' + tmp="$(mktemp)" + echo -n "$_BUFFER" > "$tmp" + $EDITOR "$tmp" + _BUFFER="$(cat "$tmp")" + rm "$tmp" + ''; + }; + + keymaps = [ + { + modes = [ "n" ]; + keys = "e"; + command = ":!_edit_line"; + } + { + modes = [ "n" ]; + keys = "ys"; + command = ":!_surround_1:!_surround_2"; + } + { + modes = [ "n" ]; + keys = "ds"; + command = ":!_surround_del"; + } + ]; + }; +} diff --git a/modules/home/environment/userpkgs.nix b/modules/home/environment/userpkgs.nix index 94c303a..ae78af8 100755 --- a/modules/home/environment/userpkgs.nix +++ b/modules/home/environment/userpkgs.nix @@ -33,6 +33,13 @@ in { }; config = lib.mkIf config.movOpts.envConfig.userPkgs.enable { home.packages = with pkgs; [ + cargo + rustc + clippy + rust-analyzer + nerd-fonts.envy-code-r + clippy + rust-analyzer nemo feh gtk3 @@ -45,7 +52,7 @@ in { zsh-syntax-highlighting zsh-history-substring-search zsh-autosuggestions - libreoffice + #libreoffice gtrash ripgrep wf-recorder @@ -61,7 +68,6 @@ in { gparted dust porsmo - rustup w3m neovide claude-code diff --git a/modules/home/programs/git.nix b/modules/home/programs/git.nix index 6708631..9ec917a 100755 --- a/modules/home/programs/git.nix +++ b/modules/home/programs/git.nix @@ -14,6 +14,11 @@ alias = { draft = "!if git rev-parse > /dev/null 2>&1; then echo \"$1\" >> $(git rev-parse --git-dir)/DRAFT_MSG; else exit 1; fi #"; }; + safe = { + directory = [ + "/home/pagedmov/mnt/net" + ]; + }; core.pager = "delta"; interactive.diffFilter = "delta --color-only"; delta.navigate = "true"; diff --git a/modules/home/programs/nixvim/autocmd.nix b/modules/home/programs/nixvim/autocmd.nix index 406a58c..2a07f7a 100755 --- a/modules/home/programs/nixvim/autocmd.nix +++ b/modules/home/programs/nixvim/autocmd.nix @@ -21,6 +21,31 @@ pattern = [ "*" ]; desc = "Start the floaterm window"; } + { + pattern = [ "qf" ]; + event = [ "FileType" ]; + callback = { + __raw = /* lua */ '' + function() + vim.keymap.set("n", "", "", { buffer = true }) + end''; + }; + } + { + pattern = [ "nix" ]; + event = [ "FileType" ]; + callback = { + __raw = /* lua */ '' + function() + require("otter").activate( + { "bash", "lua", "python" }, + true, -- completions + true, -- diagnostics + nil + ) + end''; + }; + } ]; }; } diff --git a/modules/home/programs/nixvim/default.nix b/modules/home/programs/nixvim/default.nix index f26137d..489aaa4 100755 --- a/modules/home/programs/nixvim/default.nix +++ b/modules/home/programs/nixvim/default.nix @@ -1,14 +1,6 @@ { env, config, pkgs, host, self, ... }: { programs.nixvim = { nixpkgs.useGlobalPackages = true; - extraPackages = [ - pkgs.cargo - pkgs.rustc - pkgs.clippy - pkgs.rustup - pkgs.rust-analyzer - pkgs.nerd-fonts.envy-code-r - ]; }; imports = [ ./plugins ./options.nix ./keymaps.nix ./autocmd.nix ]; } diff --git a/modules/home/programs/nixvim/keymaps.nix b/modules/home/programs/nixvim/keymaps.nix index b10d73e..bb2ce3d 100755 --- a/modules/home/programs/nixvim/keymaps.nix +++ b/modules/home/programs/nixvim/keymaps.nix @@ -36,6 +36,11 @@ key = ""; mode = "n"; } + { + action = "zA"; + key = ""; + mode = "n"; + } { action = "w"; key = ""; diff --git a/modules/home/programs/nixvim/options.nix b/modules/home/programs/nixvim/options.nix index 6c89eff..74915d1 100755 --- a/modules/home/programs/nixvim/options.nix +++ b/modules/home/programs/nixvim/options.nix @@ -30,7 +30,7 @@ in { virtual_text = true; signs = false; }; - extraConfigLua = '' + extraConfigLua = /* lua */ '' if vim.g.started_by_firenvim == true then vim.o.laststatus = 0 end @@ -59,6 +59,7 @@ in { vim.opt.termguicolors = true vim.opt.ruler = true vim.opt.scrolloff = 6 + vim.opt.foldlevelstart = 99 vim.opt.undofile = true vim.opt.foldmethod = "manual" vim.opt.wrap = true @@ -67,8 +68,17 @@ in { vim.opt.breakat = " \t!@*-+;:,./?" vim.opt.guifont = "EnvyCodeR Nerd Font Mono:h18" - vim.g.mapleader = "!" + vim.g.mapleader = " " vim.g.rust_recommended_style = 0 + + vim.treesitter.query.set("nix", "injections", [[ + ;; extends + ((comment) @injection.language + . + (indented_string_expression + (string_fragment) @injection.content) + (#gsub! @injection.language "^%s*/%*%s*(%S+)%s*%*/.*$" "%1")) + ]]) ''; }; } diff --git a/modules/home/programs/nixvim/plugins/default.nix b/modules/home/programs/nixvim/plugins/default.nix index aa45852..f23fd4b 100755 --- a/modules/home/programs/nixvim/plugins/default.nix +++ b/modules/home/programs/nixvim/plugins/default.nix @@ -2,6 +2,8 @@ { imports = [ + ./otter.nix + ./treesitter.nix ./alpha.nix ./haskell.nix ./vim-matchup.nix diff --git a/modules/home/programs/nixvim/plugins/otter.nix b/modules/home/programs/nixvim/plugins/otter.nix new file mode 100644 index 0000000..ebd9579 --- /dev/null +++ b/modules/home/programs/nixvim/plugins/otter.nix @@ -0,0 +1,10 @@ +{ + programs.nixvim = { + plugins.otter = { + enable = true; + settings = { + handle_leading_whitespace = true; + }; + }; + }; +} diff --git a/modules/home/programs/nixvim/plugins/treesitter.nix b/modules/home/programs/nixvim/plugins/treesitter.nix new file mode 100644 index 0000000..60805a0 --- /dev/null +++ b/modules/home/programs/nixvim/plugins/treesitter.nix @@ -0,0 +1,16 @@ +{ + programs.nixvim = { + plugins.treesitter = { + enable = true; + folding = { + enable = true; + }; + indent = { + enable = true; + }; + highlight = { + enable = true; + }; + }; + }; +}