174 lines
3.8 KiB
Bash
Executable File
174 lines
3.8 KiB
Bash
Executable File
# Aliases
|
||
alias vim="nvim"
|
||
alias nv="nvim"
|
||
|
||
alias nig="dig"
|
||
|
||
alias eza='eza'
|
||
alias ls='eza -lh --group-directories-first --icons'
|
||
alias lsn='eza'
|
||
|
||
# Quicker navigation
|
||
alias ..="cd .."
|
||
alias ...="cd ../.."
|
||
alias ....="cd ../../.."
|
||
alias .....="cd ../../../.."
|
||
|
||
# Enable aliases to be sudo’ed
|
||
alias sudo='sudo '
|
||
|
||
# Install and remove packages
|
||
alias install="sudo apt install -y"
|
||
|
||
# Config files
|
||
alias kittyc="nvim ~/.config/kitty"
|
||
alias helixc="nvim ~/.config/helix"
|
||
alias starc="nvim ~/.config/starship.toml"
|
||
|
||
function nvimc() {
|
||
cd "~/.config/nvim"
|
||
nvim .
|
||
}
|
||
|
||
# Git
|
||
# You must install Git first
|
||
alias gs='git status'
|
||
alias ga='git add -A'
|
||
alias gc='git commit -m' # requires you to type a commit message
|
||
alias grm='git rm $(git ls-files --deleted)'
|
||
alias gb="git checkout -b"
|
||
|
||
function commit() {
|
||
git add .
|
||
git commit -m "$1"
|
||
}
|
||
|
||
function push() {
|
||
branch=$(parse_git_branch)
|
||
git push -u origin "$branch"
|
||
}
|
||
|
||
# # Git branch details
|
||
function parse_git_dirty() {
|
||
[[ $(git status 2>/dev/null | tail -n1) != *"working directory clean"* ]]
|
||
}
|
||
function parse_git_branch() {
|
||
git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
|
||
}
|
||
|
||
# Docker aliases
|
||
alias dc="docker-compose"
|
||
alias bx="docker buildx"
|
||
alias de="docker exec -it"
|
||
alias dub="docker compose up -d --build"
|
||
alias dup="docker-compose up"
|
||
alias dwn="docker-compose down"
|
||
alias da="docker_artisan"
|
||
|
||
# Laravel & php
|
||
alias a="php artisan"
|
||
|
||
# Convenience
|
||
alias ep="nvim ~/.bash_profile"
|
||
alias rp="source ~/.bashrc && clear"
|
||
alias edithosts="nvim /etc/hosts"
|
||
alias cls="clear"
|
||
alias editpath="nvim /etc/paths"
|
||
alias home="cd ~"
|
||
alias projects="cd ~/projects"
|
||
alias co="code ."
|
||
alias locl="cd ~/Sites/local"
|
||
alias cdpl="cd deploy/local"
|
||
alias clipboard="xclip -selection clipboard"
|
||
|
||
# Laravel sail
|
||
alias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
|
||
alias sup="sail up -d"
|
||
alias sd="sail down"
|
||
alias sa="sail artisan"
|
||
alias sc="sail composer"
|
||
alias st="sail test"
|
||
alias stf="sail composer tf"
|
||
alias rebuild="sail down && sail build --no-cache && sail up -d"
|
||
|
||
# Temp
|
||
alias smp="sa migrate:rollback && sa migrate && clear && sa db:seed --class=SimpleMapSeeder"
|
||
alias stackartisan="docker exec -it stack-ems php /usr/src/myapp/artisan"
|
||
|
||
# Jigsaw
|
||
alias jig="vendor/bin/jigsaw"
|
||
|
||
# Golang
|
||
alias gr="go run ."
|
||
alias gmt="go mod tidy"
|
||
|
||
# Open something in the projects folder
|
||
function o() {
|
||
cd "$HOME/projects/$1"
|
||
}
|
||
|
||
function proj() {
|
||
lsn -ld ~/projects/* --color=never |
|
||
awk '{print $7}' |
|
||
fzf --reverse | xargs -I{} code {} -n && exit
|
||
}
|
||
|
||
function makepasswd() {
|
||
openssl rand -base64 16 | clipboard
|
||
echo "Password copied to clipboard"
|
||
}
|
||
|
||
function mountnewshares() {
|
||
sudo systemctl daemon-reload
|
||
sudo mount -a
|
||
}
|
||
|
||
function makerole() {
|
||
mkdir -p "roles/$1/tasks"
|
||
mkdir -p "roles/$1/defaults"
|
||
touch "roles/$1/tasks/main.yml"
|
||
touch "roles/$1/defaults/main.yml"
|
||
}
|
||
|
||
function pyvenv() {
|
||
python3 -m venv .venv
|
||
source .venv/bin/activate
|
||
}
|
||
|
||
function newsshkey() {
|
||
KEY_NAME="id_ed25519_$1"
|
||
KEY_PATH="$HOME/.ssh/$KEY_NAME"
|
||
ssh-keygen -t ed25519 -C "$1" -f "$KEY_PATH" -N ""
|
||
ssh-add "$KEY_PATH"
|
||
echo "Key created and added"
|
||
echo "Key: $KEY_NAME"
|
||
echo "Saved to: $KEY_PATH"
|
||
}
|
||
|
||
function listsshkeys() {
|
||
ls "$HOME/.ssh"
|
||
}
|
||
|
||
function copypublickey() {
|
||
KEY_NAME="$1"
|
||
KEY_PATH="$HOME/.ssh/$KEY_NAME"
|
||
cat "$KEY_PATH.pub" | clipboard
|
||
echo "Key copied to clipboard"
|
||
}
|
||
|
||
eval "$(starship init bash)"
|
||
. "$HOME/.cargo/env"
|
||
|
||
# Add composer global bin
|
||
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
|
||
export PATH="$PATH:$HOME/go/bin"
|
||
export PATH="$PATH:/usr/local/go/bin"
|
||
export PATH="$PATH:$HOME/.config/herd-lite/bin"
|
||
|
||
# Created by `pipx` on 2025-06-17 18:51:39
|
||
export PATH="$PATH:/home/javi/.local/bin"
|
||
|
||
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
|