-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.aliases
68 lines (58 loc) · 1.86 KB
/
.aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/zsh
#git
alias gs='git status -s'
alias ga='git add -p'
alias gc='git commit -m'
alias gpush='git push'
alias gpull='git pull'
alias undo='reset soft HEAD^'
alias gwta='git worktree add'
alias gwtr='git worktree remove'
alias gwtl='git worktree list'
#docker
alias dcu='docker compose up -d'
alias dcuw='docker compose up' #w=watch (show logs)
alias dcd='docker compose down'
#general
alias :q="exit"
alias c="clear"
alias projects='nvim $(find $HOME/code -maxdepth 1 -type d | fzf)' #open projects folder
alias ls='exa -al --color=always --group-directories-first'
alias grep='grep --color=auto'
alias dot='cd $HOME/code/dotfiles/' #open dotfiles folder
alias nvimconfig='cd $HOME/code/dotfiles/.config/nvim/ && nvim' #open nvim config folder
#apt package manager
alias aptup='sudo apt update && sudo apt upgrade'
alias aptin='sudo apt install'
alias aptun='sudo apt uninstall'
#navigation
alias root='cd ~'
alias ..='cd ..'
alias ..2='cd ../../'
alias ..3='cd ../../../'
alias ..4='cd ../../../../'
alias ..5='cd ../../../../../'
#confirmations
alias mv='mv -i' #move file
alias cp='cp -i' #copy file
alias rm='rm -i' #delete file
alias ln='ln -i' #symlink file
#get tmux cheatsheet
alias tmuxch='check_and_clone_repo https://github.com/abdullahmorrison/tmux-cheatsheet'
# Function to check if a tmux-cheatsheet repo exists, clone if not, and cat tmux-cheatsheet.md
check_and_clone_repo() {
local code_dir="$HOME/code"
local repo_url="$1"
local repo_name="$(basename -s .git "$repo_url")"
local repo_path="$code_dir/$repo_name"
local readme_file="$repo_path/tmux-cheatsheet.md"
if [ ! -d "$repo_path" ]; then
echo "Repository not found in $code_dir. Cloning..."
git clone "$repo_url" "$repo_path"
fi
if [ -f "$readme_file" ]; then
cat "$readme_file"
else
echo "tmux-cheatsheet.md not found in the repository."
fi
}