diff --git a/install.sh b/install.sh index e21e891..5c88072 100755 --- a/install.sh +++ b/install.sh @@ -1,97 +1,84 @@ #!/bin/bash -# configure vim bundles -VIM_BUNDLES=( - 'git://github.com/msanders/snipmate.vim.git' - 'git://github.com/scrooloose/syntastic.git' - 'git://github.com/altercation/vim-colors-solarized.git' - 'git://github.com/tpope/vim-surround.git' - ) - -# check for git -GIT=$(which git) -if [ ! $? == 0 ]; then - echo "You must install git and add it to you PATH" - exit 1 -fi -ROOT=`pwd` +ROOT="$(pwd)" # pre-run cleanup rm -rf bash/bash_magic vim/bundle/* "${HOME}"/.vimrc ### -# bash +# shell ### -# clone bash_magic repo -if [ ! -d bash/bash_magic ]; then - $GIT clone git://github.com/w33ble/bash_magic.git bash/bash_magic -fi -# install select bash magic scripts -mkdir -p "${HOME}/bin" "${HOME}/.bash_aliases.d" "${HOME}/.bash_completion.d" "${HOME}/.bash_functions.d" +# check for zsh, perform setup if it exists +ZSH="$(which zsh)" +if [ ! $? == 0 ]; then + echo "Zsh not found, skipping shell setup" +else + echo "Zsh found, setting it as default shell" + chsh -s $ZSH -cd "${ROOT}/bash/bash_magic/bash_aliases.d"; -for i in color refresh git less dev sublime docker misc; do cp "${i}.sh" "${HOME}/.bash_aliases.d"; done -cd "${ROOT}/bash/bash_magic/bash_completion.d"; -for i in etc; do cp "${i}.sh" "${HOME}/.bash_completion.d"; done -cd "${ROOT}/bash/bash_magic/bash_functions.d"; -for i in completion extract lsbytes lsnew vim; do cp "${i}.sh" "${HOME}/.bash_functions.d"; done - -# install custom bash scripts -# cp "${ROOT}/bash/bash_aliases.d/"*.sh "${HOME}/.bash_aliases.d" -# cp "${ROOT}/bash/bash_completion.d/"*.sh "${HOME}/.bash_completion.d" -# cp "${ROOT}/bash/bash_functions.d/"*.sh "${HOME}/.bash_functions.d" - -# set up the bash_profile file -cp "${ROOT}/bash/bash_profile" "${HOME}"/.bash_profile - -# add bash_magic logic to bash profile -cat "${ROOT}/bash/bash_magic/bashrc" >> "${HOME}"/.bash_profile -if [ ! -f "${HOME}"/.bashrc ]; then - ln -s "${HOME}"/.bash_profile "${HOME}"/.bashrc + # install zimfw + echo "Install zimfw?" + read zfw + if [ "$zfw" == "y" ]; then + curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh + fi fi ### # dotfiles ### -cd "${ROOT}/dotfiles" -for i in *; do - cp "${i}" "${HOME}/.${i}" -done -cd "${ROOT}" +# check for dotfiles, copy them to home +if [ -d "${ROOT}/dotfiles" ]; then + cd "${ROOT}/dotfiles" || exit + for i in *; do + # check if file exists, if so skip the copy + if [ -f "${HOME}/.${i}" ]; then + echo "File ${HOME}/.${i} already exists, skipping copy" + else + cp "${i}" "${HOME}/.${i}" + fi + done + cd "${ROOT}" || exit +fi + ### # git ### -# collect git user info, create config file -echo -n "Enter your git name: " -read NAME -echo -n "Enter you git email: " -read EMAIL -echo -e "[user]\n\tname = ${NAME}\n\temail = ${EMAIL}" > "${HOME}"/.gitconfig +# check for git +GIT=$(which git) +if [ ! $? == 0 ]; then + echo "git not found, skipping git setup" +else + # add custom config and helpers + cat "${ROOT}"/git/gitconfig >> "${HOME}"/.gitconfig + cp "${ROOT}"/git/githelpers "${HOME}"/.githelpers -# add custom config and helpers -cat "${ROOT}"/git/gitconfig >> "${HOME}"/.gitconfig -cp "${ROOT}"/git/githelpers "${HOME}"/.githelpers + # collect git user info, create config file + echo "Enter you git auth details?" + read GIT_AUTH + if [ "$GIT_AUTH" == "y" ]; then + echo -n "Enter your git name: " + read NAME + echo -n "Enter you git email: " + read EMAIL + git config --global user.name "${NAME}" + git config --global user.email "${EMAIL}" + fi +fi ### # vim ### -# clone bundle repos -echo "${ROOT}/vim/bundle" -cd "${ROOT}/vim/bundle" -pwd - -for b in ${VIM_BUNDLES[@]}; do - $GIT clone "${b}" -done -cd "${ROOT}" - # install -cp -R vim "${HOME}"/.vim -ln -s "${HOME}"/.vim/vimrc "${HOME}"/.vimrc +if [ -d "${HOME}/.vimrc" ]; then + echo "Vim config already exists, skipping copy" +else + cp "${HOME}"/.vim/vimrc "${HOME}"/.vimrc +fi -echo Install complete, run the following: source \"${HOME}\"/.bashrc +echo Install complete, restart your terminal diff --git a/vim/README.md b/vim/README.md deleted file mode 100644 index c996f53..0000000 --- a/vim/README.md +++ /dev/null @@ -1,33 +0,0 @@ - -What is this? -=== - -My personal vim scripts and settings. Nothing too mind-blowing, but I -find it useful having it online and maybe someone will learn something -or find out about a vim script they never heard of before. - -This uses [pathogen](http://www.vim.org/scripts/script.php?script_id=2332), -which is probably the greatest thing since sliced bread. - -Under bundle, you'll find custom, which is just some custom stuff I added. -Nothing too magical, just some indenting rules settings, aliases and other -jazz that I didn't want mucking up my vimrc. - - -Usage -=== - -Clone the repo to ~/.vim and symlink ~/.vim/vimrc to ~/.vimrc and you'll see what I see. - - -Included Scripts -=== - -- [phpfolding.vim](https://github.com/vim-scripts/phpfolding.vim) -- [snipmate.vim](https://github.com/msanders/snipmate.vim) -- [syntastic](https://github.com/scrooloose/syntastic) -- [vim-coffee-script](https://github.com/kchmck/vim-coffee-script) -- [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized) -- [vim-jade](https://github.com/digitaltoad/vim-jade) -- [vim-stylus](https://github.com/wavded/vim-stylus) -- [vim-surround](https://github.com/tpope/vim-surround) diff --git a/vim/autoload/pathogen.vim b/vim/autoload/pathogen.vim deleted file mode 100644 index be68389..0000000 --- a/vim/autoload/pathogen.vim +++ /dev/null @@ -1,230 +0,0 @@ -" pathogen.vim - path option manipulation -" Maintainer: Tim Pope -" Version: 2.0 - -" Install in ~/.vim/autoload (or ~\vimfiles\autoload). -" -" For management of individually installed plugins in ~/.vim/bundle (or -" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc -" prior to `fileype plugin indent on` is the only other setup necessary. -" -" The API is documented inline below. For maximum ease of reading, -" :set foldmethod=marker - -if exists("g:loaded_pathogen") || &cp - finish -endif -let g:loaded_pathogen = 1 - -" Point of entry for basic default usage. Give a directory name to invoke -" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path -" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards, -" pathogen#cycle_filetype() is invoked. -function! pathogen#infect(...) abort " {{{1 - let source_path = a:0 ? a:1 : 'bundle' - if source_path =~# '[\\/]' - call pathogen#runtime_prepend_subdirectories(source_path) - else - call pathogen#runtime_append_all_bundles(source_path) - endif - call pathogen#cycle_filetype() -endfunction " }}}1 - -" Split a path into a list. -function! pathogen#split(path) abort " {{{1 - if type(a:path) == type([]) | return a:path | endif - let split = split(a:path,'\\\@,'edit',) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',) -command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,'lcd') - -" vim:set ft=vim ts=8 sw=2 sts=2: diff --git a/vim/bundle/.empty b/vim/bundle/.empty deleted file mode 100644 index e69de29..0000000 diff --git a/vim/vimrc b/vim/vimrc index 74b7448..e69de29 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,123 +0,0 @@ -" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just -" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime -" you can find below. If you wish to change any of those settings, you should -" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten -" everytime an upgrade of the vim packages is performed. It is recommended to -" make changes after sourcing debian.vim since it alters the value of the -" 'compatible' option. - -" This line should not be removed as it ensures that various options are -" properly set to work with the Vim-related packages available in Debian. -" runtime! debian.vim - -" Uncomment the next line to make Vim more Vi-compatible -" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous -" options, so any other options should be set AFTER setting 'compatible'. -"set nocompatible - -" Vim5 and later versions support syntax highlighting. Uncommenting the next -" line enables syntax highlighting by default. -syntax enable - -" Start Pathogen -call pathogen#infect() -" Enable filetype plugins -filetype plugin on - -" Some custom highlighting rules -" au BufNewFile,BufRead *.ctp setfiletype php - -" If using a dark background within the editing area and syntax highlighting -" turn on this option as well -set background=dark - -" The following are commands that change the default colors of the syntax -" highlighting. Comment of change them to meet your needs -hi Comment ctermfg=DarkGreen -hi Search ctermbg=red -hi String ctermfg=grey - -" Load the solarized color theme -"colorscheme solarized - -" Uncomment the following to have Vim jump to the last position when -" reopening a file -"if has("autocmd") -" au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") -" \| exe "normal g'\"" | endif -"endif - -" Uncomment the following to have Vim load indentation rules according to the -" detected filetype. Per default Debian Vim only load filetype specific -" plugins. -if has("autocmd") - filetype indent on -endif - -" Allow indenting to be toggled by pressing F8 -nnoremap :setl noai! nocin! nosi! - -" Allow quick paste toggle -nnoremap :set invpaste paste? -set pastetoggle= -set showmode - -" The following are commented out as they cause vim to behave a lot -" differently from regular Vi. They are highly recommended though. -set showcmd " Show (partial) command in status line. -set showmatch " Show matching brackets. -set ignorecase " Do case insensitive matching -set smartcase " Do smart case matching -set incsearch " Incremental search as you type it -set hlsearch " Highlight search phrases -"set autowrite " Automatically save before commands like :next and :make -"set hidden " Hide buffers when they are abandoned -"set mouse=a " Enable mouse usage (all modes) in terminals -set visualbell " Enable visual bell -set ruler " Always show a ruler -set laststatus=2 " Always shows the last status menu -set statusline=%F%m%r%h%w\ (%{&ff})\ %=\ [%l,%v\ %L\ (%p%%)] -set noerrorbells " Don't ring the bell for errors -set nostartofline " Don't move cursor to the start of the line -set shortmess=at " Avoid the 'press enter' with error messages - -"set expandtab " insert spaces instead of tabs -set tabstop=4 " use X spaces when tab is pressed -set shiftwidth=4 " shifttabs are also X spaces -set smarttab " make delete remove X spaces -set smartindent " allow vim to do intelligent indenting - -" Syntastic settings -let g:syntastic_check_on_open=1 -" Status line settings -set statusline+=%#warningmsg# -set statusline+=%{SyntasticStatuslineFlag()} -set statusline+=%* - - -" On some systems, it may be nesseccary to re-map the arrow keys. Uncomment -" these next lines if that is the case. -"map gk -"map gj -"map gh -"map gl - -" Disable the 'auto commenting' crap -au FileType * setlocal comments= - -" Source a global configuration file if available -" XXX Deprecated, please move your changes here in /etc/vim/vimrc -"if filereadable("/etc/vim/vimrc.local") -" source /etc/vim/vimrc.local -"endif - -" Omnifunc stuff -"autocmd FileType python set omnifunc=pythoncomplete#Complete -"autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS -"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags -"autocmd FileType css set omnifunc=csscomplete#CompleteCSS -"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags -"autocmd FileType php set omnifunc=phpcomplete#CompletePHP -"autocmd FileType c set omnifunc=ccomplete#Complete -"autocmd FileType coffee set omnifunc=coffeecomplete#Complete -