Skip to content

Instantly share code, notes, and snippets.

@satoruk
Created April 9, 2012 06:01
Show Gist options
  • Save satoruk/2341819 to your computer and use it in GitHub Desktop.
Save satoruk/2341819 to your computer and use it in GitHub Desktop.
dotfile
vim/.netrwhist
vim/bundle/*
!vim/bundle/vundle
[submodule "vim/bundle/vundle"]
path = vim/bundle/vundle
url = https://github.com/gmarik/vundle.git

$ git clone git://gist.github.com/2341819.git ~/.dotfile $ cd ~/.dotfile $ git submodule init $ git submodule update $ ./setup.sh

TODO

  • Check exist git of bash_completion on Cent OS
[[ -s "$HOME/.bashrc.local" ]] && . "$HOME/.bashrc.local" # Load local bashrc
# Mac OS X only
if [ `uname` = "Darwin" ]; then
if type -P brew >/dev/null; then
export PATH=$(brew --repository)/bin:$PATH
if [ -d $(brew --repository)/Library/LinkedKegs/gnu-tar ]; then
alias tar='gtar'
fi
if [ -d $(brew --repository)/Library/LinkedKegs/coreutils ]; then
export PATH=$(brew --repository)/Library/LinkedKegs/coreutils/libexec/gnubin:$PATH
fi
if [ -f $(brew --repository)/etc/bash_completion ]; then
. $(brew --repository)/etc/bash_completion
fi
fi
fi
# RVM
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
# Node Version Manager(nvm)
if [ -s $HOME/.nvm/nvm.sh ]; then
source $HOME/.nvm/nvm.sh
source $HOME/.nvm/bash_completion
fi
# pythonz
[[ -s $HOME/.pythonz/etc/bashrc ]] && source $HOME/.pythonz/etc/bashrc
# python 2.7.3
[[ -d $HOME/.pythonz/pythons/CPython-2.7.3/bin ]] && export PATH=$HOME/.pythonz/pythons/CPython-2.7.3/bin:$PATH
PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[36m\]\W'
if declare -f __git_ps1 > /dev/null; then
GIT_PS1_SHOWDIRTYSTATE=true
PS1=$PS1'\[\033[31m\]$(__git_ps1)'
fi
# RVM
if type -P rvm-prompt >/dev/null; then
__custom_ps1_rvm() {
local val="$(rvm-prompt)"
[[ -n $val ]] && echo '('$val')'
}
PS1='\[\033[0;36m\]$(__custom_ps1_rvm)'$PS1
fi
# NVM
if type nvm_version &>/dev/null; then
__custom_ps1_nvm() {
local val="$(nvm_version)"
[[ -n $val ]] && echo '(node '$val')'
}
PS1='\[\033[0;36m\]$(__custom_ps1_nvm)'$PS1
fi
PS1=$PS1'\[\033[00m\]\$ '
export LESS='-R'
alias sl='ls --color=auto'
alias ll='ls --color=auto -al'
alias sudo='sudo '
#alias java='java -Dfile.encoding=UTF-8'
#eval `gdircolors ~/.dir_colors -b`
#eval `ssh-agent`
PATH=$HOME/.rvm/bin:$PATH # Add RVM to PATH for scripting
PATH=./node_modules/.bin:$PATH # Add for node.js
""""""""""""""""""""""""
" basic.vimrc
"
syntax on
filetype plugin indent on
set listchars=tab:>-,trail:-,eol:$,extends:>,precedes:<,nbsp:%
set list
set number
set laststatus=2
set cursorline
set autowrite
set hidden
set nowrap
function! GetStatusEx()
let str = ''
if &ft != ''
let str = str . '[' . &ft . ']'
endif
if has('multi_byte')
if &fenc != ''
let str = str . '[' . &fenc . ']'
elseif &enc != ''
let str = str . '[' . &enc . ']'
endif
endif
if &ff != ''
let str = str . '[' . &ff . ']'
endif
return str
endfunction
set statusline=%<%f\ %m%r%h%w%=%{GetStatusEx()}\ \ %l,%c%V%8P
" Javascript [ejs]
au BufNewFile,BufRead *.ejs set filetype=html
" PHP
au BufNewFile,BufRead *.php set tabstop=4 shiftwidth=4
""""""""""""""""""""""""
" vim-indent-guides
"
set ts=2 sw=2 et
let g:indent_guides_auto_colors = 0
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
""""""""""""""""""""""""
" neocomplcache
"
"起動時に有効
let g:neocomplcache_enable_at_startup = 1
"自動補完を行う入力数を設定。初期値は2
let g:neocomplcache_auto_completion_start_length = 2
"手動補完時に補完を行う入力数を制御。値を小さくすると文字の削除時に重くなる
let g:neocomplcache_manual_completion_start_length = 3
""""""""""""""""""""""""
" colors.vimrc
"
""""""""""""""""""""""""
" Color Scheme
"
set t_Co=256
colorscheme molokai
set background=dark " dark or light
if 'dark' == &background
hi Normal ctermbg=black guibg=black
hi Cursor ctermbg=233
hi NonText ctermbg=233 ctermfg=239
hi Visual ctermbg=236
" autocmd VimEnter,Colorscheme * :hi Normal guibg=black ctermbg=black
" autocmd VimEnter,Colorscheme * :hi Cursor ctermbg=233
endif
if 'dark' == &background
if &t_Co > 255
hi IndentGuidesOdd ctermbg=235 guibg=red
hi IndentGuidesEven ctermbg=237 guibg=green
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=235 guibg=red
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=237 guibg=green
else
hi IndentGuidesOdd ctermbg=Blue guibg=red
hi IndentGuidesEven ctermbg=DarkBlue guibg=green
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=3 guibg=red
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=4 guibg=green
endif
endif
.DS_Store
.yardoc
*.tmproj
*.bak
*.swp
*.swo
#!/bin/bash
basedir=$(cd $(dirname $0);pwd)
cd $basedir
#echo $basedir
canonical_readlink () {
cd `dirname $1`;
__filename=`basename $1`;
if [ -h "$__filename" ]; then
canonical_readlink `readlink $__filename`;
else
echo "`pwd -P`/$__filename";
fi
}
mkSLink () {
local src dest cancel
cancel=false
src=$1
dest=$2
if [ $(canonical_readlink $src) = $(canonical_readlink $dest) ]; then
echo "$(printf '%-30s ... ok (already created)' $dest)";
return
fi
if [ -e $dest ]; then
read -p "$dest already exist. Overwite? [y/N]:" ans
case $ans in
[Yy]* ) break;;
* ) cancel=true;;
esac
fi
if ! $cancel; then
rm -rf $dest
ln -s -f $src $dest
echo "$(printf '%-30s ... ok' $dest)";
else
echo "$(printf '%-30s ... skip' $dest)";
fi
}
escapeFile () {
local src dest
src=$1
dest=$2
if [ ! -f $dest ]; then
return
fi
if [ $(canonical_readlink $src) = $(canonical_readlink $dest) ]; then
return
fi
mv $dest "$dest.local"
echo "escape $dest to .local"
}
vimsetup () {
vim -u $basedir/vim/vimrc.d/vundle.vimrc +BundleInstall +qall
}
git submodule init
git submodule update
escapeFile "$basedir/bashrc" ~/.bashrc
mkSLink "$basedir/bashrc" ~/.bashrc
mkSLink "$basedir/gitignore" ~/.gitignore
mkSLink "$basedir/vimrc" ~/.vimrc
mkSLink "$basedir/vim" ~/.vim
vimsetup
# setup git
if [ -z $(git config --global user.name) ]; then
echo -en "\e[32mgit config --global user.name\e[00m > "
read input
if [ -z $input ]; then
echo -e "\e[33mskip\e[00m"
else
echo -e "git config --global user.name \e[32m$input\e[00m"
git config --global user.name $input
fi
fi
if [ -z $(git config --global user.email) ]; then
echo -en "\e[32mgit config --global user.email\e[00m > "
read input
if [ -z $input ]; then
echo -e "\e[33mskip\e[00m"
else
echo -e "git config --global user.email \e[32m$input\e[00m"
git config --global user.email $input
fi
fi
# use color UI
git config --global color.ui true
# use default git ignores
git config --global core.excludesfile $HOME/.gitignore
# push only current branch
git config --global push.default current
# aliases
git config --global alias.mls 'ls-files --other --modified --exclude-standard'
if which update-alternatives >/dev/null; then
if [ $(update-alternatives --query editor | grep -c "^Value: .*vim.*") != 1 ]; then
sudo update-alternatives --config editor
fi
fi
source ~/.vim/vimrc.d/vundle.vimrc
source ~/.vim/vimrc.d/basic.vimrc
source ~/.vim/vimrc.d/colors.vimrc
"let bedir resolve(expand("~/.vimrc"))
set nocompatible " be iMproved
filetype off " required!
" Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" original repos on github
Bundle 'gmarik/vundle'
Bundle 'kchmck/vim-coffee-script'
Bundle 'nathanaelkane/vim-indent-guides'
Bundle 'Shougo/neocomplcache'
" vim-scripts repos
Bundle 'molokai'
"Bundle 'unite.vim'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment