vint: Use single quotes.

This commit is contained in:
Yasuhiro Matsumoto 2020-10-16 11:18:49 +09:00 committed by zah
commit d37b228985
6 changed files with 48 additions and 46 deletions

View file

@ -1,7 +1,7 @@
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
@ -14,12 +14,12 @@ if has('pythonx')
endif
fun! nim#init()
let cmd = printf("nim --dump.format:json --verbosity:0 dump %s", s:CurrentNimFile())
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']
@ -27,7 +27,7 @@ fun! nim#init()
for path in dumpdata['lib_paths']
if finddir(path) == path
let &l:path = path . "," . &l:path
let &l:path = path . ',' . &l:path
endif
endfor
else
@ -52,7 +52,7 @@ endf
augroup NimVim
au!
au BufEnter log://nim call s:UpdateNimLog()
if has("pythonx")
if has('pythonx')
" au QuitPre * :pyx nimTerminateAll()
au VimLeavePre * :pyx nimTerminateAll()
endif
@ -70,14 +70,14 @@ fun! s:CurrentNimFile()
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)
@ -105,15 +105,15 @@ let g:nim_symbol_types = {
\ }
fun! NimExec(op)
let isDirty = getbufvar(bufnr('%'), "&modified")
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
@ -121,10 +121,10 @@ fun! NimExec(op)
exe printf("pyx nimExecCmd('%s', '%s', False)", b:nim_project_root, cmd)
let output = 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
@ -139,7 +139,7 @@ fun! NimComplete(findstart, base)
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('.')
@ -150,10 +150,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], '')
@ -166,7 +166,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*'
@ -186,33 +186,33 @@ 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)
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"))
call NimExecAsync('--def', function('GotoDefinition_nim_ready'))
endf
fun! FindReferences_nim()
@ -228,10 +228,10 @@ fun! SyntaxCheckers_nim_nim_GetLocList()
endf
function! SyntaxCheckers_nim_nim_IsAvailable()
return executable("nim")
return executable('nim')
endfunction
if exists("g:SyntasticRegistry")
if exists('g:SyntasticRegistry')
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'nim',
\ 'name': 'nim'})

View file

@ -1,10 +1,10 @@
if exists("current_compiler")
if exists('current_compiler')
finish
endif
let current_compiler = "nim"
let current_compiler = 'nim'
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
if exists(':CompilerSet') != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif

View file

@ -1,2 +1,4 @@
augroup nim_vim
au BufNewFile,BufRead *.nim,*.nims,*.nimble set filetype=nim
augroup END

View file

@ -1,4 +1,4 @@
if exists("b:nim_loaded")
if exists('b:nim_loaded')
finish
endif

View file

@ -1,5 +1,5 @@
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
@ -12,7 +12,7 @@ setlocal indentexpr=GetNimIndent(v:lnum)
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif
" Only define the function once.
if exists("*GetNimIndent")
if exists('*GetNimIndent')
finish
endif
@ -38,7 +38,7 @@ function! GetNimIndent(lnum)
endif
" If the start of the line is in a string don't change the indent.
if has('syntax_items') && synIDattr(synID(a:lnum, 1, 1), "name") =~ "String$"
if has('syntax_items') && synIDattr(synID(a:lnum, 1, 1), 'name') =~ 'String$'
return -1
endif
@ -54,12 +54,12 @@ function! GetNimIndent(lnum)
" If the last character in the line is a comment, do a binary search for
" the start of the comment. synID() is slow, a linear search would take
" too long on a long line.
if synIDattr(synID(plnum, pline_len, 1), "name") =~ "Comment$"
if synIDattr(synID(plnum, pline_len, 1), 'name') =~ 'Comment$'
let min = 1
let max = pline_len
while min < max
let col = (min + max) / 2
if synIDattr(synID(plnum, col, 1), "name") =~ "Comment$"
if synIDattr(synID(plnum, col, 1), 'name') =~ 'Comment$'
let max = col
else
let min = col + 1

View file

@ -2,28 +2,28 @@
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
elseif exists('b:current_syntax')
finish
endif
" Keep user-supplied options
if !exists("nim_highlight_numbers")
if !exists('nim_highlight_numbers')
let nim_highlight_numbers = 1
endif
if !exists("nim_highlight_builtins")
if !exists('nim_highlight_builtins')
let nim_highlight_builtins = 1
endif
if !exists("nim_highlight_exceptions")
if !exists('nim_highlight_exceptions')
let nim_highlight_exceptions = 1
endif
if !exists("nim_highlight_space_errors")
if !exists('nim_highlight_space_errors')
let nim_highlight_space_errors = 1
endif
if !exists("nim_highlight_special_vars")
if !exists('nim_highlight_special_vars')
let nim_highlight_special_vars = 1
endif
if exists("nim_highlight_all")
if exists('nim_highlight_all')
let nim_highlight_numbers = 1
let nim_highlight_builtins = 1
let nim_highlight_exceptions = 1