set nocompatible " be iMproved, required
filetype off " required
filetype plugin indent on
set backspace=indent,eol,start "Make backspace behave like every other editor
let mapleader = ',' "The default leader is a comma instead of \
set number "Toggle line numbers
set linespace=9 "Macvim-specific line-height
set cindent
set cursorline
set nowrap
set showmatch
let g:html_indent_tags = 'li\|p'
set smarttab
set tabstop=4
set shiftwidth=4
set smartindent
set expandtab
" Fuzzy file searching
set path+=**
set wildmenu
"-------------------------Visuals-------------------------"
colorscheme solarized
set t_CO=256
set guioptions-=l "Hide left scrollbar
set guioptions-=L "Hide left scrollbar when split vertically
set guioptions-=r "Hide right scrollbar
set guioptions-=R "Hide right scrollbar when split vertically
"-------------------Initialize Plugins--------------------"
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-projectionist'
Plugin 'noahfrederick/vim-composer'
Plugin 'noahfrederick/vim-laravel'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'mattn/emmet-vim'
Plugin 'ctrlp.vim'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'posva/vim-vue'
" All of your Plugins must be added before the following line
call vundle#end() " required
"---------------------------------------------------------"
let g:airline#extensions#tabline#enabled = 1
let g:nerdtree_tabs_smart_startup_focus = 1
let g:nerdtree_tabs_open_on_gui_startup = 1
noremap <F2> :set invpaste paste?<CR>i
set pastetoggle=<F2>
"------------------Search-------------------"
set hlsearch
set incsearch
"------------------Mappings-------------------"
map <Leader>n <plug>NERDTreeTabsToggle<cr>
:nmap <Leader>ev :tabedit $MYVIMRC<cr>
:nmap <Leader><space> :nohlsearch<cr>
:nmap <c-s> :w<CR>
:imap <c-s> <Esc>:w<CR>a
:imap <c-s> <Esc><c-s>
au BufReadPost,BufNewFile *.twig colorscheme koehler
au BufReadPost,BufNewFile *.css colorscheme slate
au BufReadPost,BufNewFile *.js colorscheme slate2
au BufReadPost,BufNewFile *.py colorscheme molokaiyo
au BufReadPost,BufNewFile *.html colorscheme monokai
au BufReadPost,BufNewFile *.java colorscheme monokai
au BufReadPost,BufNewFile *.php colorscheme monokai
" Default line highlighting for unknown filetypes
hi String ctermfg=140
hi CursorLine ctermbg=235
hi CursorLine guibg=#D3D3D3 cterm=none
"----------------------Auto-Commands--------------------------------"
" Automatically source the Vimrc file on save
augroup autosourcing
autocmd!
autocmd BufWritePost .vimrc source %
augroup END
autocmd FileType vue syntax sync fromstart
au BufNewFile,BufRead *.vue setf vue
" Commenting blocks of code.
" This specifies the comment character when specifying block comments.
"autocmd FileType c,cpp,java,scala let b:comment_leader = '//'
"autocmd FileType sh,ruby,python let b:comment_leader = '#'
"autocmd FileType conf,fstab let b:comment_leader = '#'
"autocmd FileType tex let b:comment_leader = '%'
"autocmd FileType mail let b:comment_leader = '>'
"autocmd FileType vim let b:comment_leader = '"'
"this makes it so you can Shift-V highlight lots of text then press ,cc to
"comment it or ,cu to uncomment.
noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
"This mission critical workaround hack tells vim to restore cursor to the last line.
"Be sure to set: "Thip, crinkle, sploit" to "stopit, just be right". lolz
"Also it could be the functionality is disabled in your /etc/vim/vimrc or
"your ~/.viminfo is owned by root.
"http://askubuntu.com/questions/223018/vim-is-not-remembering-last-position
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
"These extra commands tell syntastic to ignore the following kinds of warnings
"let g:syntastic_quiet_messages = { "regex": 'superfluous' }
"let g:syntastic_quiet_messages = { "regex": 'superfluous-parens\|too-many-instance-attributes\|too-few-public-methods' }
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode
let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode