My dotfiles. Period.

main.bashrc 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. #!/bin/bash
  2. ## hack to workaround Fedora/Red Hat bug 878428
  3. #shellcheck disable=SC1091
  4. test -f /usr/share/git-core/contrib/completion/git-prompt.sh \
  5. && . /usr/share/git-core/contrib/completion/git-prompt.sh
  6. #######################################################
  7. ### things to do BEFORE host/user-specific settings ###
  8. #######################################################
  9. ### .... ###
  10. ### SUBZ ###
  11. ### '''' ###
  12. prepend() {
  13. #
  14. # pre-pend $2 to filename $1
  15. #
  16. local path=$1
  17. local prefix=$2
  18. local dirpath
  19. local filename
  20. local abspath
  21. abspath=$(readlink -f "$path")
  22. dirpath=$(dirname "$abspath")
  23. filename=$(basename "$abspath")
  24. echo mv "$path" "$dirpath/$prefix-$filename"
  25. }
  26. smv() {
  27. #
  28. # scp but rm the source
  29. #
  30. local src=$1
  31. local dst=$2
  32. test $# -eq 2 || {
  33. echo "i can only 2 argz!" >&2
  34. return 2
  35. }
  36. scp "$src" "$dst" && rm "$src"
  37. }
  38. smvr() {
  39. #
  40. # smv but recursive
  41. #
  42. local src=$1
  43. local dst=$2
  44. test $# -eq 2 || {
  45. echo "i can only 2 argz!" >&2
  46. return 2
  47. }
  48. scp -r "$src" "$dst" && rm -r "$src"
  49. }
  50. snore() {
  51. #
  52. # Sleep loudly-ish for $1 time
  53. #
  54. local stime=${1:-0}
  55. test "$stime" == 0 || echo -e "sleeping for $BASHUM_COLOR_LGREEN$stime$BASHUM_COLOR_NORMAL"
  56. sleep "$stime"
  57. }
  58. dotsleep() {
  59. #
  60. # Sleep with dots for $1 seconds
  61. #
  62. local secs=$1
  63. echo -e "sleeping for $BASHUM_COLOR_LGREEN$secs$BASHUM_COLOR_NORMAL seconds"
  64. local secs_togo=$secs
  65. while test "$secs_togo" -gt 0; do
  66. sleep 1
  67. echo -n .
  68. ((secs_togo--))
  69. done
  70. echo
  71. }
  72. bb() {
  73. #
  74. # Ring the bell after $1 time of sleep
  75. #
  76. local stime=${1:-0}
  77. snore "$stime"
  78. printf '\a'
  79. }
  80. spec_cksources() {
  81. #
  82. # Check Source?: URL's in RPM spec file $1
  83. #
  84. local file=$1
  85. local hdr
  86. local url
  87. rpmspec -P "$file" \
  88. | grep -E 'Source[0-9]+: *http' \
  89. | while read -r hdr url; do
  90. echo -n "$hdr: $url .."
  91. curl -fsSL -I "$url" >/dev/null || {
  92. echo fail
  93. return 1
  94. }
  95. echo ok
  96. done
  97. }
  98. nn() {
  99. #
  100. # Ring the bell and send notification $1 after $2 time
  101. #
  102. local msg=${1:-this is done}
  103. local stime=$2
  104. bb "$stime"
  105. echo -e "hey, $BASHUM_COLOR_LRED$msg$BASHUM_COLOR_NORMAL"
  106. notify-send -a 'nn()' "hey, $msg"
  107. }
  108. pp() {
  109. #
  110. # Ring the bell and send notification $1 and pause
  111. #
  112. local msg=${1:-this is done}
  113. bb
  114. echo -e "hey, \033[1;31m$msg\033[1;0m!"
  115. notify-send -a 'pp()' "hey, $msg"
  116. read -r junk -p "Press Enter to continue"
  117. }
  118. wrep() {
  119. #
  120. # Print each line on STDIN $1 times horizontally
  121. #
  122. echo >&2 "use sdup -w instead!"
  123. local rep=${1:-1}; shift
  124. local delim=${1:-" "}; shift
  125. local line
  126. local n
  127. while read -r line; do
  128. local head=true
  129. n=$rep
  130. while test "$n" -gt 0;
  131. do
  132. $head || echo -n "$delim"
  133. $head && head=false
  134. echo -n "$line"
  135. ((n--))
  136. done
  137. echo
  138. done
  139. }
  140. lrep() {
  141. #
  142. # Print each line on STDIN $1 times
  143. #
  144. echo >&2 "use sdup -l instead!"
  145. local rep=${1:-1}; shift
  146. local line
  147. local n
  148. while read -r line; do
  149. n=$rep
  150. while test "$n" -gt 0;
  151. do
  152. echo "$line"
  153. ((n--))
  154. done
  155. done
  156. }
  157. prep() {
  158. #
  159. # Print STDIN $1 times
  160. #
  161. echo >&2 "use sdup instead!"
  162. local rep=${1:-1}; shift
  163. local data
  164. data=$(cat)
  165. n=$rep
  166. while test "$n" -gt 0;
  167. do
  168. echo "$data"
  169. echo
  170. ((n--))
  171. done
  172. }
  173. dt() {
  174. #
  175. # Open $1 new terminals
  176. #
  177. __bashum_run_n "${1:-1}" urxvt
  178. }
  179. dT() {
  180. #
  181. # Open $1 new alterminals
  182. #
  183. __bashum_run_n "${1:-1}" xfce4-terminal
  184. }
  185. hr() {
  186. #
  187. # Make horizontal ruler
  188. #
  189. local i
  190. local line
  191. for i in $(seq 1 "$COLUMNS"); do
  192. case $((i%10)) in
  193. 0) line+='#' ;;
  194. *) line+='-' ;;
  195. esac
  196. done
  197. echo "$line"
  198. echo "$line"
  199. echo "$line"
  200. }
  201. __bashum_run_n() {
  202. #
  203. # Run $2.. in background $1 times
  204. #
  205. local n=${1:-1}; shift
  206. while test "$n" -gt 0;
  207. do
  208. "$@" &
  209. ((n--))
  210. done
  211. }
  212. twice() {
  213. #
  214. # Run $@ two times
  215. #
  216. "$@"
  217. "$@"
  218. }
  219. ckyaml() {
  220. #
  221. # Check if YAML file $1 is loadable
  222. #
  223. local yfile=$1
  224. test -n "$yfile" || { echo "usage: ckyaml FILE.yaml"; return 2; }
  225. python -c 'import yaml; import sys; print(yaml.load(sys.stdin)["this"])' <"$yfile"
  226. }
  227. git() {
  228. #
  229. # /usr/bin/git wrapper just to disable dangerous commands
  230. #
  231. # In particular, `git-am` is a a close typo of my favorite
  232. # aliases `ap` (`git-add --patch`) and `cm` (`git-commit`)
  233. # but it's dangerous to call by accident as it destroys
  234. # workdir changes.
  235. #
  236. if grep -Fwqse "$1" "$GIT_DISABLED_COMMANDS"; then
  237. echo "You don't want this." >&2
  238. return 1
  239. else
  240. command git "$@"
  241. fi
  242. }
  243. grepcl() {
  244. #
  245. # Grep in common chat log files
  246. #
  247. # The order is from older apps to newer as I was moving towards
  248. # weechat.
  249. #
  250. grep "$@" -R \
  251. "$HOME/.config/xchat2/xchatlogs" \
  252. "$HOME/.config/xchat2/scrollback" \
  253. "$HOME/.config/hexchat/logs" \
  254. "$HOME/.config/hexchat/scrollback" \
  255. "$HOME/.local/share/weechat/logs.old" \
  256. "$HOME/.local/share/weechat/logs"
  257. }
  258. grepfx() {
  259. #
  260. # Grep recursively for technical debt
  261. #
  262. # '[F]' hack to avoid matching self
  263. #
  264. grep --color -n \
  265. --exclude-dir 'utils' \
  266. --exclude-dir '.git' \
  267. -o '#[F]IXME:.*' -R "$@"
  268. }
  269. grepr() {
  270. #
  271. # Grep recursively, keeping numbers and ignoring common dirs
  272. #
  273. # Number one tool for refactoring!
  274. #
  275. local p=$1; shift
  276. grep --color -n --exclude-dir=".git" -e "$p" -R "$@"
  277. }
  278. grepr1() {
  279. #
  280. # Like grepr() but only list matching items in this directory
  281. #
  282. # Ie. list only files in current directory or names of subdirectories
  283. # where matches were found "somewhere".
  284. #
  285. grepr "$@" -l | cut -d/ -f1 | uniq
  286. }
  287. greph() {
  288. #
  289. # Grep through bash history
  290. #
  291. history | sed 's/^ *//; s/ / /' | cut -d' ' -f2- | grep "$@"
  292. }
  293. gitcd() {
  294. #
  295. # Deep in git repo, cd to the git root
  296. #
  297. cd "$(git rev-parse --show-toplevel)" || return 1
  298. }
  299. clsz() {
  300. #
  301. # Clear screen and move the prompt to bottom
  302. #
  303. tput clear; tput cup "$(tput lines)" 0
  304. }
  305. bcdiff() {
  306. #
  307. # Call bcompare only if objects actually differ
  308. #
  309. test $# -eq 2 && diff "$@" >/dev/null && return
  310. bcompare "$@" &
  311. }
  312. strip_colors() {
  313. #
  314. # Strip color codes from stdin
  315. #
  316. # Stolen from http://unix.stackexchange.com/a/4533/9365
  317. #
  318. sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g'
  319. }
  320. vims() {
  321. #
  322. # List Vim .swp files in a nice table
  323. #
  324. # **Note:** For this ro work, you need to set up Vim to
  325. # use same swap directory as assigned below. this can
  326. # be achieved by addoing section such as this to your
  327. # .vimrc:
  328. #
  329. # if isdirectory($HOME . '/.local/share/vim') == 0
  330. # :silent !mkdir -p ~/.vim/swap >/dev/null 2>&1
  331. # endif
  332. # set directory=./.vim-swap//
  333. # set directory+=~/.local/share/vim/swap//
  334. # set directory+=~/tmp//
  335. # set directory+=.
  336. #
  337. # Call this after crash or poweroff to remind yourself what
  338. # files you were editing before fact. Example:
  339. #
  340. # 2015-07-10 06:10:48.603953758 +0200 ~/TODO.todo
  341. #
  342. # This should make it easier to recover after a little
  343. # disaster.
  344. #
  345. local swap="$HOME/.local/share/vim/swap"
  346. #shellcheck disable=SC1117
  347. find "$swap" -type f -print0 \
  348. | xargs -0 -r stat -c "%y %n" \
  349. | sed "
  350. s| $swap/| |
  351. s|%|/|g
  352. s|.swp$||
  353. s| $HOME| ~|
  354. s| \(..:..\):[^ ]* +.... | \\1 |
  355. " \
  356. | sort \
  357. | tac
  358. }
  359. fixnl() {
  360. #
  361. # Fix newlines in stdin and pass to stdout
  362. #
  363. # Note: We need to read whole stdin; this cannot work
  364. # for infinite stream.
  365. #
  366. # Fix annoying cases:
  367. #
  368. # * If multi-line text is missing newline at the
  369. # end---add the missing newline.
  370. #
  371. # * If -c is passed, and single-line text does have
  372. # a newline at the end, remove it.
  373. #
  374. # This will not touch properly terminated multi-line texts,
  375. # or zero-line texts (ie. oly chars with no newline at all).
  376. #
  377. local arg=$1 # argument passed
  378. local cache # cache to keep stream in
  379. local nlcount # count of newlines in the stream
  380. local lastchr # hex dump (2-digit, lowercase) of last char
  381. local single=keep # single-line streams:
  382. # keep: do nothing
  383. # chop: drop last char if it's a LF
  384. case $arg in
  385. -c|--chop-single) single=chop ;;
  386. esac
  387. cache="$(mktemp -t fixnl.XXXXXXXX)"
  388. cat >"$cache"
  389. nlcount=$(<"$cache" wc -l)
  390. lastchr=$(<"$cache" tail -c1 | hexdump -e '"%02x"')
  391. case $nlcount:$lastchr:$single in
  392. 0:??:*) cat "$cache" ;; # 'abc' => keep as is
  393. 1:0a:chop) head -c -1 "$cache" ;; # 'abc\n' => -c passed: chop!
  394. 1:0a:keep) cat "$cache" ;; # 'abc\n' => keep as is
  395. *:0a:*) cat "$cache" ;; # 'a\nb\nc\n' => keep as is
  396. *:??:*) cat "$cache"; echo ;; # 'a\nb\nc' => add the missing NL
  397. esac
  398. rm "$cache"
  399. }
  400. nlfor() {
  401. #
  402. # Replace $1 (or blank space) with newlines and fix final newline
  403. #
  404. # Shorthand for commonly used tr syntax. Example:
  405. #
  406. # $ echo "$PATH" | nlat :
  407. # /foo
  408. # /bar
  409. # $
  410. #
  411. # is almost like `tr : '\n'` except that it is a bit easier
  412. # to type and fixes the annoying problem with missing
  413. # newline at the end of the replaced string.
  414. #
  415. local char=$1
  416. test -n "$char" || char='[:blank:]'
  417. tr "$char" '\n' \
  418. | fixnl
  419. }
  420. nljoin() {
  421. #
  422. # Join lines with $1 (or space)
  423. #
  424. # Shorthand for commonly used tr syntax. Example:
  425. #
  426. # $ { echo foo; echo bar; } | nljoin :
  427. #
  428. # is almost like `tr '\n' :` except that it is a bit easier
  429. # to type and fixes the annoying problem with extraneous
  430. # newline/colon at the end of final string.
  431. #
  432. local char=$1
  433. test -n "$char" || char=' '
  434. tr '\n' "$char" \
  435. | sed "s/$char*$//" \
  436. | fixnl -c
  437. }
  438. urle() {
  439. #
  440. # Encode or decode (if $1 is '-d') message on stdin as URL encode
  441. #
  442. local fn=quote
  443. case $1 in
  444. -d) fn=unquote ;;
  445. -*) echo 'usage: urle [-d] <text' >&2; return 2 ;;
  446. esac
  447. python3 -c "import sys; from urllib.parse import $fn; print($fn(sys.stdin.read()));"
  448. }
  449. qpr() {
  450. #
  451. # Encode or decode (if $1 is '-d') message on stdin as Quoted Printable
  452. #
  453. local fn=encode
  454. case $1 in
  455. -d) fn=decode ;;
  456. -*) echo 'usage: qpr [-d] <text' >&2; return 2 ;;
  457. esac
  458. perl -MMIME::QuotedPrint -pe "\$_=MIME::QuotedPrint::$fn(\$_);"
  459. }
  460. xop() {
  461. #
  462. # Common clipboard operations with fixnl() on top
  463. #
  464. local op=$1
  465. local file=${2:-/dev/stdin}
  466. case $op in
  467. oo) xclip -selection clipboard -o | fixnl ;;
  468. o) xclip -o | fixnl ;;
  469. ii) fixnl -c | xclip -selection clipboard -i ;;
  470. i) fixnl -c | xclip -i ;;
  471. esac <"$file"
  472. }
  473. xod() {
  474. #
  475. # Like mktemp but get the content from clipboard
  476. #
  477. # Dump xo in a file named $1 somewhere in /tmp; echo the path
  478. # usage: scp $(xod useful_name.txt) eg:some/shared/place
  479. # instead of:
  480. #
  481. # xo > useful_name.txt
  482. # scp useful_name.txt eg:some/shared/place
  483. # rm useful_name.txt
  484. #
  485. local name="${1:-clipboard_dump.txt}"
  486. local tmp
  487. tmp=$(mktemp -d -t "xod.XXXXXXXX")
  488. xclip -o > "$tmp/$name"
  489. echo "$tmp/$name"
  490. }
  491. xood() {
  492. #
  493. # Just like xod() but using xoo (i.e. 'clipboard' clipboard)
  494. #
  495. local name="${1:-clipboard_dump.txt}"
  496. local tmp
  497. tmp=$(mktemp -d -t "xood.XXXXXXXX")
  498. xclip -selection clipboard -o > "$tmp/$name"
  499. echo "$tmp/$name"
  500. }
  501. xl() {
  502. #
  503. # Show primary clipboard in less(1)
  504. #
  505. xop o | less -S
  506. }
  507. xxl() {
  508. #
  509. # Show C-C clipboard in less(1)
  510. #
  511. xop oo | less -S
  512. }
  513. xvxx() {
  514. #
  515. # Edit text in primary clipboard and save it to C-C clipboard
  516. #
  517. # Ideal for editing snippets in browser-based editors: during editing,
  518. # select the text, open terminal, call `xvxx`, edit the text, move
  519. # back to the browser and paste it over the old (still selected) text.
  520. # That's it, no need to make up and save temporary files.
  521. #
  522. # If you quickly realize you need to re-edit the text, use xxvxx().
  523. #
  524. xop o | vipe | xop ii
  525. }
  526. xcp() {
  527. #
  528. # Copy paths of $@ to clipboard
  529. #
  530. local path
  531. find "$@" -maxdepth 0 -mindepth 0 \
  532. | while read -r path; do
  533. readlink -e "$path"
  534. done \
  535. | xop i
  536. }
  537. xpst() {
  538. #
  539. # Paste paths from clipboard
  540. #
  541. { xop o; echo; } \
  542. | while read -r path; do
  543. echo "path='$path'" >&2
  544. test -e "$path" || {
  545. echo "does not exist: $path"
  546. continue
  547. }
  548. cp -r "$path" .
  549. done
  550. }
  551. xvb() {
  552. #
  553. # Edit text in primary clipboard and run it using bash
  554. #
  555. xop o | vipe | bash
  556. }
  557. xxvb() {
  558. #
  559. # Edit text in C-C clipboard and run it using bash
  560. #
  561. xop oo | vipe | bash
  562. }
  563. vxx() {
  564. #
  565. # Edit text on stdin and save it to C-C clipboard
  566. #
  567. # Ideal for editing outut of command before pasting ot to browser
  568. # or another GUI application. Run the command with `vxx`, edit
  569. # the text, move back to the application and paste it.
  570. #
  571. # If you quickly realize you need to re-edit the text, use xxvxx().
  572. #
  573. vipe | xop ii
  574. }
  575. xcxx() {
  576. #
  577. # Filter text in primary clipboard using command $@ and save it to C-C clipboard
  578. #
  579. # Similar to xvxx() but instead of interactive editing, provided filter
  580. # command is run.
  581. #
  582. local cmd=("$@")
  583. xop o | "${cmd[@]}" | xop ii
  584. return "${PIPESTATUS[1]}"
  585. }
  586. vx() {
  587. #
  588. # Edit stdin and save it to primary clipboard
  589. #
  590. # Ideal for selecting snippets of output of arbitrary commands.
  591. # select the text, open terminal, call `xvx`, edit the text, move
  592. # back to the browser and paste it over the old (still selected) text.
  593. # That's it, no need to make up and save temporary files.
  594. #
  595. vipe | xop i
  596. }
  597. xxvxx() {
  598. #
  599. # Edit text in C-C clipboard and save it back
  600. #
  601. xop oo | vipe | xop ii
  602. }
  603. yt2ogg() {
  604. #
  605. # Download YouTube video as vorbis audio
  606. #
  607. local url=$1
  608. youtube-dl -x --audio-format vorbis "$url"
  609. }
  610. yum_hasbin() {
  611. #
  612. # Ask yum who has bin $1 (and make the output actually readable)
  613. #
  614. local bname
  615. for bname in "$@";
  616. do
  617. case $bname in
  618. */*) dnf provides "$bname" ;;
  619. *) dnf provides "*/bin/$bname" ;;
  620. esac \
  621. | grep '^.' \
  622. | grep -E '^[[:alnum:]_:.-]+ :'
  623. done
  624. }
  625. cal() {
  626. #
  627. # cal with the proper version pick
  628. #
  629. local cal_v
  630. local cal_es
  631. cal_v=$(command cal -V 2>/dev/null); cal_es=$?
  632. case $cal_es:$cal_v in
  633. 0:cal\ from\ util-linux\ 2.*)
  634. command cal --color=always --monday --week "$@"
  635. ;;
  636. 64:*)
  637. command cal -M "$@"
  638. ;;
  639. esac
  640. }
  641. ### .... ###
  642. ### BASH ###
  643. ### '''' ###
  644. HISTCONTROL=ignoredups:erasedups
  645. # shopt -s histappend
  646. # PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
  647. HISTIGNORE="$HISTIGNORE:ls:ll:la:cd"
  648. HISTIGNORE="$HISTIGNORE:git st"
  649. HISTIGNORE="$HISTIGNORE:se *:sc *"
  650. HISTSIZE=33333
  651. HISTFILESIZE=33333
  652. HISTTIMEFORMAT='%F %T '
  653. GLOBIGNORE=.:..
  654. # shopt -s histverify
  655. # some more aliases
  656. alias cls='clear'
  657. alias czkrates='czkrates -v'
  658. alias ll='ls -lh'
  659. alias lla='ls -lha'
  660. alias lr='ll -lhrt'
  661. alias open='xdg-open'
  662. alias diff='colordiff -u'
  663. alias dmesg='dmesg --time-format iso'
  664. alias pad4='sed -e "/./s/^/ /"'
  665. alias mkittool='mkittool -v'
  666. alias grep='grep --color'
  667. alias sc='se --direction encz.cz'
  668. alias taskm='task modify'
  669. alias tasks='task rc.context:none'
  670. alias ts='ts "%F %T"'
  671. alias lsblk='lsblk -o +UUID,LABEL'
  672. alias pstree='pstree -h'
  673. alias virsh='virsh --connect qemu:///system'
  674. alias wttr='curl -s "wttr.in/?1&n&q"'
  675. alias xaa='xclip -o | audit2allow'
  676. alias xi='xop i'
  677. alias xii='xop ii'
  678. alias xo='xop o'
  679. alias xoo='xop oo'
  680. alias reboot="echo -n . ; sync ; echo -n . ; sync ; echo -n . ; systemctl reboot"
  681. alias poweroff="echo -n . ; sync ; echo -n . ; sync ; echo -n . ; systemctl poweroff"
  682. x4xx() {
  683. #
  684. # Pad text from primary clipboard with 4 spaces; save to C-C clipboard
  685. #
  686. # ...that is, for inclusion as Markdown verbatim text.
  687. #
  688. xop oo | pad4 | xop ii
  689. }
  690. x4x() {
  691. #
  692. # Pad text from primary clipboard with 4 spaces; save back
  693. #
  694. # ...that is, for inclusion as Markdown verbatim text.
  695. #
  696. xop -o | pad4 | xop i
  697. }
  698. BASHUM__RV_TMP="/tmp/bashum-rv"
  699. mkdir -p "$BASHUM__RV_TMP"
  700. ### ...... ###
  701. ### OTHERS ###
  702. ### '''''' ###
  703. export LC_COLLATE=C # make sort upper first
  704. export EDITOR=vim
  705. export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
  706. export LESS=' -R '
  707. export NEATY=color
  708. export PRETTY=color
  709. export PRETTY_DEBUG_EXCLUDE=inigrep
  710. export MDVIMB__CONVERTER=cmark
  711. export MDVIMB__STYLE=darkzen # pergamen
  712. #shellcheck disable=SC2034
  713. {
  714. GIT_PS1_SHOWDIRTYSTATE=true
  715. GIT_PS1_SHOWUNTRACKEDFILES=true
  716. __SATURNIN_COMPLETE_DEBUG=true
  717. GIT_DISABLED_COMMANDS="$HOME/.gittum/disabled-commands"
  718. }
  719. export GIT_PAGER='less -S'
  720. # disable mounting things like SFTP to ~/.gvfs when accessed
  721. # via GIO (used by nautilus etc.)
  722. export GVFS_DISABLE_FUSE=1
  723. # disable the terrible beep sound (only for X; for tty?, blacklist pcspkr)
  724. xhost >& /dev/null && xset b off
  725. # get rid of those .pyc files once and for all
  726. export PYTHONDONTWRITEBYTECODE=1
  727. ssh-add -l >& /dev/null || ssh-add