Home

dotnix @ede75c9471a02bd4c76e47a84b55358ddb9e7c04 - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
dotnix / home / nogui / nushell / autoload / scratch.nu
- raw -
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
module scratch {
  # Make a throwaway buffer
  export def --env main [
    --description(-d): string         # Optional filename description for identifying
    extension?:        string = "txt" # File extension (for highlighting)
  ]: nothing -> nothing {
    mut name = "tmp"
    if $description != null {
      $name = $description
    }
    let tmp = mktemp --tmpdir --suffix $".($extension)" $"($name).XXX"
    ^$env.EDITOR $tmp
  }
}
use scratch *