" Some of these I've taken from spf13
set nocompatible
filetype plugin indent on
set virtualedit=onemore
set history=1000
set number
set cursorline

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'juanedi/predawn.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'mxw/vim-jsx'
Plugin 'tpope/vim-surround'
Plugin 'Nopik/vim-nerdtree-direnter'
Bundle 'jistr/vim-nerdtree-tabs'
Plugin 'vim-airline/vim-airline'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'pangloss/vim-javascript'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

" backspace damnit
set backspace=indent,eol,start

" Theme stuff
colorscheme predawn
syntax on
highlight LineNr ctermfg=243 ctermbg=235
let g:airline_theme='luna'
hi treeDir guifg=#96CBFE

" Tree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
map <C-n> :NERDTreeToggle<CR>
map <C-e> :NERDTreeTabsToggle<CR>
let g:nerdtree_tabs_open_on_console_startup=1

" Scrolling
set mouse=a

" make Insert mode behave more sensibly
" beginning/end of lines
inoremap <C-e> <Esc>A
inoremap <C-a> <Esc>I
" deleting whole lines
inoremap <C-d> <Esc>D
" selecting all
map <C-a> <esc>ggVG<CR>

" SAVING WITH CTRL-S
" ---------------------------------------------------
" If the current buffer has never been saved, it will have no name,
" call the file browser to save it, otherwise just save it
command -nargs=0 -bar Update if &modified
			\|    if empty(bufname('%'))
				\|        browse confirm write
				\|    else
					\|        confirm write
					\|    endif
					\|endif
nnoremap <silent> <C-S> :<C-u>Update<CR>