Skip to content

Commit

Permalink
Merged zsh_aliases and bash_aliases into single aliases, extracted
Browse files Browse the repository at this point in the history
functions from aliases config file to separate functions config file
  • Loading branch information
rsherstnev committed Sep 26, 2024
1 parent c44c083 commit b332cbb
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 81 deletions.
9 changes: 6 additions & 3 deletions bash/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ if [ -x /usr/bin/dircolors ]; then
alias egrep='egrep --color=auto'
fi

if [ -f ~/.bash_aliases ]; then
source ~/.bash_aliases
fi
for config_file in $HOME/.{aliases,functions}; do
if [[ -r "$config_file" ]] && [[ -f "$config_file" ]]; then
source "$config_file"
fi
done
unset config_file

if ! shopt -oq posix; then
if [[ -f /usr/share/bash-completion/bash_completion ]]; then
Expand Down
26 changes: 16 additions & 10 deletions bash/.bash_aliases → bash_and_zsh/.aliases
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# alias ls='ls --color=auto'
alias ls='eza --group-directories-first --git --color=always'
alias ls='ls --color=auto'

# Uncomment for eza on server
# alias ls='eza --group-directories-first --git --color=always'

# Uncomment for eza on workstation with nerd fonts
# alias ls='eza --group-directories-first --icons=always --git --color=always'

alias l='ls --oneline'
alias la='ls -a'
alias ll='ls -lh'
Expand All @@ -18,8 +24,8 @@ alias clshist='truncate -s 0 $HISTFILE && reset'
alias ip='ip -color=auto'
alias diff='diff --color=auto'
alias grep='grep --color=auto'
alias egrep='grep -E --color=auto'
alias fgrep='grep -F --color=auto'
alias egrep='grep -E'
alias fgrep='grep -F'
alias less='less -R -s -M +Gg'
alias dmesg='dmesg --color=always'
alias mkdir='mkdir -p'
Expand All @@ -45,9 +51,14 @@ alias free='free -h'
alias wget='wget -c'
alias myexternalip='dig +short myip.opendns.com @resolver1.opendns.com'
alias catwithoutcomments='grep -v "^$\|^#"'
alias sudovim='sudo -E vim'
alias checkcommand='type -t'
alias pipenv-run='pipenv run python'
alias htb='cd /opt/htb'
alias codeby='cd /opt/codeby'
alias go-codeby='wg-quick up NordeN'
alias empire-server='docker start empire & docker attach empire'
alias empire-client='docker exec -it empire ./ps-empire client'
alias hosts='sudo vim /etc/hosts'

alias ..='cd ..'
alias ...='cd ../..'
Expand All @@ -57,8 +68,3 @@ alias ......='cd ../../../../..'
alias .......='cd ../../../../../..'
alias ........='cd ../../../../../../..'

ctlstartandstat ()
{
systemctl start "$1"
systemctl status "$1"
}
8 changes: 8 additions & 0 deletions bash_and_zsh/.functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function ctlstartandstat () {
systemctl start "$1"
systemctl status "$1"
}

function sudovim() {
sudo -E vim $1
}
62 changes: 0 additions & 62 deletions zsh/.zsh_aliases

This file was deleted.

4 changes: 0 additions & 4 deletions zsh/.zsh_functions

This file was deleted.

5 changes: 3 additions & 2 deletions zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ plugins=(
)

source $ZSH/oh-my-zsh.sh
for config_file in $HOME/.{zsh_aliases,zsh_functions}; do

for config_file in $HOME/.{aliases,functions}; do
if [[ -r "$config_file" ]] && [[ -f "$config_file" ]]; then
source "$config_file"
fi
done
unset file
unset config_file

# Настройки автодополнения zsh
zstyle ':completion:*' special-dirs false
Expand Down

0 comments on commit b332cbb

Please sign in to comment.