Compare commits
87
Commits
master
..
2e9e3a68b9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e9e3a68b9 | ||
|
|
5c9a4802cb | ||
|
|
b4d0925afc | ||
|
|
c2fbd61445 | ||
|
|
f7627194db | ||
|
|
e04bcc547b | ||
|
|
f71b17e5ff | ||
|
|
9db303ec84 | ||
|
|
97923e802e | ||
|
|
34b914314c | ||
|
|
71a88388f8 | ||
|
|
cf80d4a447 | ||
|
|
fe65a36685 | ||
|
|
29e48a870f | ||
|
|
4c6b31041a | ||
|
|
8505ed15b8 | ||
|
|
ee73f0ae57 | ||
|
|
c143c1e459 | ||
|
|
28d0942bb9 | ||
|
|
d84b40efb8 | ||
|
|
7d4d36520b | ||
|
|
75b1b57727 | ||
|
|
85679ad72e | ||
|
|
b7a4fa9001 | ||
|
|
b09c0d2b7b | ||
|
|
10258de0ab | ||
|
|
4c5371a8c2 | ||
|
|
79d492df92 | ||
|
|
361fa87e99 | ||
|
|
7e0a278f49 | ||
|
|
09c4a473bd | ||
|
|
cbe60343ad | ||
|
|
2ba08d2efb | ||
|
|
009bb52681 | ||
|
|
387a6273a2 | ||
|
|
36ec95006e | ||
|
|
db55b56b85 | ||
|
|
5c7fbbd20f | ||
|
|
23643a0850 | ||
|
|
4c18b9aaa2 | ||
|
|
9bc4faf1d3 | ||
|
|
9f0fedd00d | ||
|
|
f61de6afa2 | ||
|
|
f4a32f1a69 | ||
|
|
f6b76ee9d1 | ||
|
|
d5c15d2302 | ||
|
|
afbe10737e | ||
|
|
36ceabb857 | ||
|
|
1f42f0e909 | ||
|
|
cfcc2bd943 | ||
|
|
ef429f5e5e | ||
|
|
741d96cdd4 | ||
|
|
c14fe5451f | ||
|
|
1d6d53e580 | ||
|
|
8e1877f9e8 | ||
|
|
6565a041e1 | ||
|
|
4385fa7c01 | ||
|
|
d5b8675fef | ||
|
|
247417af95 | ||
|
|
6d2071b1ea | ||
|
|
bd497a668d | ||
|
|
e931cb3c81 | ||
|
|
e332049a0d | ||
|
|
e68ccd8bc7 | ||
|
|
e80f4e87e7 | ||
|
|
d682e91d6d | ||
|
|
9455e8c6a9 | ||
|
|
c98ea52dbb | ||
|
|
a2a8cd16cb | ||
|
|
912f5aa0b5 | ||
|
|
4ed509fee6 | ||
|
|
7b33bf13f9 | ||
|
|
4bfa9995cd | ||
|
|
81202b5968 | ||
|
|
67d46f99c7 | ||
|
|
8b29c959fb | ||
|
|
710b0f9cdf | ||
|
|
ccfa18b331 | ||
|
|
d60bc2772f | ||
|
|
dfb0c08a0f | ||
|
|
b7886df942 | ||
|
|
330e88fbf3 | ||
|
|
914afec926 | ||
|
|
59d618b9f2 | ||
|
|
9733251bfc | ||
|
|
a9da299120 | ||
|
|
a2076fd6f1 |
@@ -61,6 +61,3 @@
|
|||||||
[submodule "vim/.vim/nvim-bundle/zk-nvim"]
|
[submodule "vim/.vim/nvim-bundle/zk-nvim"]
|
||||||
path = vim/.vim/nvim-bundle/zk-nvim
|
path = vim/.vim/nvim-bundle/zk-nvim
|
||||||
url = https://github.com/zk-org/zk-nvim.git
|
url = https://github.com/zk-org/zk-nvim.git
|
||||||
[submodule "vim/.vim/bundle/vim-helm"]
|
|
||||||
path = vim/.vim/bundle/vim-helm
|
|
||||||
url = https://github.com/towolf/vim-helm.git
|
|
||||||
|
|||||||
+11
-29
@@ -5,11 +5,6 @@ apply_dotfile() {
|
|||||||
stow --adopt -S -t "${HOME}" "${directory_to_stow}"
|
stow --adopt -S -t "${HOME}" "${directory_to_stow}"
|
||||||
}
|
}
|
||||||
|
|
||||||
revert_dotfile() {
|
|
||||||
directory_to_stow="${1}"
|
|
||||||
stow -D -t "${HOME}" "${directory_to_stow}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Adopt will change the files in stow to match existing files.
|
# Adopt will change the files in stow to match existing files.
|
||||||
# We don't want this, we just want to handle existing files gracefully.
|
# We don't want this, we just want to handle existing files gracefully.
|
||||||
# We simply adopt all the files and then at the end restore our git repo to undo changes
|
# We simply adopt all the files and then at the end restore our git repo to undo changes
|
||||||
@@ -17,35 +12,22 @@ restore_from_adoption() {
|
|||||||
git restore .
|
git restore .
|
||||||
}
|
}
|
||||||
|
|
||||||
mode_command=${1:-apply}
|
apply_dotfile bash
|
||||||
if [ "${mode_command}" != "apply" ] && [ "${mode_command}" != "revert" ]; then
|
apply_dotfile sh
|
||||||
echo "$0: mode command ("'${1}'") must be apply or revert" 1>&2
|
apply_dotfile readline
|
||||||
exit 1
|
apply_dotfile screen
|
||||||
fi
|
|
||||||
|
|
||||||
operation() {
|
apply_dotfile git
|
||||||
${mode_command}_dotfile ${1}
|
apply_dotfile xdg
|
||||||
}
|
|
||||||
|
|
||||||
# Create .local/bin to prevent tree folding
|
apply_dotfile vim
|
||||||
mkdir -p ~/.local/bin
|
|
||||||
|
|
||||||
operation bash
|
apply_dotfile ruby
|
||||||
operation sh
|
apply_dotfile python
|
||||||
operation readline
|
|
||||||
operation screen
|
|
||||||
|
|
||||||
operation git
|
|
||||||
operation xdg
|
|
||||||
|
|
||||||
operation vim
|
|
||||||
|
|
||||||
operation ruby
|
|
||||||
operation python
|
|
||||||
|
|
||||||
# Only if inside a coder instance
|
# Only if inside a coder instance
|
||||||
if [ -n "${CODER}" ]; then
|
if [ -n "${CODER}" ]; then
|
||||||
operation gnupg
|
apply_dotfile gnupg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that SSH version is above 9.2 (where EnableEscapeCommandline was added) before conditionally adding
|
# Check that SSH version is above 9.2 (where EnableEscapeCommandline was added) before conditionally adding
|
||||||
@@ -56,6 +38,6 @@ cat <<CONFIG > ssh/.ssh/extra.conf
|
|||||||
EnableEscapeCommandline yes
|
EnableEscapeCommandline yes
|
||||||
CONFIG
|
CONFIG
|
||||||
fi
|
fi
|
||||||
operation ssh
|
apply_dotfile ssh
|
||||||
|
|
||||||
restore_from_adoption
|
restore_from_adoption
|
||||||
|
|||||||
+87
-49
@@ -1,41 +1,5 @@
|
|||||||
#{- ~/.bashrc -}#
|
#{- ~/.bashrc -}#
|
||||||
|
|
||||||
#{- SOURCING -}#
|
|
||||||
|
|
||||||
# Source profile, if it hasn't already been loaded
|
|
||||||
if [ -z "$__PROFILE_DONE" ]; then
|
|
||||||
. $HOME/.profile
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source .env to extend with secret/sensitive environment variables if it exists
|
|
||||||
if [ -r "$HOME/.env" ]; then
|
|
||||||
. "$HOME/.env"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -r "$HOME/.config/xdg/env" ]; then
|
|
||||||
. "$HOME/.config/xdg/env"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source aliases, if they exist
|
|
||||||
if [ -f "$HOME/.aliases" ] && [ -r "$HOME/.aliases" ]; then
|
|
||||||
. "$HOME/.aliases"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source private aliases, if they exist
|
|
||||||
if [ -f "$HOME/.private_aliases" ] && [ -r "$HOME/.private_aliases" ]; then
|
|
||||||
. "$HOME/.private_aliases"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source functions, if they exist
|
|
||||||
if [ -f "$HOME/.functions" ] && [ -r "$HOME/.functions" ]; then
|
|
||||||
. "$HOME/.functions"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source private functions, if they exist
|
|
||||||
if [ -f "$HOME/.private_functions" ] && [ -r "$HOME/.private_functions" ]; then
|
|
||||||
. "$HOME/.private_functions"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#{- PROMPT -}#
|
#{- PROMPT -}#
|
||||||
|
|
||||||
if which tput &> /dev/null && tput bold &> /dev/null; then
|
if which tput &> /dev/null && tput bold &> /dev/null; then
|
||||||
@@ -56,6 +20,7 @@ else
|
|||||||
no_color="\[\033[0m\]"
|
no_color="\[\033[0m\]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
export PS1="${green}"'\$'"${no_color} "
|
export PS1="${green}"'\$'"${no_color} "
|
||||||
export DIRENV_PS1="${red}"'\$'"${no_color} "
|
export DIRENV_PS1="${red}"'\$'"${no_color} "
|
||||||
export NIX_SHELL_PS1="${blue}"'λ'"${no_color} "
|
export NIX_SHELL_PS1="${blue}"'λ'"${no_color} "
|
||||||
@@ -90,7 +55,7 @@ if which direnv &> /dev/null; then
|
|||||||
PS1=${ORIG_PS1}
|
PS1=${ORIG_PS1}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
prompt_command_prepend update_prompt
|
PROMPT_COMMAND="update_prompt; $PROMPT_COMMAND"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Continuation Prompt: "> " in cyan
|
# Continuation Prompt: "> " in cyan
|
||||||
@@ -100,10 +65,7 @@ export PS4="${blue}#${no_color} "
|
|||||||
|
|
||||||
#{- HISTORY -}#
|
#{- HISTORY -}#
|
||||||
|
|
||||||
prompt_command_prepend "history -r"
|
PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
||||||
prompt_command_prepend "history -c"
|
|
||||||
prompt_command_prepend "history -w"
|
|
||||||
prompt_command_prepend "history -n"
|
|
||||||
# PROMPT_COMMAND="echo hist1; history; history -n; echo hist2; history; history -w; echo hist3; history; history -c; echo hist4; history; history -r; echo hist5; history; $PROMPT_COMMAND"
|
# PROMPT_COMMAND="echo hist1; history; history -n; echo hist2; history; history -w; echo hist3; history; history -c; echo hist4; history; history -r; echo hist5; history; $PROMPT_COMMAND"
|
||||||
export HISTFILE="$HOME/.history/bash"
|
export HISTFILE="$HOME/.history/bash"
|
||||||
export HISTTIMEFORMAT="%F %T "
|
export HISTTIMEFORMAT="%F %T "
|
||||||
@@ -131,18 +93,98 @@ log_bash_persistent_history()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_command_prepend "log_bash_persistent_history"
|
PROMPT_COMMAND="log_bash_persistent_history; $PROMPT_COMMAND"
|
||||||
|
|
||||||
|
|
||||||
# Source bash completion, this file will then lazy load all other completions
|
#{- SOURCING -}#
|
||||||
|
|
||||||
|
|
||||||
|
# Source profile, if it hasn't already been loaded
|
||||||
|
if [ -z "$__PROFILE_DONE" ]; then
|
||||||
|
. $HOME/.profile
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source .env to extend with secret/sensitive environment variables if it exists
|
||||||
|
if [ -r "$HOME/.env" ]; then
|
||||||
|
. "$HOME/.env"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -r "$HOME/.config/xdg/env" ]; then
|
||||||
|
. "$HOME/.config/xdg/env"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source aliases, if they exist
|
||||||
|
if [ -f "$HOME/.aliases" ] && [ -r "$HOME/.aliases" ]; then
|
||||||
|
. "$HOME/.aliases"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source private aliases, if they exist
|
||||||
|
if [ -f "$HOME/.private_aliases" ] && [ -r "$HOME/.private_aliases" ]; then
|
||||||
|
. "$HOME/.private_aliases"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source functions, if they exist
|
||||||
|
if [ -f "$HOME/.functions" ] && [ -r "$HOME/.functions" ]; then
|
||||||
|
. "$HOME/.functions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source private functions, if they exist
|
||||||
|
if [ -f "$HOME/.private_functions" ] && [ -r "$HOME/.private_functions" ]; then
|
||||||
|
. "$HOME/.private_functions"
|
||||||
|
fi
|
||||||
|
|
||||||
source_completions() {
|
source_completions() {
|
||||||
|
# Source completions if they are available
|
||||||
|
completion_dirs=(
|
||||||
|
"/usr/share/bash-completion/completions"
|
||||||
|
"/etc/bash_completion.d"
|
||||||
|
)
|
||||||
|
cache_dir="${XDG_CACHE_HOME}/bash-completion-sourcing"
|
||||||
|
|
||||||
|
if [ "${BUILD_CACHE}" ]; then
|
||||||
|
mkdir -p "${cache_dir}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Base completion sourcing, later completions will fail without this
|
||||||
if [ -r "/usr/share/bash-completion/bash_completion" ]; then
|
if [ -r "/usr/share/bash-completion/bash_completion" ]; then
|
||||||
. "/usr/share/bash-completion/bash_completion"
|
. "/usr/share/bash-completion/bash_completion"
|
||||||
elif [ -r "/etc/bash_completion" ]; then
|
elif [ -r "/etc/bash_completion" ]; then
|
||||||
. "/etc/bash_completion"
|
. "/etc/bash_completion"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Completions from packages
|
||||||
|
export TIMEFORMAT="%R"
|
||||||
|
for completion_dir in "${completion_dirs[@]}"; do
|
||||||
|
if [ -d "${completion_dir}" ] && [ -r "${completion_dir}" ]; then
|
||||||
|
for completion_file in "${completion_dir}"/*; do
|
||||||
|
if [ "$BUILD_CACHE" ]; then
|
||||||
|
echo "Sourcing ${completion_file}"
|
||||||
|
. "${completion_file}"
|
||||||
|
timeavg=$(time (. "${completion_file}") 2>&1 1>/dev/null)
|
||||||
|
timeavg=$(echo $timeavg | cut -d '.' -f 2)
|
||||||
|
if [ "${timeavg}" -gt 100 ]; then
|
||||||
|
echo "This ones slow, adding to cache"
|
||||||
|
echo "${timeavg}" > "${cache_dir}/$(basename ${completion_file})"
|
||||||
|
elif [ "${timeavg}" -gt 10 ]; then
|
||||||
|
echo "This ones a little slow"
|
||||||
|
echo "${timeavg}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! [ -e "${cache_dir}/$(basename ${completion_file})" ]; then
|
||||||
|
. "${completion_file}"
|
||||||
|
else
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset TIMEFORMAT
|
||||||
}
|
}
|
||||||
source_completions
|
|
||||||
|
if [ "$BASH_COMPLETION_ENABLED" ]; then
|
||||||
|
source_completions
|
||||||
|
fi
|
||||||
|
|
||||||
# Preserve the usefulness of set -x by attempting to hide everything that
|
# Preserve the usefulness of set -x by attempting to hide everything that
|
||||||
# happens in prompt_command
|
# happens in prompt_command
|
||||||
@@ -159,12 +201,8 @@ preserve_xtrace_reset() {
|
|||||||
fi
|
fi
|
||||||
} 2>/dev/null
|
} 2>/dev/null
|
||||||
|
|
||||||
prompt_command_prepend preserve_xtrace
|
PROMPT_COMMAND="preserve_xtrace; $PROMPT_COMMAND preserve_xtrace_reset"
|
||||||
prompt_command_append preserve_xtrace_reset
|
|
||||||
|
|
||||||
if $(which direnv &> /dev/null); then
|
if $(which direnv &> /dev/null); then
|
||||||
# Only if direnv isn't already defined in our prompt_command
|
|
||||||
if ! grep -q _direnv_hook <<< $PROMPT_COMMAND; then
|
|
||||||
eval "$(direnv hook bash)"
|
eval "$(direnv hook bash)"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-54
@@ -18,59 +18,6 @@ maths()
|
|||||||
|
|
||||||
cat_with_newline()
|
cat_with_newline()
|
||||||
{
|
{
|
||||||
\cat "$@" && echo
|
cat "$@" && echo
|
||||||
}
|
}
|
||||||
alias cat="cat_with_newline"
|
alias cat="cat_with_newline"
|
||||||
|
|
||||||
k_prompt()
|
|
||||||
{
|
|
||||||
set -x
|
|
||||||
if [ -z ${KUBE_PROMPT+x} ]; then
|
|
||||||
export KUBE_PROMPT=1
|
|
||||||
else
|
|
||||||
unset KUBE_PROMPT
|
|
||||||
fi
|
|
||||||
set +x
|
|
||||||
}
|
|
||||||
|
|
||||||
kube_prompt()
|
|
||||||
{
|
|
||||||
set -x
|
|
||||||
if ! [ -z ${KUBE_PROMPT+x} ]; then
|
|
||||||
context=$(\cat ${KUBECONFIG} \
|
|
||||||
| grep "current-context: " \
|
|
||||||
| sed "s/current-context: //")
|
|
||||||
echo {$context}
|
|
||||||
fi
|
|
||||||
set +x
|
|
||||||
}
|
|
||||||
|
|
||||||
g_prompt()
|
|
||||||
{
|
|
||||||
if ! [ -z ${GIT_PROMPT+x} ]; then
|
|
||||||
export GIT_PROMPT=1
|
|
||||||
else
|
|
||||||
unset GIT_PROMPT
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
git_prompt()
|
|
||||||
{
|
|
||||||
if ! [ -z ${GIT_PROMPT+x} ]; then
|
|
||||||
# Determine if we are in a git repository
|
|
||||||
if git rev-parse --is-inside-work-tree &> /dev/null; then
|
|
||||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
|
||||||
echo [$branch]
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
prompt_command_append() {
|
|
||||||
arg=${1}
|
|
||||||
PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND; "}"${arg}"
|
|
||||||
}
|
|
||||||
|
|
||||||
prompt_command_prepend() {
|
|
||||||
arg=${1}
|
|
||||||
PROMPT_COMMAND="${arg}"${PROMPT_COMMAND:+"; $PROMPT_COMMAND"}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,12 +7,8 @@ set -e
|
|||||||
set -x
|
set -x
|
||||||
|
|
||||||
# Abort installation if Nix is already installed
|
# Abort installation if Nix is already installed
|
||||||
if [ -d /nix/store ]; then
|
if [ -d /nix ]; then
|
||||||
exit 0
|
exit 0
|
||||||
elif [ -d /nix ] && ! [ -O /nix ]; then
|
|
||||||
# If we don't own /nix use sudo to chown it.
|
|
||||||
# If we can't sudo then nothing we do here will work so we just let this fail
|
|
||||||
sudo chown $UID /nix
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Workaround to make a single user install work as root
|
# Workaround to make a single user install work as root
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Defaults to using bash as the shell
|
# Defaults to using bash as the shell
|
||||||
defshell $SHELL
|
defshell bash
|
||||||
# Extend scrollback buffer
|
# Extend scrollback buffer
|
||||||
defscrollback 100000
|
defscrollback 100000
|
||||||
# Disable startup message
|
# Disable startup message
|
||||||
|
|||||||
+1
-1
Submodule vim/.vim/bundle/ale updated: c59c0d1a57...6db58b3379
Submodule vim/.vim/bundle/commentary updated: 64a654ef4a...c4b8f52cbb
+1
-1
Submodule vim/.vim/bundle/eunuch updated: e86bb794a1...8fb3904be2
Submodule vim/.vim/bundle/filetype-nix updated: 7235c7ce2c...e25cd0f2e5
+1
-1
Submodule vim/.vim/bundle/fugitive updated: 3b753cf8c6...dac8e5c2d8
+1
-1
Submodule vim/.vim/bundle/sleuth updated: be69bff867...1cc4557420
+1
-1
Submodule vim/.vim/bundle/slime updated: 2cfdc3b24e...87988b173b
Submodule vim/.vim/bundle/vim-helm deleted from 2c8525fd98
Reference in New Issue
Block a user