[shell] moved to a single directory + alias.sh

This commit is contained in:
2024-07-28 16:18:45 +03:00
parent 2de1ebcfef
commit 9876c30d6d
4 changed files with 6 additions and 2 deletions

2
shell/alias.sh Normal file
View File

@@ -0,0 +1,2 @@
alias l="ls -lah"
alias lg="lazygit"

24
shell/bash/bashrc Normal file
View File

@@ -0,0 +1,24 @@
source ~/.dotfiles/git/git-prompt.sh
source ~/.dotfiles/shell/alias.sh
PROMPT_COMMAND='PS1_CMD1=$(__git_ps1 " [%s]")'; PS1='\[\e[38;5;117m\]\u\[\e[0m\] \w${PS1_CMD1}\$ '
#
# tmux history preservation
#
# Avoid duplicates
HISTCONTROL=ignoredups:erasedups # Ubuntu default is ignoreboth
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend # In Ubuntu this is already set by default
# After each command, append to the history file and reread it
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
#
# tmux autostart
#
# [[ $- == *i* ]] is to check if the current seession is interactive - https://superuser.com/a/1777888/136716
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ $- == *i* ]] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
exec tmux new-session -As0
fi

21
shell/zsh/zshrc Normal file
View File

@@ -0,0 +1,21 @@
source ~/.dotfiles/shell/alias.sh
eval "$(/opt/homebrew/bin/brew shellenv)"
if type brew &>/dev/null
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit
compinit
fi
setopt appendhistory # Append history to the history file (no overwriting)
setopt incappendhistory # Immediately append to the history file, not just when a term is killed
setopt histignoredups
source ~/.dotfiles/git/git-prompt.sh
setopt PROMPT_SUBST ; PS1='%n@%m %c$(__git_ps1 " [%s]")\$ '
if [ -f ~/.zshrc_local ]
then
source ~/.zshrc_local
fi