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'
fi
alias cdd='cd {{ .deploydir }}'
# ---------------------------------------------------------------------------
# COMPLETIONS
# ---------------------------------------------------------------------------

@ -1,36 +1,38 @@
# fzf
source ~/.fzf-completion.bash
source ~/.fzf-keybindings.bash
if hash fzf 2>/dev/null; then
source ~/.fzf-completion.bash
source ~/.fzf-keybindings.bash
export FZF_DEFAULT_COMMAND="fdfind . "
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fdfind -t d ."
export FZF_DEFAULT_OPTS='--height 40% --reverse --border'
# do not use **<TAB> but something else
# export FZF_COMPLETION_TRIGGER=''
export FZF_DEFAULT_COMMAND="fdfind . "
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fdfind -t d ."
export FZF_DEFAULT_OPTS='--height 40% --reverse --border'
# do not use **<TAB> but something else
# export FZF_COMPLETION_TRIGGER=''
# quickly find a project
p(){
cd {{ .projectdir }} && `__fzf_cd__` && [[ -d ".git" ]] && git fetch
}
# quickly find a project
p(){
cd {{ .projectdir }} && `__fzf_cd__` && [[ -d ".git" ]] && git fetch
}
# open any file with default editor (or vim if none)
fze() {
IFS=$'\n' files=($(fzf --query="$1" --multi --select-1 --exit-0))
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
}
# open any file with default editor (or vim if none)
fze() {
IFS=$'\n' files=($(fzf --query="$1" --multi --select-1 --exit-0))
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
}
# grep with silver searcher (https://github.com/ggreer/the_silver_searcher)
# install debian : sudo apt-get install silversearcher-ag
fzg() {
local file
local line
# grep with silver searcher (https://github.com/ggreer/the_silver_searcher)
# install debian : sudo apt-get install silversearcher-ag
fzg() {
local file
local line
read -r file line <<<"$(ag --nobreak --noheading $@ | fzf -0 -1 | awk -F: '{print $1, $2}')"
read -r file line <<<"$(ag --nobreak --noheading $@ | fzf -0 -1 | awk -F: '{print $1, $2}')"
if [[ -n $file ]]
then
${EDITOR:-vim} $file +$line
fi
}
if [[ -n $file ]]
then
${EDITOR:-vim} $file +$line
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
if [ -f "{{ .java_truststore_file }}" ]; then
alias m='mvn -Djavax.net.ssl.trustStore={{ .java_truststore_file }} -Djavax.net.ssl.trustStorePassword={{ .java_truststore_password }}'
else
alias m='mvn'
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 }}'
else
alias m='mvn'
fi
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 mvni='m -Dmaven.test.skip -Dmaven.javadoc.skip=true clean install'
# copy maven artifact
alias d='python3 ~/.local/bin/deploy.py'
fi
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 mvni='m -Dmaven.test.skip -Dmaven.javadoc.skip=true clean install'
# copy maven artifact
alias d='python3 ~/.local/bin/deploy.py'

@ -1,4 +1,4 @@
# Node
# node
if [ -f "{{ .extra_ca_cert }}" ]; then
export NODE_EXTRA_CA_CERTS={{ .extra_ca_cert }}
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/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi

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

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

Loading…
Cancel
Save