1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 17:28:01 +00:00

[.zshrc] Add new alias to kill all docker containers and a function to run docker exec using fzf to choose the container

This commit is contained in:
Daniel Carrillo 2020-01-19 19:12:31 +01:00
parent b2deb86a71
commit 844bbd1223

10
.zshrc
View File

@ -20,6 +20,7 @@ alias gb="git checkout \$(git branch -vv | fzf +m | awk '{print \$1}')"
alias open='xdg-open'
alias yayU='yay -Suy --noconfirm'
alias mknamedvenv='mkvirtualenv $(basename $PWD) -r requirements.txt'
alias dkillall='docker rm -f $(docker ps -qa)'
##### tilix #####
@ -49,6 +50,15 @@ fzf-file-widget-hidden () {
fd --type f --hidden -I --follow --exclude .git --exclude .cache | fzf
}
dexec () {
local cid
local cmd=${1:-"bash"}
cid=$(docker ps -a | sed 1d | fzf -1 -q "$1" | awk '{print $1}')
[ -n "$cid" ] && docker exec -ti "$cid" $cmd
}
export FZF_DEFAULT_COMMAND="fd --type f --follow -I"
export FZF_DEFAULT_OPTS="-m --reverse --bind 'ctrl-o:execute(xdg-open {})+abort,ctrl-e:execute({})+abort,ctrl-y:execute(echo {} | xclip -selection clipboard -in)+abort'"
export FZF_CTRL_T_OPTS="--no-height --preview '[[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file || pygmentize {} 2> /dev/null | head -500'"