diff --git a/vimrc b/vimrc index fbd6bc0..41d3b67 100644 --- a/vimrc +++ b/vimrc @@ -105,7 +105,7 @@ set foldcolumn=2 " key mappings -let mapleader = "\" +let g:mapleader = "\" " jk acts as escape in insert,visual/select modes inoremap jk @@ -132,6 +132,10 @@ nnoremap k :resize -1 nnoremap l :vertical resize +1 nnoremap h :vertical resize -1 +nnoremap ep :lprev +nnoremap en :lnext + + " brace/quotes completion inoremap {{ {} inoremap (( () @@ -187,8 +191,11 @@ syntax on " tabs "set tabstop=2 " leave at default set expandtab " tab inserts 'softtabstop' number of spaces -set softtabstop=2 " -set shiftwidth=2 " affects what happens with >>,<<,== and automatic indentation +" set following with autocommands to override filetype plugin indent +au Filetype * let &l:softtabstop=2 " +au Filetype * let &l:shiftwidth=2 " affects what happens with >>,<<,== and automatic indentation +set shiftround " round indent to multiples of shiftwidth +set autoindent " copy indent from current line over to new line set mouse=a filetype plugin indent on " file type based indentation @@ -282,8 +289,31 @@ let g:ale_sign_error = '>>' let g:ale_sign_warning = '--' let g:ale_sign_column_always = 1 -let g:ale_linters = {'scss': ['stylelint'], 'javascript': ['jshint'], 'php':['php'], 'html':['htmlhint']} +"let g:ale_linters = {'scss': ['stylelint'], 'javascript': ['jshint'], 'php':['php'], 'html':['htmlhint']} +let g:ale_linters = {'scss': ['stylelint'], 'javascript': ['eslint'], 'php':['php'], 'html':['htmlhint']} let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' +let g:ale_javascript_eslint_options = '-c ~/.config/eslint/.eslintrc.js' +let g:ale_fixers = {'javascript': ['eslint']} +"let g:ale_javascript_prettier_options = '--single-quote ' + +" override ALE's eslint fix function tose correct config file +function! ale#fixers#eslint#Fix(buffer) abort + let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) + let l:config = ale#handlers#eslint#FindConfig(a:buffer) + + if empty(l:config) + let l:config = '' + endif + + return { + \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ' --config /home/ray/.config/eslint/.eslintrc.js' + \ . ' --fix %t', + \ 'read_temporary_file': 1, + \} +endfunction + + function! LinterStatus() abort let l:counts = ale#statusline#Count(bufnr(''))