Skip to content

Instantly share code, notes, and snippets.

@deverebor
Last active May 2, 2023 13:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deverebor/3f5164871377f78f4b704dd6099d473b to your computer and use it in GitHub Desktop.
Save deverebor/3f5164871377f78f4b704dd6099d473b to your computer and use it in GitHub Desktop.
ZSH + Starshipt +Terminal - Personal settings

Plugins

  • Oh my zsh
  • zinit
  • Autosuggestion
  • SyntaxHgihlight
  • Globalsearch - fzf
  • zsh-z

Dependencies

  • sudo apt-get install ruby-full
  • pyenv

Theme

How will the end result be?

image

# ~/.config/starship.toml
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
add_newline = true
[character]
success_symbol = "[❯ ](bold green)"
error_symbol = "[❯ ](bold red)"
[os]
disabled = false
# format = "[](fg:blue)[$symbol](bg:blue fg:black)[](fg:blue)"
format = "$symbol"
[os.symbols]
Arch = "[ ](fg:bright-blue)"
Debian = "[ ](fg:red)"
EndeavourOS = "[ ](fg:purple)"
Fedora = "[ ](fg:blue)"
NixOS = "[ ](fg:bright-white)"
openSUSE = "[ ](fg:green)"
SUSE = "[ ](fg:green)"
[directory]
format = "[](fg:bright-black)[$path](bg:bright-black fg:white)[](fg:bright-black) "
read_only = "  "
truncation_length = 4
truncation_symbol = "~/…/"
truncate_to_repo = true
[directory.substitutions]
"Documents" = " "
"Downloads" = " "
"Music" = " "
"Pictures" = " "
"Videos" = " "
"Projects" = "󱌢 "
"School" = "󰑴 "
"www" = ""
".config" = " "
[git_branch]
symbol = ""
style = "bg:bright-black fg:white"
format = "[](fg:bright-black)[on $symbol$branch(:$remote_branch)]($style)[](fg:bright-black) "
truncation_length = 20
[docker_context]
symbol = " "
format = "via [$symbol$context]($style) "
style = "blue bold"
only_with_files = true
detect_files = ["docker-compose.yml", "docker-compose.yaml", "Dockerfile"]
detect_folders = []
disabled = false
[java]
symbol = " "
[python]
symbol = ""
format = 'via [${symbol}(\($virtualenv\) )]($style)'
style = "bold yellow"
pyenv_prefix = "venv "
python_binary = ["./venv/bin/python", "python", "python3", "python2"]
detect_extensions = ["py"]
version_format = "v${raw}"
[ruby]
disabled = true
style = "bold red"
format = " via [$symbol]($style)"
[nodejs]
detect_files = ["package.json", ".node-version"]
detect_folders = ["node_modules"]
symbol = " "
style = "bold yellow"
format = "via [$symbol]($style)"
[package]
disabled = true
[aws]
disabled = true
format = 'on [$symbol$region]($style) '
style = 'bold yellow'
symbol = '☁️ '
[aws.region_aliases]
ap-southeast-2 = ' (au-2)'
us-east-1 = ' (ue-1)'
# @author: deverebor
# @version: 2.5
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
ZSH_THEME=""
# Which plugins would you like to load?
plugins=(git zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
### Added by Zinit's installer
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
print -P "%F{33} %F{34}Installation successful.%f%b" || \
print -P "%F{160} The clone has failed.%f%b"
fi
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
zdharma-continuum/zinit-annex-as-monitor \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-patch-dl \
zdharma-continuum/zinit-annex-rust \
zdharma-continuum/fast-syntax-highlighting
### End of Zinit's installer chunk
zinit load agkozak/zsh-z
### Aliases
alias ll="colorls -1"
alias zshrc="code ~/.zshrc"
alias ohmyzshrc="code ~/.oh-my-zsh"
alias gitconfig="code ~/.gitconfig"
alias sstoml="code ~/.config/starship.toml"
### Custom scripts
# This loads nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# This loads Pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
# This loads colorls
source $(dirname $(gem which colorls))/tab_complete.sh
#This load yarn in shell
export PATH="$(yarn global bin):$PATH"
# Personal SpaceShip config
# SPACESHIP_PROMPT_ORDER=(
# line_sep # Line break
# time # Time stampts section
# user # Username section
# dir # Current directory section
# host # Hostname section
# git # Git section (git_branch + git_status)
# hg # Mercurial section (hg_branch + hg_status)
# node # Node.js section
# ruby # Ruby section
# python # Python section
# java # Java section
# docker # Docker section
# venv # virtualenv section
# conda # conda virtualenv section
# jobs # Background jobs indicator
# exit_code # Exit code section
# char # Prompt character
# )
# SPACESHIP_USER_SHOW=always
# SPACESHIP_PROMPT_ADD_NEWLINE=false
# SPACESHIP_USER_PREFIX=
# SPACESHIP_DOCKER_SHOW=true
# Function for create venv
function cvenv {
if $1
then python3 -m venv .venv
source .venv/bin/activate
else
python -m venv .venv
source .venv/bin/activate
fi
}
# Function to enter into a venv
function venv {
source .venv/bin/activate
}
eval "$(starship init zsh)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment