summaryrefslogtreecommitdiff
path: root/.config/shell/profile
blob: bda9343d4c3735d3cbc42f248d163412f000381d (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
#!/bin/sh

export PATH="$PATH:$(du -L "$HOME/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')"

# use neovim if available
if command -v nvim &> /dev/null; then
    export EDITOR="nvim"
elif command -v vim &> /dev/null; then
    export EDITOR="vim"
fi
export SUDO_EDITOR="$EDITOR"
export VISUAL="$EDITOR"
# $HOME cleanup
# https://wiki.archlinux.org/index.php/XDG_Base_Directory
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
export LESSHISTFILE="-"
export HISTSIZE=10000
export HISTFILE="$XDG_STATE_HOME/bash/history"
export WGETRC="$XDG_CONFIG_HOME/wgetrc"
# npm
export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
# Golang
export GOBIN="$HOME/.local/bin/go"
export GOPATH="$XDG_DATA_HOME/go"
export GOMODCACHE="$XDG_CACHE_HOME/go/mod"
export PATH="$PATH:$GOBIN:$GOPATH/bin"
# Rust
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export PATH="$PATH:$CARGO_HOME/bin"
# bash
export BASH_COMPLETIONS="$XDG_DATA_HOME/bash-completion/completions"
# GPG
export GPG_TTY=$(tty)
# less
export LESS=-R
if command -v source-highlight &> /dev/null; then
    export LESSOPEN="| /usr/sbin/source-highlight %s"
fi
    # Taken from LS's dots. Not sure if should keep the '\e', since without it
    # less freaks out. Also, more info on the following links:
    # https://unix.stackexchange.com/questions/108699/documentation-on-less-termcap-variables
    # https://misc.flogisoft.com/bash/tip_colors_and_formatting
    # At last, I changed the codes to actually do what they're supposed to do.
export LESS_TERMCAP_mb="$(printf '%b' '\e[5;31m')"
export LESS_TERMCAP_md="$(printf '%b' '\e[1;36m')"
export LESS_TERMCAP_me="$(printf '%b' '\e[0m')"
export LESS_TERMCAP_so="$(printf '%b' '\e[1;45;33m')"
export LESS_TERMCAP_se="$(printf '%b' '\e[0m')"
export LESS_TERMCAP_us="$(printf '%b' '\e[4;32m')"
export LESS_TERMCAP_ue="$(printf '%b' '\e[0m')"
	# What these termcap variables mean:
		# termcap terminfo
		# ks      smkx      make the keypad send commands
		# ke      rmkx      make the keypad send digits
		# vb      flash     emit visual bell
		# mb      blink     start blink
		# md      bold      start bold
		# me      sgr0      turn off bold, blink and underline
		# so      smso      start standout (reverse video)
		# se      rmso      stop standout
		# us      smul      start underline
		# ue      rmul      stop underline

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        source "$HOME/.bashrc"
    fi
fi