Initial commit

This commit is contained in:
2018-10-18 12:33:31 +08:00
commit e3bcaeaaf2
9 changed files with 338 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
backup/

23
README.md Normal file
View File

@@ -0,0 +1,23 @@
Git repo of my personal shell profile variables
## Installing
Copy this directory somewhere in your home directory. The directory should be persistent, so probably keep this in your "projects" directory or somewhere similar. If in doubt, you can keep this under `.local/share/madumlao-profile`.
Next, run the `install.sh` script. It should backup your existing profile and replace it with symlinks to this version.
~~~ sh
madumlao@lenneth ~/Projects/madumlao-profile $ ./install.sh
Backing up original profile under /home/madumlao/Projects/madumlao-profile/backup
'/home/madumlao/.bash_profile' -> '/home/madumlao/Projects/madumlao-profile/backup/.bash_profile'
'/home/madumlao/.bash_profile' -> 'Projects/madumlao-profile/skel/.bash_profile'
'/home/madumlao/.bashrc' -> '/home/madumlao/Projects/madumlao-profile/backup/.bashrc'
'/home/madumlao/.bashrc' -> 'Projects/madumlao-profile/skel/.bashrc'
'/home/madumlao/.profile' -> '/home/madumlao/Projects/madumlao-profile/backup/.profile'
'/home/madumlao/.profile' -> 'Projects/madumlao-profile/skel/.profile'
'/home/madumlao/.vimrc' -> '/home/madumlao/Projects/madumlao-profile/backup/.vimrc'
'/home/madumlao/.vimrc' -> 'Projects/madumlao-profile/skel/.vimrc'
'/home/madumlao/.zprofile' -> '/home/madumlao/Projects/madumlao-profile/backup/.zprofile'
'/home/madumlao/.zprofile' -> 'Projects/madumlao-profile/skel/.zprofile'
'/home/madumlao/.zshrc' -> '/home/madumlao/Projects/madumlao-profile/backup/.zshrc'
'/home/madumlao/.zshrc' -> 'Projects/madumlao-profile/skel/.zshrc'
~~~

20
install.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
APP_DIR="$(dirname "$0")"
cd "$APP_DIR"
APP_DIR="$(pwd)"
SKEL_DIR="$APP_DIR/skel"
BACK_DIR="$APP_DIR/backup"
echo "Backing up original profile under $BACK_DIR"
mkdir -pv "$BACK_DIR"
cd "$SKEL_DIR"
OLDIFS="$IFS"
IFS=$'\n'
for x in $(ls -a); do
[ "$x" = '.' ] || [ "$x" = '..' ] && continue;
[ -r "$HOME/$x" ] && mv -v "$HOME/$x" "$BACK_DIR"
ln -srv "$(pwd)/$x" "$HOME"
done
IFS="$OLDIFS"

9
skel/.bash_profile Normal file
View File

@@ -0,0 +1,9 @@
# bash profile
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
source "$HOME/.profile"

117
skel/.bashrc Normal file
View File

@@ -0,0 +1,117 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
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=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm*) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
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

69
skel/.profile Normal file
View File

@@ -0,0 +1,69 @@
# environment variables
export TZ="Asia/Manila"
export PATH="/usr/local/bin:$PATH"
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.crypt/bin:$PATH"
# set your umask
# group readonly
# others no read access
umask 026
# effectively unlimited history
export HISTSIZE=10000000
# source private variables
[ -f "$HOME/.profile-priivate" ] && source "$HOME/.profile-private"
# firefox hardware acceleration
export MOZ_USE_OMTC=1
# Preferred editor
export VISUAL="vim"
export EDITOR="vim"
# gtk options
# enable "command pallete"
export GTK3_MODULES="/usr/lib/x86_64-linux-gnu/libplotinus/libplotinus.so:$GTK3_MODULES"
# Ubuntu make installation of Ubuntu Make binary symlink
export PATH="$HOME/.local/share/umake/bin:$PATH"
# C compiler options
export CPATH="$HOME/include:$CPATH"
export LIBRARY_PATH="$HOME/lib:$LIBRARY_PATH"
export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH"
# composer
export PATH="$HOME/.composer/vendor/bin:$PATH"
# phpenv
export PATH="$HOME/.phpenv/bin:$PATH"
eval "$(phpenv init -)"
# php-build
export PHP_BUILD_CONFIGURE_OPTS="--with-ldap=/usr --with-ldap-sasl=/usr --with-mhash=/usr --with-mysql-sock=/run/mysqld/mysqld.sock --with-apxs2"
export PHP_BUILD_KEEP_OBJECT_FILES=y
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
# jenv
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
# nenv
export PATH="$HOME/.nenv/bin:$PATH"
eval "$(nenv init -)"
# pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
# perl
export PATH="/home/madumlao/perl5/bin${PATH:+:${PATH}}"; export PATH;
export PERL5LIB="/home/madumlao/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
export PERL_LOCAL_LIB_ROOT="/home/madumlao/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
export PERL_MB_OPT="--install_base \"/home/madumlao/perl5\""; export PERL_MB_OPT;
export PERL_MM_OPT="INSTALL_BASE=/home/madumlao/perl5"; export PERL_MM_OPT;

25
skel/.vimrc Normal file
View File

@@ -0,0 +1,25 @@
set ignorecase
set smartcase
set iskeyword-=_
" VundleVim
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Plugins
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-sleuth'
Plugin 'wakatime/vim-wakatime'
call vundle#end()
filetype plugin indent on

1
skel/.zprofile Normal file
View File

@@ -0,0 +1 @@
source $HOME/.profile

73
skel/.zshrc Normal file
View File

@@ -0,0 +1,73 @@
# Path to your oh-my-zsh installation.
export ZSH=/home/madumlao/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="gentoo"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git per-directory-history zsh-autosuggestions zsh-syntax-highlighting)
# User configuration
source $ZSH/oh-my-zsh.sh
# interactive comments
setopt interactivecomments
# leave running jobs running
setopt NO_HUP
setopt NO_CHECK_JOBS
# command suggestions
source /etc/zsh_command_not_found
# rebuild autocompletion always
zstyle ":completion:*:commands" rehash 1
# wait ten seconds before agreeing to rm *
setopt RM_STAR_WAIT
# history options
SAVEHIST=$HISTSIZE
setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt HIST_BEEP # Beep when accessing nonexistent history.
setopt HIST_LEX_WORDS # parse quotes when parsing history