dotfiles/.config/rash/rashrc.rkt

22 lines
703 B
Racket

#lang rash
(require
racket/port
rash/private/rashrc-lib
readline/pread)
(provide nv)
(current-prompt-function
(λ (#:last-return-value retval
#:last-command-duration duration)
(unless (void? retval)
(display ((current-rash-top-level-print-formatter) retval)))
(parameterize ([current-environment-variables (environment-variables-copy (current-environment-variables))])
(putenv "MZPROMPT_STATUS" (if (exn:fail? retval) "1" "0"))
(putenv "MZPROMPT_FISH_MODE" "insert")
(putenv "MZPROMPT_DURATION" (number->string duration))
(putenv "MZPROMPT_JOBS" "0")
(readline-prompt #{prompt show |> port->bytes}))))
(define-simple-pipeline-alias nv nvim)