summaryrefslogtreecommitdiffstats
path: root/.profile
blob: 3eba7f4314555cb81cbbc553242bb9f434a4e36d (plain) (blame)
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
# Moving aliases and other setup to non-shell-specific
# file ~/.profile

case $(uname) in
Darwin)
	if [ $SHELL = "/bin/bash" ] || [ $SHELL = "/opt/homebrew/bin/bash" ] || [ $SHELL = "/opt/local/bin/bash" ]; then
		set -o posix
		# OSX-specific bash warning
		export BASH_SILENCE_DEPRECATION_WARNING=1
	fi

	# MacPorts setup
	if [ -d '/opt/local' ]; then
		export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
		export MANPATH=/opt/local/share/man:$MANPATH
	fi

	# Brew (OSX) specifics
	if [ -f '/opt/homebrew/bin/brew' ]; then
		export HOMEBREW_PREFIX="/opt/homebrew"
		export HOMEBREW_CELLAR="/opt/homebrew/Cellar"
		export HOMEBREW_REPOSITORY="/opt/homebrew"
		export HOMEBREW_FORCE_BREWED_CURL=1
		export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/curl/bin${PATH+:$PATH}"
		export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:"
		export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"
		if [ -f "/opt/homebrew/etc/bash_completion.d/git-completion.bash" ]; then
			source /opt/homebrew/etc/bash_completion.d/git-completion.bash
		fi
	fi

	if [ $(command -v python3) ]; then
		export PATH=$(python3 -m site --user-base)/bin:$PATH
	fi

	# Load config from filesystem
	export AWS_SDK_LOAD_CONFIG=1

	# Add Local bin
	export PATH=$PATH:$HOME/.local/bin

	# Unlock Keychain cli
	alias unlock='security unlock-keychain ~/Library/Keychains/login.keychain'
	alias ls='/bin/ls -F -h -A -D "%F %H:%M:%S"'
	alias ll='/bin/ls -F -h -A -D "%F %H:%M:%S" -l'
	alias dua='du -h -d 1 | sort -h'
	;;
Linux)
	alias ls="/bin/ls --color=never -F -h -A "
	alias ll="/bin/ls --color=never -F -h -A -l"
	alias dua='du -h -d 1 | sort -h'
	;;
*BSD)
	export PAGER=less
	alias ls="/bin/ls -F -h -A "
	alias ll="/bin/ls -F -h -A -l"
	alias cvs-st="cvs -q -n update"
	set -o emacs
	if [ $SHELL = "/bin/sh" ]; then
		set -o tabcomplete
	fi
	if [ -d "/usr/pkg/bin" ]; then
		export PATH=$PATH:/usr/pkg/bin
	fi
	if [ -d "/usr/pkg/sbin" ]; then
		export PATH=$PATH:/usr/pkg/sbin
	fi
	export PATH=$PATH:/sbin:/usr/sbin:$HOME/.local/bin

	export CVS_RSH="ssh"
	export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"

	#Newsraft env
	export NO_COLOR="true"
	;;
esac

# Go setup
if [ -d "$HOME/.golang" ]; then
	### Just in case it's missing
	mkdir -p ~/.golang/path
	# Go in the homedir
	if [ -d "$HOME/.golang/go" ]; then
		#export GOROOT_BOOTSTRAP=$HOME/.golang/bootstrap_go
		export GOROOT_BOOTSTRAP=/usr/pkg/go122/
		export GOROOT=$HOME/.golang/go
	fi
	export GOPATH=$HOME/.golang/path
	# Disable broken caching by proxy.golang
	export GOPROXY=direct
	export GOSUMDB=off
	export PATH=$HOME/.golang/go/bin:$PATH:$HOME/.golang/path/bin
fi

# == Editors ==
# Vim not detected? Use vi as a fallback
if [ ! "$(command -v vim)" ]; then
	alias vim=vi
	export EDITOR="vi"
else
	# But do we also have neovim?
	if [ ! "$(command -v nvim)" ]; then
		export EDITOR="vim"
		export VISUAL="vim"
	else
		export EDITOR="nvim"
		export VISUAL="nvim"
		alias vim=nvim
	fi
fi

# Ensure less always uses the one-page, raw control characters, and no-init settings
export LESS=FRX

# Defaults
alias upcode="find $HOME/.code -name \".git\" -exec fetchgit {} \;"
alias gc_all="find $HOME/.code -name \".git\" | xargs -I {} -n 1 sh -c \"cd {}; echo {}; git gc --aggressive;\" "

## Zstd always uses all cores
if [ "$(command -v zstd)" ]; then
	alias zstd='zstd -T0'
fi

# == Rust Tools ==#
# Add Rust paths if present
if [ -d "$HOME/.cargo/bin" ]; then
	export PATH=$HOME/.cargo/bin:$PATH
fi

if [ $(command -v yt-dlp) ]; then
	alias yt-dlp="yt-dlp -S ext:mp4:m4a "
fi

# == END TOOLS ==

## == DOTFILES ==
# To load files
# git clone --bare ssh://tydavis@git.gluecode.net:/var/www/.gitdata/dotfiles $HOME/.dotfiles
#  OR
# git clone --bare git@git.sr.ht:~tydavis/dotfiles $HOME/.dotfiles

#shorten the git dotfiles management
alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
# Ignore files that aren't relevant
# dotfiles config --local status.showUntrackedFiles no
## == END DOTFILES ==

# Dedupe path entries
export PATH=$(printf %s "$PATH" | awk -v RS=: '{ if (!arr[$0]++) {printf("%s%s",!ln++?"":":",$0)}}')

export HISTFILE=~/.history
export HISTSIZE=10000
export PS1='\$ '