Files
dotfiles/.bashrc

122 lines
3.4 KiB
Bash
Raw Permalink Normal View History

2019-02-06 17:12:59 -08:00
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
2020-10-19 17:07:35 -07:00
# add from /etc/bash.bashrc default with fix for alacritty window title bars
2020-05-10 22:22:24 -07:00
case ${TERM} in
xterm*|rxvt*|Eterm|alacritty|aterm|kterm|gnome*)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
;;
screen*)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
;;
esac
2019-02-06 17:12:59 -08:00
#customize prompt see https://wiki.archlinux.org/index.php/Bash/Prompt_customization
RED="\[$(tput setaf 1)\]"
YELLOW="\[$(tput setaf 3)\]"
LIGHTBLUE="\[$(tput setaf 4)\]"
BLUE="\[$(tput setaf 27)\]"
RESET="\[$(tput sgr0)\]"
2021-05-29 08:24:35 -04:00
if [[ -z "$DISPLAY" ]]; then
PS1="${YELLOW}\u@\h \W>${RESET} "
else
#PS1="${BLUE}\u@\h \W>${RESET} "
PS1="${LIGHTBLUE}\W>${RESET} "
fi
2019-02-06 17:12:59 -08:00
man() {
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;44;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
command man "$@"
}
2023-05-15 11:19:08 -04:00
alias ls='ls --color=always'
2019-02-06 17:12:59 -08:00
alias l='ls'
alias la='ls -A'
alias ll='ls -lah'
alias tree='tree -CL 2'
alias nv='nvim'
2023-05-15 11:19:08 -04:00
export EDITOR=nvim
export VISUAL=wm_spawn
2020-10-19 17:07:35 -07:00
alias feh='feh --scale-down'
2019-02-06 17:12:59 -08:00
#alias xclip="xclip -selection clipboard"
#alias ts="date --iso-8601='seconds' | tr -d '\n' | xclip"
# Base16 Shell
BASE16_SHELL="$HOME/.config/base16-shell/"
[ -n "$PS1" ] && \
[ -s "$BASE16_SHELL/profile_helper.sh" ] && \
eval "$("$BASE16_SHELL/profile_helper.sh")"
#add private usr bin to path if exists
if [ -d "$HOME/bin" ] ; then
2019-05-30 17:20:31 -07:00
export PATH="$HOME/bin:$PATH"
2019-02-06 17:12:59 -08:00
fi
2019-05-30 17:20:31 -07:00
if [ -d "$HOME/.local/bin" ] ; then
export PATH="$HOME/.local/bin:$PATH"
fi
2021-05-10 11:18:19 -07:00
#---begin fzf setup---
#fast fuzzy file searching with fzf
2025-05-13 16:48:02 -04:00
#fzf kbd shortcuts: <alt-c>, <ctrl-r>, <ctrl-t>, <ctrl-p>
2019-02-06 17:12:59 -08:00
source /usr/share/fzf/key-bindings.bash
source /usr/share/fzf/completion.bash
2021-05-10 11:18:19 -07:00
#use ripgrep with fzf
2025-05-13 16:48:02 -04:00
export FZF_DEFAULT_COMMAND='rg -i --files --glob "!.git/*"'
2021-05-10 11:18:19 -07:00
#export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"'
#or use fd with fzf
# export FZF_DEFAULT_COMMAND="fd --type file --color=always"
# export FZF_DEFAULT_COMMAND='fd --type file --hidden --color=always --follow --exclude .git'
# export FZF_DEFAULT_OPTS="--ansi"
#use ansi color codes and bind ctrl-y to copy selection
export FZF_DEFAULT_OPTS=' --ansi --bind "ctrl-y:execute-silent(printf {} | cut -f 2- | wl-copy --trim-newline)"'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
#bind ctrl-p to text editor
alias fzfcmd='fzf --bind "enter:execute($EDITOR {})"'
2020-10-19 17:07:35 -07:00
bind -x '"\C-p": fzfcmd;'
2024-04-17 13:58:46 -04:00
#---end fzf setup---
2019-12-13 14:00:23 -08:00
2023-09-29 00:32:44 -04:00
#setup bash history
2025-05-13 16:48:02 -04:00
#export HISTIGNORE="ls*:cd*:exit:ps*:history:pass*:gpg*:start*"
export HISTIGNORE="ls*:cd*:exit:ps*:history:gpg*:start*"
2023-09-29 00:32:44 -04:00
# export HISTSIZE=4096
export HISTSIZE=-1 #make unlimited
# export HISTSIZE=0 #disable history
# export HISTFILESIZE=32768
unset HISTFILESIZE
2021-05-10 11:18:19 -07:00
export HISTCONTROL=ignoreboth:erasedups
shopt -s histappend
2019-12-13 14:00:23 -08:00
# export HISTTIMEFORMAT='%Y-%m-%d %H:%M:%S | '
2024-04-17 13:58:46 -04:00
#
2019-12-13 14:00:23 -08:00
# if [ -d "$HOME/bin/Fiji.app" ]; then
# alias fiji="~/bin/Fiji.app/ImageJ-linux64"
# fi
2019-02-06 17:12:59 -08:00
#source custom user aliases
if [[ -e $HOME/.bashrc.local ]]; then
source $HOME/.bashrc.local
2019-02-06 17:12:59 -08:00
fi
# if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
# tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux
# fi