-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_profile
123 lines (103 loc) · 3.59 KB
/
dot_profile
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
# vim: noet
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# Exports
test -d ${HOME}/.local/bin && PATH="${HOME}/.local/bin:${PATH}"
test -d ${HOME}/bin && PATH="${HOME}/bin:${PATH}"
export GOPATH=$HOME/.local/share/go
[ -d $GOPATH ] || mkdir -p $GOPATH
test -d ${GOPATH}/bin && PATH="${GOPATH}/bin:${PATH}"
export PATH
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-${HOME}/.cache}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}"
export XDG_STATE_HOME="${XDG_STATE_HOME:-${HOME}/.local/state}"
mkdir -p ${XDG_CONFIG_HOME}
mkdir -p ${XDG_CACHE_HOME}
mkdir -p ${XDG_DATA_HOME}
mkdir -p ${XDG_STATE_HOME}
# Functions
FUNCTIONS_DIR="${XDG_CONFIG_HOME}/functions"
if [ -d "${FUNCTIONS_DIR}" ]; then
for function_file in $(ls -1 ${FUNCTIONS_DIR}/*.sh); do
. "${function_file}"
done
fi
# Aliases
ALIASES_DIR="${XDG_CONFIG_HOME}/aliases"
if [ -d "${ALIASES_DIR}" ]; then
for alias_file in $(ls -1 ${ALIASES_DIR}/*.aliases); do
. "${alias_file}"
done
fi
## History
HISTSIZE=1000000
SAVEHIST=${HISTSIZE} # for zsh
HISTFILE="${XDG_STATE_HOME}/$(get_shell_name)/history"
mkdir -p "$(dirname $HISTFILE)"
# Editor
has nvim && export EDITOR='nvim'
# Man pager
has nvim && export MANPAGER='nvim +Man!'
# Use bat as default pager
has bat && export PAGER=$(which bat)
# Init starship - modern shell prompt
has starship && eval "$(starship init $(get_shell_name))"
# Init zoxide - modern cd
has zoxide && eval "$(zoxide init $(get_shell_name))"
# Enable direnv
has direnv && eval "$(direnv hook $(get_shell_name))"
# Enable mcfly (better ctrl-r)
if has mcfly ; then
#export MCFLY_HISTORY="${XDG_STATE_HOME}/mcfly/history.db"
#mkdir -p "$(dirname "${MCFLY_HISTORY}")"
export MCFLY_KEY_SCHEME=vim
export MCFLY_INTERFACE_VIEW=TOP # BOTTOM
export MCFLY_DISABLE_MENU=TRUE
# Details are in https://github.com/cantino/mcfly
eval "$(mcfly init $(get_shell_name))"
#MCFLY_RESULTS_SORT=LAST_RUN # RANK
#export MCFLY_RESULTS=10
fi
# Init gnome-keyring by default if present
if has gnome-keyring && pkill -0 -u $(id -u) -f gnome-keyring-daemon; then
export eval $(gnome-keyring-daemon --start 2>/dev/null)
# Init keychain
elif has keychain; then
keychain --inherit any-once --ignore-missing --noask
# ${HOME}/.ssh/id_ed25519 ${HOME}/.ssh/id_rsa_mcp-scale-jenkins ${HOME}/.ssh/id_rsa_alovtsov-generated 2>/dev/null
. ${HOME}/.keychain/$(hostname -s)-sh
#. ${HOME}/.keychain/$(hostname -s)-sh-gpg
fi
# Load zsh configs
if [ $(get_shell_name) = "zsh" ]; then
ZDOTDIR="${HOME}/.config/zsh"
fi
# Add icons to lf (file manager)
has lf && [ -f "${XDG_CONFIG_HOME}/lf/icons" ] && source "${XDG_CONFIG_HOME}/lf/icons"
# Use Everblush color theme for fzf if it installed
# from https://github.com/Everblush/fzf
#has fzf && export FZF_DEFAULT_OPTS='
# --color hl:#dadada,hl+:#26292a,gutter:#1e2527
# --color pointer:#373d49,info:#606672
# --border
# --color border:#1e2527
# --height 13'
# Use Catppuccin color theme for fzf if it installed
# from https://github.com/catppuccin/fzf/blob/main/mocha.md
has fzf && export FZF_DEFAULT_OPTS=" \
--tabstop=2 \
--height 13 \
--border \
--color border:#1e1e2e
--color=bg+:#313244,bg:#111111,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8"
# File and Dir colors for ls and other outputs
export LS_OPTIONS='--color=auto'
eval "$(dircolors -b)"