Skip to content

Instantly share code, notes, and snippets.

@fcsest
Last active July 19, 2022 19:15
Show Gist options
  • Save fcsest/39034873db1bc9536d99bd3f4c51b85b to your computer and use it in GitHub Desktop.
Save fcsest/39034873db1bc9536d99bd3f4c51b85b to your computer and use it in GitHub Desktop.
My fish shell config for ArchWSL.
#------------------------------------------------------------------------------#
# Remove start message
set fish_greeting
#------------------------------------------------------------------------------#
# WSL Setttings
set -gx DISPLAY $(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0
set -gx LIBGL_ALWAYS_INDIRECT 1
#------------------------------------------------------------------------------#
# Docker Settings
set -gx DOCKER_BUILDKIT 1
function docker-reset
docker system prune -a --volumes
end
#------------------------------------------------------------------------------#
# Ngrok Settings
function ngrok-start
sudo systemctl restart sshd.service
echo "Start ssh-access ngrok in background..."
nohup ngrok start ssh-access &>/dev/null &
echo "Extracting ngrok port..."
while [ -z "$NGROK_PUBLIC_URL" ];
sleep 1sec
# Run 'curl' against ngrok API and extract public (using 'sed' command)
set NGROK_PUBLIC_URL = $(curl --silent --max-time 10 --connect-timeout 5 \
--show-error http://127.0.0.1:4040/api/tunnels | \
sed -nE 's/.*ngrok.i..([^"]*).*/\1/p')
end
echo "ngrok port => $NGROK_PUBLIC_URL"
end
function ngrok-stop
echo "Stopping background ngrok process..."
sudo kill -9 $(ps -ef | grep 'ngrok' | grep -v 'grep' | awk '{print $2}')
echo "ngrok stopped"
end
#------------------------------------------------------------------------------#
# Rust Settings
set -gx PATH $PATH /home/fcsest/.cargo/bin
# Rust functions aliases
alias cat="bat --style=auto"
alias du="dust"
alias find="fd"
alias grep="ripgrep"
alias ls="exa --icons -la"
alias ps="procs --sortd cpu"
alias tldr="tealdeer"
#------------------------------------------------------------------------------#
# TMUX Settings
set -gx DISABLE_AUTO_TITLE true
# TMUX Functions
function tmux-start
tmux new-session -d -s $USER >/dev/null
tmux rename-window -t $USER:1 'monitoring'
tmux splitw -h -p 36 -t $USER:1.1
tmux send-keys -t $USER:1.1 'htop' Enter
tmux send-keys -t $USER:1.2 'ytop' Enter
tmux select-pane -t $USER:1.1
tmux new-window -t $USER
tmux rename-window -t $USER:2 'docker'
tmux splitw -v -p 64 -t $USER:2.1
tmux send-keys -t $USER:2.1 'docker-start' Enter
tmux send-keys -t $USER:2.2 'docker ps'
tmux select-pane -t $USER:2.2
tmux new-window -t $USER
tmux rename-window -t $USER:3 'terminals'
tmux select-pane -t $USER:3.1
tmux attach -t $USER
end
function tmux-stop
tmux kill-server
end
#------------------------------------------------------------------------------#
# Others settings
# ASDF fish settings
source /opt/asdf-vm/asdf.fish
# Set default editor and term as VSCode
if status is-interactive
set -gx EDITOR code
set -gx TERM_PROGRAM vscode
end
# Aliases for arch update
alias updt="sudo pacman -Syyuu"
alias updty="sudo pacman -Syyuu --noconfirm"
# TimeZone Config
set -gx TZ America/Sao_Paulo
# Environment variables
set -gx GITHUB_PAT ''
#------------------------------------------------------------------------------#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment