This repository was archived by the owner on Feb 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
94 lines (79 loc) · 2.38 KB
/
Copy pathbashrc
File metadata and controls
94 lines (79 loc) · 2.38 KB
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
# .bashrc
#for interactive shell only
#[ -z "${PS1}" ] && return
#######################################################################
if [[ "${SHELL}" =~ bash ]]; then
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# ubuntu
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
#----------------------------------------------------------------------
if [[ "${USER}" == "root" ]]; then
PS1='[\u@\h: \w]# '
else
PS1='[\u@\h: \w]$ '
fi
fi # end of if is bash
#----------------------------------------------------------------------
for pth in \
/opt/homebrew/bin \
${HOME}/bin \
${HOME}/.local/bin \
${HOME}/.cargo/bin \
${HOME}/.krew/bin \
; do
if ! echo ":${PATH}:" | grep -q ":${pth}:"; then
PATH=${PATH}:${pth}
fi
done
if [[ -d ${HOME}/env.d ]]; then
for _env in ${HOME}/env.d/*.env; do
source ${_env}
done
fi
# need to move these default path to the last, otherwise pyenv, sdkman etc
# won't work because their substituate alternative needs to take precedence
# in path search.
for pth in /usr/local/bin /usr/local/sbin /usr/bin /usr/sbin /bin /sbin; do
if echo ":${PATH}:" | grep -q ":${pth}:"; then
PATH=${PATH/:${pth}:/:}
fi
PATH=${PATH}:${pth}
done
export PATH
#----------------------------------------------------------------------
# user specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias nvim='nvim -u ~/.vim/vimrc'
# alias vi=nvim
# alias vim=nvim
if [[ "${OSTYPE}" =~ "darwin" ]]; then
alias ls='ls -G'
elif [[ "${OSTYPE}" =~ "linux" ]]; then
alias ls='ls --color --ignore=*.pyc '
fi
# https://stackoverflow.com/questions/7131670/make-a-bash-alias-that-takes-a-parameter
# vim edit with 'I am feeling lucky' search.
# FZF_DEFAULT_COMMAND, https://github.com/junegunn/fzf
function fuzzy_vim() {
nvim $(rg --files | fzf -f "$@" | head -n 1)
}
alias fzvim=fuzzy_vim
alias fzvi=fuzzy_vim
function fuzzy_run() {
# https://stackoverflow.com/a/11217798/221794, Getting the last argument passed to a shell script
cmd="${@:1:$#-1}"
query="${@: -1}"
$cmd $(fzf -f "$query" | head -n 1)
}
alias fz=fuzzy_run
#----------------------------------------------------------------------
export EDITOR=nvim
#----------------------------------------------------------------------
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"