Skip to content

Instantly share code, notes, and snippets.

@featuriz
Last active January 26, 2025 18:07
Show Gist options
  • Save featuriz/d5891ce6d7d42829967a371bbb577596 to your computer and use it in GitHub Desktop.
Save featuriz/d5891ce6d7d42829967a371bbb577596 to your computer and use it in GitHub Desktop.
Fish shell config to read from .env file
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
eval "$(starship init bash)"
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '
###
# PERSONAL CUSTOMIZATION : START
#
eval "$(starship init bash)"
###
# FISH: check its config.fish
# .env file is nin same dir
FROMENV=''
while IFS="=" read -r key value; do
case "$key" in
'#'*) ;;
*)
# echo "Key: $key"
# echo "Value: $value"
FROMENV+=":$value"
esac
done < .env
# echo "$FROMENV"
PATH=$PATH$FROMENV
NODEJS=/opt/node-v22.11.0-linux-x64/bin
GO=/home/sud/go/bin
PNPM=/home/sud/.local/share/pnpm
# $HOME/.config/alacritty/alacritty.toml
# by Rito Ghosh 2023-10-06
# Alacritty now uses TOML formatting for its config files.
# This is a simple example.
# There are the specification here: https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd
# It is not obvious how it translates to TOML. But it is extremely straightforward.
# example: WINDOW, COLORS, etc. are tables, and should be represented as [window], [colors], respectively.
# specifics of variables go under them. e.g.- look under "dynamic_padding" under-
# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd#window
# write `dynamic_padding = true` (without backticks -`) under the table [window]
# for variables with multiple values, use "dotted keys". Like setting `padding.x = 5` under [window].
# This is simple. If not clear, do several trials and errors.
# Below is my initial set-up. The TOML homepage (https://toml.io/en/v1.0.0) was very helpful in figuring this out.
# I put the file alacritty.toml in $HOME/.config/alacritty. However it can be kept anywhere among the places mentioned in
# https://github.com/alacritty/alacritty/tree/master#configuration
[general]
import = [
"~/.config/alacritty/themes/github_dark_high_contrast.toml"
]
[window]
opacity = 0.8
padding.x = 10
padding.y = 10
decorations = "Full"
decorations_theme_variant = "Dark" # "Dark"
[font]
normal.family = "Cascadia Mono"
bold.style = "Bold"
italic.style = "Italic"
bold_italic.style = "Bold Italic"
size = 12.0
#[debug]
#highlight_damage = true
# Tip: for inspiration, look for values in the source code files of your favorite VS Code themes, and use the color picker in
# Google to test colors before setting a value, or simply using an editor such as VS Code where colors are displayed in a
# small box when a HEX is detected by the editor.
starship init fish | source
set fish_greeting
alias cls='clear'
alias fishy='nano /home/sud/.config/fish/config.fish'
##
# .env filse is not in this dir. Thats why calling ~/.env
# /home/sud/.env
##
function envsource
# echo "Setting Environment variable from:: ~/.env"
set -f envfile "$argv"
if not test -f "$envfile"
echo "Unable to load $envfile"
return 1
end
while read line
if not string match -qr '^#|^$' "$line"
set item (string split -m 1 '=' $line)
set -gx $item[1] $item[2]
if test -n "\$$item[2]"
set -gx PATH $item[2] $PATH
end
#echo "Exported key $item[1] = $item[2]"
end
end < "$envfile"
end
envsource ~/.env
[colors.bright]
black = "0x9ea7b3"
blue = "0x91cbff"
cyan = "0x39c5cf"
green = "0x4ae168"
magenta = "0xcb9eff"
red = "0xffb1af"
white = "0xd9dee3"
yellow = "0xf7c843"
[colors.cursor]
cursor = "0xf0f3f6"
text = "0x0a0c10"
[colors.normal]
black = "0x7a828e"
blue = "0x00FFFF"
cyan = "0x39c5cf"
green = "0x26cd4d"
magenta = "0xcb9eff"
red = "0xff9492"
white = "0xd9dee3"
yellow = "0xf0b72f"
[colors.primary]
background = "0x0a0c10"
foreground = "0xf0f3f6"

#Fish shell config to read .env file

Here, with a function, fish shell will read the .env file from home dir and set it to PATH

Also this helps for others too.

  • Here bash also uses the same .env file.
  • It too have a function to convert .env file values to PATH

GRUB THEME

GNOME

  • At Gnome Tweaks
  • Fonts
    • Interface Text : Segoe UI Variable @opsz=11
    • Document Text : Noto Serif
    • Monospace Text : Droid Sans Mono

Terminal: Cascadia Mono

add_newline = true
format = """
[[](fg:#DF0000)]() $all\
$character"""
right_format = """
$time"""
[aws]
symbol = ""
[buf]
symbol = ""
[c]
symbol = ""
[conda]
symbol = ""
[crystal]
symbol = ""
[dart]
symbol = ""
[directory]
read_only = " 󰌾"
[docker_context]
symbol = ""
[elixir]
symbol = ""
[elm]
symbol = ""
[fennel]
symbol = ""
[fossil_branch]
symbol = ""
[git_branch]
symbol = ""
[git_commit]
tag_symbol = ''
[golang]
symbol = ""
[guix_shell]
symbol = ""
[haskell]
symbol = ""
[haxe]
symbol = ""
[hg_branch]
symbol = ""
[hostname]
ssh_symbol = ""
[java]
symbol = ""
[julia]
symbol = ""
[kotlin]
symbol = ""
[lua]
symbol = ""
[memory_usage]
symbol = "󰍛 "
[meson]
symbol = "󰔷 "
[nim]
symbol = "󰆥 "
[nix_shell]
symbol = ""
[nodejs]
symbol = ""
[ocaml]
symbol = ""
[os.symbols]
Alpaquita = ""
Alpine = ""
AlmaLinux = ""
Amazon = ""
Android = ""
Arch = ""
Artix = ""
CentOS = ""
Debian = ""
DragonFly = ""
Emscripten = ""
EndeavourOS = ""
Fedora = ""
FreeBSD = ""
Garuda = "󰛓 "
Gentoo = ""
HardenedBSD = "󰞌 "
Illumos = "󰈸 "
Kali = ""
Linux = ""
Mabox = ""
Macos = ""
Manjaro = ""
Mariner = ""
MidnightBSD = ""
Mint = ""
NetBSD = ""
NixOS = ""
OpenBSD = "󰈺 "
openSUSE = ""
OracleLinux = "󰌷 "
Pop = ""
Raspbian = ""
Redhat = ""
RedHatEnterprise = ""
RockyLinux = ""
Redox = "󰀘 "
Solus = "󰠳 "
SUSE = ""
Ubuntu = ""
Unknown = ""
Void = ""
Windows = "󰍲 "
[package]
symbol = "󰏗 "
[perl]
symbol = ""
[php]
symbol = ""
[pijul_channel]
symbol = ""
[python]
symbol = ""
[rlang]
symbol = "󰟔 "
[ruby]
symbol = ""
[rust]
symbol = "󱘗 "
[scala]
symbol = ""
[swift]
symbol = ""
[zig]
symbol = ""
[gradle]
symbol = ""
[time]
disabled = false
time_format = "%T" # Hour:Minute Format
style = "bg:#1d2230"
format = '[[  $time ](fg:#DF00FF bg:#1d2230)]($style)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment