summaryrefslogtreecommitdiffstats
path: root/ship/src/bootstrap_env_makefu
blob: e61f4e9907e734375ce76d5b7a7e99215789d1a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/sh
# TODO: modularize zsh configuration and vim configuration
#@info
#@strict
#@include core
#@include punani
#@include vim

# vim +python
_punanidb_pacman_vim_python=gvim
_punanidb_yum_vim_python=vim-enhanced
_punanidb_aptget_vim_python=vim

# TODO pull out youcompleteme into a vim function
# cmake ,make,g++,python-dev for youcompleteme 
_punanidb_pacman_cmake=cmake
_punanidb_yum_cmake=cmake
_punanidb_aptget_cmake=cmake
#@mainifyme

info "Configuring environment for $(id -un)"
cd $(readlink -f $(dirname $0))
info "Using punani to install git vim and zsh"
punani install git vim_python zsh gpp cmake make python2_dev || die "cannot install some shit"

info "writing dotfiles"
# deploying zshrc
# TODO modularize zshrc
cat > $HOME/.zshrc <<EOF
# Path to your oh-my-zsh configuration.
export ZSH=\$HOME/.oh-my-zsh

# Look in ~/.oh-my-zsh/themes/
export ZSH_THEME="gallifrey"

# Comment this out to disable weekly auto-update checks
export DISABLE_AUTO_UPDATE="true"

plugins=(git ssh-agent)
. \$ZSH/oh-my-zsh.sh
test -e \$HOME/.aliases && source \$HOME/.aliases

# Customize to your needs...
export PATH=/usr/sbin:/krebs/bin:\$HOME/bin:\$PATH:/sbin
HISTFILE=~/.histfile
HISTSIZE=9000001
SAVEHIST=9000001

export EDITOR=vim

export JAVA_HOME=\$JAVA_HOME:/opt/java/jre

GREP_COLOR="1;33"
alias grep='grep --color=auto'
alias vi=vim

export MANPATH=\$MANPATH:\$HOME/man

if [ -f "\$HOME/.dircolors" ] ; then
  eval \$(dircolors -b "\$HOME/.dircolors")
  export LS_COLORS
fi

which fortune >/dev/null && fortune -a
which task >/dev/null && task
echo "--"
test -r ~/TODO  && cat ~/TODO 

setopt menu_complete
unsetopt correct_all
export PYTHONSTARTUP=~/.pythonrc
EOF
info 'deploying pythonrc'
cat > $HOME/.pythonrc <<EOF
import rlcompleter, readline
readline.parse_and_bind('tab:complete')
EOF
info "deploying vim config"
if [ -e $HOME/.vim ] ; then
  oldvim=$HOME/.vim.`date +%Y%M%d`
  info "Backing up old vim folder to $oldvim"
  mv -v $HOME/.vim $oldvim
fi

mkdir -p $HOME/.vim

# TODO modilarize vimconfig

cat > $HOME/.vim/vimrc <<EOF 
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
" TODO refactor this
Bundle 'gmarik/vundle'
Bundle 'SudoEdit.vim'
Bundle 'snipMate'
Bundle 'tpope/vim-fugitive'
Bundle 'Valloric/YouCompleteMe'
Bundle 'scrooloose/syntastic'
Bundle 'sjl/gundo.vim'

nnoremap <F5> :GundoToggle<CR>
set undodir=~/.vim/undo
set undofile
"maximum number of changes that can be undone
set undolevels=1000000
"maximum number lines to save for undo on a buffer reload
set undoreload=10000000

set pastetoggle=<F2>
set showmode
filetype plugin indent on


filetype plugin indent on

let g:snips_author = 'Bob Ross <root@syntax-fehler.de>'
let g:makefu_author = 'makefu'

" pasting
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode

" save on focus lost
au FocusLost * :wa

set spelllang=en

set textwidth=9001
autocmd BufRead *.json set filetype=json
EOF
if [ -e $HOME/.vimrc ] ; then
  oldvim=$HOME/.vimrc.`date +%Y%M%d`
  info "Backing up old vimrc file to $oldvim"
  mv -v $HOME/.vimrc $oldvim
fi
info "Symlinking .vimrc to .vim/vimrc"
ln -vs $HOME/.vim/vimrc $HOME/.vimrc
vim_conf_sane_defaults

#install all the vim stuff with the help of vundle
cd $HOME/.vim
mkdir -p bundle undo backup
info "Fetching vim-vundle"
git clone https://github.com/gmarik/vundle.git bundle/vundle > /dev/null && \
  info "Vim Vundle deployed"
info "Installing Vundle Bundles"
vim "+:BundleInstall" "+:qall"

info "building youcompleteme libs"
cd $HOME/.vim/bundle/YouCompleteMe
./install.sh
cd -

info "configuring zsh"
if exists zsh; then
  if [ "$SHELL" != "`which zsh`" ] ;then
    info "setting zsh as new shell,please enter your user password"
    chsh -s `which zsh` 
  else
    info "zsh already set as default shell"
  fi
  if [ ! -d ~/.oh-my-zsh ] ; then
    git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh > /dev/null && info "oh-my-zsh deployed"
  else
    info "oh-my-zsh already installed"
  fi
else
  error "cannot find zsh :("
fi