set nocompatible              " be iMproved, required
filetype off                  " required

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'

Plugin 'tpope/vim-fugitive'
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}

Plugin 'https://github.com/tyrannicaltoucan/vim-deep-space.git'
Plugin 'https://github.com/dracula/vim.git'
Plugin 'vim-airline/vim-airline'
Plugin 'https://github.com/scrooloose/nerdtree.git'
Plugin 'alx741/vim-hindent'
Plugin 'https://github.com/neovimhaskell/haskell-vim.git'
Plugin 'https://github.com/dense-analysis/ale.git'
Plugin 'https://github.com/ndmitchell/ghcid.git'
Plugin 'https://github.com/frazrepo/vim-rainbow.git'
Plugin 'othree/html5.vim'
Plugin 'othree/html5-syntax.vim'
Plugin 'https://github.com/mattn/emmet-vim.git'

call vundle#end()            " required
filetype plugin indent on    " required

" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

set background=dark
set termguicolors
set softtabstop=4 expandtab
set autoindent
set nu

:colorscheme deep-space
let g:airline_theme='deep_space'
let g:rainbow_active = 1

function Compile()
    :w
    if expand('%:e') == 'hs'
	:!ghc % -g -debug -o %< 2> %<.err
    endif
    if expand('%:e') == 'cpp'
    	:!g++ % -g -DHOME -std=c++11 -Wall -o %< 2> %<.err
    endif
endfunction

function Run()
    :!time ./%<
endfunction

function Debug()
    :call Compile()
    :!gdb %< --tui 2> %<.err
endfunction

function Penis()
    :w!
    :startinsert
endfunction

function Save()
    :w
endfunction

if expand('%:e') == 'hs'
    :set expandtab
endif

imap <C-S> <esc> :call Penis() <cr>
nmap <C-S> :call Save()<cr>
map <C-N> :tabnew<cr>
map <C-D> :tabn<cr>
map <C-A> :tabp<cr>
map <C-E> :NERDTreeToggle<cr>
map <C-Up> :topleft new<cr>
map <C-Left> :topleft vnew<cr>
map <C-Down> :botright new<cr>
map <C-Right> :botright vnew<cr>
map <C-Q> :q<cr>

let mapleader = " "
map<leader>s :w <RETURN>
map<leader>c :call Compile() <RETURN>
map<leader>d :call Debug() <RETURN>
map<leader>r :call Run() <RETURN>
map<leader>e :botright new %<.err <RETURN>

