-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
112 lines (101 loc) · 2.68 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# aliases
alias rmf='shred -uzn 4'
alias rmd='wipe -rfqQ -s 8'
alias daterc='date -R | xsel -b -i' # input date (RFC 5322) to clipboard (for changelog)
alias _date='date +"%d/%m/%Y - %H:%M:%S"' # simple format
alias ls='ls -1l --group-directories-first -hN --color'
alias la='ls -A --color'
alias c='cd ~/'
alias d='cd ~/Downloads'
alias s='cd ~/sources'
alias gm='cd ~/git/myenv'
alias gs='cd ~/git/salsa'
alias gw='cd ~/git/work'
alias mn='cd ~/git/myenv/notes'
alias pb='cd /var/cache/pbuilder'
alias mm='cd ~/main && vim -c NERDTree'
alias m='cd ~/main'
alias v='vim'
alias a='sudo aptitude'
alias n='neomutt'
alias nb='newsboat'
alias tos='cd ~/main/.trash && ls -a'
alias tod='cd ~/main/self && vim todo/head'
alias sshc='cd ~/.ssh && vim ~/.ssh/config'
alias lb='cd ~/.local/bin'
alias brc='vim ~/.bashrc'
alias rb='sudo reboot'
alias sdn='sudo shutdown -h now'
alias cc='xsel -p -c; xsel -b -c' # clear primary/clipboard selections
alias rcd='d=$(rnd-stdout.sh 8); mkdir $d; cd $d'
alias grep='grep --color'
alias diff='diff --color'
alias rm='rm -v'
alias cp='cp -vi'
alias mv='mv -vi'
alias mkdir='mkdir -v'
# exports
export LANG=en_US.UTF8
export LC_ALL=en_US.UTF-8
export EDITOR='/usr/bin/vim'
export BROWSER='/usr/bin/firefox'
export TERMINAL='/usr/bin/xfce4-terminal'
export [email protected]
export DEBFULLNAME="Kirill Rekhov"
# function for my .vimrc trick (vnoremap)
# (vim -> visual mode -> ctrl + c -> ~/vbuf)
# ~/vbuf file has saved lines from the clipboard
vb()
{
[ -s ~/vbuf ] && vim ~/vbuf || echo $?
}
# touch file with verbose mode =)
vtouch()
{
for i do
touch "$i"
[ $? == 0 ] && echo "touched: '$i'"
done
} && alias touch='vtouch'
# .bash_history
HISTSIZE=8000
HISTFILESIZE=$HISTSIZE
HISTCONTROL=ignoreboth
_bash_history_sync()
{
builtin history -a
HISTFILESIZE=$HISTSIZE
builtin history -c
builtin history -r
}
history()
{
_bash_history_sync
builtin history "$@"
}
PROMPT_COMMAND=_bash_history_sync
# color man pages
man()
{
LESS_TERMCAP_mb=$'\e[0;91m'
LESS_TERMCAP_md=$'\e[0;91m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[07m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[0;4;32m' \
command man "$@"
}
# prompt variable
# good ideas: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#afowler
PS1='\[\e[0;33m\]\A|\[\e[0;32m\]\h:\[\e[0;36m\]\w \[\033[0;34m\]\u\[\e[0m\] \$ '
# set 077 umask for the user
# files -> 600 (rw-------)
# directories -> 700 (rwx------)
# for all users need change /etc/profile
# https://wintelguy.com/umask-calc.pl
(( $(umask) != 077 )) && umask 077
# start the terminal multiplexer
if command -v tmux >/dev/null; then
[ -z "$TMUX" ] && tmux
fi