-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
167 lines (136 loc) · 5.96 KB
/
.zshrc
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
export PATH=$PATH:$GOPATH/bin
plugins=(
git
aliases
git-prompt
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
)
# get machine's ip address
alias ip="ipconfig getifaddr en0"
# edit global zsh configuration
alias zshconfig="vim ~/.zshrc"
# reload zsh configuration
alias zshsource="source ~/.zshrc"
# reload zsh configuration
alias ohmyzsh="cd ~/.oh-my-zsh"
# navigate to global ssh directory
alias sshhome="cd ~/.ssh"
# edit global ssh configuration
alias sshconfig="nvim ~/.ssh/config"
# edit global git configuration
alias gitconfig="nvim ~/.gitconfig"
# Open nvim config
alias nvimconfig="cd ~/.config/nvim"
# Open .config directory
alias dotconfig="cd ~/.config"
# Copy biome config to root of project
alias initbiome="cp ~/.config/biome/biome.json ./"
# run biome lint on ./src
alias biomelint="npx @biomejs/biome lint ./src"
# Change default editor when in SSH
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
alias ssh-root-udev="ssh root@173.249.37.144 -i ~/.ssh/contabo-udev/contabo_udev_server_key_rsa"
alias ssh-udev="ssh ruben@173.249.37.144 -i ~/.ssh/contabo-udev/contabo_udev_server_key_rsa"
# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS="true"
# ALIASES
# Alias for managing dotfiles
alias dotfiles="/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME"
# Testing nvim kickstart for a new config with sane defaults
alias nvimk='NVIM_APPNAME="nvim-kickstart-modular" nvim'
# open new window and panes in tmux, IDE style.
alias ide='tmux new-window -n IDE \; split-window -v -p 25 \; split-window -h -p 40 \; select-pane -t 0 \; send-keys "nvim" C-m \; select-pane -t 1 \; send-keys "ls" C-m \; select-pane -t 0'
# test
alias websplit="tmux new-window -n WebSplit \; split-window -v -p 25 \; select-pane -t 0 \; send-keys "nvim" C-m \; select-pane -t 1 \; send-keys "lhost" C-m \;"
# open localhost:3000 in Arc.
alias lhost="open -a Arc http://localhost:3000"
# open localhost:3000 in Safari.
alias lhostsaf="open -a Safari http://localhost:3000"
# open finder in current directory
alias finder="open ."
# Easier navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias cleanswap='find . -type f -name "*.swp" -exec rm {} \;'
# FZF Aliases
export FZF_DEFAULT_OPTS="--bind='j:down,k:up'"
export FZF_DEFAULT_OPTS="--bind='ctrl-j:down,ctrl-k:up,ctrl-d:page-down,ctrl-u:page-up'"
# Search through files in a directory for specific text patterns
alias fzfgrep='grep -r "" . | fzf'
# Interactively list and select files in the current directory
alias fzfls='ls | fzf'
# Select a file and edit it in the default editor (or a specified one)
alias fzfn='EDITOR=nvim; export EDITOR; ${EDITOR} "$(fzf)"'
# Search through command history
alias fzfhist='history | fzf'
# Interactively select and kill processes
alias fzfkill='ps -ef | fzf -m | awk '\''{print $2}'\'' | xargs kill -9'
# Interactively select a directory and cd into it
alias fzfcd='cd "$(dirname "$(fzf)")"'
# ls stuff, most are set in lib/directories.zsh
alias ls='ls -GFh' # Colorize output, add file type indicator, and put sizes in human readable format
alias ll='ls -GFhl' # Same as above, but in long listing format
alias lh='ls -d .*' # show hidden files/directories only
alias lt='ls -ltFho' #long list,sorted by date,show type,human readable
alias ldot='ls -ld .*' #list dot files
alias dus='du -sckx * | sort -nr' #directories sorted by size
alias wordy='wc -w * | sort | tail -n10' # sort files in current directory by the number of words they contain
alias filecount='find . -type f | wc -l' # number of files (not directories)
alias ttop='top -ocpu -R -F -s 2 -n30' # fancy top
# CD Shortcuts
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
alias docs="cd ~/Documents"
alias dev="cd ~/Development/"
alias odin="cd ~/Development/Projects/the-odin-project/"
alias rby="cd ~/Development/Projects/rby"
alias school="cd ~/Development/School"
alias projects="cd ~/Development/Projects/"
# Quick edit to my aliases and zshrc config
alias zshrc="nvim ~/.zshrc"
# Clear terminal
alias cl='clear'
# Enable aliases to be sudo’ed
alias sudo='sudo '
# Get week number
alias week='date +%V'
# Get macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update; sudo gem cleanup'
# Recursively delete `.DS_Store` files
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
# Recursively delete logs, speeds up iterm2 start time
alias clearlogs='sudo rm -rf /var/log/asl/*.asl'
# Hide/show all desktop icons (useful when presenting)
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
alias loc="npx sloc --format cli-table --format-option head --exclude 'build|\.svg$\.xml' ./"
# load zsh-completions
autoload -U compinit && compinit
# use nvm
source /opt/homebrew/opt/nvm/nvm.sh
# use starship theme (needs to be at the end)
# eval "$(starship init zsh)"
#
ZSH_THEME="powerlevel10k/powerlevel10k"
#
source ~/powerlevel10k/powerlevel10k.zsh-theme
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
source /Users/ruben/Repos/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /Users/ruben/Repos/zsh-autocomplete/zsh-autocomplete.plugin.zsh