Update bash/zsh/iTerm environments

This commit is contained in:
2Shirt 2021-03-19 03:36:55 -06:00
parent 70aa8e40ac
commit 30f661183c
8 changed files with 152 additions and 2 deletions

View file

@ -5,7 +5,7 @@
# Live macOS env workaround
tmux_args=()
if [[ -e "/.wk-live-macos" ]]; then
tmux_args=(-f "/etc/tmux.conf" -S "$(mktemp).socket")
tmux_args=(-f "/etc/tmux.conf" -S "/Volumes/RAM_Disk/.tmux.socket")
fi
function ask() {

16
setup/macos-live/aliases Normal file
View file

@ -0,0 +1,16 @@
alias cdtmp='cd "$(mktemp -d)"'
alias du='du -sch'
alias fix-perms='find -type d -exec chmod 755 "{}" \; && find -type f -exec chmod 644 "{}" \;'
alias less='less -S'
alias mkdir='mkdir -p'
alias mv='mv -nv'
alias q1=' ls -1'
alias q1a=' ls -1A'
alias q=' ls -lh'
alias qa=' ls -lAh'
alias qs=' ls'
alias qsa=' ls -A'
alias rm='rm -v'
alias rmdirs='find -depth -mindepth 1 -type d -exec rmdir "{}" --ignore-fail-on-non-empty \;'
alias tmux='tmux -f /etc/tmux.conf -S /Volumes/RAM_Disk/.tmux.socket'
alias vim='vim -u /.vimrc'

14
setup/macos-live/bashrc Normal file
View file

@ -0,0 +1,14 @@
export HOME=/Volumes/RAM_Disk
# Set Locale
LC_ALL=en_US.UTF-8; export LC_ALL
LANG=en_US.UTF-8; export LANG
# Set PATH
for p in /usr{/local/opt/{e2fsprogs,ruby,util-linux},/local,}/{bin,sbin}; do
PATH="${p}:${PATH}"
done
export PATH
# Aliases
source /.aliases

View file

@ -54,8 +54,10 @@ cp -a /Library/Fonts/Inconsolata*ttf "${WK_PATH}/System/Library/Fonts"/
echo "Installing iTerm2..."
if [[ "${OS_VERSION}" == "El Capitan" ]]; then
rsync -aS /Applications/iTerm.app "${WK_PATH}/Applications"/
rsync -aS "El Capitan/com.googlecode.iterm2.plist" "${WK_PATH}/var/root/Library/Preferences"/
else
rsync -aS /Applications/iTerm-2.app "${WK_PATH}/Applications"/
rsync -aS com.googlecode.iterm2.plist "${WK_PATH}/var/root/Library/Preferences"/
rsync -aS /usr/lib/lib{apr,expat,ffi}* /Volumes/1201_UFD/usr/lib/
rsync -aS /System/Library/Frameworks/{MetalKit,Quartz*}.framework "${WK_PATH}/System/Library/Frameworks"/
fi
@ -64,12 +66,24 @@ rsync -aS /System/Library/Colors/System.clr "${WK_PATH}/System/Library/Colors"/
rsync -aS /System/Library/Frameworks/{Scripting,ScriptingBridge,LocalAuthentication}.framework "${WK_PATH}/System/Library/Frameworks"/
rsync -aS /usr/bin/locale "${WK_PATH}/usr/bin"/
rsync -aLS /usr/share/locale/en_US.UTF-8 "${WK_PATH}/usr/share/locale"/
rsync -aS com.googlecode.iterm2.plist "${WK_PATH}/var/root/Library/Preferences"/
# pipes-sh
echo "Installing pipes.sh..."
cp -a /usr/bin/tput "${WK_PATH}/usr/bin"/
# zsh
echo "Installing zsh..."
cp -a /bin/zsh "${WK_PATH}/bin"/
rsync -aS /usr/lib/zsh "${WK_PATH}/usr/lib"/
rsync -aS /usr/share/zsh "${WK_PATH}/usr/share"/
rsync -aS /usr/local/share/zsh "${WK_PATH}/usr/local/share"/
# Misc
cp -a aliases "${WK_PATH}/.aliases"
cp -a bashrc "${WK_PATH}/etc/profile"
cp -a vimrc "${WK_PATH}/.vimrc"
cp -a zshrc "${WK_PATH}/etc/zshenv"
# WizardKit
echo "Installing WizardKit env..."
touch "${WK_PATH}/.wk-live-macos"

81
setup/macos-live/vimrc Normal file
View file

@ -0,0 +1,81 @@
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
" 2Shirt Stuff
set autoindent " align the new line indent with the previous line
set expandtab " insert spaces when hitting TABs
set nowrap " I'd rather manually wrap than manually unwrap
set shiftround " round indent to multiple of 'shiftwidth'
set shiftwidth=2 " operation >> indents 2 columns; << unindents 2 columns
set softtabstop=2 " insert/delete 2 spaces when hitting a TAB/BACKSPACE
set tabstop=2 " an hard TAB displays as 2 columns
" Python Stuff.
au FileType python set textwidth=79 " lines longer than 79 columns will be broken
au FileType python call matchadd('ColorColumn', '\%80v')
" Do wrap stuff
au FileType mail set wrap
au FileType text set wrap
" Enable code folding
set foldmethod=indent
" Keep all folds open when a file is opened
augroup OpenAllFoldsOnFileOpen
autocmd!
autocmd BufRead * normal zR
augroup END
" macOS stuff
set backspace=indent,eol,start
set ruler

25
setup/macos-live/zshrc Normal file
View file

@ -0,0 +1,25 @@
export HOME=/Volumes/RAM_Disk
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export EDITOR='vim'
export VISUAL='vim'
export PAGER='less'
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_DIRS="/etc/xdg"
export XDG_CONFIG_HOME="/"
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
export XDG_DATA_HOME="$HOME/.local/share"
# Ensure path arrays do not contain duplicates.
typeset -gU cdpath fpath mailpath path
path=(
/usr/local/opt/{e2fsprogs,ruby,util-linux}/{bin,sbin}
/usr/local/{bin,sbin}
$path
)
## Load aliases
. "/.aliases"