smart alias

main
Yax 2 years ago
parent 64c8509dac
commit 04356602bd

@ -133,6 +133,8 @@ if hash nix-env 2>/dev/null; then
alias nix-update='nix-channel --update && nix-env -u' alias nix-update='nix-channel --update && nix-env -u'
fi fi
alias cdd='cd {{ .deploydir }}'
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# COMPLETIONS # COMPLETIONS
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

@ -1,29 +1,30 @@
# fzf # fzf
source ~/.fzf-completion.bash if hash fzf 2>/dev/null; then
source ~/.fzf-keybindings.bash source ~/.fzf-completion.bash
source ~/.fzf-keybindings.bash
export FZF_DEFAULT_COMMAND="fdfind . " export FZF_DEFAULT_COMMAND="fdfind . "
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fdfind -t d ." export FZF_ALT_C_COMMAND="fdfind -t d ."
export FZF_DEFAULT_OPTS='--height 40% --reverse --border' export FZF_DEFAULT_OPTS='--height 40% --reverse --border'
# do not use **<TAB> but something else # do not use **<TAB> but something else
# export FZF_COMPLETION_TRIGGER='' # export FZF_COMPLETION_TRIGGER=''
# quickly find a project # quickly find a project
p(){ p(){
cd {{ .projectdir }} && `__fzf_cd__` && [[ -d ".git" ]] && git fetch cd {{ .projectdir }} && `__fzf_cd__` && [[ -d ".git" ]] && git fetch
} }
# open any file with default editor (or vim if none) # open any file with default editor (or vim if none)
fze() { fze() {
IFS=$'\n' files=($(fzf --query="$1" --multi --select-1 --exit-0)) IFS=$'\n' files=($(fzf --query="$1" --multi --select-1 --exit-0))
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" [[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
} }
# grep with silver searcher (https://github.com/ggreer/the_silver_searcher) # grep with silver searcher (https://github.com/ggreer/the_silver_searcher)
# install debian : sudo apt-get install silversearcher-ag # install debian : sudo apt-get install silversearcher-ag
fzg() { fzg() {
local file local file
local line local line
@ -33,4 +34,5 @@ fzg() {
then then
${EDITOR:-vim} $file +$line ${EDITOR:-vim} $file +$line
fi fi
} }
fi

@ -1,28 +0,0 @@
# fstash - easier way to deal with stashes
# type fstash to get a list of your stashes
# enter shows you the contents of the stash
# ctrl-d shows a diff of the stash against your current HEAD
# ctrl-b checks the stash out as a branch, for easier merging
fstash() {
local out q k sha
while out=$(
git stash list --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs" |
fzf --ansi --no-sort --query="$q" --print-query \
--expect=ctrl-d,ctrl-b);
do
mapfile -t out <<< "$out"
q="${out[0]}"
k="${out[1]}"
sha="${out[-1]}"
sha="${sha%% *}"
[[ -z "$sha" ]] && continue
if [[ "$k" == 'ctrl-d' ]]; then
git diff $sha
elif [[ "$k" == 'ctrl-b' ]]; then
git stash branch "stash-$sha" $sha
break;
else
git stash show -p $sha
fi
done
}

@ -1,7 +1,9 @@
# Java alternatives # java
if hash sdk 2>/dev/null; then
alias java6='sdk use java {{ .java6_version }}'
alias java7='sdk use java {{ .java7_version }}'
alias java8='sdk use java {{ .java8_version }}'
alias java11='sdk use java {{ .java11_version}}'
alias jv='java -version'
fi
alias java6='sdk use java {{ .java6_version }}'
alias java7='sdk use java {{ .java7_version }}'
alias java8='sdk use java {{ .java8_version }}'
alias java11='sdk use java {{ .java11_version}}'
alias jv='java -version'

@ -1,18 +1,14 @@
# alias and set var
alias cdd='cd {{ .deploydir }}'
export cdd={{ .deploydir }}
# maven # maven
if [ -f "{{ .java_truststore_file }}" ]; then if hash mvn 2>/dev/null; then
if [ -f "{{ .java_truststore_file }}" ]; then
alias m='mvn -Djavax.net.ssl.trustStore={{ .java_truststore_file }} -Djavax.net.ssl.trustStorePassword={{ .java_truststore_password }}' alias m='mvn -Djavax.net.ssl.trustStore={{ .java_truststore_file }} -Djavax.net.ssl.trustStorePassword={{ .java_truststore_password }}'
else else
alias m='mvn' alias m='mvn'
fi fi
alias mvnp='m -Dmaven.test.skip -Dmaven.javadoc.skip=true -DskipMunitTests clean package' alias mvnp='m -Dmaven.test.skip -Dmaven.javadoc.skip=true -DskipMunitTests clean package'
alias mvnd='m -Dmaven.test.skip -Dmaven.javadoc.skip=true deploy -P profile-nexus' alias mvnd='m -Dmaven.test.skip -Dmaven.javadoc.skip=true deploy -P profile-nexus'
alias mvni='m -Dmaven.test.skip -Dmaven.javadoc.skip=true clean install' alias mvni='m -Dmaven.test.skip -Dmaven.javadoc.skip=true clean install'
# copy maven artifact
alias d='python3 ~/.local/bin/deploy.py'
# copy maven artifact
alias d='python3 ~/.local/bin/deploy.py'
fi

@ -1,4 +1,4 @@
# Node # node
if [ -f "{{ .extra_ca_cert }}" ]; then if [ -f "{{ .extra_ca_cert }}" ]; then
export NODE_EXTRA_CA_CERTS={{ .extra_ca_cert }} export NODE_EXTRA_CA_CERTS={{ .extra_ca_cert }}
fi fi
@ -16,5 +16,3 @@ if [ -d "$HOME/.nvm" ]; then
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi fi

@ -1,6 +1,4 @@
# ------------------------------------------------------------- # python
# PYTHON
# -------------------------------------------------------------
# pyenv # pyenv
if [ -d "$HOME/.pyenv" ]; then if [ -d "$HOME/.pyenv" ]; then

@ -1,4 +1,3 @@
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman" export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"

Loading…
Cancel
Save