f2728990
—
Peter John 10 months ago
changes
- nushell/env.nu +3 -60
- setup.sh +1 -4
nushell/env.nu
CHANGED
|
@@ -1,63 +1,3 @@
|
|
|
1
|
-
# Nushell Environment Config File
|
|
2
|
-
#
|
|
3
|
-
# version = "0.100.0"
|
|
4
|
-
|
|
5
|
-
def create_left_prompt [] {
|
|
6
|
-
let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) {
|
|
7
|
-
null => $env.PWD
|
|
8
|
-
'' => '~'
|
|
9
|
-
$relative_pwd => ([~ $relative_pwd] | path join)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
|
|
13
|
-
let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold })
|
|
14
|
-
let path_segment = $"($path_color)($dir)(ansi reset)"
|
|
15
|
-
|
|
16
|
-
$path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)"
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
def create_right_prompt [] {
|
|
20
|
-
# create a right prompt in magenta with green separators and am/pm underlined
|
|
21
|
-
let time_segment = ([
|
|
22
|
-
(ansi reset)
|
|
23
|
-
(ansi magenta)
|
|
24
|
-
(date now | format date '%x %X') # try to respect user's locale
|
|
25
|
-
] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" |
|
|
26
|
-
str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}")
|
|
27
|
-
|
|
28
|
-
let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([
|
|
29
|
-
(ansi rb)
|
|
30
|
-
($env.LAST_EXIT_CODE)
|
|
31
|
-
] | str join)
|
|
32
|
-
} else { "" }
|
|
33
|
-
|
|
34
|
-
([$last_exit_code, (char space), $time_segment] | str join)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
# Use nushell functions to define your right and left prompt
|
|
38
|
-
$env.PROMPT_COMMAND = {|| create_left_prompt }
|
|
39
|
-
# FIXME: This default is not implemented in rust code as of 2023-09-08.
|
|
40
|
-
$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
|
|
41
|
-
|
|
42
|
-
# The prompt indicators are environmental variables that represent
|
|
43
|
-
# the state of the prompt
|
|
44
|
-
$env.PROMPT_INDICATOR = {|| "> " }
|
|
45
|
-
$env.PROMPT_INDICATOR_VI_INSERT = {|| ": " }
|
|
46
|
-
$env.PROMPT_INDICATOR_VI_NORMAL = {|| "> " }
|
|
47
|
-
$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " }
|
|
48
|
-
|
|
49
|
-
# If you want previously entered commands to have a different prompt from the usual one,
|
|
50
|
-
# you can uncomment one or more of the following lines.
|
|
51
|
-
# This can be useful if you have a 2-line prompt and it's taking up a lot of space
|
|
52
|
-
# because every command entered takes up 2 lines instead of 1. You can then uncomment
|
|
53
|
-
# the line below so that previously entered commands show with a single `🚀`.
|
|
54
|
-
# $env.TRANSIENT_PROMPT_COMMAND = {|| "🚀 " }
|
|
55
|
-
# $env.TRANSIENT_PROMPT_INDICATOR = {|| "" }
|
|
56
|
-
# $env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = {|| "" }
|
|
57
|
-
# $env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = {|| "" }
|
|
58
|
-
# $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = {|| "" }
|
|
59
|
-
# $env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| "" }
|
|
60
|
-
|
|
61
1
|
# Specifies how environment variables are:
|
|
62
2
|
# - converted from a string to a value on Nushell startup (from_string)
|
|
63
3
|
# - converted from a value back to a string when running external commands (to_string)
|
|
@@ -92,4 +32,7 @@ $env.PROMPT_INDICATOR = $"(ansi y)$> (ansi reset)"
|
|
|
92
32
|
use std "path add"
|
|
93
33
|
$env.PATH = ($env.PATH | split row (char esep))
|
|
94
34
|
path add /opt/homebrew/bin
|
|
35
|
+
path add /opt/homebrew/opt/openjdk/bin
|
|
36
|
+
path add /opt/homebrew/opt/ruby/bin
|
|
95
37
|
path add ~/.cargo/bin
|
|
38
|
+
path add ~/Library/Android/sdk/platform-tools/
|
setup.sh
CHANGED
|
@@ -7,12 +7,9 @@ brew --cask install visual-studio-code android-studio intellij-idea iterm2 googl
|
|
|
7
7
|
mas install 497799835 # installs xcode
|
|
8
8
|
echo /opt/homebrew/bin/nu | sudo tee -a /etc/shells
|
|
9
9
|
chsh -s /opt/homebrew/bin/nu
|
|
10
|
-
fish_add_path /opt/homebrew/opt/openjdk/bin
|
|
11
|
-
fish_add_path /opt/homebrew/opt/ruby/bin
|
|
12
|
-
fish_add_path ~/Library/Android/sdk/platform-tools/
|
|
13
10
|
launchctl setenv PATH /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin
|
|
14
11
|
launchctl setenv XDG_CONFIG_HOME /Users/pyrossh/Code/pyrossh/config
|
|
15
12
|
launchctl setenv JAVA_HOME "/opt/homebrew/opt/openjdk"
|
|
16
13
|
launchctl setenv ANDROID_HOME ~/Library/Android/sdk
|
|
17
14
|
launchctl setenv EDITOR hx
|
|
18
|
-
git config --global --add --bool push.autoSetupRemote true
|
|
15
|
+
git config --global --add --bool push.autoSetupRemote true
|