dynamic aliases

This commit is contained in:
Piotr Domański 2023-12-13 13:11:25 +01:00
parent f5039e6c2d
commit c9a0f7bdf2
3 changed files with 32 additions and 8 deletions

View file

@ -1,21 +1,18 @@
# Work directories
WORK="$HOME/Projects/Work"
UTIL="$HOME/Projects/Work/utility"
BPS="$HOME/Projects/Work/BPS"
PUB="$HOME/Projects/Work/publikator/"
AR="$HOME/Projects/Work/arriva_server/server"
KRD="$HOME/Projects/Work/robots/krd_syncer"
AR="$HOME/Projects/Work/arriva_server/"
NEG="$HOME/Projects/Work/negocjator/"
SZ="$HOME/Projects/Work/szyna/"
# Workflow
alias work="cd $WORK"
alias util="cd $UTIL && make"
alias bps="cd $BPS && make"
alias pub="cd $PUB"
alias ar="cd $AR && make"
alias arr="ar"
alias krd="cd $KRD"
alias neg="cd $NEG"
alias sz="cd $SZ"
alias ar="cd $AR"
alias activate_venv="[ -f .venv/bin/activate ] && source .venv/bin/activate"
alias display_makefile_help="[ -f Makefile ] && make"
@ -25,6 +22,7 @@ for d in $PUB/*; do
if [ -d "$d" ]; then
last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
last_part=${last_part:0:1}
last_part=$(echo $last_part | tr '[:upper:]' '[:lower:]')
alias pub$last_part="cd $d && display_makefile_help && activate_venv"
fi
done
@ -33,6 +31,25 @@ for d in $NEG/*; do
if [ -d "$d" ]; then
last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
last_part=${last_part:0:1}
last_part=$(echo $last_part | tr '[:upper:]' '[:lower:]')
alias neg$last_part="cd $d && display_makefile_help && activate_venv"
fi
done
for d in $SZ/*; do
if [ -d "$d" ]; then
last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
last_part=${last_part:0:2}
last_part=$(echo $last_part | tr '[:upper:]' '[:lower:]')
alias sz$last_part="cd $d && display_makefile_help && activate_venv"
fi
done
for d in $AR/*; do
if [ -d "$d" ]; then
last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
last_part=${last_part:0:1}
last_part=$(echo $last_part | tr '[:upper:]' '[:lower:]')
alias ar$last_part="cd $d && display_makefile_help && activate_venv"
fi
done

View file

@ -26,6 +26,13 @@ return {
"<cmd>Telescope buffers<cr>",
desc = "Find buffer",
},
{
"<leader>fr",
function()
require("telescope.builtin").resume()
end,
desc = "Resume last search",
},
},
opts = {
defaults = {

2
.zshrc
View file

@ -202,7 +202,7 @@ bindkey '^l' autosuggest-accept
export FZF_DEFAULT_OPTS="--reverse --bind change:first --bind ctrl-j:down,ctrl-k:up -i --cycle --header-first --border rounded"
# exports - local bin, python, brew
export PATH="$HOME/.local/bin:$HOME/.bin:/Users/$USER/Library/Python/3.9/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/libpq/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
export PATH="$HOME/.local/bin:$HOME/.bin:/Users/$USER/Library/Python/3.9/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/libpq/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$HOME/.cargo/bin:$PATH"
# mysql client on macos
export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"