diff --git a/.config/nvim/lua/custom/plugins/prettier.lua b/.config/nvim/lua/custom/plugins/prettier.lua index 1be7047e..d28b2552 100644 --- a/.config/nvim/lua/custom/plugins/prettier.lua +++ b/.config/nvim/lua/custom/plugins/prettier.lua @@ -85,7 +85,7 @@ return { vim.api.nvim_create_autocmd(event, { buffer = bufnr, group = group, - callback = function() format() end, + callback = format, desc = "[lsp] format on save", }) -- end diff --git a/exports.sh b/exports.sh index e8a5f597..b5242d84 100755 --- a/exports.sh +++ b/exports.sh @@ -106,6 +106,15 @@ if [[ -f "$HOME/.cargo/env" ]]; then . "$HOME/.cargo/env" fi +if [[ -d "$HOME/Dev/gba/butano" ]]; then + export BUTANO_HOME="$HOME/Dev/gba/butano" +fi + +if [[ -d "/opt/devkitpro" ]]; then + export DEVKITPRO="/opt/devkitpro" + export DEVKITARM="/opt/devkitpro/devkitARM" +fi + if [[ -f ~/.fzf.zsh ]]; then source ~/.fzf.zsh; fi if [[ -f /opt/homebrew/opt/chruby/share/chruby/chruby.sh ]]; then source /opt/homebrew/opt/chruby/share/chruby/chruby.sh; fi if [[ -f $(which rbenv) ]]; then eval "$(rbenv init - zsh)"; fi diff --git a/install.sh b/install.sh index c8b925a2..9fcb3beb 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ type src >/dev/null || source "$DOTFILES/zplug.init.zsh" echo_yellow "Preparing..." -src exports +src -q exports if is_mac && [[ ! -d "$HOME/Library/ApplicationSupport" ]]; then ln -s "$HOME/Library/Application Support" "$HOME/Library/ApplicationSupport" diff --git a/plugins/functions.plugin.zsh b/plugins/functions.plugin.zsh index d1aeddf4..4e58f48a 100755 --- a/plugins/functions.plugin.zsh +++ b/plugins/functions.plugin.zsh @@ -76,14 +76,23 @@ is_linux() { rc() { if [[ $# -eq 0 ]]; then - echo_red "Usage: rc [-n] " + echo_red "Usage: rc [-n] [-q] " return 1 fi + no_src=0 + quiet=0 - if [[ $1 == '-n' ]]; then - no_src=1 + while [[ $# -gt 1 ]]; do + case $1 in + -n) + no_src=1 + ;; + -q) + quiet=1 + ;; + esac shift - fi + done if [[ -f "$DOTFILES/$1.sh" ]]; then file="$DOTFILES/$1.sh" @@ -98,9 +107,16 @@ rc() { newhash=$(md5 $file) if [[ $? -eq 0 && $hash != $newhash ]]; then - if [[ $no_src -ne 1 ]]; then src $1; fi + if [[ $no_src -ne 1 ]]; then + if [[ $quiet -ne 1 ]]; then + src $1 + else + src -q $1 + fi + fi else echo "No changes made" + return 2 fi return 0 fi @@ -110,10 +126,20 @@ rc() { src() { if [[ $# -eq 0 ]]; then - echo_red "Usage: src " + echo_red "Usage: src [-q] " return 1 fi + while [[ $# -gt 1 ]]; do + case $1 in + -q) + quiet=1 + ;; + esac + shift + done + + if [[ -f "$DOTFILES/$1.sh" ]]; then file="$DOTFILES/$1.sh" else @@ -121,7 +147,9 @@ src() { fi if [[ -f $file ]]; then - echo "Reloading $file..." + if [[ $quiet -ne 1 ]]; then + echo "Reloading $file..." + fi source "$file" return 0 fi @@ -314,13 +342,31 @@ reload-zsh() { bench() { if [[ $# -eq 0 ]]; then - echo_red "Usage: bench " + echo_red "Usage: bench [-v] " return 1 fi + verbose=0 + while [[ $# -gt 1 ]]; do + case $1 in + -v) + verbose=1 + ;; + esac + shift + done command=$1 shift echo "Benchmarking $command..." - /usr/bin/time -v $command $@ + bin="/usr/bin/time" + flags='' + if [[ $verbose -eq 1 ]]; then + flags='-h -l' + fi + + # TODO implement + # xargs $bin $flags $command $@ + + /usr/bin/time -h -l $command $@ } strjoin() {