call plug#begin('~/.vim/plugged')
if has('nvim')
    Plug 'neovim/nvim-lspconfig'
    Plug 'nvim-lua/completion-nvim'
endif
Plug 'adelarsq/vim-matchit'
Plug 'tpope/vim-surround'
Plug 'bronson/vim-trailing-whitespace'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'vim-airline/vim-airline'
Plug 'kien/ctrlp.vim'
Plug 'wincent/ferret'
Plug 'sheerun/vim-polyglot'
Plug 'mattn/emmet-vim'
Plug 'justinmk/vim-sneak'
Plug 'alvan/vim-closetag'
Plug 'mipmip/vim-fluid'
Plug 'chrisbra/Colorizer'
call plug#end()

if has('nvim')
    set inccommand=nosplit
endif

"" NERDTree config
" Autostart NERDTree on start
autocmd vimenter * NERDTree | wincmd w
let NERDTreeShowHidden=1

" Close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

"" CtrlP config
" Self explainatory
let g:ctrlp_max_files=0
let g:ctrlp_max_depth=40
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
let g:ctrlp_show_hidden = 1

"" Vim Closetag
let g:closetag_filenames = '*.xml,*.xlf,*.html,*.xhtml,*.phtml'

"" completion-nvim
let g:completion_trigger_character = ['.', '::', '>']
let g:completion_trigger_keyword_length = 3

"" Vim Config
" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect

" Avoid showing message extra message when using completion
set shortmess+=c

" Add clipboard support
set clipboard=unnamedplus

" Intendation
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent

let mapleader=" "
