This commit is contained in:
Michael Zhang 2021-08-28 01:35:36 -05:00
parent b4c4effb4e
commit 2dc08c1ff7
Signed by: michael
GPG Key ID: BDA47A31A3C8EE6B
8 changed files with 202 additions and 65 deletions

142
dot_bashrc Normal file
View File

@ -0,0 +1,142 @@
#
# ~/.bashrc
#
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}
seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done
echo; echo
done
}
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
# Change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
;;
screen*)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
;;
esac
use_color=true
# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file
# first to take advantage of user additions. Use internal bash
# globbing instead of external grep binary.
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
else
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '
fi
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto'
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi
unset use_color safe_term match_lhs sh
alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias np='nano -w PKGBUILD'
alias more=less
xhost +local:root > /dev/null 2>&1
complete -cf sudo
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
shopt -s expand_aliases
# export QT_SELECT=4
# Enable history appending instead of overwriting. #139609
shopt -s histappend
#
# # ex - archive extractor
# # usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
source $HOME/.local/scripts/common/rc.sh
source $HOME/.local/scripts/common/aliases.sh

View File

@ -150,7 +150,7 @@ font:
#style: Bold Italic
# Point size
size: 8.5
size: 10.0
# Offset is the extra space around each character. `offset.y` can be thought
# of as modifying the line spacing, and `offset.x` as modifying the letter

View File

@ -1,6 +1,6 @@
[memory]
command=/usr/lib/i3blocks/memory/memory
label=MEM
label=MEM
interval=20
[weather]
@ -21,11 +21,11 @@ interval=5
color=#999999
[date]
command=date +"%a %m[%d]%Y"
command=date +"%a %m [%d] %Y"
interval=5
color=#EE92EE
[time]
command=date +"[%H:%M]:%S"
command=date +"[%H:%M] :%S"
interval=5
color=#EEEE92

View File

@ -13,6 +13,8 @@ exe 'source' (stdpath('config') . '/nerdtree.vim')
" Plug 'ctrlpvim/ctrlp.vim'
let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
Plug 'LnL7/vim-nix'
Plug 'FStarLang/VimFStar', {'for': 'fstar'}
" Plug 'jiangmiao/auto-pairs', { 'for': 'rust' }

View File

@ -1,3 +1,5 @@
source $HOME/.common.sh
command_exists exa && alias ls="exa"
command_exists garbage && alias rm="garbage put"
@ -36,4 +38,6 @@ function ced() {
chezmoi apply
}
cpush() { chezmoi git add . -- -A && chezmoi git commit -- -m "update" && chezmoi git push }
cpush() {
chezmoi git add . -- -A && chezmoi git commit -- -m "update" && chezmoi git push
}

View File

@ -0,0 +1,43 @@
source $HOME/.common.sh
export LANG=en_US.UTF-8
export DOTNET_CLI_TELEMETRY_OPTOUT=1
# export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
export EDITOR=vim
command_exists nvim && export EDITOR=nvim
export MAILDIR=$HOME/Mail
source_if_exists $HOME/.cargo/env
source_if_exists "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env"
append_path "$HOME/.local/bin"
append_path "$HOME/.local/scripts"
append_path "$HOME/.dotnet/tools"
append_path "$HOME/go/bin"
append_path "$HOME/.idris2/bin"
append_path "$HOME/.opam/default/bin"
append_path "$HOME/.local/share/prt"
[[ -s /etc/profile.d/autojump.sh ]] && source /etc/profile.d/autojump.sh
eval $(opam env)
# opam configuration
# test -r /home/michael/.opam/opam-init/init.zsh && . /home/michael/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
function rgc() {
rg --color always $@ | bat --color always
}
function loadnpm() {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
}
# ssh
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
# vim: set filetype=sh:

View File

@ -4,10 +4,10 @@ export TERMINAL="/usr/bin/alacritty"
export EDITOR="/usr/bin/nvim"
export CUPS_SERVER="192.168.0.171:631"
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]
then
exec startx;
fi
# if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]
# then
# exec startx;
# fi
# if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]
# then

View File

@ -3,66 +3,12 @@ source $HOME/.common.sh
source_if_exists $HOME/.local/scripts/zsh/zsh-prelude.zsh
source_if_exists $HOME/.local/scripts/zsh/check-update.zsh
export LANG=en_US.UTF-8
# oh-my-zsh
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="ys"
plugins=(
git
zsh-syntax-highlighting
)
export DISABLE_AUTO_UPDATE="true"
source $ZSH/oh-my-zsh.sh
# options
setopt HIST_IGNORE_SPACE
export DOTNET_CLI_TELEMETRY_OPTOUT=1
# export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
export EDITOR=vim
command_exists nvim && export EDITOR=nvim
export MAILDIR=$HOME/Mail
# export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
source_if_exists $HOME/.local/scripts/common/rc.sh
source_if_exists $HOME/.local/scripts/common/aliases.sh
source_if_exists $HOME/.cargo/env
source_if_exists "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env"
source_if_exists $HOME/.nix-profile/etc/profile.d/nix.sh
append_path "$HOME/.local/bin"
append_path "$HOME/.local/scripts"
append_path "$HOME/.dotnet/tools"
append_path "$HOME/go/bin"
append_path "$HOME/.idris2/bin"
append_path "$HOME/.opam/default/bin"
append_path "$HOME/.local/share/prt"
# [ -f "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env" ] && source "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env"
# [[ -s $HOME/.autojump/etc/profile.d/autojump.sh ]] && source $HOME/.autojump/etc/profile.d/autojump.sh
autoload -U compinit && compinit -u
eval $(opam env)
PROG=tea _CLI_ZSH_AUTOCOMPLETE_HACK=1 source /home/michael/.config/tea/autocomplete.zsh
# opam configuration
# test -r /home/michael/.opam/opam-init/init.zsh && . /home/michael/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
function rgc() {
rg --color always $@ | bat --color always
}
function loadnpm() {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
}
# ssh
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
source_if_exists $HOME/.local/scripts/zsh/aliases.zsh
[ -f "$HOME/.zsh/extras" ] && source $HOME/.zsh/extras/*.zsh
if [ -e /home/michael/.nix-profile/etc/profile.d/nix.sh ]; then . /home/michael/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer