Add Starship tip

This commit is contained in:
Jake 2021-04-05 09:59:01 +00:00
parent d37bddb161
commit 2d100c06fe
1 changed files with 67 additions and 0 deletions

67
tips/starship.md Normal file
View File

@ -0,0 +1,67 @@
---
title: Starship Prompt
date: 2021-04-05
description: Pimp your shell prompt!
---
[Starship](https://starship.rs/) is an awesome little program that makes your shell look much cooler without much effort.
## Install
As we are working on a pubnix, we can't install things globally so instead of following the instructions on the Starship site follow these instead.
First up, we need to make somewhere to install our local programs, so let's make a folder for that at `~/.local/bin`.
```bash
mkdir -p ~/.local/bin
```
Now we can download the Starship install script like so.
```bash
wget https://starship.rs/install.sh
```
Before we use this script, we _should_ inspect it to make sure nothing nasty is happening. After doing that, we can set the permissions on it so that we can run it and install it to our new bin folder.
```bash
chmod +x ./install.sh
./install.sh --bin-dir ~/.local/bin
```
Finally, we need to tell our shell to load this prompt, so we can do that by adding the following line to the **bottom** of your `~/.bashrc` file like so.
```bash
# other stuff...
eval "$(starship init bash)"
```
Now you can either logout and back in to see the changes, or you can run `source ~/.bashrc`.
## Customize
Starship makes a big difference by itself, but I like to turn off some of the fancy features and change the settings slightly to keep it minimal. You can do this by editing the file at `~/.config/starship.toml`. You can see all of the configuration options [here](https://starship.rs/config/), but this is what I like:
```toml
add_newline = false
format = """$username\
$hostname\
$directory\
$git_branch\
$git_commit\
$git_state\
$git_status\
$character
"""
[character]
success_symbol = "[➜](bold green)"
error_symbol = "[➜](bold red)"
[username]
format = "[$user]($style)"
[hostname]
format = ":[$hostname]($style) "
```