2016-08-22 12:04:24 +02:00
|
|
|
# Some aliases
|
|
|
|
|
|
|
|
# v is shorter
|
|
|
|
alias v="$EDITOR"
|
|
|
|
|
|
|
|
# htop is better
|
|
|
|
alias top="htop"
|
|
|
|
|
|
|
|
# Vim like alias
|
|
|
|
alias :q="exit"
|
|
|
|
|
|
|
|
# Avoid typos
|
|
|
|
alias ake="make"
|
|
|
|
|
2017-04-20 15:46:50 +02:00
|
|
|
# cake is way more stylish than cmake
|
|
|
|
alias cake="cmake"
|
|
|
|
|
2016-08-22 12:04:24 +02:00
|
|
|
# My pdf reader
|
|
|
|
alias pdf="evince"
|
|
|
|
|
|
|
|
# clean for cmake files
|
2017-01-04 13:53:54 +01:00
|
|
|
alias cclean='rm -rf `find . -name "CMakeCache.txt"` `find . -name "cmake_install.cmake"` `find . -name "CMakeFiles"` `find . -name "Makefile"`'
|
2016-08-22 12:04:24 +02:00
|
|
|
|
|
|
|
# Some cd aliases
|
|
|
|
alias cd..="cd .."
|
|
|
|
alias cd...="cd ../.."
|
|
|
|
alias cd....="cd ../../.."
|
2018-05-02 09:32:22 +02:00
|
|
|
|
|
|
|
# Alias for ls
|
2018-03-29 08:29:00 +02:00
|
|
|
command -v exa > /dev/null 2>&1
|
|
|
|
|
|
|
|
if [ $? -eq 0 ]; then
|
2018-03-29 08:31:03 +02:00
|
|
|
LS_COLORS=""
|
2018-03-29 08:29:00 +02:00
|
|
|
alias ls="exa -h --group-directories-first"
|
2018-03-29 09:30:40 +02:00
|
|
|
alias lt="ls -lT"
|
2018-03-29 08:29:00 +02:00
|
|
|
else
|
|
|
|
alias ls="ls -h --color --group-directories-first"
|
|
|
|
fi
|
2017-12-21 10:35:22 +01:00
|
|
|
alias l="ls"
|
2016-08-31 10:02:52 +02:00
|
|
|
alias sl="ls"
|
2016-08-22 12:04:24 +02:00
|
|
|
alias lsd="ls"
|
2019-08-22 15:16:35 +02:00
|
|
|
alias la="ls -lah"
|
2019-10-09 11:34:54 +02:00
|
|
|
alias u="update"
|
2020-01-15 14:00:06 +01:00
|
|
|
alias gs="gst"
|
2016-09-08 09:16:44 +02:00
|
|
|
|
|
|
|
# Jump
|
|
|
|
alias j="jump"
|
2017-03-13 10:13:13 +01:00
|
|
|
|
2018-10-11 11:16:45 +02:00
|
|
|
# Disable bat paging
|
|
|
|
alias bat="bat --paging=never"
|
|
|
|
|
2019-02-11 17:40:33 +01:00
|
|
|
# mkdir && cd
|
|
|
|
mkcd() {
|
|
|
|
mkdir $1 && cd $1
|
|
|
|
}
|
|
|
|
|
2017-03-13 10:13:13 +01:00
|
|
|
# Initialize thefuck
|
2017-03-23 17:07:35 +01:00
|
|
|
command -v thefuck > /dev/null 2>&1
|
|
|
|
|
|
|
|
# fuck aliases
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
eval $(thefuck --alias)
|
|
|
|
fi
|
2018-09-25 20:34:30 +02:00
|
|
|
|
2019-02-11 20:54:07 +01:00
|
|
|
# change to git directory
|
|
|
|
cdg() {
|
|
|
|
local newdir
|
2020-01-08 10:20:09 +01:00
|
|
|
newdir=$(CLICOLOR_FORCE=1 pgd $1) && cd $newdir
|
2019-02-11 20:54:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_cdg() {
|
|
|
|
_arguments "1: :($( cat $GCLONE_PATH/.cdgcache | rev | cut -d '/' -f 1 | rev))"
|
|
|
|
}
|
|
|
|
|
2019-05-18 13:00:05 +02:00
|
|
|
cratefmt() {
|
|
|
|
local current_dir=$PWD
|
|
|
|
|
|
|
|
# Find cargo.toml
|
|
|
|
while [ ! -f Cargo.toml ] && [ $PWD != "/" ]; do
|
|
|
|
cd ..
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -f Cargo.toml ]; then
|
|
|
|
rustfmt --edition 2018 `find src -name "*.rs"`
|
|
|
|
else
|
|
|
|
echo -e "\033[1;31merror:\033[0m\033[1m can't find Cargo.toml\033[0m"
|
|
|
|
cd $current_dir
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $current_dir
|
|
|
|
}
|
|
|
|
|
2019-02-11 20:54:07 +01:00
|
|
|
compdef _cdg cdg
|