dynamic aliases
This commit is contained in:
		
							parent
							
								
									f5039e6c2d
								
							
						
					
					
						commit
						c9a0f7bdf2
					
				
					 3 changed files with 32 additions and 8 deletions
				
			
		| 
						 | 
					@ -1,21 +1,18 @@
 | 
				
			||||||
# Work directories
 | 
					# Work directories
 | 
				
			||||||
WORK="$HOME/Projects/Work"
 | 
					WORK="$HOME/Projects/Work"
 | 
				
			||||||
UTIL="$HOME/Projects/Work/utility"
 | 
					UTIL="$HOME/Projects/Work/utility"
 | 
				
			||||||
BPS="$HOME/Projects/Work/BPS"
 | 
					 | 
				
			||||||
PUB="$HOME/Projects/Work/publikator/"
 | 
					PUB="$HOME/Projects/Work/publikator/"
 | 
				
			||||||
AR="$HOME/Projects/Work/arriva_server/server"
 | 
					AR="$HOME/Projects/Work/arriva_server/"
 | 
				
			||||||
KRD="$HOME/Projects/Work/robots/krd_syncer"
 | 
					 | 
				
			||||||
NEG="$HOME/Projects/Work/negocjator/"
 | 
					NEG="$HOME/Projects/Work/negocjator/"
 | 
				
			||||||
 | 
					SZ="$HOME/Projects/Work/szyna/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Workflow
 | 
					# Workflow
 | 
				
			||||||
alias work="cd $WORK"
 | 
					alias work="cd $WORK"
 | 
				
			||||||
alias util="cd $UTIL && make"
 | 
					alias util="cd $UTIL && make"
 | 
				
			||||||
alias bps="cd $BPS && make"
 | 
					 | 
				
			||||||
alias pub="cd $PUB"
 | 
					alias pub="cd $PUB"
 | 
				
			||||||
alias ar="cd $AR && make"
 | 
					 | 
				
			||||||
alias arr="ar"
 | 
					 | 
				
			||||||
alias krd="cd $KRD"
 | 
					 | 
				
			||||||
alias neg="cd $NEG"
 | 
					alias neg="cd $NEG"
 | 
				
			||||||
 | 
					alias sz="cd $SZ"
 | 
				
			||||||
 | 
					alias ar="cd $AR"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias activate_venv="[ -f .venv/bin/activate ] && source .venv/bin/activate"
 | 
					alias activate_venv="[ -f .venv/bin/activate ] && source .venv/bin/activate"
 | 
				
			||||||
alias display_makefile_help="[ -f Makefile ] && make"
 | 
					alias display_makefile_help="[ -f Makefile ] && make"
 | 
				
			||||||
| 
						 | 
					@ -25,6 +22,7 @@ for d in $PUB/*; do
 | 
				
			||||||
    if [ -d "$d" ]; then
 | 
					    if [ -d "$d" ]; then
 | 
				
			||||||
      last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
 | 
					      last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
 | 
				
			||||||
      last_part=${last_part:0:1}
 | 
					      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"
 | 
					      alias pub$last_part="cd $d && display_makefile_help && activate_venv"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
| 
						 | 
					@ -33,6 +31,25 @@ for d in $NEG/*; do
 | 
				
			||||||
    if [ -d "$d" ]; then
 | 
					    if [ -d "$d" ]; then
 | 
				
			||||||
      last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
 | 
					      last_part=$(basename $d | tr "_" " " | awk '{print $NF}')
 | 
				
			||||||
      last_part=${last_part:0:1}
 | 
					      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"
 | 
					      alias neg$last_part="cd $d && display_makefile_help && activate_venv"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
done
 | 
					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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,6 +26,13 @@ return {
 | 
				
			||||||
        "<cmd>Telescope buffers<cr>",
 | 
					        "<cmd>Telescope buffers<cr>",
 | 
				
			||||||
				desc = "Find buffer",
 | 
									desc = "Find buffer",
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									"<leader>fr",
 | 
				
			||||||
 | 
									function()
 | 
				
			||||||
 | 
										require("telescope.builtin").resume()
 | 
				
			||||||
 | 
									end,
 | 
				
			||||||
 | 
									desc = "Resume last search",
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		opts = {
 | 
							opts = {
 | 
				
			||||||
			defaults = {
 | 
								defaults = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								.zshrc
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								.zshrc
									
									
									
									
									
								
							| 
						 | 
					@ -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"
 | 
					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
 | 
					# 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
 | 
					# mysql client on macos
 | 
				
			||||||
export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"
 | 
					export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue