summaryrefslogtreecommitdiff
path: root/.bashrc
blob: 296640ffa76952bb5e7cae56744816b6219b4b5e (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# ~/.bashrc

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

export PAGER=less
export EDITOR=vim
export HISTIGNORE=2fa:ls:ps:history:tc:cursor
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

# Disable Ctrl-S
stty -ixon

# Save and reload the history after each command finishes
#export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

# Change font for urxvt. Examples:
# cf 9x15
# cf xft:Monospace:size=12
# cf "xft:Bitstream Vera Sans Mono:size=8:antialias=true
# cf() { printf '\e]710;%s\007' "${1:-fixed}"; }

p() {  [ -f "$1" -a ! -x "$1" ] && less "$1" || "$@" 2>&1 | less; }
export -f p

fixab() { printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 "$1"; }

# Less: use colors in place of bold/underline
# red: 1, green: 2, yellow: 3, blue: 4, magenta: 5, cyan: 6, grey: 7, black: 8
#export LESS_TERMCAP_md=$(tput setaf 4) # bold (blue)
#export LESS_TERMCAP_me=$'\E[0m'		# end bold
#export LESS_TERMCAP_us=$(tput setaf 5)	# underline (magenta)
#export LESS_TERMCAP_ue=$'\E[0m'		# end underline

# Less: use a 4-space tabulation, search with ignorecase, no terminal (de)init
export LESS=iXFRx4

# gnuplot display in terminal
export GNUTERM='sixelgd enhanced truecolor size 1600,1200 font "arial,9" fontscale 2'

# Explicit empty LS_COLORS (normally unset) for fd(1) in light terminals. No change for ls(1).
export LS_COLORS=""

#export BACKUP=bip:/home/backup/marc@m1

export DOT='dotty -'

# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'

#export TERMINAL=xt
#alias cl='cf xft:Mono:size=12'
#alias cp='cp --reflink'
#alias ls='ls --color=auto -v'
alias ls='ls -GF'
alias ll='ls -AlGFhv'
#alias vi='vim'
#alias view='vim -R'
alias ldd='otool -L'
alias ibrew='arch -x86_64 /usr/local/bin/brew'
#alias op='xdg-open'
#alias git='hub'
#alias go='go1.14.1'
#alias go11='go1.11.13'
#alias go12='go1.12.10'
#alias go13='go1.13.8'
#alias go14='go1.14.2'
alias goa='go build -gcflags -S'
alias gob='go build'
alias goh='p go help'
alias god='p go doc'
alias gol='GO111MODULE=off go'
alias golint='golangci-lint run --no-config --disable-all -E'
# 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 rvi='sudo vim'
#alias rxt='sudo xt'
#alias rxvi='sudo xvi'
alias ww='(cd ~/Wiki && vi home_page.md)'
alias s='(cd ~/Wiki && vi scratch.md)'
alias dotfiles='git --git-dir=$HOME/dotfiles --work-tree=$HOME'
alias pv='qlmanage -p'

gtr() { go test -v -run "$@"; }
export -f gtr

#alias uc='systemctl --user'
#alias wpa='sudo wpa_gui -i wlan0'

#alias ifre='echo "ip link set wlo1 down; ip link set wlo1 up"|sudo sh'

# Some admin command
#alias dmesg='sudo dmesg'
#alias mount='sudo mount'
#alias umount='sudo umount'
#alias cryptsetup='sudo cryptsetup'

alias by='go build ./cmd/yaegi'
#alias by8='go1.18.3 build ./cmd/yaegi'
alias cy='cd ~/go/src/github.com/traefik/yaegi'
#alias ty='go test -v -short ./interp'
alias y='rlwrap -pblue yaegi'
alias dy='YAEGI_AST_DOT=1 YAEGI_CFG_DOT=1 ./yaegi'
alias wai='~/go/src/github.co/traefik/whoami/whoami'

# yaegi debug
export YAEGI_DOT_CMD="dotty -"
export YAEGI_UNSAFE=1
export YAEGI_UNRESTRICTED=1
export YAEGI_SYSCALL=1

mkcd() { mkdir -p "$1" && cd "$1"; }

ssht() { ssh -t "$@" -- tmux a; }
export -f ssht

mpvx() { mpv --vo=sixel --profile=sw-fast --really-quiet "$@"; }
export -f mpvx

tfk() { ~/go/src/github.com/traefik/traefik/traefik "$@"; }
export -f tfk

ty() { go test -v -short ./interp; }
export -f ty

ty8() { go1.18.3 test -v -short ./interp; }
export -f ty8

# ws() (cd ~/Wiki && git status --short)
ws() { open -a safari "https://lite.duckduckgo.com/lite?q=$*"; }
export -f ws

wsd() (cd ~/Wiki && git add . && git diff --cached)
export -f wsd

man() {
	local width=''
	[ $(tput cols) -gt 88 ] && width='MANWIDTH=88'
	env $width man "$@"
}

preman() {
    mandoc -T pdf "$(/usr/bin/man -w $@)" | open -fa Preview
}

meteo() {
    local request="wttr.in/${1-Toulouse}?F&T"
    [ "$(tput cols)" -lt 125 ] && request+='&n'
    curl -H "Accept-Language: fr" --compressed "$request"
}

#PS1='[\u@\h \W]\$ '

# fzf
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# Accomodate different base prefix on termux
#[ -d "$HOME/../usr" ] && base=..
#[ -f "$base/usr/share/fzf/completion.bash" ] && . "$base/usr/share/fzf/completion.bash"
#[ -f "$base/usr/share/fzf/key-bindings.bash" ] && . "$base/usr/share/fzf/key-bindings.bash"
#unset base
export FZF_DEFAULT_COMMAND='rg -i --files --ignore-vcs --hidden'

export RIPGREP_CONFIG_PATH=~/.ripgreprc

eval "$(zoxide init bash)"

# Command completion
export HOMEBREW_REPOSITORY=/opt/homebrew
. /opt/homebrew/etc/profile.d/bash_completion.sh

# Arch: display package to install for missing commands
#[ -f '/usr/share/doc/pkgfile/command-not-found.bash' ] && . /usr/share/doc/pkgfile/command-not-found.bash

# Display git status in prompt
. ~/.bash-powerline.sh

# export GITHUB_TOKEN=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

# Added by Radicle.
export PATH="$PATH:/Users/marc/.radicle/bin"