Skip to content

Commit

Permalink
feat: Fixing starship prompt. 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
TechDufus committed Sep 16, 2024
1 parent 7006738 commit 113d413
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 31 deletions.
3 changes: 2 additions & 1 deletion roles/bash/files/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export OSH="$HOME/.oh-my-bash"

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-bash is loaded.
OSH_THEME="axin"
# OSH_THEME="axin"

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
Expand Down Expand Up @@ -180,3 +180,4 @@ if [[ -z "$TMUX" ]]; then
fi
#toilet "TechDufus" -F border:gay -f emboss2

eval "$(starship init bash)"
175 changes: 166 additions & 9 deletions roles/starship/files/starship.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,106 @@
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'

add_newline = false
# format = '$all$directory$character'

# GLOBAL FORMAT
format = """
$username\
$hostname\
$localip\
$shlvl\
$singularity\
$kubernetes\
$vcsh\
$fossil_branch\
$fossil_metrics\
${custom.giturl}\
$git_branch\
$git_commit\
$git_state\
$git_metrics\
$git_status\
$hg_branch\
$pijul_channel\
$docker_context\
$package\
$c\
$cmake\
$cobol\
$daml\
$dart\
$deno\
$dotnet\
$elixir\
$elm\
$erlang\
$fennel\
$gleam\
$golang\
$guix_shell\
$haskell\
$haxe\
$helm\
$java\
$julia\
$kotlin\
$gradle\
$lua\
$nim\
$nodejs\
$ocaml\
$opa\
$perl\
$php\
$pulumi\
$purescript\
$python\
$quarto\
$raku\
$rlang\
$red\
$ruby\
$rust\
$scala\
$solidity\
$swift\
$terraform\
$typst\
$vlang\
$vagrant\
$zig\
$buf\
$nix_shell\
$conda\
$meson\
$spack\
$memory_usage\
$aws\
$gcloud\
$openstack\
$azure\
$nats\
$direnv\
$env_var\
$crystal\
$sudo\
$cmd_duration\
$line_break\
$jobs\
$battery\
$time\
$status\
$os\
$container\
$shell\
$directory\
$character"""


# format = """$os$directory$character"""
# right_format = """$all"""

# Sets user-defined palette
# Palettes must be defined _after_ this line
palette = "catppuccin_latte"
Expand Down Expand Up @@ -126,7 +226,7 @@ mantle = "#181825"
crust = "#11111b"

[aws]
symbol = " "
symbol = ""

[buf]
symbol = ""
Expand All @@ -145,7 +245,8 @@ symbol = " "

[directory]
read_only = " 󰌾"
truncation_length = 4
truncation_length = 8
truncation_symbol = "…/"
style = "bold lavender"

[docker_context]
Expand All @@ -166,27 +267,52 @@ symbol = " "
[git_branch]
symbol = ""
style = "bold mauve"
format = '[$symbol$branch]($style) '

[git_metrics]
disabled = false

[git_status]
disabled = false
format = '[\($all_status$ahead_behind\)]($style) '
style = "bold green"
conflicted = "🏳"
up_to_date = ""
untracked = ""
ahead = "⇡${count}"
diverged = "⇕⇡${ahead_count}⇣${behind_count}"
behind = "⇣${count}"
stashed = ""
modified = ""
staged = '[++\($count\)](green)'
renamed = ""
deleted = ""

[golang]
symbol = " "
format = "[$version]($style) "

[gcloud]
disabled = true
symbol = "☁️"
format = '[$symbol$active]($style) '

[guix_shell]
symbol = " "
symbol = ""

[haskell]
symbol = " "
symbol = ""

[haxe]
symbol = " "
symbol = ""

[hg_branch]
symbol = " "
symbol = ""

[hostname]
ssh_symbol = ""
ssh_only = false
ssh_symbol = ""
format = '[$ssh_symbol(bold blue)[$hostname](bold blue)]($style) '
disabled = false

[java]
symbol = ""
Expand All @@ -198,9 +324,11 @@ symbol = " "
symbol = ""

[kubernetes]
format = '[⛵(($namespace@)$context)]($style) in '
# format = '[⛵(($namespace@)$context)]($style) in '
format = '[$symbol$context([\(](peach)$namespace[\)](peach))]($style) '
disabled = false


[lua]
symbol = ""

Expand Down Expand Up @@ -299,8 +427,37 @@ symbol = "󱘗 "
[scala]
symbol = ""

# [shell]
# disabled = true
# bash_indicator = ""
# zsh_indicator = "[](muave)"

[swift]
symbol = ""

[username]
format = '[$user]($style) [@](peach)'

[zig]
symbol = ""

[custom.giturl]
description = "Display symbol for remote Git server"
command = """
GIT_REMOTE=$(command git ls-remote --get-url 2> /dev/null)
if [[ "$GIT_REMOTE" =~ "github" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "gitlab" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "bitbucket" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "git" ]]; then
GIT_REMOTE_SYMBOL="󰊢 "
else
GIT_REMOTE_SYMBOL=" "
fi
echo "$GIT_REMOTE_SYMBOL"
"""
when = 'git rev-parse --is-inside-work-tree 2> /dev/null'
format = "$output "

4 changes: 2 additions & 2 deletions roles/starship/tasks/Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
- name: "Starship | {{ ansible_distribution }} | Install Starship"
ansible.builtin.command:
cmd: which starship
cmd: which starship
register: starship_installed
changed_when: false

- name: "Starship | {{ ansible_distribution }} | Install Starship"
when: starship_installed.rc != 0
ansible.builtin.shell:
cmd: curl -fsSL https://starship.rs/install.sh | sudo sh -s -- --force
cmd: set -o pipefail && curl -fsSL https://starship.rs/install.sh | sudo sh -s -- --force
args:
creates: /usr/local/bin/starship
7 changes: 0 additions & 7 deletions roles/zsh/files/.profile

This file was deleted.

19 changes: 13 additions & 6 deletions roles/zsh/files/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ COMPLETION_WAITING_DOTS="true"
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups


# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

Expand All @@ -86,6 +90,7 @@ plugins=(
podman
scala
ssh
starship
terraform
themes
timer
Expand All @@ -102,11 +107,11 @@ source $ZSH/oh-my-zsh.sh
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='nvim'
# fi
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nvim'
else
export EDITOR='nvim'
fi

# Compilation flags
# export ARCHFLAGS="-arch $(uname -m)"
Expand All @@ -123,6 +128,7 @@ source $ZSH/oh-my-zsh.sh
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"


if [[ -f "$HOME/.config/zsh/.zsh_private" ]]; then
source "$HOME/.config/zsh/.zsh_private"
fi
Expand All @@ -131,6 +137,8 @@ for file in $HOME/.config/zsh/*.zsh; do
source "$file"
done

bindkey '^R' history-incremental-search-backward

greetings="neofetch nerdfetch"
# if greeting bin exists, run it and stop evaluating the rest
if [[ -z "$TMUX" ]]; then
Expand All @@ -142,4 +150,3 @@ if [[ -z "$TMUX" ]]; then
done
fi

eval "$(starship init zsh)"
6 changes: 6 additions & 0 deletions roles/zsh/files/os/Ubuntu/os_functions.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env zsh

alias update='sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y'
if command -v task &> /dev/null; then
alias update='task -g upgrade'
fi
12 changes: 6 additions & 6 deletions roles/zsh/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
src: ".zshrc"
dest: "{{ ansible_user_dir }}/.zshrc"
mode: "0644"

- name: "Bash | Copy .profile"
ansible.builtin.copy:
src: ".profile"
dest: "{{ ansible_user_dir }}/.profile"
mode: "0644"
#
# - name: "Bash | Copy .profile"
# ansible.builtin.copy:
# src: ".profile"
# dest: "{{ ansible_user_dir }}/.profile"
# mode: "0644"

- name: "ZSH | Copy custom zsh config"
ansible.builtin.copy:
Expand Down

0 comments on commit 113d413

Please sign in to comment.