From e11d880e00dc05021d89a5928e287ad36c90a810 Mon Sep 17 00:00:00 2001 From: Yasin Date: Fri, 22 Mar 2024 10:38:50 +0100 Subject: [PATCH] sync configurations --- bash/bashrc | 24 ++++++++++++++++-------- git/defaults | 2 ++ snap/Snaplist | 14 +++++++++----- zsh/zshrc | 47 +++++++++++++++++++++++++++++++++++++---------- 4 files changed, 64 insertions(+), 23 deletions(-) diff --git a/bash/bashrc b/bash/bashrc index eb33c15..6da364e 100755 --- a/bash/bashrc +++ b/bash/bashrc @@ -1,13 +1,5 @@ #!/usr/bin/env bash -# Using the same configurations from the ZSH shell. -# I'm not relying on the ZSH specific features. - -# Source .zshrc if it exists -if [ -f "$HOME/.dotfiles/zsh/zshrc" ]; then - source "$HOME/.dotfiles/zsh/zshrc" -fi - # If not running interactively, don't do anything case $- in *i*) ;; @@ -90,3 +82,19 @@ export SCM_CHECK=true # Load Bash It source "$BASH_IT"/bash_it.sh +source ~/.dotfiles/zsh/zshrc +source /etc/bash_completion + +# HSTR configuration +alias hh=hstr # hh to be alias for hstr +export HSTR_CONFIG=hicolor # get more colors +shopt -s histappend # append new history items to .bash_history +export HISTCONTROL=ignorespace # leading space hides commands from history +export HISTFILESIZE=10000 # increase history file size (default is 500) +export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500) +# ensure synchronization between bash memory and history file +export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}" +# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc) +if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi +# if this is interactive shell, then bind 'kill last command' to Ctrl-x k +if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi \ No newline at end of file diff --git a/git/defaults b/git/defaults index 316b59b..37771f5 100755 --- a/git/defaults +++ b/git/defaults @@ -13,6 +13,8 @@ alias hit="git" alias gut="git" alias got="git" +alias grv="git remote -v" +alias gst="git status" alias gstash="git stash" # default stash. alias gstashall="git stash -u" # Stash all untracked ones. alias gp="git push" # default push. diff --git a/snap/Snaplist b/snap/Snaplist index d220ed0..a43ff1f 100644 --- a/snap/Snaplist +++ b/snap/Snaplist @@ -1,20 +1,24 @@ bare -barrier -chromium +code core core18 +core20 core22 cups emote gnome-3-34-1804 gnome-42-2204 -goreleaser +go +gradle gtk-common-themes hello-world intellij-idea-ultimate j2 +lxd +nmap pdftk -podman -pycharm-community +simplenote slack +tree vlc +zoom-client diff --git a/zsh/zshrc b/zsh/zshrc index dd6dd2a..8684a86 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -38,7 +38,7 @@ alias .....="cd ../../../.." # go back five directories alias ......="cd ../../../../.." # go back six directories alias .......="cd ../../../../../.." # go back seven directories alias ~="cd ~" # go to home but `cd` is probably faster to type. -alias -- -="cd -" # go to old directory == cd $OLDPWD +# alias -- -="cd -" # go to old directory == cd $OLDPWD alias d="cd ~/Documents" # go to documents alias dl="cd ~/Downloads" # go to downloads @@ -54,11 +54,11 @@ alias cls="clear" # Good old cls # way I want. So, I'm overriding the similar existing # ones with mine. First push all the above aliases # and then pop back later. -if [[ "$(uname)" == "Darwin" ]]; then -PERSONAL_ALIASES="$(alias -L)" -else -PERSONAL_ALIASES="$(alias -p)" -fi +# if [[ "$(uname)" == "Darwin" ]]; then +# PERSONAL_ALIASES="$(alias -L)" +# else +# PERSONAL_ALIASES="$(alias -p)" +# fi # Abbreviated for: Append to $PATH. # This function will append a path to $PATH and @@ -207,13 +207,11 @@ function darwin() { } function linux() { - echo "Applying your Linux specific configs..." - source "$DOTFILES_DIR/snap/defaults" - + # source "/var/snap/openjdk/current/openjdk.env" + export JAVA_HOME="/usr/lib/jvm/java-21-openjdk-amd64/" alias rrr="exec bash" - } function common() { @@ -228,6 +226,7 @@ function common() { source "$DOTFILES_DIR/git/defaults" alias dlistall="docker ps -a" + alias dpsa="docker ps -a --no-trunc | less -S" alias dstart="docker start" alias dstop="docker stop" @@ -266,3 +265,31 @@ fi eval "$PERSONAL_ALIASES" echo -e "A new $(ps -o comm= $$) session created with pid $$" echo -e "$USER's $(echo $0) environment is ready ✅.\n" + +function dokcer_jump_to() { + docker exec -it $1 "${2:-sh}" +} + +function dlg() { + docker logs $1 +} + +function docker_stop_all_running_containers() { + docker stop $(docker ps -q) +} + +function docker_remove_all_containers() { + docker rm -vf $(docker ps -aq) +} + +function docker_remove_all_images() { + docker rmi -f $(docker images -aq) +} + +function docker_prune_everything() { + docker system prune -a --volumes +} + +function docker_restart() { + sudo systemctl restart docker +}