Skip to content

Instantly share code, notes, and snippets.

@jinyongp
Last active May 28, 2022 13:17
Show Gist options
  • Save jinyongp/7ca926fda012d17ec18b0d4866b439bf to your computer and use it in GitHub Desktop.
Save jinyongp/7ca926fda012d17ec18b0d4866b439bf to your computer and use it in GitHub Desktop.
My custom dotfiles
[pull]
rebase = true
[init]
defaultBranch = main
[pager]
branch = false
[core]
editor = vi
autocrlf = input
hooksPath = ~/.git-template/hooks
ignorecase = false
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
[include]
path = ~/.gitconfig_personal
[includeIf "gitdir:~/Workspaces/datable/"]
path = ~/.gitconfig_company
[user]
name = jinyongp
email = [email protected]
[user]
name = jinyongp
email = [email protected]
signingkey = CACC87A04D3B216B
[commit]
gpgsign = true
" ============================= "
" author: jinyongp "
" email: [email protected] "
" ============================= "
" ------------------- "
" Indentation Options "
" ------------------- "
set autoindent
set expandtab
set shiftround
set cindent
set nobackup
set tabstop=2
set softtabstop=2
set shiftwidth=2
set smarttab
set smartindent
" -------------- "
" Search Options "
" -------------- "
set hlsearch
set ignorecase
set incsearch
set smartcase
" ---------------------- "
" Text Rendering Options "
" ---------------------- "
set encoding=utf-8
set termencoding=utf-8
set linebreak
set wrap
set scrolloff=1
set sidescrolloff=5
if has("syntax")
syntax enable
endif
" ---------------------- "
" User Interface Options "
" ---------------------- "
set ruler
set laststatus=2
set wildmenu
set background=dark
"set term=xterm-256color
"set t_Co=256
set history=300
set number
"set relativenumber
"set cursorline
highlight CursorLineNr term=bold cterm=NONE ctermfg=cyan ctermbg=NONE
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE
highlight MatchParen ctermbg=NONE
highlight Pmenu ctermbg=white ctermfg=black
highlight PmenuSel ctermbg=darkgrey ctermfg=white
set list listchars=tab:»\ ,trail:•
set noerrorbells
set mouse=a
set title
" -------------------- "
" Code Folding Options "
" -------------------- "
"set foldmethod=indent
"set foldnestmax=5
" --------------------- "
" Miscellaneous Options "
" --------------------- "
set langmap=ㅁㅠㅊㅇㄷㄹㅎㅗㅑㅓㅏㅣㅡㅜㅐㅔㅂㄱㄴㅅㅕㅍㅈㅌㅛㅋ;abcdefghijklmnopqrstuvwxyz
set nocompatible
set autoread
set backspace=indent,eol,start
set noswapfile
"set spell
"set spellfile=~/.vim/spell/en.utf-8.add
set viminfo=
" ------- "
" Plugins "
" ------- "
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'shougo/neocomplete.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'baskerville/bubblegum'
Plugin 'Rainbow-Parenthesis'
call vundle#end()
filetype plugin indent on
" --------------- "
" Plugin Settings "
" --------------- "
nmap <D-1> :NERDTreeToggle<cr>
let NERDTreeShowHidden=1
let g:airline_theme='bubblegum'
let g:airline_powerline_fonts=1
let g:airline_left_sep= ''
let g:airline_right_sep= ''
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tablin#fnamemod= '.:t'
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# ============================= #
# author: jinyongp #
# email: [email protected] #
# ============================= #
export ZSH="$HOME/.oh-my-zsh"
export ZSH_COMPDUMP="$ZSH_CACHE_DIR/.zcompdump"
setopt PROMPT_CR
unsetopt PROMPT_SP
HIST_STAMPS="yyyy-mm-dd"
PROMPT_EOL_MARK=
[[ -f $HOME/.zshrc_theme ]] && source $HOME/.zshrc_theme || echo "~/.zshrc_theme not found"
[[ -f $HOME/.zshrc_plugin ]] && source $HOME/.zshrc_plugin || echo "~/.zshrc_plugin not found"
source $ZSH/oh-my-zsh.sh
[[ -f $HOME/.zshrc_alias ]] && source $HOME/.zshrc_alias || echo "~/.zshrc_alias not found"
[[ -f $HOME/.zshrc_env ]] && source $HOME/.zshrc_env || echo "~/.zshrc_env not found"
alias python=python3
alias pip=pip3
#alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Neovim
alias vim='mvim -v'
alias vi='mvim -v'
# EXA
alias ls=ols
alias ls="exa --grid --classify --icons --color=automatic --header --sort=type --git"
alias lsd="ls --only-dirs"
alias la="ls --all --long"
alias lst="ls --reverse --tree"
# Editor (https://github.com/macvim-dev/macvim)
export EDITOR=$(which mvim) || $(which vim)
# Manpage (https://github.com/sharkdp/bat)
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
# Language
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Custom Commands
export PATH=~/.custom_commands:$PATH
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('$HOME/opt/miniconda3/bin/conda' 'shell.zsh' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "$HOME/opt/miniconda3/etc/profile.d/conda.sh" ]; then
. "$HOME/opt/miniconda3/etc/profile.d/conda.sh"
else
export PATH="$HOME/opt/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# rbenv
[[ -d ~/.rbenv ]] &&
export PATH=${HOME}/.rbenv/bin:${PATH} &&
eval "$(rbenv init -)"
# Android Studio
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
# Brew
if type brew &>/dev/null; then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit
compinit
fi
# [[ -s "/Users/jinyongp/.gvm/scripts/gvm" ]] && source "/Users/jinyongp/.gvm/scripts/gvm"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/jinyongp/Downloads/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/jinyongp/Downloads/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/jinyongp/Downloads/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/jinyongp/Downloads/google-cloud-sdk/completion.zsh.inc'; fi
plugins=(
git
vundle
thefuck
copyfile
copypath
virtualenv
direnv
alias-tips
zsh-autosuggestions
zsh-completions
zsh-syntax-highlighting
git-flow-completion
zsh-better-npm-completion
)
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=245'
ZSH_THEME="powerlevel10k/powerlevel10k"
POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
POWERLEVEL9K_MODE='nerdfont-complete' # 'FiraCode Nerd Font'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUNT=1 # POWERLEVEL9K_PROMPT_ADD_NEWLINE ? (default: 1) : pass
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=''
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=$'  '
POWERLEVEL9K_INSTANT_PROMPT_COMMAND_LINES=0
# LEFT PROMPT
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator dir virtualenv anaconda)
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
# POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=''
POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='%F{008}%F{008}'
# RIGHT PROMPT
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(dir_writable vcs time status)
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='%F{008}%F{008}'
POWERLEVEL9K_SHORTEN_DELIMITER='%F{007}…%F{007}'
#POWERLEVEL9K_SHORTEN_DIR_LENGTH=1024
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_package_name"
POWERLEVEL9K_DIR_PACKAGE_FILES=(package.json)
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=true
POWERLEVEL9K_TIME_FORMAT="%D{%b %d \'%y  %H:%M:%S }"
POWERLEVEL9K_TIME_ICON=''
# VSC
POWERLEVEL9K_HIDE_BRANCH_ICON=false
POWERLEVEL9K_SHOW_CHANGESET=true
POWERLEVEL9K_CHANGESET_HASH_LENGTH=4
# VIRTUAL ENV
POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
POWERLEVEL9K_VIRTUALENV_GENERIC_NAMES=(virtualenv venv .venv env)
POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER='\b'
POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER=''
# ANACONDA
POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false
POWERLEVEL9K_ANACONDA_LEFT_DELIMITER='\b'
POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=''
# ICON
POWERLEVEL9K_HOME_ICON=""
POWERLEVEL9K_ETC_ICON=''
POWERLEVEL9K_OS_ICON_BACKGROUND='none'
POWERLEVEL9K_OS_ICON_FOREGROUND='cyan'
POWERLEVEL9K_CARRIAGE_RETURN_ICON=""
# ICON(VCS)
#POWERLEVEL9K_VCS_GIT_ICON=''
#POWERLEVEL9K_VCS_BRANCH_ICON=$''
#POWERLEVEL9K_VCS_COMMIT_ICON="ﰖ"
# COLOR
POWERLEVEL9K_DIR_BACKGROUND='none'
POWERLEVEL9K_DIR_FOREGROUND='250'
POWERLEVEL9K_DIR_HOME_BACKGROUND="none"
POWERLEVEL9K_DIR_HOME_FOREGROUND="250"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="none"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="250"
POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND='007'
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_BACKGROUND="none"
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_FOREGROUND="red"
POWERLEVEL9K_STATUS_ERROR_BACKGROUND="none"
POWERLEVEL9K_STATUS_ERROR_FOREGROUND="001"
POWERLEVEL9K_STATUS_OK_BACKGROUND="none"
POWERLEVEL9K_STATUS_BACKGROUND="none"
POWERLEVEL9K_TIME_BACKGROUND='none'
POWERLEVEL9K_TIME_FOREGROUND='250'
POWERLEVEL9K_VIRTUALENV_BACKGROUND='none'
POWERLEVEL9K_VIRTUALENV_FOREGROUND='149'
POWERLEVEL9K_ANACONDA_BACKGROUND='none'
POWERLEVEL9K_ANACONDA_FOREGROUND='149'
# COLOR(VCS)
POWERLEVEL9K_VCS_CLEAN_BACKGROUND='none'
POWERLEVEL9K_VCS_CLEAN_FOREGROUND='040'
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='none'
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='009'
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='none'
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='190'
#!/bin/bash
CWD=$(dirname $(readlink -f $0))
dotfiles=(
.zshrc
.zshrc_env
.zshrc_alias
.zshrc_theme
.zshrc_plugin
.vimrc
.gitconfig
.gitconfig_personal
.gitconfig_company
)
echo -e "Installing dotfiles...\n"
overwritten=()
linked=()
for file in ${dotfiles[*]}; do
overwrite=false
if [[ -f $HOME/$file ]]; then
BACKUP_DIR=$CWD/.backup/$(date +%Y-%m-%d__%H-%M)
mkdir -p $BACKUP_DIR
cp $HOME/$file $BACKUP_DIR/$file
rm $HOME/$file
overwrite=true
fi
ln -s $CWD/$file $HOME/$file
[[ $? == 0 ]] && [[ $overwrite == true ]] &&
overwritten+=("$file") ||
linked+=("$file")
done
[[ ${#overwritten[@]} > 0 ]] && (
echo "Overwritten:"
printf " %s\n" ${overwritten[@]}
)
echo
[[ ${#linked[@]} > 0 ]] && (
echo "New linked:"
printf " %s\n" ${linked[@]}
)
[[ ${#overwritten[@]} > 0 ]] && echo -e "\nYour original files are backed up in $BACKUP_DIR\n"
echo -e "All dotfiles installed. Enjoy! :)"
GIT_HOOKS_DIR=$HOME/.git-template/hooks
if [[ ! -d "$GIT_HOOKS_DIR" ]]; then
echo -e -e "\nGit hooks not found. Installing..."
mkdir -p $GIT_HOOKS_DIR
git clone https://gist.github.com/d8a4ce41e4bb52e352d45306691e3122.git $GIT_HOOKS_DIR --quiet
echo -e "Git hooks installed. Check it out $GIT_HOOKS_DIR"
fi
@jinyongp
Copy link
Author

jinyongp commented May 26, 2022

My Custom Dotfiles

Install

First, clone this gist.

$ git clone https://gist.github.com/7ca926fda012d17ec18b0d4866b439bf.git ~/dotfiles

Run install.sh to copy(symlink) all of the dotfiles in home directory.

$ ~/dotfiles/install.sh

The files that already existed are backed up in dotfiles/backup directory.

Setup

Oh My Zsh

Install Oh My Zsh

Install external plugins for oh-my-zsh.

  1. alias-tips
  2. direnv
  3. thefuck
  4. zsh-autosuggestions
  5. zsh-completions
  6. zsh-syntax-highlighting
  7. conda-zsh-completion
  8. git-flow-completion
  9. zsh-better-npm-completion

Run command $ omz reload to load ~/.zshrc.

You can disable some plugins that you don't need by running command $ omz plugins disable <plugin-name>.
Or, find plugins array from ~/.zshrc and delete the corresponding items.

VundleVim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment