blob: b52782a8a1e7a73686e2de4d80742d23c3a8dd24 (
plain)
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
|
# ~/.bashrc
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
export PAGER=less
export EDITOR=vim
export HISTIGNORE='sudo id:uname:date:exit:df:ll:ls:ps:pwd:tc:top:history'
export HISTCONTROL=ignoreboth:erasedups # no start space and duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
shopt -s globstar
shopt -s dotglob
stty -ixon # disable Ctrl-S
# Save and reload the history after each command finishes
#export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
# export GNUTERM='sixelgd enhanced truecolor font "arial,9"'
#
OS=${OS:-$(~/bin/os)}
# Support different operating system environments
case $OS in
(arch|alpine)
alias ls='ls --color=auto -v' ll='ls -AlFhv'
[ "$OS" = arch ] || trap 'printf "\e]2;${PWD/~/\~} ${BASH_COMMAND%ps1}\a"' DEBUG
;;
(Darwin)
alias ls='ls -GF' ll='ls -AlGFhv'
alias ldd='otool -L'
alias ibrew='arch -x86_64 /usr/local/bin/brew'
trap 'printf "\e]2;${PWD/~/\~} ${BASH_COMMAND%update_terminal_cwd}\a"' DEBUG
;;
(termux)
PATH=~/bin:${HOME%/*}/usr/bin:~/go/bin
type eza >/dev/null && alias ls='eza' ll='eza -lao --no-user --no-permissions' ||
alias ls='ls --color=auto -v' ll='ls -AlFhv'
;;
esac
p() { [ -f "$1" -a ! -x "$1" ] && less "$1" || "$@" 2>&1 | less; }
export -f p
export LESS=iXFRx4
#export BACKUP=bip:/home/backup/marc@$(hostname -s)
# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
alias grep='grep -i --color'
alias more='less'
alias vi='vim'
alias view='vim -R'
alias gob='go build'
alias goh='p go help'
alias god='p go doc'
alias gol='GO111MODULE=off go'
alias gtr='go test -v -run'
alias gtb='go test -v -cpuprofile cpu.out -memprofile mem.out -benchmem -bench'
alias gdt='dlv test -- -test.v -test.run'
alias ww='vi ~/Wiki/home_page.md'
alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME'
alias apk='doas apk'
alias rg='rg --smart-case'
alias y='rlwrap -pblue yaegi'
alias dy='YAEGI_AST_DOT=1 YAEGI_CFG_DOT=1 ./yaegi'
# yaegi debug
export YAEGI_DOT_CMD='dotty -'
export YAEGI_UNSAFE=1
export YAEGI_UNRESTRICTED=1
export YAEGI_SYSCALL=1
sshs() { ssh -t "$@" -- screen -d -R; }
man() {
local width=''
[ $(tput cols) -gt 88 ] && width='MANWIDTH=88'
env $width man "$@"
}
meteo() {
local request="wttr.in/${1-Toulouse}?F&T"
[ "$(tput cols)" -lt 125 ] && request+='&n'
curl -H "Accept-Language: fr" --compressed "$request"
}
eval "$(fzf --bash)" >/dev/null
# Handle missing commands, unless already provided.
type -t command_not_found_handle >/dev/null || command_not_found_handle() {
case $OS in
(alpine) pkgs=$(apk list -Pq "cmd:$1" | awk '{print $2}') ;;
(arch) pkgs=$(pkgfile -b "$1") ;;
(Darwin) pkgs=$(brew which-formula "$1") ;;
esac
echo "$1: command not found${pkgs:+. Present in: $pkgs}" >&2
}
# Display git status in prompt
. ~/.bash-powerline.sh
|