Modules for Elvish Shell

Compare changes

Choose any two refs to compare.

+22 -5
README.md
··· 3 3 Modules for [Elvish Shell](https://github.com/elves/elvish) 4 4 5 5 # Install 6 + ## epm 7 + Required until git.sr.ht is added upstream: 8 + ```elvish 9 + use epm 10 + mkdir -p $epm:managed-dir/git.sr.ht/ 11 + echo "{ 12 + \"method\": \"git\", 13 + \"protocol\": \"https\", 14 + \"levels\": \"2\" 15 + }" > $epm:managed-dir/git.sr.ht/epm-domain.cfg 16 + ``` 6 17 18 + Install module 7 19 ```elvish 8 20 use epm 9 - epm:install &silent-if-installed=$true github.com/ejrichards/mellon 21 + epm:install &silent-if-installed=$true git.sr.ht/~ejri/mellon 10 22 11 23 ``` 12 24 ··· 14 26 15 27 `flake.nix` supplies a NixOS module that lets you import in the same manner as `epm` 16 28 29 + Input 30 + ```nix 31 + mellon.url = "git+https://git.sr.ht/~ejri/mellon"; 32 + ``` 33 + Use module 17 34 ```nix 18 35 { 19 36 ... ··· 28 45 # Usage 29 46 30 47 ```elvish 31 - use github.com/ejrichards/mellon/<module> 48 + use git.sr.ht/~ejri/mellon/<module> 32 49 ``` 33 50 34 51 ## `atuin.elv` ··· 36 53 Add bindings for `Ctrl-r` and `Up` to use atuin for searching history. 37 54 ```elvish 38 55 if (has-external atuin) { 39 - use github.com/ejrichards/mellon/atuin 56 + use git.sr.ht/~ejri/mellon/atuin 40 57 set edit:insert:binding[Ctrl-r] = { atuin:search } 41 58 set edit:insert:binding[Up] = { atuin:search-up } 42 59 } ··· 47 64 Add bindings for `Ctrl-r` and `Up` to use fzf for searching history. 48 65 ```elvish 49 66 if (has-external fzf) { 50 - use github.com/ejrichards/mellon/fzf 67 + use git.sr.ht/~ejri/mellon/fzf 51 68 set edit:insert:binding[Ctrl-r] = { fzf:history } 52 69 set edit:insert:binding[Up] = { fzf:history } 53 70 } ··· 58 75 Add an alias `y` that will `cd` on quit. 59 76 ```elvish 60 77 if (has-external yazi) { 61 - use github.com/ejrichards/mellon/yazi 78 + use git.sr.ht/~ejri/mellon/yazi 62 79 edit:add-var y~ $yazi:y~ 63 80 } 64 81 ```
+13 -3
atuin.elv
··· 8 8 9 9 set edit:after-readline = [$@edit:after-readline {|line| 10 10 try { 11 - set-env ATUIN_HISTORY_ID (atuin history start -- $line) 11 + if (not-eq (str:trim-space $line) '') { 12 + set-env ATUIN_HISTORY_ID (atuin history start -- $line) 13 + } 12 14 } catch e { 13 15 unset-env ATUIN_HISTORY_ID 14 16 } ··· 26 28 } 27 29 var duration = (exact-num (math:round (* $m[duration] 1000000000))) 28 30 29 - with E:ATUIN_LOG = 'error' { atuin history end --exit $exit-status --duration=$duration -- $E:ATUIN_HISTORY_ID >$os:dev-null 2>&1 & } 31 + var history-end = { 32 + tmp E:ATUIN_LOG = 'error' 33 + atuin history end --exit $exit-status --duration $duration -- $E:ATUIN_HISTORY_ID >$os:dev-null 2>&1 34 + unset-env ATUIN_HISTORY_ID 35 + } 30 36 31 - unset-env ATUIN_HISTORY_ID 37 + if $notify-bg-job-success { 38 + $history-end 39 + } else { 40 + $history-end & 41 + } 32 42 } 33 43 }] 34 44
+42
flake.lock
··· 1 + { 2 + "nodes": { 3 + "nixpkgs": { 4 + "locked": { 5 + "lastModified": 1764517877, 6 + "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", 7 + "owner": "NixOS", 8 + "repo": "nixpkgs", 9 + "rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c", 10 + "type": "github" 11 + }, 12 + "original": { 13 + "owner": "NixOS", 14 + "ref": "nixos-unstable", 15 + "repo": "nixpkgs", 16 + "type": "github" 17 + } 18 + }, 19 + "root": { 20 + "inputs": { 21 + "nixpkgs": "nixpkgs", 22 + "systems": "systems" 23 + } 24 + }, 25 + "systems": { 26 + "locked": { 27 + "lastModified": 1681028828, 28 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 29 + "owner": "nix-systems", 30 + "repo": "default", 31 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 32 + "type": "github" 33 + }, 34 + "original": { 35 + "id": "systems", 36 + "type": "indirect" 37 + } 38 + } 39 + }, 40 + "root": "root", 41 + "version": 7 42 + }
+24 -21
flake.nix
··· 1 1 { 2 2 inputs = { 3 3 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 4 - flake-utils.url = "github:numtide/flake-utils"; 5 4 }; 6 5 7 6 outputs = 8 7 { 9 8 self, 9 + systems, 10 10 nixpkgs, 11 - flake-utils, 12 11 }: 13 - flake-utils.lib.eachDefaultSystem ( 14 - system: 15 - let 16 - pkgs = nixpkgs.legacyPackages.${system}; 17 - in 18 - { 19 - packages.default = pkgs.stdenv.mkDerivation { 20 - name = "mellon"; 21 - src = ./.; 22 - installPhase = '' 23 - mkdir -p $out/share/elvish/lib/github.com/ejrichards/mellon 24 - cp *.elv $out/share/elvish/lib/github.com/ejrichards/mellon 25 - ''; 26 - }; 27 - } 28 - ) 29 - // { 12 + let 13 + eachSystem = nixpkgs.lib.genAttrs (import systems); 14 + in 15 + { 16 + packages = eachSystem ( 17 + system: 18 + let 19 + pkgs = nixpkgs.legacyPackages.${system}; 20 + in 21 + { 22 + default = pkgs.stdenv.mkDerivation { 23 + name = "mellon"; 24 + src = ./.; 25 + installPhase = '' 26 + mkdir -p $out/share/elvish/lib/git.sr.ht/~ejri/mellon 27 + cp *.elv $out/share/elvish/lib/git.sr.ht/~ejri/mellon 28 + ''; 29 + }; 30 + } 31 + ); 32 + 30 33 nixosModules.default = 31 34 { pkgs, ... }: 32 35 { 33 - environment.systemPackages = [ self.packages.${pkgs.system}.default ]; 34 - environment.pathsToLink = [ "/share/elvish/lib/github.com/ejrichards" ]; 36 + environment.systemPackages = [ self.packages.${pkgs.stdenv.hostPlatform.system}.default ]; 37 + environment.pathsToLink = [ "/share/elvish/lib/git.sr.ht/~ejri" ]; 35 38 }; 36 39 }; 37 40 }