diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-17 17:40:10 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-17 17:40:10 +0200 | 
| commit | 518d733369fb6f2e4652e9649a78546ce6493079 (patch) | |
| tree | 4fe3bbecd68b2270fb6949e0862154198108015b /autoload | |
| parent | 00213842594d8262c35b64b03b176d6e831a6e94 (diff) | |
| download | vim-polyglot-518d733369fb6f2e4652e9649a78546ce6493079.tar.gz vim-polyglot-518d733369fb6f2e4652e9649a78546ce6493079.zip | |
Make sure custom scripts.vim are respected as well
Diffstat (limited to '')
| -rw-r--r-- | autoload/go/config.vim | 4 | ||||
| -rw-r--r-- | autoload/nim.vim | 106 | 
2 files changed, 56 insertions, 54 deletions
| diff --git a/autoload/go/config.vim b/autoload/go/config.vim index ce33d996..8af1e675 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -578,6 +578,10 @@ function! go#config#DiagnosticsEnabled() abort    return get(g:, 'go_diagnostics_enabled', 0)  endfunction +function! go#config#DiagnosticsIgnoreWarnings() abort +  return get(g:, 'go_diagnostics_ignore_warnings', 0) +endfunction +  function! go#config#GoplsOptions() abort    return get(g:, 'go_gopls_options', ['-remote=auto'])  endfunction diff --git a/autoload/nim.vim b/autoload/nim.vim index 59f9122d..e5531ec5 100644 --- a/autoload/nim.vim +++ b/autoload/nim.vim @@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1  let g:nim_log = []  let s:plugin_path = escape(expand('<sfile>:p:h'), '\') -if !exists("g:nim_caas_enabled") +if !exists('g:nim_caas_enabled')    let g:nim_caas_enabled = 0  endif @@ -11,27 +11,25 @@ if !executable('nim')    echoerr "the Nim compiler must be in your system's PATH"  endif -if has("python3") -  exe 'py3file ' . fnameescape(s:plugin_path) . '/nim_vim.py' -elseif has("python") -  exe 'pyfile ' . fnameescape(s:plugin_path) . '/nim_vim.py' +if has('pythonx') +  exe 'pyxfile ' . fnameescape(s:plugin_path) . '/nim_vim.py'  endif -fun! nim#init() -  let cmd = printf("nim --dump.format:json --verbosity:0 dump %s", s:CurrentNimFile()) +fun! nim#init() abort +  let cmd = printf('nim --dump.format:json --verbosity:0 dump %s', s:CurrentNimFile())    let raw_dumpdata = system(cmd) -  if !v:shell_error && expand("%:e") == "nim" +  if !v:shell_error && expand('%:e') ==# 'nim'      let false = 0 " Needed for eval of json      let true = 1 " Needed for eval of json -    let dumpdata = eval(substitute(raw_dumpdata, "\n", "", "g")) +    let dumpdata = eval(substitute(raw_dumpdata, "\n", '', 'g'))      let b:nim_project_root = dumpdata['project_path']      let b:nim_defined_symbols = dumpdata['defined_symbols']      let b:nim_caas_enabled = g:nim_caas_enabled || index(dumpdata['defined_symbols'], 'forcecaas') != -1      for path in dumpdata['lib_paths'] -      if finddir(path) == path -        let &l:path = path . "," . &l:path +      if finddir(path) ==# path +        let &l:path = path . ',' . &l:path        endif      endfor    else @@ -39,7 +37,7 @@ fun! nim#init()    endif  endf -fun! s:UpdateNimLog() +fun! s:UpdateNimLog() abort    setlocal buftype=nofile    setlocal bufhidden=hide    setlocal noswapfile @@ -56,32 +54,32 @@ endf  augroup NimVim    au!    au BufEnter log://nim call s:UpdateNimLog() -  if has("python3") || has("python") -    " au QuitPre * :py nimTerminateAll() -    au VimLeavePre * :py nimTerminateAll() +  if has('pythonx') +    " au QuitPre * :pyx nimTerminateAll() +    au VimLeavePre * :pyx nimTerminateAll()    endif  augroup END  command! NimLog :e log://nim  command! NimTerminateService -  \ :exe printf("py nimTerminateService('%s')", b:nim_project_root) +  \ :exe printf("pyx nimTerminateService('%s')", b:nim_project_root)  command! NimRestartService -  \ :exe printf("py nimRestartService('%s')", b:nim_project_root) +  \ :exe printf("pyx nimRestartService('%s')", b:nim_project_root) -fun! s:CurrentNimFile() +fun! s:CurrentNimFile() abort    let save_cur = getpos('.')    call cursor(0, 0, 0) -  let PATTERN = "\\v^\\#\\s*included from \\zs.*\\ze" -  let l = search(PATTERN, "n") +  let PATTERN = '\v^\#\s*included from \zs.*\ze' +  let l = search(PATTERN, 'n')    if l != 0      let f = matchstr(getline(l), PATTERN) -    let l:to_check = expand('%:h') . "/" . f +    let l:to_check = expand('%:h') . '/' . f    else -    let l:to_check = expand("%") +    let l:to_check = expand('%')    endif    call setpos('.', save_cur) @@ -108,42 +106,42 @@ let g:nim_symbol_types = {    \ 'skEnumField': 'v',    \ } -fun! NimExec(op) -  let isDirty = getbufvar(bufnr('%'), "&modified") +fun! NimExec(op) abort +  let isDirty = getbufvar(bufnr('%'), '&modified')    if isDirty -    let tmp = tempname() . bufname("%") . "_dirty.nim" -    silent! exe ":w " . tmp +    let tmp = tempname() . bufname('%') . '_dirty.nim' +    silent! exe ':w ' . tmp -    let cmd = printf("idetools %s --trackDirty:\"%s,%s,%d,%d\" \"%s\"", +    let cmd = printf('idetools %s --trackDirty:"%s,%s,%d,%d" "%s"',        \ a:op, tmp, expand('%:p'), line('.'), col('.')-1, s:CurrentNimFile())    else -    let cmd = printf("idetools %s --track:\"%s,%d,%d\" \"%s\"", +    let cmd = printf('idetools %s --track:"%s,%d,%d" "%s"',        \ a:op, expand('%:p'), line('.'), col('.')-1, s:CurrentNimFile())    endif    if b:nim_caas_enabled -    exe printf("py nimExecCmd('%s', '%s', False)", b:nim_project_root, cmd) -    let output = l:py_res +    exe printf("pyx nimExecCmd('%s', '%s', False)", b:nim_project_root, cmd) +    let output = get(l:, 'py_res', '')    else -    let output = system("nim " . cmd) +    let output = system('nim ' . cmd)    endif -  call add(g:nim_log, "nim " . cmd . "\n" . output) +  call add(g:nim_log, 'nim ' . cmd . "\n" . output)    return output  endf -fun! NimExecAsync(op, Handler) +fun! NimExecAsync(op, Handler) abort    let result = NimExec(a:op)    call a:Handler(result)  endf -fun! NimComplete(findstart, base) -  if b:nim_caas_enabled == 0 +fun! NimComplete(findstart, base) abort +  if b:nim_caas_enabled ==# 0      return -1    endif    if a:findstart -    if synIDattr(synIDtrans(synID(line("."),col("."),1)), "name") == 'Comment' +    if synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name') ==# 'Comment'        return -1      endif      let line = getline('.') @@ -154,10 +152,10 @@ fun! NimComplete(findstart, base)      return start    else      let result = [] -    let sugOut = NimExec("--suggest") +    let sugOut = NimExec('--suggest')      for line in split(sugOut, '\n')        let lineData = split(line, '\t') -      if len(lineData) > 0 && lineData[0] == "sug" +      if len(lineData) > 0 && lineData[0] ==# 'sug'          let word = split(lineData[2], '\.')[-1]          if a:base ==? '' || word =~# '^' . a:base            let kind = get(g:nim_symbol_types, lineData[1], '') @@ -170,7 +168,7 @@ fun! NimComplete(findstart, base)    endif  endf -if !exists("g:neocomplcache_omni_patterns") +if !exists('g:neocomplcache_omni_patterns')    let g:neocomplcache_omni_patterns = {}  endif  let g:neocomplcache_omni_patterns['nim'] = '[^. *\t]\.\w*' @@ -182,7 +180,7 @@ let g:neocomplete#sources#omni#input_patterns['nim'] = '[^. *\t]\.\w*'  let g:nim_completion_callbacks = {} -fun! NimAsyncCmdComplete(cmd, output) +fun! NimAsyncCmdComplete(cmd, output) abort    call add(g:nim_log, a:output)    echom g:nim_completion_callbacks    if has_key(g:nim_completion_callbacks, a:cmd) @@ -190,52 +188,52 @@ fun! NimAsyncCmdComplete(cmd, output)      call Callback(a:output)      " remove(g:nim_completion_callbacks, a:cmd)    else -    echom "ERROR, Unknown Command: " . a:cmd +    echom 'ERROR, Unknown Command: ' . a:cmd    endif    return 1  endf -fun! GotoDefinition_nim_ready(def_output) +fun! GotoDefinition_nim_ready(def_output) abort    if v:shell_error -    echo "nim was unable to locate the definition. exit code: " . v:shell_error +    echo 'nim was unable to locate the definition. exit code: ' . v:shell_error      " echoerr a:def_output      return 0    endif    let rawDef = matchstr(a:def_output, 'def\t\([^\n]*\)') -  if rawDef == "" -    echo "the current cursor position does not match any definitions" +  if rawDef == '' +    echo 'the current cursor position does not match any definitions'      return 0    endif    let defBits = split(rawDef, '\t')    let file = defBits[4]    let line = defBits[5] -  exe printf("e +%d %s", line, file) +  exe printf('e +%d %s', line, file)    return 1  endf -fun! GotoDefinition_nim() -  call NimExecAsync("--def", function("GotoDefinition_nim_ready")) +fun! GotoDefinition_nim() abort +  call NimExecAsync('--def', function('GotoDefinition_nim_ready'))  endf -fun! FindReferences_nim() -  setloclist() +fun! FindReferences_nim() abort +  "setloclist()  endf  " Syntastic syntax checking -fun! SyntaxCheckers_nim_nim_GetLocList() +fun! SyntaxCheckers_nim_nim_GetLocList() abort    let makeprg = 'nim check --hints:off --listfullpaths ' . s:CurrentNimFile()    let errorformat = &errorformat    return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })  endf -function! SyntaxCheckers_nim_nim_IsAvailable() -  return executable("nim") +function! SyntaxCheckers_nim_nim_IsAvailable() abort +  return executable('nim')  endfunction -if exists("g:SyntasticRegistry") +if exists('g:SyntasticRegistry')    call g:SyntasticRegistry.CreateAndRegisterChecker({        \ 'filetype': 'nim',        \ 'name': 'nim'}) | 
