Added some changes for js/css/ejs

This commit is contained in:
dbroqua 2020-08-17 11:52:31 +02:00
parent 83d9abae43
commit 729a3a1cdd
3 changed files with 24 additions and 15 deletions

2
.gitignore vendored
View file

@ -28,3 +28,5 @@ config/neomutt/accounts
config/neomutt/signature
Bin/calameco.sh
config/i3/wallpaper
dotfiles/vim/plugged
dotfiles/vim/autoload/plug.vim

View file

@ -0,0 +1,4 @@
" Fix files with prettier, and then ESLint.
let b:ale_fixers = ['prettier', 'eslint']
" Equivalent to the above.
let b:ale_fixers = {'javascript': ['prettier', 'eslint']}

View file

@ -20,6 +20,7 @@ call plug#begin('~/.vim/plugged')
Plug 'ctrlpvim/ctrlp.vim'
Plug 'moll/vim-node'
Plug 'pangloss/vim-javascript'
Plug 'briancollins/vim-jst'
Plug '1995eaton/vim-better-javascript-completion'
Plug 'heavenshell/vim-jsdoc', {
\ 'for': ['javascript', 'javascript.jsx','typescript'],
@ -88,13 +89,6 @@ set tabstop=2 " Number of spaces that a <Tab> in the file counts for
set shiftwidth=2 " Alignment with '<' and '>'
set expandtab " Use spaces instead of tab
let b:ale_linters = ['eslint']
let g:ale_fixers = {
\ 'javascript': ['eslint']
\ }
let g:ale_sign_error = '❌'
let g:ale_sign_warning = '⚠️'
let g:ale_fix_on_save = 1
augroup myTodo
autocmd!
autocmd Syntax * syntax match myTodo /\v\_.<(TODO|FIXME|INFO).*/hs=s+1 containedin=.*Comment
@ -112,24 +106,33 @@ inoremap {<CR> {<CR>}<ESC>O
inoremap {;<CR> {<CR>};<ESC>O
" -- Remove unwantedd spaces
function TrimWhiteSpace()
function GlobalTrimWhiteSpace()
%s/\s*$//
''
endfunction
set list listchars=trail:.,extends:>
autocmd FileWritePre * call TrimWhiteSpace()
autocmd FileAppendPre * call TrimWhiteSpace()
autocmd FilterWritePre * call TrimWhiteSpace()
autocmd BufWritePre * call TrimWhiteSpace()
autocmd FileWritePre * call GlobalTrimWhiteSpace()
autocmd FileAppendPre * call GlobalTrimWhiteSpace()
autocmd FilterWritePre * call GlobalTrimWhiteSpace()
autocmd BufWritePre * call GlobalTrimWhiteSpace()
map <F2> :call TrimWhiteSpace()<CR>
map! <F2> :call TrimWhiteSpace()<CR>
map <F2> :call GlobalTrimWhiteSpace()<CR>
map! <F2> :call GlobalTrimWhiteSpace()<CR>
" -- Plugins configurations
" ale
let b:ale_linters = ['eslint']
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['prettier', 'eslint'],
\ 'css': ['prettier']
\ }
let g:ale_sign_error = '❌'
let g:ale_sign_warning = '⚠️'
let g:ale_fix_on_save = 1
" vim-javascript
let g:javascript_plugin_jsdoc = 1 " Enables syntax highlighting for JSDocs
let g:javascript_plugin_flow = 1 " Enables syntax highlighting for Flow