diff --git a/dotfiles/vimrc b/dotfiles/vimrc index edbe733..b9dd725 100644 --- a/dotfiles/vimrc +++ b/dotfiles/vimrc @@ -26,6 +26,7 @@ call plug#begin('~/.vim/plugged') \ 'do': 'make install' \} Plug 'JamshedVesuna/vim-markdown-preview' + Plug 'ternjs/tern_for_vim', {'do': 'yarn install'} " Initialize plugin system call plug#end() @@ -49,6 +50,8 @@ filetype on filetype plugin on filetype indent on +set omnifunc=syntaxcomplete#Complete + :highlight ExtraWhitespace ctermbg=red guibg=red :match ExtraWhitespace /\s\+$/ :match errorMsg /\s\+$/ @@ -79,20 +82,6 @@ set backspace=indent,eol,start " Hide file when open other file set hidden -" Disable arrow keys -"map -"map -"map -"map -"imap -"imap -"imap -"imap - -" Remap esc key -:imap -:map - " Code formating set smartindent " Do smart autoindenting when starting a new line set tabstop=2 " Number of spaces that a in the file counts for @@ -112,6 +101,32 @@ augroup myTodo augroup END highlight link myTodo Todo +" Auto close brackets/… +inoremap " "" +inoremap ' '' +inoremap ` `` +inoremap ( () +inoremap [ [] +inoremap { {} +inoremap { {}O +inoremap {; {};O + +" -- Remove unwantedd spaces +function TrimWhiteSpace() + %s/\s*$// + '' +endfunction + +set list listchars=trail:.,extends:> +autocmd FileWritePre * call TrimWhiteSpace() +autocmd FileAppendPre * call TrimWhiteSpace() +autocmd FilterWritePre * call TrimWhiteSpace() +autocmd BufWritePre * call TrimWhiteSpace() + +map :call TrimWhiteSpace() +map! :call TrimWhiteSpace() + + " -- Plugins configurations " vim-javascript