Archived
1
0
Fork 0

linux: Switch from bash to zsh and unify setup scripts.

This commit is contained in:
Christoph Heiss 2018-09-25 10:29:29 +02:00
parent 780ec8492a
commit 6216184b19
Signed by: c8h4
GPG key ID: 642FF75046E6C3CA
18 changed files with 301 additions and 724 deletions

View file

@ -22,6 +22,7 @@ perl-authen-sasl
perl-mime-tools
perl-net-smtp-ssl
python-capstone
rustup
sleuthkit
speedometer
squashfs-tools
@ -33,3 +34,7 @@ vim
xz
yarn
z
zsh
zsh-autosuggestions
zsh-completions
zsh-syntax-highlighting

View file

@ -1,5 +1,3 @@
alacritty-git
alacritty-terminfo-git
cups
cups-filters
dropbox
@ -10,6 +8,7 @@ gimp
google-chrome
libreoffice-fresh
libva-vdpau-driver
powerline-fonts
python-opengl
qemu
qemu-arch-extra
@ -18,6 +17,7 @@ spotify
sushi
texlive-most
tmux
tmux-mem-cpu-load-git
ttf-meslo
vlc
youtube-dl

View file

@ -1,53 +1,38 @@
#!/usr/bin/env bash
set -e
set -u
YAY_OPTIONS="--sudoloop --noconfirm --nodiffmenu --noeditmenu --noupgrademenu"
ARCH_PACKAGE_LIST_GENERIC=arch-packages-generic.txt
ARCH_PACKAGE_LIST_GUI=arch-packages-gui.txt
arch_generic_pre() {
sudo sed -i 's/^#Color$/Color/' /etc/pacman.conf
sudo sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$((`nproc` * 3 / 2))\"/g" /etc/makepkg.conf
# install yay first
yay_tmpdir=$(mktemp -d)
pushd $yay_tmpdir
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si --noconfirm
popd
# update and install packages
yay -Syu $YAY_OPTIONS
yay -S $YAY_OPTIONS --needed - < $ARCH_PACKAGE_LIST_GENERIC
[[ $WITH_GUI == y ]] && yay -S $YAY_OPTIONS --needed - < $ARCH_PACKAGE_LIST_GUI || true
yay -Qs hplib && yay -Rns hplib || true
}
arch_generic_post() {
# clean up package cache
yay -Scc --noconfirm
}
generic_pre() {
# install gulp globally
yarn global add gulp
}
generic_post() {
[[ ! -d $HOME/.vim ]] && git clone --recurse-submodules -j4 https://github.com/christoph-heiss/vimfiles.git $HOME/.vim || true
[[ ! -d $HOME/.config/base16-shell ]] && git clone https://github.com/chriskempson/base16-shell.git $HOME/.config/base16-shell || true
ln -sf $HOME/.vim/vimrc $HOME/.vimrc
cp -va files/.bash_{aliases,colors,profile,utils} files/.{bashrc,gitconfig} $HOME/
[[ $WITH_GUI == y ]] && cp -va files/.{tmux.conf,alacritty.yml} $HOME/ || true
}
[[ ! -d $HOME/.config/base16-shell ]] && git clone https://github.com/chriskempson/base16-shell.git $HOME/.config/base16-shell || true
[[ ! -d $HOME/.nvm ]] && curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash || true
source $HOME/.nvm/nvm.sh
nvm install node
[[ ! -d $HOME/.oh-my-zsh ]] && sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
cp -va files/.{zshrc,gitconfig,tmux.conf} $HOME/
touch $HOME/.z
ZSH_CUSTOM=$HOME/.oh-my-zsh/custom
[[ ! -d $ZSH_CUSTOM/themes/spaceship-prompt ]] && git clone https://github.com/denysdovhan/spaceship-prompt.git $ZSH_CUSTOM/themes/spaceship-prompt || true
ln -sf $ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme $ZSH_CUSTOM/themes/spaceship.zsh-theme
[[ ! -d $ZSH_CUSTOM/plugins/zsh-syntax-highlighting ]] && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting || true
zsh_path=$(which zsh)
if ! grep $zsh_path /etc/shells; then
echo $zsh_path | sudo tee /etc/shells
fi
if [ $SHELL != $zsh_path ]; then
echo 'Changing shell to zsh, please confirm:'
sudo chsh -s $zsh_path $(whoami)
fi

View file

@ -1,389 +0,0 @@
# Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty it self.
env:
# TERM env customization.
#
# If this property is not set, alacritty will set it to xterm-256color.
#
# Note that some xterm terminfo databases don't declare support for italics.
# You can verify this by checking for the presence of `smso` and `sitm` in
# `infocmp xterm-256color`.
TERM: xterm-256color
window:
# Window dimensions in character columns and lines
# Falls back to size specified by window manager if set to 0x0.
# (changes require restart)
dimensions:
columns: 140
lines: 50
# Adds this many blank pixels of padding around the window
# Units are physical pixels; this is not DPI aware.
# (change requires restart)
padding:
x: 2
y: 2
# Window decorations
# Setting this to false will result in window without borders and title bar.
decorations: true
# Display tabs using this many cells (changes require restart)
tabspaces: 8
# When true, bold text is drawn using the bright variant of colors.
draw_bold_text_with_bright_colors: true
# Font configuration (changes require restart)
#
# Important font attributes like antialiasing, subpixel aa, and hinting can be
# controlled through fontconfig. Specifically, the following attributes should
# have an effect:
#
# * hintstyle
# * antialias
# * lcdfilter
# * rgba
#
# For instance, if you wish to disable subpixel antialiasing, you might set the
# rgba property to "none". If you wish to completely disable antialiasing, you
# can set antialias to false.
#
# Please see these resources for more information on how to use fontconfig
#
# * https://wiki.archlinux.org/index.php/font_configuration#Fontconfig_configuration
# * file:///usr/share/doc/fontconfig/fontconfig-user.html
font:
# The normal (roman) font face to use.
normal:
family: monospace # should be "Menlo" or something on macOS.
# Style can be specified to pick a specific face.
# style: Regular
# The bold font face
bold:
family: monospace # should be "Menlo" or something on macOS.
# Style can be specified to pick a specific face.
# style: Bold
# The italic font face
italic:
family: monospace # should be "Menlo" or something on macOS.
# Style can be specified to pick a specific face.
# style: Italic
# Point size of the font
size: 9.0
# Offset is the extra space around each character. offset.y can be thought of
# as modifying the linespacing, and offset.x as modifying the letter spacing.
offset:
x: 0.0
y: 0.0
# Glyph offset determines the locations of the glyphs within their cells with
# the default being at the bottom. Increase the x offset to move the glyph to
# the right, increase the y offset to move the glyph upward.
glyph_offset:
x: 0.0
y: 0.0
# OS X only: use thin stroke font rendering. Thin strokes are suitable
# for retina displays, but for non-retina you probably want this set to
# false.
use_thin_strokes: true
# Should display the render timer
render_timer: false
# Use custom cursor colors. If true, display the cursor in the cursor.foreground
# and cursor.background colors, otherwise invert the colors of the cursor.
custom_cursor_colors: true
# Colors (Tomorrow Night Bright)
colors:
# Default colors
primary:
background: '0x000000'
foreground: '0xeaeaea'
# Colors the cursor will use if `custom_cursor_colors` is true
cursor:
text: '0x000000'
cursor: '0xffffff'
# Normal colors
normal:
black: '0x000000'
red: '0xd54e53'
green: '0xb9ca4a'
yellow: '0xe6c547'
blue: '0x7aa6da'
magenta: '0xc397d8'
cyan: '0x70c0ba'
white: '0xffffff'
# Bright colors
bright:
black: '0x666666'
red: '0xff3334'
green: '0x9ec400'
yellow: '0xe7c547'
blue: '0x7aa6da'
magenta: '0xb77ee0'
cyan: '0x54ced6'
white: '0xffffff'
# Dim colors (Optional)
dim:
black: '0x333333'
red: '0xf2777a'
green: '0x99cc99'
yellow: '0xffcc66'
blue: '0x6699cc'
magenta: '0xcc99cc'
cyan: '0x66cccc'
white: '0xdddddd'
# Visual Bell
#
# Any time the BEL code is received, Alacritty "rings" the visual bell. Once
# rung, the terminal background will be set to white and transition back to the
# default background color. You can control the rate of this transition by
# setting the `duration` property (represented in milliseconds). You can also
# configure the transition function by setting the `animation` property.
#
# Possible values for `animation`
# `Ease`
# `EaseOut`
# `EaseOutSine`
# `EaseOutQuad`
# `EaseOutCubic`
# `EaseOutQuart`
# `EaseOutQuint`
# `EaseOutExpo`
# `EaseOutCirc`
# `Linear`
#
# To completely disable the visual bell, set its duration to 0.
#
visual_bell:
animation: EaseOutExpo
duration: 0
# Background opacity
background_opacity: 1.0
# Mouse bindings
#
# Currently doesn't support modifiers. Both the `mouse` and `action` fields must
# be specified.
#
# Values for `mouse`:
# - Middle
# - Left
# - Right
# - Numeric identifier such as `5`
#
# Values for `action`:
# - Paste
# - PasteSelection
# - Copy (TODO)
mouse_bindings:
- { mouse: Middle, action: PasteSelection }
mouse:
# Click settings
#
# The `double_click` and `triple_click` settings control the time
# alacritty should wait for accepting multiple clicks as one double
# or triple click.
double_click: { threshold: 300 }
triple_click: { threshold: 300 }
# Faux Scrollback
#
# The `faux_scrollback_lines` setting controls the number
# of lines the terminal should scroll when the alternate
# screen buffer is active. This is used to allow mouse
# scrolling for applications like `man`.
#
# To disable this completely, set `faux_scrollback_lines` to 0.
faux_scrollback_lines: 1
selection:
semantic_escape_chars: ",│`|:\"' ()[]{}<>"
dynamic_title: true
hide_cursor_when_typing: false
# Style of the cursor
#
# Values for 'cursor_style':
# - Block
# - Underline
# - Beam
cursor_style: Underline
# Live config reload (changes require restart)
live_config_reload: true
# Shell
#
# You can set shell.program to the path of your favorite shell, e.g. /bin/fish.
# Entries in shell.args are passed unmodified as arguments to the shell.
#
shell:
program: /usr/bin/tmux
# Key bindings
#
# Each binding is defined as an object with some properties. Most of the
# properties are optional. All of the alphabetical keys should have a letter for
# the `key` value such as `V`. Function keys are probably what you would expect
# as well (F1, F2, ..). The number keys above the main keyboard are encoded as
# `Key1`, `Key2`, etc. Keys on the number pad are encoded `Number1`, `Number2`,
# etc. These all match the glutin::VirtualKeyCode variants.
#
# A list with all available `key` names can be found here:
# https://docs.rs/glutin/*/glutin/enum.VirtualKeyCode.html#variants
#
# Possible values for `mods`
# `Command`, `Super` refer to the super/command/windows key
# `Control` for the control key
# `Shift` for the Shift key
# `Alt` and `Option` refer to alt/option
#
# mods may be combined with a `|`. For example, requiring control and shift
# looks like:
#
# mods: Control|Shift
#
# The parser is currently quite sensitive to whitespace and capitalization -
# capitalization must match exactly, and piped items must not have whitespace
# around them.
#
# Either an `action`, `chars`, or `command` field must be present.
# `action` must be one of `Paste`, `PasteSelection`, `Copy`, or `Quit`.
# `chars` writes the specified string every time that binding is activated.
# These should generally be escape sequences, but they can be configured to
# send arbitrary strings of bytes.
# `command` must be a map containing a `program` string, and `args` array of
# strings. For example:
# - { ... , command: { program: "alacritty", args: ["-e", "vttest"] } }
#
# Want to add a binding (e.g. "PageUp") but are unsure what the X sequence
# (e.g. "\x1b[5~") is? Open another terminal (like xterm) without tmux,
# then run `showkey -a` to get the sequence associated to a key combination.
key_bindings:
- { key: V, mods: Control|Shift, action: Paste }
- { key: C, mods: Control|Shift, action: Copy }
- { key: Q, mods: Command, action: Quit }
- { key: W, mods: Command, action: Quit }
- { key: Insert, mods: Shift, action: PasteSelection }
- { key: Key0, mods: Control, action: ResetFontSize }
- { key: Equals, mods: Control, action: IncreaseFontSize }
- { key: Subtract, mods: Control, action: DecreaseFontSize }
- { key: Home, chars: "\x1bOH", mode: AppCursor }
- { key: Home, chars: "\x1b[H", mode: ~AppCursor }
- { key: End, chars: "\x1bOF", mode: AppCursor }
- { key: End, chars: "\x1b[F", mode: ~AppCursor }
- { key: PageUp, mods: Shift, chars: "\x1b[5;2~" }
- { key: PageUp, mods: Control, chars: "\x1b[5;5~" }
- { key: PageUp, chars: "\x1b[5~" }
- { key: PageDown, mods: Shift, chars: "\x1b[6;2~" }
- { key: PageDown, mods: Control, chars: "\x1b[6;5~" }
- { key: PageDown, chars: "\x1b[6~" }
- { key: Tab, mods: Shift, chars: "\x1b[Z" }
- { key: Back, chars: "\x7f" }
- { key: Back, mods: Alt, chars: "\x1b\x7f" }
- { key: Insert, chars: "\x1b[2~" }
- { key: Delete, chars: "\x1b[3~" }
- { key: Left, mods: Shift, chars: "\x1b[1;2D" }
- { key: Left, mods: Control, chars: "\x1b[1;5D" }
- { key: Left, mods: Alt, chars: "\x1b[1;3D" }
- { key: Left, chars: "\x1b[D", mode: ~AppCursor }
- { key: Left, chars: "\x1bOD", mode: AppCursor }
- { key: Right, mods: Shift, chars: "\x1b[1;2C" }
- { key: Right, mods: Control, chars: "\x1b[1;5C" }
- { key: Right, mods: Alt, chars: "\x1b[1;3C" }
- { key: Right, chars: "\x1b[C", mode: ~AppCursor }
- { key: Right, chars: "\x1bOC", mode: AppCursor }
- { key: Up, mods: Shift, chars: "\x1b[1;2A" }
- { key: Up, mods: Control, chars: "\x1b[1;5A" }
- { key: Up, mods: Alt, chars: "\x1b[1;3A" }
- { key: Up, chars: "\x1b[A", mode: ~AppCursor }
- { key: Up, chars: "\x1bOA", mode: AppCursor }
- { key: Down, mods: Shift, chars: "\x1b[1;2B" }
- { key: Down, mods: Control, chars: "\x1b[1;5B" }
- { key: Down, mods: Alt, chars: "\x1b[1;3B" }
- { key: Down, chars: "\x1b[B", mode: ~AppCursor }
- { key: Down, chars: "\x1bOB", mode: AppCursor }
- { key: F1, chars: "\x1bOP" }
- { key: F2, chars: "\x1bOQ" }
- { key: F3, chars: "\x1bOR" }
- { key: F4, chars: "\x1bOS" }
- { key: F5, chars: "\x1b[15~" }
- { key: F6, chars: "\x1b[17~" }
- { key: F7, chars: "\x1b[18~" }
- { key: F8, chars: "\x1b[19~" }
- { key: F9, chars: "\x1b[20~" }
- { key: F10, chars: "\x1b[21~" }
- { key: F11, chars: "\x1b[23~" }
- { key: F12, chars: "\x1b[24~" }
- { key: F1, mods: Shift, chars: "\x1b[1;2P" }
- { key: F2, mods: Shift, chars: "\x1b[1;2Q" }
- { key: F3, mods: Shift, chars: "\x1b[1;2R" }
- { key: F4, mods: Shift, chars: "\x1b[1;2S" }
- { key: F5, mods: Shift, chars: "\x1b[15;2~" }
- { key: F6, mods: Shift, chars: "\x1b[17;2~" }
- { key: F7, mods: Shift, chars: "\x1b[18;2~" }
- { key: F8, mods: Shift, chars: "\x1b[19;2~" }
- { key: F9, mods: Shift, chars: "\x1b[20;2~" }
- { key: F10, mods: Shift, chars: "\x1b[21;2~" }
- { key: F11, mods: Shift, chars: "\x1b[23;2~" }
- { key: F12, mods: Shift, chars: "\x1b[24;2~" }
- { key: F1, mods: Control, chars: "\x1b[1;5P" }
- { key: F2, mods: Control, chars: "\x1b[1;5Q" }
- { key: F3, mods: Control, chars: "\x1b[1;5R" }
- { key: F4, mods: Control, chars: "\x1b[1;5S" }
- { key: F5, mods: Control, chars: "\x1b[15;5~" }
- { key: F6, mods: Control, chars: "\x1b[17;5~" }
- { key: F7, mods: Control, chars: "\x1b[18;5~" }
- { key: F8, mods: Control, chars: "\x1b[19;5~" }
- { key: F9, mods: Control, chars: "\x1b[20;5~" }
- { key: F10, mods: Control, chars: "\x1b[21;5~" }
- { key: F11, mods: Control, chars: "\x1b[23;5~" }
- { key: F12, mods: Control, chars: "\x1b[24;5~" }
- { key: F1, mods: Alt, chars: "\x1b[1;6P" }
- { key: F2, mods: Alt, chars: "\x1b[1;6Q" }
- { key: F3, mods: Alt, chars: "\x1b[1;6R" }
- { key: F4, mods: Alt, chars: "\x1b[1;6S" }
- { key: F5, mods: Alt, chars: "\x1b[15;6~" }
- { key: F6, mods: Alt, chars: "\x1b[17;6~" }
- { key: F7, mods: Alt, chars: "\x1b[18;6~" }
- { key: F8, mods: Alt, chars: "\x1b[19;6~" }
- { key: F9, mods: Alt, chars: "\x1b[20;6~" }
- { key: F10, mods: Alt, chars: "\x1b[21;6~" }
- { key: F11, mods: Alt, chars: "\x1b[23;6~" }
- { key: F12, mods: Alt, chars: "\x1b[24;6~" }
- { key: F1, mods: Super, chars: "\x1b[1;3P" }
- { key: F2, mods: Super, chars: "\x1b[1;3Q" }
- { key: F3, mods: Super, chars: "\x1b[1;3R" }
- { key: F4, mods: Super, chars: "\x1b[1;3S" }
- { key: F5, mods: Super, chars: "\x1b[15;3~" }
- { key: F6, mods: Super, chars: "\x1b[17;3~" }
- { key: F7, mods: Super, chars: "\x1b[18;3~" }
- { key: F8, mods: Super, chars: "\x1b[19;3~" }
- { key: F9, mods: Super, chars: "\x1b[20;3~" }
- { key: F10, mods: Super, chars: "\x1b[21;3~" }
- { key: F11, mods: Super, chars: "\x1b[23;3~" }
- { key: F12, mods: Super, chars: "\x1b[24;3~" }

View file

@ -1,43 +0,0 @@
#
# ~/.bash_aliases
#
alias grep='grep --color=auto'
alias sudo='sudo '
alias fuck='eval $(thefuck $(fc -ln -1)); history -r'
alias yt-dl="youtube-dl -o '%(title)s.%(ext)s' -i -x --audio-quality 320K --audio-format mp3"
alias rusti='rustup run nightly-2016-08-01 rusti'
alias rustfmt='rustup run nightly cargo fmt --all'
case "`uname`" in
Darwin )
alias ls='ls -G'
alias md5sum='md5'
alias sha1sum='shasum -a 1'
alias sha224sum='shasum -a 224'
alias sha256sum='shasum -a 256'
alias sha384sum='shasum -a 384'
alias sha512sum='shasum -a 512'
alias strace='sudo dtruss'
alias ldd='otool -L'
alias lsblk='diskutil list'
alias objdump='otool -tVC'
alias shot='screencapture -x -T 5 ~/Dropbox/screenshots/`date +%y-%m-%d_%H:%M:%S`.png'
;;
Linux )
alias ls='ls -G --color=auto'
alias open='xdg-open'
alias shot='scrot -c -d 5 ~/Dropbox/screenshots/`date +%y-%m-%d_%H:%M:%S`.png'
;;
esac

View file

@ -1,18 +0,0 @@
#
# ~/.bash_colors
#
C_RESET="\e[0m"
C_BOLD="\e[1m"
C_ULINE="\e[4m"
C_DEFAULT="\e[39m"
C_WHITE="\e[97m"
C_GRAY="\e[37m"
C_RED="\e[91m"
C_GREEN="\e[92m"
C_YELLOW="\e[93m"
C_BLUE="\e[94m"
C_MAGENTA="\e[95m"
C_CYAN="\e[96m"

View file

@ -1,6 +0,0 @@
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc

View file

@ -1,52 +0,0 @@
#
# ~/.bash_tools
#
__update_log() {
printf "\n${C_GREEN}---> Updating %s${C_RESET}\n" "$1"
}
update() {
case "`uname`" in
Darwin )
__update_log "OS X"
sudo softwareupdate -i -a || exit
__update_log brew
brew update
brew upgrade
brew link --force unzip sqlite
brew cleanup --force --prune=0 -s
brew cask cleanup
brew prune
;;
Linux )
__update_log packages
yay -Syu --sudoloop --noconfirm --nodiffmenu --noeditmenu --noupgrademenu
;;
esac
if hash yarn 2> /dev/null; then
__update_log "node packages"
yarn global upgrade
fi
if hash gem 2> /dev/null; then
__update_log gems
gem update
fi
if hash rustup 2> /dev/null; then
__update_log rust
rustup update
fi
}
weather() {
curl -4 wttr.in
}

View file

@ -1,54 +0,0 @@
#
# ~/.bashrc
#
# If not running interactively, do nothing
[[ $- != *i* ]] && return
[[ -s ~/.bash_colors ]] && source ~/.bash_colors
export PATH="$HOME/.yarn/bin:$HOME/.cargo/bin:$HOME/local/bin:$HOME/.gems/bin:$PATH"
PS1="\[${C_BOLD}\][\[${C_RED}\]\u\[${C_WHITE}\]@\[${C_GREEN}\]\h \[${C_BLUE}\]\w\[${C_WHITE}\]]\\$ \[${C_RESET}\]"
shopt -s checkwinsize
shopt -s histappend
shopt -s cdspell
shopt -s globstar
# Do not freeze terminal on Ctrl-S
stty -ixon
export HISTCONTROL=ignoreboth
export HISTSIZE=10000
export HISTFILESIZE=${HISTSIZE}
export LC_ALL="en_US.UTF-8"
export EDITOR="vim"
export GIT_EDITOR="$EDITOR"
export PKG_CONFIG_PATH="$HOME/local/lib/pkgconfig"
export GEM_HOME="$HOME/.gems"
[[ -s ~/.bash_aliases ]] && source ~/.bash_aliases
[[ -s ~/.bash_utils ]] && source ~/.bash_utils
[[ -d ~/.bash_completions.d ]] && for f in ~/.bash_completions.d/*; do source "$f"; done
export BASE16_SHELL=$HOME/.config/base16-shell
[[ -s $BASE16_SHELL/profile_helper.sh ]] && eval "$($BASE16_SHELL/profile_helper.sh)"
if [[ "`uname`" == Linux ]]; then
export QT_STYLE_OVERRIDE=gtk
export QT_SELECT=qt5
[[ -s /usr/share/nvm/init-nvm.sh ]] && source /usr/share/nvm/init-nvm.sh
elif [[ "`uname`" == Darwin ]]; then
export HOMEBREW_GITHUB_API_TOKEN=""
export NVM_DIR="$HOME/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
[[ -s "$NVM_DIR/bash_completion" ]] && source "$NVM_DIR/bash_completion"
[[ -f $(brew --prefix)/share/bash-completion/bash_completion ]] && source $(brew --prefix)/share/bash-completion/bash_completion
[[ -f $(brew --prefix)/etc/profile.d/z.sh ]] && source $(brew --prefix)/etc/profile.d/z.sh
fi

View file

@ -1,98 +1,90 @@
# tmux v2.4+ (or so)
# Status bar colors
set-option -g status-bg colour235 # base02
set-option -g status-fg colour136 # yellow
set-option -g status-attr default
# set window split
bind-key v split-window -h
bind-key b split-window
# default window title colors
# Default window title colors
set-window-option -g window-status-fg colour244 # base0
set-window-option -g window-status-bg default
#set-window-option -g window-status-attr dim
# active window title colors
# Active window title colors
set-window-option -g window-status-current-fg colour166 # orange
set-window-option -g window-status-current-bg default
#set-window-option -g window-status-current-attr bright
set-window-option -g window-status-current-attr bright
# pane border
# Pane border
set-option -g pane-border-fg colour235 # base02
set-option -g pane-active-border-fg colour240 # base01
# Message color
set-option -g message-bg colour235 # base02
set-option -g message-fg colour166 # orange
# pane number display
# Pane number display
set-option -g display-panes-active-colour colour33 # blue
set-option -g display-panes-colour colour166 # orange
# clock
set-window-option -g clock-mode-colour green #green
set -g status-interval 1
set -g status-justify centre # center align window list
set -g status-left-length 20
set -g status-right-length 140
set -g status-left '#[fg=green]#H #[default]'
set -g status-right '#[fg=green,bg=default,bright]#(tmux-mem-cpu-load) #[fg=red,dim,bg=default]#(uptime | cut -f 4-7 -d " " | cut -f 1-2 -d ",") #[fg=white,bg=default]%a %l:%M:%S %p#[default] #[fg=blue]%Y-%m-%d'
# Update status bar every second
set-option -g status-interval 1
set-option -g status-justify centre # center align window list
set-option -g status-left-length 140
set-option -g status-right-length 140
set-option -g status-left '#[fg=green,bright]#H #[default,fg=blue,dim]#(tmux-mem-cpu-load -g 0 -a 0)#[default]'
set-option -g status-right '#[fg=red,dim]#(uptime -p | sed -r s/hours?/h/ | sed -r s/minutes?/min/) #[default,fg=white,bright]%a %l:%M:%S %p #[fg=blue]%Y-%m-%d'
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
# Start numbering at 1
set -g base-index 0
set-option -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
set-option -s escape-time 0
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
set-window-option -g aggressive-resize on
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
# Allow using C-a a <command> to send commands to a nested tmux session
bind-key a send-prefix
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity on
set-window-option -g monitor-activity on
set-option -g visual-activity on
# Horizontal and vertical split
bind-key b split-window -h -c "#{pane_current_path}"
bind-key v split-window -c "#{pane_current_path}"
# New window
bind-key c new-window -c "#{pane_current_path}"
# hjkl pane traversal
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# reload config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# Reload config
bind-key r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# auto window rename
# Raise scrollback size from 2000 to 5000 lines
set-option -g history-limit 5000
# Auto window rename
set-window-option -g automatic-rename
# color
set -g default-terminal "screen-256color-bce"
# from powerline
run-shell "tmux set-environment -g TMUX_VERSION_MAJOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f1 | sed 's/[^0-9]*//g')"
run-shell "tmux set-environment -g TMUX_VERSION_MINOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f2 | sed 's/[^0-9]*//g')"
# Terminal color support
set-option -g default-terminal "screen-256color-bce"
# Vi copypaste mode
set-window-option -g mode-keys vi
if-shell "test '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 4 \)'" 'bind-key -Tcopy-mode-vi v send -X begin-selection; bind-key -Tcopy-mode-vi y send -X copy-selection-and-cancel'
if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 4\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'bind-key -t vi-copy v begin-selection; bind-key -t vi-copy y copy-selection'
set-option -g mode-keys vi
bind-key -Tcopy-mode-vi v send -X begin-selection
bind-key -Tcopy-mode-vi y send -X copy-selection-and-cancel
# status bar
if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 2\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'set-option -g status-utf8 on'
# rm mouse mode fail
if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 1\)' 'set -g mouse off'
if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 1\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'set -g mode-mouse off'
# fix pane_current_path on new window and splits
if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" 'unbind c; bind c new-window -c "#{pane_current_path}"'
if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" "unbind '\"'; bind '\"' split-window -v -c '#{pane_current_path}'"
if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" 'unbind v; bind v split-window -h -c "#{pane_current_path}"'
if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" 'unbind %; bind % split-window -h -c "#{pane_current_path}"'
# Disable mouse support
set-option -g mouse off

View file

@ -0,0 +1,16 @@
#
# ~/.zsh_platform for darwin
#
update_platform() {
sudo softwareupdate -i -a || true
__update_log 'brew packages'
brew update
brew upgrade
brew link --force unzip sqlite
brew cleanup --prune=0 -s
rm -rfv $(brew --cache)
brew prune
}

14
files/.zsh_platform_linux Normal file
View file

@ -0,0 +1,14 @@
#
# ~/.zsh_platform for linux
#
alias open=xdg-open
update_platform() {
if [ -f /etc/arch-release ]; then
yay -Syu --sudoloop --noconfirm --nodiffmenu --noeditmenu --noupgrademenu
fi
}

113
files/.zshrc Normal file
View file

@ -0,0 +1,113 @@
#
# ~/.zshrc
#
# If not running interactively, do nothing
[[ $- != *i* ]] && return
export PATH="$HOME/.yarn/bin:$HOME/.cargo/bin:$HOME/local/bin:$HOME/.gems/bin:$PATH"
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME=spaceship
HYPHEN_INSENSITIVE=true
ENABLE_CORRECTION=true
# Display red dots whilst waiting for completion
COMPLETION_WAITING_DOTS=true
# Timestamps for history
HIST_STAMPS=yyyy-mm-dd
plugins=(
docker
gitfast
git-extras
z
# must be last
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# Show low battery warning < 20% left
SPACESHIP_BATTERY_THRESHOLD=20
# Show execution time of last command if > 10 sec
SPACESHIP_EXEC_TIME_ELAPSED=10
SPACESHIP_EXIT_CODE_SYMBOL="✘ "
SPACESHIP_EXIT_CODE_SHOW=true
export MANPATH="/usr/local/man:$MANPATH"
export LANG=en_US.UTF-8
export LC_ALL=$LANG
export HISTCONTROL=ignoreboth
export HISTSIZE=10000
export HISTFILESIZE=$HISTSIZE
export EDITOR=vim
export GIT_EDITOR=$EDITOR
export PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig
export GEM_HOM=$HOME/.gems
# Setup base16 themes
export BASE16_SHELL=$HOME/.config/base16-shell
[ -n "$PS1" ] && [ -s $BASE16_SHELL/profile_helper.sh ] && eval "$($BASE16_SHELL/profile_helper.sh)"
# Set current terminal theme
base16_material
# Setup nvm
export NVM_DIR=$HOME/.nvm
[ -s $NVM_DIR/nvm.sh ] && source $NVM_DIR/nvm.sh
# Do not freeze terminal on Ctrl-S
stty -ixon
alias sudo='sudo '
alias yt-dl="youtube-dl -o '%(title)s.%(ext)s' -i -x --audio-quality 320K --audio-format mp3"
alias weather='curl wttr.in'
alias diff='diff -u --color=always'
source $HOME/.zsh_platform
__update_log() {
printf "\n 📦 \e[92mUpdating $1\e[0m\n"
}
update() {
__update_log 'system packages'
update_platform
if hash yarn 2> /dev/null; then
__update_log 'global node packages'
yarn global upgrade
fi
if hash gem 2> /dev/null; then
__update_log gems
gem update
fi
if hash rustup 2> /dev/null; then
__update_log rust
rustup update
fi
}

View file

@ -1,14 +0,0 @@
#!/usr/bin/env bash
set -e
WITH_GUI=y
source ./common.sh
arch_generic_pre
generic_pre
arch_generic_post
generic_post

View file

@ -1,12 +0,0 @@
#!/usr/bin/env bash
set -e
source ./common.sh
arch_generic_pre
generic_pre
arch_generic_post
generic_post

45
setup-arch-linux.sh Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -e
set -u
YAY_OPTIONS="--sudoloop --noconfirm --nodiffmenu --noeditmenu --noupgrademenu"
ARCH_PACKAGE_LIST_GENERIC=arch-packages-generic.txt
ARCH_PACKAGE_LIST_GUI=arch-packages-gui.txt
WITH_GUI=$(grep antergos /etc/os-release && echo y || echo n)
# Enable pacman colors
sudo sed -i 's/^#Color$/Color/' /etc/pacman.conf
# Instruct makepkg to use (1.5 * count) cores while compiling
sudo sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$((`nproc` * 3 / 2))\"/g" /etc/makepkg.conf
# Install yay
if ! hash yay 2> /dev/null; then
yay_tmpdir=$(mktemp -d)
pushd $yay_tmpdir
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si --noconfirm
popd
fi
# Update packages
yay -Syu $YAY_OPTIONS
# Install all wanted packages
yay -S $YAY_OPTIONS --needed - < $ARCH_PACKAGE_LIST_GENERIC
[[ $WITH_GUI == y ]] && yay -S $YAY_OPTIONS --needed - < $ARCH_PACKAGE_LIST_GUI || true
yay -Qs hplib && yay -Rns hplib || true
# Clean up package cache
yay -Scc --noconfirm
./common.sh
cp -av files/.zsh_platform_linux $HOME/.zsh_platform

View file

@ -78,10 +78,6 @@ pip3 install --upgrade setuptools
mkdir -p $HOME/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> $HOME/Library/Python/2.7/lib/python/site-packages/homebrew.pth
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
curl -o- -L https://yarnpkg.com/install.sh | bash
nvm install node
generic_pre
echo '/usr/local/bin/bash' | sudo tee -a /etc/shells
@ -91,20 +87,12 @@ if hash xcode-select > /dev/null; then
xcode-select --install || echo
fi
# install rustc/cargo using rustup
# Install rust[up] and cargo
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
rustup default stable
mkdir ~/git
git clone git@github.com:jwilm/alacritty.git ~/git/alacritty
cd ~/git/alacritty
make app
cp -r target/release/osx/Alacritty.app /Applications/
sudo pmset -a sms 0
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

View file

@ -4,17 +4,24 @@
set -e
set -u
if [[ "$(basename `pwd`)" != "dotfiles" ]]; then
echo "Please execute this script in the repo's folder!"
exit 1
fi
cd "$(dirname "${BASH_SOURCE[0]}")"
rm -rf files/
mkdir -p files/
cp ~/.bashrc files/
cp ~/.bash_{aliases,colors,profile,utils} files/
cp ~/.gitconfig files/
cp ~/.tmux.conf files/
cp ~/.alacritty.yml files/
cp -v \
~/.zshrc \
~/.gitconfig \
~/.tmux.conf \
files/
case `uname` in
Linux )
cp -v ~/.zsh_platform files/.zsh_platform_linux
;;
Darwin )
cp -v ~/.zsh_platform files/.zsh_platform_darwin
;;
esac