Skip to content

Commit

Permalink
~ nu home path
Browse files Browse the repository at this point in the history
  • Loading branch information
oluceps committed Mar 6, 2024
1 parent e84ee08 commit e15679a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion home/programs/nu/env.nu
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ $env.NU_PLUGIN_DIRS = [

def create_prompt [p] {
let gold = {fg: '#f1c4cd'}
$'(ansi blue)(pwd) (ansi reset)(ansi --escape $gold)(do -i {git rev-parse --abbrev-ref HEAD } | str trim | str join)(ansi reset)(char newline)(ansi cyan)($p)(ansi reset)'
let home = $env.HOME | str trim
let in_home = pwd | str starts-with $home
let path = if $in_home {
pwd | str replace $home '~'
}
$'(ansi blue)($path) (ansi reset)(ansi --escape $gold)(do -i {git rev-parse --abbrev-ref HEAD } | str trim | str join)(ansi reset)(char newline)(ansi cyan)($p)(ansi reset)'
}


Expand Down

0 comments on commit e15679a

Please sign in to comment.