-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
62 lines (52 loc) · 2.05 KB
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# If not running interactively, stop!
[[ $- != *i* ]] && return
# Function to remove `<EOL>`
e() { find . -type f -not -path '*/\.git/*' -exec perl -pi -e 'chomp if eof' {} ';'; }
# Function to convert `<CR><LF>` to `<LF>`
n() { grep -lrw '\r' | xargs perl -pi -e 's/\r//g'; }
# Function to convert `<Tab>` to `<Space><Space><Space><Space>`
t() { grep -lrw '\t' | xargs perl -pi -e 's/\t/ /g'; }
# Add more aliases to complete the short version of CRUD commands:
# `cd`, `cp`, `ls`, `md`, `mv`, `rd`, `rm`
md() { mkdir "$@"; }
rd() { rmdir "$@"; }
alias .....='cd ../../../..'
alias ....='cd ../../..'
alias ...='cd ../..'
alias ..='cd ..'
alias aur-restore='echo "TODO"'
alias aur-save='pacman -Qqem > aur.bak'
alias desk-update='feh --bg-fill $HOME/Picture/Wall/* --no-fehbg --randomize'
alias grub-save='cp /etc/default/grub ~/grub.bak'
alias grub-update='grub-mkconfig -o /boot/grub/grub.cfg'
alias home='cd $HOME'
alias la='ls -A --color=auto'
alias ls='ls --color=auto'
alias pkg-restore='pacman -S --needed - < ~/pkg.bak'
alias pkg-save='pacman -Qqen > ~/pkg.bak'
alias pkg-update-all='pacman -Syu'
alias pkg-update='pacman -Syu --ignore=chromium,filezilla,firefox-developer-edition,gammy,gimp,libreoffice-fresh,obs-studio,openshot,simple-scan,vlc,xed' # Sync only the core package(s)
alias rxvt-update='xrdb .xinit/.Xresources';
alias sudo='sudo ' # <https://stackoverflow.com/a/37210013/1163000>
alias www='cd /srv/http'
alias xterm='urxvt'
# Function to change the terminal title automatically
title() {
if [[ "$PWD" = "/" ]];
then
PROMPT_COMMAND='echo -ne "\033]0;Terminal\007"'
elif [[ "$PWD" = "$HOME" ]];
then
PROMPT_COMMAND='echo -ne "\033]0;Home\007"'
else
PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"'
fi
}
# Hook it to the `cd` command
cd() { command cd "$@"; title; }
# Initialize the terminal title changer
title
# Colorize the `user@host` part
PS1='\[$(tput bold)\]\[$(tput setaf 2)\]\u@\h\[$(tput setaf 7)\]:\[$(tput setaf 4)\]\w\[$(tput sgr0)\]\$ '
export TERM='xterm-256color'
export XDG_SESSION_TYPE='X11'