Skip to content

Commit

Permalink
refactor(config): update zshrc settings
Browse files Browse the repository at this point in the history
  • Loading branch information
borjapazr committed May 13, 2024
1 parent 7a76bc4 commit 4037b9c
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: ⬇️ Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: βšͺ️ Set needed environment variables
run: |
Expand All @@ -29,10 +29,10 @@ jobs:

steps:
- name: ⬇️ Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: 🐿️ Setup go version
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: "^1.16.1"

Expand All @@ -59,7 +59,7 @@ jobs:

steps:
- name: ⬇️ Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: πŸ“₯ Install .dotfiles
run: echo "$HOME/.dotfiles" | bash installer
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<br>
<br>

![GitHub CI Workflow Status](https://img.shields.io/github/workflow/status/borjapazr/dotfiles/CI?style=flat-square&logo=github&label=CI)
![GitHub CI Workflow Status](https://img.shields.io/github/actions/workflow/status/borjapazr/dotfiles/ci.yml?style=flat-square&logo=github&label=CI)

<h4>
πŸ’»πŸš€ Custom dotfiles for UNIX based systems
Expand Down
7 changes: 7 additions & 0 deletions git/.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

[push]
default = simple
autoSetupRemote = true

[apply]
whitespace = fix
Expand Down Expand Up @@ -81,6 +82,9 @@
[commit]
gpgsign = true

[credential]
helper = osxkeychain

[tag]
gpgsign = true

Expand All @@ -90,3 +94,6 @@
[alias]
nah = "!f(){ git reset --hard; git clean -df; if [ -d ".git/rebase-apply" ] || [ -d ".git/rebase-merge" ]; then git rebase --abort; fi; }; f"
undo = "reset HEAD~1 --mixed"

[init]
defaultBranch = main
4 changes: 3 additions & 1 deletion git/.gitignore_global
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
# Clojure
.lein-repl-history
.lein-failures
completer.hist
completer.histw
.nrepl-port
.lsp
.clj-kondo

# Scala
libsigar-universal64-macosx.dylib
Expand Down
2 changes: 1 addition & 1 deletion scripts/core/_main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if ! ${DOT_MAIN_SOURCED:-false}; then
for file in $DOTFILES_PATH/scripts/core/{args,docs,dot,git,log,platform,str}.sh; do
for file in $DOTFILES_PATH/scripts/core/{args,docs,dot,git,log,platform,selector,str}.sh; do
source "$file"
done
unset file
Expand Down
8 changes: 8 additions & 0 deletions scripts/core/selector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
selector::select() {
options=""
while read -r data; do
options="$options\n$data"
done

printf "$options" | choose -c 31d6e0
}
25 changes: 25 additions & 0 deletions scripts/docker/logs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -euo pipefail

source "$DOTFILES_PATH/scripts/core/_main.sh"

##? Shows the logs of the selected container
##?
##? Usage:
##? logs
docs::parse "$@"

if docker ps >/dev/null 2>&1; then
container=$(docker ps | awk '{if (NR!=1) print $1 ": " $(NF)}' | fzf --height 40%)

if [[ -n $container ]]; then
container_id=$(echo $container | awk -F ': ' '{print $1}')

docker logs -f --tail 100 $container_id
else
echo "You haven't selected any container! ༼぀◕_◕༽぀"
fi
else
echo "Docker daemon is not running! (ΰ² _ΰ² )"
fi
68 changes: 68 additions & 0 deletions scripts/system/empty_trash
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env bash

set -euo pipefail

source "$DOTLY_PATH/scripts/core/_main.sh"

##? Empty the trash and remove cache files
#?? 1.0.0
##?
##? Usage:
##? empty_trash
docs::parse "$@"

free_space_in_home() {
df -h ~ | tail -n1 | awk '{print $4}'
}

free_space_before_empty=$(free_space_in_home)

ls /Volumes | grep -v GoogleDrive | xargs -I_ sudo rm -rfv /Volumes/_/.Trashes
sudo rm -rfv ~/.Trash/*
echo 'πŸ—‘ All trashes empty'

sudo rm -rfv /private/var/log/asl/*.asl
sudo rm -rfv /var/log/asl/*.asl
echo 'πŸ“œ Mac logs empty'

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'
echo '⏬ Mac downloads history empty'

rm -rf "$HOME/Movies/"*.fcpbundle"/"*"/Render Files/High Quality Media"
echo '🎬 Final Cut rendered media cleared'

brew cleanup
brew cleanup --prune-prefix
rm -rf ~/Library/Caches/Homebrew
echo '🍺 Brew cache cleared'

rm -rf ~/Library/Caches/com.tinyspeck.slackmacgap
rm -rf ~/Library/Caches/com.tinyspeck.slackmacgap.ShipIt
rm -rf ~/Library/Application Support/Slack/Cache
rm -rf "$HOME/Library/Application Support/Slack/Service Worker/CacheStorage"
echo 'πŸ’¬ Slack cache cleared'

rm -rf ~/Library/Caches/com.spotify.client/Data
echo '🎢 Spotify cache cleared'

rm -rf ~/Library/Caches/JetBrains
echo 'πŸ…Έ JetBrains cache cleared'

rm -rf ~/Library/Caches/Yarn/
echo 'πŸ’ͺ Yarn cache cleared'

rm -rf ~/.gradle/wrapper/dists/
rm -rf ~/.gradle/caches/
echo '🐘 Gradle cache cleared'

rm -rf ~/.composer/cache/
echo 'πŸ‘¨β€πŸŽ€ Composer cache cleared'

rm -rf ~/Library/Caches/Google/Chrome || true
rm -rf "$HOME/Library/Application Support/Google/Chrome/"*"/Service Worker/CacheStorage" || true
rm -rf "$HOME/Library/Application Support/Google/Chrome/"*"/Application Cache/Cache" || true
echo '🟑 Chrome cache cleared'

free_space_after_empty=$(free_space_in_home)

echo "Done! Free space before: $free_space_before_empty, free space now: $free_space_after_empty"
11 changes: 11 additions & 0 deletions shell/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ fi
# Options
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FCNTL_LOCK
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt INC_APPEND_HISTORY_TIME
setopt EXTENDED_HISTORY
setopt HIST_NO_STORE
setopt +o nomatch
unset zle_bracketed_paste

Expand All @@ -19,10 +24,16 @@ ZSH_THEME="powerlevel10k/powerlevel10k"
ZLE_RPROMPT_INDENT=0
export LS_COLORS="no=00:rs=0:fi=00:di=01;34:ln=36:mh=04;36:pi=04;01;36:so=04;33:do=04;01;36:bd=01;33:cd=33:or=31:mi=01;37;41:ex=01;36:su=01;04;37:sg=01;04;37:ca=01;37:tw=01;37;44:ow=01;04;34:st=04;37;44:*.7z=01;32:*.ace=01;32:*.alz=01;32:*.arc=01;32:*.arj=01;32:*.bz=01;32:*.bz2=01;32:*.cab=01;32:*.cpio=01;32:*.deb=01;32:*.dz=01;32:*.ear=01;32:*.gz=01;32:*.jar=01;32:*.lha=01;32:*.lrz=01;32:*.lz=01;32:*.lz4=01;32:*.lzh=01;32:*.lzma=01;32:*.lzo=01;32:*.rar=01;32:*.rpm=01;32:*.rz=01;32:*.sar=01;32:*.t7z=01;32:*.tar=01;32:*.taz=01;32:*.tbz=01;32:*.tbz2=01;32:*.tgz=01;32:*.tlz=01;32:*.txz=01;32:*.tz=01;32:*.tzo=01;32:*.tzst=01;32:*.war=01;32:*.xz=01;32:*.z=01;32:*.Z=01;32:*.zip=01;32:*.zoo=01;32:*.zst=01;32:*.aac=32:*.au=32:*.flac=32:*.m4a=32:*.mid=32:*.midi=32:*.mka=32:*.mp3=32:*.mpa=32:*.mpeg=32:*.mpg=32:*.ogg=32:*.opus=32:*.ra=32:*.wav=32:*.3des=01;35:*.aes=01;35:*.gpg=01;35:*.pgp=01;35:*.doc=32:*.docx=32:*.dot=32:*.odg=32:*.odp=32:*.ods=32:*.odt=32:*.otg=32:*.otp=32:*.ots=32:*.ott=32:*.pdf=32:*.ppt=32:*.pptx=32:*.xls=32:*.xlsx=32:*.app=01;36:*.bat=01;36:*.btm=01;36:*.cmd=01;36:*.com=01;36:*.exe=01;36:*.reg=01;36:*~=02;37:*.bak=02;37:*.BAK=02;37:*.log=02;37:*.log=02;37:*.old=02;37:*.OLD=02;37:*.orig=02;37:*.ORIG=02;37:*.swo=02;37:*.swp=02;37:*.bmp=32:*.cgm=32:*.dl=32:*.dvi=32:*.emf=32:*.eps=32:*.gif=32:*.jpeg=32:*.jpg=32:*.JPG=32:*.mng=32:*.pbm=32:*.pcx=32:*.pgm=32:*.png=32:*.PNG=32:*.ppm=32:*.pps=32:*.ppsx=32:*.ps=32:*.svg=32:*.svgz=32:*.tga=32:*.tif=32:*.tiff=32:*.xbm=32:*.xcf=32:*.xpm=32:*.xwd=32:*.xwd=32:*.yuv=32:*.anx=32:*.asf=32:*.avi=32:*.axv=32:*.flc=32:*.fli=32:*.flv=32:*.gl=32:*.m2v=32:*.m4v=32:*.mkv=32:*.mov=32:*.MOV=32:*.mp4=32:*.mpeg=32:*.mpg=32:*.nuv=32:*.ogm=32:*.ogv=32:*.ogx=32:*.qt=32:*.rm=32:*.rmvb=32:*.swf=32:*.vob=32:*.webm=32:*.wmv=32:"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
if [[ -z $TMUX ]]; then
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
else
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
fi;

# Configuration
COMPLETION_WAITING_DOTS="false"
ZSH_AUTOSUGGEST_USE_ASYNC=true
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
ZSH_HIGHLIGHT_MAXLENGTH=300
ZSH_DISABLE_COMPFIX="true"
DEFAULT_USER=$(whoami)
Expand Down

0 comments on commit 4037b9c

Please sign in to comment.