aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorb-r-o-c-k <brockmammen@gmail.com>2018-04-14 14:17:51 -0500
committerb-r-o-c-k <brockmammen@gmail.com>2018-04-14 14:17:51 -0500
commitad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f (patch)
tree92de2079e80f5f289dd87a54af123cb7d90c3058 /runtime/autoload
parent78bc52ea5397c092d01cd08296fe1dc85d998329 (diff)
parentef4feab0e75be19c5f41d70a001db980b72090f5 (diff)
downloadrneovim-ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f.tar.gz
rneovim-ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f.tar.bz2
rneovim-ad999eaa775d7d4b0cacedb30c6ea3a0ee699a6f.zip
Merge branch 'master' into s-dash-stdin
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/dist/ft.vim741
-rw-r--r--runtime/autoload/health.vim24
-rw-r--r--runtime/autoload/health/nvim.vim10
-rw-r--r--runtime/autoload/health/provider.vim96
-rw-r--r--runtime/autoload/man.vim19
-rw-r--r--runtime/autoload/provider.vim37
-rw-r--r--runtime/autoload/provider/clipboard.vim17
-rw-r--r--runtime/autoload/provider/node.vim87
-rw-r--r--runtime/autoload/provider/python.vim6
-rw-r--r--runtime/autoload/provider/python3.vim6
-rw-r--r--runtime/autoload/provider/pythonx.vim19
-rw-r--r--runtime/autoload/provider/ruby.vim29
-rw-r--r--runtime/autoload/tutor.vim3
13 files changed, 919 insertions, 175 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
new file mode 100644
index 0000000000..2603c6822f
--- /dev/null
+++ b/runtime/autoload/dist/ft.vim
@@ -0,0 +1,741 @@
+" Vim functions for file type detection
+"
+" Maintainer: Bram Moolenaar <Bram@vim.org>
+" Last Change: 2017 Nov 11
+
+" These functions are moved here from runtime/filetype.vim to make startup
+" faster.
+
+" Line continuation is used here, remove 'C' from 'cpoptions'
+let s:cpo_save = &cpo
+set cpo&vim
+
+func dist#ft#Check_inp()
+ if getline(1) =~ '^\*'
+ setf abaqus
+ else
+ let n = 1
+ if line("$") > 500
+ let nmax = 500
+ else
+ let nmax = line("$")
+ endif
+ while n <= nmax
+ if getline(n) =~? "^header surface data"
+ setf trasys
+ break
+ endif
+ let n = n + 1
+ endwhile
+ endif
+endfunc
+
+" This function checks for the kind of assembly that is wanted by the user, or
+" can be detected from the first five lines of the file.
+func dist#ft#FTasm()
+ " make sure b:asmsyntax exists
+ if !exists("b:asmsyntax")
+ let b:asmsyntax = ""
+ endif
+
+ if b:asmsyntax == ""
+ call dist#ft#FTasmsyntax()
+ endif
+
+ " if b:asmsyntax still isn't set, default to asmsyntax or GNU
+ if b:asmsyntax == ""
+ if exists("g:asmsyntax")
+ let b:asmsyntax = g:asmsyntax
+ else
+ let b:asmsyntax = "asm"
+ endif
+ endif
+
+ exe "setf " . fnameescape(b:asmsyntax)
+endfunc
+
+func dist#ft#FTasmsyntax()
+ " see if file contains any asmsyntax=foo overrides. If so, change
+ " b:asmsyntax appropriately
+ let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4).
+ \" ".getline(5)." "
+ let match = matchstr(head, '\sasmsyntax=\zs[a-zA-Z0-9]\+\ze\s')
+ if match != ''
+ let b:asmsyntax = match
+ elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library'))
+ let b:asmsyntax = "vmasm"
+ endif
+endfunc
+
+" Check if one of the first five lines contains "VB_Name". In that case it is
+" probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype.
+func dist#ft#FTVB(alt)
+ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
+ setf vb
+ else
+ exe "setf " . a:alt
+ endif
+endfunc
+
+func dist#ft#FTbtm()
+ if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm
+ setf dosbatch
+ else
+ setf btm
+ endif
+endfunc
+
+func dist#ft#BindzoneCheck(default)
+ if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA'
+ setf bindzone
+ elseif a:default != ''
+ exe 'setf ' . a:default
+ endif
+endfunc
+
+func dist#ft#FTlpc()
+ if exists("g:lpc_syntax_for_c")
+ let lnum = 1
+ while lnum <= 12
+ if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)'
+ setf lpc
+ return
+ endif
+ let lnum = lnum + 1
+ endwhile
+ endif
+ setf c
+endfunc
+
+func dist#ft#FTheader()
+ if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1
+ if exists("g:c_syntax_for_h")
+ setf objc
+ else
+ setf objcpp
+ endif
+ elseif exists("g:c_syntax_for_h")
+ setf c
+ elseif exists("g:ch_syntax_for_h")
+ setf ch
+ else
+ setf cpp
+ endif
+endfunc
+
+" This function checks if one of the first ten lines start with a '@'. In
+" that case it is probably a change file.
+" If the first line starts with # or ! it's probably a ch file.
+" If a line has "main", "include", "//" ir "/*" it's probably ch.
+" Otherwise CHILL is assumed.
+func dist#ft#FTchange()
+ let lnum = 1
+ while lnum <= 10
+ if getline(lnum)[0] == '@'
+ setf change
+ return
+ endif
+ if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!')
+ setf ch
+ return
+ endif
+ if getline(lnum) =~ "MODULE"
+ setf chill
+ return
+ endif
+ if getline(lnum) =~ 'main\s*(\|#\s*include\|//'
+ setf ch
+ return
+ endif
+ let lnum = lnum + 1
+ endwhile
+ setf chill
+endfunc
+
+func dist#ft#FTent()
+ " This function checks for valid cl syntax in the first five lines.
+ " Look for either an opening comment, '#', or a block start, '{".
+ " If not found, assume SGML.
+ let lnum = 1
+ while lnum < 6
+ let line = getline(lnum)
+ if line =~ '^\s*[#{]'
+ setf cl
+ return
+ elseif line !~ '^\s*$'
+ " Not a blank line, not a comment, and not a block start,
+ " so doesn't look like valid cl code.
+ break
+ endif
+ let lnum = lnum + 1
+ endw
+ setf dtd
+endfunc
+
+func dist#ft#EuphoriaCheck()
+ if exists('g:filetype_euphoria')
+ exe 'setf ' . g:filetype_euphoria
+ else
+ setf euphoria3
+ endif
+endfunc
+
+func dist#ft#DtraceCheck()
+ let lines = getline(1, min([line("$"), 100]))
+ if match(lines, '^module\>\|^import\>') > -1
+ " D files often start with a module and/or import statement.
+ setf d
+ elseif match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1
+ setf dtrace
+ else
+ setf d
+ endif
+endfunc
+
+func dist#ft#FTe()
+ if exists('g:filetype_euphoria')
+ exe 'setf ' . g:filetype_euphoria
+ else
+ let n = 1
+ while n < 100 && n < line("$")
+ if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
+ setf specman
+ return
+ endif
+ let n = n + 1
+ endwhile
+ setf eiffel
+ endif
+endfunc
+
+" Distinguish between HTML, XHTML and Django
+func dist#ft#FThtml()
+ let n = 1
+ while n < 10 && n < line("$")
+ if getline(n) =~ '\<DTD\s\+XHTML\s'
+ setf xhtml
+ return
+ endif
+ if getline(n) =~ '{%\s*\(extends\|block\|load\)\>\|{#\s\+'
+ setf htmldjango
+ return
+ endif
+ let n = n + 1
+ endwhile
+ setf html
+endfunc
+
+" Distinguish between standard IDL and MS-IDL
+func dist#ft#FTidl()
+ let n = 1
+ while n < 50 && n < line("$")
+ if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
+ setf msidl
+ return
+ endif
+ let n = n + 1
+ endwhile
+ setf idl
+endfunc
+
+" Distinguish between "default" and Cproto prototype file. */
+func dist#ft#ProtoCheck(default)
+ " Cproto files have a comment in the first line and a function prototype in
+ " the second line, it always ends in ";". Indent files may also have
+ " comments, thus we can't match comments to see the difference.
+ " IDL files can have a single ';' in the second line, require at least one
+ " chacter before the ';'.
+ if getline(2) =~ '.;$'
+ setf cpp
+ else
+ exe 'setf ' . a:default
+ endif
+endfunc
+
+func dist#ft#FTm()
+ let n = 1
+ let saw_comment = 0 " Whether we've seen a multiline comment leader.
+ while n < 100
+ let line = getline(n)
+ if line =~ '^\s*/\*'
+ " /* ... */ is a comment in Objective C and Murphi, so we can't conclude
+ " it's either of them yet, but track this as a hint in case we don't see
+ " anything more definitive.
+ let saw_comment = 1
+ endif
+ if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|//\)'
+ setf objc
+ return
+ endif
+ if line =~ '^\s*%'
+ setf matlab
+ return
+ endif
+ if line =~ '^\s*(\*'
+ setf mma
+ return
+ endif
+ if line =~ '^\c\s*\(\(type\|var\)\>\|--\)'
+ setf murphi
+ return
+ endif
+ let n = n + 1
+ endwhile
+
+ if saw_comment
+ " We didn't see anything definitive, but this looks like either Objective C
+ " or Murphi based on the comment leader. Assume the former as it is more
+ " common.
+ setf objc
+ elseif exists("g:filetype_m")
+ " Use user specified default filetype for .m
+ exe "setf " . g:filetype_m
+ else
+ " Default is matlab
+ setf matlab
+ endif
+endfunc
+
+func dist#ft#FTmms()
+ let n = 1
+ while n < 10
+ let line = getline(n)
+ if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
+ setf mmix
+ return
+ endif
+ if line =~ '^\s*#'
+ setf make
+ return
+ endif
+ let n = n + 1
+ endwhile
+ setf mmix
+endfunc
+
+" This function checks if one of the first five lines start with a dot. In
+" that case it is probably an nroff file: 'filetype' is set and 1 is returned.
+func dist#ft#FTnroff()
+ if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.'
+ setf nroff
+ return 1
+ endif
+ return 0
+endfunc
+
+func dist#ft#FTmm()
+ let n = 1
+ while n < 10
+ let line = getline(n)
+ if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)'
+ setf objcpp
+ return
+ endif
+ let n = n + 1
+ endwhile
+ setf nroff
+endfunc
+
+func dist#ft#FTpl()
+ if exists("g:filetype_pl")
+ exe "setf " . g:filetype_pl
+ else
+ " recognize Prolog by specific text in the first non-empty line
+ " require a blank after the '%' because Perl uses "%list" and "%translate"
+ let l = getline(nextnonblank(1))
+ if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
+ setf prolog
+ else
+ setf perl
+ endif
+ endif
+endfunc
+
+func dist#ft#FTinc()
+ if exists("g:filetype_inc")
+ exe "setf " . g:filetype_inc
+ else
+ let lines = getline(1).getline(2).getline(3)
+ if lines =~? "perlscript"
+ setf aspperl
+ elseif lines =~ "<%"
+ setf aspvbs
+ elseif lines =~ "<?"
+ setf php
+ else
+ call dist#ft#FTasmsyntax()
+ if exists("b:asmsyntax")
+ exe "setf " . fnameescape(b:asmsyntax)
+ else
+ setf pov
+ endif
+ endif
+ endif
+endfunc
+
+func dist#ft#FTprogress_cweb()
+ if exists("g:filetype_w")
+ exe "setf " . g:filetype_w
+ return
+ endif
+ if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE'
+ setf progress
+ else
+ setf cweb
+ endif
+endfunc
+
+func dist#ft#FTprogress_asm()
+ if exists("g:filetype_i")
+ exe "setf " . g:filetype_i
+ return
+ endif
+ " This function checks for an assembly comment the first ten lines.
+ " If not found, assume Progress.
+ let lnum = 1
+ while lnum <= 10 && lnum < line('$')
+ let line = getline(lnum)
+ if line =~ '^\s*;' || line =~ '^\*'
+ call dist#ft#FTasm()
+ return
+ elseif line !~ '^\s*$' || line =~ '^/\*'
+ " Not an empty line: Doesn't look like valid assembly code.
+ " Or it looks like a Progress /* comment
+ break
+ endif
+ let lnum = lnum + 1
+ endw
+ setf progress
+endfunc
+
+func dist#ft#FTprogress_pascal()
+ if exists("g:filetype_p")
+ exe "setf " . g:filetype_p
+ return
+ endif
+ " This function checks for valid Pascal syntax in the first ten lines.
+ " Look for either an opening comment or a program start.
+ " If not found, assume Progress.
+ let lnum = 1
+ while lnum <= 10 && lnum < line('$')
+ let line = getline(lnum)
+ if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>'
+ \ || line =~ '^\s*{' || line =~ '^\s*(\*'
+ setf pascal
+ return
+ elseif line !~ '^\s*$' || line =~ '^/\*'
+ " Not an empty line: Doesn't look like valid Pascal code.
+ " Or it looks like a Progress /* comment
+ break
+ endif
+ let lnum = lnum + 1
+ endw
+ setf progress
+endfunc
+
+func dist#ft#FTr()
+ let max = line("$") > 50 ? 50 : line("$")
+
+ for n in range(1, max)
+ " Rebol is easy to recognize, check for that first
+ if getline(n) =~? '\<REBOL\>'
+ setf rebol
+ return
+ endif
+ endfor
+
+ for n in range(1, max)
+ " R has # comments
+ if getline(n) =~ '^\s*#'
+ setf r
+ return
+ endif
+ " Rexx has /* comments */
+ if getline(n) =~ '^\s*/\*'
+ setf rexx
+ return
+ endif
+ endfor
+
+ " Nothing recognized, use user default or assume Rexx
+ if exists("g:filetype_r")
+ exe "setf " . g:filetype_r
+ else
+ " Rexx used to be the default, but R appears to be much more popular.
+ setf r
+ endif
+endfunc
+
+func dist#ft#McSetf()
+ " Rely on the file to start with a comment.
+ " MS message text files use ';', Sendmail files use '#' or 'dnl'
+ for lnum in range(1, min([line("$"), 20]))
+ let line = getline(lnum)
+ if line =~ '^\s*\(#\|dnl\)'
+ setf m4 " Sendmail .mc file
+ return
+ elseif line =~ '^\s*;'
+ setf msmessages " MS Message text file
+ return
+ endif
+ endfor
+ setf m4 " Default: Sendmail .mc file
+endfunc
+
+" Called from filetype.vim and scripts.vim.
+func dist#ft#SetFileTypeSH(name)
+ if expand("<amatch>") =~ g:ft_ignore_pat
+ return
+ endif
+ if a:name =~ '\<csh\>'
+ " Some .sh scripts contain #!/bin/csh.
+ call dist#ft#SetFileTypeShell("csh")
+ return
+ elseif a:name =~ '\<tcsh\>'
+ " Some .sh scripts contain #!/bin/tcsh.
+ call dist#ft#SetFileTypeShell("tcsh")
+ return
+ elseif a:name =~ '\<zsh\>'
+ " Some .sh scripts contain #!/bin/zsh.
+ call dist#ft#SetFileTypeShell("zsh")
+ return
+ elseif a:name =~ '\<ksh\>'
+ let b:is_kornshell = 1
+ if exists("b:is_bash")
+ unlet b:is_bash
+ endif
+ if exists("b:is_sh")
+ unlet b:is_sh
+ endif
+ elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>'
+ let b:is_bash = 1
+ if exists("b:is_kornshell")
+ unlet b:is_kornshell
+ endif
+ if exists("b:is_sh")
+ unlet b:is_sh
+ endif
+ elseif a:name =~ '\<sh\>'
+ let b:is_sh = 1
+ if exists("b:is_kornshell")
+ unlet b:is_kornshell
+ endif
+ if exists("b:is_bash")
+ unlet b:is_bash
+ endif
+ endif
+ call dist#ft#SetFileTypeShell("sh")
+endfunc
+
+" For shell-like file types, check for an "exec" command hidden in a comment,
+" as used for Tcl.
+" Also called from scripts.vim, thus can't be local to this script.
+func dist#ft#SetFileTypeShell(name)
+ if expand("<amatch>") =~ g:ft_ignore_pat
+ return
+ endif
+ let l = 2
+ while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)'
+ " Skip empty and comment lines.
+ let l = l + 1
+ endwhile
+ if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$'
+ " Found an "exec" line after a comment with continuation
+ let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '')
+ if n =~ '\<tclsh\|\<wish'
+ setf tcl
+ return
+ endif
+ endif
+ exe "setf " . a:name
+endfunc
+
+func dist#ft#CSH()
+ if exists("g:filetype_csh")
+ call dist#ft#SetFileTypeShell(g:filetype_csh)
+ elseif &shell =~ "tcsh"
+ call dist#ft#SetFileTypeShell("tcsh")
+ else
+ call dist#ft#SetFileTypeShell("csh")
+ endif
+endfunc
+
+let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*'
+func dist#ft#FTRules()
+ let path = expand('<amatch>:p')
+ if path =~ '^/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|lib/udev/\%(rules\.d/\)\=.*\.rules\)$'
+ setf udevrules
+ return
+ endif
+ if path =~ '^/etc/ufw/'
+ setf conf " Better than hog
+ return
+ endif
+ if path =~ '^/\(etc\|usr/share\)/polkit-1/rules\.d'
+ setf javascript
+ return
+ endif
+ try
+ let config_lines = readfile('/etc/udev/udev.conf')
+ catch /^Vim\%((\a\+)\)\=:E484/
+ setf hog
+ return
+ endtry
+ let dir = expand('<amatch>:p:h')
+ for line in config_lines
+ if line =~ s:ft_rules_udev_rules_pattern
+ let udev_rules = substitute(line, s:ft_rules_udev_rules_pattern, '\1', "")
+ if dir == udev_rules
+ setf udevrules
+ endif
+ break
+ endif
+ endfor
+ setf hog
+endfunc
+
+func dist#ft#SQL()
+ if exists("g:filetype_sql")
+ exe "setf " . g:filetype_sql
+ else
+ setf sql
+ endif
+endfunc
+
+" If the file has an extension of 't' and is in a directory 't' or 'xt' then
+" it is almost certainly a Perl test file.
+" If the first line starts with '#' and contains 'perl' it's probably a Perl
+" file.
+" (Slow test) If a file contains a 'use' statement then it is almost certainly
+" a Perl file.
+func dist#ft#FTperl()
+ let dirname = expand("%:p:h:t")
+ if expand("%:e") == 't' && (dirname == 't' || dirname == 'xt')
+ setf perl
+ return 1
+ endif
+ if getline(1)[0] == '#' && getline(1) =~ 'perl'
+ setf perl
+ return 1
+ endif
+ if search('^use\s\s*\k', 'nc', 30)
+ setf perl
+ return 1
+ endif
+ return 0
+endfunc
+
+" Choose context, plaintex, or tex (LaTeX) based on these rules:
+" 1. Check the first line of the file for "%&<format>".
+" 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
+" 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc.
+func dist#ft#FTtex()
+ let firstline = getline(1)
+ if firstline =~ '^%&\s*\a\+'
+ let format = tolower(matchstr(firstline, '\a\+'))
+ let format = substitute(format, 'pdf', '', '')
+ if format == 'tex'
+ let format = 'latex'
+ elseif format == 'plaintex'
+ let format = 'plain'
+ endif
+ elseif expand('%') =~ 'tex/context/.*/.*.tex'
+ let format = 'context'
+ else
+ " Default value, may be changed later:
+ let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain'
+ " Save position, go to the top of the file, find first non-comment line.
+ let save_cursor = getpos('.')
+ call cursor(1,1)
+ let firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
+ if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword.
+ let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
+ let cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
+ let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)',
+ \ 'cnp', firstNC + 1000)
+ if kwline == 1 " lpat matched
+ let format = 'latex'
+ elseif kwline == 2 " cpat matched
+ let format = 'context'
+ endif " If neither matched, keep default set above.
+ " let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000)
+ " let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000)
+ " if cline > 0
+ " let format = 'context'
+ " endif
+ " if lline > 0 && (cline == 0 || cline > lline)
+ " let format = 'tex'
+ " endif
+ endif " firstNC
+ call setpos('.', save_cursor)
+ endif " firstline =~ '^%&\s*\a\+'
+
+ " Translation from formats to file types. TODO: add AMSTeX, RevTex, others?
+ if format == 'plain'
+ setf plaintex
+ elseif format == 'context'
+ setf context
+ else " probably LaTeX
+ setf tex
+ endif
+ return
+endfunc
+
+func dist#ft#FTxml()
+ let n = 1
+ while n < 100 && n < line("$")
+ let line = getline(n)
+ " DocBook 4 or DocBook 5.
+ let is_docbook4 = line =~ '<!DOCTYPE.*DocBook'
+ let is_docbook5 = line =~ ' xmlns="http://docbook.org/ns/docbook"'
+ if is_docbook4 || is_docbook5
+ let b:docbk_type = "xml"
+ if is_docbook5
+ let b:docbk_ver = 5
+ else
+ let b:docbk_ver = 4
+ endif
+ setf docbk
+ return
+ endif
+ if line =~ 'xmlns:xbl="http://www.mozilla.org/xbl"'
+ setf xbl
+ return
+ endif
+ let n += 1
+ endwhile
+ setf xml
+endfunc
+
+func dist#ft#FTy()
+ let n = 1
+ while n < 100 && n < line("$")
+ let line = getline(n)
+ if line =~ '^\s*%'
+ setf yacc
+ return
+ endif
+ if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include'
+ setf racc
+ return
+ endif
+ let n = n + 1
+ endwhile
+ setf yacc
+endfunc
+
+func dist#ft#Redif()
+ let lnum = 1
+ while lnum <= 5 && lnum < line('$')
+ if getline(lnum) =~ "^\ctemplate-type:"
+ setf redif
+ return
+ endif
+ let lnum = lnum + 1
+ endwhile
+endfunc
+
+
+" Restore 'cpoptions'
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim
index 53d45afc2e..56ae2071e9 100644
--- a/runtime/autoload/health.vim
+++ b/runtime/autoload/health.vim
@@ -93,26 +93,26 @@ function! s:help_to_link(s) abort
return substitute(a:s, '\v:h%[elp] ([^|][^"\r\n ]+)', ':help |\1|', 'g')
endfunction
-" Format a message for a specific report item
+" Format a message for a specific report item.
+" a:1: Optional advice (string or list)
function! s:format_report_message(status, msg, ...) abort " {{{
let output = ' - ' . a:status . ': ' . s:indent_after_line1(a:msg, 4)
- let advice = []
" Optional parameters
if a:0 > 0
- let advice = type(a:1) == type("") ? [a:1] : a:1
+ let advice = type(a:1) == type('') ? [a:1] : a:1
if type(advice) != type([])
- throw "Expected String or List"
+ throw 'a:1: expected String or List'
endif
- endif
- " Report each suggestion
- if len(advice) > 0
- let output .= "\n - ADVICE:"
+ " Report each suggestion
+ if !empty(advice)
+ let output .= "\n - ADVICE:"
+ for suggestion in advice
+ let output .= "\n - " . s:indent_after_line1(suggestion, 10)
+ endfor
+ endif
endif
- for suggestion in advice
- let output .= "\n - " . s:indent_after_line1(suggestion, 10)
- endfor
return s:help_to_link(output)
endfunction " }}}
@@ -128,6 +128,7 @@ function! health#report_ok(msg) abort " {{{
endfunction " }}}
" Reports a health warning.
+" a:1: Optional advice (string or list)
function! health#report_warn(msg, ...) abort " {{{
if a:0 > 0
echo s:format_report_message('WARNING', a:msg, a:1)
@@ -137,6 +138,7 @@ function! health#report_warn(msg, ...) abort " {{{
endfunction " }}}
" Reports a failed healthcheck.
+" a:1: Optional advice (string or list)
function! health#report_error(msg, ...) abort " {{{
if a:0 > 0
echo s:format_report_message('ERROR', a:msg, a:1)
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index 58033f0405..d09a714719 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -7,12 +7,12 @@ function! s:check_config() abort
" If $VIM is empty we don't care. Else make sure it is valid.
if !empty($VIM) && !filereadable($VIM.'/runtime/doc/nvim.txt')
let ok = v:false
- call health#report_error("$VIM is invalid: ".$VIM)
+ call health#report_error('$VIM is invalid: '.$VIM)
endif
if exists('$NVIM_TUI_ENABLE_CURSOR_SHAPE')
let ok = v:false
- call health#report_warn("$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+",
+ call health#report_warn('$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+',
\ [ "Use the 'guicursor' option to configure cursor shape. :help 'guicursor'",
\ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ])
endif
@@ -100,8 +100,8 @@ function! s:check_performance() abort
else
call health#report_info(buildtype)
call health#report_warn(
- \ "Non-optimized build-type. Nvim will be slower.",
- \ ["Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.",
+ \ 'Non-optimized build-type. Nvim will be slower.',
+ \ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.',
\ s:suggest_faq])
endif
endfunction
@@ -174,7 +174,7 @@ function! s:check_terminal() abort
\ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry))
endif
for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY']
- if !exists('$'.env_var)
+ if exists('$'.env_var)
call health#report_info(printf("$%s='%s'", env_var, eval('$'.env_var)))
endif
endfor
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 0201ed8062..4adab1aa76 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -13,6 +13,12 @@ function! s:normalize_path(s) abort
return substitute(substitute(a:s, '\', '/', 'g'), '/\./\|/\+', '/', 'g')
endfunction
+" Returns TRUE if `cmd` exits with success, else FALSE.
+function! s:cmd_ok(cmd) abort
+ call system(a:cmd)
+ return v:shell_error == 0
+endfunction
+
" Simple version comparison.
function! s:version_cmp(a, b) abort
let a = split(a:a, '\.', 0)
@@ -120,6 +126,13 @@ endfunction
function! s:check_clipboard() abort
call health#report_start('Clipboard (optional)')
+ if !empty($TMUX) && executable('tmux') && executable('pbpaste') && !s:cmd_ok('pbpaste')
+ let tmux_version = matchstr(system('tmux -V'), '\d\+\.\d\+')
+ call health#report_error('pbcopy does not work with tmux version: '.tmux_version,
+ \ ['Install tmux 2.6+. https://superuser.com/q/231130',
+ \ 'or use tmux with reattach-to-user-namespace. https://superuser.com/a/413233'])
+ endif
+
let clipboard_tool = provider#clipboard#Executable()
if exists('g:clipboard') && empty(clipboard_tool)
call health#report_error(
@@ -247,20 +260,23 @@ function! s:check_python(version) abort
let python_multiple = []
if exists(loaded_var) && !exists('*provider#'.pyname.'#Call')
- call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
- return
+ call health#report_info('Disabled ('.loaded_var.'='.eval(loaded_var).'). This might be due to some previous error.')
endif
if !empty(pyenv)
if empty(pyenv_root)
- call health#report_warn(
- \ 'pyenv was found, but $PYENV_ROOT is not set.',
- \ ['Did you follow the final install instructions?',
- \ 'If you use a shell "framework" like Prezto or Oh My Zsh, try without.',
- \ 'Try a different shell (bash).']
+ call health#report_info(
+ \ 'pyenv was found, but $PYENV_ROOT is not set. `pyenv root` will be used.'
+ \ .' If you run into problems, try setting $PYENV_ROOT explicitly.'
\ )
+ let pyenv_root = s:trim(s:system([pyenv, 'root']))
+ endif
+
+ if !isdirectory(pyenv_root)
+ call health#report_error('Invalid pyenv root: '.pyenv_root)
else
- call health#report_ok(printf('pyenv found: "%s"', pyenv))
+ call health#report_info(printf('pyenv: %s', pyenv))
+ call health#report_info(printf('pyenv root: %s', pyenv_root))
endif
endif
@@ -272,9 +288,6 @@ function! s:check_python(version) abort
if empty(pyname)
call health#report_warn('No Python interpreter was found with the neovim '
\ . 'module. Using the first available for diagnostics.')
- if !empty(pythonx_errs)
- call health#report_warn(pythonx_errs)
- endif
endif
if !empty(pyname)
@@ -332,8 +345,8 @@ function! s:check_python(version) abort
endif
endif
- if !empty(python_bin)
- if empty(venv) && !empty(pyenv) && !exists('g:'.host_prog_var)
+ if !empty(python_bin) && !exists('g:'.host_prog_var)
+ if empty(venv) && !empty(pyenv)
\ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.pyenv_root.'/'
call health#report_warn('pyenv is not set up optimally.', [
\ printf('Create a virtualenv specifically '
@@ -341,7 +354,7 @@ function! s:check_python(version) abort
\ . 'the need to install the Neovim Python module in each '
\ . 'version/virtualenv.', host_prog_var)
\ ])
- elseif !empty(venv) && exists('g:'.host_prog_var)
+ elseif !empty(venv)
if !empty(pyenv_root)
let venv_root = pyenv_root
else
@@ -366,27 +379,16 @@ function! s:check_python(version) abort
let python_bin = ''
endif
- " Check if $VIRTUAL_ENV is active
- let virtualenv_inactive = 0
-
+ " Check if $VIRTUAL_ENV is valid.
if exists('$VIRTUAL_ENV')
- if !empty(pyenv)
- let pyenv_prefix = resolve(s:trim(s:system([pyenv, 'prefix'])))
- if $VIRTUAL_ENV != pyenv_prefix
- let virtualenv_inactive = 1
- endif
- elseif !empty(pyname) && exepath(pyname) !~# '^'.$VIRTUAL_ENV.'/'
- let virtualenv_inactive = 1
+ if !empty(pyname) && $VIRTUAL_ENV !=# matchstr(exepath(pyname), '^\V'.$VIRTUAL_ENV)
+ call health#report_warn(
+ \ '$VIRTUAL_ENV exists but appears to be inactive. '
+ \ . 'This could lead to unexpected results.',
+ \ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654' ])
endif
endif
- if virtualenv_inactive
- call health#report_warn(
- \ '$VIRTUAL_ENV exists but appears to be inactive. '
- \ . 'This could lead to unexpected results.',
- \ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654/5229' ])
- endif
-
" Diagnostic output
call health#report_info('Executable: ' . (empty(python_bin) ? 'Not found' : python_bin))
if len(python_multiple)
@@ -451,10 +453,11 @@ function! s:check_ruby() abort
let host = provider#ruby#Detect()
if empty(host)
- call health#report_warn('Missing "neovim" gem.',
- \ ['Run in shell: gem install neovim',
- \ 'Is the gem bin directory in $PATH? Check `gem environment`.',
- \ 'If you are using rvm/rbenv/chruby, try "rehashing".'])
+ call health#report_warn('`neovim-ruby-host` not found.',
+ \ ['Run `gem install neovim` to ensure the neovim RubyGem is installed.',
+ \ 'Run `gem environment` to ensure the gem bin directory is in $PATH.',
+ \ 'If you are using rvm/rbenv/chruby, try "rehashing".',
+ \ 'See :help g:ruby_host_prog for non-standard gem installations.'])
return
endif
call health#report_info('Host: '. host)
@@ -488,7 +491,7 @@ function! s:check_ruby() abort
endfunction
function! s:check_node() abort
- call health#report_start('Node provider (optional)')
+ call health#report_start('Node.js provider (optional)')
let loaded_var = 'g:loaded_node_provider'
if exists(loaded_var) && !exists('*provider#node#Call')
@@ -502,7 +505,16 @@ function! s:check_node() abort
\ ['Install Node.js and verify that `node` and `npm` commands work.'])
return
endif
- call health#report_info('Node: '. s:system('node -v'))
+ let node_v = get(split(s:system('node -v'), "\n"), 0, '')
+ call health#report_info('Node.js: '. node_v)
+ if !s:shell_error && s:version_cmp(node_v[1:], '6.0.0') < 0
+ call health#report_warn('Neovim node.js host does not support '.node_v)
+ " Skip further checks, they are nonsense if nodejs is too old.
+ return
+ endif
+ if !provider#node#can_inspect()
+ call health#report_warn('node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.')
+ endif
let host = provider#node#Detect()
if empty(host)
@@ -511,7 +523,7 @@ function! s:check_node() abort
\ 'Is the npm bin directory in $PATH?'])
return
endif
- call health#report_info('Host: '. host)
+ call health#report_info('Neovim node.js host: '. host)
let latest_npm_cmd = has('win32') ? 'cmd /c npm info neovim --json' : 'npm info neovim --json'
let latest_npm = s:system(split(latest_npm_cmd))
@@ -530,11 +542,11 @@ function! s:check_node() abort
let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse')
endif
- let current_npm_cmd = host .' --version'
+ let current_npm_cmd = ['node', host, '--version']
let current_npm = s:system(current_npm_cmd)
if s:shell_error
- call health#report_error('Failed to run: '. current_npm_cmd,
- \ ['Report this issue with the output of: ', current_npm_cmd])
+ call health#report_error('Failed to run: '. string(current_npm_cmd),
+ \ ['Report this issue with the output of: ', string(current_npm_cmd)])
return
endif
@@ -544,7 +556,7 @@ function! s:check_node() abort
\ current_npm, latest_npm),
\ ['Run in shell: npm update neovim'])
else
- call health#report_ok('Latest "neovim" npm is installed: '. current_npm)
+ call health#report_ok('Latest "neovim" npm package is installed: '. current_npm)
endif
endfunction
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index dd71ede680..4d43a4582b 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -65,9 +65,9 @@ function! man#open_page(count, count1, mods, ...) abort
try
set eventignore+=BufReadCmd
if a:mods !~# 'tab' && s:find_man()
- execute 'silent edit' fnameescape(bufname)
+ execute 'silent keepalt edit' fnameescape(bufname)
else
- execute 'silent' a:mods 'split' fnameescape(bufname)
+ execute 'silent keepalt' a:mods 'split' fnameescape(bufname)
endif
finally
set eventignore-=BufReadCmd
@@ -148,7 +148,8 @@ function! s:get_page(path) abort
let manwidth = empty($MANWIDTH) ? winwidth(0) : $MANWIDTH
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
" http://comments.gmane.org/gmane.editors.vim.devel/29085
- let cmd = ['env', 'MANPAGER=cat', 'MANWIDTH='.manwidth, 'man']
+ " Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.
+ let cmd = ['env', 'MANPAGER=cat', 'MANWIDTH='.manwidth, 'MAN_KEEP_FORMATTING=1', 'man']
return s:system(cmd + (s:localfile_arg ? ['-l', a:path] : [a:path]))
endfunction
@@ -157,11 +158,10 @@ function! s:put_page(page) abort
setlocal noreadonly
silent keepjumps %delete _
silent put =a:page
- " Remove all backspaced/escape characters.
- execute 'silent keeppatterns keepjumps %substitute,.\b\|\e\[\d\+m,,e'.(&gdefault?'':'g')
while getline(1) =~# '^\s*$'
silent keepjumps 1delete _
endwhile
+ lua require("man").highlight_man_page()
setlocal filetype=man
endfunction
@@ -299,6 +299,12 @@ endfunction
" see man#extract_sect_and_name_ref on why tolower(sect)
function! man#complete(arg_lead, cmd_line, cursor_pos) abort
let args = split(a:cmd_line)
+ let cmd_offset = index(args, 'Man')
+ if cmd_offset > 0
+ " Prune all arguments up to :Man itself. Otherwise modifier commands like
+ " :tab, :vertical, etc. would lead to a wrong length.
+ let args = args[cmd_offset:]
+ endif
let l = len(args)
if l > 3
return
@@ -370,13 +376,12 @@ function! s:format_candidate(path, psect) abort
endfunction
function! man#init_pager() abort
- " Remove all backspaced/escape characters.
- execute 'silent keeppatterns keepjumps %substitute,.\b\|\e\[\d\+m,,e'.(&gdefault?'':'g')
if getline(1) =~# '^\s*$'
silent keepjumps 1delete _
else
keepjumps 1
endif
+ lua require("man").highlight_man_page()
" This is not perfect. See `man glDrawArraysInstanced`. Since the title is
" all caps it is impossible to tell what the original capitilization was.
let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g')
diff --git a/runtime/autoload/provider.vim b/runtime/autoload/provider.vim
index e6514f5ba8..dc24e801d0 100644
--- a/runtime/autoload/provider.vim
+++ b/runtime/autoload/provider.vim
@@ -1,20 +1,21 @@
-" Common functionality for providers
+" Common functions for providers
-let s:stderr = {}
-
-function! provider#stderr_collector(chan_id, data, event)
- let stderr = get(s:stderr, a:chan_id, [''])
- let stderr[-1] .= a:data[0]
- call extend(stderr, a:data[1:])
- let s:stderr[a:chan_id] = stderr
-endfunction
-
-function! provider#clear_stderr(chan_id)
- if has_key(s:stderr, a:chan_id)
- call remove(s:stderr, a:chan_id)
- endif
-endfunction
-
-function! provider#get_stderr(chan_id)
- return get(s:stderr, a:chan_id, [])
+" Start the provider and perform a 'poll' request
+"
+" Returns a valid channel on success
+function! provider#Poll(argv, orig_name, log_env) abort
+ let job = {'rpc': v:true, 'stderr_buffered': v:true}
+ try
+ let channel_id = jobstart(a:argv, job)
+ if channel_id > 0 && rpcrequest(channel_id, 'poll') ==# 'ok'
+ return channel_id
+ endif
+ catch
+ echomsg v:throwpoint
+ echomsg v:exception
+ for row in get(job, 'stderr', [])
+ echomsg row
+ endfor
+ endtry
+ throw remote#host#LoadErrorForHost(a:orig_name, a:log_env)
endfunction
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 6454a01c2a..87a0315073 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -7,7 +7,7 @@ let s:clipboard = {}
" When caching is enabled, store the jobid of the xclip/xsel process keeping
" ownership of the selection, so we know how long the cache is valid.
-let s:selection = { 'owner': 0, 'data': [], 'on_stderr': function('provider#stderr_collector') }
+let s:selection = { 'owner': 0, 'data': [], 'stderr_buffered': v:true }
function! s:selection.on_exit(jobid, data, event) abort
" At this point this nvim instance might already have launched
@@ -16,19 +16,17 @@ function! s:selection.on_exit(jobid, data, event) abort
let self.owner = 0
endif
if a:data != 0
- let stderr = provider#get_stderr(a:jobid)
echohl WarningMsg
- echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(stderr)
+ echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(self.stderr)
echohl None
endif
- call provider#clear_stderr(a:jobid)
endfunction
let s:selections = { '*': s:selection, '+': copy(s:selection) }
function! s:try_cmd(cmd, ...) abort
let argv = split(a:cmd, " ")
- let out = a:0 ? systemlist(argv, a:1, 1) : systemlist(argv, [''], 1)
+ let out = systemlist(argv, (a:0 ? a:1 : ['']), 1)
if v:shell_error
if !exists('s:did_error_try_cmd')
echohl WarningMsg
@@ -66,7 +64,7 @@ function! provider#clipboard#Executable() abort
let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null })
let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0)
return get(g:clipboard, 'name', 'g:clipboard')
- elseif has('mac') && executable('pbcopy')
+ elseif has('mac') && executable('pbpaste') && s:cmd_ok('pbpaste')
let s:copy['+'] = 'pbcopy'
let s:paste['+'] = 'pbpaste'
let s:copy['*'] = s:copy['+']
@@ -142,12 +140,13 @@ function! s:clipboard.set(lines, regtype, reg) abort
return 0
end
- let selection = s:selections[a:reg]
- if selection.owner > 0
+ if s:selections[a:reg].owner > 0
" The previous provider instance should exit when the new one takes
" ownership, but kill it to be sure we don't fill up the job table.
- call jobstop(selection.owner)
+ call jobstop(s:selections[a:reg].owner)
end
+ let s:selections[a:reg] = copy(s:selection)
+ let selection = s:selections[a:reg]
let selection.data = [a:lines, a:regtype]
let argv = split(s:copy[a:reg], " ")
let selection.argv = argv
diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim
index b08ad4f316..39b5dc63b8 100644
--- a/runtime/autoload/provider/node.vim
+++ b/runtime/autoload/provider/node.vim
@@ -3,13 +3,59 @@ if exists('g:loaded_node_provider')
endif
let g:loaded_node_provider = 1
-let s:job_opts = {'rpc': v:true, 'on_stderr': function('provider#stderr_collector')}
+function! s:is_minimum_version(version, min_major, min_minor) abort
+ if empty(a:version)
+ let nodejs_version = get(split(system(['node', '-v']), "\n"), 0, '')
+ if v:shell_error || nodejs_version[0] !=# 'v'
+ return 0
+ endif
+ else
+ let nodejs_version = a:version
+ endif
+ " Remove surrounding junk. Example: 'v4.12.0' => '4.12.0'
+ let nodejs_version = matchstr(nodejs_version, '\(\d\.\?\)\+')
+ " [major, minor, patch]
+ let v_list = split(nodejs_version, '\.')
+ return len(v_list) == 3
+ \ && ((str2nr(v_list[0]) > str2nr(a:min_major))
+ \ || (str2nr(v_list[0]) == str2nr(a:min_major)
+ \ && str2nr(v_list[1]) >= str2nr(a:min_minor)))
+endfunction
+
+" Support for --inspect-brk requires node 6.12+ or 7.6+ or 8+
+" Return 1 if it is supported
+" Return 0 otherwise
+function! provider#node#can_inspect() abort
+ if !executable('node')
+ return 0
+ endif
+ let ver = get(split(system(['node', '-v']), "\n"), 0, '')
+ if v:shell_error || ver[0] !=# 'v'
+ return 0
+ endif
+ return (ver[1] ==# '6' && s:is_minimum_version(ver, 6, 12))
+ \ || s:is_minimum_version(ver, 7, 6)
+endfunction
function! provider#node#Detect() abort
- return has('win32') ? exepath('neovim-node-host.cmd') : exepath('neovim-node-host')
+ if exists('g:node_host_prog')
+ return g:node_host_prog
+ endif
+ let global_modules = get(split(system('npm root -g'), "\n"), 0, '')
+ if v:shell_error || !isdirectory(global_modules)
+ return ''
+ endif
+ if !s:is_minimum_version(v:null, 6, 0)
+ return ''
+ endif
+ let entry_point = glob(global_modules . '/neovim/bin/cli.js')
+ if !filereadable(entry_point)
+ return ''
+ endif
+ return entry_point
endfunction
-function! provider#node#Prog()
+function! provider#node#Prog() abort
return s:prog
endfunction
@@ -19,37 +65,18 @@ function! provider#node#Require(host) abort
return
endif
- if has('win32')
- let args = provider#node#Prog()
- else
- let args = ['node']
-
- if !empty($NVIM_NODE_HOST_DEBUG)
- call add(args, '--inspect-brk')
- endif
+ let args = ['node']
- call add(args , provider#node#Prog())
+ if !empty($NVIM_NODE_HOST_DEBUG) && provider#node#can_inspect()
+ call add(args, '--inspect-brk')
endif
- try
- let channel_id = jobstart(args, s:job_opts)
- if rpcrequest(channel_id, 'poll') ==# 'ok'
- return channel_id
- endif
- catch
- echomsg v:throwpoint
- echomsg v:exception
- for row in provider#get_stderr(channel_id)
- echomsg row
- endfor
- endtry
- finally
- call provider#clear_stderr(channel_id)
- endtry
- throw remote#host#LoadErrorForHost(a:host.orig_name, '$NVIM_NODE_LOG_FILE')
+ call add(args, provider#node#Prog())
+
+ return provider#Poll(args, a:host.orig_name, '$NVIM_NODE_LOG_FILE')
endfunction
-function! provider#node#Call(method, args)
+function! provider#node#Call(method, args) abort
if s:err != ''
echoerr s:err
return
@@ -74,7 +101,7 @@ let s:err = ''
let s:prog = provider#node#Detect()
if empty(s:prog)
- let s:err = 'Cannot find the "neovim" node package. Try :CheckHealth'
+ let s:err = 'Cannot find the "neovim" node package. Try :checkhealth'
endif
call remote#host#RegisterPlugin('node-provider', 'node', [])
diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim
index 81fe194cb9..a06cbe4814 100644
--- a/runtime/autoload/provider/python.vim
+++ b/runtime/autoload/provider/python.vim
@@ -11,11 +11,11 @@ let g:loaded_python_provider = 1
let [s:prog, s:err] = provider#pythonx#Detect(2)
-function! provider#python#Prog()
+function! provider#python#Prog() abort
return s:prog
endfunction
-function! provider#python#Error()
+function! provider#python#Error() abort
return s:err
endfunction
@@ -29,7 +29,7 @@ endif
call remote#host#RegisterClone('legacy-python-provider', 'python')
call remote#host#RegisterPlugin('legacy-python-provider', 'script_host.py', [])
-function! provider#python#Call(method, args)
+function! provider#python#Call(method, args) abort
if s:err != ''
return
endif
diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim
index 0c3b75b73d..242a224cb3 100644
--- a/runtime/autoload/provider/python3.vim
+++ b/runtime/autoload/provider/python3.vim
@@ -11,11 +11,11 @@ let g:loaded_python3_provider = 1
let [s:prog, s:err] = provider#pythonx#Detect(3)
-function! provider#python3#Prog()
+function! provider#python3#Prog() abort
return s:prog
endfunction
-function! provider#python3#Error()
+function! provider#python3#Error() abort
return s:err
endfunction
@@ -29,7 +29,7 @@ endif
call remote#host#RegisterClone('legacy-python3-provider', 'python3')
call remote#host#RegisterPlugin('legacy-python3-provider', 'script_host.py', [])
-function! provider#python3#Call(method, args)
+function! provider#python3#Call(method, args) abort
if s:err != ''
return
endif
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index 7285ed43ea..b51c398410 100644
--- a/runtime/autoload/provider/pythonx.vim
+++ b/runtime/autoload/provider/pythonx.vim
@@ -5,8 +5,6 @@ endif
let s:loaded_pythonx_provider = 1
-let s:job_opts = {'rpc': v:true, 'on_stderr': function('provider#stderr_collector')}
-
function! provider#pythonx#Require(host) abort
let ver = (a:host.orig_name ==# 'python') ? 2 : 3
@@ -20,22 +18,7 @@ function! provider#pythonx#Require(host) abort
call add(args, plugin.path)
endfor
- try
- let channel_id = jobstart(args, s:job_opts)
- if rpcrequest(channel_id, 'poll') ==# 'ok'
- return channel_id
- endif
- catch
- echomsg v:throwpoint
- echomsg v:exception
- for row in provider#get_stderr(channel_id)
- echomsg row
- endfor
- finally
- call provider#clear_stderr(channel_id)
- endtry
- throw remote#host#LoadErrorForHost(a:host.orig_name,
- \ '$NVIM_PYTHON_LOG_FILE')
+ return provider#Poll(args, a:host.orig_name, '$NVIM_PYTHON_LOG_FILE')
endfunction
function! provider#pythonx#Detect(major_ver) abort
diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim
index da73a0dfc0..2fe3817512 100644
--- a/runtime/autoload/provider/ruby.vim
+++ b/runtime/autoload/provider/ruby.vim
@@ -4,17 +4,6 @@ if exists('g:loaded_ruby_provider')
endif
let g:loaded_ruby_provider = 1
-let s:stderr = {}
-let s:job_opts = {'rpc': v:true}
-
-function! s:job_opts.on_stderr(chan_id, data, event)
- let stderr = get(s:stderr, a:chan_id, [''])
- let last = remove(stderr, -1)
- let a:data[0] = last.a:data[0]
- call extend(stderr, a:data)
- let s:stderr[a:chan_id] = stderr
-endfunction
-
function! provider#ruby#Detect() abort
if exists("g:ruby_host_prog")
return g:ruby_host_prog
@@ -23,7 +12,7 @@ function! provider#ruby#Detect() abort
end
endfunction
-function! provider#ruby#Prog()
+function! provider#ruby#Prog() abort
return s:prog
endfunction
@@ -35,22 +24,10 @@ function! provider#ruby#Require(host) abort
let prog .= " " . shellescape(plugin.path)
endfor
- try
- let channel_id = jobstart(prog, s:job_opts)
- if rpcrequest(channel_id, 'poll') ==# 'ok'
- return channel_id
- endif
- catch
- echomsg v:throwpoint
- echomsg v:exception
- for row in get(s:stderr, channel_id, [])
- echomsg row
- endfor
- endtry
- throw remote#host#LoadErrorForHost(a:host.orig_name, '$NVIM_RUBY_LOG_FILE')
+ return provider#Poll(prog, a:host.orig_name, '$NVIM_RUBY_LOG_FILE')
endfunction
-function! provider#ruby#Call(method, args)
+function! provider#ruby#Call(method, args) abort
if s:err != ''
echoerr s:err
return
diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim
index 56e2283465..0f01190b9b 100644
--- a/runtime/autoload/tutor.vim
+++ b/runtime/autoload/tutor.vim
@@ -2,9 +2,6 @@
" Setup: {{{1
function! tutor#SetupVim()
- if &columns < 90
- set columns=90
- endif
if !exists('g:did_load_ftplugin') || g:did_load_ftplugin != 1
filetype plugin on
endif