Compare commits

..

11 Commits

Author SHA1 Message Date
Adam Stankiewicz
233a817f05 Add vim-sensible defaults by default 2020-10-19 02:26:31 +02:00
Adam Stankiewicz
c3e825027d Allow vim-polyglot to load in non-compatible mode 2020-10-19 02:25:59 +02:00
Adam Stankiewicz
3618414fad Do not set tabstop by mistake 2020-10-19 00:10:17 +02:00
Adam Stankiewicz
88cae16fca Autodetect only 2, 3, 4, or 8 space indent, fixes #592 2020-10-18 23:57:00 +02:00
Adam Stankiewicz
6d7f437b84 Do not set nocompatible mode, fixes #593 2020-10-18 22:15:53 +02:00
Adam Stankiewicz
bb27d0efbf Add regression test 2020-10-18 13:34:01 +02:00
Adam Stankiewicz
8a790ac7bf Leave only filetype detect for context, closes #575 2020-10-18 12:27:11 +02:00
Adam Stankiewicz
c9f2aa9ae0 Leave only filetype detection for man, #576 2020-10-18 12:24:33 +02:00
Adam Stankiewicz
1fc249bafd Set nocompatible mode instead of checking it 2020-10-17 21:23:12 +02:00
Adam Stankiewicz
518d733369 Make sure custom scripts.vim are respected as well 2020-10-17 17:40:10 +02:00
Adam Stankiewicz
0021384259 Make sure polyglot_disable does not skip native vim files, fixes #591 2020-10-17 15:56:13 +02:00
22 changed files with 2584 additions and 986 deletions

View File

@@ -7,7 +7,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cpp-modern') ==
" http://www.vim.org/scripts/script.php?script_id=3064 " http://www.vim.org/scripts/script.php?script_id=3064
" Maintainer: bfrg <bfrg@users.noreply.github.com> " Maintainer: bfrg <bfrg@users.noreply.github.com>
" Website: https://github.com/bfrg/vim-cpp-modern " Website: https://github.com/bfrg/vim-cpp-modern
" Last Change: Oct 4, 2020 " Last Change: Oct 17, 2020
" "
" Extended C syntax highlighting including highlighting of user-defined " Extended C syntax highlighting including highlighting of user-defined
" functions. " functions.
@@ -28,6 +28,21 @@ if !get(g:, 'cpp_no_function_highlight', 0)
endif endif
" Highlight struct/class member variables
if get(g:, 'cpp_member_highlight', 0)
syn match cMemberAccess "\.\|->" nextgroup=cStructMember,cppTemplateKeyword
syn match cStructMember "\<\h\w*\>\%((\|<\)\@!" contained
syn cluster cParenGroup add=cStructMember
syn cluster cPreProcGroup add=cStructMember
hi def link cStructMember Identifier
if &filetype ==# 'cpp'
syn keyword cppTemplateKeyword template
hi def link cppTemplateKeyword cppStructure
endif
endif
" Common ANSI-standard Names " Common ANSI-standard Names
syn keyword cAnsiName syn keyword cAnsiName
\ PRId8 PRIi16 PRIo32 PRIu64 PRId16 PRIi32 PRIo64 PRIuLEAST8 PRId32 PRIi64 PRIoLEAST8 PRIuLEAST16 PRId64 PRIiLEAST8 PRIoLEAST16 PRIuLEAST32 PRIdLEAST8 PRIiLEAST16 PRIoLEAST32 PRIuLEAST64 PRIdLEAST16 PRIiLEAST32 PRIoLEAST64 PRIuFAST8 PRIdLEAST32 PRIiLEAST64 PRIoFAST8 PRIuFAST16 PRIdLEAST64 PRIiFAST8 PRIoFAST16 PRIuFAST32 PRIdFAST8 PRIiFAST16 PRIoFAST32 PRIuFAST64 PRIdFAST16 PRIiFAST32 PRIoFAST64 PRIuMAX PRIdFAST32 PRIiFAST64 PRIoMAX PRIuPTR PRIdFAST64 PRIiMAX PRIoPTR PRIx8 PRIdMAX PRIiPTR PRIu8 PRIx16 PRIdPTR PRIo8 PRIu16 PRIx32 PRIi8 PRIo16 PRIu32 PRIx64 PRIxLEAST8 SCNd8 SCNiFAST32 SCNuLEAST32 PRIxLEAST16 SCNd16 SCNiFAST64 SCNuLEAST64 PRIxLEAST32 SCNd32 SCNiMAX SCNuFAST8 PRIxLEAST64 SCNd64 SCNiPTR SCNuFAST16 PRIxFAST8 SCNdLEAST8 SCNo8 SCNuFAST32 PRIxFAST16 SCNdLEAST16 SCNo16 SCNuFAST64 PRIxFAST32 SCNdLEAST32 SCNo32 SCNuMAX PRIxFAST64 SCNdLEAST64 SCNo64 SCNuPTR PRIxMAX SCNdFAST8 SCNoLEAST8 SCNx8 PRIxPTR SCNdFAST16 SCNoLEAST16 SCNx16 PRIX8 SCNdFAST32 SCNoLEAST32 SCNx32 PRIX16 SCNdFAST64 SCNoLEAST64 SCNx64 PRIX32 SCNdMAX SCNoFAST8 SCNxLEAST8 PRIX64 SCNdPTR SCNoFAST16 SCNxLEAST16 PRIXLEAST8 SCNi8 SCNoFAST32 SCNxLEAST32 PRIXLEAST16 SCNi16 SCNoFAST64 SCNxLEAST64 PRIXLEAST32 SCNi32 SCNoMAX SCNxFAST8 PRIXLEAST64 SCNi64 SCNoPTR SCNxFAST16 PRIXFAST8 SCNiLEAST8 SCNu8 SCNxFAST32 PRIXFAST16 SCNiLEAST16 SCNu16 SCNxFAST64 PRIXFAST32 SCNiLEAST32 SCNu32 SCNxMAX PRIXFAST64 SCNiLEAST64 SCNu64 SCNxPTR PRIXMAX SCNiFAST8 SCNuLEAST8 PRIXPTR SCNiFAST16 SCNuLEAST16 STDC CX_LIMITED_RANGE STDC FENV_ACCESS STDC FP_CONTRACT \ PRId8 PRIi16 PRIo32 PRIu64 PRId16 PRIi32 PRIo64 PRIuLEAST8 PRId32 PRIi64 PRIoLEAST8 PRIuLEAST16 PRId64 PRIiLEAST8 PRIoLEAST16 PRIuLEAST32 PRIdLEAST8 PRIiLEAST16 PRIoLEAST32 PRIuLEAST64 PRIdLEAST16 PRIiLEAST32 PRIoLEAST64 PRIuFAST8 PRIdLEAST32 PRIiLEAST64 PRIoFAST8 PRIuFAST16 PRIdLEAST64 PRIiFAST8 PRIoFAST16 PRIuFAST32 PRIdFAST8 PRIiFAST16 PRIoFAST32 PRIuFAST64 PRIdFAST16 PRIiFAST32 PRIoFAST64 PRIuMAX PRIdFAST32 PRIiFAST64 PRIoMAX PRIuPTR PRIdFAST64 PRIiMAX PRIoPTR PRIx8 PRIdMAX PRIiPTR PRIu8 PRIx16 PRIdPTR PRIo8 PRIu16 PRIx32 PRIi8 PRIo16 PRIu32 PRIx64 PRIxLEAST8 SCNd8 SCNiFAST32 SCNuLEAST32 PRIxLEAST16 SCNd16 SCNiFAST64 SCNuLEAST64 PRIxLEAST32 SCNd32 SCNiMAX SCNuFAST8 PRIxLEAST64 SCNd64 SCNiPTR SCNuFAST16 PRIxFAST8 SCNdLEAST8 SCNo8 SCNuFAST32 PRIxFAST16 SCNdLEAST16 SCNo16 SCNuFAST64 PRIxFAST32 SCNdLEAST32 SCNo32 SCNuMAX PRIxFAST64 SCNdLEAST64 SCNo64 SCNuPTR PRIxMAX SCNdFAST8 SCNoLEAST8 SCNx8 PRIxPTR SCNdFAST16 SCNoLEAST16 SCNx16 PRIX8 SCNdFAST32 SCNoLEAST32 SCNx32 PRIX16 SCNdFAST64 SCNoLEAST64 SCNx64 PRIX32 SCNdMAX SCNoFAST8 SCNxLEAST8 PRIX64 SCNdPTR SCNoFAST16 SCNxLEAST16 PRIXLEAST8 SCNi8 SCNoFAST32 SCNxLEAST32 PRIXLEAST16 SCNi16 SCNoFAST64 SCNxLEAST64 PRIXLEAST32 SCNi32 SCNoMAX SCNxFAST8 PRIXLEAST64 SCNi64 SCNoPTR SCNxFAST16 PRIXFAST8 SCNiLEAST8 SCNu8 SCNxFAST32 PRIXFAST16 SCNiLEAST16 SCNu16 SCNxFAST64 PRIXFAST32 SCNiLEAST32 SCNu32 SCNxMAX PRIXFAST64 SCNiLEAST64 SCNu64 SCNxPTR PRIXMAX SCNiFAST8 SCNuLEAST8 PRIXPTR SCNiFAST16 SCNuLEAST16 STDC CX_LIMITED_RANGE STDC FENV_ACCESS STDC FP_CONTRACT

View File

@@ -1,188 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1
" Language: ConTeXt typesetting engine
" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
" Latest Revision: 2016 Oct 21
let s:keepcpo= &cpo
set cpo&vim
" Helper functions {{{
function! s:context_echo(message, mode)
redraw
echo "\r"
execute 'echohl' a:mode
echomsg '[ConTeXt]' a:message
echohl None
endf
function! s:sh()
return has('win32') || has('win64') || has('win16') || has('win95')
\ ? ['cmd.exe', '/C']
\ : ['/bin/sh', '-c']
endfunction
" For backward compatibility
if exists('*win_getid')
function! s:win_getid()
return win_getid()
endf
function! s:win_id2win(winid)
return win_id2win(a:winid)
endf
else
function! s:win_getid()
return winnr()
endf
function! s:win_id2win(winnr)
return a:winnr
endf
endif
" }}}
" ConTeXt jobs {{{
if has('job')
let g:context_jobs = []
" Print the status of ConTeXt jobs
function! context#job_status()
let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"')
let l:n = len(l:jobs)
call s:context_echo(
\ 'There '.(l:n == 1 ? 'is' : 'are').' '.(l:n == 0 ? 'no' : l:n)
\ .' job'.(l:n == 1 ? '' : 's').' running'
\ .(l:n == 0 ? '.' : ' (' . join(l:jobs, ', ').').'),
\ 'ModeMsg')
endfunction
" Stop all ConTeXt jobs
function! context#stop_jobs()
let l:jobs = filter(g:context_jobs, 'job_status(v:val) == "run"')
for job in l:jobs
call job_stop(job)
endfor
sleep 1
let l:tmp = []
for job in l:jobs
if job_status(job) == "run"
call add(l:tmp, job)
endif
endfor
let g:context_jobs = l:tmp
if empty(g:context_jobs)
call s:context_echo('Done. No jobs running.', 'ModeMsg')
else
call s:context_echo('There are still some jobs running. Please try again.', 'WarningMsg')
endif
endfunction
function! context#callback(path, job, status)
if index(g:context_jobs, a:job) != -1 && job_status(a:job) != 'run' " just in case
call remove(g:context_jobs, index(g:context_jobs, a:job))
endif
call s:callback(a:path, a:job, a:status)
endfunction
function! context#close_cb(channel)
call job_status(ch_getjob(a:channel)) " Trigger exit_cb's callback for faster feedback
endfunction
function! s:typeset(path)
call add(g:context_jobs,
\ job_start(add(s:sh(), context#command() . ' ' . shellescape(fnamemodify(a:path, ":t"))), {
\ 'close_cb' : 'context#close_cb',
\ 'exit_cb' : function(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')),
\ [a:path]),
\ 'in_io' : 'null'
\ }))
endfunction
else " No jobs
function! context#job_status()
call s:context_echo('Not implemented', 'WarningMsg')
endfunction!
function! context#stop_jobs()
call s:context_echo('Not implemented', 'WarningMsg')
endfunction
function! context#callback(path, job, status)
call s:callback(a:path, a:job, a:status)
endfunction
function! s:typeset(path)
execute '!' . context#command() . ' ' . shellescape(fnamemodify(a:path, ":t"))
call call(get(b:, 'context_callback', get(g:, 'context_callback', 'context#callback')),
\ [a:path, 0, v:shell_error])
endfunction
endif " has('job')
function! s:callback(path, job, status) abort
if a:status < 0 " Assume the job was terminated
return
endif
" Get info about the current window
let l:winid = s:win_getid() " Save window id
let l:efm = &l:errorformat " Save local errorformat
let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory
" Set errorformat to parse ConTeXt errors
execute 'setl efm=' . escape(b:context_errorformat, ' ')
try " Set cwd to expand error file correctly
execute 'lcd' fnameescape(fnamemodify(a:path, ':h'))
catch /.*/
execute 'setl efm=' . escape(l:efm, ' ')
throw v:exception
endtry
try
execute 'cgetfile' fnameescape(fnamemodify(a:path, ':r') . '.log')
botright cwindow
finally " Restore cwd and errorformat
execute s:win_id2win(l:winid) . 'wincmd w'
execute 'lcd ' . fnameescape(l:cwd)
execute 'setl efm=' . escape(l:efm, ' ')
endtry
if a:status == 0
call s:context_echo('Success!', 'ModeMsg')
else
call s:context_echo('There are errors. ', 'ErrorMsg')
endif
endfunction
function! context#command()
return get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun'))
\ . ' --script context --autogenerate --nonstopmode'
\ . ' --synctex=' . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0')
\ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', ''))
endfunction
" Accepts an optional path (useful for big projects, when the file you are
" editing is not the project's root document). If no argument is given, uses
" the path of the current buffer.
function! context#typeset(...) abort
let l:path = fnamemodify(strlen(a:000[0]) > 0 ? a:1 : expand("%"), ":p")
let l:cwd = fnamemodify(getcwd(), ":p") " Save local working directory
call s:context_echo('Typesetting...', 'ModeMsg')
execute 'lcd' fnameescape(fnamemodify(l:path, ":h"))
try
call s:typeset(l:path)
finally " Restore local working directory
execute 'lcd ' . fnameescape(l:cwd)
endtry
endfunction!
"}}}
let &cpo = s:keepcpo
unlet s:keepcpo
" vim: sw=2 fdm=marker
endif

View File

@@ -574,10 +574,21 @@ function! go#config#GoplsEnabled() abort
return get(g:, 'go_gopls_enabled', 1) return get(g:, 'go_gopls_enabled', 1)
endfunction endfunction
" TODO(bc): remove support for g:go_diagnostics_enabled;
" g:go_diagnostics_level is the replacement.
function! go#config#DiagnosticsEnabled() abort function! go#config#DiagnosticsEnabled() abort
return get(g:, 'go_diagnostics_enabled', 0) return get(g:, 'go_diagnostics_enabled', 0)
endfunction endfunction
function! go#config#DiagnosticsLevel() abort
let l:default = 0
if has_key(g:, 'go_diagnostics_enabled') && g:go_diagnostics_enabled
let l:default = 2
endif
return get(g:, 'go_diagnostics_level', l:default)
endfunction
function! go#config#GoplsOptions() abort function! go#config#GoplsOptions() abort
return get(g:, 'go_gopls_options', ['-remote=auto']) return get(g:, 'go_gopls_options', ['-remote=auto'])
endfunction endfunction

View File

@@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
let g:nim_log = [] let g:nim_log = []
let s:plugin_path = escape(expand('<sfile>:p:h'), '\') 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 let g:nim_caas_enabled = 0
endif endif
@@ -11,27 +11,25 @@ if !executable('nim')
echoerr "the Nim compiler must be in your system's PATH" echoerr "the Nim compiler must be in your system's PATH"
endif endif
if has("python3") if has('pythonx')
exe 'py3file ' . fnameescape(s:plugin_path) . '/nim_vim.py' exe 'pyxfile ' . fnameescape(s:plugin_path) . '/nim_vim.py'
elseif has("python")
exe 'pyfile ' . fnameescape(s:plugin_path) . '/nim_vim.py'
endif endif
fun! nim#init() fun! nim#init() abort
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) 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 false = 0 " Needed for eval of json
let true = 1 " 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_project_root = dumpdata['project_path']
let b:nim_defined_symbols = dumpdata['defined_symbols'] let b:nim_defined_symbols = dumpdata['defined_symbols']
let b:nim_caas_enabled = g:nim_caas_enabled || index(dumpdata['defined_symbols'], 'forcecaas') != -1 let b:nim_caas_enabled = g:nim_caas_enabled || index(dumpdata['defined_symbols'], 'forcecaas') != -1
for path in dumpdata['lib_paths'] for path in dumpdata['lib_paths']
if finddir(path) == path if finddir(path) ==# path
let &l:path = path . "," . &l:path let &l:path = path . ',' . &l:path
endif endif
endfor endfor
else else
@@ -39,7 +37,7 @@ fun! nim#init()
endif endif
endf endf
fun! s:UpdateNimLog() fun! s:UpdateNimLog() abort
setlocal buftype=nofile setlocal buftype=nofile
setlocal bufhidden=hide setlocal bufhidden=hide
setlocal noswapfile setlocal noswapfile
@@ -56,32 +54,32 @@ endf
augroup NimVim augroup NimVim
au! au!
au BufEnter log://nim call s:UpdateNimLog() au BufEnter log://nim call s:UpdateNimLog()
if has("python3") || has("python") if has('pythonx')
" au QuitPre * :py nimTerminateAll() " au QuitPre * :pyx nimTerminateAll()
au VimLeavePre * :py nimTerminateAll() au VimLeavePre * :pyx nimTerminateAll()
endif endif
augroup END augroup END
command! NimLog :e log://nim command! NimLog :e log://nim
command! NimTerminateService command! NimTerminateService
\ :exe printf("py nimTerminateService('%s')", b:nim_project_root) \ :exe printf("pyx nimTerminateService('%s')", b:nim_project_root)
command! NimRestartService 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('.') let save_cur = getpos('.')
call cursor(0, 0, 0) call cursor(0, 0, 0)
let PATTERN = "\\v^\\#\\s*included from \\zs.*\\ze" let PATTERN = '\v^\#\s*included from \zs.*\ze'
let l = search(PATTERN, "n") let l = search(PATTERN, 'n')
if l != 0 if l != 0
let f = matchstr(getline(l), PATTERN) let f = matchstr(getline(l), PATTERN)
let l:to_check = expand('%:h') . "/" . f let l:to_check = expand('%:h') . '/' . f
else else
let l:to_check = expand("%") let l:to_check = expand('%')
endif endif
call setpos('.', save_cur) call setpos('.', save_cur)
@@ -108,42 +106,42 @@ let g:nim_symbol_types = {
\ 'skEnumField': 'v', \ 'skEnumField': 'v',
\ } \ }
fun! NimExec(op) fun! NimExec(op) abort
let isDirty = getbufvar(bufnr('%'), "&modified") let isDirty = getbufvar(bufnr('%'), '&modified')
if isDirty if isDirty
let tmp = tempname() . bufname("%") . "_dirty.nim" let tmp = tempname() . bufname('%') . '_dirty.nim'
silent! exe ":w " . tmp 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()) \ a:op, tmp, expand('%:p'), line('.'), col('.')-1, s:CurrentNimFile())
else 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()) \ a:op, expand('%:p'), line('.'), col('.')-1, s:CurrentNimFile())
endif endif
if b:nim_caas_enabled if b:nim_caas_enabled
exe printf("py nimExecCmd('%s', '%s', False)", b:nim_project_root, cmd) exe printf("pyx nimExecCmd('%s', '%s', False)", b:nim_project_root, cmd)
let output = l:py_res let output = get(l:, 'py_res', '')
else else
let output = system("nim " . cmd) let output = system('nim ' . cmd)
endif endif
call add(g:nim_log, "nim " . cmd . "\n" . output) call add(g:nim_log, 'nim ' . cmd . "\n" . output)
return output return output
endf endf
fun! NimExecAsync(op, Handler) fun! NimExecAsync(op, Handler) abort
let result = NimExec(a:op) let result = NimExec(a:op)
call a:Handler(result) call a:Handler(result)
endf endf
fun! NimComplete(findstart, base) fun! NimComplete(findstart, base) abort
if b:nim_caas_enabled == 0 if b:nim_caas_enabled ==# 0
return -1 return -1
endif endif
if a:findstart if a:findstart
if synIDattr(synIDtrans(synID(line("."),col("."),1)), "name") == 'Comment' if synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name') ==# 'Comment'
return -1 return -1
endif endif
let line = getline('.') let line = getline('.')
@@ -154,10 +152,10 @@ fun! NimComplete(findstart, base)
return start return start
else else
let result = [] let result = []
let sugOut = NimExec("--suggest") let sugOut = NimExec('--suggest')
for line in split(sugOut, '\n') for line in split(sugOut, '\n')
let lineData = split(line, '\t') 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] let word = split(lineData[2], '\.')[-1]
if a:base ==? '' || word =~# '^' . a:base if a:base ==? '' || word =~# '^' . a:base
let kind = get(g:nim_symbol_types, lineData[1], '') let kind = get(g:nim_symbol_types, lineData[1], '')
@@ -170,7 +168,7 @@ fun! NimComplete(findstart, base)
endif endif
endf endf
if !exists("g:neocomplcache_omni_patterns") if !exists('g:neocomplcache_omni_patterns')
let g:neocomplcache_omni_patterns = {} let g:neocomplcache_omni_patterns = {}
endif endif
let g:neocomplcache_omni_patterns['nim'] = '[^. *\t]\.\w*' 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 = {} let g:nim_completion_callbacks = {}
fun! NimAsyncCmdComplete(cmd, output) fun! NimAsyncCmdComplete(cmd, output) abort
call add(g:nim_log, a:output) call add(g:nim_log, a:output)
echom g:nim_completion_callbacks echom g:nim_completion_callbacks
if has_key(g:nim_completion_callbacks, a:cmd) if has_key(g:nim_completion_callbacks, a:cmd)
@@ -190,52 +188,52 @@ fun! NimAsyncCmdComplete(cmd, output)
call Callback(a:output) call Callback(a:output)
" remove(g:nim_completion_callbacks, a:cmd) " remove(g:nim_completion_callbacks, a:cmd)
else else
echom "ERROR, Unknown Command: " . a:cmd echom 'ERROR, Unknown Command: ' . a:cmd
endif endif
return 1 return 1
endf endf
fun! GotoDefinition_nim_ready(def_output) fun! GotoDefinition_nim_ready(def_output) abort
if v:shell_error 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 " echoerr a:def_output
return 0 return 0
endif endif
let rawDef = matchstr(a:def_output, 'def\t\([^\n]*\)') let rawDef = matchstr(a:def_output, 'def\t\([^\n]*\)')
if rawDef == "" if rawDef == ''
echo "the current cursor position does not match any definitions" echo 'the current cursor position does not match any definitions'
return 0 return 0
endif endif
let defBits = split(rawDef, '\t') let defBits = split(rawDef, '\t')
let file = defBits[4] let file = defBits[4]
let line = defBits[5] let line = defBits[5]
exe printf("e +%d %s", line, file) exe printf('e +%d %s', line, file)
return 1 return 1
endf endf
fun! GotoDefinition_nim() fun! GotoDefinition_nim() abort
call NimExecAsync("--def", function("GotoDefinition_nim_ready")) call NimExecAsync('--def', function('GotoDefinition_nim_ready'))
endf endf
fun! FindReferences_nim() fun! FindReferences_nim() abort
setloclist() "setloclist()
endf endf
" Syntastic syntax checking " Syntastic syntax checking
fun! SyntaxCheckers_nim_nim_GetLocList() fun! SyntaxCheckers_nim_nim_GetLocList() abort
let makeprg = 'nim check --hints:off --listfullpaths ' . s:CurrentNimFile() let makeprg = 'nim check --hints:off --listfullpaths ' . s:CurrentNimFile()
let errorformat = &errorformat let errorformat = &errorformat
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endf endf
function! SyntaxCheckers_nim_nim_IsAvailable() function! SyntaxCheckers_nim_nim_IsAvailable() abort
return executable("nim") return executable('nim')
endfunction endfunction
if exists("g:SyntasticRegistry") if exists('g:SyntasticRegistry')
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'nim', \ 'filetype': 'nim',
\ 'name': 'nim'}) \ 'name': 'nim'})

View File

@@ -1,3 +1,9 @@
" Restore 'cpoptions'
let s:cpo_save = &cpo
set cpo&vim
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
let s:globs = { let s:globs = {
\ '8th': '*.8th', \ '8th': '*.8th',
\ 'Jenkinsfile': '*.jenkinsfile,*.Jenkinsfile,Jenkinsfile,Jenkinsfile*', \ 'Jenkinsfile': '*.jenkinsfile,*.Jenkinsfile,Jenkinsfile,Jenkinsfile*',
@@ -624,6 +630,13 @@ let s:globs = {
\ 'zsh': '*.zsh,.zshrc,.zshenv,.zlogin,.zprofile,.zlogout,.zlog*,.zcompdump*,.zfbfmarks,.zsh*', \ 'zsh': '*.zsh,.zshrc,.zshenv,.zlogin,.zprofile,.zlogout,.zlog*,.zcompdump*,.zfbfmarks,.zsh*',
\} \}
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE
func! polyglot#sleuth#GlobForFiletype(type) func! polyglot#sleuth#GlobForFiletype(type)
return get(s:globs, a:type, '') return get(s:globs, a:type, '')
endfunc endfunc
" Restore 'cpoptions'
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,58 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1
" Vim compiler file
" Compiler: ConTeXt typesetting engine
" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
" Last Change: 2016 Oct 21
if exists("current_compiler")
finish
endif
let s:keepcpo= &cpo
set cpo&vim
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" If makefile exists and we are not asked to ignore it, we use standard make
" (do not redefine makeprg)
if get(b:, 'context_ignore_makefile', get(g:, 'context_ignore_makefile', 0)) ||
\ (!filereadable('Makefile') && !filereadable('makefile'))
let current_compiler = 'context'
" The following assumes that the current working directory is set to the
" directory of the file to be typeset
let &l:makeprg = get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun'))
\ . ' --script context --autogenerate --nonstopmode --synctex='
\ . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0')
\ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', ''))
\ . ' ' . shellescape(expand('%:p:t'))
else
let current_compiler = 'make'
endif
let b:context_errorformat = ''
\ . '%-Popen source%.%#> %f,'
\ . '%-Qclose source%.%#> %f,'
\ . "%-Popen source%.%#name '%f',"
\ . "%-Qclose source%.%#name '%f',"
\ . '%Etex %trror%.%#mp error on line %l in file %f:%.%#,'
\ . 'tex %trror%.%#error on line %l in file %f: %m,'
\ . '%Elua %trror%.%#error on line %l in file %f:,'
\ . '%+Emetapost %#> error: %#,'
\ . '! error: %#%m,'
\ . '%-C %#,'
\ . '%C! %m,'
\ . '%Z[ctxlua]%m,'
\ . '%+C<*> %.%#,'
\ . '%-C%.%#,'
\ . '%Z...%m,'
\ . '%-Zno-error,'
\ . '%-G%.%#' " Skip remaining lines
execute 'CompilerSet errorformat=' . escape(b:context_errorformat, ' ')
let &cpo = s:keepcpo
unlet s:keepcpo
endif

View File

@@ -1,12 +1,12 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
if exists("current_compiler") if exists('current_compiler')
finish finish
endif 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> command -nargs=* CompilerSet setlocal <args>
endif endif

View File

@@ -1902,8 +1902,12 @@ When it is `v:null`, `gopls`' default will be used. By default it is `v:null`.
*'g:go_gopls_local'* *'g:go_gopls_local'*
Specifies the prefix for imports that `gopls` should consider group Specifies the prefix for imports that `gopls` should group separately.
separately.
The value can either be a string or a dictionary. When it is a string, all
workspaces will use the same value. When it is a dictionary, the key should be
the absolute path of the workspace and the value is the prefix to use for
local imports within that workspace.
When it is `v:null`, `gopls`' default will be used. By default it is `v:null`. When it is `v:null`, `gopls`' default will be used. By default it is `v:null`.
> >
@@ -1933,14 +1937,21 @@ default it is `v:null`.
< <
*'g:go_diagnostics_enabled'* *'g:go_diagnostics_enabled'*
Specifies whether `gopls` diagnostics are enabled. Only the diagnostics for Deprecated. See `'g:go_diagnostics_level'`. Specifies whether `gopls`
the current buffer will be processed when it is not set; all others will be diagnostics are enabled. Only the diagnostics for the current buffer will be
ignored. processed when it is not set; all others will be ignored. By default it is
disabled.
By default it is disabled.
> >
let g:go_diagnostics_enabled = 0 let g:go_diagnostics_enabled = 0
< <
*'g:go_diagnostics_level'*
Specifies the `gopls` diagnostics level. Valid values are 0, 1, and 2. 0
ignores `gopls` diagnostics, 1 is for errors only, and 2 is for errors and
warnings. By default it is 0.
>
let g:go_diagnostics_level = 0
<
*'g:go_template_autocreate'* *'g:go_template_autocreate'*

2257
extras/filetype.vim Normal file

File diff suppressed because it is too large Load Diff

1
filetype.vim Normal file
View File

@@ -0,0 +1 @@
runtime! ftdetect/polyglot.vim

View File

@@ -3,11 +3,6 @@
" Maintainer: Adam Stankiewicz <sheerun@sher.pl> " Maintainer: Adam Stankiewicz <sheerun@sher.pl>
" URL: https://github.com/sheerun/vim-polyglot " URL: https://github.com/sheerun/vim-polyglot
" We are not supporting non-compatible mode
if &compatible
finish
endif
" Listen very carefully, I will say this only once " Listen very carefully, I will say this only once
if exists("did_load_polyglot") if exists("did_load_polyglot")
finish finish
@@ -15,6 +10,10 @@ endif
let did_load_polyglot = 1 let did_load_polyglot = 1
" Switch to compatible mode for the time being
let s:cpo_save = &cpo
set cpo&vim
" It can happen vim filetype.vim loads first, then we need a reset " It can happen vim filetype.vim loads first, then we need a reset
if exists("did_load_filetypes") if exists("did_load_filetypes")
au! filetypedetect au! filetypedetect
@@ -23,10 +22,6 @@ endif
" Prevent filetype.vim of vim from loading again " Prevent filetype.vim of vim from loading again
let did_load_filetypes = 1 let did_load_filetypes = 1
" Line continuation is used here, remove 'C' from 'cpoptions'
let s:cpo_save = &cpo
set cpo&vim
" Be consistent across different systems " Be consistent across different systems
set nofileignorecase set nofileignorecase
@@ -117,12 +112,12 @@ func! s:StarSetf(ft)
endif endif
endfunc endfunc
" Load user-defined filetype.vim
augroup filetypedetect augroup filetypedetect
runtime! filetype.vim
augroup END
augroup filetypedetect " Load user-defined filetype.vim and oter plugins ftdetect first
" This is to use polyglot-defined ftdetect always as fallback to user settings
runtime! filetype.vim
runtime! ftdetect/*.vim
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE " DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
@@ -2634,15 +2629,11 @@ au BufEnter * if &ft == "" && expand("<afile>:e") == "" |
augroup END augroup END
if !has_key(s:disabled_packages, 'autoindent') if !has_key(s:disabled_packages, 'autoindent')
" Code below re-implements sleuth for vim-polyglot " Code below re-implements sleuth for vim-polyglot
let g:loaded_sleuth = 1 let g:loaded_sleuth = 1
" Makes shiftwidth to be synchronized with tabstop by default
if &shiftwidth == &tabstop
let &shiftwidth = 0
endif
function! s:guess(lines) abort function! s:guess(lines) abort
let options = {} let options = {}
let ccomment = 0 let ccomment = 0
@@ -2731,7 +2722,7 @@ if !has_key(s:disabled_packages, 'autoindent')
return 1 return 1
elseif line[0] == " " elseif line[0] == " "
let indent = len(matchstr(line, '^ *')) let indent = len(matchstr(line, '^ *'))
if (indent % 2 == 0 || indent % 3 == 0) && indent < minindent if indent < minindent && index([2, 3, 4, 8], indent) >= 0
let minindent = indent let minindent = indent
endif endif
endif endif
@@ -2740,6 +2731,7 @@ if !has_key(s:disabled_packages, 'autoindent')
if minindent < 10 if minindent < 10
setlocal expandtab setlocal expandtab
let &l:shiftwidth=minindent let &l:shiftwidth=minindent
let &l:tabstop=minindent
let b:sleuth_culprit .= ':' . i let b:sleuth_culprit .= ':' . i
return 1 return 1
endif endif
@@ -2752,6 +2744,16 @@ if !has_key(s:disabled_packages, 'autoindent')
return return
endif endif
if &expandtab
" Make tabstop to be synchronized with shiftwidth by default
" Some plugins are using &shiftwidth directly or accessing &tabstop
if &tabstop != 8 || &shiftwidth == 0
let &shiftwidth = &tabstop
else
let &tabstop = &shiftwidth
endif
endif
let b:sleuth_culprit = expand("<afile>:p") let b:sleuth_culprit = expand("<afile>:p")
if s:guess(getline(1, 32)) if s:guess(getline(1, 32))
return return
@@ -2793,7 +2795,7 @@ if !has_key(s:disabled_packages, 'autoindent')
unlet b:sleuth_culprit unlet b:sleuth_culprit
endfunction endfunction
setglobal smarttab set smarttab
function! SleuthIndicator() abort function! SleuthIndicator() abort
let sw = &shiftwidth ? &shiftwidth : &tabstop let sw = &shiftwidth ? &shiftwidth : &tabstop
@@ -2808,7 +2810,7 @@ if !has_key(s:disabled_packages, 'autoindent')
augroup polyglot-sleuth augroup polyglot-sleuth
au! au!
au FileType * call s:detect_indent() au BufEnter * call s:detect_indent()
au User Flags call Hoist('buffer', 5, 'SleuthIndicator') au User Flags call Hoist('buffer', 5, 'SleuthIndicator')
augroup END augroup END
@@ -3421,15 +3423,18 @@ au BufNewFile,BufRead *.txt
\| setf text \| setf text
\| endif \| endif
" Use the filetype detect plugins. They may overrule any of the previously
" detected filetypes.
runtime! ftdetect/*.vim
" NOTE: The above command could have ended the filetypedetect autocmd group " NOTE: The above command could have ended the filetypedetect autocmd group
" and started another one. Let's make sure it has ended to get to a consistent " and started another one. Let's make sure it has ended to get to a consistent
" state. " state.
augroup END augroup END
" Use the filetype detect plugins. They may overrule any of the previously
" detected filetypes.
if exists("did_load_filetypes") && exists("g:polyglot_disabled")
unlet did_load_filetypes
runtime! extras/filetype.vim
endif
" Restore 'cpoptions' " Restore 'cpoptions'
let &cpo = s:cpo_save let &cpo = s:cpo_save

View File

@@ -1,106 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1
" Vim filetype plugin file
" Language: ConTeXt typesetting engine
" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
" Former Maintainers: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2016 Oct 30
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
if !exists('current_compiler')
compiler context
endif
let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<"
\ . "| unlet! b:match_ignorecase b:match_words b:match_skip"
setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tjcroql2
if get(b:, 'context_metapost', get(g:, 'context_metapost', 1))
setlocal omnifunc=contextcomplete#Complete
let g:omni_syntax_group_include_context = 'mf\w\+,mp\w\+'
let g:omni_syntax_group_exclude_context = 'mfTodoComment'
endif
let &l:define='\\\%([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\='
\ . 'def\|\\font\|\\\%(future\)\=let'
\ . '\|\\new\%(count\|dimen\|skip\|muskip\|box\|toks\|read\|write'
\ . '\|fam\|insert\|if\)'
let &l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)'
setlocal suffixesadd=.tex
if exists("loaded_matchit")
let b:match_ignorecase = 0
let b:match_skip = 'r:\\\@<!\%(\\\\\)*%'
let b:match_words = '(:),\[:],{:},\\(:\\),\\\[:\\],' .
\ '\\start\(\a\+\):\\stop\1'
endif
let s:context_regex = {
\ 'beginsection' : '\\\%(start\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>',
\ 'endsection' : '\\\%(stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>',
\ 'beginblock' : '\\\%(start\|setup\|define\)',
\ 'endblock' : '\\\%(stop\|setup\|define\)'
\ }
function! s:move_around(count, what, flags, visual)
if a:visual
exe "normal! gv"
endif
call search(s:context_regex[a:what], a:flags.'s') " 's' sets previous context mark
call map(range(2, a:count), 'search(s:context_regex[a:what], a:flags)')
endfunction
" Move around macros.
nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR>
vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR>
nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR>
vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR>
nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR>
vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR>
nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR>
vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR>
nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR>
vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR>
nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR>
vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR>
" Other useful mappings
if get(g:, 'context_mappings', 1)
let s:tp_regex = '?^$\|^\s*\\\(item\|start\|stop\|blank\|\%(sub\)*section\|chapter\|\%(sub\)*subject\|title\|part\)'
fun! s:tp()
call cursor(search(s:tp_regex, 'bcW') + 1, 1)
normal! V
call cursor(search(s:tp_regex, 'W') - 1, 1)
endf
" Reflow paragraphs with commands like gqtp ("gq TeX paragraph")
onoremap <silent><buffer> tp :<c-u>call <sid>tp()<cr>
" Select TeX paragraph
vnoremap <silent><buffer> tp <esc>:<c-u>call <sid>tp()<cr>
" $...$ text object
onoremap <silent><buffer> i$ :<c-u>normal! T$vt$<cr>
onoremap <silent><buffer> a$ :<c-u>normal! F$vf$<cr>
vnoremap <buffer> i$ T$ot$
vnoremap <buffer> a$ F$of$
endif
" Commands for asynchronous typesetting
command! -buffer -nargs=? -complete=file ConTeXt call context#typeset(<q-args>)
command! -nargs=0 ConTeXtJobStatus call context#job_status()
command! -nargs=0 ConTeXtStopJobs call context#stop_jobs()
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -1,254 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'man') == -1
" Vim filetype plugin file
" Language: man
" Maintainer: Jason Franklin <vim@justemail.net>
" Maintainer: SungHyun Nam <goweol@gmail.com>
" Last Change: 2020 Jun 01
" To make the ":Man" command available before editing a manual page, source
" this script from your startup vimrc file.
" If 'filetype' isn't "man", we must have been called to only define ":Man".
if &filetype == "man"
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
endif
let s:cpo_save = &cpo
set cpo-=C
if &filetype == "man"
" allow dot and dash in manual page name.
setlocal iskeyword+=\.,-
let b:undo_ftplugin = "setlocal iskeyword<"
" Add mappings, unless the user didn't want this.
if !exists("no_plugin_maps") && !exists("no_man_maps")
if !hasmapto('<Plug>ManBS')
nmap <buffer> <LocalLeader>h <Plug>ManBS
let b:undo_ftplugin = b:undo_ftplugin
\ . '|silent! nunmap <buffer> <LocalLeader>h'
endif
nnoremap <buffer> <Plug>ManBS :%s/.\b//g<CR>:setl nomod<CR>''
nnoremap <buffer> <silent> <c-]> :call <SID>PreGetPage(v:count)<CR>
nnoremap <buffer> <silent> <c-t> :call <SID>PopPage()<CR>
nnoremap <buffer> <silent> q :q<CR>
" Add undo commands for the maps
let b:undo_ftplugin = b:undo_ftplugin
\ . '|silent! nunmap <buffer> <Plug>ManBS'
\ . '|silent! nunmap <buffer> <c-]>'
\ . '|silent! nunmap <buffer> <c-t>'
\ . '|silent! nunmap <buffer> q'
endif
if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1)
setlocal foldmethod=indent foldnestmax=1 foldenable
let b:undo_ftplugin = b:undo_ftplugin
\ . '|silent! setl fdm< fdn< fen<'
endif
endif
if exists(":Man") != 2
com -nargs=+ -complete=shellcmd Man call s:GetPage(<q-mods>, <f-args>)
nmap <Leader>K :call <SID>PreGetPage(0)<CR>
nmap <Plug>ManPreGetPage :call <SID>PreGetPage(0)<CR>
endif
" Define functions only once.
if !exists("s:man_tag_depth")
let s:man_tag_depth = 0
let s:man_sect_arg = ""
let s:man_find_arg = "-w"
try
if !has("win32") && $OSTYPE !~ 'cygwin\|linux' && system('uname -s') =~ "SunOS" && system('uname -r') =~ "^5"
let s:man_sect_arg = "-s"
let s:man_find_arg = "-l"
endif
catch /E145:/
" Ignore the error in restricted mode
endtry
func <SID>PreGetPage(cnt)
if a:cnt == 0
let old_isk = &iskeyword
if &ft == 'man'
setl iskeyword+=(,)
endif
let str = expand("<cword>")
let &l:iskeyword = old_isk
let page = substitute(str, '(*\(\k\+\).*', '\1', '')
let sect = substitute(str, '\(\k\+\)(\([^()]*\)).*', '\2', '')
if match(sect, '^[0-9 ]\+$') == -1
let sect = ""
endif
if sect == page
let sect = ""
endif
else
let sect = a:cnt
let page = expand("<cword>")
endif
call s:GetPage('', sect, page)
endfunc
func <SID>GetCmdArg(sect, page)
if a:sect == ''
return a:page
endif
return s:man_sect_arg.' '.a:sect.' '.a:page
endfunc
func <SID>FindPage(sect, page)
let where = system("man ".s:man_find_arg.' '.s:GetCmdArg(a:sect, a:page))
if where !~ "^/"
if matchstr(where, " [^ ]*$") !~ "^ /"
return 0
endif
endif
return 1
endfunc
func <SID>GetPage(cmdmods, ...)
if a:0 >= 2
let sect = a:1
let page = a:2
elseif a:0 >= 1
let sect = ""
let page = a:1
else
return
endif
" To support: nmap K :Man <cword>
if page == '<cword>'
let page = expand('<cword>')
endif
if !exists('g:ft_man_no_sect_fallback') || (g:ft_man_no_sect_fallback == 0)
if sect != "" && s:FindPage(sect, page) == 0
let sect = ""
endif
endif
if s:FindPage(sect, page) == 0
let msg = 'man.vim: no manual entry for "' . page . '"'
if !empty(sect)
let msg .= ' in section ' . sect
endif
echomsg msg
return
endif
exec "let s:man_tag_buf_".s:man_tag_depth." = ".bufnr("%")
exec "let s:man_tag_lin_".s:man_tag_depth." = ".line(".")
exec "let s:man_tag_col_".s:man_tag_depth." = ".col(".")
let s:man_tag_depth = s:man_tag_depth + 1
let open_cmd = 'edit'
" Use an existing "man" window if it exists, otherwise open a new one.
if &filetype != "man"
let thiswin = winnr()
exe "norm! \<C-W>b"
if winnr() > 1
exe "norm! " . thiswin . "\<C-W>w"
while 1
if &filetype == "man"
break
endif
exe "norm! \<C-W>w"
if thiswin == winnr()
break
endif
endwhile
endif
if &filetype != "man"
if exists("g:ft_man_open_mode")
if g:ft_man_open_mode == 'vert'
let open_cmd = 'vsplit'
elseif g:ft_man_open_mode == 'tab'
let open_cmd = 'tabedit'
else
let open_cmd = 'split'
endif
else
let open_cmd = a:cmdmods . ' split'
endif
endif
endif
silent execute open_cmd . " $HOME/" . page . '.' . sect . '~'
" Avoid warning for editing the dummy file twice
setl buftype=nofile noswapfile
setl fdc=0 ma nofen nonu nornu
%delete _
let unsetwidth = 0
if empty($MANWIDTH)
let $MANWIDTH = winwidth(0)
let unsetwidth = 1
endif
" Ensure Vim is not recursively invoked (man-db does this) when doing ctrl-[
" on a man page reference by unsetting MANPAGER.
" Some versions of env(1) do not support the '-u' option, and in such case
" we set MANPAGER=cat.
if !exists('s:env_has_u')
call system('env -u x true')
let s:env_has_u = (v:shell_error == 0)
endif
let env_cmd = s:env_has_u ? 'env -u MANPAGER' : 'env MANPAGER=cat'
let env_cmd .= ' GROFF_NO_SGR=1'
let man_cmd = env_cmd . ' man ' . s:GetCmdArg(sect, page) . ' | col -b'
silent exec "r !" . man_cmd
if unsetwidth
let $MANWIDTH = ''
endif
" Remove blank lines from top and bottom.
while line('$') > 1 && getline(1) =~ '^\s*$'
1delete _
endwhile
while line('$') > 1 && getline('$') =~ '^\s*$'
$delete _
endwhile
1
setl ft=man nomod
setl bufhidden=hide
setl nobuflisted
setl noma
endfunc
func <SID>PopPage()
if s:man_tag_depth > 0
let s:man_tag_depth = s:man_tag_depth - 1
exec "let s:man_tag_buf=s:man_tag_buf_".s:man_tag_depth
exec "let s:man_tag_lin=s:man_tag_lin_".s:man_tag_depth
exec "let s:man_tag_col=s:man_tag_col_".s:man_tag_depth
exec s:man_tag_buf."b"
exec s:man_tag_lin
exec "norm! ".s:man_tag_col."|"
exec "unlet s:man_tag_buf_".s:man_tag_depth
exec "unlet s:man_tag_lin_".s:man_tag_depth
exec "unlet s:man_tag_col_".s:man_tag_depth
unlet s:man_tag_buf s:man_tag_lin s:man_tag_col
endif
endfunc
endif
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: set sw=2 ts=8 noet:
endif

View File

@@ -1,40 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1
" ConTeXt indent file
" Language: ConTeXt typesetting engine
" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
" Last Change: 2016 Oct 15
if exists("b:did_indent")
finish
endif
if !get(b:, 'context_metapost', get(g:, 'context_metapost', 1))
finish
endif
" Load MetaPost indentation script
runtime! indent/mp.vim
let s:keepcpo= &cpo
set cpo&vim
setlocal indentexpr=GetConTeXtIndent()
let b:undo_indent = "setl indentexpr<"
function! GetConTeXtIndent()
" Use MetaPost rules inside MetaPost graphic environments
if len(synstack(v:lnum, 1)) > 0 &&
\ synIDattr(synstack(v:lnum, 1)[0], "name") ==# 'contextMPGraphic'
return GetMetaPostIndent()
endif
return -1
endfunc
let &cpo = s:keepcpo
unlet s:keepcpo
" vim:sw=2
endif

View File

@@ -1,7 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
" Only load this indent file when no other was loaded. " Only load this indent file when no other was loaded.
if exists("b:did_indent") if exists('b:did_indent')
finish finish
endif endif
let b:did_indent = 1 let b:did_indent = 1
@@ -14,7 +14,7 @@ setlocal indentexpr=GetNimIndent(v:lnum)
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif
" Only define the function once. " Only define the function once.
if exists("*GetNimIndent") if exists('*GetNimIndent')
finish finish
endif endif
@@ -40,7 +40,7 @@ function! GetNimIndent(lnum)
endif endif
" If the start of the line is in a string don't change the indent. " 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 return -1
endif endif
@@ -56,12 +56,12 @@ function! GetNimIndent(lnum)
" If the last character in the line is a comment, do a binary search for " 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 " the start of the comment. synID() is slow, a linear search would take
" too long on a long line. " 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 min = 1
let max = pline_len let max = pline_len
while min < max while min < max
let col = (min + max) / 2 let col = (min + max) / 2
if synIDattr(synID(plnum, col, 1), "name") =~ "Comment$" if synIDattr(synID(plnum, col, 1), 'name') =~# 'Comment$'
let max = col let max = col
else else
let min = col + 1 let min = col + 1
@@ -80,16 +80,16 @@ function! GetNimIndent(lnum)
endwhile endwhile
endif endif
if cline =~ '^\s*\(if\|when\|for\|while\|case\|of\|try\)\>' if cline =~# '^\s*\(if\|when\|for\|while\|case\|of\|try\)\>'
" This is a benign line, do nothing " This is a benign line, do nothing
return -1 return -1
endif endif
" If the current line begins with a keyword that lines up with "try" " If the current line begins with a keyword that lines up with "try"
if cline =~ '^\s*\(except\|finally\)\>' if cline =~# '^\s*\(except\|finally\)\>'
let lnum = a:lnum - 1 let lnum = a:lnum - 1
while lnum >= 1 while lnum >= 1
if getline(lnum) =~ '^\s*\(try\|except\)\>' if getline(lnum) =~# '^\s*\(try\|except\)\>'
let ind = indent(lnum) let ind = indent(lnum)
if ind >= clindent if ind >= clindent
return -1 " indent is already less than this return -1 " indent is already less than this
@@ -102,31 +102,31 @@ function! GetNimIndent(lnum)
endif endif
" If the current line begins with a header keyword, dedent " If the current line begins with a header keyword, dedent
if cline =~ '^\s*\(elif\|else\)\>' if cline =~# '^\s*\(elif\|else\)\>'
return s:FindStartLine(a:lnum, '^\s*\(if\|when\|elif\|of\)') return s:FindStartLine(a:lnum, '^\s*\(if\|when\|elif\|of\)')
endif endif
if pline =~ ':\s*$' if pline =~# ':\s*$'
"return s:FindStartLine(plnum, '(^\s*\(if\|when\|else\|elif\|case\|of\|try\|except\|finally\)\>)\|\<do\>') + &sw "return s:FindStartLine(plnum, '(^\s*\(if\|when\|else\|elif\|case\|of\|try\|except\|finally\)\>)\|\<do\>') + &sw
return s:FindStartLine(plnum, '^\s*\(if\|when\|else\|elif\|for\|while\|case\|of\|try\|except\|finally\)\>') + &sw return s:FindStartLine(plnum, '^\s*\(if\|when\|else\|elif\|for\|while\|case\|of\|try\|except\|finally\)\>') + &sw
endif endif
if pline =~ '=\s*$' if pline =~# '=\s*$'
return s:FindStartLine(plnum, '^\s*\(proc\|template\|macro\|iterator\)\>') + &sw return s:FindStartLine(plnum, '^\s*\(proc\|template\|macro\|iterator\)\>') + &sw
endif endif
" if we got here, this should be the begging of a multi-line if expression for example " if we got here, this should be the begging of a multi-line if expression for example
if pline =~ '^\s*\(if\|when\|proc\|iterator\|macro\|template\|for\|while\)[^:]*$' if pline =~# '^\s*\(if\|when\|proc\|iterator\|macro\|template\|for\|while\)[^:]*$'
return plindent + &sw return plindent + &sw
endif endif
if pline =~ '\(type\|import\|const\|var\|let\)\s*$' if pline =~# '\(type\|import\|const\|var\|let\)\s*$'
\ || pline =~ '=\s*\(object\|enum\|tuple\|concept\)' \ || pline =~# '=\s*\(object\|enum\|tuple\|concept\)'
return plindent + &sw return plindent + &sw
endif endif
" If the previous line was a stop-execution statement... " If the previous line was a stop-execution statement...
if pline =~ '^\s*\(break\|continue\|raise\|return\)\>' if pline =~# '^\s*\(break\|continue\|raise\|return\)\>'
" See if the user has already dedented " See if the user has already dedented
if indent(a:lnum) > plindent - &sw if indent(a:lnum) > plindent - &sw
" If not, recommend one dedent " If not, recommend one dedent

View File

@@ -5509,8 +5509,6 @@ filetypes:
- pattern: "XF86Config-4*,XF86Config*,*/xorg.conf.d/*.conf,xorg.conf,xorg.conf-4" - pattern: "XF86Config-4*,XF86Config*,*/xorg.conf.d/*.conf,xorg.conf,xorg.conf-4"
--- ---
name: man name: man
remote: vim/vim:runtime
glob: "**/man.vim"
filetypes: filetypes:
- name: man - name: man
linguist: Roff Manpage linguist: Roff Manpage
@@ -5532,8 +5530,6 @@ filetypes:
description: X PixMap 2 description: X PixMap 2
--- ---
name: context name: context
remote: vim/vim:runtime
glob: "**/context.vim"
filetypes: filetypes:
- name: context - name: context
patterns: patterns:

View File

@@ -1,3 +1,137 @@
if !exists("did_load_polyglot") " Turn on filetype plugins (:help filetype-plugin).
runtime! ftdetect/polyglot.vim if has('autocmd') && !(exists("did_load_filetypes") && exists("did_indent_on"))
filetype plugin indent on
endif
" Enable syntax highlighting.
if has('syntax') && !exists('g:syntax_on')
syntax enable
endif
" No need to duplicate work
if exists('g:loaded_sensible')
finish
endif
" Code taken from https://github.com/tpope/vim-sensible
" and (mostly comments) from https://github.com/sheerun/vimrc
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sensible')
" Autoindent when starting new line, or using `o` or `O`.
set autoindent
" Allow backspace in insert mode.
set backspace=indent,eol,start
" Don't scan included files. The .tags file is more performant.
set complete-=i
" Use 'shiftwidth' when using `<Tab>` in front of a line.
" By default it's used only for shift commands (`<`, `>`).
set smarttab
" Disable octal format for number processing.
set nrformats-=octal
" Allow for mappings including `Esc`, while preserving
" zero timeout after pressing it manually.
" (only vim needs a fix for this)
if !has('nvim') && &ttimeoutlen == -1
set ttimeout
set ttimeoutlen=100
endif
" Enable highlighted case-insensitive incremential search.
set incsearch
" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
endif
" Always show window statuses, even if there's only one.
set laststatus=2
" Show the line and column number of the cursor position.
set ruler
" Autocomplete commands using nice menu in place of window status.
" Enable `Ctrl-N` and `Ctrl-P` to scroll through matches.
set wildmenu
" Keep 5 columns next to the cursor when scrolling horizontally.
if !&scrolloff
set scrolloff=1
endif
if !&sidescrolloff
set sidescrolloff=5
endif
" When 'wrap' is on, display last line even if it doesn't fit.
set display+=lastline
" Force utf-8 encoding
set encoding=utf-8
" Set default whitespace characters when using `:set list`
if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
endif
" Delete comment character when joining commented lines
if v:version > 703 || v:version == 703 && has("patch541")
set formatoptions+=j
endif
" Search upwards for tags file instead only locally
if has('path_extra')
setglobal tags-=./tags tags-=./tags; tags^=./tags;
endif
" Fix issues with fish shell
" https://github.com/tpope/vim-sensible/issues/50
if &shell =~# 'fish$' && (v:version < 704 || v:version == 704 && !has('patch276'))
set shell=/usr/bin/env\ bash
endif
" Reload unchanged files automatically.
set autoread
" Increase history size to 1000 items.
if &history < 1000
set history=1000
endif
" Allow for up to 50 opened tabs on Vim start.
if &tabpagemax < 50
set tabpagemax=50
endif
" Always save upper case variables to viminfo file.
if !empty(&viminfo)
set viminfo^=!
endif
" Don't save options in sessions and views
set sessionoptions-=options
set viewoptions-=options
" Allow color schemes to do bright colors without forcing bold.
if &t_Co == 8 && $TERM !~# '^Eterm'
set t_Co=16
endif
" Load matchit.vim, but only if the user hasn't installed a newer version.
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
" `Ctrl-U` in insert mode deletes a lot. Use `Ctrl-G` u to first break undo,
" so that you can undo `Ctrl-U` without undoing what you typed before it.
if empty(mapcheck('<C-U>', 'i'))
inoremap <C-U> <C-G>u<C-U>
endif
if empty(mapcheck('<C-W>', 'i'))
inoremap <C-W> <C-G>u<C-W>
endif
endif endif

View File

@@ -128,6 +128,10 @@ def load_data()
for package in packages for package in packages
for filetype in package["filetypes"] for filetype in package["filetypes"]
if ["context", "man"].include?(filetype["name"]) && package["remote"]
puts "context and man packages caused issues in past, are you sure?"
exit 1
end
if filetype["patterns"] if filetype["patterns"]
for pattern in filetype["patterns"] for pattern in filetype["patterns"]
for p in comma_expanson(pattern["pattern"]) for p in comma_expanson(pattern["pattern"])
@@ -257,9 +261,8 @@ def parse_remote(remote)
[match[:repo], match[:branch] || "master", match[:path], dir] [match[:repo], match[:branch] || "master", match[:path], dir]
end end
def copy_file(package, src, dest) def copy_file(name, src, dest)
FileUtils.mkdir_p(File.dirname(dest)) FileUtils.mkdir_p(File.dirname(dest))
name = package.fetch("name")
if dest.end_with?(".vim") if dest.end_with?(".vim")
header = '" Polyglot metafile' header = '" Polyglot metafile'
@@ -509,11 +512,11 @@ def extract(packages)
globs.each do |glob| globs.each do |glob|
Dir.glob("#{subdir}/#{glob}", base: subtree).each do |p| Dir.glob("#{subdir}/#{glob}", base: subtree).each do |p|
next unless File.file?("#{subtree}#{p}") next unless File.file?("#{subtree}#{p}")
copy_file(package, "#{subtree}#{p}", p) copy_file(package["name"], "#{subtree}#{p}", p)
end end
end end
elsif File.exist?(subpath) elsif File.exist?(subpath)
copy_file(package, subpath, subdir) copy_file(package["name"], subpath, subdir)
end end
end end
@@ -845,15 +848,7 @@ def generate_plugins(packages)
end end
output << " \\}\n\n" output << " \\}\n\n"
inject_code('autoload/polyglot/sleuth.vim', output)
output << <<~EOS
func! polyglot#sleuth#GlobForFiletype(type)
return get(s:globs, a:type, '')
endfunc
EOS
File.write('autoload/polyglot/sleuth.vim', output)
end end
def process_list(list, extras) def process_list(list, extras)
@@ -889,6 +884,19 @@ def show_warnings(all_filetypes, expected_filetypes)
end end
end end
def generate_fallback
filetype_content = File.read('tmp/vim/vim/runtime/filetype.vim')
filetype_content.gsub!('runtime! ftdetect/*.vim', '')
filetype_content.gsub!(/^au BufNewFile,BufRead \*\n.+?runtime!.+?endif/m) {}
filetype_content.gsub!(/^au StdinReadPost \* .+?runtime!.+?endif/m) {}
filetype_content.gsub!(/^au filetypedetect BufNewFile,BufRead,StdinReadPost \*\n.+?endif/m) {}
File.write('extras/filetype.vim', filetype_content)
autoload_content = File.read('tmp/vim/vim/runtime/autoload/dist/ft.vim')
autoload_content.gsub!('dist#ft#', 'polyglot#ft#')
File.write('autoload/polyglot/ft.vim', autoload_content)
end
if __FILE__ == $0 if __FILE__ == $0
if !ENV["DEV"] if !ENV["DEV"]
@@ -900,6 +908,7 @@ if __FILE__ == $0
packages, heuristics = load_data() packages, heuristics = load_data()
download(packages) download(packages)
extract(packages) extract(packages)
generate_fallback()
generate_ftdetect(packages, heuristics) generate_ftdetect(packages, heuristics)
generate_plugins(packages) generate_plugins(packages)
generate_tests(packages) generate_tests(packages)

View File

@@ -7,7 +7,6 @@ def run_script(src)
end end
def run_vimscript(src) def run_vimscript(src)
wrapper = <<~EOF wrapper = <<~EOF
vim --clean --not-a-term -u <(cat <<- "EOM" vim --clean --not-a-term -u <(cat <<- "EOM"
set nocompatible set nocompatible

View File

@@ -1,145 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'context') == -1
" Vim syntax file
" Language: ConTeXt typesetting engine
" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
" Former Maintainers: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2016 Oct 16
if exists("b:current_syntax")
finish
endif
runtime! syntax/plaintex.vim
unlet b:current_syntax
let s:cpo_save = &cpo
set cpo&vim
" Dictionary of (filetype, group) pairs to highlight between \startGROUP \stopGROUP.
let s:context_include = get(b:, 'context_include', get(g:, 'context_include', {'xml': 'XML'}))
" For backward compatibility (g:context_include used to be a List)
if type(s:context_include) ==# type([])
let g:context_metapost = (index(s:context_include, 'mp') != -1)
let s:context_include = filter(
\ {'c': 'C', 'javascript': 'JS', 'ruby': 'Ruby', 'xml': 'XML'},
\ { k,_ -> index(s:context_include, k) != -1 }
\ )
endif
syn iskeyword @,48-57,a-z,A-Z,192-255
syn spell toplevel
" ConTeXt options, i.e., [...] blocks
syn region contextOptions matchgroup=contextDelimiter start='\[' end=']\|\ze\\stop' skip='\\\[\|\\\]' contains=ALLBUT,contextBeginEndLua,@Spell
" Highlight braces
syn match contextDelimiter '[{}]'
" Comments
syn match contextComment '\\\@<!\%(\\\\\)*\zs%.*$' display contains=initexTodo
syn match contextComment '^\s*%[CDM].*$' display contains=initexTodo
syn match contextBlockDelim '\\\%(start\|stop\)\a\+' contains=@NoSpell
syn region contextEscaped matchgroup=contextPreProc start='\\type\%(\s*\|\n\)*\z([^A-Za-z%]\)' end='\z1'
syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s\|\n\)*{' end='}'
syn region contextEscaped matchgroup=contextPreProc start='\\type\=\%(\s*\|\n\)*<<' end='>>'
syn region contextEscaped matchgroup=contextPreProc
\ start='\\start\z(\a*\%(typing\|typen\)\)'
\ end='\\stop\z1' contains=plaintexComment keepend
syn region contextEscaped matchgroup=contextPreProc start='\\\h\+Type\%(\s\|\n\)*{' end='}'
syn region contextEscaped matchgroup=contextPreProc start='\\Typed\h\+\%(\s\|\n\)*{' end='}'
syn match contextBuiltin display contains=@NoSpell
\ '\\\%(unprotect\|protect\|unexpanded\)\>'
syn match contextPreProc '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\)\>'
\ contains=@NoSpell
if get(b:, 'context_metapost', get(g:, 'context_metapost', 1))
let b:mp_metafun_macros = 1 " Highlight MetaFun keywords
syn include @mpTop syntax/mp.vim
unlet b:current_syntax
syn region contextMPGraphic matchgroup=contextBlockDelim
\ start='\\start\z(MP\%(clip\|code\|definitions\|drawing\|environment\|extensions\|inclusions\|initializations\|page\|\)\)\>.*$'
\ end='\\stop\z1'
\ contains=@mpTop,@NoSpell
syn region contextMPGraphic matchgroup=contextBlockDelim
\ start='\\start\z(\%(\%[re]usable\|use\|unique\|static\)MPgraphic\|staticMPfigure\|uniqueMPpagegraphic\)\>.*$'
\ end='\\stop\z1'
\ contains=@mpTop,@NoSpell
endif
if get(b:, 'context_lua', get(g:, 'context_lua', 1))
syn include @luaTop syntax/lua.vim
unlet b:current_syntax
syn region contextLuaCode matchgroup=contextBlockDelim
\ start='\\startluacode\>'
\ end='\\stopluacode\>' keepend
\ contains=@luaTop,@NoSpell
syn match contextDirectLua "\\\%(directlua\|ctxlua\)\>\%(\s*%.*$\)\="
\ nextgroup=contextBeginEndLua skipwhite skipempty
\ contains=initexComment
syn region contextBeginEndLua matchgroup=contextSpecial
\ start="{" end="}" skip="\\[{}]"
\ contained contains=@luaTop,@NoSpell
endif
for synname in keys(s:context_include)
execute 'syn include @' . synname . 'Top' 'syntax/' . synname . '.vim'
unlet b:current_syntax
execute 'syn region context' . s:context_include[synname] . 'Code'
\ 'matchgroup=contextBlockDelim'
\ 'start=+\\start' . s:context_include[synname] . '+'
\ 'end=+\\stop' . s:context_include[synname] . '+'
\ 'contains=@' . synname . 'Top,@NoSpell'
endfor
syn match contextSectioning '\\\%(start\|stop\)\=\%(\%(sub\)*section\|\%(sub\)*subject\|chapter\|part\|component\|product\|title\)\>'
\ contains=@NoSpell
syn match contextSpecial '\\crlf\>\|\\par\>\|-\{2,3}\||[<>/]\=|'
\ contains=@NoSpell
syn match contextSpecial /\\[`'"]/
syn match contextSpecial +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+
\ contains=@NoSpell
syn match contextSpecial '\^\^.'
syn match contextSpecial '`\%(\\.\|\^\^.\|.\)'
syn match contextStyle '\\\%(em\|ss\|hw\|cg\|mf\)\>'
\ contains=@NoSpell
syn match contextFont '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>'
\ contains=@NoSpell
syn match contextFont '\\\%(Word\|WORD\|Words\|WORDS\)\>'
\ contains=@NoSpell
syn match contextFont '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>'
\ contains=@NoSpell
syn match contextFont '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>'
\ contains=@NoSpell
hi def link contextOptions Typedef
hi def link contextComment Comment
hi def link contextBlockDelim Keyword
hi def link contextBuiltin Keyword
hi def link contextDelimiter Delimiter
hi def link contextEscaped String
hi def link contextPreProc PreProc
hi def link contextSectioning PreProc
hi def link contextSpecial Special
hi def link contextType Type
hi def link contextStyle contextType
hi def link contextFont contextType
hi def link contextDirectLua Keyword
let b:current_syntax = "context"
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -1,60 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'man') == -1
" Vim syntax file
" Language: Man page
" Maintainer: Jason Franklin <vim@justemail.net>
" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
" Previous Maintainer: Gautam H. Mudunuri <gmudunur@informatica.com>
" Version Info:
" Last Change: 2020 Sep 19
" Additional highlighting by Johannes Tanzler <johannes.tanzler@aon.at>:
" * manSubHeading
" * manSynopsis (only for sections 2 and 3)
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" Get the CTRL-H syntax to handle backspaced text
runtime! syntax/ctrlh.vim
syn case ignore
syn match manReference "\f\+([1-9][a-z]\=)"
syn match manSectionHeading "^\a.*$"
syn match manSubHeading "^\s\{3\}\a.*$"
syn match manOptionDesc "^\s*[+-][a-z0-9]\S*"
syn match manLongOptionDesc "^\s*--[a-z0-9-]\S*"
" syn match manHistory "^[a-z].*last change.*$"
syn match manHeader '\%1l.*'
exe 'syn match manFooter ''\%' . line('$') . 'l.*'''
if getline(1) =~ '^[a-zA-Z_]\+([23])'
syntax include @cCode <sfile>:p:h/c.vim
syn match manCFuncDefinition display "\<\h\w*\>\s*("me=e-1 contained
syn region manSynopsis start="^SYNOPSIS"hs=s+8 end="^\u\+\s*$"me=e-12 keepend contains=manSectionHeading,@cCode,manCFuncDefinition
endif
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
hi def link manHeader Title
hi def link manFooter PreProc
hi def link manSectionHeading Statement
hi def link manOptionDesc Constant
hi def link manLongOptionDesc Constant
hi def link manReference PreProc
hi def link manSubHeading Function
hi def link manCFuncDefinition Function
let b:current_syntax = "man"
" vim:ts=8 sts=2 sw=2:
endif

View File

@@ -2,30 +2,30 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
" For version 5.x: Clear all syntax items " For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded " For version 6.x: Quit when a syntax file was already loaded
if version < 600 if v:version < 600
syntax clear syntax clear
elseif exists("b:current_syntax") elseif exists('b:current_syntax')
finish finish
endif endif
" Keep user-supplied options " Keep user-supplied options
if !exists("nim_highlight_numbers") if !exists('nim_highlight_numbers')
let nim_highlight_numbers = 1 let nim_highlight_numbers = 1
endif endif
if !exists("nim_highlight_builtins") if !exists('nim_highlight_builtins')
let nim_highlight_builtins = 1 let nim_highlight_builtins = 1
endif endif
if !exists("nim_highlight_exceptions") if !exists('nim_highlight_exceptions')
let nim_highlight_exceptions = 1 let nim_highlight_exceptions = 1
endif endif
if !exists("nim_highlight_space_errors") if !exists('nim_highlight_space_errors')
let nim_highlight_space_errors = 1 let nim_highlight_space_errors = 1
endif endif
if !exists("nim_highlight_special_vars") if !exists('nim_highlight_special_vars')
let nim_highlight_special_vars = 1 let nim_highlight_special_vars = 1
endif endif
if exists("nim_highlight_all") if exists('nim_highlight_all')
let nim_highlight_numbers = 1 let nim_highlight_numbers = 1
let nim_highlight_builtins = 1 let nim_highlight_builtins = 1
let nim_highlight_exceptions = 1 let nim_highlight_exceptions = 1
@@ -158,8 +158,8 @@ syn sync match nimSync grouphere NONE "):$"
syn sync maxlines=200 syn sync maxlines=200
syn sync minlines=2000 syn sync minlines=2000
if version >= 508 || !exists("did_nim_syn_inits") if v:version >= 508 || !exists('did_nim_syn_inits')
if version <= 508 if v:version <= 508
let did_nim_syn_inits = 1 let did_nim_syn_inits = 1
command -nargs=+ HiLink hi link <args> command -nargs=+ HiLink hi link <args>
else else
@@ -202,7 +202,7 @@ if version >= 508 || !exists("did_nim_syn_inits")
delcommand HiLink delcommand HiLink
endif endif
let b:current_syntax = "nim" let b:current_syntax = 'nim'
endif endif