Skip to content

Instantly share code, notes, and snippets.

@daog1
Forked from Bwc9876/bootstrap.sh
Created August 31, 2023 00:29
Show Gist options
  • Save daog1/751288f58adae6cd28bb8464645d5f61 to your computer and use it in GitHub Desktop.
Save daog1/751288f58adae6cd28bb8464645d5f61 to your computer and use it in GitHub Desktop.
NuShell Bootstrap
# Bootstraps all tools
cargo install nu ripgrep starship bat
export PATH="$PATH:~/.cargo/bin"
NU_VERSION=$(nu --version)
CONF_PATH=$(nu -c "echo \$nu.config-path")
ENV_PATH=$(nu -c "echo \$nu.env-path")
CONF_DIR=$(dirname "$CONF_PATH")
cd $CONF_DIR
wget https://raw.githubusercontent.com/nushell/nushell/$NU_VERSION/crates/nu-utils/src/sample_config/default_env.nu -O $CONF_DIR/env.nu
wget https://raw.githubusercontent.com/nushell/nushell/$NU_VERSION/crates/nu-utils/src/sample_config/default_config.nu -O $CONF_DIR/config.nu
wget https://gist.github.com/Bwc9876/0593c32becd3611dfba802e2b0fc2a51/raw/86171a4920b425c34e1b138d7c2f59b39d2ae1fb/custom_config.nu -O $CONF_DIR/custom_config.nu
wget https://gist.github.com/Bwc9876/0593c32becd3611dfba802e2b0fc2a51/raw/86171a4920b425c34e1b138d7c2f59b39d2ae1fb/custom_env.nu -O $CONF_DIR/custom_env.nu
echo "source $CONF_DIR/custom_config.nu" >> config.nu
echo "source $CONF_DIR/custom_env.nu" >> env.nu
cd ~/.config
wget https://gist.githubusercontent.com/Bwc9876/0593c32becd3611dfba802e2b0fc2a51/raw/86171a4920b425c34e1b138d7c2f59b39d2ae1fb/starship.toml -O ~/.config/starship.toml
# Custom configuration for nushell, place
# Place this file in your ~/.config/nushell folder then place this line near the bottom of config.nu:
# source ~/.config/nushell/custom_config.nu
# Config
$env.config.show_banner = false
$env.config.buffer_editor = "nvim"
# Starship Initialization
source ~/.cache/starship/init.nu
# Custom configuration for nushell, place
# Place this file in your ~/.config/nushell folder then place this line near the bottom of env.nu:
# source ~/.config/nushell/custom_env.nu
# PATH
let-env PATH = ($env.PATH | split row (char esep) | prepend "~/.cargo/bin" )
# Aliases
alias py = python
alias cat = bat
alias vim = nvim
# Starship Setup
mkdir ~/.cache/starship
if ( not ("~/.cache/starship/init.nu" | path exists) ) {
starship init nu | save -f ~/.cache/starship/init.nu
}
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
format = """
[░▒▓](grey)[ \
$os\
$hostname\
$username\
[](bg:grey #999999)\
$directory\
([](bg:grey #999999)\
$git_branch\
$git_commit\
$git_state)\
([](bg:grey #999999)\
$package\
$nodejs\
$python\
$rust)](bg:grey)\
[ ](grey)"""
right_format = """
[ ](grey)
($character$status[](bg:grey #999999))
($cmd_duration[](bg:grey #999999))\
$time\
[▓▒░](grey)
"""
palette = "main"
add_newline = false
[palettes.main]
grey = "#303030"
lightgrey = "#e5e5e5"
header = "blue"
footer = "green"
[line_break]
disabled = true
[hostname]
format = "[$hostname( $ssh_symbol) ]($style)"
ssh_only = false
ssh_symbol = ""
style = "bold header bg:grey"
[username]
format = "[$user ]($style)"
style_user = "header bg:grey"
style_root = "bold red bg:grey"
show_always = true
[os]
style = "bg:grey bold lightgrey"
disabled = false
format = "[$symbol ]($style)"
[os.symbols]
Raspbian = ""
Debian = ""
Macos = ""
Linux = ""
Windows = ""
Ubuntu = ""
Manjaro = ""
Android = ""
[directory]
truncation_length = 10
truncate_to_repo = true
home_symbol = ""
read_only = ""
style = "bold footer bg:grey"
format = "[ ($read_only )$path ]($style)"
[git_branch]
symbol = ""
style = "bg:grey footer"
format = '[ $symbol ($branch )]($style)'
[git_status]
conflicted = ""
modified = ""
style = "bg:grey footer"
format = '[$all_status $ahead_behind ]($style)'
[nodejs]
symbol = ""
style = "bg:grey footer"
format = '[ $symbol ($version) ]($style)'
[python]
symbol = ""
style = "bg:grey footer"
format = '[ $symbol ($version) ]($style)'
[rust]
symbol = ""
style = "bg:grey footer"
format = '[ $symbol ($version) ]($style)'
[character]
disabled = false
success_symbol = "[](bold footer bg:grey)"
error_symbol = "[](bold red bg:grey)"
format = "[ $symbol ](bg:grey)"
[status]
disabled = false
style = "bg:grey red"
format = "[$status ]($style)"
[cmd_duration]
disabled = false
min_time = 2000
style = "bg:grey header"
format = "[ $duration  ]($style)"
[time]
disabled = false
use_12hr = true
time_format = "%a %b %e %I:%M %p "
style="bg:grey bold header"
format = "[ $time ]($style)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment