From aebef2c2e76b88384b1121c237c965e8cf8b3bcb Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 7 May 2019 16:17:30 +0200 Subject: [PATCH] Update --- autoload/dart.vim | 52 +++++++++++++++++++++++++++--------------- autoload/go/config.vim | 4 ++++ ftdetect/polyglot.vim | 3 ++- indent/nim.vim | 2 +- syntax/elixir.vim | 4 ++-- syntax/typescript.vim | 4 ++-- 6 files changed, 44 insertions(+), 25 deletions(-) diff --git a/autoload/dart.vim b/autoload/dart.vim index f524e09..8285946 100644 --- a/autoload/dart.vim +++ b/autoload/dart.vim @@ -9,22 +9,35 @@ function! s:error(text) abort echohl None endfunction -function! s:cexpr(errorformat, joined_lines) abort - let temp_errorfomat = &errorformat - try - let &errorformat = a:errorformat - cexpr a:joined_lines - copen - finally - let &errorformat = temp_errorfomat - endtry +function! s:cexpr(errorformat, lines, reason) abort + call setqflist([], ' ', { + \ 'lines': a:lines, + \ 'efm': a:errorformat, + \ 'context': {'reason': a:reason}, + \}) + copen +endfunction + +" If the quickfix list has a context matching [reason], clear and close it. +function! s:clearQfList(reason) abort + let context = get(getqflist({'context': 1}), 'context', {}) + if type(context) == v:t_dict && + \ has_key(context, 'reason') && + \ context.reason == a:reason + call setqflist([], 'r') + cclose + endif endfunction function! dart#fmt(q_args) abort if executable('dartfmt') let buffer_content = join(getline(1, '$'), "\n") - let joined_lines = system(printf('dartfmt %s', a:q_args), buffer_content) - if buffer_content ==# joined_lines[:-2] | return | endif + let args = '--stdin-name '.expand('%').' '.a:q_args + let joined_lines = system(printf('dartfmt %s', args), buffer_content) + if buffer_content ==# joined_lines[:-2] + call s:clearQfList('dartfmt') + return + endif if 0 == v:shell_error let win_view = winsaveview() let lines = split(joined_lines, "\n") @@ -33,12 +46,11 @@ function! dart#fmt(q_args) abort silent keepjumps execute string(len(lines)+1).',$ delete' endif call winrestview(win_view) + call s:clearQfList('dartfmt') else let errors = split(joined_lines, "\n")[2:] - let file_path = expand('%') - call map(errors, 'file_path.":".v:val') - let error_format = '%A%f:line %l\, column %c of stdin: %m,%C%.%#' - call s:cexpr(error_format, join(errors, "\n")) + let error_format = '%Aline %l\, column %c of %f: %m,%C%.%#' + call s:cexpr(error_format, errors, 'dartfmt') endif else call s:error('cannot execute binary file: dartfmt') @@ -49,8 +61,9 @@ function! dart#analyzer(q_args) abort if executable('dartanalyzer') let path = expand('%:p:gs:\:/:') if filereadable(path) - let joined_lines = system(printf('dartanalyzer %s %s', a:q_args, shellescape(path))) - call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines) + let command = printf('dartanalyzer %s %s', a:q_args, shellescape(path)) + let lines = systemlist(command) + call s:cexpr('%m (%f\, line %l\, col %c)', lines, 'dartanalyzer') else call s:error(printf('cannot read a file: "%s"', path)) endif @@ -63,8 +76,9 @@ function! dart#tojs(q_args) abort if executable('dart2js') let path = expand('%:p:gs:\:/:') if filereadable(path) - let joined_lines = system(printf('dart2js %s %s', a:q_args, shellescape(path))) - call s:cexpr('%m (%f\, line %l\, col %c)', joined_lines) + let command = printf('dart2js %s %s', a:q_args, shellescape(path)) + let lines = systemlist(command) + call s:cexpr('%m (%f\, line %l\, col %c)', lines, 'dart2js') else call s:error(printf('cannot read a file: "%s"', path)) endif diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 4a9c149..7f243d0 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -470,6 +470,10 @@ function! go#config#EchoGoInfo() abort return get(g:, "go_echo_go_info", 1) endfunction +function! go#config#CodeCompletionEnabled() abort + return get(g:, "go_code_completion_enabled", 1) +endfunction + " Set the default value. A value of "1" is a shortcut for this, for " compatibility reasons. if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1 diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index abe0d30..d8ab62c 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -291,8 +291,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == augroup filetypedetect " dockerfile, from Dockerfile.vim in ekalinin/Dockerfile.vim " Dockerfile -autocmd BufRead,BufNewFile Dockerfile set ft=Dockerfile +autocmd BufRead,BufNewFile [Dd]ockerfile set ft=Dockerfile autocmd BufRead,BufNewFile Dockerfile* set ft=Dockerfile +autocmd BufRead,BufNewFile [Dd]ockerfile.vim set ft=vim autocmd BufRead,BufNewFile *.dock set ft=Dockerfile autocmd BufRead,BufNewFile *.[Dd]ockerfile set ft=Dockerfile augroup end diff --git a/indent/nim.vim b/indent/nim.vim index a605796..94250b7 100644 --- a/indent/nim.vim +++ b/indent/nim.vim @@ -122,7 +122,7 @@ function! GetNimIndent(lnum) return plindent + &sw endif - if pline =~ '\(type\|import\|const\|var\)\s*$' + if pline =~ '\(type\|import\|const\|var\|let\)\s*$' \ || pline =~ '=\s*\(object\|enum\|tuple\|concept\)' return plindent + &sw endif diff --git a/syntax/elixir.vim b/syntax/elixir.vim index 89440f7..9ad39e4 100644 --- a/syntax/elixir.vim +++ b/syntax/elixir.vim @@ -43,12 +43,12 @@ syn match elixirOperator '\.\.\|\.' syn match elixirOperator "\^\^\^\|\^" syn match elixirOperator '\\\\\|::\|\*\|/\|\~\~\~\|@' +syn match elixirAlias '\([a-z]\)\@=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)' syn match elixirAtom '\(:\)\@\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)' syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!" -syn match elixirAlias '\([a-z]\)\@\|>=\|<=\|++\|+=\|--\|-=" syn match typescriptEndColons "[;,]" -syn match typescriptLogicSymbols "\(&&\)\|\(||\)" +syn match typescriptLogicSymbols "\(&&\)\|\(||\)\|\(!\)" " typescriptFold Function {{{