migrate
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# Load fastfetch
|
||||
fastfetch
|
||||
|
||||
# Check if starship is installed
|
||||
if ! command -v starship &> /dev/null
|
||||
then
|
||||
echo "Starship not found, installing..."
|
||||
# Install starship (using the recommended installation script)
|
||||
curl -sS https://starship.rs/install.sh | sh
|
||||
# You can also specify an installation directory, e.g., if you don't have sudo access:
|
||||
# curl -sS https://starship.rs/install.sh | sh -s -- -b ~/.local/bin
|
||||
echo "Starship installed."
|
||||
fi
|
||||
|
||||
# Load starship prompt if starship is installed
|
||||
if [ -x /usr/bin/starship ]; then
|
||||
__main() {
|
||||
local major="${BASH_VERSINFO[0]}"
|
||||
local minor="${BASH_VERSINFO[1]}"
|
||||
|
||||
if ((major > 4)) || { ((major == 4)) && ((minor >= 1)); }; then
|
||||
source <("/usr/bin/starship" init bash --print-full-init)
|
||||
else
|
||||
source /dev/stdin <<<"$("/usr/bin/starship" init bash --print-full-init)"
|
||||
fi
|
||||
}
|
||||
__main
|
||||
unset -f __main
|
||||
fi
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=20000
|
||||
HISTFILESIZE=10000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
shopt -s checkwinsize
|
||||
|
||||
# Combine multiline commands into one in history
|
||||
shopt -s cmdhist
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
|
||||
# get current branch in git repo
|
||||
function parse_git_branch() {
|
||||
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
|
||||
if [ ! "${BRANCH}" == "" ]
|
||||
then
|
||||
STAT=`parse_git_dirty`
|
||||
echo "[${BRANCH}${STAT}]"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# Load Aliases and Finctions, instead of adding them here directly.
|
||||
if [ -e $HOME/.bash_aliases ]; then
|
||||
source $HOME/.bash_aliases
|
||||
fi
|
||||
|
||||
if [ -e $HOME/.bash_functions ]; then
|
||||
source $HOME/.bash_functions
|
||||
fi
|
||||
|
||||
|
||||
# enable programmable completion features (you don't need to enable this, if it's already enabled in /etc/bash.bashrc and /etc/profile, sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make Nano the default Editor
|
||||
if [[ -n $SSH_CONNECTION ]]; then
|
||||
export EDITOR='nano'
|
||||
else
|
||||
export EDITOR='nano'
|
||||
fi
|
||||
|
||||
### FZF ###
|
||||
# Enables the following keybindings:
|
||||
# CTRL-t = fzf select
|
||||
# CTRL-r = fzf history
|
||||
# ALT-c = fzf cd
|
||||
eval "$(fzf --bash)"
|
||||
|
||||
# Added by LM Studio CLI (lms)
|
||||
export PATH="$PATH:/home/miker/.lmstudio/bin"
|
||||
# End of LM Studio CLI section
|
||||
|
||||
# Automatically preform ls when changing directory,
|
||||
cd() {
|
||||
builtin cd "$@" && ls -lA
|
||||
}
|
||||
|
||||
|
||||
# Initialize starship
|
||||
eval "$(starship init bash)"
|
||||
Reference in New Issue
Block a user