diff options
Diffstat (limited to 'runtime/autoload')
40 files changed, 7472 insertions, 1228 deletions
diff --git a/runtime/autoload/RstFold.vim b/runtime/autoload/RstFold.vim new file mode 100644 index 0000000000..5becb04685 --- /dev/null +++ b/runtime/autoload/RstFold.vim @@ -0,0 +1,48 @@ +" Author: Antony Lee <anntzer.lee@gmail.com> +" Description: Helper functions for reStructuredText syntax folding +" Last Modified: 2018-01-07 + +function s:CacheRstFold() + let closure = {'header_types': {}, 'max_level': 0, 'levels': {}} + function closure.Process(match) dict + let curline = getcurpos()[1] + if has_key(self.levels, curline - 1) + " For over+under-lined headers, the regex will match both at the + " overline and at the title itself; in that case, skip the second match. + return + endif + let lines = split(a:match, '\n') + let key = repeat(lines[-1][0], len(lines)) + if !has_key(self.header_types, key) + let self.max_level += 1 + let self.header_types[key] = self.max_level + endif + let self.levels[curline] = self.header_types[key] + endfunction + let save_cursor = getcurpos() + silent keeppatterns %s/\v^%(%(([=`:.'"~^_*+#-])\1+\n)?.{1,2}\n([=`:.'"~^_*+#-])\2+)|%(%(([=`:.''"~^_*+#-])\3{2,}\n)?.{3,}\n([=`:.''"~^_*+#-])\4{2,})$/\=closure.Process(submatch(0))/gn + call setpos('.', save_cursor) + let b:RstFoldCache = closure.levels +endfunction + +function RstFold#GetRstFold() + if !has_key(b:, 'RstFoldCache') + call s:CacheRstFold() + endif + if has_key(b:RstFoldCache, v:lnum) + return '>' . b:RstFoldCache[v:lnum] + else + return '=' + endif +endfunction + +function RstFold#GetRstFoldText() + if !has_key(b:, 'RstFoldCache') + call s:CacheRstFold() + endif + let indent = repeat(' ', b:RstFoldCache[v:foldstart] - 1) + let thisline = getline(v:foldstart) + " For over+under-lined headers, skip the overline. + let text = thisline =~ '^\([=`:.''"~^_*+#-]\)\1\+$' ? getline(v:foldstart + 1) : thisline + return indent . text +endfunction diff --git a/runtime/autoload/ada.vim b/runtime/autoload/ada.vim index cc5191fa43..d04feb9250 100644 --- a/runtime/autoload/ada.vim +++ b/runtime/autoload/ada.vim @@ -2,12 +2,13 @@ " Description: Perform Ada specific completion & tagging. " Language: Ada (2005) " $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $ -" Maintainer: Martin Krischik <krischik@users.sourceforge.net> +" Maintainer: Mathias Brousset <mathiasb17@gmail.com> +" Martin Krischik <krischik@users.sourceforge.net> " Taylor Venable <taylor@metasyntax.net> " Neil Bird <neil@fnxweb.com> " Ned Okie <nokie@radford.edu> " $Author: krischik $ -" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ +" $Date: 2017-01-31 20:20:05 +0200 (Mon, 01 Jan 2017) $ " Version: 4.6 " $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/ada.vim $ @@ -23,6 +24,7 @@ " 09.05.2007 MK Session just won't work no matter how much " tweaking is done " 19.09.2007 NO still some mapleader problems +" 31.01.2017 MB fix more mapleader problems " Help Page: ft-ada-functions "------------------------------------------------------------------------------ @@ -585,11 +587,11 @@ function ada#Map_Menu (Text, Keys, Command) \ " :" . a:Command . "<CR>" execute \ "nnoremap <buffer>" . - \ escape(l:leader . "a" . a:Keys , '\') . + \ " <Leader>a" . a:Keys . \" :" . a:Command execute \ "inoremap <buffer>" . - \ escape(l:leader . "a" . a:Keys , '\') . + \ " <Leader>a" . a:Keys . \" <C-O>:" . a:Command endif return diff --git a/runtime/autoload/ccomplete.vim b/runtime/autoload/ccomplete.vim index d5bfa076a9..156b3af025 100644 --- a/runtime/autoload/ccomplete.vim +++ b/runtime/autoload/ccomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2012 Jun 20 +" Last Change: 2018 Aug 20 let s:cpo_save = &cpo set cpo&vim @@ -72,8 +72,10 @@ function! ccomplete#Complete(findstart, base) " Split item in words, keep empty word after "." or "->". " "aa" -> ['aa'], "aa." -> ['aa', ''], "aa.bb" -> ['aa', 'bb'], etc. " We can't use split, because we need to skip nested [...]. + " "aa[...]" -> ['aa', '[...]'], "aa.bb[...]" -> ['aa', 'bb', '[...]'], etc. let items = [] let s = 0 + let arrays = 0 while 1 let e = match(base, '\.\|->\|\[', s) if e < 0 @@ -107,6 +109,7 @@ function! ccomplete#Complete(findstart, base) endwhile let e += 1 call add(items, strpart(base, s, e - s)) + let arrays += 1 let s = e endif endwhile @@ -161,15 +164,26 @@ function! ccomplete#Complete(findstart, base) endif endif let res = [{'match': match, 'tagline' : '', 'kind' : kind, 'info' : line}] + elseif len(items) == arrays + 1 + " Completing one word and it's a local array variable: build tagline + " from declaration line + let match = items[0] + let kind = 'v' + let tagline = "\t/^" . line . '$/' + let res = [{'match': match, 'tagline' : tagline, 'kind' : kind, 'info' : line}] else " Completing "var.", "var.something", etc. let res = s:Nextitem(strpart(line, 0, col), items[1:], 0, 1) endif endif - if len(items) == 1 + if len(items) == 1 || len(items) == arrays + 1 " Only one part, no "." or "->": complete from tags file. - let tags = taglist('^' . base) + if len(items) == 1 + let tags = taglist('^' . base) + else + let tags = taglist('^' . items[0] . '$') + endif " Remove members, these can't appear without something in front. call filter(tags, 'has_key(v:val, "kind") ? v:val["kind"] != "m" : 1') @@ -516,11 +530,24 @@ function! s:StructMembers(typename, items, all) endif endif + " Skip over [...] items + let idx = 0 + while 1 + if idx >= len(a:items) + let target = '' " No further items, matching all members + break + endif + if a:items[idx][0] != '[' + let target = a:items[idx] + break + endif + let idx += 1 + endwhile " Put matching members in matches[]. let matches = [] for l in qflist let memb = matchstr(l['text'], '[^\t]*') - if memb =~ '^' . a:items[0] + if memb =~ '^' . target " Skip matches local to another file. if match(l['text'], "\tfile:") < 0 || bufnr('%') == bufnr(matchstr(l['text'], '\t\zs[^\t]*')) let item = {'match': memb, 'tagline': l['text']} @@ -540,8 +567,8 @@ function! s:StructMembers(typename, items, all) endfor if len(matches) > 0 - " Skip over [...] items - let idx = 1 + " Skip over next [...] items + let idx += 1 while 1 if idx >= len(a:items) return matches " No further items, return the result. diff --git a/runtime/autoload/clojurecomplete.vim b/runtime/autoload/clojurecomplete.vim index 708bb31104..030785e901 100644 --- a/runtime/autoload/clojurecomplete.vim +++ b/runtime/autoload/clojurecomplete.vim @@ -1,14 +1,14 @@ " Vim completion script -" Language: Clojure -" Maintainer: Sung Pae <self@sungpae.com> -" URL: https://github.com/guns/vim-clojure-static -" License: Same as Vim -" Last Change: 27 March 2014 +" Language: Clojure +" Maintainer: Sung Pae <self@sungpae.com> +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: 18 July 2016 " -*- COMPLETION WORDS -*- -" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-010/clj/src/vim_clojure_static/generate.clj -" Clojure version 1.6.0 -let s:words = ["*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-readably*","*read-eval*","*source-path*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods",".","..","/","<","<=","=","==",">",">=","EMPTY-NODE","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc!","assoc","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","booleans","bound-fn","bound-fn*","bound?","butlast","byte","byte-array","bytes","case","cast","catch","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","concat","cond","cond->","cond->>","condp","conj!","conj","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","def","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj!","disj","dissoc!","dissoc","distinct","distinct?","do","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","doubles","drop","drop-last","drop-while","empty","empty?","ensure","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-data","ex-info","extend","extend-protocol","extend-type","extenders","extends?","false?","ffirst","file-seq","filter","filterv","finally","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","identical?","identity","if","if-let","if-not","if-some","ifn?","import","in-ns","inc","inc'","init-proxy","instance?","int","int-array","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","let","letfn","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","loop","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","monitor-enter","monitor-exit","munge","name","namespace","namespace-munge","neg?","new","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop!","pop","pop-thread-bindings","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","quot","quote","rand","rand-int","rand-nth","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read-line","read-string","realized?","record?","recur","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-watch","repeat","repeatedly","replace","replicate","require","reset!","reset-meta!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seque","sequence","sequential?","set!","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","slurp","some","some->","some->>","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","symbol","symbol?","sync","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","throw","time","to-array","to-array-2d","trampoline","transient","tree-seq","true?","try","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","unsigned-bit-shift-right","update-in","update-proxy","use","val","vals","var","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"] +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-011/clj/src/vim_clojure_static/generate.clj +" Clojure version 1.8.0 +let s:words = ["*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-readably*","*read-eval*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods",".","..","/","<","<=","=","==",">",">=","EMPTY-NODE","Throwable->map","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc!","assoc","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","booleans","bound-fn","bound-fn*","bound?","butlast","byte","byte-array","bytes","case","cast","cat","catch","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","cond","cond->","cond->>","condp","conj!","conj","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","dedupe","def","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj!","disj","dissoc!","dissoc","distinct","distinct?","do","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-data","ex-info","extend","extend-protocol","extend-type","extenders","extends?","false?","ffirst","file-seq","filter","filterv","finally","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","identical?","identity","if","if-let","if-not","if-some","ifn?","import","in-ns","inc","inc'","init-proxy","instance?","int","int-array","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","let","letfn","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","loop","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","monitor-enter","monitor-exit","munge","name","namespace","namespace-munge","neg?","new","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop!","pop","pop-thread-bindings","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","quot","quote","rand","rand-int","rand-nth","random-sample","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","recur","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-watch","repeat","repeatedly","replace","replicate","require","reset!","reset-meta!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seque","sequence","sequential?","set!","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","slurp","some","some->","some->>","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","symbol","symbol?","sync","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","throw","time","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","try","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","unreduced","unsigned-bit-shift-right","update","update-in","update-proxy","use","val","vals","var","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","vswap!","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"] " Simple word completion for special forms and public vars in clojure.core function! clojurecomplete#Complete(findstart, base) diff --git a/runtime/autoload/context.vim b/runtime/autoload/context.vim new file mode 100644 index 0000000000..254d710c01 --- /dev/null +++ b/runtime/autoload/context.vim @@ -0,0 +1,184 @@ +" 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 diff --git a/runtime/autoload/contextcomplete.vim b/runtime/autoload/contextcomplete.vim new file mode 100644 index 0000000000..5b93bb0986 --- /dev/null +++ b/runtime/autoload/contextcomplete.vim @@ -0,0 +1,25 @@ +" Language: ConTeXt typesetting engine +" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> +" Latest Revision: 2016 Oct 15 + +let s:keepcpo= &cpo +set cpo&vim + +" Complete keywords in MetaPost blocks +function! contextcomplete#Complete(findstart, base) + if a:findstart == 1 + if len(synstack(line('.'), 1)) > 0 && + \ synIDattr(synstack(line('.'), 1)[0], "name") ==# 'contextMPGraphic' + return syntaxcomplete#Complete(a:findstart, a:base) + else + return -3 + endif + else + return syntaxcomplete#Complete(a:findstart, a:base) + endif +endfunction + +let &cpo = s:keepcpo +unlet s:keepcpo + +" vim: sw=2 fdm=marker diff --git a/runtime/autoload/csscomplete.vim b/runtime/autoload/csscomplete.vim index 50048a37fd..f6c5a6c391 100644 --- a/runtime/autoload/csscomplete.vim +++ b/runtime/autoload/csscomplete.vim @@ -4,7 +4,7 @@ " plus CSS Speech Module <http://www.w3.org/TR/css3-speech/> " Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com ) " Original Author: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2016 Jan 11 +" Last Change: 2018 Jul 02 let s:values = split("all additive-symbols align-content align-items align-self animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size block-size border border-block-end border-block-end-color border-block-end-style border-block-end-width border-block-start border-block-start-color border-block-start-style border-block-start-width border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-inline-end border-inline-end-color border-inline-end-style border-inline-end-width border-inline-start border-inline-start-color border-inline-start-style border-inline-start-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side clear clip clip-path color columns column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width content counter-increment counter-reset cue cue-before cue-after cursor direction display empty-cells fallback filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font font-family font-feature-settings font-kerning font-language-override font-size font-size-adjust font-stretch font-style font-synthesis font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric font-variant-position font-weight grid grid-area grid-auto-columns grid-auto-flow grid-auto-position grid-auto-rows grid-column grid-column-start grid-column-end grid-row grid-row-start grid-row-end grid-template grid-template-areas grid-template-rows grid-template-columns height hyphens image-rendering image-resolution image-orientation ime-mode inline-size isolation justify-content left letter-spacing line-break line-height list-style list-style-image list-style-position list-style-type margin margin-block-end margin-block-start margin-bottom margin-inline-end margin-inline-start margin-left margin-right margin-top marks mask mask-type max-block-size max-height max-inline-size max-width max-zoom min-block-size min-height min-inline-size min-width min-zoom mix-blend-mode negative object-fit object-position offset-block-end offset-block-start offset-inline-end offset-inline-start opacity order orientation orphans outline outline-color outline-offset outline-style outline-width overflow overflow-wrap overflow-x overflow-y pad padding padding-block-end padding-block-start padding-bottom padding-inline-end padding-inline-start padding-left padding-right padding-top page-break-after page-break-before page-break-inside pause-before pause-after pause perspective perspective-origin pointer-events position prefix quotes range resize rest rest-before rest-after right ruby-align ruby-merge ruby-position scroll-behavior scroll-snap-coordinate scroll-snap-destination scroll-snap-points-x scroll-snap-points-y scroll-snap-type scroll-snap-type-x scroll-snap-type-y shape-image-threshold shape-margin shape-outside speak speak-as suffix symbols system table-layout tab-size text-align text-align-last text-combine-upright text-decoration text-decoration-color text-decoration-line text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-orientation text-overflow text-rendering text-shadow text-transform text-underline-position top touch-action transform transform-box transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi unicode-range user-zoom vertical-align visibility voice-balance voice-duration voice-family voice-pitch voice-rate voice-range voice-stress voice-volume white-space widows width will-change word-break word-spacing word-wrap writing-mode z-index zoom") @@ -19,7 +19,6 @@ function! csscomplete#CompleteCSS(findstart, base) while start >= 0 && line[start - 1] =~ '\%(\k\|-\)' let start -= 1 endwhile - let b:after = line[compl_begin :] let b:compl_context = line[0:compl_begin] return start endif @@ -37,11 +36,14 @@ function! csscomplete#CompleteCSS(findstart, base) " 5. if @ complete at-rule " 6. if ! complete important if exists("b:compl_context") + let line = getline('.') + let compl_begin = col('.') - 2 + let after = line[compl_begin:] let line = b:compl_context - let after = b:after unlet! b:compl_context else let line = a:base + let after = '' endif let res = [] diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim new file mode 100644 index 0000000000..160cdcff64 --- /dev/null +++ b/runtime/autoload/dist/ft.vim @@ -0,0 +1,745 @@ +" Vim functions for file type detection +" +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2017 Dec 05 + +" 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 + let save_cursor = getpos('.') + call cursor(1,1) + let has_use = search('^use\s\s*\k', 'c', 30) + call setpos('.', save_cursor) + if has_use + 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 "plain" 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/gzip.vim b/runtime/autoload/gzip.vim index a6b4605b06..e4adec0947 100644 --- a/runtime/autoload/gzip.vim +++ b/runtime/autoload/gzip.vim @@ -1,6 +1,6 @@ " Vim autoload file for editing compressed files. " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Nov 05 +" Last Change: 2016 Sep 28 " These functions are used by the gzip plugin. @@ -63,6 +63,9 @@ fun gzip#read(cmd) " set 'modifiable' let ma_save = &ma setlocal ma + " set 'write' + let write_save = &write + set write " Reset 'foldenable', otherwise line numbers get adjusted. if has("folding") let fen_save = &fen @@ -127,6 +130,7 @@ fun gzip#read(cmd) let &pm = pm_save let &cpo = cpo_save let &l:ma = ma_save + let &write = write_save if has("folding") let &l:fen = fen_save endif diff --git a/runtime/autoload/haskellcomplete.vim b/runtime/autoload/haskellcomplete.vim new file mode 100644 index 0000000000..520ab93700 --- /dev/null +++ b/runtime/autoload/haskellcomplete.vim @@ -0,0 +1,3382 @@ +" Vim completion script +" Language: Haskell +" Maintainer: Daniel Campoverde <alx@sillybytes.net> +" URL: https://github.com/alx741/haskellcomplete.vim +" Last Change: 2018 Aug 26 + +" Usage: setlocal omnifunc=haskellcomplete#Complete + + +" Language extensions from: +" https://hackage.haskell.org/package/Cabal-2.2.0.1/docs/Language-Haskell-Extension.html +" +" GHC options from: +" https://downloads.haskell.org/~ghc/7.0.4/docs/html/users_guide/flag-reference.html +" https://downloads.haskell.org/~ghc/8.4.3/docs/html/users_guide/flags.html + + + +" Available completions +let b:completingLangExtension = 0 +let b:completingOptionsGHC = 0 +let b:completingModule = 0 + +function! haskellcomplete#Complete(findstart, base) + if a:findstart + let l:line = getline('.') + let l:start = col('.') - 1 + + if l:line =~ '^\s*{-#\s*LANGUAGE.*' + while l:start >= 0 && l:line[l:start - 1] !~ '[, ]' + let l:start -= 1 + endwhile + let b:completingLangExtension = 1 + return l:start + + elseif l:line =~ '^\s*{-#\s*OPTIONS_GHC.*' + while l:start >= 0 && l:line[l:start - 1] !~ '[, ]' + let l:start -= 1 + endwhile + let b:completingOptionsGHC = 1 + return l:start + + elseif l:line =~ '^\s*import\s*.*' + while l:start >= 0 && l:line[l:start - 1] !~ ' ' + let l:start -= 1 + endwhile + let b:completingModule = 1 + return l:start + + endif + + return start + endif + + if b:completingLangExtension + if a:base ==? "" + " Return all posible Lang extensions + return s:langExtensions + else + let l:matches = [] + for extension in s:langExtensions + if extension =~? '^' . a:base + call add(l:matches, extension) + endif + endfor + return l:matches + endif + + + elseif b:completingOptionsGHC + if a:base ==? "" + " Return all posible GHC options + return s:optionsGHC + else + let l:matches = [] + for flag in s:optionsGHC + if flag =~? '^' . a:base + call add(l:matches, flag) + endif + endfor + return l:matches + endif + + + elseif b:completingModule + if a:base ==? "" + " Return all posible modules + return s:commonModules + else + let l:matches = [] + for module in s:commonModules + if module =~? '^' . a:base + call add(l:matches, module) + endif + endfor + return l:matches + endif + + endif + + return -1 +endfunction + +let s:langExtensions = + \ [ "OverlappingInstances" + \ , "UndecidableInstances" + \ , "IncoherentInstances" + \ , "DoRec" + \ , "RecursiveDo" + \ , "ParallelListComp" + \ , "MultiParamTypeClasses" + \ , "MonomorphismRestriction" + \ , "FunctionalDependencies" + \ , "Rank2Types" + \ , "RankNTypes" + \ , "PolymorphicComponents" + \ , "ExistentialQuantification" + \ , "ScopedTypeVariables" + \ , "PatternSignatures" + \ , "ImplicitParams" + \ , "FlexibleContexts" + \ , "FlexibleInstances" + \ , "EmptyDataDecls" + \ , "CPP" + \ , "KindSignatures" + \ , "BangPatterns" + \ , "TypeSynonymInstances" + \ , "TemplateHaskell" + \ , "ForeignFunctionInterface" + \ , "Arrows" + \ , "Generics" + \ , "ImplicitPrelude" + \ , "NamedFieldPuns" + \ , "PatternGuards" + \ , "GeneralizedNewtypeDeriving" + \ , "ExtensibleRecords" + \ , "RestrictedTypeSynonyms" + \ , "HereDocuments" + \ , "MagicHash" + \ , "TypeFamilies" + \ , "StandaloneDeriving" + \ , "UnicodeSyntax" + \ , "UnliftedFFITypes" + \ , "InterruptibleFFI" + \ , "CApiFFI" + \ , "LiberalTypeSynonyms" + \ , "TypeOperators" + \ , "RecordWildCards" + \ , "RecordPuns" + \ , "DisambiguateRecordFields" + \ , "TraditionalRecordSyntax" + \ , "OverloadedStrings" + \ , "GADTs" + \ , "GADTSyntax" + \ , "MonoPatBinds" + \ , "RelaxedPolyRec" + \ , "ExtendedDefaultRules" + \ , "UnboxedTuples" + \ , "DeriveDataTypeable" + \ , "DeriveGeneric" + \ , "DefaultSignatures" + \ , "InstanceSigs" + \ , "ConstrainedClassMethods" + \ , "PackageImports" + \ , "ImpredicativeTypes" + \ , "NewQualifiedOperators" + \ , "PostfixOperators" + \ , "QuasiQuotes" + \ , "TransformListComp" + \ , "MonadComprehensions" + \ , "ViewPatterns" + \ , "XmlSyntax" + \ , "RegularPatterns" + \ , "TupleSections" + \ , "GHCForeignImportPrim" + \ , "NPlusKPatterns" + \ , "DoAndIfThenElse" + \ , "MultiWayIf" + \ , "LambdaCase" + \ , "RebindableSyntax" + \ , "ExplicitForAll" + \ , "DatatypeContexts" + \ , "MonoLocalBinds" + \ , "DeriveFunctor" + \ , "DeriveTraversable" + \ , "DeriveFoldable" + \ , "NondecreasingIndentation" + \ , "SafeImports" + \ , "Safe" + \ , "Trustworthy" + \ , "Unsafe" + \ , "ConstraintKinds" + \ , "PolyKinds" + \ , "DataKinds" + \ , "ParallelArrays" + \ , "RoleAnnotations" + \ , "OverloadedLists" + \ , "EmptyCase" + \ , "AutoDeriveTypeable" + \ , "NegativeLiterals" + \ , "BinaryLiterals" + \ , "NumDecimals" + \ , "NullaryTypeClasses" + \ , "ExplicitNamespaces" + \ , "AllowAmbiguousTypes" + \ , "JavaScriptFFI" + \ , "PatternSynonyms" + \ , "PartialTypeSignatures" + \ , "NamedWildCards" + \ , "DeriveAnyClass" + \ , "DeriveLift" + \ , "StaticPointers" + \ , "StrictData" + \ , "Strict" + \ , "ApplicativeDo" + \ , "DuplicateRecordFields" + \ , "TypeApplications" + \ , "TypeInType" + \ , "UndecidableSuperClasses" + \ , "MonadFailDesugaring" + \ , "TemplateHaskellQuotes" + \ , "OverloadedLabels" + \ , "TypeFamilyDependencies" + \ , "DerivingStrategies" + \ , "UnboxedSums" + \ , "HexFloatLiterals" + \ ] + +let s:optionsGHC = + \ [ "-n" + \ , "-v" + \ , "-vn" + \ , "-c" + \ , "-hcsuf" + \ , "-hidir" + \ , "-hisuf" + \ , "-o" + \ , "-odir" + \ , "-ohi" + \ , "-osuf" + \ , "-stubdir" + \ , "-outputdir" + \ , "-keep-hc-file" + \ , "-keep-llvm-file" + \ , "-keep-s-file" + \ , "-keep-raw-s-file" + \ , "-keep-tmp-files" + \ , "-tmpdir" + \ , "-ddump-hi" + \ , "-ddump-hi-diffs" + \ , "-ddump-minimal-imports" + \ , "-fforce-recomp" + \ , "-fno-force-recomp" + \ , "-fbreak-on-exception" + \ , "-fno-break-on-exception" + \ , "-fbreak-on-error" + \ , "-fno-break-on-error" + \ , "-fprint-evld-with-show" + \ , "-fno-print-evld-with-show" + \ , "-fprint-bind-result" + \ , "-fno-print-bind-result" + \ , "-fno-print-bind-contents" + \ , "-fno-implicit-import-qualified" + \ , "-package-name" + \ , "-no-auto-link-packages" + \ , "-fglasgow-exts" + \ , "-fno-glasgow-exts" + \ , "-XOverlappingInstances" + \ , "-XNoOverlappingInstances" + \ , "-XIncoherentInstances" + \ , "-XNoIncoherentInstances" + \ , "-XUndecidableInstances" + \ , "-XNoUndecidableInstances" + \ , "-fcontext-stack=Nn" + \ , "-XArrows" + \ , "-XNoArrows" + \ , "-XDisambiguateRecordFields" + \ , "-XNoDisambiguateRecordFields" + \ , "-XForeignFunctionInterface" + \ , "-XNoForeignFunctionInterface" + \ , "-XGenerics" + \ , "-XNoGenerics" + \ , "-XImplicitParams" + \ , "-XNoImplicitParams" + \ , "-firrefutable-tuples" + \ , "-fno-irrefutable-tuples" + \ , "-XNoImplicitPrelude" + \ , "-XImplicitPrelude" + \ , "-XRebindableSyntax" + \ , "-XNoRebindableSyntax" + \ , "-XNoMonomorphismRestriction" + \ , "-XMonomorphismRrestriction" + \ , "-XNoNPlusKPatterns" + \ , "-XNPlusKPatterns" + \ , "-XNoMonoPatBinds" + \ , "-XMonoPatBinds" + \ , "-XRelaxedPolyRec" + \ , "-XNoRelaxedPolyRec" + \ , "-XExtendedDefaultRules" + \ , "-XNoExtendedDefaultRules" + \ , "-XOverloadedStrings" + \ , "-XNoOverloadedStrings" + \ , "-XGADTs" + \ , "-XNoGADTs" + \ , "-XTypeFamilies" + \ , "-XNoTypeFamilies" + \ , "-XScopedTypeVariables" + \ , "-XNoScopedTypeVariables" + \ , "-XMonoLocalBinds" + \ , "-XNoMonoLocalBinds" + \ , "-XTemplateHaskell" + \ , "-XNoTemplateHaskell" + \ , "-XQuasiQuotes" + \ , "-XNoQuasiQuotes" + \ , "-XBangPatterns" + \ , "-XNoBangPatterns" + \ , "-XCPP" + \ , "-XNoCPP" + \ , "-XPatternGuards" + \ , "-XNoPatternGuards" + \ , "-XViewPatterns" + \ , "-XNoViewPatterns" + \ , "-XUnicodeSyntax" + \ , "-XNoUnicodeSyntax" + \ , "-XMagicHash" + \ , "-XNoMagicHash" + \ , "-XNewQualifiedOperators" + \ , "-XNoNewQualifiedOperators" + \ , "-XExplicitForALl" + \ , "-XNoExplicitForAll" + \ , "-XPolymorphicComponents" + \ , "-XNoPolymorphicComponents" + \ , "-XRank2Types" + \ , "-XNoRank2Types" + \ , "-XRankNTypes" + \ , "-XNoRankNTypes" + \ , "-XImpredicativeTypes" + \ , "-XNoImpredicativeTypes" + \ , "-XExistentialQuantification" + \ , "-XNoExistentialQuantification" + \ , "-XKindSignatures" + \ , "-XNoKindSignatures" + \ , "-XEmptyDataDecls" + \ , "-XNoEmptyDataDecls" + \ , "-XParallelListComp" + \ , "-XNoParallelListComp" + \ , "-XTransformListComp" + \ , "-XNoTransformListComp" + \ , "-XUnliftedFFITypes" + \ , "-XNoUnliftedFFITypes" + \ , "-XLiberalTypeSynonyms" + \ , "-XNoLiberalTypeSynonyms" + \ , "-XTypeOperators" + \ , "-XNoTypeOperators" + \ , "-XDoRec" + \ , "-XNoDoRec" + \ , "-XRecursiveDo" + \ , "-XNoRecursiveDo" + \ , "-XPArr" + \ , "-XNoPArr" + \ , "-XRecordWildCards" + \ , "-XNoRecordWildCards" + \ , "-XNamedFieldPuns" + \ , "-XNoNamedFieldPuns" + \ , "-XDisambiguateRecordFields" + \ , "-XNoDisambiguateRecordFields" + \ , "-XUnboxedTuples" + \ , "-XNoUnboxedTuples" + \ , "-XStandaloneDeriving" + \ , "-XNoStandaloneDeriving" + \ , "-XDeriveDataTypeable" + \ , "-XNoDeriveDataTypeable" + \ , "-XGeneralizedNewtypeDeriving" + \ , "-XNoGeneralizedNewtypeDeriving" + \ , "-XTypeSynonymInstances" + \ , "-XNoTypeSynonymInstances" + \ , "-XFlexibleContexts" + \ , "-XNoFlexibleContexts" + \ , "-XFlexibleInstances" + \ , "-XNoFlexibleInstances" + \ , "-XConstrainedClassMethods" + \ , "-XNoConstrainedClassMethods" + \ , "-XMultiParamTypeClasses" + \ , "-XNoMultiParamTypeClasses" + \ , "-XFunctionalDependencies" + \ , "-XNoFunctionalDependencies" + \ , "-XPackageImports" + \ , "-XNoPackageImports" + \ , "-W" + \ , "-w" + \ , "-w" + \ , "-Wall" + \ , "-w" + \ , "-Werror" + \ , "-Wwarn" + \ , "-Wwarn" + \ , "-Werror" + \ , "-fwarn-unrecognised-pragmas" + \ , "-fno-warn-unrecognised-pragmas" + \ , "-fwarn-warnings-deprecations" + \ , "-fno-warn-warnings-deprecations" + \ , "-fwarn-deprecated-flags" + \ , "-fno-warn-deprecated-flags" + \ , "-fwarn-duplicate-exports" + \ , "-fno-warn-duplicate-exports" + \ , "-fwarn-hi-shadowing" + \ , "-fno-warn-hi-shadowing" + \ , "-fwarn-implicit-prelude" + \ , "-fno-warn-implicit-prelude" + \ , "-fwarn-incomplete-patterns" + \ , "-fno-warn-incomplete-patterns" + \ , "-fwarn-incomplete-record-updates" + \ , "-fno-warn-incomplete-record-updates" + \ , "-fwarn-lazy-unlifted-bindings" + \ , "-fno-warn-lazy-unlifted-bindings" + \ , "-fwarn-missing-fields" + \ , "-fno-warn-missing-fields" + \ , "-fwarn-missing-import-lists" + \ , "-fnowarn-missing-import-lists" + \ , "-fwarn-missing-methods" + \ , "-fno-warn-missing-methods" + \ , "-fwarn-missing-signatures" + \ , "-fno-warn-missing-signatures" + \ , "-fwarn-name-shadowing" + \ , "-fno-warn-name-shadowing" + \ , "-fwarn-orphans" + \ , "-fno-warn-orphans" + \ , "-fwarn-overlapping-patterns" + \ , "-fno-warn-overlapping-patterns" + \ , "-fwarn-tabs" + \ , "-fno-warn-tabs" + \ , "-fwarn-type-defaults" + \ , "-fno-warn-type-defaults" + \ , "-fwarn-monomorphism-restriction" + \ , "-fno-warn-monomorphism-restriction" + \ , "-fwarn-unused-binds" + \ , "-fno-warn-unused-binds" + \ , "-fwarn-unused-imports" + \ , "-fno-warn-unused-imports" + \ , "-fwarn-unused-matches" + \ , "-fno-warn-unused-matches" + \ , "-fwarn-unused-do-bind" + \ , "-fno-warn-unused-do-bind" + \ , "-fwarn-wrong-do-bind" + \ , "-fno-warn-wrong-do-bind" + \ , "-O" + \ , "-O0" + \ , "-On" + \ , "-O0" + \ , "-fcase-merge" + \ , "-fno-case-merge" + \ , "-fmethod-sharing" + \ , "-fno-method-sharing" + \ , "-fdo-eta-reduction" + \ , "-fno-do-eta-reduction" + \ , "-fdo-lambda-eta-expansion" + \ , "-fno-do-lambda-eta-expansion" + \ , "-fexcess-precision" + \ , "-fno-excess-precision" + \ , "-fignore-asserts" + \ , "-fno-ignore-asserts" + \ , "-fignore-interface-pragmas" + \ , "-fno-ignore-interface-pragmas" + \ , "-fomit-interface-pragmas" + \ , "-fno-omit-interface-pragmas" + \ , "-fsimplifier-phases" + \ , "-fmax-simplifier-iterations" + \ , "-fcse" + \ , "-fno-cse" + \ , "-fspecialise" + \ , "-fno-specialise" + \ , "-ffull-laziness" + \ , "-fno-full-laziness" + \ , "-ffloat-in" + \ , "-fno-float-in" + \ , "-fenable-rewrite-rules" + \ , "-fno-enable-rewrite-rules" + \ , "-fstrictness" + \ , "-fno-strictness" + \ , "-fstrictness=before=n" + \ , "-fspec-constr" + \ , "-fno-spec-constr" + \ , "-fliberate-case" + \ , "-fno-liberate-case" + \ , "-fstatic-argument-transformation" + \ , "-fno-static-argument-transformation" + \ , "-funbox-strict-fields" + \ , "-fno-unbox-strict-fields" + \ , "-feager-blackholing" + \ , "-auto" + \ , "-no-auto" + \ , "-auto-all" + \ , "-no-auto-all" + \ , "-caf-all" + \ , "-no-caf-all" + \ , "-hpcdir" + \ , "-F" + \ , "-cpp" + \ , "-Dsymbol[=value]" + \ , "-Usymbol" + \ , "-Usymbol" + \ , "-Idir" + \ , "-fasm" + \ , "-fvia-C" + \ , "-fvia-C" + \ , "-fasm" + \ , "-fllvm" + \ , "-fasm" + \ , "-fno-code" + \ , "-fbyte-code" + \ , "-fobject-code" + \ , "-shared" + \ , "-dynamic" + \ , "-framework" + \ , "-framework-path" + \ , "-llib" + \ , "-Ldir" + \ , "-main-is" + \ , "--mk-dll" + \ , "-no-hs-main" + \ , "-rtsopts," + \ , "-with-rtsopts=opts" + \ , "-no-link" + \ , "-split-objs" + \ , "-fno-gen-manifest" + \ , "-fno-embed-manifest" + \ , "-fno-shared-implib" + \ , "-dylib-install-name" + \ , "-pgmL" + \ , "-pgmP" + \ , "-pgmc" + \ , "-pgmm" + \ , "-pgms" + \ , "-pgma" + \ , "-pgml" + \ , "-pgmdll" + \ , "-pgmF" + \ , "-pgmwindres" + \ , "-optL" + \ , "-optP" + \ , "-optF" + \ , "-optc" + \ , "-optlo" + \ , "-optlc" + \ , "-optm" + \ , "-opta" + \ , "-optl" + \ , "-optdll" + \ , "-optwindres" + \ , "-msse2" + \ , "-monly-[432]-regs" + \ , "-fext-core" + \ , "-dcore-lint" + \ , "-ddump-asm" + \ , "-ddump-bcos" + \ , "-ddump-cmm" + \ , "-ddump-cpranal" + \ , "-ddump-cse" + \ , "-ddump-deriv" + \ , "-ddump-ds" + \ , "-ddump-flatC" + \ , "-ddump-foreign" + \ , "-ddump-hpc" + \ , "-ddump-inlinings" + \ , "-ddump-llvm" + \ , "-ddump-occur-anal" + \ , "-ddump-opt-cmm" + \ , "-ddump-parsed" + \ , "-ddump-prep" + \ , "-ddump-rn" + \ , "-ddump-rules" + \ , "-ddump-simpl" + \ , "-ddump-simpl-phases" + \ , "-ddump-simpl-iterations" + \ , "-ddump-spec" + \ , "-ddump-splices" + \ , "-ddump-stg" + \ , "-ddump-stranal" + \ , "-ddump-tc" + \ , "-ddump-types" + \ , "-ddump-worker-wrapper" + \ , "-ddump-if-trace" + \ , "-ddump-tc-trace" + \ , "-ddump-rn-trace" + \ , "-ddump-rn-stats" + \ , "-ddump-simpl-stats" + \ , "-dsource-stats" + \ , "-dcmm-lint" + \ , "-dstg-lint" + \ , "-dstg-stats" + \ , "-dverbose-core2core" + \ , "-dverbose-stg2stg" + \ , "-dshow-passes" + \ , "-dfaststring-stats" + \ , "-fno-asm-mangling" + \ , "-fno-ghci-sandbox" + \ , "-fdiagnostics-color=" + \ , "-fdiagnostics-show-caret" + \ , "-fno-diagnostics-show-caret" + \ , "-ferror-spans" + \ , "-fhide-source-paths" + \ , "-fprint-equality-relations" + \ , "-fno-print-equality-relations" + \ , "-fprint-expanded-synonyms" + \ , "-fno-print-expanded-synonyms" + \ , "-fprint-explicit-coercions" + \ , "-fno-print-explicit-coercions" + \ , "-fprint-explicit-foralls" + \ , "-fno-print-explicit-foralls" + \ , "-fprint-explicit-kinds" + \ , "-fno-print-explicit-kinds" + \ , "-fprint-explicit-runtime-rep" + \ , "-fno-print-explicit-runtime-reps" + \ , "-fprint-explicit-runtime-reps" + \ , "-fno-print-explicit-runtime-reps" + \ , "-fprint-potential-instances" + \ , "-fno-print-potential-instances" + \ , "-fprint-typechecker-elaboration" + \ , "-fno-print-typechecker-elaboration" + \ , "-fprint-unicode-syntax" + \ , "-fno-print-unicode-syntax" + \ , "-fshow-hole-constraints" + \ , "-Rghc-timing" + \ , "-v" + \ , "-v" + \ , "-F" + \ , "-x" + \ , "--exclude-module=" + \ , "-ddump-mod-cycles" + \ , "-dep-makefile" + \ , "-dep-suffix" + \ , "-dumpdir" + \ , "-hcsuf" + \ , "-hidir" + \ , "-hisuf" + \ , "-include-pkg-deps" + \ , "-o" + \ , "-odir" + \ , "-ohi" + \ , "-osuf" + \ , "-outputdir" + \ , "-stubdir" + \ , "-keep-hc-file," + \ , "-keep-hi-files" + \ , "-no-keep-hi-files" + \ , "-keep-llvm-file," + \ , "-keep-o-files" + \ , "-no-keep-o-files" + \ , "-keep-s-file," + \ , "-keep-tmp-files" + \ , "-tmpdir" + \ , "-i" + \ , "-i[:]*" + \ , "-ddump-hi" + \ , "-ddump-hi-diffs" + \ , "-ddump-minimal-imports" + \ , "-fforce-recomp" + \ , "-fno-force-recomp" + \ , "-fignore-hpc-changes" + \ , "-fno-ignore-hpc-changes" + \ , "-fignore-optim-changes" + \ , "-fno-ignore-optim-changes" + \ , "-fbreak-on-error" + \ , "-fno-break-on-error" + \ , "-fbreak-on-exception" + \ , "-fno-break-on-exception" + \ , "-fghci-hist-size=" + \ , "-flocal-ghci-history" + \ , "-fno-local-ghci-history" + \ , "-fprint-bind-result" + \ , "-fno-print-bind-result" + \ , "-fshow-loaded-modules" + \ , "-ghci-script" + \ , "-ignore-dot-ghci" + \ , "-interactive-print" + \ , "-clear-package-db" + \ , "-distrust" + \ , "-distrust-all-packages" + \ , "-fpackage-trust" + \ , "-global-package-db" + \ , "-hide-all-packages" + \ , "-hide-package" + \ , "-ignore-package" + \ , "-no-auto-link-packages" + \ , "-no-global-package-db" + \ , "-no-user-package-db" + \ , "-package" + \ , "-package-db" + \ , "-package-env" + \ , "-package-id" + \ , "-this-unit-id" + \ , "-trust" + \ , "-user-package-db" + \ , "-fdefer-out-of-scope-variables" + \ , "-fno-defer-out-of-scope-variables" + \ , "-fdefer-type-errors" + \ , "-fno-defer-type-errors" + \ , "-fdefer-typed-holes" + \ , "-fno-defer-typed-holes" + \ , "-fhelpful-errors" + \ , "-fno-helpful-errors" + \ , "-fmax-pmcheck-iterations=" + \ , "-fshow-warning-groups" + \ , "-fno-show-warning-groups" + \ , "-W" + \ , "-w" + \ , "-w" + \ , "-Wall" + \ , "-w" + \ , "-Wall-missed-specialisations" + \ , "-Wno-all-missed-specialisations" + \ , "-Wamp" + \ , "-Wno-amp" + \ , "-Wcompat" + \ , "-Wno-compat" + \ , "-Wcpp-undef" + \ , "-Wdeferred-out-of-scope-variables" + \ , "-Wno-deferred-out-of-scope-variables" + \ , "-Wdeferred-type-errors" + \ , "-Wno-deferred-type-errors" + \ , "-Wdeprecated-flags" + \ , "-Wno-deprecated-flags" + \ , "-Wdeprecations" + \ , "-Wno-deprecations" + \ , "-Wdodgy-exports" + \ , "-Wno-dodgy-exports" + \ , "-Wdodgy-foreign-imports" + \ , "-Wno-dodgy-foreign-import" + \ , "-Wdodgy-imports" + \ , "-Wno-dodgy-imports" + \ , "-Wduplicate-constraints" + \ , "-Wno-duplicate-constraints" + \ , "-Wduplicate-exports" + \ , "-Wno-duplicate-exports" + \ , "-Wempty-enumerations" + \ , "-Wno-empty-enumerations" + \ , "-Werror" + \ , "-Wwarn" + \ , "-Weverything" + \ , "-Whi-shadowing" + \ , "-Wno-hi-shadowing" + \ , "-Widentities" + \ , "-Wno-identities" + \ , "-Wimplicit-prelude" + \ , "-Wno-implicit-prelude" + \ , "-Wincomplete-patterns" + \ , "-Wno-incomplete-patterns" + \ , "-Wincomplete-record-updates" + \ , "-Wno-incomplete-record-updates" + \ , "-Wincomplete-uni-patterns" + \ , "-Wno-incomplete-uni-patterns" + \ , "-Winline-rule-shadowing" + \ , "-Wno-inline-rule-shadowing" + \ , "-Wmissed-specialisations" + \ , "-Wno-missed-specialisations" + \ , "-Wmissing-export-lists" + \ , "-fnowarn-missing-export-lists" + \ , "-Wmissing-exported-signatures" + \ , "-Wno-missing-exported-signatures" + \ , "-Wmissing-exported-sigs" + \ , "-Wno-missing-exported-sigs" + \ , "-Wmissing-fields" + \ , "-Wno-missing-fields" + \ , "-Wmissing-home-modules" + \ , "-Wno-missing-home-modules" + \ , "-Wmissing-import-lists" + \ , "-fnowarn-missing-import-lists" + \ , "-Wmissing-local-signatures" + \ , "-Wno-missing-local-signatures" + \ , "-Wmissing-local-sigs" + \ , "-Wno-missing-local-sigs" + \ , "-Wmissing-methods" + \ , "-Wno-missing-methods" + \ , "-Wmissing-monadfail-instances" + \ , "-Wno-missing-monadfail-instances" + \ , "-Wmissing-pattern-synonym-signatures" + \ , "-Wno-missing-pattern-synonym-signatures" + \ , "-Wmissing-signatures" + \ , "-Wno-missing-signatures" + \ , "-Wmonomorphism-restriction" + \ , "-Wno-monomorphism-restriction" + \ , "-Wname-shadowing" + \ , "-Wno-name-shadowing" + \ , "-Wno-compat" + \ , "-Wcompat" + \ , "-Wnoncanonical-monad-instances" + \ , "-Wno-noncanonical-monad-instances" + \ , "-Wnoncanonical-monadfail-instances" + \ , "-Wno-noncanonical-monadfail-instances" + \ , "-Wnoncanonical-monoid-instances" + \ , "-Wno-noncanonical-monoid-instances" + \ , "-Worphans" + \ , "-Wno-orphans" + \ , "-Woverflowed-literals" + \ , "-Wno-overflowed-literals" + \ , "-Woverlapping-patterns" + \ , "-Wno-overlapping-patterns" + \ , "-Wpartial-fields" + \ , "-Wno-partial-fields" + \ , "-Wpartial-type-signatures" + \ , "-Wno-partial-type-signatures" + \ , "-Wredundant-constraints" + \ , "-Wno-redundant-constraints" + \ , "-Wsafe" + \ , "-Wno-safe" + \ , "-Wsemigroup" + \ , "-Wno-semigroup" + \ , "-Wsimplifiable-class-constraints" + \ , "-Wno-overlapping-patterns" + \ , "-Wtabs" + \ , "-Wno-tabs" + \ , "-Wtrustworthy-safe" + \ , "-Wno-safe" + \ , "-Wtype-defaults" + \ , "-Wno-type-defaults" + \ , "-Wtyped-holes" + \ , "-Wno-typed-holes" + \ , "-Wunbanged-strict-patterns" + \ , "-Wno-unbanged-strict-patterns" + \ , "-Wunrecognised-pragmas" + \ , "-Wno-unrecognised-pragmas" + \ , "-Wunrecognised-warning-flags" + \ , "-Wno-unrecognised-warning-flags" + \ , "-Wunsafe" + \ , "-Wno-unsafe" + \ , "-Wunsupported-calling-conventions" + \ , "-Wno-unsupported-calling-conventions" + \ , "-Wunsupported-llvm-version" + \ , "-Wno-monomorphism-restriction" + \ , "-Wunticked-promoted-constructors" + \ , "-Wno-unticked-promoted-constructors" + \ , "-Wunused-binds" + \ , "-Wno-unused-binds" + \ , "-Wunused-do-bind" + \ , "-Wno-unused-do-bind" + \ , "-Wunused-foralls" + \ , "-Wno-unused-foralls" + \ , "-Wunused-imports" + \ , "-Wno-unused-imports" + \ , "-Wunused-local-binds" + \ , "-Wno-unused-local-binds" + \ , "-Wunused-matches" + \ , "-Wno-unused-matches" + \ , "-Wunused-pattern-binds" + \ , "-Wno-unused-pattern-binds" + \ , "-Wunused-top-binds" + \ , "-Wno-unused-top-binds" + \ , "-Wunused-type-patterns" + \ , "-Wno-unused-type-patterns" + \ , "-Wwarn" + \ , "-Werror" + \ , "-Wwarnings-deprecations" + \ , "-Wno-warnings-deprecations" + \ , "-Wwrong-do-bind" + \ , "-Wno-wrong-do-bind" + \ , "-O," + \ , "-O0" + \ , "-O0" + \ , "-O2" + \ , "-O0" + \ , "-Odph" + \ , "-fcall-arity" + \ , "-fno-call-arity" + \ , "-fcase-folding" + \ , "-fno-case-folding" + \ , "-fcase-merge" + \ , "-fno-case-merge" + \ , "-fcmm-elim-common-blocks" + \ , "-fno-cmm-elim-common-blocks" + \ , "-fcmm-sink" + \ , "-fno-cmm-sink" + \ , "-fcpr-anal" + \ , "-fno-cpr-anal" + \ , "-fcross-module-specialise" + \ , "-fno-cross-module-specialise" + \ , "-fcse" + \ , "-fno-cse" + \ , "-fdicts-cheap" + \ , "-fno-dicts-cheap" + \ , "-fdicts-strict" + \ , "-fno-dicts-strict" + \ , "-fdmd-tx-dict-sel" + \ , "-fno-dmd-tx-dict-sel" + \ , "-fdo-eta-reduction" + \ , "-fno-do-eta-reduction" + \ , "-fdo-lambda-eta-expansion" + \ , "-fno-do-lambda-eta-expansion" + \ , "-feager-blackholing" + \ , "-fenable-rewrite-rules" + \ , "-fno-enable-rewrite-rules" + \ , "-fexcess-precision" + \ , "-fno-excess-precision" + \ , "-fexitification" + \ , "-fno-exitification" + \ , "-fexpose-all-unfoldings" + \ , "-fno-expose-all-unfoldings" + \ , "-ffloat-in" + \ , "-fno-float-in" + \ , "-ffull-laziness" + \ , "-fno-full-laziness" + \ , "-ffun-to-thunk" + \ , "-fno-fun-to-thunk" + \ , "-fignore-asserts" + \ , "-fno-ignore-asserts" + \ , "-fignore-interface-pragmas" + \ , "-fno-ignore-interface-pragmas" + \ , "-flate-dmd-anal" + \ , "-fno-late-dmd-anal" + \ , "-fliberate-case" + \ , "-fno-liberate-case" + \ , "-fliberate-case-threshold=" + \ , "-fno-liberate-case-threshold" + \ , "-fllvm-pass-vectors-in-regs" + \ , "-fno-llvm-pass-vectors-in-regs" + \ , "-floopification" + \ , "-fno-loopification" + \ , "-fmax-inline-alloc-size=" + \ , "-fmax-inline-memcpy-insns=" + \ , "-fmax-inline-memset-insns=" + \ , "-fmax-relevant-binds=" + \ , "-fno-max-relevant-bindings" + \ , "-fmax-simplifier-iterations=" + \ , "-fmax-uncovered-patterns=" + \ , "-fmax-valid-substitutions=" + \ , "-fno-max-valid-substitutions" + \ , "-fmax-worker-args=" + \ , "-fno-opt-coercion" + \ , "-fno-pre-inlining" + \ , "-fno-state-hack" + \ , "-fomit-interface-pragmas" + \ , "-fno-omit-interface-pragmas" + \ , "-fomit-yields" + \ , "-fno-omit-yields" + \ , "-foptimal-applicative-do" + \ , "-fno-optimal-applicative-do" + \ , "-fpedantic-bottoms" + \ , "-fno-pedantic-bottoms" + \ , "-fregs-graph" + \ , "-fno-regs-graph" + \ , "-fregs-iterative" + \ , "-fno-regs-iterative" + \ , "-fsimpl-tick-factor=" + \ , "-fsimplifier-phases=" + \ , "-fsolve-constant-dicts" + \ , "-fno-solve-constant-dicts" + \ , "-fspec-constr" + \ , "-fno-spec-constr" + \ , "-fspec-constr-count=" + \ , "-fno-spec-constr-count" + \ , "-fspec-constr-keen" + \ , "-fno-spec-constr-keen" + \ , "-fspec-constr-threshold=" + \ , "-fno-spec-constr-threshold" + \ , "-fspecialise" + \ , "-fno-specialise" + \ , "-fspecialise-aggressively" + \ , "-fno-specialise-aggressively" + \ , "-fstatic-argument-transformation" + \ , "-fno-static-argument-transformation" + \ , "-fstg-cse" + \ , "-fno-stg-cse" + \ , "-fstrictness" + \ , "-fno-strictness" + \ , "-fstrictness-before=" + \ , "-funbox-small-strict-fields" + \ , "-fno-unbox-small-strict-fields" + \ , "-funbox-strict-fields" + \ , "-fno-unbox-strict-fields" + \ , "-funfolding-creation-threshold=" + \ , "-funfolding-dict-discount=" + \ , "-funfolding-fun-discount=" + \ , "-funfolding-keeness-factor=" + \ , "-funfolding-use-threshold=" + \ , "-fvectorisation-avoidance" + \ , "-fno-vectorisation-avoidance" + \ , "-fvectorise" + \ , "-fno-vectorise" + \ , "-fno-prof-auto" + \ , "-fprof-auto" + \ , "-fno-prof-cafs" + \ , "-fprof-cafs" + \ , "-fno-prof-count-entries" + \ , "-fprof-count-entries" + \ , "-fprof-auto" + \ , "-fno-prof-auto" + \ , "-fprof-auto-calls" + \ , "-fno-prof-auto-calls" + \ , "-fprof-auto-exported" + \ , "-fno-prof-auto" + \ , "-fprof-auto-top" + \ , "-fno-prof-auto" + \ , "-fprof-cafs" + \ , "-fno-prof-cafs" + \ , "-prof" + \ , "-ticky" + \ , "-fhpc" + \ , "-cpp" + \ , "-D[=]" + \ , "-U" + \ , "-I" + \ , "-U" + \ , "-dynamic" + \ , "-too" + \ , "-fasm" + \ , "-fllvm" + \ , "-fbyte-code" + \ , "-fllvm" + \ , "-fasm" + \ , "-fno-code" + \ , "-fobject-code" + \ , "-fPIC" + \ , "-fPIE" + \ , "-fwrite-interface" + \ , "-debug" + \ , "-dylib-install-name" + \ , "-dynamic" + \ , "-dynload" + \ , "-eventlog" + \ , "-fno-embed-manifest" + \ , "-fno-gen-manifest" + \ , "-fno-shared-implib" + \ , "-framework" + \ , "-framework-path" + \ , "-fwhole-archive-hs-libs" + \ , "-L" + \ , "-l" + \ , "-main-is" + \ , "-no-hs-main" + \ , "-no-rtsopts-suggestions" + \ , "-package" + \ , "-pie" + \ , "-rdynamic" + \ , "-rtsopts[=]" + \ , "-shared" + \ , "-split-objs" + \ , "-split-sections" + \ , "-static" + \ , "-staticlib" + \ , "-threaded" + \ , "-with-rtsopts=" + \ , "-fplugin-opt=:" + \ , "-fplugin=" + \ , "-hide-all-plugin-packages" + \ , "-plugin-package" + \ , "-plugin-package-id" + \ , "-pgma" + \ , "-pgmc" + \ , "-pgmdll" + \ , "-pgmF" + \ , "-pgmi" + \ , "-pgmL" + \ , "-pgml" + \ , "-pgmlc" + \ , "-pgmlibtool" + \ , "-pgmlo" + \ , "-pgmP" + \ , "-pgms" + \ , "-pgmwindres" + \ , "-opta" + \ , "-optc" + \ , "-optdll" + \ , "-optF" + \ , "-opti" + \ , "-optL" + \ , "-optl" + \ , "-optlc" + \ , "-optlo" + \ , "-optP" + \ , "-optwindres" + \ , "-msse2" + \ , "-msse4.2" + \ , "-dcmm-lint" + \ , "-dcore-lint" + \ , "-ddump-asm" + \ , "-ddump-asm-expanded" + \ , "-ddump-asm-liveness" + \ , "-ddump-asm-native" + \ , "-ddump-asm-regalloc" + \ , "-ddump-asm-regalloc-stages" + \ , "-ddump-asm-stats" + \ , "-ddump-bcos" + \ , "-ddump-cmm" + \ , "-ddump-cmm-caf" + \ , "-ddump-cmm-cbe" + \ , "-ddump-cmm-cfg" + \ , "-ddump-cmm-cps" + \ , "-ddump-cmm-from-stg" + \ , "-ddump-cmm-info" + \ , "-ddump-cmm-proc" + \ , "-ddump-cmm-procmap" + \ , "-ddump-cmm-raw" + \ , "-ddump-cmm-sink" + \ , "-ddump-cmm-sp" + \ , "-ddump-cmm-split" + \ , "-ddump-cmm-switch" + \ , "-ddump-cmm-verbose" + \ , "-ddump-core-stats" + \ , "-ddump-cse" + \ , "-ddump-deriv" + \ , "-ddump-ds" + \ , "-ddump-ec-trace" + \ , "-ddump-foreign" + \ , "-ddump-if-trace" + \ , "-ddump-inlinings" + \ , "-ddump-json" + \ , "-ddump-llvm" + \ , "-ddump-occur-anal" + \ , "-ddump-opt-cmm" + \ , "-ddump-parsed" + \ , "-ddump-parsed-ast" + \ , "-ddump-prep" + \ , "-ddump-rn" + \ , "-ddump-rn-ast" + \ , "-ddump-rn-stats" + \ , "-ddump-rn-trace" + \ , "-ddump-rule-firings" + \ , "-ddump-rule-rewrites" + \ , "-ddump-rules" + \ , "-ddump-simpl" + \ , "-ddump-simpl-iterations" + \ , "-ddump-simpl-stats" + \ , "-ddump-spec" + \ , "-ddump-splices" + \ , "-ddump-stg" + \ , "-ddump-str-signatures" + \ , "-ddump-stranal" + \ , "-ddump-tc" + \ , "-ddump-tc-ast" + \ , "-ddump-tc-trace" + \ , "-ddump-timings" + \ , "-ddump-to-file" + \ , "-ddump-types" + \ , "-ddump-vect" + \ , "-ddump-vt-trace" + \ , "-ddump-worker-wrapper" + \ , "-dfaststring-stats" + \ , "-dinitial-unique=" + \ , "-dno-debug-output" + \ , "-ddebug-output" + \ , "-dppr-case-as-let" + \ , "-dppr-cols=" + \ , "-dppr-debug" + \ , "-dppr-user-length" + \ , "-dshow-passes" + \ , "-dstg-lint" + \ , "-dsuppress-all" + \ , "-dsuppress-coercions" + \ , "-dsuppress-idinfo" + \ , "-dsuppress-module-prefixes" + \ , "-dsuppress-stg-free-vars" + \ , "-dsuppress-ticks" + \ , "-dsuppress-type-applications" + \ , "-dsuppress-type-signatures" + \ , "-dsuppress-unfoldings" + \ , "-dsuppress-uniques" + \ , "-dsuppress-var-kinds" + \ , "-dth-dec-file=" + \ , "-dunique-increment=" + \ , "-dverbose-core2core" + \ , "-dverbose-stg2stg" + \ , "-falignment-sanitisation" + \ , "-fcatch-bottoms" + \ , "-fllvm-fill-undef-with-garbage" + \ , "-g," + \ , "-fexternal-interpreter" + \ , "-fglasgow-exts" + \ , "-fno-glasgow-exts" + \ , "-ghcversion-file" + \ , "-H" + \ , "-j[]" + \ ] + +let s:commonModules = + \ [ "Distribution.Backpack" + \ , "Distribution.Backpack.ComponentsGraph" + \ , "Distribution.Backpack.Configure" + \ , "Distribution.Backpack.ConfiguredComponent" + \ , "Distribution.Backpack.DescribeUnitId" + \ , "Distribution.Backpack.FullUnitId" + \ , "Distribution.Backpack.LinkedComponent" + \ , "Distribution.Backpack.ModSubst" + \ , "Distribution.Backpack.ModuleShape" + \ , "Distribution.Backpack.PreModuleShape" + \ , "Distribution.CabalSpecVersion" + \ , "Distribution.Compat.Binary" + \ , "Distribution.Compat.CharParsing" + \ , "Distribution.Compat.CreatePipe" + \ , "Distribution.Compat.DList" + \ , "Distribution.Compat.Directory" + \ , "Distribution.Compat.Environment" + \ , "Distribution.Compat.Exception" + \ , "Distribution.Compat.Graph" + \ , "Distribution.Compat.Internal.TempFile" + \ , "Distribution.Compat.Lens" + \ , "Distribution.Compat.Map.Strict" + \ , "Distribution.Compat.Newtype" + \ , "Distribution.Compat.Parsing" + \ , "Distribution.Compat.Prelude.Internal" + \ , "Distribution.Compat.ReadP" + \ , "Distribution.Compat.Semigroup" + \ , "Distribution.Compat.Stack" + \ , "Distribution.Compat.Time" + \ , "Distribution.Compiler" + \ , "Distribution.FieldGrammar" + \ , "Distribution.FieldGrammar.Class" + \ , "Distribution.FieldGrammar.FieldDescrs" + \ , "Distribution.FieldGrammar.Parsec" + \ , "Distribution.FieldGrammar.Pretty" + \ , "Distribution.InstalledPackageInfo" + \ , "Distribution.License" + \ , "Distribution.Make" + \ , "Distribution.ModuleName" + \ , "Distribution.Package" + \ , "Distribution.PackageDescription" + \ , "Distribution.PackageDescription.Check" + \ , "Distribution.PackageDescription.Configuration" + \ , "Distribution.PackageDescription.FieldGrammar" + \ , "Distribution.PackageDescription.Parsec" + \ , "Distribution.PackageDescription.PrettyPrint" + \ , "Distribution.PackageDescription.Quirks" + \ , "Distribution.PackageDescription.Utils" + \ , "Distribution.ParseUtils" + \ , "Distribution.Parsec.Class" + \ , "Distribution.Parsec.Common" + \ , "Distribution.Parsec.ConfVar" + \ , "Distribution.Parsec.Field" + \ , "Distribution.Parsec.FieldLineStream" + \ , "Distribution.Parsec.Lexer" + \ , "Distribution.Parsec.LexerMonad" + \ , "Distribution.Parsec.Newtypes" + \ , "Distribution.Parsec.ParseResult" + \ , "Distribution.Parsec.Parser" + \ , "Distribution.Pretty" + \ , "Distribution.PrettyUtils" + \ , "Distribution.ReadE" + \ , "Distribution.SPDX" + \ , "Distribution.SPDX.License" + \ , "Distribution.SPDX.LicenseExceptionId" + \ , "Distribution.SPDX.LicenseExpression" + \ , "Distribution.SPDX.LicenseId" + \ , "Distribution.SPDX.LicenseReference" + \ , "Distribution.Simple" + \ , "Distribution.Simple.Bench" + \ , "Distribution.Simple.Build" + \ , "Distribution.Simple.Build.Macros" + \ , "Distribution.Simple.Build.PathsModule" + \ , "Distribution.Simple.BuildPaths" + \ , "Distribution.Simple.BuildTarget" + \ , "Distribution.Simple.BuildToolDepends" + \ , "Distribution.Simple.CCompiler" + \ , "Distribution.Simple.Command" + \ , "Distribution.Simple.Compiler" + \ , "Distribution.Simple.Configure" + \ , "Distribution.Simple.Doctest" + \ , "Distribution.Simple.GHC" + \ , "Distribution.Simple.GHCJS" + \ , "Distribution.Simple.Haddock" + \ , "Distribution.Simple.HaskellSuite" + \ , "Distribution.Simple.Hpc" + \ , "Distribution.Simple.Install" + \ , "Distribution.Simple.InstallDirs" + \ , "Distribution.Simple.JHC" + \ , "Distribution.Simple.LHC" + \ , "Distribution.Simple.LocalBuildInfo" + \ , "Distribution.Simple.PackageIndex" + \ , "Distribution.Simple.PreProcess" + \ , "Distribution.Simple.PreProcess.Unlit" + \ , "Distribution.Simple.Program" + \ , "Distribution.Simple.Program.Ar" + \ , "Distribution.Simple.Program.Builtin" + \ , "Distribution.Simple.Program.Db" + \ , "Distribution.Simple.Program.Find" + \ , "Distribution.Simple.Program.GHC" + \ , "Distribution.Simple.Program.HcPkg" + \ , "Distribution.Simple.Program.Hpc" + \ , "Distribution.Simple.Program.Internal" + \ , "Distribution.Simple.Program.Ld" + \ , "Distribution.Simple.Program.ResponseFile" + \ , "Distribution.Simple.Program.Run" + \ , "Distribution.Simple.Program.Script" + \ , "Distribution.Simple.Program.Strip" + \ , "Distribution.Simple.Program.Types" + \ , "Distribution.Simple.Register" + \ , "Distribution.Simple.Setup" + \ , "Distribution.Simple.SrcDist" + \ , "Distribution.Simple.Test" + \ , "Distribution.Simple.Test.ExeV10" + \ , "Distribution.Simple.Test.LibV09" + \ , "Distribution.Simple.Test.Log" + \ , "Distribution.Simple.UHC" + \ , "Distribution.Simple.UserHooks" + \ , "Distribution.Simple.Utils" + \ , "Distribution.System" + \ , "Distribution.TestSuite" + \ , "Distribution.Text" + \ , "Distribution.Types.AbiDependency" + \ , "Distribution.Types.AbiHash" + \ , "Distribution.Types.AnnotatedId" + \ , "Distribution.Types.Benchmark" + \ , "Distribution.Types.Benchmark.Lens" + \ , "Distribution.Types.BenchmarkInterface" + \ , "Distribution.Types.BenchmarkType" + \ , "Distribution.Types.BuildInfo" + \ , "Distribution.Types.BuildInfo.Lens" + \ , "Distribution.Types.BuildType" + \ , "Distribution.Types.Component" + \ , "Distribution.Types.ComponentId" + \ , "Distribution.Types.ComponentInclude" + \ , "Distribution.Types.ComponentLocalBuildInfo" + \ , "Distribution.Types.ComponentName" + \ , "Distribution.Types.ComponentRequestedSpec" + \ , "Distribution.Types.CondTree" + \ , "Distribution.Types.Condition" + \ , "Distribution.Types.Dependency" + \ , "Distribution.Types.DependencyMap" + \ , "Distribution.Types.ExeDependency" + \ , "Distribution.Types.Executable" + \ , "Distribution.Types.Executable.Lens" + \ , "Distribution.Types.ExecutableScope" + \ , "Distribution.Types.ExposedModule" + \ , "Distribution.Types.ForeignLib" + \ , "Distribution.Types.ForeignLib.Lens" + \ , "Distribution.Types.ForeignLibOption" + \ , "Distribution.Types.ForeignLibType" + \ , "Distribution.Types.GenericPackageDescription" + \ , "Distribution.Types.GenericPackageDescription.Lens" + \ , "Distribution.Types.HookedBuildInfo" + \ , "Distribution.Types.IncludeRenaming" + \ , "Distribution.Types.InstalledPackageInfo" + \ , "Distribution.Types.InstalledPackageInfo.FieldGrammar" + \ , "Distribution.Types.InstalledPackageInfo.Lens" + \ , "Distribution.Types.LegacyExeDependency" + \ , "Distribution.Types.Lens" + \ , "Distribution.Types.Library" + \ , "Distribution.Types.Library.Lens" + \ , "Distribution.Types.LocalBuildInfo" + \ , "Distribution.Types.Mixin" + \ , "Distribution.Types.Module" + \ , "Distribution.Types.ModuleReexport" + \ , "Distribution.Types.ModuleRenaming" + \ , "Distribution.Types.MungedPackageId" + \ , "Distribution.Types.MungedPackageName" + \ , "Distribution.Types.PackageDescription" + \ , "Distribution.Types.PackageDescription.Lens" + \ , "Distribution.Types.PackageId" + \ , "Distribution.Types.PackageId.Lens" + \ , "Distribution.Types.PackageName" + \ , "Distribution.Types.PkgconfigDependency" + \ , "Distribution.Types.PkgconfigName" + \ , "Distribution.Types.SetupBuildInfo" + \ , "Distribution.Types.SetupBuildInfo.Lens" + \ , "Distribution.Types.SourceRepo" + \ , "Distribution.Types.SourceRepo.Lens" + \ , "Distribution.Types.TargetInfo" + \ , "Distribution.Types.TestSuite" + \ , "Distribution.Types.TestSuite.Lens" + \ , "Distribution.Types.TestSuiteInterface" + \ , "Distribution.Types.TestType" + \ , "Distribution.Types.UnitId" + \ , "Distribution.Types.UnqualComponentName" + \ , "Distribution.Types.Version" + \ , "Distribution.Types.VersionInterval" + \ , "Distribution.Types.VersionRange" + \ , "Distribution.Utils.Generic" + \ , "Distribution.Utils.IOData" + \ , "Distribution.Utils.LogProgress" + \ , "Distribution.Utils.MapAccum" + \ , "Distribution.Utils.NubList" + \ , "Distribution.Utils.Progress" + \ , "Distribution.Utils.ShortText" + \ , "Distribution.Verbosity" + \ , "Distribution.Version" + \ , "Language.Haskell.Extension" + \ , "Graphics.GLU" + \ , "Graphics.GLU.Callbacks" + \ , "Graphics.GLU.Functions" + \ , "Graphics.GLU.Tokens" + \ , "Graphics.GLU.Types" + \ , "Graphics.UI.GLUT" + \ , "Graphics.UI.GLUT.Begin" + \ , "Graphics.UI.GLUT.Callbacks" + \ , "Graphics.UI.GLUT.Callbacks.Global" + \ , "Graphics.UI.GLUT.Callbacks.Window" + \ , "Graphics.UI.GLUT.Colormap" + \ , "Graphics.UI.GLUT.Debugging" + \ , "Graphics.UI.GLUT.DeviceControl" + \ , "Graphics.UI.GLUT.Fonts" + \ , "Graphics.UI.GLUT.GameMode" + \ , "Graphics.UI.GLUT.Initialization" + \ , "Graphics.UI.GLUT.Menu" + \ , "Graphics.UI.GLUT.Objects" + \ , "Graphics.UI.GLUT.Overlay" + \ , "Graphics.UI.GLUT.State" + \ , "Graphics.UI.GLUT.Window" + \ , "Network.Browser" + \ , "Network.BufferType" + \ , "Network.HTTP" + \ , "Network.HTTP.Auth" + \ , "Network.HTTP.Base" + \ , "Network.HTTP.Cookie" + \ , "Network.HTTP.HandleStream" + \ , "Network.HTTP.Headers" + \ , "Network.HTTP.Proxy" + \ , "Network.HTTP.Stream" + \ , "Network.Stream" + \ , "Network.StreamDebugger" + \ , "Network.StreamSocket" + \ , "Network.TCP" + \ , "Test.HUnit" + \ , "Test.HUnit.Base" + \ , "Test.HUnit.Lang" + \ , "Test.HUnit.Terminal" + \ , "Test.HUnit.Text" + \ , "Data.ObjectName" + \ , "Graphics.Rendering.OpenGL" + \ , "Graphics.Rendering.OpenGL.GL" + \ , "Graphics.Rendering.OpenGL.GL.Antialiasing" + \ , "Graphics.Rendering.OpenGL.GL.BeginEnd" + \ , "Graphics.Rendering.OpenGL.GL.Bitmaps" + \ , "Graphics.Rendering.OpenGL.GL.BufferObjects" + \ , "Graphics.Rendering.OpenGL.GL.Clipping" + \ , "Graphics.Rendering.OpenGL.GL.ColorSum" + \ , "Graphics.Rendering.OpenGL.GL.Colors" + \ , "Graphics.Rendering.OpenGL.GL.ConditionalRendering" + \ , "Graphics.Rendering.OpenGL.GL.CoordTrans" + \ , "Graphics.Rendering.OpenGL.GL.DebugOutput" + \ , "Graphics.Rendering.OpenGL.GL.DisplayLists" + \ , "Graphics.Rendering.OpenGL.GL.Evaluators" + \ , "Graphics.Rendering.OpenGL.GL.Feedback" + \ , "Graphics.Rendering.OpenGL.GL.FlushFinish" + \ , "Graphics.Rendering.OpenGL.GL.Fog" + \ , "Graphics.Rendering.OpenGL.GL.Framebuffer" + \ , "Graphics.Rendering.OpenGL.GL.FramebufferObjects" + \ , "Graphics.Rendering.OpenGL.GL.FramebufferObjects.Attachments" + \ , "Graphics.Rendering.OpenGL.GL.FramebufferObjects.FramebufferObjects" + \ , "Graphics.Rendering.OpenGL.GL.FramebufferObjects.Queries" + \ , "Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferObjects" + \ , "Graphics.Rendering.OpenGL.GL.Hints" + \ , "Graphics.Rendering.OpenGL.GL.LineSegments" + \ , "Graphics.Rendering.OpenGL.GL.PerFragment" + \ , "Graphics.Rendering.OpenGL.GL.PixelRectangles" + \ , "Graphics.Rendering.OpenGL.GL.PixelRectangles.ColorTable" + \ , "Graphics.Rendering.OpenGL.GL.PixelRectangles.Convolution" + \ , "Graphics.Rendering.OpenGL.GL.PixelRectangles.Histogram" + \ , "Graphics.Rendering.OpenGL.GL.PixelRectangles.Minmax" + \ , "Graphics.Rendering.OpenGL.GL.PixelRectangles.PixelMap" + \ , "Graphics.Rendering.OpenGL.GL.PixelRectangles.PixelStorage" + \ , "Graphics.Rendering.OpenGL.GL.PixelRectangles.PixelTransfer" + \ , "Graphics.Rendering.OpenGL.GL.PixelRectangles.Rasterization" + \ , "Graphics.Rendering.OpenGL.GL.PixellikeObject" + \ , "Graphics.Rendering.OpenGL.GL.Points" + \ , "Graphics.Rendering.OpenGL.GL.Polygons" + \ , "Graphics.Rendering.OpenGL.GL.PrimitiveMode" + \ , "Graphics.Rendering.OpenGL.GL.QueryObjects" + \ , "Graphics.Rendering.OpenGL.GL.RasterPos" + \ , "Graphics.Rendering.OpenGL.GL.ReadCopyPixels" + \ , "Graphics.Rendering.OpenGL.GL.Rectangles" + \ , "Graphics.Rendering.OpenGL.GL.SavingState" + \ , "Graphics.Rendering.OpenGL.GL.Selection" + \ , "Graphics.Rendering.OpenGL.GL.Shaders" + \ , "Graphics.Rendering.OpenGL.GL.Shaders.Attribs" + \ , "Graphics.Rendering.OpenGL.GL.Shaders.Limits" + \ , "Graphics.Rendering.OpenGL.GL.Shaders.ProgramBinaries" + \ , "Graphics.Rendering.OpenGL.GL.Shaders.ProgramObjects" + \ , "Graphics.Rendering.OpenGL.GL.Shaders.ShaderBinaries" + \ , "Graphics.Rendering.OpenGL.GL.Shaders.ShaderObjects" + \ , "Graphics.Rendering.OpenGL.GL.Shaders.Uniform" + \ , "Graphics.Rendering.OpenGL.GL.StringQueries" + \ , "Graphics.Rendering.OpenGL.GL.SyncObjects" + \ , "Graphics.Rendering.OpenGL.GL.Tensor" + \ , "Graphics.Rendering.OpenGL.GL.Texturing" + \ , "Graphics.Rendering.OpenGL.GL.Texturing.Application" + \ , "Graphics.Rendering.OpenGL.GL.Texturing.Environments" + \ , "Graphics.Rendering.OpenGL.GL.Texturing.Objects" + \ , "Graphics.Rendering.OpenGL.GL.Texturing.Parameters" + \ , "Graphics.Rendering.OpenGL.GL.Texturing.Queries" + \ , "Graphics.Rendering.OpenGL.GL.Texturing.Specification" + \ , "Graphics.Rendering.OpenGL.GL.TransformFeedback" + \ , "Graphics.Rendering.OpenGL.GL.VertexArrayObjects" + \ , "Graphics.Rendering.OpenGL.GL.VertexArrays" + \ , "Graphics.Rendering.OpenGL.GL.VertexSpec" + \ , "Graphics.Rendering.OpenGL.GLU" + \ , "Graphics.Rendering.OpenGL.GLU.Errors" + \ , "Graphics.Rendering.OpenGL.GLU.Initialization" + \ , "Graphics.Rendering.OpenGL.GLU.Matrix" + \ , "Graphics.Rendering.OpenGL.GLU.Mipmapping" + \ , "Graphics.Rendering.OpenGL.GLU.NURBS" + \ , "Graphics.Rendering.OpenGL.GLU.Quadrics" + \ , "Graphics.Rendering.OpenGL.GLU.Tessellation" + \ , "Graphics.GL" + \ , "Graphics.GL.AMD" + \ , "Graphics.GL.AMD.BlendMinmaxFactor" + \ , "Graphics.GL.AMD.DebugOutput" + \ , "Graphics.GL.AMD.DepthClampSeparate" + \ , "Graphics.GL.AMD.DrawBuffersBlend" + \ , "Graphics.GL.AMD.FramebufferMultisampleAdvanced" + \ , "Graphics.GL.AMD.FramebufferSamplePositions" + \ , "Graphics.GL.AMD.GPUShaderHalfFloat" + \ , "Graphics.GL.AMD.GPUShaderInt64" + \ , "Graphics.GL.AMD.InterleavedElements" + \ , "Graphics.GL.AMD.MultiDrawIndirect" + \ , "Graphics.GL.AMD.NameGenDelete" + \ , "Graphics.GL.AMD.OcclusionQueryEvent" + \ , "Graphics.GL.AMD.PerformanceMonitor" + \ , "Graphics.GL.AMD.PinnedMemory" + \ , "Graphics.GL.AMD.QueryBufferObject" + \ , "Graphics.GL.AMD.SamplePositions" + \ , "Graphics.GL.AMD.SeamlessCubemapPerTexture" + \ , "Graphics.GL.AMD.SparseTexture" + \ , "Graphics.GL.AMD.StencilOperationExtended" + \ , "Graphics.GL.AMD.TransformFeedback4" + \ , "Graphics.GL.AMD.VertexShaderTessellator" + \ , "Graphics.GL.APPLE" + \ , "Graphics.GL.APPLE.AuxDepthStencil" + \ , "Graphics.GL.APPLE.ClientStorage" + \ , "Graphics.GL.APPLE.ElementArray" + \ , "Graphics.GL.APPLE.Fence" + \ , "Graphics.GL.APPLE.FloatPixels" + \ , "Graphics.GL.APPLE.FlushBufferRange" + \ , "Graphics.GL.APPLE.ObjectPurgeable" + \ , "Graphics.GL.APPLE.RGB422" + \ , "Graphics.GL.APPLE.RowBytes" + \ , "Graphics.GL.APPLE.SpecularVector" + \ , "Graphics.GL.APPLE.TextureRange" + \ , "Graphics.GL.APPLE.TransformHint" + \ , "Graphics.GL.APPLE.VertexArrayObject" + \ , "Graphics.GL.APPLE.VertexArrayRange" + \ , "Graphics.GL.APPLE.VertexProgramEvaluators" + \ , "Graphics.GL.APPLE.YCbCr422" + \ , "Graphics.GL.ARB" + \ , "Graphics.GL.ARB.BaseInstance" + \ , "Graphics.GL.ARB.BindlessTexture" + \ , "Graphics.GL.ARB.BlendFuncExtended" + \ , "Graphics.GL.ARB.BufferStorage" + \ , "Graphics.GL.ARB.CLEvent" + \ , "Graphics.GL.ARB.ClearBufferObject" + \ , "Graphics.GL.ARB.ClearTexture" + \ , "Graphics.GL.ARB.ClipControl" + \ , "Graphics.GL.ARB.ColorBufferFloat" + \ , "Graphics.GL.ARB.CompressedTexturePixelStorage" + \ , "Graphics.GL.ARB.ComputeShader" + \ , "Graphics.GL.ARB.ComputeVariableGroupSize" + \ , "Graphics.GL.ARB.ConditionalRenderInverted" + \ , "Graphics.GL.ARB.CopyBuffer" + \ , "Graphics.GL.ARB.CopyImage" + \ , "Graphics.GL.ARB.CullDistance" + \ , "Graphics.GL.ARB.DebugOutput" + \ , "Graphics.GL.ARB.DepthBufferFloat" + \ , "Graphics.GL.ARB.DepthClamp" + \ , "Graphics.GL.ARB.DepthTexture" + \ , "Graphics.GL.ARB.DirectStateAccess" + \ , "Graphics.GL.ARB.DrawBuffers" + \ , "Graphics.GL.ARB.DrawBuffersBlend" + \ , "Graphics.GL.ARB.DrawElementsBaseVertex" + \ , "Graphics.GL.ARB.DrawIndirect" + \ , "Graphics.GL.ARB.DrawInstanced" + \ , "Graphics.GL.ARB.ES2Compatibility" + \ , "Graphics.GL.ARB.ES31Compatibility" + \ , "Graphics.GL.ARB.ES32Compatibility" + \ , "Graphics.GL.ARB.ES3Compatibility" + \ , "Graphics.GL.ARB.EnhancedLayouts" + \ , "Graphics.GL.ARB.ExplicitUniformLocation" + \ , "Graphics.GL.ARB.FragmentProgram" + \ , "Graphics.GL.ARB.FragmentShader" + \ , "Graphics.GL.ARB.FramebufferNoAttachments" + \ , "Graphics.GL.ARB.FramebufferObjectCompatibility" + \ , "Graphics.GL.ARB.FramebufferObjectCore" + \ , "Graphics.GL.ARB.FramebufferSRGB" + \ , "Graphics.GL.ARB.GPUShader5" + \ , "Graphics.GL.ARB.GPUShaderFP64" + \ , "Graphics.GL.ARB.GPUShaderInt64" + \ , "Graphics.GL.ARB.GeometryShader4" + \ , "Graphics.GL.ARB.GetProgramBinary" + \ , "Graphics.GL.ARB.GetTextureSubImage" + \ , "Graphics.GL.ARB.GlSpirv" + \ , "Graphics.GL.ARB.HalfFloatPixel" + \ , "Graphics.GL.ARB.HalfFloatVertex" + \ , "Graphics.GL.ARB.ImagingCompatibility" + \ , "Graphics.GL.ARB.ImagingCore" + \ , "Graphics.GL.ARB.IndirectParameters" + \ , "Graphics.GL.ARB.InstancedArrays" + \ , "Graphics.GL.ARB.InternalformatQuery" + \ , "Graphics.GL.ARB.InternalformatQuery2" + \ , "Graphics.GL.ARB.InvalidateSubdata" + \ , "Graphics.GL.ARB.MapBufferAlignment" + \ , "Graphics.GL.ARB.MapBufferRange" + \ , "Graphics.GL.ARB.MatrixPalette" + \ , "Graphics.GL.ARB.MultiBind" + \ , "Graphics.GL.ARB.MultiDrawIndirect" + \ , "Graphics.GL.ARB.Multisample" + \ , "Graphics.GL.ARB.Multitexture" + \ , "Graphics.GL.ARB.OcclusionQuery" + \ , "Graphics.GL.ARB.OcclusionQuery2" + \ , "Graphics.GL.ARB.ParallelShaderCompile" + \ , "Graphics.GL.ARB.PipelineStatisticsQuery" + \ , "Graphics.GL.ARB.PixelBufferObject" + \ , "Graphics.GL.ARB.PointParameters" + \ , "Graphics.GL.ARB.PointSprite" + \ , "Graphics.GL.ARB.PolygonOffsetClamp" + \ , "Graphics.GL.ARB.ProgramInterfaceQuery" + \ , "Graphics.GL.ARB.ProvokingVertex" + \ , "Graphics.GL.ARB.QueryBufferObject" + \ , "Graphics.GL.ARB.RobustnessCompatibility" + \ , "Graphics.GL.ARB.RobustnessCore" + \ , "Graphics.GL.ARB.SampleLocations" + \ , "Graphics.GL.ARB.SampleShading" + \ , "Graphics.GL.ARB.SamplerObjects" + \ , "Graphics.GL.ARB.SeamlessCubeMap" + \ , "Graphics.GL.ARB.SeamlessCubemapPerTexture" + \ , "Graphics.GL.ARB.SeparateShaderObjects" + \ , "Graphics.GL.ARB.ShaderAtomicCounters" + \ , "Graphics.GL.ARB.ShaderImageLoadStore" + \ , "Graphics.GL.ARB.ShaderObjects" + \ , "Graphics.GL.ARB.ShaderStorageBufferObject" + \ , "Graphics.GL.ARB.ShaderSubroutine" + \ , "Graphics.GL.ARB.ShadingLanguage100" + \ , "Graphics.GL.ARB.ShadingLanguageInclude" + \ , "Graphics.GL.ARB.Shadow" + \ , "Graphics.GL.ARB.ShadowAmbient" + \ , "Graphics.GL.ARB.SparseBuffer" + \ , "Graphics.GL.ARB.SparseTexture" + \ , "Graphics.GL.ARB.SpirvExtensions" + \ , "Graphics.GL.ARB.StencilTexturing" + \ , "Graphics.GL.ARB.Sync" + \ , "Graphics.GL.ARB.TessellationShader" + \ , "Graphics.GL.ARB.TextureBarrier" + \ , "Graphics.GL.ARB.TextureBorderClamp" + \ , "Graphics.GL.ARB.TextureBufferObject" + \ , "Graphics.GL.ARB.TextureBufferObjectRGB32" + \ , "Graphics.GL.ARB.TextureBufferRange" + \ , "Graphics.GL.ARB.TextureCompression" + \ , "Graphics.GL.ARB.TextureCompressionBPTC" + \ , "Graphics.GL.ARB.TextureCompressionRGTC" + \ , "Graphics.GL.ARB.TextureCubeMap" + \ , "Graphics.GL.ARB.TextureCubeMapArray" + \ , "Graphics.GL.ARB.TextureEnvCombine" + \ , "Graphics.GL.ARB.TextureEnvDot3" + \ , "Graphics.GL.ARB.TextureFilterAnisotropic" + \ , "Graphics.GL.ARB.TextureFilterMinmax" + \ , "Graphics.GL.ARB.TextureFloat" + \ , "Graphics.GL.ARB.TextureGather" + \ , "Graphics.GL.ARB.TextureMirrorClampToEdge" + \ , "Graphics.GL.ARB.TextureMirroredRepeat" + \ , "Graphics.GL.ARB.TextureMultisample" + \ , "Graphics.GL.ARB.TextureRG" + \ , "Graphics.GL.ARB.TextureRGB10A2UI" + \ , "Graphics.GL.ARB.TextureRectangle" + \ , "Graphics.GL.ARB.TextureStencil8" + \ , "Graphics.GL.ARB.TextureStorage" + \ , "Graphics.GL.ARB.TextureStorageMultisample" + \ , "Graphics.GL.ARB.TextureSwizzle" + \ , "Graphics.GL.ARB.TextureView" + \ , "Graphics.GL.ARB.TimerQuery" + \ , "Graphics.GL.ARB.TransformFeedback2" + \ , "Graphics.GL.ARB.TransformFeedback3" + \ , "Graphics.GL.ARB.TransformFeedbackInstanced" + \ , "Graphics.GL.ARB.TransformFeedbackOverflowQuery" + \ , "Graphics.GL.ARB.TransposeMatrix" + \ , "Graphics.GL.ARB.UniformBufferObject" + \ , "Graphics.GL.ARB.VertexArrayBGRA" + \ , "Graphics.GL.ARB.VertexArrayObject" + \ , "Graphics.GL.ARB.VertexAttrib64Bit" + \ , "Graphics.GL.ARB.VertexAttribBinding" + \ , "Graphics.GL.ARB.VertexBlend" + \ , "Graphics.GL.ARB.VertexBufferObject" + \ , "Graphics.GL.ARB.VertexProgram" + \ , "Graphics.GL.ARB.VertexShader" + \ , "Graphics.GL.ARB.VertexType10f11f11fRev" + \ , "Graphics.GL.ARB.VertexType2101010RevCompatibility" + \ , "Graphics.GL.ARB.VertexType2101010RevCore" + \ , "Graphics.GL.ARB.ViewportArray" + \ , "Graphics.GL.ARB.WindowPos" + \ , "Graphics.GL.ATI" + \ , "Graphics.GL.ATI.DrawBuffers" + \ , "Graphics.GL.ATI.ElementArray" + \ , "Graphics.GL.ATI.EnvmapBumpmap" + \ , "Graphics.GL.ATI.FragmentShader" + \ , "Graphics.GL.ATI.MapObjectBuffer" + \ , "Graphics.GL.ATI.Meminfo" + \ , "Graphics.GL.ATI.PNTriangles" + \ , "Graphics.GL.ATI.PixelFormatFloat" + \ , "Graphics.GL.ATI.SeparateStencil" + \ , "Graphics.GL.ATI.TextFragmentShader" + \ , "Graphics.GL.ATI.TextureEnvCombine3" + \ , "Graphics.GL.ATI.TextureFloat" + \ , "Graphics.GL.ATI.TextureMirrorOnce" + \ , "Graphics.GL.ATI.VertexArrayObject" + \ , "Graphics.GL.ATI.VertexAttribArrayObject" + \ , "Graphics.GL.ATI.VertexStreams" + \ , "Graphics.GL.Compatibility30" + \ , "Graphics.GL.Compatibility31" + \ , "Graphics.GL.Compatibility32" + \ , "Graphics.GL.Compatibility33" + \ , "Graphics.GL.Compatibility40" + \ , "Graphics.GL.Compatibility41" + \ , "Graphics.GL.Compatibility42" + \ , "Graphics.GL.Compatibility43" + \ , "Graphics.GL.Compatibility44" + \ , "Graphics.GL.Compatibility45" + \ , "Graphics.GL.Compatibility46" + \ , "Graphics.GL.Core30" + \ , "Graphics.GL.Core31" + \ , "Graphics.GL.Core32" + \ , "Graphics.GL.Core33" + \ , "Graphics.GL.Core40" + \ , "Graphics.GL.Core41" + \ , "Graphics.GL.Core42" + \ , "Graphics.GL.Core43" + \ , "Graphics.GL.Core44" + \ , "Graphics.GL.Core45" + \ , "Graphics.GL.Core46" + \ , "Graphics.GL.EXT" + \ , "Graphics.GL.EXT.ABGR" + \ , "Graphics.GL.EXT.BGRA" + \ , "Graphics.GL.EXT.BindableUniform" + \ , "Graphics.GL.EXT.BlendColor" + \ , "Graphics.GL.EXT.BlendEquationSeparate" + \ , "Graphics.GL.EXT.BlendFuncSeparate" + \ , "Graphics.GL.EXT.BlendMinmax" + \ , "Graphics.GL.EXT.BlendSubtract" + \ , "Graphics.GL.EXT.CMYKA" + \ , "Graphics.GL.EXT.ClipVolumeHint" + \ , "Graphics.GL.EXT.ColorSubtable" + \ , "Graphics.GL.EXT.CompiledVertexArray" + \ , "Graphics.GL.EXT.Convolution" + \ , "Graphics.GL.EXT.CoordinateFrame" + \ , "Graphics.GL.EXT.CopyTexture" + \ , "Graphics.GL.EXT.CullVertex" + \ , "Graphics.GL.EXT.DebugLabel" + \ , "Graphics.GL.EXT.DebugMarker" + \ , "Graphics.GL.EXT.DepthBoundsTest" + \ , "Graphics.GL.EXT.DirectStateAccess" + \ , "Graphics.GL.EXT.DrawBuffers2" + \ , "Graphics.GL.EXT.DrawInstanced" + \ , "Graphics.GL.EXT.DrawRangeElements" + \ , "Graphics.GL.EXT.EglImageStorage" + \ , "Graphics.GL.EXT.ExternalBuffer" + \ , "Graphics.GL.EXT.FogCoord" + \ , "Graphics.GL.EXT.FourTwoTwoPixels" + \ , "Graphics.GL.EXT.FramebufferBlit" + \ , "Graphics.GL.EXT.FramebufferMultisample" + \ , "Graphics.GL.EXT.FramebufferMultisampleBlitScaled" + \ , "Graphics.GL.EXT.FramebufferObject" + \ , "Graphics.GL.EXT.FramebufferSRGB" + \ , "Graphics.GL.EXT.GPUProgramParameters" + \ , "Graphics.GL.EXT.GPUShader4" + \ , "Graphics.GL.EXT.GeometryShader4" + \ , "Graphics.GL.EXT.Histogram" + \ , "Graphics.GL.EXT.IndexArrayFormats" + \ , "Graphics.GL.EXT.IndexFunc" + \ , "Graphics.GL.EXT.IndexMaterial" + \ , "Graphics.GL.EXT.LightTexture" + \ , "Graphics.GL.EXT.MemoryObject" + \ , "Graphics.GL.EXT.MemoryObjectFd" + \ , "Graphics.GL.EXT.MemoryObjectWin32" + \ , "Graphics.GL.EXT.MultiDrawArrays" + \ , "Graphics.GL.EXT.Multisample" + \ , "Graphics.GL.EXT.PackedDepthStencil" + \ , "Graphics.GL.EXT.PackedFloat" + \ , "Graphics.GL.EXT.PackedPixels" + \ , "Graphics.GL.EXT.PalettedTexture" + \ , "Graphics.GL.EXT.PixelBufferObject" + \ , "Graphics.GL.EXT.PixelTransform" + \ , "Graphics.GL.EXT.PointParameters" + \ , "Graphics.GL.EXT.PolygonOffset" + \ , "Graphics.GL.EXT.PolygonOffsetClamp" + \ , "Graphics.GL.EXT.ProvokingVertex" + \ , "Graphics.GL.EXT.RasterMultisample" + \ , "Graphics.GL.EXT.RescaleNormal" + \ , "Graphics.GL.EXT.SecondaryColor" + \ , "Graphics.GL.EXT.Semaphore" + \ , "Graphics.GL.EXT.SemaphoreFd" + \ , "Graphics.GL.EXT.SemaphoreWin32" + \ , "Graphics.GL.EXT.SeparateShaderObjects" + \ , "Graphics.GL.EXT.SeparateSpecularColor" + \ , "Graphics.GL.EXT.ShaderFramebufferFetch" + \ , "Graphics.GL.EXT.ShaderFramebufferFetchNonCoherent" + \ , "Graphics.GL.EXT.ShaderImageLoadStore" + \ , "Graphics.GL.EXT.SharedTexturePalette" + \ , "Graphics.GL.EXT.StencilClearTag" + \ , "Graphics.GL.EXT.StencilTwoSide" + \ , "Graphics.GL.EXT.StencilWrap" + \ , "Graphics.GL.EXT.Subtexture" + \ , "Graphics.GL.EXT.Texture" + \ , "Graphics.GL.EXT.Texture3D" + \ , "Graphics.GL.EXT.TextureArray" + \ , "Graphics.GL.EXT.TextureBufferObject" + \ , "Graphics.GL.EXT.TextureCompressionLATC" + \ , "Graphics.GL.EXT.TextureCompressionRGTC" + \ , "Graphics.GL.EXT.TextureCompressionS3TC" + \ , "Graphics.GL.EXT.TextureCubeMap" + \ , "Graphics.GL.EXT.TextureEnvCombine" + \ , "Graphics.GL.EXT.TextureEnvDot3" + \ , "Graphics.GL.EXT.TextureFilterAnisotropic" + \ , "Graphics.GL.EXT.TextureFilterMinmax" + \ , "Graphics.GL.EXT.TextureInteger" + \ , "Graphics.GL.EXT.TextureLODBias" + \ , "Graphics.GL.EXT.TextureMirrorClamp" + \ , "Graphics.GL.EXT.TextureObject" + \ , "Graphics.GL.EXT.TexturePerturbNormal" + \ , "Graphics.GL.EXT.TextureSNorm" + \ , "Graphics.GL.EXT.TextureSRGB" + \ , "Graphics.GL.EXT.TextureSRGBDecode" + \ , "Graphics.GL.EXT.TextureSharedExponent" + \ , "Graphics.GL.EXT.TextureSwizzle" + \ , "Graphics.GL.EXT.TimerQuery" + \ , "Graphics.GL.EXT.TransformFeedback" + \ , "Graphics.GL.EXT.VertexArray" + \ , "Graphics.GL.EXT.VertexArrayBGRA" + \ , "Graphics.GL.EXT.VertexAttrib64Bit" + \ , "Graphics.GL.EXT.VertexShader" + \ , "Graphics.GL.EXT.VertexWeighting" + \ , "Graphics.GL.EXT.Win32KeyedMutex" + \ , "Graphics.GL.EXT.WindowRectangles" + \ , "Graphics.GL.EXT.X11SyncObject" + \ , "Graphics.GL.Functions" + \ , "Graphics.GL.GREMEDY" + \ , "Graphics.GL.GREMEDY.FrameTerminator" + \ , "Graphics.GL.GREMEDY.StringMarker" + \ , "Graphics.GL.GetProcAddress" + \ , "Graphics.GL.Groups" + \ , "Graphics.GL.HP" + \ , "Graphics.GL.HP.ConvolutionBorderModes" + \ , "Graphics.GL.HP.ImageTransform" + \ , "Graphics.GL.HP.OcclusionTest" + \ , "Graphics.GL.HP.TextureLighting" + \ , "Graphics.GL.IBM" + \ , "Graphics.GL.IBM.CullVertex" + \ , "Graphics.GL.IBM.MultimodeDrawArrays" + \ , "Graphics.GL.IBM.RasterposClip" + \ , "Graphics.GL.IBM.StaticData" + \ , "Graphics.GL.IBM.TextureMirroredRepeat" + \ , "Graphics.GL.IBM.VertexArrayLists" + \ , "Graphics.GL.INGR" + \ , "Graphics.GL.INGR.BlendFuncSeparate" + \ , "Graphics.GL.INGR.ColorClamp" + \ , "Graphics.GL.INGR.InterlaceRead" + \ , "Graphics.GL.INTEL" + \ , "Graphics.GL.INTEL.BlackholeRender" + \ , "Graphics.GL.INTEL.ConservativeRasterization" + \ , "Graphics.GL.INTEL.FramebufferCmaa" + \ , "Graphics.GL.INTEL.MapTexture" + \ , "Graphics.GL.INTEL.ParallelArrays" + \ , "Graphics.GL.INTEL.PerformanceQuery" + \ , "Graphics.GL.KHR" + \ , "Graphics.GL.KHR.BlendEquationAdvanced" + \ , "Graphics.GL.KHR.BlendEquationAdvancedCoherent" + \ , "Graphics.GL.KHR.ContextFlushControl" + \ , "Graphics.GL.KHR.DebugCompatibility" + \ , "Graphics.GL.KHR.DebugCore" + \ , "Graphics.GL.KHR.NoError" + \ , "Graphics.GL.KHR.ParallelShaderCompile" + \ , "Graphics.GL.KHR.Robustness" + \ , "Graphics.GL.KHR.TextureCompressionASTCHDR" + \ , "Graphics.GL.KHR.TextureCompressionASTCLDR" + \ , "Graphics.GL.MESA" + \ , "Graphics.GL.MESA.PackInvert" + \ , "Graphics.GL.MESA.ProgramBinaryFormats" + \ , "Graphics.GL.MESA.ResizeBuffers" + \ , "Graphics.GL.MESA.TileRasterOrder" + \ , "Graphics.GL.MESA.WindowPos" + \ , "Graphics.GL.MESA.YCbCrTexture" + \ , "Graphics.GL.MESAX" + \ , "Graphics.GL.MESAX.TextureStack" + \ , "Graphics.GL.NV" + \ , "Graphics.GL.NV.AlphaToCoverageDitherControl" + \ , "Graphics.GL.NV.BindlessMultiDrawIndirect" + \ , "Graphics.GL.NV.BindlessMultiDrawIndirectCount" + \ , "Graphics.GL.NV.BindlessTexture" + \ , "Graphics.GL.NV.BlendEquationAdvanced" + \ , "Graphics.GL.NV.BlendEquationAdvancedCoherent" + \ , "Graphics.GL.NV.BlendMinmaxFactor" + \ , "Graphics.GL.NV.ClipSpaceWScaling" + \ , "Graphics.GL.NV.CommandList" + \ , "Graphics.GL.NV.ComputeProgram5" + \ , "Graphics.GL.NV.ConditionalRender" + \ , "Graphics.GL.NV.ConservativeRaster" + \ , "Graphics.GL.NV.ConservativeRasterDilate" + \ , "Graphics.GL.NV.ConservativeRasterPreSnap" + \ , "Graphics.GL.NV.ConservativeRasterPreSnapTriangles" + \ , "Graphics.GL.NV.CopyDepthToColor" + \ , "Graphics.GL.NV.CopyImage" + \ , "Graphics.GL.NV.DeepTexture3D" + \ , "Graphics.GL.NV.DepthBufferFloat" + \ , "Graphics.GL.NV.DepthClamp" + \ , "Graphics.GL.NV.DrawTexture" + \ , "Graphics.GL.NV.DrawVulkanImage" + \ , "Graphics.GL.NV.Evaluators" + \ , "Graphics.GL.NV.ExplicitMultisample" + \ , "Graphics.GL.NV.Fence" + \ , "Graphics.GL.NV.FillRectangle" + \ , "Graphics.GL.NV.FloatBuffer" + \ , "Graphics.GL.NV.FogDistance" + \ , "Graphics.GL.NV.FragmentCoverageToColor" + \ , "Graphics.GL.NV.FragmentProgram" + \ , "Graphics.GL.NV.FragmentProgram2" + \ , "Graphics.GL.NV.FramebufferMixedSamples" + \ , "Graphics.GL.NV.FramebufferMultisampleCoverage" + \ , "Graphics.GL.NV.GPUMulticast" + \ , "Graphics.GL.NV.GPUProgram4" + \ , "Graphics.GL.NV.GPUProgram5" + \ , "Graphics.GL.NV.GPUShader5" + \ , "Graphics.GL.NV.GeometryProgram4" + \ , "Graphics.GL.NV.HalfFloat" + \ , "Graphics.GL.NV.InternalformatSampleQuery" + \ , "Graphics.GL.NV.LightMaxExponent" + \ , "Graphics.GL.NV.MultisampleCoverage" + \ , "Graphics.GL.NV.MultisampleFilterHint" + \ , "Graphics.GL.NV.OcclusionQuery" + \ , "Graphics.GL.NV.PackedDepthStencil" + \ , "Graphics.GL.NV.ParameterBufferObject" + \ , "Graphics.GL.NV.PathRenderingCompatibility" + \ , "Graphics.GL.NV.PathRenderingCore" + \ , "Graphics.GL.NV.PathRenderingSharedEdge" + \ , "Graphics.GL.NV.PixelDataRange" + \ , "Graphics.GL.NV.PointSprite" + \ , "Graphics.GL.NV.PresentVideo" + \ , "Graphics.GL.NV.PrimitiveRestart" + \ , "Graphics.GL.NV.QueryResource" + \ , "Graphics.GL.NV.QueryResourceTag" + \ , "Graphics.GL.NV.RegisterCombiners" + \ , "Graphics.GL.NV.RegisterCombiners2" + \ , "Graphics.GL.NV.RobustnessVideoMemoryPurge" + \ , "Graphics.GL.NV.SampleLocations" + \ , "Graphics.GL.NV.ShaderBufferLoad" + \ , "Graphics.GL.NV.ShaderBufferStore" + \ , "Graphics.GL.NV.ShaderThreadGroup" + \ , "Graphics.GL.NV.TessellationProgram5" + \ , "Graphics.GL.NV.TexgenEmboss" + \ , "Graphics.GL.NV.TexgenReflection" + \ , "Graphics.GL.NV.TextureBarrier" + \ , "Graphics.GL.NV.TextureEnvCombine4" + \ , "Graphics.GL.NV.TextureExpandNormal" + \ , "Graphics.GL.NV.TextureMultisample" + \ , "Graphics.GL.NV.TextureRectangle" + \ , "Graphics.GL.NV.TextureShader" + \ , "Graphics.GL.NV.TextureShader2" + \ , "Graphics.GL.NV.TextureShader3" + \ , "Graphics.GL.NV.TransformFeedback" + \ , "Graphics.GL.NV.TransformFeedback2" + \ , "Graphics.GL.NV.UniformBufferUnifiedMemory" + \ , "Graphics.GL.NV.VDPAUInterop" + \ , "Graphics.GL.NV.VertexArrayRange" + \ , "Graphics.GL.NV.VertexArrayRange2" + \ , "Graphics.GL.NV.VertexAttribInteger64Bit" + \ , "Graphics.GL.NV.VertexBufferUnifiedMemory" + \ , "Graphics.GL.NV.VertexProgram" + \ , "Graphics.GL.NV.VertexProgram2Option" + \ , "Graphics.GL.NV.VertexProgram3" + \ , "Graphics.GL.NV.VertexProgram4" + \ , "Graphics.GL.NV.VideoCapture" + \ , "Graphics.GL.NV.ViewportSwizzle" + \ , "Graphics.GL.NVX" + \ , "Graphics.GL.NVX.ConditionalRender" + \ , "Graphics.GL.NVX.GPUMemoryInfo" + \ , "Graphics.GL.NVX.LinkedGPUMulticast" + \ , "Graphics.GL.OES" + \ , "Graphics.GL.OES.ByteCoordinates" + \ , "Graphics.GL.OES.CompressedPalettedTexture" + \ , "Graphics.GL.OES.FixedPoint" + \ , "Graphics.GL.OES.QueryMatrix" + \ , "Graphics.GL.OES.ReadFormat" + \ , "Graphics.GL.OES.SinglePrecision" + \ , "Graphics.GL.OML" + \ , "Graphics.GL.OML.Interlace" + \ , "Graphics.GL.OML.Resample" + \ , "Graphics.GL.OML.Subsample" + \ , "Graphics.GL.OVR" + \ , "Graphics.GL.OVR.Multiview" + \ , "Graphics.GL.PGI" + \ , "Graphics.GL.PGI.MiscHints" + \ , "Graphics.GL.PGI.VertexHints" + \ , "Graphics.GL.REND" + \ , "Graphics.GL.REND.ScreenCoordinates" + \ , "Graphics.GL.S3" + \ , "Graphics.GL.S3.S3TC" + \ , "Graphics.GL.SGI" + \ , "Graphics.GL.SGI.ColorMatrix" + \ , "Graphics.GL.SGI.ColorTable" + \ , "Graphics.GL.SGI.TextureColorTable" + \ , "Graphics.GL.SGIS" + \ , "Graphics.GL.SGIS.DetailTexture" + \ , "Graphics.GL.SGIS.FogFunction" + \ , "Graphics.GL.SGIS.GenerateMipmap" + \ , "Graphics.GL.SGIS.Multisample" + \ , "Graphics.GL.SGIS.PixelTexture" + \ , "Graphics.GL.SGIS.PointLineTexgen" + \ , "Graphics.GL.SGIS.PointParameters" + \ , "Graphics.GL.SGIS.SharpenTexture" + \ , "Graphics.GL.SGIS.Texture4D" + \ , "Graphics.GL.SGIS.TextureBorderClamp" + \ , "Graphics.GL.SGIS.TextureColorMask" + \ , "Graphics.GL.SGIS.TextureEdgeClamp" + \ , "Graphics.GL.SGIS.TextureFilter4" + \ , "Graphics.GL.SGIS.TextureLOD" + \ , "Graphics.GL.SGIS.TextureSelect" + \ , "Graphics.GL.SGIX" + \ , "Graphics.GL.SGIX.Async" + \ , "Graphics.GL.SGIX.AsyncHistogram" + \ , "Graphics.GL.SGIX.AsyncPixel" + \ , "Graphics.GL.SGIX.BlendAlphaMinmax" + \ , "Graphics.GL.SGIX.CalligraphicFragment" + \ , "Graphics.GL.SGIX.Clipmap" + \ , "Graphics.GL.SGIX.ConvolutionAccuracy" + \ , "Graphics.GL.SGIX.DepthTexture" + \ , "Graphics.GL.SGIX.FlushRaster" + \ , "Graphics.GL.SGIX.FogOffset" + \ , "Graphics.GL.SGIX.FragmentLighting" + \ , "Graphics.GL.SGIX.Framezoom" + \ , "Graphics.GL.SGIX.IglooInterface" + \ , "Graphics.GL.SGIX.Instruments" + \ , "Graphics.GL.SGIX.Interlace" + \ , "Graphics.GL.SGIX.IrInstrument1" + \ , "Graphics.GL.SGIX.ListPriority" + \ , "Graphics.GL.SGIX.PixelTexture" + \ , "Graphics.GL.SGIX.PixelTiles" + \ , "Graphics.GL.SGIX.PolynomialFFD" + \ , "Graphics.GL.SGIX.ReferencePlane" + \ , "Graphics.GL.SGIX.Resample" + \ , "Graphics.GL.SGIX.ScalebiasHint" + \ , "Graphics.GL.SGIX.Shadow" + \ , "Graphics.GL.SGIX.ShadowAmbient" + \ , "Graphics.GL.SGIX.Sprite" + \ , "Graphics.GL.SGIX.Subsample" + \ , "Graphics.GL.SGIX.TagSampleBuffer" + \ , "Graphics.GL.SGIX.TextureAddEnv" + \ , "Graphics.GL.SGIX.TextureCoordinateClamp" + \ , "Graphics.GL.SGIX.TextureLODBias" + \ , "Graphics.GL.SGIX.TextureMultiBuffer" + \ , "Graphics.GL.SGIX.TextureScaleBias" + \ , "Graphics.GL.SGIX.VertexPreclip" + \ , "Graphics.GL.SGIX.YCrCb" + \ , "Graphics.GL.SGIX.YCrCbA" + \ , "Graphics.GL.SUN" + \ , "Graphics.GL.SUN.ConvolutionBorderModes" + \ , "Graphics.GL.SUN.GlobalAlpha" + \ , "Graphics.GL.SUN.MeshArray" + \ , "Graphics.GL.SUN.SliceAccum" + \ , "Graphics.GL.SUN.TriangleList" + \ , "Graphics.GL.SUN.Vertex" + \ , "Graphics.GL.SUNX" + \ , "Graphics.GL.SUNX.ConstantData" + \ , "Graphics.GL.ThreeDFX" + \ , "Graphics.GL.ThreeDFX.Multisample" + \ , "Graphics.GL.ThreeDFX.Tbuffer" + \ , "Graphics.GL.ThreeDFX.TextureCompressionFXT1" + \ , "Graphics.GL.Tokens" + \ , "Graphics.GL.Types" + \ , "Graphics.GL.Version10" + \ , "Graphics.GL.Version11" + \ , "Graphics.GL.Version12" + \ , "Graphics.GL.Version13" + \ , "Graphics.GL.Version14" + \ , "Graphics.GL.Version15" + \ , "Graphics.GL.Version20" + \ , "Graphics.GL.Version21" + \ , "Graphics.GL.WIN" + \ , "Graphics.GL.WIN.PhongShading" + \ , "Graphics.GL.WIN.SpecularFog" + \ , "Test.QuickCheck" + \ , "Test.QuickCheck.All" + \ , "Test.QuickCheck.Arbitrary" + \ , "Test.QuickCheck.Exception" + \ , "Test.QuickCheck.Function" + \ , "Test.QuickCheck.Gen" + \ , "Test.QuickCheck.Gen.Unsafe" + \ , "Test.QuickCheck.Modifiers" + \ , "Test.QuickCheck.Monadic" + \ , "Test.QuickCheck.Poly" + \ , "Test.QuickCheck.Property" + \ , "Test.QuickCheck.Random" + \ , "Test.QuickCheck.State" + \ , "Test.QuickCheck.Test" + \ , "Test.QuickCheck.Text" + \ , "Data.StateVar" + \ , "Graphics.Win32" + \ , "Graphics.Win32.Control" + \ , "Graphics.Win32.Dialogue" + \ , "Graphics.Win32.GDI" + \ , "Graphics.Win32.GDI.AlphaBlend" + \ , "Graphics.Win32.GDI.Bitmap" + \ , "Graphics.Win32.GDI.Brush" + \ , "Graphics.Win32.GDI.Clip" + \ , "Graphics.Win32.GDI.Font" + \ , "Graphics.Win32.GDI.Graphics2D" + \ , "Graphics.Win32.GDI.HDC" + \ , "Graphics.Win32.GDI.Palette" + \ , "Graphics.Win32.GDI.Path" + \ , "Graphics.Win32.GDI.Pen" + \ , "Graphics.Win32.GDI.Region" + \ , "Graphics.Win32.GDI.Types" + \ , "Graphics.Win32.Icon" + \ , "Graphics.Win32.Key" + \ , "Graphics.Win32.LayeredWindow" + \ , "Graphics.Win32.Menu" + \ , "Graphics.Win32.Message" + \ , "Graphics.Win32.Misc" + \ , "Graphics.Win32.Resource" + \ , "Graphics.Win32.Window" + \ , "Graphics.Win32.Window.AnimateWindow" + \ , "Graphics.Win32.Window.ForegroundWindow" + \ , "Graphics.Win32.Window.HotKey" + \ , "Graphics.Win32.Window.IMM" + \ , "Graphics.Win32.Window.PostMessage" + \ , "Media.Win32" + \ , "System.Win32" + \ , "System.Win32.Automation" + \ , "System.Win32.Automation.Input" + \ , "System.Win32.Automation.Input.Key" + \ , "System.Win32.Automation.Input.Mouse" + \ , "System.Win32.Console" + \ , "System.Win32.Console.CtrlHandler" + \ , "System.Win32.Console.HWND" + \ , "System.Win32.Console.Title" + \ , "System.Win32.DLL" + \ , "System.Win32.DebugApi" + \ , "System.Win32.Encoding" + \ , "System.Win32.Exception.Unsupported" + \ , "System.Win32.File" + \ , "System.Win32.FileMapping" + \ , "System.Win32.HardLink" + \ , "System.Win32.Info" + \ , "System.Win32.Info.Computer" + \ , "System.Win32.Info.Version" + \ , "System.Win32.Mem" + \ , "System.Win32.MinTTY" + \ , "System.Win32.NLS" + \ , "System.Win32.Path" + \ , "System.Win32.Process" + \ , "System.Win32.Registry" + \ , "System.Win32.Security" + \ , "System.Win32.Shell" + \ , "System.Win32.SimpleMAPI" + \ , "System.Win32.String" + \ , "System.Win32.SymbolicLink" + \ , "System.Win32.Thread" + \ , "System.Win32.Time" + \ , "System.Win32.Types" + \ , "System.Win32.Utils" + \ , "System.Win32.Word" + \ , "Data.Array" + \ , "Data.Array.Base" + \ , "Data.Array.IArray" + \ , "Data.Array.IO" + \ , "Data.Array.IO.Internals" + \ , "Data.Array.IO.Safe" + \ , "Data.Array.MArray" + \ , "Data.Array.MArray.Safe" + \ , "Data.Array.ST" + \ , "Data.Array.ST.Safe" + \ , "Data.Array.Storable" + \ , "Data.Array.Storable.Internals" + \ , "Data.Array.Storable.Safe" + \ , "Data.Array.Unboxed" + \ , "Data.Array.Unsafe" + \ , "Control.Concurrent.Async" + \ , "Data.Attoparsec" + \ , "Data.Attoparsec.ByteString" + \ , "Data.Attoparsec.ByteString.Char8" + \ , "Data.Attoparsec.ByteString.Lazy" + \ , "Data.Attoparsec.Char8" + \ , "Data.Attoparsec.Combinator" + \ , "Data.Attoparsec.Internal" + \ , "Data.Attoparsec.Internal.Types" + \ , "Data.Attoparsec.Lazy" + \ , "Data.Attoparsec.Number" + \ , "Data.Attoparsec.Text" + \ , "Data.Attoparsec.Text.Lazy" + \ , "Data.Attoparsec.Types" + \ , "Data.Attoparsec.Zepto" + \ , "Control.Applicative" + \ , "Control.Arrow" + \ , "Control.Category" + \ , "Control.Concurrent" + \ , "Control.Concurrent.Chan" + \ , "Control.Concurrent.MVar" + \ , "Control.Concurrent.QSem" + \ , "Control.Concurrent.QSemN" + \ , "Control.Exception" + \ , "Control.Exception.Base" + \ , "Control.Monad" + \ , "Control.Monad.Fail" + \ , "Control.Monad.Fix" + \ , "Control.Monad.IO.Class" + \ , "Control.Monad.Instances" + \ , "Control.Monad.ST" + \ , "Control.Monad.ST.Lazy" + \ , "Control.Monad.ST.Lazy.Safe" + \ , "Control.Monad.ST.Lazy.Unsafe" + \ , "Control.Monad.ST.Safe" + \ , "Control.Monad.ST.Strict" + \ , "Control.Monad.ST.Unsafe" + \ , "Control.Monad.Zip" + \ , "Data.Bifoldable" + \ , "Data.Bifunctor" + \ , "Data.Bitraversable" + \ , "Data.Bits" + \ , "Data.Bool" + \ , "Data.Char" + \ , "Data.Coerce" + \ , "Data.Complex" + \ , "Data.Data" + \ , "Data.Dynamic" + \ , "Data.Either" + \ , "Data.Eq" + \ , "Data.Fixed" + \ , "Data.Foldable" + \ , "Data.Function" + \ , "Data.Functor" + \ , "Data.Functor.Classes" + \ , "Data.Functor.Compose" + \ , "Data.Functor.Const" + \ , "Data.Functor.Identity" + \ , "Data.Functor.Product" + \ , "Data.Functor.Sum" + \ , "Data.IORef" + \ , "Data.Int" + \ , "Data.Ix" + \ , "Data.Kind" + \ , "Data.List" + \ , "Data.List.NonEmpty" + \ , "Data.Maybe" + \ , "Data.Monoid" + \ , "Data.Ord" + \ , "Data.Proxy" + \ , "Data.Ratio" + \ , "Data.STRef" + \ , "Data.STRef.Lazy" + \ , "Data.STRef.Strict" + \ , "Data.Semigroup" + \ , "Data.String" + \ , "Data.Traversable" + \ , "Data.Tuple" + \ , "Data.Type.Bool" + \ , "Data.Type.Coercion" + \ , "Data.Type.Equality" + \ , "Data.Typeable" + \ , "Data.Unique" + \ , "Data.Version" + \ , "Data.Void" + \ , "Data.Word" + \ , "Debug.Trace" + \ , "Foreign" + \ , "Foreign.C" + \ , "Foreign.C.Error" + \ , "Foreign.C.String" + \ , "Foreign.C.Types" + \ , "Foreign.Concurrent" + \ , "Foreign.ForeignPtr" + \ , "Foreign.ForeignPtr.Safe" + \ , "Foreign.ForeignPtr.Unsafe" + \ , "Foreign.Marshal" + \ , "Foreign.Marshal.Alloc" + \ , "Foreign.Marshal.Array" + \ , "Foreign.Marshal.Error" + \ , "Foreign.Marshal.Pool" + \ , "Foreign.Marshal.Safe" + \ , "Foreign.Marshal.Unsafe" + \ , "Foreign.Marshal.Utils" + \ , "Foreign.Ptr" + \ , "Foreign.Safe" + \ , "Foreign.StablePtr" + \ , "Foreign.Storable" + \ , "GHC.Arr" + \ , "GHC.Base" + \ , "GHC.ByteOrder" + \ , "GHC.Char" + \ , "GHC.Clock" + \ , "GHC.Conc" + \ , "GHC.Conc.IO" + \ , "GHC.Conc.Signal" + \ , "GHC.Conc.Sync" + \ , "GHC.ConsoleHandler" + \ , "GHC.Constants" + \ , "GHC.Desugar" + \ , "GHC.Enum" + \ , "GHC.Environment" + \ , "GHC.Err" + \ , "GHC.Event" + \ , "GHC.Exception" + \ , "GHC.ExecutionStack" + \ , "GHC.ExecutionStack.Internal" + \ , "GHC.Exts" + \ , "GHC.Fingerprint" + \ , "GHC.Fingerprint.Type" + \ , "GHC.Float" + \ , "GHC.Float.ConversionUtils" + \ , "GHC.Float.RealFracMethods" + \ , "GHC.Foreign" + \ , "GHC.ForeignPtr" + \ , "GHC.GHCi" + \ , "GHC.Generics" + \ , "GHC.IO" + \ , "GHC.IO.Buffer" + \ , "GHC.IO.BufferedIO" + \ , "GHC.IO.Device" + \ , "GHC.IO.Encoding" + \ , "GHC.IO.Encoding.CodePage" + \ , "GHC.IO.Encoding.Failure" + \ , "GHC.IO.Encoding.Iconv" + \ , "GHC.IO.Encoding.Latin1" + \ , "GHC.IO.Encoding.Types" + \ , "GHC.IO.Encoding.UTF16" + \ , "GHC.IO.Encoding.UTF32" + \ , "GHC.IO.Encoding.UTF8" + \ , "GHC.IO.Exception" + \ , "GHC.IO.FD" + \ , "GHC.IO.Handle" + \ , "GHC.IO.Handle.FD" + \ , "GHC.IO.Handle.Internals" + \ , "GHC.IO.Handle.Lock" + \ , "GHC.IO.Handle.Text" + \ , "GHC.IO.Handle.Types" + \ , "GHC.IO.IOMode" + \ , "GHC.IO.Unsafe" + \ , "GHC.IOArray" + \ , "GHC.IORef" + \ , "GHC.Int" + \ , "GHC.List" + \ , "GHC.MVar" + \ , "GHC.Natural" + \ , "GHC.Num" + \ , "GHC.OldList" + \ , "GHC.OverloadedLabels" + \ , "GHC.PArr" + \ , "GHC.Pack" + \ , "GHC.Profiling" + \ , "GHC.Ptr" + \ , "GHC.RTS.Flags" + \ , "GHC.Read" + \ , "GHC.Real" + \ , "GHC.Records" + \ , "GHC.ST" + \ , "GHC.STRef" + \ , "GHC.Show" + \ , "GHC.Stable" + \ , "GHC.Stack" + \ , "GHC.Stack.CCS" + \ , "GHC.Stack.Types" + \ , "GHC.StaticPtr" + \ , "GHC.Stats" + \ , "GHC.Storable" + \ , "GHC.TopHandler" + \ , "GHC.TypeLits" + \ , "GHC.TypeNats" + \ , "GHC.Unicode" + \ , "GHC.Weak" + \ , "GHC.Word" + \ , "Numeric" + \ , "Numeric.Natural" + \ , "Prelude" + \ , "System.CPUTime" + \ , "System.Console.GetOpt" + \ , "System.Environment" + \ , "System.Environment.Blank" + \ , "System.Exit" + \ , "System.IO" + \ , "System.IO.Error" + \ , "System.IO.Unsafe" + \ , "System.Info" + \ , "System.Mem" + \ , "System.Mem.StableName" + \ , "System.Mem.Weak" + \ , "System.Posix.Internals" + \ , "System.Posix.Types" + \ , "System.Timeout" + \ , "Text.ParserCombinators.ReadP" + \ , "Text.ParserCombinators.ReadPrec" + \ , "Text.Printf" + \ , "Text.Read" + \ , "Text.Read.Lex" + \ , "Text.Show" + \ , "Text.Show.Functions" + \ , "Type.Reflection" + \ , "Type.Reflection.Unsafe" + \ , "Unsafe.Coerce" + \ , "Data.ByteString" + \ , "Data.ByteString.Builder" + \ , "Data.ByteString.Builder.Extra" + \ , "Data.ByteString.Builder.Internal" + \ , "Data.ByteString.Builder.Prim" + \ , "Data.ByteString.Builder.Prim.Internal" + \ , "Data.ByteString.Char8" + \ , "Data.ByteString.Internal" + \ , "Data.ByteString.Lazy" + \ , "Data.ByteString.Lazy.Builder" + \ , "Data.ByteString.Lazy.Builder.ASCII" + \ , "Data.ByteString.Lazy.Builder.Extras" + \ , "Data.ByteString.Lazy.Char8" + \ , "Data.ByteString.Lazy.Internal" + \ , "Data.ByteString.Short" + \ , "Data.ByteString.Short.Internal" + \ , "Data.ByteString.Unsafe" + \ , "Data.CallStack" + \ , "Data.CaseInsensitive" + \ , "Data.CaseInsensitive.Unsafe" + \ , "Network.CGI" + \ , "Network.CGI.Compat" + \ , "Network.CGI.Cookie" + \ , "Network.CGI.Monad" + \ , "Network.CGI.Protocol" + \ , "Data.Graph" + \ , "Data.IntMap" + \ , "Data.IntMap.Internal" + \ , "Data.IntMap.Internal.Debug" + \ , "Data.IntMap.Lazy" + \ , "Data.IntMap.Merge.Lazy" + \ , "Data.IntMap.Merge.Strict" + \ , "Data.IntMap.Strict" + \ , "Data.IntSet" + \ , "Data.IntSet.Internal" + \ , "Data.Map" + \ , "Data.Map.Internal" + \ , "Data.Map.Internal.Debug" + \ , "Data.Map.Lazy" + \ , "Data.Map.Lazy.Merge" + \ , "Data.Map.Merge.Lazy" + \ , "Data.Map.Merge.Strict" + \ , "Data.Map.Strict" + \ , "Data.Map.Strict.Internal" + \ , "Data.Map.Strict.Merge" + \ , "Data.Sequence" + \ , "Data.Sequence.Internal" + \ , "Data.Sequence.Internal.Sorting" + \ , "Data.Set" + \ , "Data.Set.Internal" + \ , "Data.Tree" + \ , "Utils.Containers.Internal.BitQueue" + \ , "Utils.Containers.Internal.BitUtil" + \ , "Utils.Containers.Internal.StrictPair" + \ , "Control.DeepSeq" + \ , "System.Directory" + \ , "System.Directory.Internal" + \ , "System.Directory.Internal.Prelude" + \ , "Control.Monad.Catch" + \ , "Control.Monad.Catch.Pure" + \ , "Control.Exception.Extensible" + \ , "Data.Graph.Inductive" + \ , "Data.Graph.Inductive.Basic" + \ , "Data.Graph.Inductive.Example" + \ , "Data.Graph.Inductive.Graph" + \ , "Data.Graph.Inductive.Internal.Heap" + \ , "Data.Graph.Inductive.Internal.Queue" + \ , "Data.Graph.Inductive.Internal.RootPath" + \ , "Data.Graph.Inductive.Internal.Thread" + \ , "Data.Graph.Inductive.Monad" + \ , "Data.Graph.Inductive.Monad.IOArray" + \ , "Data.Graph.Inductive.Monad.STArray" + \ , "Data.Graph.Inductive.NodeMap" + \ , "Data.Graph.Inductive.PatriciaTree" + \ , "Data.Graph.Inductive.Query" + \ , "Data.Graph.Inductive.Query.ArtPoint" + \ , "Data.Graph.Inductive.Query.BCC" + \ , "Data.Graph.Inductive.Query.BFS" + \ , "Data.Graph.Inductive.Query.DFS" + \ , "Data.Graph.Inductive.Query.Dominators" + \ , "Data.Graph.Inductive.Query.GVD" + \ , "Data.Graph.Inductive.Query.Indep" + \ , "Data.Graph.Inductive.Query.MST" + \ , "Data.Graph.Inductive.Query.MaxFlow" + \ , "Data.Graph.Inductive.Query.MaxFlow2" + \ , "Data.Graph.Inductive.Query.Monad" + \ , "Data.Graph.Inductive.Query.SP" + \ , "Data.Graph.Inductive.Query.TransClos" + \ , "Data.Graph.Inductive.Tree" + \ , "System.FilePath" + \ , "System.FilePath.Posix" + \ , "System.FilePath.Windows" + \ , "Numeric.Fixed" + \ , "Annotations" + \ , "ApiAnnotation" + \ , "Ar" + \ , "AsmCodeGen" + \ , "AsmUtils" + \ , "Avail" + \ , "Bag" + \ , "BasicTypes" + \ , "BinFingerprint" + \ , "BinIface" + \ , "Binary" + \ , "Bitmap" + \ , "BkpSyn" + \ , "BlockId" + \ , "BooleanFormula" + \ , "BufWrite" + \ , "BuildTyCl" + \ , "ByteCodeAsm" + \ , "ByteCodeGen" + \ , "ByteCodeInstr" + \ , "ByteCodeItbls" + \ , "ByteCodeLink" + \ , "ByteCodeTypes" + \ , "CLabel" + \ , "CPrim" + \ , "CSE" + \ , "CallArity" + \ , "CgUtils" + \ , "Check" + \ , "Class" + \ , "CmdLineParser" + \ , "Cmm" + \ , "CmmBuildInfoTables" + \ , "CmmCallConv" + \ , "CmmCommonBlockElim" + \ , "CmmContFlowOpt" + \ , "CmmExpr" + \ , "CmmImplementSwitchPlans" + \ , "CmmInfo" + \ , "CmmLayoutStack" + \ , "CmmLex" + \ , "CmmLint" + \ , "CmmLive" + \ , "CmmMachOp" + \ , "CmmMonad" + \ , "CmmNode" + \ , "CmmOpt" + \ , "CmmParse" + \ , "CmmPipeline" + \ , "CmmProcPoint" + \ , "CmmSink" + \ , "CmmSwitch" + \ , "CmmType" + \ , "CmmUtils" + \ , "CoAxiom" + \ , "CodeGen.Platform" + \ , "CodeGen.Platform.ARM" + \ , "CodeGen.Platform.ARM64" + \ , "CodeGen.Platform.NoRegs" + \ , "CodeGen.Platform.PPC" + \ , "CodeGen.Platform.PPC_Darwin" + \ , "CodeGen.Platform.SPARC" + \ , "CodeGen.Platform.X86" + \ , "CodeGen.Platform.X86_64" + \ , "CodeOutput" + \ , "Coercion" + \ , "ConLike" + \ , "Config" + \ , "Constants" + \ , "Convert" + \ , "CoreArity" + \ , "CoreFVs" + \ , "CoreLint" + \ , "CoreMonad" + \ , "CoreOpt" + \ , "CorePrep" + \ , "CoreSeq" + \ , "CoreStats" + \ , "CoreSubst" + \ , "CoreSyn" + \ , "CoreTidy" + \ , "CoreToStg" + \ , "CoreUnfold" + \ , "CoreUtils" + \ , "CostCentre" + \ , "Coverage" + \ , "Ctype" + \ , "DataCon" + \ , "Debug" + \ , "Debugger" + \ , "DebuggerUtils" + \ , "Demand" + \ , "Desugar" + \ , "Digraph" + \ , "DmdAnal" + \ , "DriverBkp" + \ , "DriverMkDepend" + \ , "DriverPhases" + \ , "DriverPipeline" + \ , "DsArrows" + \ , "DsBinds" + \ , "DsCCall" + \ , "DsExpr" + \ , "DsForeign" + \ , "DsGRHSs" + \ , "DsListComp" + \ , "DsMeta" + \ , "DsMonad" + \ , "DsUsage" + \ , "DsUtils" + \ , "Dwarf" + \ , "Dwarf.Constants" + \ , "Dwarf.Types" + \ , "DynFlags" + \ , "DynamicLoading" + \ , "Elf" + \ , "Encoding" + \ , "EnumSet" + \ , "ErrUtils" + \ , "Exception" + \ , "Exitify" + \ , "FV" + \ , "FamInst" + \ , "FamInstEnv" + \ , "FastFunctions" + \ , "FastMutInt" + \ , "FastString" + \ , "FastStringEnv" + \ , "FieldLabel" + \ , "FileCleanup" + \ , "Finder" + \ , "Fingerprint" + \ , "FiniteMap" + \ , "FlagChecker" + \ , "FloatIn" + \ , "FloatOut" + \ , "ForeignCall" + \ , "Format" + \ , "FunDeps" + \ , "GHC" + \ , "GHCi" + \ , "GhcMake" + \ , "GhcMonad" + \ , "GhcPlugins" + \ , "GraphBase" + \ , "GraphColor" + \ , "GraphOps" + \ , "GraphPpr" + \ , "HaddockUtils" + \ , "HeaderInfo" + \ , "Hooks" + \ , "Hoopl.Block" + \ , "Hoopl.Collections" + \ , "Hoopl.Dataflow" + \ , "Hoopl.Graph" + \ , "Hoopl.Label" + \ , "Hoopl.Unique" + \ , "HsBinds" + \ , "HsDecls" + \ , "HsDoc" + \ , "HsDumpAst" + \ , "HsExpr" + \ , "HsExtension" + \ , "HsImpExp" + \ , "HsLit" + \ , "HsPat" + \ , "HsSyn" + \ , "HsTypes" + \ , "HsUtils" + \ , "HscMain" + \ , "HscStats" + \ , "HscTypes" + \ , "IOEnv" + \ , "Id" + \ , "IdInfo" + \ , "IfaceEnv" + \ , "IfaceSyn" + \ , "IfaceType" + \ , "Inst" + \ , "InstEnv" + \ , "Instruction" + \ , "InteractiveEval" + \ , "InteractiveEvalTypes" + \ , "Json" + \ , "Kind" + \ , "KnownUniques" + \ , "Lexeme" + \ , "Lexer" + \ , "LiberateCase" + \ , "Linker" + \ , "ListSetOps" + \ , "ListT" + \ , "Literal" + \ , "Llvm" + \ , "Llvm.AbsSyn" + \ , "Llvm.MetaData" + \ , "Llvm.PpLlvm" + \ , "Llvm.Types" + \ , "LlvmCodeGen" + \ , "LlvmCodeGen.Base" + \ , "LlvmCodeGen.CodeGen" + \ , "LlvmCodeGen.Data" + \ , "LlvmCodeGen.Ppr" + \ , "LlvmCodeGen.Regs" + \ , "LlvmMangler" + \ , "LoadIface" + \ , "Match" + \ , "MatchCon" + \ , "MatchLit" + \ , "Maybes" + \ , "MkCore" + \ , "MkGraph" + \ , "MkId" + \ , "MkIface" + \ , "Module" + \ , "MonadUtils" + \ , "NCGMonad" + \ , "Name" + \ , "NameCache" + \ , "NameEnv" + \ , "NameSet" + \ , "NameShape" + \ , "OccName" + \ , "OccurAnal" + \ , "OptCoercion" + \ , "OrdList" + \ , "Outputable" + \ , "PIC" + \ , "PPC.CodeGen" + \ , "PPC.Cond" + \ , "PPC.Instr" + \ , "PPC.Ppr" + \ , "PPC.RegInfo" + \ , "PPC.Regs" + \ , "PackageConfig" + \ , "Packages" + \ , "Pair" + \ , "Panic" + \ , "Parser" + \ , "PatSyn" + \ , "PipelineMonad" + \ , "PlaceHolder" + \ , "Platform" + \ , "PlatformConstants" + \ , "Plugins" + \ , "PmExpr" + \ , "PprBase" + \ , "PprC" + \ , "PprCmm" + \ , "PprCmmDecl" + \ , "PprCmmExpr" + \ , "PprColour" + \ , "PprCore" + \ , "PprTyThing" + \ , "PrelInfo" + \ , "PrelNames" + \ , "PrelRules" + \ , "Pretty" + \ , "PrimOp" + \ , "ProfInit" + \ , "RdrHsSyn" + \ , "RdrName" + \ , "Reg" + \ , "RegAlloc.Graph.ArchBase" + \ , "RegAlloc.Graph.ArchX86" + \ , "RegAlloc.Graph.Coalesce" + \ , "RegAlloc.Graph.Main" + \ , "RegAlloc.Graph.Spill" + \ , "RegAlloc.Graph.SpillClean" + \ , "RegAlloc.Graph.SpillCost" + \ , "RegAlloc.Graph.Stats" + \ , "RegAlloc.Graph.TrivColorable" + \ , "RegAlloc.Linear.Base" + \ , "RegAlloc.Linear.FreeRegs" + \ , "RegAlloc.Linear.JoinToTargets" + \ , "RegAlloc.Linear.Main" + \ , "RegAlloc.Linear.PPC.FreeRegs" + \ , "RegAlloc.Linear.SPARC.FreeRegs" + \ , "RegAlloc.Linear.StackMap" + \ , "RegAlloc.Linear.State" + \ , "RegAlloc.Linear.Stats" + \ , "RegAlloc.Linear.X86.FreeRegs" + \ , "RegAlloc.Linear.X86_64.FreeRegs" + \ , "RegAlloc.Liveness" + \ , "RegClass" + \ , "RepType" + \ , "RnBinds" + \ , "RnEnv" + \ , "RnExpr" + \ , "RnFixity" + \ , "RnHsDoc" + \ , "RnModIface" + \ , "RnNames" + \ , "RnPat" + \ , "RnSource" + \ , "RnSplice" + \ , "RnTypes" + \ , "RnUnbound" + \ , "RnUtils" + \ , "RtClosureInspect" + \ , "Rules" + \ , "SAT" + \ , "SMRep" + \ , "SPARC.AddrMode" + \ , "SPARC.Base" + \ , "SPARC.CodeGen" + \ , "SPARC.CodeGen.Amode" + \ , "SPARC.CodeGen.Base" + \ , "SPARC.CodeGen.CondCode" + \ , "SPARC.CodeGen.Expand" + \ , "SPARC.CodeGen.Gen32" + \ , "SPARC.CodeGen.Gen64" + \ , "SPARC.CodeGen.Sanity" + \ , "SPARC.Cond" + \ , "SPARC.Imm" + \ , "SPARC.Instr" + \ , "SPARC.Ppr" + \ , "SPARC.Regs" + \ , "SPARC.ShortcutJump" + \ , "SPARC.Stack" + \ , "SetLevels" + \ , "SimplCore" + \ , "SimplEnv" + \ , "SimplMonad" + \ , "SimplStg" + \ , "SimplUtils" + \ , "Simplify" + \ , "SpecConstr" + \ , "Specialise" + \ , "SrcLoc" + \ , "State" + \ , "StaticPtrTable" + \ , "StgCmm" + \ , "StgCmmArgRep" + \ , "StgCmmBind" + \ , "StgCmmClosure" + \ , "StgCmmCon" + \ , "StgCmmEnv" + \ , "StgCmmExpr" + \ , "StgCmmExtCode" + \ , "StgCmmForeign" + \ , "StgCmmHeap" + \ , "StgCmmHpc" + \ , "StgCmmLayout" + \ , "StgCmmMonad" + \ , "StgCmmPrim" + \ , "StgCmmProf" + \ , "StgCmmTicky" + \ , "StgCmmUtils" + \ , "StgCse" + \ , "StgLint" + \ , "StgStats" + \ , "StgSyn" + \ , "Stream" + \ , "StringBuffer" + \ , "SysTools" + \ , "SysTools.BaseDir" + \ , "SysTools.ExtraObj" + \ , "SysTools.Info" + \ , "SysTools.Process" + \ , "SysTools.Tasks" + \ , "SysTools.Terminal" + \ , "THNames" + \ , "TargetReg" + \ , "TcAnnotations" + \ , "TcArrows" + \ , "TcBackpack" + \ , "TcBinds" + \ , "TcCanonical" + \ , "TcClassDcl" + \ , "TcDefaults" + \ , "TcDeriv" + \ , "TcDerivInfer" + \ , "TcDerivUtils" + \ , "TcEnv" + \ , "TcErrors" + \ , "TcEvidence" + \ , "TcExpr" + \ , "TcFlatten" + \ , "TcForeign" + \ , "TcGenDeriv" + \ , "TcGenFunctor" + \ , "TcGenGenerics" + \ , "TcHsSyn" + \ , "TcHsType" + \ , "TcIface" + \ , "TcInstDcls" + \ , "TcInteract" + \ , "TcMType" + \ , "TcMatches" + \ , "TcPat" + \ , "TcPatSyn" + \ , "TcPluginM" + \ , "TcRnDriver" + \ , "TcRnExports" + \ , "TcRnMonad" + \ , "TcRnTypes" + \ , "TcRules" + \ , "TcSMonad" + \ , "TcSigs" + \ , "TcSimplify" + \ , "TcSplice" + \ , "TcTyClsDecls" + \ , "TcTyDecls" + \ , "TcType" + \ , "TcTypeNats" + \ , "TcTypeable" + \ , "TcUnify" + \ , "TcValidity" + \ , "TidyPgm" + \ , "TmOracle" + \ , "ToIface" + \ , "TrieMap" + \ , "TyCoRep" + \ , "TyCon" + \ , "Type" + \ , "TysPrim" + \ , "TysWiredIn" + \ , "UnVarGraph" + \ , "UnariseStg" + \ , "Unify" + \ , "UniqDFM" + \ , "UniqDSet" + \ , "UniqFM" + \ , "UniqMap" + \ , "UniqSet" + \ , "UniqSupply" + \ , "Unique" + \ , "Util" + \ , "Var" + \ , "VarEnv" + \ , "VarSet" + \ , "Vectorise" + \ , "Vectorise.Builtins" + \ , "Vectorise.Builtins.Base" + \ , "Vectorise.Builtins.Initialise" + \ , "Vectorise.Convert" + \ , "Vectorise.Env" + \ , "Vectorise.Exp" + \ , "Vectorise.Generic.Description" + \ , "Vectorise.Generic.PADict" + \ , "Vectorise.Generic.PAMethods" + \ , "Vectorise.Generic.PData" + \ , "Vectorise.Monad" + \ , "Vectorise.Monad.Base" + \ , "Vectorise.Monad.Global" + \ , "Vectorise.Monad.InstEnv" + \ , "Vectorise.Monad.Local" + \ , "Vectorise.Monad.Naming" + \ , "Vectorise.Type.Classify" + \ , "Vectorise.Type.Env" + \ , "Vectorise.Type.TyConDecl" + \ , "Vectorise.Type.Type" + \ , "Vectorise.Utils" + \ , "Vectorise.Utils.Base" + \ , "Vectorise.Utils.Closure" + \ , "Vectorise.Utils.Hoisting" + \ , "Vectorise.Utils.PADict" + \ , "Vectorise.Utils.Poly" + \ , "Vectorise.Var" + \ , "Vectorise.Vect" + \ , "WorkWrap" + \ , "WwLib" + \ , "X86.CodeGen" + \ , "X86.Cond" + \ , "X86.Instr" + \ , "X86.Ppr" + \ , "X86.RegInfo" + \ , "X86.Regs" + \ , "Numeric.Half" + \ , "Data.Hashable" + \ , "Data.Hashable.Lifted" + \ , "Language.Haskell.Lexer" + \ , "Language.Haskell.ParseMonad" + \ , "Language.Haskell.ParseUtils" + \ , "Language.Haskell.Parser" + \ , "Language.Haskell.Pretty" + \ , "Language.Haskell.Syntax" + \ , "Control.Monad" + \ , "Data.Array" + \ , "Data.Bits" + \ , "Data.Char" + \ , "Data.Complex" + \ , "Data.Int" + \ , "Data.Ix" + \ , "Data.List" + \ , "Data.Maybe" + \ , "Data.Ratio" + \ , "Data.Word" + \ , "Foreign" + \ , "Foreign.C" + \ , "Foreign.C.Error" + \ , "Foreign.C.String" + \ , "Foreign.C.Types" + \ , "Foreign.ForeignPtr" + \ , "Foreign.Marshal" + \ , "Foreign.Marshal.Alloc" + \ , "Foreign.Marshal.Array" + \ , "Foreign.Marshal.Error" + \ , "Foreign.Marshal.Utils" + \ , "Foreign.Ptr" + \ , "Foreign.StablePtr" + \ , "Foreign.Storable" + \ , "Numeric" + \ , "Prelude" + \ , "System.Environment" + \ , "System.Exit" + \ , "System.IO" + \ , "System.IO.Error" + \ , "Array" + \ , "Bits" + \ , "CError" + \ , "CForeign" + \ , "CPUTime" + \ , "CString" + \ , "CTypes" + \ , "Char" + \ , "Complex" + \ , "Directory" + \ , "ForeignPtr" + \ , "IO" + \ , "Int" + \ , "Ix" + \ , "List" + \ , "Locale" + \ , "MarshalAlloc" + \ , "MarshalArray" + \ , "MarshalError" + \ , "MarshalUtils" + \ , "Maybe" + \ , "Monad" + \ , "Numeric" + \ , "Prelude" + \ , "Ptr" + \ , "Random" + \ , "Ratio" + \ , "StablePtr" + \ , "Storable" + \ , "System" + \ , "Time" + \ , "Word" + \ , "Trace.Hpc.Mix" + \ , "Trace.Hpc.Reflect" + \ , "Trace.Hpc.Tix" + \ , "Trace.Hpc.Util" + \ , "Text.Html" + \ , "Text.Html.BlockTable" + \ , "GHC.Integer.Logarithms.Compat" + \ , "Math.NumberTheory.Logarithms" + \ , "Math.NumberTheory.Powers.Integer" + \ , "Math.NumberTheory.Powers.Natural" + \ , "Control.Monad.Cont" + \ , "Control.Monad.Cont.Class" + \ , "Control.Monad.Error" + \ , "Control.Monad.Error.Class" + \ , "Control.Monad.Except" + \ , "Control.Monad.Identity" + \ , "Control.Monad.List" + \ , "Control.Monad.RWS" + \ , "Control.Monad.RWS.Class" + \ , "Control.Monad.RWS.Lazy" + \ , "Control.Monad.RWS.Strict" + \ , "Control.Monad.Reader" + \ , "Control.Monad.Reader.Class" + \ , "Control.Monad.State" + \ , "Control.Monad.State.Class" + \ , "Control.Monad.State.Lazy" + \ , "Control.Monad.State.Strict" + \ , "Control.Monad.Trans" + \ , "Control.Monad.Writer" + \ , "Control.Monad.Writer.Class" + \ , "Control.Monad.Writer.Lazy" + \ , "Control.Monad.Writer.Strict" + \ , "Network.Multipart" + \ , "Network.Multipart.Header" + \ , "Network" + \ , "Network.BSD" + \ , "Network.Socket" + \ , "Network.Socket.ByteString" + \ , "Network.Socket.ByteString.Lazy" + \ , "Network.Socket.Internal" + \ , "Network.URI" + \ , "System.Locale" + \ , "System.Time" + \ , "Control.Parallel" + \ , "Control.Parallel.Strategies" + \ , "Control.Seq" + \ , "Text.Parsec" + \ , "Text.Parsec.ByteString" + \ , "Text.Parsec.ByteString.Lazy" + \ , "Text.Parsec.Char" + \ , "Text.Parsec.Combinator" + \ , "Text.Parsec.Error" + \ , "Text.Parsec.Expr" + \ , "Text.Parsec.Language" + \ , "Text.Parsec.Perm" + \ , "Text.Parsec.Pos" + \ , "Text.Parsec.Prim" + \ , "Text.Parsec.String" + \ , "Text.Parsec.Text" + \ , "Text.Parsec.Text.Lazy" + \ , "Text.Parsec.Token" + \ , "Text.ParserCombinators.Parsec" + \ , "Text.ParserCombinators.Parsec.Char" + \ , "Text.ParserCombinators.Parsec.Combinator" + \ , "Text.ParserCombinators.Parsec.Error" + \ , "Text.ParserCombinators.Parsec.Expr" + \ , "Text.ParserCombinators.Parsec.Language" + \ , "Text.ParserCombinators.Parsec.Perm" + \ , "Text.ParserCombinators.Parsec.Pos" + \ , "Text.ParserCombinators.Parsec.Prim" + \ , "Text.ParserCombinators.Parsec.Token" + \ , "Text.PrettyPrint" + \ , "Text.PrettyPrint.Annotated" + \ , "Text.PrettyPrint.Annotated.HughesPJ" + \ , "Text.PrettyPrint.Annotated.HughesPJClass" + \ , "Text.PrettyPrint.HughesPJ" + \ , "Text.PrettyPrint.HughesPJClass" + \ , "Control.Monad.Primitive" + \ , "Data.Primitive" + \ , "Data.Primitive.Addr" + \ , "Data.Primitive.Array" + \ , "Data.Primitive.ByteArray" + \ , "Data.Primitive.MVar" + \ , "Data.Primitive.MachDeps" + \ , "Data.Primitive.MutVar" + \ , "Data.Primitive.PrimArray" + \ , "Data.Primitive.Ptr" + \ , "Data.Primitive.SmallArray" + \ , "Data.Primitive.Types" + \ , "Data.Primitive.UnliftedArray" + \ , "System.Cmd" + \ , "System.Process" + \ , "System.Process.Internals" + \ , "System.Random" + \ , "Text.Regex.Base" + \ , "Text.Regex.Base.Context" + \ , "Text.Regex.Base.Impl" + \ , "Text.Regex.Base.RegexLike" + \ , "Text.Regex" + \ , "Text.Regex.Posix" + \ , "Text.Regex.Posix.ByteString" + \ , "Text.Regex.Posix.ByteString.Lazy" + \ , "Text.Regex.Posix.Sequence" + \ , "Text.Regex.Posix.String" + \ , "Text.Regex.Posix.Wrap" + \ , "Data.ByteString.Builder.Scientific" + \ , "Data.Scientific" + \ , "Data.Text.Lazy.Builder.Scientific" + \ , "Data.List.Split" + \ , "Data.List.Split.Internals" + \ , "Control.Concurrent.STM" + \ , "Control.Concurrent.STM.TArray" + \ , "Control.Concurrent.STM.TBQueue" + \ , "Control.Concurrent.STM.TChan" + \ , "Control.Concurrent.STM.TMVar" + \ , "Control.Concurrent.STM.TQueue" + \ , "Control.Concurrent.STM.TSem" + \ , "Control.Concurrent.STM.TVar" + \ , "Control.Monad.STM" + \ , "Data.Generics" + \ , "Data.Generics.Aliases" + \ , "Data.Generics.Basics" + \ , "Data.Generics.Builders" + \ , "Data.Generics.Instances" + \ , "Data.Generics.Schemes" + \ , "Data.Generics.Text" + \ , "Data.Generics.Twins" + \ , "Generics.SYB" + \ , "Generics.SYB.Aliases" + \ , "Generics.SYB.Basics" + \ , "Generics.SYB.Builders" + \ , "Generics.SYB.Instances" + \ , "Generics.SYB.Schemes" + \ , "Generics.SYB.Text" + \ , "Generics.SYB.Twins" + \ , "Language.Haskell.TH" + \ , "Language.Haskell.TH.LanguageExtensions" + \ , "Language.Haskell.TH.Lib" + \ , "Language.Haskell.TH.Lib.Internal" + \ , "Language.Haskell.TH.Ppr" + \ , "Language.Haskell.TH.PprLib" + \ , "Language.Haskell.TH.Quote" + \ , "Language.Haskell.TH.Syntax" + \ , "Data.Text" + \ , "Data.Text.Array" + \ , "Data.Text.Encoding" + \ , "Data.Text.Encoding.Error" + \ , "Data.Text.Foreign" + \ , "Data.Text.IO" + \ , "Data.Text.Internal" + \ , "Data.Text.Internal.Builder" + \ , "Data.Text.Internal.Builder.Functions" + \ , "Data.Text.Internal.Builder.Int.Digits" + \ , "Data.Text.Internal.Builder.RealFloat.Functions" + \ , "Data.Text.Internal.Encoding.Fusion" + \ , "Data.Text.Internal.Encoding.Fusion.Common" + \ , "Data.Text.Internal.Encoding.Utf16" + \ , "Data.Text.Internal.Encoding.Utf32" + \ , "Data.Text.Internal.Encoding.Utf8" + \ , "Data.Text.Internal.Functions" + \ , "Data.Text.Internal.Fusion" + \ , "Data.Text.Internal.Fusion.CaseMapping" + \ , "Data.Text.Internal.Fusion.Common" + \ , "Data.Text.Internal.Fusion.Size" + \ , "Data.Text.Internal.Fusion.Types" + \ , "Data.Text.Internal.IO" + \ , "Data.Text.Internal.Lazy" + \ , "Data.Text.Internal.Lazy.Encoding.Fusion" + \ , "Data.Text.Internal.Lazy.Fusion" + \ , "Data.Text.Internal.Lazy.Search" + \ , "Data.Text.Internal.Private" + \ , "Data.Text.Internal.Read" + \ , "Data.Text.Internal.Search" + \ , "Data.Text.Internal.Unsafe" + \ , "Data.Text.Internal.Unsafe.Char" + \ , "Data.Text.Internal.Unsafe.Shift" + \ , "Data.Text.Lazy" + \ , "Data.Text.Lazy.Builder" + \ , "Data.Text.Lazy.Builder.Int" + \ , "Data.Text.Lazy.Builder.RealFloat" + \ , "Data.Text.Lazy.Encoding" + \ , "Data.Text.Lazy.IO" + \ , "Data.Text.Lazy.Internal" + \ , "Data.Text.Lazy.Read" + \ , "Data.Text.Read" + \ , "Data.Text.Unsafe" + \ , "System.Random.TF" + \ , "System.Random.TF.Gen" + \ , "System.Random.TF.Init" + \ , "System.Random.TF.Instances" + \ , "Data.Time" + \ , "Data.Time.Calendar" + \ , "Data.Time.Calendar.Easter" + \ , "Data.Time.Calendar.Julian" + \ , "Data.Time.Calendar.MonthDay" + \ , "Data.Time.Calendar.OrdinalDate" + \ , "Data.Time.Calendar.WeekDate" + \ , "Data.Time.Clock" + \ , "Data.Time.Clock.POSIX" + \ , "Data.Time.Clock.System" + \ , "Data.Time.Clock.TAI" + \ , "Data.Time.Format" + \ , "Data.Time.LocalTime" + \ , "Control.Applicative.Backwards" + \ , "Control.Applicative.Lift" + \ , "Control.Monad.Signatures" + \ , "Control.Monad.Trans.Accum" + \ , "Control.Monad.Trans.Class" + \ , "Control.Monad.Trans.Cont" + \ , "Control.Monad.Trans.Error" + \ , "Control.Monad.Trans.Except" + \ , "Control.Monad.Trans.Identity" + \ , "Control.Monad.Trans.List" + \ , "Control.Monad.Trans.Maybe" + \ , "Control.Monad.Trans.RWS" + \ , "Control.Monad.Trans.RWS.Lazy" + \ , "Control.Monad.Trans.RWS.Strict" + \ , "Control.Monad.Trans.Reader" + \ , "Control.Monad.Trans.Select" + \ , "Control.Monad.Trans.State" + \ , "Control.Monad.Trans.State.Lazy" + \ , "Control.Monad.Trans.State.Strict" + \ , "Control.Monad.Trans.Writer" + \ , "Control.Monad.Trans.Writer.Lazy" + \ , "Control.Monad.Trans.Writer.Strict" + \ , "Data.Functor.Constant" + \ , "Data.Functor.Reverse" + \ , "Control.Monad.Trans.Instances" + \ , "Data.Functor.Classes.Generic" + \ , "Data.Functor.Classes.Generic.Internal" + \ , "System.Posix" + \ , "System.Posix.ByteString" + \ , "System.Posix.ByteString.FilePath" + \ , "System.Posix.Directory" + \ , "System.Posix.Directory.ByteString" + \ , "System.Posix.DynamicLinker" + \ , "System.Posix.DynamicLinker.ByteString" + \ , "System.Posix.DynamicLinker.Module" + \ , "System.Posix.DynamicLinker.Module.ByteString" + \ , "System.Posix.DynamicLinker.Prim" + \ , "System.Posix.Env" + \ , "System.Posix.Env.ByteString" + \ , "System.Posix.Error" + \ , "System.Posix.Fcntl" + \ , "System.Posix.Files" + \ , "System.Posix.Files.ByteString" + \ , "System.Posix.IO" + \ , "System.Posix.IO.ByteString" + \ , "System.Posix.Process" + \ , "System.Posix.Process.ByteString" + \ , "System.Posix.Process.Internals" + \ , "System.Posix.Resource" + \ , "System.Posix.Semaphore" + \ , "System.Posix.SharedMem" + \ , "System.Posix.Signals" + \ , "System.Posix.Signals.Exts" + \ , "System.Posix.Temp" + \ , "System.Posix.Temp.ByteString" + \ , "System.Posix.Terminal" + \ , "System.Posix.Terminal.ByteString" + \ , "System.Posix.Time" + \ , "System.Posix.Unistd" + \ , "System.Posix.User" + \ , "Data.HashMap.Lazy" + \ , "Data.HashMap.Strict" + \ , "Data.HashSet" + \ , "Data.Vector" + \ , "Data.Vector.Fusion.Bundle" + \ , "Data.Vector.Fusion.Bundle.Monadic" + \ , "Data.Vector.Fusion.Bundle.Size" + \ , "Data.Vector.Fusion.Stream.Monadic" + \ , "Data.Vector.Fusion.Util" + \ , "Data.Vector.Generic" + \ , "Data.Vector.Generic.Base" + \ , "Data.Vector.Generic.Mutable" + \ , "Data.Vector.Generic.Mutable.Base" + \ , "Data.Vector.Generic.New" + \ , "Data.Vector.Internal.Check" + \ , "Data.Vector.Mutable" + \ , "Data.Vector.Primitive" + \ , "Data.Vector.Primitive.Mutable" + \ , "Data.Vector.Storable" + \ , "Data.Vector.Storable.Internal" + \ , "Data.Vector.Storable.Mutable" + \ , "Data.Vector.Unboxed" + \ , "Data.Vector.Unboxed.Base" + \ , "Data.Vector.Unboxed.Mutable" + \ , "Text.XHtml" + \ , "Text.XHtml.Debug" + \ , "Text.XHtml.Frameset" + \ , "Text.XHtml.Strict" + \ , "Text.XHtml.Table" + \ , "Text.XHtml.Transitional" + \ , "Codec.Compression.GZip" + \ , "Codec.Compression.Zlib" + \ , "Codec.Compression.Zlib.Internal" + \ , "Codec.Compression.Zlib.Raw" + \ , "Web.Spock" + \ , "Web.Spock.Config" + \ , "Web.Spock.Internal.SessionManager" + \ , "Web.Spock.Internal.SessionVault" + \ , "Web.Spock.SessionActions" + \ , "Web.Spock.Api" + \ , "Web.Spock.Auth" + \ , "Web.Spock.Action" + \ , "Web.Spock.Core" + \ , "Web.Spock.Internal.Cookies" + \ , "Web.Spock.Internal.Util" + \ , "Web.Spock.Routing" + \ , "Web.Spock.Digestive" + \ , "Database.Esqueleto" + \ , "Database.Esqueleto.Internal.Language" + \ , "Database.Esqueleto.Internal.Sql" + \ , "Database.Esqueleto.PostgreSQL" + \ , "Database.Persist" + \ , "Database.Persist.Class" + \ , "Database.Persist.Quasi" + \ , "Database.Persist.Sql" + \ , "Database.Persist.Sql.Types.Internal" + \ , "Database.Persist.Sql.Util" + \ , "Database.Persist.Types" + \ , "Database.Persist.MySQL" + \ , "Database.Persist.Postgresql" + \ , "Database.Persist.Postgresql.JSON" + \ , "Database.Persist.Redis" + \ , "Database.Persist.Sqlite" + \ , "Database.Sqlite" + \ , "Servant.API" + \ , "Servant.API.Alternative" + \ , "Servant.API.BasicAuth" + \ , "Servant.API.Capture" + \ , "Servant.API.ContentTypes" + \ , "Servant.API.Description" + \ , "Servant.API.Empty" + \ , "Servant.API.Experimental.Auth" + \ , "Servant.API.Generic" + \ , "Servant.API.Header" + \ , "Servant.API.HttpVersion" + \ , "Servant.API.Internal.Test.ComprehensiveAPI" + \ , "Servant.API.IsSecure" + \ , "Servant.API.Modifiers" + \ , "Servant.API.QueryParam" + \ , "Servant.API.Raw" + \ , "Servant.API.RemoteHost" + \ , "Servant.API.ReqBody" + \ , "Servant.API.ResponseHeaders" + \ , "Servant.API.Stream" + \ , "Servant.API.Sub" + \ , "Servant.API.TypeLevel" + \ , "Servant.API.Vault" + \ , "Servant.API.Verbs" + \ , "Servant.API.WithNamedContext" + \ , "Servant.Links" + \ , "Servant.Utils.Enter" + \ , "Servant.Utils.Links" + \ , "Servant.Auth" + \ , "Servant.Client" + \ , "Servant.Client.Internal.HttpClient" + \ , "Servant" + \ , "Servant.Server" + \ , "Servant.Server.Experimental.Auth" + \ , "Servant.Server.Generic" + \ , "Servant.Server.Internal" + \ , "Servant.Server.Internal.BasicAuth" + \ , "Servant.Server.Internal.Context" + \ , "Servant.Server.Internal.Handler" + \ , "Servant.Server.Internal.Router" + \ , "Servant.Server.Internal.RoutingApplication" + \ , "Servant.Server.Internal.ServantErr" + \ , "Servant.Server.StaticFiles" + \ , "Servant.Utils.StaticFiles" + \ ] diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index dc362577a6..56ae2071e9 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -1,433 +1,177 @@ -function! s:trim(s) abort - return substitute(a:s, '^\_s*\|\_s*$', '', 'g') -endfunction - +function! s:enhance_syntax() abort + syntax case match -" Simple version comparison. -function! s:version_cmp(a, b) abort - let a = split(a:a, '\.') - let b = split(a:b, '\.') - - for i in range(len(a)) - if a[i] > b[i] - return 1 - elseif a[i] < b[i] - return -1 - endif - endfor - - return 0 -endfunction + syntax keyword healthError ERROR[:] + \ containedin=markdownCodeBlock,mkdListItemLine + highlight default link healthError Error + syntax keyword healthWarning WARNING[:] + \ containedin=markdownCodeBlock,mkdListItemLine + highlight default link healthWarning WarningMsg -" Fetch the contents of a URL. -function! s:download(url) abort - let content = '' - if executable('curl') - let content = system('curl -sL "'.a:url.'"') - endif + syntax keyword healthSuccess OK[:] + \ containedin=markdownCodeBlock,mkdListItemLine + highlight default healthSuccess guibg=#5fff00 guifg=#080808 ctermbg=82 ctermfg=232 - if empty(content) && executable('python') - let script = " - \try:\n - \ from urllib.request import urlopen\n - \except ImportError:\n - \ from urllib2 import urlopen\n - \\n - \try:\n - \ response = urlopen('".a:url."')\n - \ print(response.read().decode('utf8'))\n - \except Exception:\n - \ pass\n - \" - let content = system('python -c "'.script.'" 2>/dev/null') - endif + syntax match healthHelp "|.\{-}|" contains=healthBar + \ containedin=markdownCodeBlock,mkdListItemLine + syntax match healthBar "|" contained conceal + highlight default link healthHelp Identifier - return content + " We do not care about markdown syntax errors in :checkhealth output. + highlight! link markdownError Normal endfunction - -" Get the latest Neovim Python client version from PyPI. The result is -" cached. -function! s:latest_pypi_version() - if exists('s:pypi_version') - return s:pypi_version - endif - - let s:pypi_version = 'unknown' - let pypi_info = s:download('https://pypi.python.org/pypi/neovim/json') - if !empty(pypi_info) - let pypi_data = json_decode(pypi_info) - let s:pypi_version = get(get(pypi_data, 'info', {}), 'version', 'unknown') - return s:pypi_version - endif -endfunction - - -" Get version information using the specified interpreter. The interpreter is -" used directly in case breaking changes were introduced since the last time -" Neovim's Python client was updated. -function! s:version_info(python) abort - let pypi_version = s:latest_pypi_version() - let python_version = s:trim(system( - \ printf('"%s" -c "import sys; print(''.''.join(str(x) ' - \ . 'for x in sys.version_info[:3]))"', a:python))) - if empty(python_version) - let python_version = 'unknown' - endif - - let nvim_path = s:trim(system(printf('"%s" -c "import sys, neovim;' - \ . 'print(neovim.__file__)" 2>/dev/null', a:python))) - if empty(nvim_path) - return [python_version, 'not found', pypi_version, 'unknown'] - endif - - let nvim_version = 'unknown' - let base = fnamemodify(nvim_path, ':h') - for meta in glob(base.'-*/METADATA', 1, 1) + glob(base.'-*/PKG-INFO', 1, 1) - for meta_line in readfile(meta) - if meta_line =~# '^Version:' - let nvim_version = matchstr(meta_line, '^Version: \zs\S\+') - endif +" Runs the specified healthchecks. +" Runs all discovered healthchecks if a:plugin_names is empty. +function! health#check(plugin_names) abort + let healthchecks = empty(a:plugin_names) + \ ? s:discover_health_checks() + \ : s:to_fn_names(a:plugin_names) + + tabnew + setlocal wrap breakindent + setlocal filetype=markdown + setlocal conceallevel=2 concealcursor=nc + setlocal keywordprg=:help + let &l:iskeyword='!-~,^*,^|,^",192-255' + call s:enhance_syntax() + + if empty(healthchecks) + call setline(1, 'ERROR: No healthchecks found.') + else + redraw|echo 'Running healthchecks...' + for c in healthchecks + let output = '' + call append('$', split(printf("\n%s\n%s", c, repeat('=',72)), "\n")) + try + let output = "\n\n".execute('call '.c.'()') + catch + if v:exception =~# '^Vim\%((\a\+)\)\=:E117.*\V'.c + let output = execute( + \ 'call health#report_error(''No healthcheck found for "' + \ .s:to_plugin_name(c) + \ .'" plugin.'')') + else + let output = execute( + \ 'call health#report_error(''Failed to run healthcheck for "' + \ .s:to_plugin_name(c) + \ .'" plugin. Exception:''."\n".v:throwpoint."\n".v:exception)') + endif + endtry + call append('$', split(output, "\n") + ['']) + redraw endfor - endfor - - let version_status = 'unknown' - if nvim_version != 'unknown' && pypi_version != 'unknown' - if s:version_cmp(nvim_version, pypi_version) == -1 - let version_status = 'outdated' - else - let version_status = 'up to date' - endif endif - return [python_version, nvim_version, pypi_version, version_status] + " needed for plasticboy/vim-markdown, because it uses fdm=expr + normal! zR + setlocal nomodified + setlocal bufhidden=hide + redraw|echo '' endfunction - -" Check the Python interpreter's usability. -function! s:check_bin(bin, notes) abort - if !filereadable(a:bin) - call add(a:notes, printf('Error: "%s" was not found.', a:bin)) - return 0 - elseif executable(a:bin) != 1 - call add(a:notes, printf('Error: "%s" is not executable.', a:bin)) - return 0 - endif - return 1 +" Starts a new report. +function! health#report_start(name) abort + echo "\n## " . a:name endfunction - -" Text wrapping that returns a list of lines -function! s:textwrap(text, width) abort - let pattern = '.*\%(\s\+\|\_$\)\zs\%<'.a:width.'c' - return map(split(a:text, pattern), 's:trim(v:val)') -endfunction - - -" Echo wrapped notes -function! s:echo_notes(notes) abort - if empty(a:notes) - return +" Indents lines *except* line 1 of a string if it contains newlines. +function! s:indent_after_line1(s, columns) abort + let lines = split(a:s, "\n", 0) + if len(lines) < 2 " We do not indent line 1, so nothing to do. + return a:s endif - - echo ' Messages:' - for msg in a:notes - if msg =~# "\n" - let msg_lines = [] - for msgl in filter(split(msg, "\n"), 'v:val !~# ''^\s*$''') - call extend(msg_lines, s:textwrap(msgl, 74)) - endfor - else - let msg_lines = s:textwrap(msg, 74) - endif - - if !len(msg_lines) - continue - endif - echo ' *' msg_lines[0] - if len(msg_lines) > 1 - echo join(map(msg_lines[1:], '" ".v:val'), "\n") - endif + for i in range(1, len(lines)-1) " Indent lines after the first. + let lines[i] = substitute(lines[i], '^\s*', repeat(' ', a:columns), 'g') endfor + return join(lines, "\n") endfunction - -" Load the remote plugin manifest file and check for unregistered plugins -function! s:diagnose_manifest() abort - echo 'Checking: Remote Plugins' - let existing_rplugins = {} - - for item in remote#host#PluginsForHost('python') - let existing_rplugins[item.path] = 'python' - endfor - - for item in remote#host#PluginsForHost('python3') - let existing_rplugins[item.path] = 'python3' - endfor - - let require_update = 0 - let notes = [] - - for path in map(split(&rtp, ','), 'resolve(v:val)') - let python_glob = glob(path.'/rplugin/python*', 1, 1) - if empty(python_glob) - continue - endif - - let python_dir = python_glob[0] - let python_version = fnamemodify(python_dir, ':t') - - for script in glob(python_dir.'/*.py', 1, 1) - \ + glob(python_dir.'/*/__init__.py', 1, 1) - let contents = join(readfile(script)) - if contents =~# '\<\%(from\|import\)\s\+neovim\>' - if script =~# '/__init__\.py$' - let script = fnamemodify(script, ':h') - endif - - if !has_key(existing_rplugins, script) - let msg = printf('"%s" is not registered.', fnamemodify(path, ':t')) - if python_version == 'pythonx' - if !has('python2') && !has('python3') - let msg .= ' (python2 and python3 not available)' - endif - elseif !has(python_version) - let msg .= printf(' (%s not available)', python_version) - else - let require_update = 1 - endif - - call add(notes, msg) - endif - - break - endif - endfor - endfor - - echo ' Status: ' - if require_update - echon 'Out of date' - call add(notes, 'Run :UpdateRemotePlugins') - else - echon 'Up to date' - endif - - call s:echo_notes(notes) +" Changes ':h clipboard' to ':help |clipboard|'. +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. +" 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) -function! s:diagnose_python(version) abort - let python_bin_name = 'python'.(a:version == 2 ? '' : '3') - let pyenv = resolve(exepath('pyenv')) - let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : '' - let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : '' - let host_prog_var = python_bin_name.'_host_prog' - let host_skip_var = python_bin_name.'_host_skip_check' - let python_bin = '' - let python_multiple = [] - let notes = [] - - if exists('g:'.host_prog_var) - call add(notes, printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var))) - endif - - let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version) - if empty(python_bin_name) - call add(notes, 'Warning: No Python interpreter was found with the neovim ' - \ . 'module. Using the first available for diagnostics.') - if !empty(pythonx_errs) - call add(notes, pythonx_errs) - endif - let old_skip = get(g:, host_skip_var, 0) - let g:[host_skip_var] = 1 - let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version) - let g:[host_skip_var] = old_skip - endif - - if !empty(python_bin_name) - if exists('g:'.host_prog_var) - let python_bin = exepath(python_bin_name) + " Optional parameters + if a:0 > 0 + let advice = type(a:1) == type('') ? [a:1] : a:1 + if type(advice) != type([]) + throw 'a:1: expected String or List' endif - let python_bin_name = fnamemodify(python_bin_name, ':t') - endif - - if !empty(pythonx_errs) - call add(notes, pythonx_errs) - endif - - if !empty(python_bin_name) && empty(python_bin) && empty(pythonx_errs) - if !exists('g:'.host_prog_var) - call add(notes, printf('Warning: "g:%s" is not set. Searching for ' - \ . '%s in the environment.', host_prog_var, python_bin_name)) - endif - - if !empty(pyenv) - if empty(pyenv_root) - call add(notes, 'Warning: pyenv was found, but $PYENV_ROOT ' - \ . 'is not set. Did you follow the final install ' - \ . 'instructions?') - else - call add(notes, printf('Notice: pyenv found: "%s"', pyenv)) - endif - - let python_bin = s:trim(system( - \ printf('"%s" which %s 2>/dev/null', pyenv, python_bin_name))) - - if empty(python_bin) - call add(notes, printf('Warning: pyenv couldn''t find %s.', python_bin_name)) - endif - endif - - if empty(python_bin) - let python_bin = exepath(python_bin_name) - - if exists('$PATH') - for path in split($PATH, ':') - let path_bin = path.'/'.python_bin_name - if path_bin != python_bin && index(python_multiple, path_bin) == -1 - \ && executable(path_bin) - call add(python_multiple, path_bin) - endif - endfor - - if len(python_multiple) - " This is worth noting since the user may install something - " that changes $PATH, like homebrew. - call add(notes, printf('Suggestion: There are multiple %s executables found. ' - \ . 'Set "g:%s" to avoid surprises.', python_bin_name, host_prog_var)) - endif - - if python_bin =~# '\<shims\>' - call add(notes, printf('Warning: "%s" appears to be a pyenv shim. ' - \ . 'This could mean that a) the "pyenv" executable is not in ' - \ . '$PATH, b) your pyenv installation is broken. ' - \ . 'You should set "g:%s" to avoid surprises.', - \ python_bin, host_prog_var)) - endif - endif - endif - endif - if !empty(python_bin) - if !empty(pyenv) && !exists('g:'.host_prog_var) && !empty(pyenv_root) - \ && resolve(python_bin) !~# '^'.pyenv_root.'/' - call add(notes, printf('Suggestion: Create a virtualenv specifically ' - \ . 'for Neovim using pyenv and use "g:%s". This will avoid ' - \ . 'the need to install Neovim''s Python client in each ' - \ . 'version/virtualenv.', host_prog_var)) - endif - - if !empty(venv) && exists('g:'.host_prog_var) - if !empty(pyenv_root) - let venv_root = pyenv_root - else - let venv_root = fnamemodify(venv, ':h') - endif - - if resolve(python_bin) !~# '^'.venv_root.'/' - call add(notes, printf('Suggestion: Create a virtualenv specifically ' - \ . 'for Neovim and use "g:%s". This will avoid ' - \ . 'the need to install Neovim''s Python client in each ' - \ . 'virtualenv.', host_prog_var)) - endif + " 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 - if empty(python_bin) && !empty(python_bin_name) - " An error message should have already printed. - call add(notes, printf('Error: "%s" was not found.', python_bin_name)) - elseif !empty(python_bin) && !s:check_bin(python_bin, notes) - let python_bin = '' - endif + return s:help_to_link(output) +endfunction " }}} - " Check if $VIRTUAL_ENV is active - let virtualenv_inactive = 0 +" Use {msg} to report information in the current section +function! health#report_info(msg) abort " {{{ + echo s:format_report_message('INFO', a:msg) +endfunction " }}} - if exists('$VIRTUAL_ENV') - if !empty(pyenv) - let pyenv_prefix = resolve(s:trim(system(printf('"%s" prefix', pyenv)))) - if $VIRTUAL_ENV != pyenv_prefix - let virtualenv_inactive = 1 - endif - elseif !empty(python_bin_name) && exepath(python_bin_name) !~# '^'.$VIRTUAL_ENV.'/' - let virtualenv_inactive = 1 - endif - endif +" Reports a successful healthcheck. +function! health#report_ok(msg) abort " {{{ + echo s:format_report_message('OK', a:msg) +endfunction " }}} - if virtualenv_inactive - call add(notes, 'Warning: $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 - echo 'Checking: Python' a:version - echo ' Executable:' (empty(python_bin) ? 'Not found' : python_bin) - if len(python_multiple) - for path_bin in python_multiple - echo ' (other):' path_bin - endfor +" 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) + else + echo s:format_report_message('WARNING', a:msg) endif +endfunction " }}} - if !empty(python_bin) - let [pyversion, current, latest, status] = s:version_info(python_bin) - if a:version != str2nr(pyversion) - call add(notes, 'Warning: Got an unexpected version of Python. ' - \ . 'This could lead to confusing error messages. Please ' - \ . 'consider this before reporting bugs to plugin developers.') - endif - if a:version == 3 && str2float(pyversion) < 3.3 - call add(notes, 'Warning: Python 3.3+ is recommended.') - endif - - echo ' Python Version:' pyversion - echo printf(' %s-neovim Version: %s', python_bin_name, current) - - if current == 'not found' - call add(notes, 'Error: Neovim Python client is not installed.') - endif - - if latest == 'unknown' - call add(notes, 'Warning: Unable to fetch latest Neovim Python client version.') - endif - - if status == 'outdated' - echon ' (latest: '.latest.')' - else - echon ' ('.status.')' - endif +" 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) + else + echo s:format_report_message('ERROR', a:msg) endif +endfunction " }}} - call s:echo_notes(notes) +function! s:filepath_to_function(name) abort + return substitute(substitute(substitute(a:name, '.*autoload[\/]', '', ''), + \ '\.vim', '#check', ''), '[\/]', '#', 'g') endfunction +function! s:discover_health_checks() abort + let healthchecks = globpath(&runtimepath, 'autoload/health/*.vim', 1, 1) + let healthchecks = map(healthchecks, '<SID>filepath_to_function(v:val)') + return healthchecks +endfunction -function! health#check(bang) abort - redir => report - try - silent call s:diagnose_python(2) - silent echo '' - silent call s:diagnose_python(3) - silent echo '' - silent call s:diagnose_manifest() - silent echo '' - finally - redir END - endtry +" Translates a list of plugin names to healthcheck function names. +function! s:to_fn_names(plugin_names) abort + let healthchecks = [] + let plugin_names = type('') ==# type(a:plugin_names) + \ ? split(a:plugin_names, '', v:false) + \ : a:plugin_names + for p in plugin_names + call add(healthchecks, 'health#'.p.'#check') + endfor + return healthchecks +endfunction - if a:bang - new - setlocal bufhidden=wipe - call setline(1, split(report, "\n")) - setlocal nomodified - else - echo report - echo "\nTip: Use " - echohl Identifier - echon ":CheckHealth!" - echohl None - echon " to open this in a new buffer." - endif +" Extracts 'foo' from 'health#foo#check'. +function! s:to_plugin_name(fn_name) abort + return substitute(a:fn_name, + \ '\v.*health\#(.+)\#check.*', '\1', '') endfunction diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim new file mode 100644 index 0000000000..93660d05dc --- /dev/null +++ b/runtime/autoload/health/nvim.vim @@ -0,0 +1,197 @@ +let s:suggest_faq = 'https://github.com/neovim/neovim/wiki/FAQ' + +function! s:check_config() abort + let ok = v:true + call health#report_start('Configuration') + + let vimrc = empty($MYVIMRC) ? stdpath('config').'/init.vim' : $MYVIMRC + if !filereadable(vimrc) + let ok = v:false + let has_vim = filereadable(expand('~/.vimrc')) + call health#report_warn('Missing user config file: '.vimrc, + \[ has_vim ? ':help nvim-from-vim' : ':help init.vim' ]) + endif + + " 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) + 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+', + \ [ "Use the 'guicursor' option to configure cursor shape. :help 'guicursor'", + \ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ]) + endif + + if &paste + let ok = v:false + call health#report_error("'paste' is enabled. This option is only for pasting text.\nIt should not be set in your config.", + \ [ 'Remove `set paste` from your init.vim, if applicable.', + \ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ]) + endif + + if ok + call health#report_ok('no issues found') + endif +endfunction + +" Load the remote plugin manifest file and check for unregistered plugins +function! s:check_rplugin_manifest() abort + call health#report_start('Remote Plugins') + let existing_rplugins = {} + + for item in remote#host#PluginsForHost('python') + let existing_rplugins[item.path] = 'python' + endfor + + for item in remote#host#PluginsForHost('python3') + let existing_rplugins[item.path] = 'python3' + endfor + + let require_update = 0 + + for path in map(split(&runtimepath, ','), 'resolve(v:val)') + let python_glob = glob(path.'/rplugin/python*', 1, 1) + if empty(python_glob) + continue + endif + + let python_dir = python_glob[0] + let python_version = fnamemodify(python_dir, ':t') + + for script in glob(python_dir.'/*.py', 1, 1) + \ + glob(python_dir.'/*/__init__.py', 1, 1) + let contents = join(readfile(script)) + if contents =~# '\<\%(from\|import\)\s\+neovim\>' + if script =~# '[\/]__init__\.py$' + let script = tr(fnamemodify(script, ':h'), '\', '/') + endif + + if !has_key(existing_rplugins, script) + let msg = printf('"%s" is not registered.', fnamemodify(path, ':t')) + if python_version ==# 'pythonx' + if !has('python2') && !has('python3') + let msg .= ' (python2 and python3 not available)' + endif + elseif !has(python_version) + let msg .= printf(' (%s not available)', python_version) + else + let require_update = 1 + endif + + call health#report_warn(msg) + endif + + break + endif + endfor + endfor + + if require_update + call health#report_warn('Out of date', ['Run `:UpdateRemotePlugins`']) + else + call health#report_ok('Up to date') + endif +endfunction + +function! s:check_performance() abort + call health#report_start('Performance') + + " check buildtype + let buildtype = matchstr(execute('version'), '\v\cbuild type:?\s*[^\n\r\t ]+') + if empty(buildtype) + call health#report_error('failed to get build type from :version') + elseif buildtype =~# '\v(MinSizeRel|Release|RelWithDebInfo)' + call health#report_ok(buildtype) + 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`.', + \ s:suggest_faq]) + endif +endfunction + +function! s:check_tmux() abort + if empty($TMUX) || !executable('tmux') + return + endif + call health#report_start('tmux') + + " check escape-time + let suggestions = ["Set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10", + \ s:suggest_faq] + let cmd = 'tmux show-option -qvgs escape-time' + let out = system(cmd) + let tmux_esc_time = substitute(out, '\v(\s|\r|\n)', '', 'g') + if v:shell_error + call health#report_error('command failed: '.cmd."\n".out) + elseif empty(tmux_esc_time) + call health#report_error('escape-time is not set', suggestions) + elseif tmux_esc_time > 300 + call health#report_error( + \ 'escape-time ('.tmux_esc_time.') is higher than 300ms', suggestions) + else + call health#report_ok('escape-time: '.tmux_esc_time.'ms') + endif + + " check default-terminal and $TERM + call health#report_info('$TERM: '.$TERM) + let cmd = 'tmux show-option -qvg default-terminal' + let out = system(cmd) + let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g') + if empty(tmux_default_term) + let cmd = 'tmux show-option -qvgs default-terminal' + let out = system(cmd) + let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g') + endif + + if v:shell_error + call health#report_error('command failed: '.cmd."\n".out) + elseif tmux_default_term !=# $TERM + call health#report_info('default-terminal: '.tmux_default_term) + call health#report_error( + \ '$TERM differs from the tmux `default-terminal` setting. Colors might look wrong.', + \ ['$TERM may have been set by some rc (.bashrc, .zshrc, ...).']) + elseif $TERM !~# '\v(tmux-256color|screen-256color)' + call health#report_error( + \ '$TERM should be "screen-256color" or "tmux-256color" in tmux. Colors might look wrong.', + \ ["Set default-terminal in ~/.tmux.conf:\nset-option -g default-terminal \"screen-256color\"", + \ s:suggest_faq]) + endif +endfunction + +function! s:check_terminal() abort + if !executable('infocmp') + return + endif + call health#report_start('terminal') + let cmd = 'infocmp -L' + let out = system(cmd) + let kbs_entry = matchstr(out, 'key_backspace=[^,[:space:]]*') + let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*') + + if v:shell_error + call health#report_error('command failed: '.cmd."\n".out) + else + call health#report_info('key_backspace (kbs) terminfo entry: ' + \ .(empty(kbs_entry) ? '? (not found)' : kbs_entry)) + call health#report_info('key_dc (kdch1) terminfo entry: ' + \ .(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) + call health#report_info(printf("$%s='%s'", env_var, eval('$'.env_var))) + endif + endfor +endfunction + +function! health#nvim#check() abort + call s:check_config() + call s:check_performance() + call s:check_rplugin_manifest() + call s:check_terminal() + call s:check_tmux() +endfunction diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim new file mode 100644 index 0000000000..8f364a2ace --- /dev/null +++ b/runtime/autoload/health/provider.vim @@ -0,0 +1,605 @@ +let s:shell_error = 0 + +function! s:is_bad_response(s) abort + return a:s =~? '\v(^unable)|(^error)|(^outdated)' +endfunction + +function! s:trim(s) abort + return substitute(a:s, '^\_s*\|\_s*$', '', 'g') +endfunction + +" Convert '\' to '/'. Collapse '//' and '/./'. +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) + let b = split(a:b, '\.', 0) + + for i in range(len(a)) + if str2nr(a[i]) > str2nr(b[i]) + return 1 + elseif str2nr(a[i]) < str2nr(b[i]) + return -1 + endif + endfor + + return 0 +endfunction + +" Handler for s:system() function. +function! s:system_handler(jobid, data, event) dict abort + if a:event ==# 'stderr' + let self.stderr .= join(a:data, '') + if !self.ignore_stderr + let self.output .= join(a:data, '') + endif + elseif a:event ==# 'stdout' + let self.output .= join(a:data, '') + elseif a:event ==# 'exit' + let s:shell_error = a:data + endif +endfunction + +" Attempts to construct a shell command from an args list. +" Only for display, to help users debug a failed command. +function! s:shellify(cmd) abort + if type(a:cmd) != type([]) + return a:cmd + endif + return join(map(copy(a:cmd), + \'v:val =~# ''\m[^\-.a-zA-Z_/]'' ? shellescape(v:val) : v:val'), ' ') +endfunction + +" Run a system command and timeout after 30 seconds. +function! s:system(cmd, ...) abort + let stdin = a:0 ? a:1 : '' + let ignore_error = a:0 > 2 ? a:3 : 0 + let opts = { + \ 'ignore_stderr': a:0 > 1 ? a:2 : 0, + \ 'output': '', + \ 'stderr': '', + \ 'on_stdout': function('s:system_handler'), + \ 'on_stderr': function('s:system_handler'), + \ 'on_exit': function('s:system_handler'), + \ } + let jobid = jobstart(a:cmd, opts) + + if jobid < 1 + call health#report_error(printf('Command error (job=%d): `%s` (in %s)', + \ jobid, s:shellify(a:cmd), string(getcwd()))) + let s:shell_error = 1 + return opts.output + endif + + if !empty(stdin) + call jobsend(jobid, stdin) + endif + + let res = jobwait([jobid], 30000) + if res[0] == -1 + call health#report_error(printf('Command timed out: %s', s:shellify(a:cmd))) + call jobstop(jobid) + elseif s:shell_error != 0 && !ignore_error + call health#report_error(printf("Command error (job=%d, exit code %d): `%s` (in %s)\nOutput: %s\nStderr: %s", + \ jobid, s:shell_error, s:shellify(a:cmd), string(getcwd()), opts.output, opts.stderr)) + endif + + return opts.output +endfunction + +function! s:systemlist(cmd, ...) abort + let stdout = split(s:system(a:cmd, a:0 ? a:1 : ''), "\n") + if a:0 > 1 && !empty(a:2) + return filter(stdout, '!empty(v:val)') + endif + return stdout +endfunction + +" Fetch the contents of a URL. +function! s:download(url) abort + if executable('curl') + let rv = s:system(['curl', '-sL', a:url], '', 1, 1) + return s:shell_error ? 'curl error with '.a:url.': '.s:shell_error : rv + elseif executable('python') + let script = " + \try:\n + \ from urllib.request import urlopen\n + \except ImportError:\n + \ from urllib2 import urlopen\n + \\n + \response = urlopen('".a:url."')\n + \print(response.read().decode('utf8'))\n + \" + let rv = s:system(['python', '-c', script]) + return empty(rv) && s:shell_error + \ ? 'python urllib.request error: '.s:shell_error + \ : rv + endif + return 'missing `curl` and `python`, cannot make pypi request' +endfunction + +" Check for clipboard tools. +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( + \ provider#clipboard#Error(), + \ ["Use the example in :help g:clipboard as a template, or don't set g:clipboard at all."]) + elseif empty(clipboard_tool) + call health#report_warn( + \ 'No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.', + \ [':help clipboard']) + else + call health#report_ok('Clipboard tool found: '. clipboard_tool) + endif +endfunction + +" Get the latest Neovim Python client (pynvim) version from PyPI. +function! s:latest_pypi_version() abort + let pypi_version = 'unable to get pypi response' + let pypi_response = s:download('https://pypi.python.org/pypi/pynvim/json') + if !empty(pypi_response) + try + let pypi_data = json_decode(pypi_response) + catch /E474/ + return 'error: '.pypi_response + endtry + let pypi_version = get(get(pypi_data, 'info', {}), 'version', 'unable to parse') + endif + return pypi_version +endfunction + +" Get version information using the specified interpreter. The interpreter is +" used directly in case breaking changes were introduced since the last time +" Neovim's Python client was updated. +" +" Returns: [ +" {python executable version}, +" {current nvim version}, +" {current pypi nvim status}, +" {installed version status} +" ] +function! s:version_info(python) abort + let pypi_version = s:latest_pypi_version() + let python_version = s:trim(s:system([ + \ a:python, + \ '-c', + \ 'import sys; print(".".join(str(x) for x in sys.version_info[:3]))', + \ ])) + + if empty(python_version) + let python_version = 'unable to parse '.a:python.' response' + endif + + let nvim_path = s:trim(s:system([ + \ a:python, '-c', + \ 'import sys; sys.path.remove(""); ' . + \ 'import neovim; print(neovim.__file__)'])) + if s:shell_error || empty(nvim_path) + return [python_version, 'unable to load neovim Python module', pypi_version, + \ nvim_path] + endif + + " Assuming that multiple versions of a package are installed, sort them + " numerically in descending order. + function! s:compare(metapath1, metapath2) abort + let a = matchstr(fnamemodify(a:metapath1, ':p:h:t'), '[0-9.]\+') + let b = matchstr(fnamemodify(a:metapath2, ':p:h:t'), '[0-9.]\+') + return a == b ? 0 : a > b ? 1 : -1 + endfunction + + " Try to get neovim.VERSION (added in 0.1.11dev). + let nvim_version = s:system([a:python, '-c', + \ 'from neovim import VERSION as v; '. + \ 'print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))'], + \ '', 1, 1) + if empty(nvim_version) + let nvim_version = 'unable to find neovim Python module version' + let base = fnamemodify(nvim_path, ':h') + let metas = glob(base.'-*/METADATA', 1, 1) + \ + glob(base.'-*/PKG-INFO', 1, 1) + \ + glob(base.'.egg-info/PKG-INFO', 1, 1) + let metas = sort(metas, 's:compare') + + if !empty(metas) + for meta_line in readfile(metas[0]) + if meta_line =~# '^Version:' + let nvim_version = matchstr(meta_line, '^Version: \zs\S\+') + break + endif + endfor + endif + endif + + let nvim_path_base = fnamemodify(nvim_path, ':~:h') + let version_status = 'unknown; '.nvim_path_base + if !s:is_bad_response(nvim_version) && !s:is_bad_response(pypi_version) + if s:version_cmp(nvim_version, pypi_version) == -1 + let version_status = 'outdated; from '.nvim_path_base + else + let version_status = 'up to date' + endif + endif + + return [python_version, nvim_version, pypi_version, version_status] +endfunction + +" Check the Python interpreter's usability. +function! s:check_bin(bin) abort + if !filereadable(a:bin) && (!has('win32') || !filereadable(a:bin.'.exe')) + call health#report_error(printf('"%s" was not found.', a:bin)) + return 0 + elseif executable(a:bin) != 1 + call health#report_error(printf('"%s" is not executable.', a:bin)) + return 0 + endif + return 1 +endfunction + +function! s:check_python(version) abort + call health#report_start('Python ' . a:version . ' provider (optional)') + + let pyname = 'python'.(a:version == 2 ? '' : '3') + let python_exe = '' + let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : '' + let host_prog_var = pyname.'_host_prog' + let loaded_var = 'g:loaded_'.pyname.'_provider' + let python_multiple = [] + + if exists(loaded_var) && !exists('*provider#'.pyname.'#Call') + call health#report_info('Disabled ('.loaded_var.'='.eval(loaded_var).'). This might be due to some previous error.') + endif + + let [pyenv, pyenv_root] = s:check_for_pyenv() + + if exists('g:'.host_prog_var) + call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var))) + endif + + let [pyname, pythonx_errors] = provider#pythonx#Detect(a:version) + + if empty(pyname) + call health#report_warn('No Python executable found that can `import neovim`. ' + \ . 'Using the first available executable for diagnostics.') + elseif exists('g:'.host_prog_var) + let python_exe = pyname + endif + + " No Python executable could `import neovim`. + if !empty(pythonx_errors) + call health#report_error('Python provider error:', pythonx_errors) + + elseif !empty(pyname) && empty(python_exe) + if !exists('g:'.host_prog_var) + call health#report_info(printf('`g:%s` is not set. Searching for ' + \ . '%s in the environment.', host_prog_var, pyname)) + endif + + if !empty(pyenv) + let python_exe = s:trim(s:system([pyenv, 'which', pyname], '', 1)) + + if empty(python_exe) + call health#report_warn(printf('pyenv could not find %s.', pyname)) + endif + endif + + if empty(python_exe) + let python_exe = exepath(pyname) + + if exists('$PATH') + for path in split($PATH, has('win32') ? ';' : ':') + let path_bin = s:normalize_path(path.'/'.pyname) + if path_bin != s:normalize_path(python_exe) + \ && index(python_multiple, path_bin) == -1 + \ && executable(path_bin) + call add(python_multiple, path_bin) + endif + endfor + + if len(python_multiple) + " This is worth noting since the user may install something + " that changes $PATH, like homebrew. + call health#report_info(printf('Multiple %s executables found. ' + \ . 'Set `g:%s` to avoid surprises.', pyname, host_prog_var)) + endif + + if python_exe =~# '\<shims\>' + call health#report_warn(printf('`%s` appears to be a pyenv shim.', python_exe), [ + \ '`pyenv` is not in $PATH, your pyenv installation is broken. ' + \ .'Set `g:'.host_prog_var.'` to avoid surprises.', + \ ]) + endif + endif + endif + endif + + if !empty(python_exe) && !exists('g:'.host_prog_var) + if empty(venv) && !empty(pyenv) + \ && !empty(pyenv_root) && resolve(python_exe) !~# '^'.pyenv_root.'/' + call health#report_warn('pyenv is not set up optimally.', [ + \ printf('Create a virtualenv specifically ' + \ . 'for Neovim using pyenv, and set `g:%s`. This will avoid ' + \ . 'the need to install the pynvim module in each ' + \ . 'version/virtualenv.', host_prog_var) + \ ]) + elseif !empty(venv) + if !empty(pyenv_root) + let venv_root = pyenv_root + else + let venv_root = fnamemodify(venv, ':h') + endif + + if resolve(python_exe) !~# '^'.venv_root.'/' + call health#report_warn('Your virtualenv is not set up optimally.', [ + \ printf('Create a virtualenv specifically ' + \ . 'for Neovim and use `g:%s`. This will avoid ' + \ . 'the need to install the pynvim module in each ' + \ . 'virtualenv.', host_prog_var) + \ ]) + endif + endif + endif + + if empty(python_exe) && !empty(pyname) + " An error message should have already printed. + call health#report_error(printf('`%s` was not found.', pyname)) + elseif !empty(python_exe) && !s:check_bin(python_exe) + let python_exe = '' + endif + + " Check if $VIRTUAL_ENV is valid. + if exists('$VIRTUAL_ENV') && !empty(python_exe) + if $VIRTUAL_ENV ==# matchstr(python_exe, '^\V'.$VIRTUAL_ENV) + call health#report_info('$VIRTUAL_ENV matches executable') + else + 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 + + " Diagnostic output + call health#report_info('Executable: ' . (empty(python_exe) ? 'Not found' : python_exe)) + if len(python_multiple) + for path_bin in python_multiple + call health#report_info('Other python executable: ' . path_bin) + endfor + endif + + let pip = 'pip' . (a:version == 2 ? '' : '3') + + if empty(python_exe) + " No Python executable can import 'neovim'. Check if any Python executable + " can import 'pynvim'. If so, that Python failed to import 'neovim' as + " well, which is most probably due to a failed pip upgrade: + " https://github.com/neovim/neovim/wiki/Following-HEAD#20181118 + let [pynvim_exe, errors] = provider#pythonx#DetectByModule('pynvim', a:version) + if !empty(pynvim_exe) + call health#report_error( + \ 'Detected pip upgrade failure: Python executable can import "pynvim" but ' + \ . 'not "neovim": '. pynvim_exe, + \ "Use that Python version to reinstall \"pynvim\" and optionally \"neovim\".\n" + \ . pip ." uninstall pynvim neovim\n" + \ . pip ." install pynvim\n" + \ . pip ." install neovim # only if needed by third-party software") + endif + else + let [pyversion, current, latest, status] = s:version_info(python_exe) + + if a:version != str2nr(pyversion) + call health#report_warn('Unexpected Python version.' . + \ ' This could lead to confusing error messages.') + endif + + if a:version == 3 && str2float(pyversion) < 3.3 + call health#report_warn('Python 3.3+ is recommended.') + endif + + call health#report_info('Python version: ' . pyversion) + + if s:is_bad_response(status) + call health#report_info(printf('pynvim version: %s (%s)', current, status)) + else + call health#report_info(printf('pynvim version: %s', current)) + endif + + if s:is_bad_response(current) + call health#report_error( + \ "pynvim is not installed.\nError: ".current, + \ ['Run in shell: '. pip .' install pynvim']) + endif + + if s:is_bad_response(latest) + call health#report_warn('Could not contact PyPI to get latest version.') + call health#report_error('HTTP request failed: '.latest) + elseif s:is_bad_response(status) + call health#report_warn(printf('Latest pynvim is NOT installed: %s', latest)) + elseif !s:is_bad_response(current) + call health#report_ok(printf('Latest pynvim is installed.')) + endif + endif +endfunction + +" Check if pyenv is available and a valid pyenv root can be found, then return +" their respective paths. If either of those is invalid, return two empty +" strings, effectivly ignoring pyenv. +function! s:check_for_pyenv() abort + let pyenv_path = resolve(exepath('pyenv')) + + if empty(pyenv_path) + return ['', ''] + endif + + call health#report_info('pyenv: Path: '. pyenv_path) + + let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : '' + + if empty(pyenv_root) + let pyenv_root = s:trim(s:system([pyenv_path, 'root'])) + call health#report_info('pyenv: $PYENV_ROOT is not set. Infer from `pyenv root`.') + endif + + if !isdirectory(pyenv_root) + call health#report_warn( + \ printf('pyenv: Root does not exist: %s. ' + \ . 'Ignoring pyenv for all following checks.', pyenv_root)) + return ['', ''] + endif + + call health#report_info('pyenv: Root: '.pyenv_root) + + return [pyenv_path, pyenv_root] +endfunction + +function! s:check_ruby() abort + call health#report_start('Ruby provider (optional)') + + let loaded_var = 'g:loaded_ruby_provider' + if exists(loaded_var) && !exists('*provider#ruby#Call') + call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var)) + return + endif + + if !executable('ruby') || !executable('gem') + call health#report_warn( + \ '`ruby` and `gem` must be in $PATH.', + \ ['Install Ruby and verify that `ruby` and `gem` commands work.']) + return + endif + call health#report_info('Ruby: '. s:system('ruby -v')) + + let host = provider#ruby#Detect() + if empty(host) + 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) + + let latest_gem_cmd = has('win32') ? 'cmd /c gem list -ra ^^neovim$' : 'gem list -ra ^neovim$' + let latest_gem = s:system(split(latest_gem_cmd)) + if s:shell_error || empty(latest_gem) + call health#report_error('Failed to run: '. latest_gem_cmd, + \ ["Make sure you're connected to the internet.", + \ 'Are you behind a firewall or proxy?']) + return + endif + let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 1, 'not found') + + let current_gem_cmd = host .' --version' + let current_gem = s:system(current_gem_cmd) + if s:shell_error + call health#report_error('Failed to run: '. current_gem_cmd, + \ ['Report this issue with the output of: ', current_gem_cmd]) + return + endif + + if s:version_cmp(current_gem, latest_gem) == -1 + call health#report_warn( + \ printf('Gem "neovim" is out-of-date. Installed: %s, latest: %s', + \ current_gem, latest_gem), + \ ['Run in shell: gem update neovim']) + else + call health#report_ok('Latest "neovim" gem is installed: '. current_gem) + endif +endfunction + +function! s:check_node() abort + call health#report_start('Node.js provider (optional)') + + let loaded_var = 'g:loaded_node_provider' + if exists(loaded_var) && !exists('*provider#node#Call') + call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var)) + return + endif + + if !executable('node') || (!executable('npm') && !executable('yarn')) + call health#report_warn( + \ '`node` and `npm` (or `yarn`) must be in $PATH.', + \ ['Install Node.js and verify that `node` and `npm` (or `yarn`) commands work.']) + return + endif + 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) + call health#report_warn('Missing "neovim" npm (or yarn) package.', + \ ['Run in shell: npm install -g neovim', + \ 'Run in shell (if you use yarn): yarn global add neovim']) + return + endif + 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)) + if s:shell_error || empty(latest_npm) + call health#report_error('Failed to run: '. latest_npm_cmd, + \ ["Make sure you're connected to the internet.", + \ 'Are you behind a firewall or proxy?']) + return + endif + if !empty(latest_npm) + try + let pkg_data = json_decode(latest_npm) + catch /E474/ + return 'error: '.latest_npm + endtry + let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse') + endif + + 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: '. string(current_npm_cmd), + \ ['Report this issue with the output of: ', string(current_npm_cmd)]) + return + endif + + if s:version_cmp(current_npm, latest_npm) == -1 + call health#report_warn( + \ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s', + \ current_npm, latest_npm), + \ ['Run in shell: npm install -g neovim']) + else + call health#report_ok('Latest "neovim" npm/yarn package is installed: '. current_npm) + endif +endfunction + +function! health#provider#check() abort + call s:check_clipboard() + call s:check_python(2) + call s:check_python(3) + call s:check_ruby() + call s:check_node() +endfunction diff --git a/runtime/autoload/javascriptcomplete.vim b/runtime/autoload/javascriptcomplete.vim index 2abe41b463..14bc3d7ce3 100644 --- a/runtime/autoload/javascriptcomplete.vim +++ b/runtime/autoload/javascriptcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Java Script " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 Apr 30 +" Last Change: 2017 Mar 04 function! javascriptcomplete#CompleteJS(findstart, base) if a:findstart @@ -563,7 +563,7 @@ function! javascriptcomplete#CompleteJS(findstart, base) for i in arguments let g:ia = i let f_elements = matchlist(i, 'function\s\+\(\k\+\)\s*(\(.\{-}\))') - if len(f_elements) == 3 + if len(f_elements) >= 3 let b:js_menuinfo[f_elements[1].'('] = f_elements[2] endif endfor diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index 0dfcc424e2..41c2f5a405 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -1,137 +1,408 @@ -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 - -" Load man page {page} from {section} -" call man#get_page([{section}, ]{page}) -function man#get_page(...) abort - let invoked_from_man = (&filetype ==# 'man') - - if a:0 == 0 - echoerr 'argument required' - return - elseif a:0 > 2 - echoerr 'too many arguments' - return - endif +" Maintainer: Anmol Sethi <anmol@aubble.com> - let sect = get(a:000, 0) - let page = get(a:000, 1, sect) +if exists('s:loaded_man') + finish +endif +let s:loaded_man = 1 - let [page, sect] = s:parse_page_and_section(sect, page) +let s:find_arg = '-w' +let s:localfile_arg = v:true " Always use -l if possible. #6683 +let s:section_arg = '-s' - if !empty(sect) && s:find_page(sect, page) == 0 - let sect = '' +function! s:init_section_flag() + call system(['env', 'MANPAGER=cat', 'man', s:section_arg, '1', 'man']) + if v:shell_error + let s:section_arg = '-S' endif +endfunction + +function! s:init() abort + call s:init_section_flag() + " TODO(nhooyr): Does `man -l` on SunOS list searched directories? + try + if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5' + let s:find_arg = '-l' + endif + " Check for -l support. + call s:get_page(s:get_path('', 'man')) + catch /E145:/ + " Ignore the error in restricted mode + catch /command error .*/ + let s:localfile_arg = v:false + endtry +endfunction - if s:find_page(sect, page) == 0 - echo 'No manual entry for '.page +function! man#open_page(count, count1, mods, ...) abort + if a:0 > 2 + call s:error('too many arguments') return + elseif a:0 == 0 + let ref = &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>') + if empty(ref) + call s:error('no identifier under cursor') + return + endif + elseif a:0 ==# 1 + let ref = a:1 + else + " Combine the name and sect into a manpage reference so that all + " verification/extraction can be kept in a single function. + " If a:2 is a reference as well, that is fine because it is the only + " reference that will match. + let ref = a:2.'('.a:1.')' endif + try + let [sect, name] = man#extract_sect_and_name_ref(ref) + if a:count ==# a:count1 + " v:count defaults to 0 which is a valid section, and v:count1 defaults to + " 1, also a valid section. If they are equal, count explicitly set. + let sect = string(a:count) + endif + let [sect, name, path] = s:verify_exists(sect, name) + catch + call s:error(v:exception) + return + endtry + + call s:push_tag() + let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')') - 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 editcmd = 'edit' - " Use an existing 'man' window, else open a new one. - if &filetype !=# 'man' - let thiswin = winnr() - wincmd b - if winnr() > 1 - exec thiswin . 'wincmd w' - while 1 - if &filetype ==# 'man' - break - endif - wincmd w - if thiswin == winnr() - break - endif - endwhile + try + set eventignore+=BufReadCmd + if a:mods !~# 'tab' && s:find_man() + execute 'silent keepalt edit' fnameescape(bufname) + else + execute 'silent keepalt' a:mods 'split' fnameescape(bufname) endif + finally + set eventignore-=BufReadCmd + endtry - if &filetype !=# 'man' - let editcmd = 'tabnew' + try + let page = s:get_page(path) + catch + if a:mods =~# 'tab' || !s:find_man() + " a new window was opened + close endif + call s:error(v:exception) + return + endtry + + let b:man_sect = sect + call s:put_page(page) +endfunction + +function! man#read_page(ref) abort + try + let [sect, name] = man#extract_sect_and_name_ref(a:ref) + let [sect, name, path] = s:verify_exists(sect, name) + let page = s:get_page(path) + catch + call s:error(v:exception) + return + endtry + let b:man_sect = sect + call s:put_page(page) +endfunction + +" Handler for s:system() function. +function! s:system_handler(jobid, data, event) dict abort + if a:event is# 'stdout' || a:event is# 'stderr' + let self[a:event] .= join(a:data, "\n") + else + let self.exit_code = a:data endif +endfunction - silent exec editcmd.' man://'.page.(empty(sect)?'':'('.sect.')') +" Run a system command and timeout after 30 seconds. +function! s:system(cmd, ...) abort + let opts = { + \ 'stdout': '', + \ 'stderr': '', + \ 'exit_code': 0, + \ 'on_stdout': function('s:system_handler'), + \ 'on_stderr': function('s:system_handler'), + \ 'on_exit': function('s:system_handler'), + \ } + let jobid = jobstart(a:cmd, opts) - setlocal modifiable - silent keepjumps norm! 1G"_dG - if empty($MANWIDTH) - let $MANWIDTH = winwidth(0) + if jobid < 1 + throw printf('command error %d: %s', jobid, join(a:cmd)) endif - silent exec 'r!/usr/bin/man '.s:cmd(sect, page).' | col -b' - " Remove blank lines from top and bottom. + + let res = jobwait([jobid], 30000) + if res[0] == -1 + try + call jobstop(jobid) + throw printf('command timed out: %s', join(a:cmd)) + catch /^Vim(call):E900:/ + endtry + elseif res[0] == -2 + throw printf('command interrupted: %s', join(a:cmd)) + endif + if opts.exit_code != 0 + throw printf("command error (%d) %s: %s", jobid, join(a:cmd), substitute(opts.stderr, '\_s\+$', '', &gdefault ? '' : 'g')) + endif + + return opts.stdout +endfunction + +function! s:get_page(path) abort + " Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065). + " We use soft wrap: ftplugin/man.vim sets wrap/breakindent/…. + let manwidth = 999 + " Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db). + " http://comments.gmane.org/gmane.editors.vim.devel/29085 + " 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 + +function! s:put_page(page) abort + setlocal modifiable + setlocal noreadonly + silent keepjumps %delete _ + silent put =a:page while getline(1) =~# '^\s*$' silent keepjumps 1delete _ endwhile - while getline('$') =~# '^\s*$' - silent keepjumps $delete _ - endwhile - setlocal nomodified + " XXX: nroff justifies text by filling it with whitespace. That interacts + " badly with our use of $MANWIDTH=999. Hack around this by using a fixed + " size for those whitespace regions. + silent! keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g + 1 + lua require("man").highlight_man_page() setlocal filetype=man +endfunction - if invoked_from_man || editcmd ==# 'tabnew' - call s:set_window_local_options() +function! man#show_toc() abort + let bufname = bufname('%') + let info = getloclist(0, {'winid': 1}) + if !empty(info) && getwinvar(info.winid, 'qf_toc') ==# bufname + lopen + return endif + + let toc = [] + let lnum = 2 + let last_line = line('$') - 1 + while lnum && lnum < last_line + let text = getline(lnum) + if text =~# '^\%( \{3\}\)\=\S.*$' + call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum, 'text': text}) + endif + let lnum = nextnonblank(lnum + 1) + endwhile + + call setloclist(0, toc, ' ') + call setloclist(0, [], 'a', {'title': 'Man TOC'}) + lopen + let w:qf_toc = bufname endfunction -function s:set_window_local_options() abort - setlocal colorcolumn=0 foldcolumn=0 nonumber - setlocal nolist norelativenumber nofoldenable +" attempt to extract the name and sect out of 'name(sect)' +" otherwise just return the largest string of valid characters in ref +function! man#extract_sect_and_name_ref(ref) abort + if a:ref[0] ==# '-' " try ':Man -pandoc' with this disabled. + throw 'manpage name cannot start with ''-''' + endif + let ref = matchstr(a:ref, '[^()]\+([^()]\+)') + if empty(ref) + let name = matchstr(a:ref, '[^()]\+') + if empty(name) + throw 'manpage reference cannot contain only parentheses' + endif + return [get(b:, 'man_default_sects', ''), name] + endif + let left = split(ref, '(') + " see ':Man 3X curses' on why tolower. + " TODO(nhooyr) Not sure if this is portable across OSs + " but I have not seen a single uppercase section. + return [tolower(split(left[1], ')')[0]), left[0]] endfunction -function man#pop_page() abort - 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 +function! s:get_path(sect, name) abort + " Some man implementations (OpenBSD) return all available paths from the + " search command, so we get() the first one. #8341 + if empty(a:sect) + return substitute(get(split(s:system(['man', s:find_arg, a:name])), 0, ''), '\n\+$', '', '') endif + " '-s' flag handles: + " - tokens like 'printf(echo)' + " - sections starting with '-' + " - 3pcap section (found on macOS) + " - commas between sections (for section priority) + return substitute(get(split(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])), 0, ''), '\n\+$', '', '') endfunction -" Expects a string like 'access' or 'access(2)'. -function s:parse_page_and_section(sect, str) abort +function! s:verify_exists(sect, name) abort try - let [page, sect] = matchlist(a:str, '\v\C([-.[:alnum:]_]+)%(\(([-.[:alnum:]_]+)\))?')[1:2] - if empty(sect) - let sect = a:sect + let path = s:get_path(a:sect, a:name) + catch /^command error (/ + try + let path = s:get_path(get(b:, 'man_default_sects', ''), a:name) + catch /^command error (/ + let path = s:get_path('', a:name) + endtry + endtry + " Extract the section from the path, because sometimes the actual section is + " more specific than what we provided to `man` (try `:Man 3 App::CLI`). + " Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we + " still want the name of the buffer to be 'printf'. + return s:extract_sect_and_name_path(path) + [path] +endfunction + +let s:tag_stack = [] + +function! s:push_tag() abort + let s:tag_stack += [{ + \ 'buf': bufnr('%'), + \ 'lnum': line('.'), + \ 'col': col('.'), + \ }] +endfunction + +function! man#pop_tag() abort + if !empty(s:tag_stack) + let tag = remove(s:tag_stack, -1) + execute 'silent' tag['buf'].'buffer' + call cursor(tag['lnum'], tag['col']) + endif +endfunction + +" extracts the name and sect out of 'path/name.sect' +function! s:extract_sect_and_name_path(path) abort + let tail = fnamemodify(a:path, ':t') + if a:path =~# '\.\%([glx]z\|bz2\|lzma\|Z\)$' " valid extensions + let tail = fnamemodify(tail, ':r') + endif + let sect = matchstr(tail, '\.\zs[^.]\+$') + let name = matchstr(tail, '^.\+\ze\.') + return [sect, name] +endfunction + +function! s:find_man() abort + if &filetype ==# 'man' + return 1 + elseif winnr('$') ==# 1 + return 0 + endif + let thiswin = winnr() + while 1 + wincmd w + if &filetype ==# 'man' + return 1 + elseif thiswin ==# winnr() + return 0 + endif + endwhile +endfunction + +function! s:error(msg) abort + redraw + echohl ErrorMsg + echon 'man.vim: ' a:msg + echohl None +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 + elseif l ==# 1 + let name = '' + let sect = '' + elseif a:arg_lead =~# '^[^()]\+([^()]*$' + " cursor (|) is at ':Man printf(|' or ':Man 1 printf(|' + " The later is is allowed because of ':Man pri<TAB>'. + " It will offer 'priclass.d(1m)' even though section is specified as 1. + let tmp = split(a:arg_lead, '(') + let name = tmp[0] + let sect = tolower(get(tmp, 1, '')) + return s:complete(sect, '', name) + elseif args[1] !~# '^[^()]\+$' + " cursor (|) is at ':Man 3() |' or ':Man (3|' or ':Man 3() pri|' + " or ':Man 3() pri |' + return + elseif l ==# 2 + if empty(a:arg_lead) + " cursor (|) is at ':Man 1 |' + let name = '' + let sect = tolower(args[1]) + else + " cursor (|) is at ':Man pri|' + if a:arg_lead =~# '\/' + " if the name is a path, complete files + " TODO(nhooyr) why does this complete the last one automatically + return glob(a:arg_lead.'*', 0, 1) + endif + let name = a:arg_lead + let sect = '' endif + elseif a:arg_lead !~# '^[^()]\+$' + " cursor (|) is at ':Man 3 printf |' or ':Man 3 (pr)i|' + return + else + " cursor (|) is at ':Man 3 pri|' + let name = a:arg_lead + let sect = tolower(args[1]) + endif + return s:complete(sect, sect, name) +endfunction + +function! s:complete(sect, psect, name) abort + try + let mandirs = join(split(s:system(['man', s:find_arg]), ':\|\n'), ',') catch - echoerr 'man.vim: failed to parse: "'.a:str.'"' + call s:error(v:exception) + return endtry - - return [page, sect] + let pages = globpath(mandirs,'man?/'.a:name.'*.'.a:sect.'*', 0, 1) + " We remove duplicates in case the same manpage in different languages was found. + return uniq(sort(map(pages, 's:format_candidate(v:val, a:psect)'), 'i')) endfunction -function s:cmd(sect, page) abort - if !empty(a:sect) - return s:man_sect_arg.' '.a:sect.' '.a:page +function! s:format_candidate(path, psect) abort + if a:path =~# '\.\%(pdf\|in\)$' " invalid extensions + return + endif + let [sect, name] = s:extract_sect_and_name_path(a:path) + if sect ==# a:psect + return name + elseif sect =~# a:psect.'.\+$' + " We include the section if the user provided section is a prefix + " of the actual section. + return name.'('.sect.')' endif - return a:page endfunction -function s:find_page(sect, page) abort - let where = system('/usr/bin/man '.s:man_find_arg.' '.s:cmd(a:sect, a:page)) - return (where =~# '^ */') +function! man#init_pager() abort + if getline(1) =~# '^\s*$' + silent keepjumps 1delete _ + else + keepjumps 1 + endif + lua require("man").highlight_man_page() + " Guess the ref from the heading (which is usually uppercase, so we cannot + " know the correct casing, cf. `man glDrawArraysInstanced`). + let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g') + try + let b:man_sect = man#extract_sect_and_name_ref(ref)[0] + catch + let b:man_sect = '' + endtry + if -1 == match(bufname('%'), 'man:\/\/') " Avoid duplicate buffers, E95. + execute 'silent file man://'.tolower(fnameescape(ref)) + endif endfunction + +call s:init() diff --git a/runtime/autoload/msgpack.vim b/runtime/autoload/msgpack.vim index 2e2697c57f..7dd225e3d9 100644 --- a/runtime/autoload/msgpack.vim +++ b/runtime/autoload/msgpack.vim @@ -40,9 +40,10 @@ function s:msgpack_init_python() abort return s:msgpack_python_type endif let s:msgpack_python_initialized = 1 - for suf in ['', '3'] + for suf in (has('win32') ? ['3'] : ['', '3']) try execute 'python' . suf + \. "\n" \. "def shada_dict_strftime():\n" \. " import datetime\n" \. " import vim\n" @@ -60,12 +61,15 @@ function s:msgpack_init_python() abort \. " fmt = vim.eval('a:format')\n" \. " timestr = vim.eval('a:string')\n" \. " timestamp = datetime.datetime.strptime(timestr, fmt)\n" - \. " timestamp = int(timestamp.timestamp())\n" + \. " try:\n" + \. " timestamp = int(timestamp.timestamp())\n" + \. " except:\n" + \. " timestamp = int(timestamp.strftime('%s'))\n" \. " if timestamp > 2 ** 31:\n" - \. " tsabs = abs(timestamp)" + \. " tsabs = abs(timestamp)\n" \. " return ('{\"_TYPE\": v:msgpack_types.integer,'\n" \. " + '\"_VAL\": [{sign},{v1},{v2},{v3}]}').format(\n" - \. " sign=1 if timestamp >= 0 else -1,\n" + \. " sign=(1 if timestamp >= 0 else -1),\n" \. " v1=((tsabs >> 62) & 0x3),\n" \. " v2=((tsabs >> 31) & (2 ** 31 - 1)),\n" \. " v3=(tsabs & (2 ** 31 - 1)))\n" @@ -601,13 +605,10 @@ function msgpack#eval(s, special_objs) abort call add(expr, dec) endif endif - elseif s =~# '-\?\%(inf\|nan\)' - if s[0] is# '-' - call add(expr, '-') - let s = s[1:] - endif - call add(expr, s:MSGPACK_SPECIAL_OBJECTS[s[0:2]]) - let s = s[3:] + elseif s =~# '\v^\-%(inf|nan)' + call add(expr, '-') + call add(expr, s:MSGPACK_SPECIAL_OBJECTS[s[1:3]]) + let s = s[4:] elseif stridx('="+', s[0]) != -1 let match = matchlist(s, '\v\C^(\=|\+\((\-?\d+)\)|)(\"%(\\.|[^\\"]+)*\")') if empty(match) @@ -665,11 +666,15 @@ function msgpack#eval(s, special_objs) abort call add(expr, ']}') let s = s[1:] elseif s[0] is# '''' - let char = matchstr(s, '\m\C^''\zs.\ze''') + let char = matchstr(s, '\v\C^\''\zs%(\\\d+|.)\ze\''') if empty(char) throw 'char-invalid:Invalid integer character literal format: ' . s endif - call add(expr, char2nr(char)) + if char[0] is# '\' + call add(expr, +char[1:]) + else + call add(expr, char2nr(char)) + endif let s = s[len(char) + 2:] else throw 'unknown:Invalid non-space character: ' . s diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 64c08e98fa..76485c2f38 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,7 +1,7 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Feb 16, 2016 -" Version: 155 ASTRO-ONLY +" Date: Apr 20, 2016 +" Version: 156 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 @@ -13,7 +13,7 @@ " expressed or implied. By using this plugin, you agree that " in no event will the copyright holder be liable for any damages " resulting from the use of this software. -"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore(,'~'.expand("<slnum>")) +"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore() " " But be doers of the Word, and not only hearers, deluding your own selves {{{1 " (James 1:22 RSV) @@ -22,15 +22,15 @@ if &cp || exists("g:loaded_netrw") finish endif -" netrw requires vim having patch 213; netrw will benefit from vim's having patch#656, too -if v:version < 704 || !has("patch213") +" netrw requires vim having patch 7.4.213; netrw will benefit from vim's having patch#656, too +if v:version < 704 || (v:version == 704 && !has("patch213")) if !exists("s:needpatch213") unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch 213" endif let s:needpatch213= 1 finish endif -let g:loaded_netrw = "v155" +let g:loaded_netrw = "v156" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -444,7 +444,7 @@ call s:NetrwInit("g:netrw_markfileesc" , '*./[\~') call s:NetrwInit("g:netrw_maxfilenamelen", 32) call s:NetrwInit("g:netrw_menu" , 1) call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir") -call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~ '[anh]')) +call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~# '[anh]')) call s:NetrwInit("g:netrw_retmap" , 0) if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") @@ -490,6 +490,7 @@ if !exists("g:netrw_sort_sequence") endif call s:NetrwInit("g:netrw_special_syntax" , 0) call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$') +call s:NetrwInit("g:netrw_suppress_gx_mesg", 1) call s:NetrwInit("g:netrw_use_noswf" , 1) call s:NetrwInit("g:netrw_sizestyle" ,"b") " Default values - t-w ---------- {{{3 @@ -526,6 +527,7 @@ if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4' else let s:treedepthstring= "| " endif +call s:NetrwInit("s:netrw_nbcd",'{}') " BufEnter event ignored by decho when following variable is true " Has a side effect that doau BufReadPost doesn't work, so @@ -551,7 +553,7 @@ if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists( endif au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif -if g:netrw_keepj =~ "keepj" +if g:netrw_keepj =~# "keepj" com! -nargs=* NetrwKeepj keepj <args> else let g:netrw_keepj= "" @@ -821,7 +823,7 @@ fun! netrw#Explore(indx,dosplit,style,...) let dirname= curfiledir " call Decho("..empty dirname, using current file's directory<".dirname.">",'~'.expand("<slnum>")) endif - if dirname =~ '^scp://' || dirname =~ '^ftp://' + if dirname =~# '^scp://' || dirname =~ '^ftp://' call netrw#Nread(2,dirname) else if dirname == "" @@ -1560,15 +1562,7 @@ fun! s:NetrwOptionRestore(vt) " call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) if !exists("{a:vt}netrw_optionsave") - if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring posn to s:nbcd_curpos_".bufnr('%')."<".string(s:nbcd_curpos_{bufnr('%')}).">",'~'.expand("<slnum>")) - NetrwKeepj call winrestview(s:nbcd_curpos_{bufnr('%')}) -" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$"),'~'.expand("<slnum>")) -" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("<slnum>")) - unlet s:nbcd_curpos_{bufnr('%')} - else -" call Decho("no previous position",'~'.expand("<slnum>")) - endif + call s:RestorePosn(s:netrw_nbcd) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") @@ -1656,16 +1650,7 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_regstar") |sil! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif endif if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif - if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring posn to s:nbcd_curpos_".bufnr('%')."<".string(s:nbcd_curpos_{bufnr('%')}).">",'~'.expand("<slnum>")) - NetrwKeepj call winrestview(s:nbcd_curpos_{bufnr('%')}) -" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("<slnum>")) - if exists("s:nbcd_curpos_".bufnr('%')) - unlet s:nbcd_curpos_{bufnr('%')} - endif - else -" call Decho("no previous position",'~'.expand("<slnum>")) - endif + call s:RestorePosn(s:netrw_nbcd) " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("<slnum>")) @@ -3016,10 +3001,10 @@ fun! s:NetrwMethod(choice) if exists("s:netrw_hup[host]") call NetUserPass("ftp:".host) - elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~ '-[sS]:' + elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~# '-[sS]:' " call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("<slnum>")) " call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">",'~'.expand("<slnum>")) - if g:netrw_ftp_cmd =~ '-[sS]:\S*MACHINE\>' + if g:netrw_ftp_cmd =~# '-[sS]:\S*MACHINE\>' let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\<MACHINE\>',g:netrw_machine,'') " call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("<slnum>")) endif @@ -3583,7 +3568,7 @@ fun! s:NetrwBrowse(islocal,dirname) " This is useful when one edits a local file, then :e ., then :Rex if a:islocal && !exists("w:netrw_rexfile") && bufname("#") != "" let w:netrw_rexfile= bufname("#") -" call Decho("setting w:netrw_rexfile<".w:netrw_rexfile."> win#".winnr()) +" call Decho("setting w:netrw_rexfile<".w:netrw_rexfile."> win#".winnr(),'~'.expand("<slnum>")) endif " s:NetrwBrowse : initialize history {{{3 @@ -3773,7 +3758,7 @@ fun! s:NetrwBrowse(islocal,dirname) " analyze dirname and g:netrw_list_cmd {{{3 " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">",'~'.expand("<slnum>")) - if dirname =~ "^NetrwTreeListing\>" + if dirname =~# "^NetrwTreeListing\>" let dirname= b:netrw_curdir " call Decho("(dirname was <NetrwTreeListing>) dirname<".dirname.">",'~'.expand("<slnum>")) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") @@ -3854,15 +3839,15 @@ endfun " directory is used. fun! s:NetrwFile(fname) " call Dfunc("s:NetrwFile(fname<".a:fname.">) win#".winnr()) -" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a')) -" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a')) -" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a')) -" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) +" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>")) +" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a'),'~'.expand("<slnum>")) +" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) +" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) " clean up any leading treedepthstring if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST let fname= substitute(a:fname,'^'.s:treedepthstring.'\+','','') -" call Decho("clean up any leading treedepthstring: fname<".fname.">") +" call Decho("clean up any leading treedepthstring: fname<".fname.">",'~'.expand("<slnum>")) else let fname= a:fname endif @@ -3897,6 +3882,8 @@ fun! s:NetrwFile(fname) " vim and netrw agree on the current directory let ret= fname " call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("<slnum>")) +" call Decho("vim directory: ".getcwd(),'~'.expand("<slnum>")) +" call Decho("netrw directory: ".(exists("b:netrw_curdir")? b:netrw_curdir : 'n/a'),'~'.expand("<slnum>")) endif " call Dret("s:NetrwFile ".ret) @@ -3910,9 +3897,9 @@ fun! s:NetrwFileInfo(islocal,fname) let ykeep= @@ if a:islocal let lsopt= "-lsad" - if g:netrw_sizestyle =~ 'H' + if g:netrw_sizestyle =~# 'H' let lsopt= "-lsadh" - elseif g:netrw_sizestyle =~ 'h' + elseif g:netrw_sizestyle =~# 'h' let lsopt= "-lsadh --si" endif if (has("unix") || has("macunix")) && executable("/bin/ls") @@ -3944,7 +3931,7 @@ fun! s:NetrwFileInfo(islocal,fname) endif let t = getftime(s:NetrwFile(fname)) let sz = getfsize(s:NetrwFile(fname)) - if g:netrw_sizestyle =~ "[hH]" + if g:netrw_sizestyle =~# "[hH]" let sz= s:NetrwHumanReadable(sz) endif echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(s:NetrwFile(fname))) @@ -3958,108 +3945,49 @@ fun! s:NetrwFileInfo(islocal,fname) endfun " --------------------------------------------------------------------- +" s:NetrwFullPath: returns the full path to a directory and/or file {{{2 +fun! s:NetrwFullPath(filename) +" " call Dfunc("s:NetrwFullPath(filename<".a:filename.">)") + let filename= a:filename + if filename !~ '^/' + let filename= resolve(getcwd().'/'.filename) + endif + if filename != "/" && filename =~ '/$' + let filename= substitute(filename,'/$','','') + endif +" " call Dret("s:NetrwFullPath <".filename.">") + return filename +endfun + +" --------------------------------------------------------------------- " s:NetrwGetBuffer: {{{2 " returns 0=cleared buffer " 1=re-used buffer (buffer not cleared) fun! s:NetrwGetBuffer(islocal,dirname) " call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) +" call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("<slnum>")) let dirname= a:dirname " re-use buffer if possible {{{3 " call Decho("--re-use a buffer if possible--",'~'.expand("<slnum>")) - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - " find NetrwTreeList buffer if there is one -" call Decho("case liststyle=treelist: find NetrwTreeList buffer if there is one",'~'.expand("<slnum>")) - if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 -" call Decho(" re-using w:netrw_treebufnr=".w:netrw_treebufnr,'~'.expand("<slnum>")) - let eikeep= &ei - setl ei=all - exe "sil! keepj noswapfile keepalt b ".w:netrw_treebufnr - let &ei= eikeep - setl ma - sil! NetrwKeepj %d _ -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) -" call Dret("s:NetrwGetBuffer 0<buffer cleared> : bufnum#".w:netrw_treebufnr."<NetrwTreeListing>") - return 0 + if !exists("s:netrwbuf") + let s:netrwbuf= {} + endif + if has_key(s:netrwbuf,s:NetrwFullPath(dirname)) + let bufnum= s:netrwbuf[s:NetrwFullPath(dirname)] +" call Decho("lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnum) + if !bufexists(bufnum) + call remove(s:netrwbuf,s:NetrwFullPath(dirname)) + let bufnum= -1 endif - let bufnum= -1 -" call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist",'~'.expand("<slnum>")) - else - " find buffer number of buffer named precisely the same as dirname {{{3 -" call Decho("case listtyle not treelist: find buffer numnber of buffer named precisely the same as dirname--",'~'.expand("<slnum>")) -" call Dredir("(NetrwGetBuffer) ls!","ls!") - - " get dirname and associated buffer number - let bufnum = bufnr(escape(dirname,'\')) -" call Decho(" find buffer<".dirname.">'s number ",'~'.expand("<slnum>")) -" call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum,'~'.expand("<slnum>")) - - if bufnum < 0 && dirname !~ '/$' - " try appending a trailing / -" call Decho(" try appending a trailing / to dirname<".dirname.">",'~'.expand("<slnum>")) - let bufnum= bufnr(escape(dirname.'/','\')) - if bufnum > 0 - let dirname= dirname.'/' - endif - endif - - if bufnum < 0 && dirname =~ '/$' - " try removing a trailing / -" call Decho(" try removing a trailing / from dirname<".dirname.">",'~'.expand("<slnum>")) - let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\')) - if bufnum > 0 - let dirname= substitute(dirname,'/$','','') - endif - endif - -" call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)",'~'.expand("<slnum>")) - " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches) - if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' - " handle approximate matches -" call Decho(" handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'",'~'.expand("<slnum>")) - let ibuf = 1 - let buflast = bufnr("$") -" call Decho(" findbuf2: buflast=bufnr($)=".buflast,'~'.expand("<slnum>")) - while ibuf <= buflast - let bname= substitute(bufname(ibuf),'\\','/','g') - let bname= substitute(bname,'.\zs/$','','') -" call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">",'~'.expand("<slnum>")) - if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/' - " bname is not empty - " dirname ends with bname, - " dirname doesn't start with /, so its not a absolute path -" call Decho(" findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/','~'.expand("<slnum>")) - break - endif - if bname =~ '^'.dirname.'/\=$' - " bname begins with dirname -" call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$','~'.expand("<slnum>")) - break - endif - if dirname =~ '^'.bname.'/$' -" call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$','~'.expand("<slnum>")) - break - endif - if bname != '' && dirname =~ '/'.bname.'$' && bname == bufname("%") && line("$") == 1 -" call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$','~'.expand("<slnum>")) - break - endif - let ibuf= ibuf + 1 - endwhile - if ibuf > buflast - let bufnum= -1 - else - let bufnum= ibuf - endif -" call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")",'~'.expand("<slnum>")) - endif +" call Decho("lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."] not a key") + let bufnum= -1 endif " get enew buffer and name it -or- re-use buffer {{{3 - if bufnum < 0 || !bufexists(bufnum) " get enew buffer and name it + if bufnum < 0 " get enew buffer and name it " call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)",'~'.expand("<slnum>")) call s:NetrwEnew(dirname) " call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)",'~'.expand("<slnum>")) @@ -4093,6 +4021,10 @@ fun! s:NetrwGetBuffer(islocal,dirname) " let v:errmsg= "" " Decho exe 'sil! keepj keepalt file '.escdirname " call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">",'~'.expand("<slnum>")) + " enter the new buffer into the s:netrwbuf dictionary + let s:netrwbuf[s:NetrwFullPath(dirname)]= bufnr("%") +" call Decho("update netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnr("%"),'~'.expand("<slnum>")) +" call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("<slnum>")) endif " call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) @@ -4100,7 +4032,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)",'~'.expand("<slnum>")) let eikeep= &ei setl ei=all - if getline(2) =~ '^" Netrw Directory Listing' + if getline(2) =~# '^" Netrw Directory Listing' " call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum,'~'.expand("<slnum>")) exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum else @@ -4215,20 +4147,20 @@ fun! s:NetrwGetWord() let dirname= "./" let curline= getline('.') - if curline =~ '"\s*Sorted by\s' + if curline =~# '"\s*Sorted by\s' NetrwKeepj norm s let s:netrw_skipbrowse= 1 echo 'Pressing "s" also works' - elseif curline =~ '"\s*Sort sequence:' + elseif curline =~# '"\s*Sort sequence:' let s:netrw_skipbrowse= 1 echo 'Press "S" to edit sorting sequence' - elseif curline =~ '"\s*Quick Help:' + elseif curline =~# '"\s*Quick Help:' NetrwKeepj norm ? let s:netrw_skipbrowse= 1 - elseif curline =~ '"\s*\%(Hiding\|Showing\):' + elseif curline =~# '"\s*\%(Hiding\|Showing\):' NetrwKeepj norm a let s:netrw_skipbrowse= 1 echo 'Pressing "a" also works' @@ -4471,10 +4403,10 @@ fun! s:NetrwBookmark(del,...) let i = 1 while i <= a:0 if islocal - if v:version == 704 && has("patch656") - let mbfiles= glob(a:{i},0,1,1) + if v:version > 704 || (v:version == 704 && has("patch656")) + let mbfiles= glob(fnameescape(a:{i}),0,1,1) else - let mbfiles= glob(a:{i},0,1) + let mbfiles= glob(fnameescape(a:{i}),0,1) endif else let mbfiles= [a:{i}] @@ -4578,14 +4510,13 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Dret("s:NetrwBrowseChgDir") return endif +" call Decho("b:netrw_curdir<".b:netrw_curdir.">") " NetrwBrowseChgDir: save options and initialize {{{3 " call Decho("saving options",'~'.expand("<slnum>")) + call s:SavePosn(s:netrw_nbcd) NetrwKeepj call s:NetrwOptionSave("s:") NetrwKeepj call s:NetrwSafeOptions() - let nbcd_curpos = winsaveview() -" call Decho("saving posn to nbcd_curpos<".string(nbcd_curpos).">",'~'.expand("<slnum>")) - let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos if (has("win32") || has("win95") || has("win64") || has("win16")) let dirname = substitute(b:netrw_curdir,'\\','/','ge') else @@ -4601,15 +4532,14 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if g:netrw_banner " call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("<slnum>")) if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt - if getline(".") =~ 'Quick Help' + if getline(".") =~# 'Quick Help' " call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) let g:netrw_quickhelp= (g:netrw_quickhelp + 1)%len(s:QuickHelp) " call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) setl ma noro nowrap NetrwKeepj call setline(line('.'),'" Quick Help: <F1>:help '.s:QuickHelp[g:netrw_quickhelp]) setl noma nomod nowrap -" call Decho("restoring posn to nbcd_curpos<".string(nbcd_curpos).">",'~'.expand("<slnum>")) - NetrwKeepj call winrestview(nbcd_curpos) + call s:RestorePosn(s:netrw_nbcd) NetrwKeepj call s:NetrwOptionRestore("s:") " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif @@ -4633,7 +4563,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("adjusting dirname<".dirname.'> (put trailing "/" back)','~'.expand("<slnum>")) endif -" " call Decho("[newdir<".newdir."> ".((newdir =~ dirpat)? "=~" : "!~")." dirpat<".dirpat.">] && [islocal=".a:islocal."] && [newdir is ".(isdirectory(s:NetrwFile(newdir))? "" : "not ")."a directory]",'~'.expand("<slnum>")) +" call Decho("[newdir<".newdir."> ".((newdir =~ dirpat)? "=~" : "!~")." dirpat<".dirpat.">] && [islocal=".a:islocal."] && [newdir is ".(isdirectory(s:NetrwFile(newdir))? "" : "not ")."a directory]",'~'.expand("<slnum>")) if newdir !~ dirpat && !(a:islocal && isdirectory(s:NetrwFile(s:ComposePath(dirname,newdir)))) " ------------------------------ " NetrwBrowseChgDir: edit a file {{{3 @@ -4658,7 +4588,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("edit-a-file: dirname<".dirname.">",'~'.expand("<slnum>")) " call Decho("edit-a-file: tree listing",'~'.expand("<slnum>")) elseif newdir =~ '^\(/\|\a:\)' -" call Decho("edit-a-file: handle an url or path starting with /: <".newdir.">") +" call Decho("edit-a-file: handle an url or path starting with /: <".newdir.">",'~'.expand("<slnum>")) let dirname= newdir else let dirname= s:ComposePath(dirname,newdir) @@ -4685,7 +4615,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !&ea keepalt wincmd _ endif - call s:SetRexDir(a:islocal,b:netrw_curdir) + call s:SetRexDir(a:islocal,curdir) elseif g:netrw_browse_split == 2 " vertically splitting the window first " call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("<slnum>")) @@ -4693,12 +4623,15 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !&ea keepalt wincmd | endif - call s:SetRexDir(a:islocal,b:netrw_curdir) + call s:SetRexDir(a:islocal,curdir) elseif g:netrw_browse_split == 3 " open file in new tab " call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("<slnum>")) keepalt tabnew - call s:SetRexDir(a:islocal,b:netrw_curdir) + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + call s:SetRexDir(a:islocal,curdir) elseif g:netrw_browse_split == 4 " act like "P" (ie. open previous window) " call Decho("edit-a-file: use previous window for edit",'~'.expand("<slnum>")) @@ -4707,7 +4640,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Dret("s:NetrwBrowseChgDir") return endif - call s:SetRexDir(a:islocal,b:netrw_curdir) + call s:SetRexDir(a:islocal,curdir) else " handling a file, didn't split, so remove menu " call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("<slnum>")) @@ -4860,7 +4793,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif let treedir = s:NetrwTreeDir(a:islocal) " call Decho("tree-list: treedir<".treedir.">",'~'.expand("<slnum>")) - let s:treecurpos = nbcd_curpos + let s:treecurpos = winsaveview() let haskey = 0 " call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">",'~'.expand("<slnum>")) @@ -4936,6 +4869,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " else " Decho " call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod,'~'.expand("<slnum>")) endif + call s:RestorePosn(s:netrw_nbcd) if dolockout && dorestore " call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname),'~'.expand("<slnum>")) if filewritable(dirname) @@ -4971,6 +4905,10 @@ fun! s:NetrwBrowseUpDir(islocal) return endif + if !exists("w:netrw_liststyle") || w:netrw_liststyle != s:TREELIST + call s:SavePosn(s:netrw_nbcd) + endif + norm! 0 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " call Decho("case: treestyle",'~'.expand("<slnum>")) @@ -5010,7 +4948,9 @@ fun! s:NetrwBrowseUpDir(islocal) else call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../')) endif - if exists("w:netrw_bannercnt") + if has_key(s:netrw_nbcd,bufnr("%")) + call s:RestorePosn(s:netrw_nbcd) + elseif exists("w:netrw_bannercnt") " call Decho("moving to line#".w:netrw_bannercnt,'~'.expand("<slnum>")) exe w:netrw_bannercnt else @@ -5106,17 +5046,20 @@ fun! netrw#BrowseX(fname,remote) " call Decho("fname<".fname.">",'~'.expand("<slnum>")) " call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("<slnum>")) - " set up redirection - if &srr =~ "%s" - if (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= substitute(&srr,"%s","nul","") + " set up redirection (avoids browser messages) + " by default, g:netrw_suppress_gx_mesg is true + if g:netrw_suppress_gx_mesg + if &srr =~ "%s" + if (has("win32") || has("win95") || has("win64") || has("win16")) + let redir= substitute(&srr,"%s","nul","") + else + let redir= substitute(&srr,"%s","/dev/null","") + endif + elseif (has("win32") || has("win95") || has("win64") || has("win16")) + let redir= &srr . "nul" else - let redir= substitute(&srr,"%s","/dev/null","") + let redir= &srr . "/dev/null" endif - elseif (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= &srr . "nul" - else - let redir= &srr . "/dev/null" endif " call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("<slnum>")) @@ -5377,8 +5320,12 @@ endfun " --------------------------------------------------------------------- " s:NetrwGlob: does glob() if local, remote listing otherwise {{{2 -fun! s:NetrwGlob(direntry,expr) -" call Dfunc("s:NetrwGlob(direntry<".a:direntry."> expr<".a:expr.">)") +" direntry: this is the name of the directory. Will be fnameescape'd to prevent wildcard handling by glob() +" expr : this is the expression to follow the directory. Will use s:ComposePath() +" pare =1: remove the current directory from the resulting glob() filelist +" =0: leave the current directory in the resulting glob() filelist +fun! s:NetrwGlob(direntry,expr,pare) +" call Dfunc("s:NetrwGlob(direntry<".a:direntry."> expr<".a:expr."> pare=".a:pare.")") if netrw#CheckIfRemote() keepalt 1sp keepalt enew @@ -5393,9 +5340,16 @@ fun! s:NetrwGlob(direntry,expr) let filelist= w:netrw_treedict[a:direntry] endif let w:netrw_liststyle= keep_liststyle + elseif v:version > 704 || (v:version == 704 && has("patch656")) + let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1,1) + if a:pare + let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') + endif else - let filelist= glob(s:ComposePath(a:direntry,a:expr),0,1,1) - let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') + let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1) + if a:pare + let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")') + endif endif " call Dret("s:NetrwGlob ".string(filelist)) return filelist @@ -6087,7 +6041,7 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> nnoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(1,getloclist(v:count))<cr> - nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> + nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(1)<cr> nnoremap <buffer> <silent> <nowait> S :<c-u>call <SID>NetSortSequence(1)<cr> nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt(1,'b',v:count1)<cr> @@ -6140,7 +6094,7 @@ fun! s:NetrwMaps(islocal) " inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> " inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> " inoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(1,getloclist(v:count))<cr> -" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> +" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> " inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(1)<cr> " inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(1)<cr> " inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(4)<cr> @@ -6261,7 +6215,7 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> nnoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(0,getloclist(v:count))<cr> - nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> + nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(0)<cr> nnoremap <buffer> <silent> <nowait> S :<c-u>call <SID>NetSortSequence(0)<cr> nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt(0,'b',v:count1)<cr> @@ -6311,7 +6265,7 @@ fun! s:NetrwMaps(islocal) " inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> " inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> " inoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(0,getloclist(v:count))<cr> -" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> +" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> " inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(0)<cr> " inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(0)<cr> " inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(1)<cr> @@ -6415,10 +6369,10 @@ fun! s:NetrwMarkFiles(islocal,...) let i = 1 while i <= a:0 if a:islocal - if v:version == 704 && has("patch656") - let mffiles= glob(a:{i},0,1,1) + if v:version > 704 || (v:version == 704 && has("patch656")) + let mffiles= glob(fnameescape(a:{i}),0,1,1) else - let mffiles= glob(a:{i},0,1) + let mffiles= glob(fnameescape(a:{i}),0,1) endif else let mffiles= [a:{i}] @@ -6894,6 +6848,8 @@ fun! s:NetrwMarkFileCopy(islocal,...) " cleanup " ------- " call Decho("cleanup",'~'.expand("<slnum>")) + " remove markings from local buffer + call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer " call Decho(" g:netrw_fastbrowse =".g:netrw_fastbrowse,'~'.expand("<slnum>")) " call Decho(" s:netrwmftgt =".s:netrwmftgt,'~'.expand("<slnum>")) " call Decho(" s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("<slnum>")) @@ -7373,7 +7329,7 @@ fun! s:NetrwMarkFileGrep(islocal) if exists("nonisi") " original, user-supplied pattern did not begin with a character from isident " call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg",'~'.expand("<slnum>")) - if pat =~ nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' + if pat =~# nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' call s:NetrwMarkFileQFEL(a:islocal,getqflist()) endif endif @@ -7571,7 +7527,7 @@ fun! s:NetrwMarkFileRegexp(islocal) " get the matching list of files using local glob() " call Decho("handle local regexp",'~'.expand("<slnum>")) let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - if v:version == 704 && has("patch656") + if v:version > 704 || (v:version == 704 && has("patch656")) let files = glob(s:ComposePath(dirname,regexp),0,0,1) else let files = glob(s:ComposePath(dirname,regexp),0,0) @@ -7788,7 +7744,7 @@ fun! s:NetrwMarkFileTgt(islocal) " need to do refresh so that the banner will be updated " s:LocalBrowseRefresh handles all local-browsing buffers when not fast browsing if g:netrw_fastbrowse <= 1 -" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse.", so refreshing all local netrw buffers") +" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse.", so refreshing all local netrw buffers",'~'.expand("<slnum>")) call s:LocalBrowseRefresh() endif " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) @@ -7821,10 +7777,10 @@ fun! s:NetrwGetCurdir(islocal) " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("<slnum>")) endif -" call Decho("b:netrw_curdir<".b:netrw_curdir."> ".((b:netrw_curdir !~ '\<\a\{3,}://')? "does not match" : "matches")." url pattern") +" call Decho("b:netrw_curdir<".b:netrw_curdir."> ".((b:netrw_curdir !~ '\<\a\{3,}://')? "does not match" : "matches")." url pattern",'~'.expand("<slnum>")) if b:netrw_curdir !~ '\<\a\{3,}://' let curdir= b:netrw_curdir -" call Decho("g:netrw_keepdir=".g:netrw_keepdir) +" call Decho("g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("<slnum>")) if g:netrw_keepdir == 0 call s:NetrwLcd(curdir) endif @@ -8125,7 +8081,7 @@ fun! s:NetrwMenu(domenu) elseif !a:domenu let s:netrwcnt = 0 let curwin = winnr() - windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif + windo if getline(2) =~# "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif exe curwin."wincmd w" if s:netrwcnt <= 1 @@ -8708,7 +8664,7 @@ fun! s:NetrwSortStyle(islocal) let svpos= winsaveview() " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) - let g:netrw_sort_by= (g:netrw_sort_by =~ '^n')? 'time' : (g:netrw_sort_by =~ '^t')? 'size' : (g:netrw_sort_by =~ '^siz')? 'exten' : 'name' + let g:netrw_sort_by= (g:netrw_sort_by =~# '^n')? 'time' : (g:netrw_sort_by =~# '^t')? 'size' : (g:netrw_sort_by =~# '^siz')? 'exten' : 'name' NetrwKeepj norm! 0 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>")) @@ -8811,7 +8767,6 @@ fun! s:NetrwSplit(mode) let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) - "call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) unlet s:didsplit else @@ -8890,9 +8845,9 @@ endfun " (full path directory with trailing slash returned) fun! s:NetrwTreeDir(islocal) " call Dfunc("s:NetrwTreeDir(islocal=".a:islocal.") getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) -" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a')) -" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) -" call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a')) +" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>")) +" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) +" call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a'),'~'.expand("<slnum>")) if exists("s:treedir") " s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early @@ -8933,7 +8888,7 @@ fun! s:NetrwTreeDir(islocal) " detect user attempting to close treeroot " call Decho("check if user is attempting to close treeroot",'~'.expand("<slnum>")) " call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>")) -" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~ '^'.s:treedepthstring)? '=~' : '!~').' ^'.s:treedepthstring,'~'.expand("<slnum>")) +" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~# '^'.s:treedepthstring)? '=~#' : '!~').' ^'.s:treedepthstring,'~'.expand("<slnum>")) if curline !~ '^'.s:treedepthstring && getline('.') != '..' " call Decho(".user may have attempted to close treeroot",'~'.expand("<slnum>")) " now force a refresh @@ -9040,24 +8995,24 @@ fun! s:NetrwRefreshTreeDict(dir) if entry =~ '/$' && has_key(w:netrw_treedict,direntry) " call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefreshTreeDict(direntry) - let liststar = s:NetrwGlob(direntry,'*') - let listdotstar = s:NetrwGlob(direntry,'.*') + let liststar = s:NetrwGlob(direntry,'*',1) + let listdotstar = s:NetrwGlob(direntry,'.*',1) let w:netrw_treedict[direntry] = liststar + listdotstar " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>")) elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') " call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/') - let liststar = s:NetrwGlob(direntry.'/','*') - let listdotstar= s:NetrwGlob(direntry.'/','.*') + let liststar = s:NetrwGlob(direntry.'/','*',1) + let listdotstar= s:NetrwGlob(direntry.'/','.*',1) let w:netrw_treedict[direntry]= liststar + listdotstar " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>")) elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@') " call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/') - let liststar = s:NetrwGlob(direntry.'/','*') - let listdotstar= s:NetrwGlob(direntry.'/','.*') + let liststar = s:NetrwGlob(direntry.'/','*',1) + let listdotstar= s:NetrwGlob(direntry.'/','.*',1) " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>")) else @@ -9315,14 +9270,14 @@ fun! s:PerformListing(islocal) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) let sortby= g:netrw_sort_by - if g:netrw_sort_direction =~ "^r" + if g:netrw_sort_direction =~# "^r" let sortby= sortby." reversed" endif " Sorted by... {{{3 if g:netrw_banner " call Decho("--handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("<slnum>")) - if g:netrw_sort_by =~ "^n" + if g:netrw_sort_by =~# "^n" " call Decho("directories will be sorted by name",'~'.expand("<slnum>")) " sorted by name NetrwKeepj put ='\" Sorted by '.sortby @@ -9419,13 +9374,13 @@ fun! s:PerformListing(islocal) if !g:netrw_banner || line("$") >= w:netrw_bannercnt " call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("<slnum>")) - if g:netrw_sort_by =~ "^n" + if g:netrw_sort_by =~# "^n" " sort by name NetrwKeepj call s:NetrwSetSort() if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) - if g:netrw_sort_direction =~ 'n' + if g:netrw_sort_direction =~# 'n' " normal direction sorting exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else @@ -9438,7 +9393,7 @@ fun! s:PerformListing(islocal) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' NetrwKeepj call histdel("/",-1) - elseif g:netrw_sort_by =~ "^ext" + elseif g:netrw_sort_by =~# "^ext" " sort by extension exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g+/+s/^/001'.g:netrw_sepchr.'/' NetrwKeepj call histdel("/",-1) @@ -9448,7 +9403,7 @@ fun! s:PerformListing(islocal) NetrwKeepj call histdel("/",-1) if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) - if g:netrw_sort_direction =~ 'n' + if g:netrw_sort_direction =~# 'n' " normal direction sorting exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else @@ -9462,7 +9417,7 @@ fun! s:PerformListing(islocal) elseif a:islocal if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction,'~'.expand("<slnum>")) - if g:netrw_sort_direction =~ 'n' + if g:netrw_sort_direction =~# 'n' " call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort','~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else @@ -9474,7 +9429,7 @@ fun! s:PerformListing(islocal) endif endif - elseif g:netrw_sort_direction =~ 'r' + elseif g:netrw_sort_direction =~# 'r' " call Decho('(s:PerformListing) reverse the sorted listing','~'.expand("<slnum>")) if !g:netrw_banner || w:netrw_bannercnt < line('$') exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt @@ -9790,9 +9745,9 @@ fun! s:NetrwRemoteListing() " call Decho("use ftp to get remote file listing",'~'.expand("<slnum>")) let s:method = "ftp" let listcmd = g:netrw_ftp_list_cmd - if g:netrw_sort_by =~ '^t' + if g:netrw_sort_by =~# '^t' let listcmd= g:netrw_ftp_timelist_cmd - elseif g:netrw_sort_by =~ '^s' + elseif g:netrw_sort_by =~# '^s' let listcmd= g:netrw_ftp_sizelist_cmd endif " call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)",'~'.expand("<slnum>")) @@ -9899,7 +9854,7 @@ fun! s:NetrwRemoteListing() if s:method == "ftp" " cleanup exe "sil! NetrwKeepj ".w:netrw_bannercnt - while getline('.') =~ g:netrw_ftp_browse_reject + while getline('.') =~# g:netrw_ftp_browse_reject sil! NetrwKeepj d endwhile " if there's no ../ listed, then put ../ in @@ -9952,9 +9907,9 @@ fun! s:NetrwRemoteRm(usrhost,path) range " call Decho("remove all marked files with bufnr#".bufnr("%"),'~'.expand("<slnum>")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwRemoteRmFile(a:path,fname,all) - if ok =~ 'q\%[uit]' + if ok =~# 'q\%[uit]' break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif endfor @@ -9973,9 +9928,9 @@ fun! s:NetrwRemoteRm(usrhost,path) range while ctr <= a:lastline exe "NetrwKeepj ".ctr let ok= s:NetrwRemoteRmFile(a:path,s:NetrwGetWord(),all) - if ok =~ 'q\%[uit]' + if ok =~# 'q\%[uit]' break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif let ctr= ctr + 1 @@ -10014,12 +9969,12 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) let ok="no" endif let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" " call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : ""),'~'.expand("<slnum>")) if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) " call Decho("case ftp:",'~'.expand("<slnum>")) @@ -10054,13 +10009,13 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) else call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif - else if ret != 0 + elseif ret != 0 call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif " call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>")) endif endif - elseif ok =~ 'q\%[uit]' + elseif ok =~# 'q\%[uit]' " call Decho("ok==".ok,'~'.expand("<slnum>")) endif @@ -10075,12 +10030,12 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) let ok="no" endif let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) else @@ -10103,7 +10058,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) endif endif - elseif ok =~ 'q\%[uit]' + elseif ok =~# 'q\%[uit]' " call Decho("ok==".ok,'~'.expand("<slnum>")) endif endif @@ -10257,7 +10212,7 @@ fun! netrw#LocalBrowseCheck(dirname) " would hit when re-entering netrw windows, creating unexpected " refreshes (and would do so in the middle of NetrwSaveOptions(), too) " call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">") -" call Decho("isdir<".a:dirname.">=".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).expand("<slnum>")) +" call Decho("isdir<".a:dirname."> =".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).'~'.expand("<slnum>")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>")) " call Dredir("ls!","ls!") " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) @@ -10281,7 +10236,6 @@ fun! netrw#LocalBrowseCheck(dirname) unlet s:treeforceredraw sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) endif - " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Dret("netrw#LocalBrowseCheck") return @@ -10361,7 +10315,7 @@ fun! s:LocalBrowseRefresh() " refresh any netrw buffer " call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf),'~'.expand("<slnum>")) exe bufwinnr(ibuf)."wincmd w" - if getline(".") =~ 'Quick Help' + if getline(".") =~# 'Quick Help' " decrement g:netrw_quickhelp to prevent refresh from changing g:netrw_quickhelp " (counteracts s:NetrwBrowseChgDir()'s incrementing) let g:netrw_quickhelp= g:netrw_quickhelp - 1 @@ -10467,15 +10421,8 @@ fun! s:LocalListing() " get the list of files contained in the current directory let dirname = b:netrw_curdir let dirnamelen = strlen(b:netrw_curdir) - if v:version == 704 && has("patch656") -" call Decho("using glob with patch656",'~'.expand("<slnum>")) - let filelist = glob(s:ComposePath(dirname,"*"),0,1,1) - let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1,1) - else -" call Decho("using glob without patch656",'~'.expand("<slnum>")) - let filelist = glob(s:ComposePath(dirname,"*"),0,1) - let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) - endif + let filelist = s:NetrwGlob(dirname,"*",0) + let filelist = filelist + s:NetrwGlob(dirname,".*",0) " call Decho("filelist=".string(filelist),'~'.expand("<slnum>")) if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16")) @@ -10487,9 +10434,9 @@ fun! s:LocalListing() " call Decho("filelist=".string(filelist),'~'.expand("<slnum>")) endif -" call Decho("before while: dirname<".dirname.">",'~'.expand("<slnum>")) +" call Decho("before while: dirname <".dirname.">",'~'.expand("<slnum>")) " call Decho("before while: dirnamelen<".dirnamelen.">",'~'.expand("<slnum>")) -" call Decho("before while: filelist=".string(filelist),'~'.expand("<slnum>")) +" call Decho("before while: filelist =".string(filelist),'~'.expand("<slnum>")) if get(g:, 'netrw_dynamic_maxfilenamelen', 0) let filelistcopy = map(deepcopy(filelist),'fnamemodify(v:val, ":t")') @@ -10559,15 +10506,15 @@ fun! s:LocalListing() if w:netrw_liststyle == s:LONGLIST let sz = getfsize(filename) - if g:netrw_sizestyle =~ "[hH]" + if g:netrw_sizestyle =~# "[hH]" let sz= s:NetrwHumanReadable(sz) endif let fsz = strpart(" ",1,15-strlen(sz)).sz let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) -" call Decho("sz=".sz." fsz=".fsz,'~'.expand("<slnum>")) +" call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("<slnum>")) endif - if g:netrw_sort_by =~ "^t" + if g:netrw_sort_by =~# "^t" " sort by time (handles time up to 1 quintillion seconds, US) " call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("<slnum>")) let t = getftime(filename) @@ -10580,7 +10527,7 @@ fun! s:LocalListing() " sort by size (handles file sizes up to 1 quintillion bytes, US) " call Decho("getfsize(".filename.")=".getfsize(filename),'~'.expand("<slnum>")) let sz = getfsize(filename) - if g:netrw_sizestyle =~ "[hH]" + if g:netrw_sizestyle =~# "[hH]" let sz= s:NetrwHumanReadable(sz) endif let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz @@ -10733,9 +10680,9 @@ fun! s:NetrwLocalRm(path) range " call Decho("remove all marked files",'~'.expand("<slnum>")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwLocalRmFile(a:path,fname,all) - if ok =~ 'q\%[uit]' || ok == "no" + if ok =~# 'q\%[uit]' || ok == "no" break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif endfor @@ -10762,9 +10709,9 @@ fun! s:NetrwLocalRm(path) range continue endif let ok= s:NetrwLocalRmFile(a:path,curword,all) - if ok =~ 'q\%[uit]' || ok == "no" + if ok =~# 'q\%[uit]' || ok == "no" break - elseif ok =~ 'a\%[ll]' + elseif ok =~# 'a\%[ll]' let all= 1 endif let ctr= ctr + 1 @@ -10811,12 +10758,12 @@ fun! s:NetrwLocalRmFile(path,fname,all) " call Decho("response: ok<".ok.">",'~'.expand("<slnum>")) let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') " call Decho("response: ok<".ok."> (after sub)",'~'.expand("<slnum>")) - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" let ret= s:NetrwDelete(rmfile) " call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("<slnum>")) endif @@ -10832,13 +10779,13 @@ fun! s:NetrwLocalRmFile(path,fname,all) if ok == "" let ok="no" endif - if ok =~ 'a\%[ll]' + if ok =~# 'a\%[ll]' let all= 1 endif endif let rmfile= substitute(rmfile,'[\/]$','','e') - if all || ok =~ 'y\%[es]' || ok == "" + if all || ok =~# 'y\%[es]' || ok == "" if v:version < 704 || !has("patch1109") " " call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.s:ShellEscape(rmfile).')','~'.expand("<slnum>")) call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile)) @@ -10879,6 +10826,17 @@ endfun " Support Functions: {{{1 " --------------------------------------------------------------------- +" s:WinNames: COMBAK {{{2 +fun! s:WinNames(id) + let curwin= winnr() + 1wincmd w +" call Decho("--- Windows By Name --- #".a:id) +" windo call Decho("win#".winnr()."<".expand("%").">") +" call Decho("--- --- --- --- --- ---") + exe curwin."wincmd w" +endfun + +" --------------------------------------------------------------------- " netrw#Access: intended to provide access to variable values for netrw's test suite {{{2 " 0: marked file list of current buffer " 1: marked file target @@ -10905,8 +10863,6 @@ fun! netrw#Call(funcname,...) " call Dret("netrw#Call") endfun -" ------------------------------------------------------------------------ - " --------------------------------------------------------------------- " netrw#Expose: allows UserMaps and pchk to look at otherwise script-local variables {{{2 " I expect this function to be used in @@ -10914,18 +10870,22 @@ endfun " for example. fun! netrw#Expose(varname) " call Dfunc("netrw#Expose(varname<".a:varname.">)") - exe "let retval= s:".a:varname - if exists("g:netrw_pchk") - if type(retval) == 3 - let retval = copy(retval) - let i = 0 - while i < len(retval) - let retval[i]= substitute(retval[i],expand("$HOME"),'~','') - let i = i + 1 - endwhile + if exists("s:".a:varname) + exe "let retval= s:".a:varname + if exists("g:netrw_pchk") + if type(retval) == 3 + let retval = copy(retval) + let i = 0 + while i < len(retval) + let retval[i]= substitute(retval[i],expand("$HOME"),'~','') + let i = i + 1 + endwhile + endif +" call Dret("netrw#Expose ".string(retval)) + return string(retval) endif -" call Dret("netrw#Expose ".string(retval)) - return string(retval) + else + let retval= "n/a" endif " call Dret("netrw#Expose ".string(retval)) @@ -11018,9 +10978,9 @@ fun! s:ComposePath(base,subdir) " call Decho("amiga",'~'.expand("<slnum>")) let ec = a:base[s:Strlen(a:base)-1] if ec != '/' && ec != ':' - let ret = a:base . "/" . a:subdir + let ret = a:base."/" . a:subdir else - let ret = a:base . a:subdir + let ret = a:base.a:subdir endif elseif a:subdir =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) @@ -11248,10 +11208,10 @@ fun! s:NetrwBMShow() redir END let bmshowlist = split(bmshowraw,'\n') if bmshowlist != [] - let bmshowfuncs= filter(bmshowlist,'v:val =~ "<SNR>\\d\\+_BMShow()"') + let bmshowfuncs= filter(bmshowlist,'v:val =~# "<SNR>\\d\\+_BMShow()"') if bmshowfuncs != [] let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','') - if bmshowfunc =~ '^call.*BMShow()' + if bmshowfunc =~# '^call.*BMShow()' exe "sil! NetrwKeepj ".bmshowfunc endif endif @@ -11395,11 +11355,12 @@ fun! s:NetrwEnew(...) " call Decho("generate a buffer with NetrwKeepj keepalt enew!",'~'.expand("<slnum>")) " when tree listing uses file TreeListing... a new buffer is made. " Want the old buffer to be unlisted. - setl nobl + " COMBAK: this causes a problem, see P43 +" setl nobl let netrw_keepdiff= &l:diff noswapfile NetrwKeepj keepalt enew! let &l:diff= netrw_keepdiff -" call Decho("bufnr($)=".bufnr("$")." winnr($)=".winnr("$"),'~'.expand("<slnum>")) +" call Decho("bufnr($)=".bufnr("$")."<".bufname(bufnr("$"))."> winnr($)=".winnr("$"),'~'.expand("<slnum>")) NetrwKeepj call s:NetrwOptionSave("w:") " copy function-local-variables to buffer variable equivalents @@ -11458,8 +11419,8 @@ endfun " --------------------------------------------------------------------- " s:NetrwInsureWinVars: insure that a netrw buffer has its w: variables in spite of a wincmd v or s {{{2 fun! s:NetrwInsureWinVars() -" call Dfunc("s:NetrwInsureWinVars() win#".winnr()) if !exists("w:netrw_liststyle") +" call Dfunc("s:NetrwInsureWinVars() win#".winnr()) let curbuf = bufnr("%") let curwin = winnr() let iwin = 1 @@ -11479,8 +11440,8 @@ fun! s:NetrwInsureWinVars() let w:{k}= winvars[k] endfor endif +" call Dret("s:NetrwInsureWinVars win#".winnr()) endif -" call Dret("s:NetrwInsureWinVars win#".winnr()) endfun " --------------------------------------------------------------------- @@ -11685,7 +11646,7 @@ endfun " s:SetRexDir() sets up <2-leftmouse> maps (if g:netrw_retmap " is true) and a command, :Rexplore, which call this function. " -" s:nbcd_curpos_{bufnr('%')} is set up by s:NetrwBrowseChgDir() +" s:netrw_nbcd is set up by s:NetrwBrowseChgDir() " " s:rexposn_BUFNR used to save/restore cursor position fun! s:NetrwRexplore(islocal,dirname) @@ -11766,6 +11727,29 @@ fun! s:SaveBufVars() endfun " --------------------------------------------------------------------- +" s:SavePosn: saves position associated with current buffer into a dictionary {{{2 +fun! s:SavePosn(posndict) +" call Dfunc("s:SavePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") + + let a:posndict[bufnr("%")]= winsaveview() +" call Decho("saving posn: posndict[".bufnr("%")."]=".string(winsaveview()),'~'.expand("<slnum>")) + +" call Dret("s:SavePosn posndict") + return a:posndict +endfun + +" --------------------------------------------------------------------- +" s:RestorePosn: restores position associated with current buffer using dictionary {{{2 +fun! s:RestorePosn(posndict) +" call Dfunc("s:RestorePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") + if has_key(a:posndict,bufnr("%")) + call winrestview(a:posndict[bufnr("%")]) +" call Decho("restoring posn: posndict[".bufnr("%")."]=".string(a:posndict[bufnr("%")]),'~'.expand("<slnum>")) + endif +" call Dret("s:RestorePosn") +endfun + +" --------------------------------------------------------------------- " s:SaveWinVars: (used by Explore() and NetrwSplit()) {{{2 fun! s:SaveWinVars() " call Dfunc("s:SaveWinVars() win#".winnr()) @@ -11819,10 +11803,10 @@ fun! s:SetRexDir(islocal,dirname) let w:netrw_rexdir = a:dirname let w:netrw_rexlocal = a:islocal let s:rexposn_{bufnr("%")} = winsaveview() -" call Decho("setting w:netrw_rexdir =".w:netrw_rexdir) -" call Decho("setting w:netrw_rexlocal=".w:netrw_rexlocal) +" call Decho("setting w:netrw_rexdir =".w:netrw_rexdir,'~'.expand("<slnum>")) +" call Decho("setting w:netrw_rexlocal=".w:netrw_rexlocal,'~'.expand("<slnum>")) " call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>")) -" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>")) +" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to ".string(winsaveview()),'~'.expand("<slnum>")) " call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) endfun @@ -11956,7 +11940,7 @@ fun! s:TreeListMove(dir) " call Decho("regfile srch back: ".nl,'~'.expand("<slnum>")) elseif a:dir == '[]' && nxtline != '' NetrwKeepj norm! 0 -" call Decho('srchpat<'.'^\%('.curindent.'\)\@!'.'>') +" call Decho('srchpat<'.'^\%('.curindent.'\)\@!'.'>','~'.expand("<slnum>")) let nl = search('^\%('.curindent.'\)\@!','We') " search forwards if nl != 0 NetrwKeepj norm! k diff --git a/runtime/autoload/paste.vim b/runtime/autoload/paste.vim index fcf06ecdf9..dd7b3ae54a 100644 --- a/runtime/autoload/paste.vim +++ b/runtime/autoload/paste.vim @@ -1,6 +1,6 @@ " Vim support file to help with paste mappings and menus " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2006 Jun 23 +" Last Change: 2017 Aug 30 " Define the string to use for items that are present both in Edit, Popup and " Toolbar menu. Also used in mswin.vim and macmap.vim. @@ -12,7 +12,7 @@ if has("virtualedit") let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"} let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n'] - let paste#paste_cmd['i'] = 'x<BS><Esc>' . paste#paste_cmd['n'] . 'gi' + let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP" func! paste#Paste() let ove = &ve diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index 7f25d9df33..377baa8432 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2015 Jul 13 +" Last Change: 2018 Oct 10 " " OPTIONS: " @@ -146,6 +146,8 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ end try + let eventignore = &eventignore + let &eventignore = 'all' let winheight = winheight(0) let winnr = winnr() @@ -195,6 +197,8 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ " }}} elseif context =~? 'implements' return phpcomplete#CompleteClassName(a:base, ['i'], current_namespace, imports) + elseif context =~? 'instanceof' + return phpcomplete#CompleteClassName(a:base, ['c', 'n'], current_namespace, imports) elseif context =~? 'extends\s\+.\+$' && a:base == '' return ['implements'] elseif context =~? 'extends' @@ -214,6 +218,7 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ endif finally silent! exec winnr.'resize '.winheight + let &eventignore = eventignore endtry endfunction " }}} @@ -787,6 +792,8 @@ function! phpcomplete#CompleteClassName(base, kinds, current_namespace, imports) if kinds == ['c', 'i'] let filterstr = 'v:val =~? "\\(class\\|interface\\)\\s\\+[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*"' + elseif kinds == ['c', 'n'] + let filterstr = 'v:val =~? "\\(class\\|namespace\\)\\s\\+[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*"' elseif kinds == ['c'] let filterstr = 'v:val =~? "class\\s\\+[a-zA-Z_\\x7f-\\xff][a-zA-Z_0-9\\x7f-\\xff]*\\s*"' elseif kinds == ['i'] @@ -931,7 +938,7 @@ function! phpcomplete#EvaluateModifiers(modifiers, required_modifiers, prohibite endfor for modifier in a:modifiers - " if the modifier is prohibited its a no match + " if the modifier is prohibited it's a no match if index(a:prohibited_modifiers, modifier) != -1 return 0 endif @@ -996,7 +1003,7 @@ function! phpcomplete#CompleteUserClass(context, base, sccontent, visibility) " let required_modifiers += ['static'] endif let all_variable = filter(deepcopy(a:sccontent), - \ 'v:val =~ "^\\s*\\(var\\s\\+\\|public\\s\\+\\|protected\\s\\+\\|private\\s\\+\\|final\\s\\+\\|abstract\\s\\+\\|static\\s\\+\\)\\+\\$"') + \ 'v:val =~ "\\(^\\s*\\(var\\s\\+\\|public\\s\\+\\|protected\\s\\+\\|private\\s\\+\\|final\\s\\+\\|abstract\\s\\+\\|static\\s\\+\\)\\+\\$\\|^\\s*\\(\\/\\|\\*\\)*\\s*@property\\s\\+\\S\\+\\s\\S\\{-}\\s*$\\)"') let variables = [] for i in all_variable @@ -1160,6 +1167,14 @@ function! phpcomplete#GetTaglist(pattern) " {{{ endif let tags = taglist(a:pattern) + for tag in tags + for prop in keys(tag) + if prop == 'cmd' || prop == 'static' || prop == 'kind' || prop == 'builtin' + continue + endif + let tag[prop] = substitute(tag[prop], '\\\\', '\\', 'g') + endfor + endfor let s:cache_tags[a:pattern] = tags let has_key = has_key(s:cache_tags, a:pattern) let s:cache_tags_checksum = cache_checksum @@ -1379,16 +1394,30 @@ function! phpcomplete#GetCallChainReturnType(classname_candidate, class_candidat " Get Structured information of all classes and subclasses including namespace and includes " try to find the method's return type in docblock comment for classstructure in classcontents - let docblock_target_pattern = 'function\s\+&\?'.method.'\|\(public\|private\|protected\|var\).\+\$'.method + let docblock_target_pattern = 'function\s\+&\?'.method.'\>\|\(public\|private\|protected\|var\).\+\$'.method.'\>\|@property.\+\$'.method.'\>' let doc_str = phpcomplete#GetDocBlock(split(classstructure.content, '\n'), docblock_target_pattern) - if doc_str != '' + let return_type_hint = phpcomplete#GetFunctionReturnTypeHint(split(classstructure.content, '\n'), 'function\s\+&\?'.method.'\>') + if doc_str != '' || return_type_hint != '' break endif endfor - if doc_str != '' + if doc_str != '' || return_type_hint != '' let docblock = phpcomplete#ParseDocBlock(doc_str) - if has_key(docblock.return, 'type') || has_key(docblock.var, 'type') - let type = has_key(docblock.return, 'type') ? docblock.return.type : docblock.var.type + if has_key(docblock.return, 'type') || has_key(docblock.var, 'type') || len(docblock.properties) > 0 || return_type_hint != '' + if return_type_hint == '' + let type = has_key(docblock.return, 'type') ? docblock.return.type : has_key(docblock.var, 'type') ? docblock.var.type : '' + + if type == '' + for property in docblock.properties + if property.description =~? method + let type = property.type + break + endif + endfor + endif + else + let type = return_type_hint + end " there's a namespace in the type, threat the type as FQCN if type =~ '\\' @@ -1462,7 +1491,7 @@ function! phpcomplete#GetMethodStack(line) " {{{ continue endif - " if it's looks like a string + " if it looks like a string if current_char == "'" || current_char == '"' " and it is not escaped if prev_char != '\' || (prev_char == '\' && prev_prev_char == '\') @@ -1554,6 +1583,9 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor elseif get(methodstack, 0) =~# function_invocation_pattern let function_name = matchstr(methodstack[0], '^\s*\zs'.function_name_pattern) let function_file = phpcomplete#GetFunctionLocation(function_name, a:current_namespace) + if function_file == '' + let function_file = phpcomplete#GetFunctionLocation(function_name, '\') + endif if function_file == 'VIMPHP_BUILTINFUNCTION' " built in function, grab the return type from the info string @@ -1563,13 +1595,15 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor elseif function_file != '' && filereadable(function_file) let file_lines = readfile(function_file) let docblock_str = phpcomplete#GetDocBlock(file_lines, 'function\s*&\?\<'.function_name.'\>') + let return_type_hint = phpcomplete#GetFunctionReturnTypeHint(file_lines, 'function\s*&\?'.function_name.'\>') let docblock = phpcomplete#ParseDocBlock(docblock_str) - if has_key(docblock.return, 'type') - let classname_candidate = docblock.return.type + let type = has_key(docblock.return, 'type') ? docblock.return.type : return_type_hint + if type != '' + let classname_candidate = type let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines) " try to expand the classname of the returned type with the context got from the function's source file - let [classname_candidate, unused] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports) + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports) endif endif if classname_candidate != '' @@ -1650,9 +1684,10 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let sub_methodstack = phpcomplete#GetMethodStack(matchstr(line, '^\s*'.object.'\s*=&\?\s*\s\+\zs.*')) let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType( \ classname, - \ a:current_namespace, + \ namespace_for_class, \ a:imports, \ sub_methodstack) + return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate endif endif @@ -1783,6 +1818,9 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let [function_name, function_namespace] = phpcomplete#ExpandClassName(function_name, a:current_namespace, a:imports) let function_file = phpcomplete#GetFunctionLocation(function_name, function_namespace) + if function_file == '' + let function_file = phpcomplete#GetFunctionLocation(function_name, '\') + endif if function_file == 'VIMPHP_BUILTINFUNCTION' " built in function, grab the return type from the info string @@ -1793,12 +1831,14 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor elseif function_file != '' && filereadable(function_file) let file_lines = readfile(function_file) let docblock_str = phpcomplete#GetDocBlock(file_lines, 'function\s*&\?\<'.function_name.'\>') + let return_type_hint = phpcomplete#GetFunctionReturnTypeHint(file_lines, 'function\s*&\?'.function_name.'\>') let docblock = phpcomplete#ParseDocBlock(docblock_str) - if has_key(docblock.return, 'type') - let classname_candidate = docblock.return.type + let type = has_key(docblock.return, 'type') ? docblock.return.type : return_type_hint + if type != '' + let classname_candidate = type let [class_candidate_namespace, function_imports] = phpcomplete#GetCurrentNameSpace(file_lines) " try to expand the classname of the returned type with the context got from the function's source file - let [classname_candidate, unused] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports) + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, class_candidate_namespace, function_imports) break endif endif @@ -1861,6 +1901,8 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor for tag in tags if tag.kind ==? 'v' && tag.cmd =~? '=\s*new\s\+\zs'.class_name_pattern.'\ze' let classname = matchstr(tag.cmd, '=\s*new\s\+\zs'.class_name_pattern.'\ze') + " unescape the classname, it would have "\" doubled since it is an ex command + let classname = substitute(classname, '\\\(\_.\)', '\1', 'g') return classname endif endfor @@ -2077,6 +2119,19 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam endif call searchpair('{', '', '}', 'W') let class_closing_bracket_line = line('.') + + " Include class docblock + let doc_line = cfline - 1 + if getline(doc_line) =~? '^\s*\*/' + while doc_line != 0 + if getline(doc_line) =~? '^\s*/\*\*' + let cfline = doc_line + break + endif + let doc_line -= 1 + endwhile + endif + let classcontent = join(getline(cfline, class_closing_bracket_line), "\n") let used_traits = [] @@ -2241,8 +2296,19 @@ function! phpcomplete#GetDocBlock(sccontent, search) " {{{ let line = a:sccontent[i] " search for a function declaration if line =~? a:search - let l = i - 1 - " start backward serch for the comment block + if line =~? '@property' + let doc_line = i + while doc_line != sccontent_len - 1 + if a:sccontent[doc_line] =~? '^\s*\*/' + let l = doc_line + break + endif + let doc_line += 1 + endwhile + else + let l = i - 1 + endif + " start backward search for the comment block while l != 0 let line = a:sccontent[l] " if it's a one line docblock like comment and we can just return it right away @@ -2263,7 +2329,7 @@ function! phpcomplete#GetDocBlock(sccontent, search) " {{{ return '' end - while l != 0 + while l >= 0 let line = a:sccontent[l] if line =~? '^\s*/\*\*' let comment_start = l @@ -2297,9 +2363,10 @@ function! phpcomplete#ParseDocBlock(docblock) " {{{ \ 'return': {}, \ 'throws': [], \ 'var': {}, + \ 'properties': [], \ } - let res.description = substitute(matchstr(a:docblock, '\zs\_.\{-}\ze\(@var\|@param\|@return\|$\)'), '\(^\_s*\|\_s*$\)', '', 'g') + let res.description = substitute(matchstr(a:docblock, '\zs\_.\{-}\ze\(@type\|@var\|@param\|@return\|$\)'), '\(^\_s*\|\_s*$\)', '', 'g') let docblock_lines = split(a:docblock, "\n") let param_lines = filter(copy(docblock_lines), 'v:val =~? "^@param"') @@ -2334,19 +2401,68 @@ function! phpcomplete#ParseDocBlock(docblock) " {{{ endif endfor - let var_line = filter(copy(docblock_lines), 'v:val =~? "^@var"') + let var_line = filter(copy(docblock_lines), 'v:val =~? "^\\(@var\\|@type\\)"') if len(var_line) > 0 - let var_parts = matchlist(var_line[0], '@var\s\+\(\S\+\)\s*\(.*\)') + let var_parts = matchlist(var_line[0], '\(@var\|@type\)\s\+\(\S\+\)\s*\(.*\)') let res['var'] = { \ 'line': var_parts[0], - \ 'type': phpcomplete#GetTypeFromDocBlockParam(get(var_parts, 1, '')), - \ 'description': get(var_parts, 2, '')} + \ 'type': phpcomplete#GetTypeFromDocBlockParam(get(var_parts, 2, '')), + \ 'description': get(var_parts, 3, '')} endif + let property_lines = filter(copy(docblock_lines), 'v:val =~? "^@property"') + for property_line in property_lines + let parts = matchlist(property_line, '\(@property\)\s\+\(\S\+\)\s*\(.*\)') + if len(parts) > 0 + call add(res.properties, { + \ 'line': parts[0], + \ 'type': phpcomplete#GetTypeFromDocBlockParam(get(parts, 2, '')), + \ 'description': get(parts, 3, '')}) + endif + endfor + return res endfunction " }}} +function! phpcomplete#GetFunctionReturnTypeHint(sccontent, search) + let i = 0 + let l = 0 + let function_line_start = -1 + let function_line_end = -1 + let sccontent_len = len(a:sccontent) + let return_type = '' + + while (i < sccontent_len) + let line = a:sccontent[i] + " search for a function declaration + if line =~? a:search + let l = i + let function_line_start = i + " now search for the first { where the function body starts + while l < sccontent_len + let line = a:sccontent[l] + if line =~? '\V{' + let function_line_end = l + break + endif + let l += 1 + endwhile + break + endif + let i += 1 + endwhile + + " now grab the lines that holds the function declaration line + if function_line_start != -1 && function_line_end != -1 + let function_line = join(a:sccontent[function_line_start :function_line_end], " ") + let class_name_pattern = '[a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*' + let return_type = matchstr(function_line, '\c\s*:\s*\zs'.class_name_pattern.'\ze\s*{') + endif + return return_type + +endfunction + function! phpcomplete#GetTypeFromDocBlockParam(docblock_type) " {{{ if a:docblock_type !~ '|' return a:docblock_type @@ -2498,6 +2614,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ let name = matchstr(name, '\\\zs[^\\]\+\ze$') endif endif + " leading slash is not required use imports are always absolute let imports[name] = {'name': object, 'kind': ''} endfor @@ -2505,7 +2622,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ " find kind flags from tags or built in methods for the objects we extracted " they can be either classes, interfaces or namespaces, no other thing is importable in php for [key, import] in items(imports) - " if theres a \ in the name we have it's definetly not a built in thing, look for tags + " if theres a \ in the name we have it's definitely not a built in thing, look for tags if import.name =~ '\\' let patched_ctags_detected = 0 let [classname, namespace_for_classes] = phpcomplete#ExpandClassName(import.name, '\', {}) @@ -2533,6 +2650,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ elseif !exists('no_namespace_candidate') " save the first namespacless match to be used if no better " candidate found later on + let tag.namespace = namespace_for_classes let no_namespace_candidate = tag endif endif diff --git a/runtime/autoload/provider.vim b/runtime/autoload/provider.vim new file mode 100644 index 0000000000..dc24e801d0 --- /dev/null +++ b/runtime/autoload/provider.vim @@ -0,0 +1,21 @@ +" Common functions for providers + +" 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 77bc8c781d..2fb9d74d8d 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -3,76 +3,140 @@ " available. let s:copy = {} let s:paste = {} +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': [] } +let s:selection = { 'owner': 0, 'data': [], 'stderr_buffered': v:true } -function! s:selection.on_exit(jobid, data, event) +function! s:selection.on_exit(jobid, data, event) abort " At this point this nvim instance might already have launched " a new provider instance. Don't drop ownership in this case. if self.owner == a:jobid let self.owner = 0 endif + if a:data != 0 + echohl WarningMsg + echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(self.stderr) + echohl None + endif endfunction -let s:selections = { '*': s:selection, '+': copy(s:selection)} +let s:selections = { '*': s:selection, '+': copy(s:selection) } -function! s:try_cmd(cmd, ...) +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 - echohl WarningMsg - echo "clipboard: error: ".(len(out) ? out[0] : '') - echohl None + if !exists('s:did_error_try_cmd') + echohl WarningMsg + echomsg "clipboard: error: ".(len(out) ? out[0] : v:shell_error) + echohl None + let s:did_error_try_cmd = 1 + endif return 0 endif return out 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 + let s:cache_enabled = 1 -if executable('pbcopy') - let s:copy['+'] = 'pbcopy' - let s:paste['+'] = 'pbpaste' - let s:copy['*'] = s:copy['+'] - let s:paste['*'] = s:paste['+'] - let s:cache_enabled = 0 -elseif exists('$DISPLAY') && executable('xsel') - let s:copy['+'] = 'xsel --nodetach -i -b' - let s:paste['+'] = 'xsel -o -b' - let s:copy['*'] = 'xsel --nodetach -i -p' - let s:paste['*'] = 'xsel -o -p' -elseif exists('$DISPLAY') && executable('xclip') - let s:copy['+'] = 'xclip -quiet -i -selection clipboard' - let s:paste['+'] = 'xclip -o -selection clipboard' - let s:copy['*'] = 'xclip -quiet -i -selection primary' - let s:paste['*'] = 'xclip -o -selection primary' -elseif executable('lemonade') - let s:copy['+'] = 'lemonade copy' - let s:paste['+'] = 'lemonade paste' - let s:copy['*'] = 'lemonade copy' - let s:paste['*'] = 'lemonade paste' -elseif executable('doitclient') - let s:copy['+'] = 'doitclient wclip' - let s:paste['+'] = 'doitclient wclip -r' - let s:copy['*'] = s:copy['+'] - let s:paste['*'] = s:paste['+'] -else - echom 'clipboard: No clipboard tool available. See :help clipboard' +let s:err = '' + +function! provider#clipboard#Error() abort + return s:err +endfunction + +function! provider#clipboard#Executable() abort + if exists('g:clipboard') + if type({}) isnot# type(g:clipboard) + \ || type({}) isnot# type(get(g:clipboard, 'copy', v:null)) + \ || type({}) isnot# type(get(g:clipboard, 'paste', v:null)) + let s:err = 'clipboard: invalid g:clipboard' + return '' + endif + + let s:copy = get(g:clipboard, 'copy', { '+': v:null, '*': v:null }) + 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') + let s:copy['+'] = 'pbcopy' + let s:paste['+'] = 'pbpaste' + let s:copy['*'] = s:copy['+'] + let s:paste['*'] = s:paste['+'] + let s:cache_enabled = 0 + return 'pbcopy' + elseif exists('$WAYLAND_DISPLAY') && executable('wl-copy') && executable('wl-paste') + let s:copy['+'] = 'wl-copy --foreground' + let s:paste['+'] = 'wl-paste --no-newline' + let s:copy['*'] = 'wl-copy --foreground --primary' + let s:paste['*'] = 'wl-paste --no-newline --primary' + return 'wl-copy' + elseif exists('$DISPLAY') && executable('xclip') + let s:copy['+'] = 'xclip -quiet -i -selection clipboard' + let s:paste['+'] = 'xclip -o -selection clipboard' + let s:copy['*'] = 'xclip -quiet -i -selection primary' + let s:paste['*'] = 'xclip -o -selection primary' + return 'xclip' + elseif exists('$DISPLAY') && executable('xsel') && s:cmd_ok('xsel -o -b') + let s:copy['+'] = 'xsel --nodetach -i -b' + let s:paste['+'] = 'xsel -o -b' + let s:copy['*'] = 'xsel --nodetach -i -p' + let s:paste['*'] = 'xsel -o -p' + return 'xsel' + elseif executable('lemonade') + let s:copy['+'] = 'lemonade copy' + let s:paste['+'] = 'lemonade paste' + let s:copy['*'] = 'lemonade copy' + let s:paste['*'] = 'lemonade paste' + return 'lemonade' + elseif executable('doitclient') + let s:copy['+'] = 'doitclient wclip' + let s:paste['+'] = 'doitclient wclip -r' + let s:copy['*'] = s:copy['+'] + let s:paste['*'] = s:paste['+'] + return 'doitclient' + elseif executable('win32yank.exe') + let s:copy['+'] = 'win32yank.exe -i --crlf' + let s:paste['+'] = 'win32yank.exe -o --lf' + let s:copy['*'] = s:copy['+'] + let s:paste['*'] = s:paste['+'] + return 'win32yank' + elseif exists('$TMUX') && executable('tmux') + let s:copy['+'] = 'tmux load-buffer -' + let s:paste['+'] = 'tmux save-buffer -' + let s:copy['*'] = s:copy['+'] + let s:paste['*'] = s:paste['+'] + return 'tmux' + endif + + let s:err = 'clipboard: No clipboard tool. :help clipboard' + return '' +endfunction + +if empty(provider#clipboard#Executable()) + " provider#clipboard#Call() *must not* be defined if the provider is broken. + " Otherwise eval_has_provider() thinks the clipboard provider is + " functioning, and eval_call_provider() will happily call it. finish endif -let s:clipboard = {} - -function! s:clipboard.get(reg) - let reg = a:reg == '"' ? '+' : a:reg - if s:selections[reg].owner > 0 - return s:selections[reg].data +function! s:clipboard.get(reg) abort + if type(s:paste[a:reg]) == v:t_func + return s:paste[a:reg]() + elseif s:selections[a:reg].owner > 0 + return s:selections[a:reg].data end - return s:try_cmd(s:paste[reg]) + return s:try_cmd(s:paste[a:reg]) endfunction -function! s:clipboard.set(lines, regtype, reg) +function! s:clipboard.set(lines, regtype, reg) abort if a:reg == '"' call s:clipboard.set(a:lines,a:regtype,'+') if s:copy['*'] != s:copy['+'] @@ -80,33 +144,51 @@ function! s:clipboard.set(lines, regtype, reg) end return 0 end + + if type(s:copy[a:reg]) == v:t_func + call s:copy[a:reg](a:lines, a:regtype) + return 0 + end + if s:cache_enabled == 0 call s:try_cmd(s:copy[a:reg], a:lines) 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 let selection.detach = s:cache_enabled let selection.cwd = "/" let jobid = jobstart(argv, selection) - if jobid <= 0 + if jobid > 0 + call jobsend(jobid, a:lines) + call jobclose(jobid, 'stdin') + let selection.owner = jobid + else echohl WarningMsg - echo "clipboard: error when invoking provider" + echomsg 'clipboard: failed to execute: '.(s:copy[a:reg]) echohl None return 0 endif - call jobsend(jobid, a:lines) - call jobclose(jobid, 'stdin') - let selection.owner = jobid + return 1 endfunction -function! provider#clipboard#Call(method, args) - return call(s:clipboard[a:method],a:args,s:clipboard) +function! provider#clipboard#Call(method, args) abort + if get(s:, 'here', v:false) " Clipboard provider must not recurse. #7184 + return 0 + endif + let s:here = v:true + try + return call(s:clipboard[a:method],a:args,s:clipboard) + finally + let s:here = v:false + endtry endfunction diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim new file mode 100644 index 0000000000..35882849bd --- /dev/null +++ b/runtime/autoload/provider/node.vim @@ -0,0 +1,148 @@ +if exists('g:loaded_node_provider') + finish +endif +let g:loaded_node_provider = 1 + +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 + +let s:NodeHandler = { +\ 'stdout_buffered': v:true, +\ 'result': '' +\ } +function! s:NodeHandler.on_exit(job_id, data, event) abort + let bin_dir = join(get(self, 'stdout', []), '') + let entry_point = bin_dir . self.entry_point + let self.result = filereadable(entry_point) ? entry_point : '' +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 + if exists('g:node_host_prog') + return expand(g:node_host_prog) + endif + if !s:is_minimum_version(v:null, 6, 0) + return '' + endif + + let npm_opts = {} + if executable('npm') + let npm_opts = deepcopy(s:NodeHandler) + let npm_opts.entry_point = '/neovim/bin/cli.js' + let npm_opts.job_id = jobstart('npm --loglevel silent root -g', npm_opts) + endif + + let yarn_opts = {} + if executable('yarn') + let yarn_opts = deepcopy(s:NodeHandler) + let yarn_opts.entry_point = '/node_modules/neovim/bin/cli.js' + " `yarn global dir` is slow (> 250ms), try the default path first + " XXX: The following code is not portable + " https://github.com/yarnpkg/yarn/issues/2049#issuecomment-263183768 + if has('unix') + let yarn_default_path = $HOME . '/.config/yarn/global/' . yarn_opts.entry_point + if filereadable(yarn_default_path) + return yarn_default_path + endif + endif + let yarn_opts.job_id = jobstart('yarn global dir', yarn_opts) + endif + + " npm returns the directory faster, so let's check that first + if !empty(npm_opts) + let result = jobwait([npm_opts.job_id]) + if result[0] == 0 && npm_opts.result != '' + return npm_opts.result + endif + endif + + if !empty(yarn_opts) + let result = jobwait([yarn_opts.job_id]) + if result[0] == 0 && yarn_opts.result != '' + return yarn_opts.result + endif + endif + + return '' +endfunction + +function! provider#node#Prog() abort + return s:prog +endfunction + +function! provider#node#Require(host) abort + if s:err != '' + echoerr s:err + return + endif + + let args = ['node'] + + if !empty($NVIM_NODE_HOST_DEBUG) && provider#node#can_inspect() + call add(args, '--inspect-brk') + endif + + 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) abort + if s:err != '' + echoerr s:err + return + endif + + if !exists('s:host') + try + let s:host = remote#host#Require('node') + catch + let s:err = v:exception + echohl WarningMsg + echomsg v:exception + echohl None + return + endtry + endif + return call('rpcrequest', insert(insert(a:args, 'node_'.a:method), s:host)) +endfunction + + +let s:err = '' +let s:prog = provider#node#Detect() + +if empty(s:prog) + 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 b99a046375..a06cbe4814 100644 --- a/runtime/autoload/provider/python.vim +++ b/runtime/autoload/provider/python.vim @@ -1,5 +1,5 @@ " The Python provider uses a Python host to emulate an environment for running -" python-vim plugins. See ":help provider". +" python-vim plugins. :help provider " " Associating the plugin with the Python host is the first step because plugins " will be passed as command-line arguments @@ -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 4f47a03a9b..242a224cb3 100644 --- a/runtime/autoload/provider/python3.vim +++ b/runtime/autoload/provider/python3.vim @@ -1,5 +1,5 @@ " The Python3 provider uses a Python3 host to emulate an environment for running -" python3 plugins. See ":help provider". +" python3 plugins. :help provider " " Associating the plugin with the Python3 host is the first step because " plugins will be passed as command-line arguments @@ -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 0ebf00112f..59b1c27b72 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -9,7 +9,8 @@ function! provider#pythonx#Require(host) abort let ver = (a:host.orig_name ==# 'python') ? 2 : 3 " Python host arguments - let args = ['-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()'] + let prog = (ver == '2' ? provider#python#Prog() : provider#python3#Prog()) + let args = [prog, '-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()'] " Collect registered Python plugins into args let python_plugins = remote#host#PluginsForHost(a:host.name) @@ -17,103 +18,98 @@ function! provider#pythonx#Require(host) abort call add(args, plugin.path) endfor - try - let channel_id = rpcstart((ver ==# '2' ? - \ provider#python#Prog() : provider#python3#Prog()), args) - if rpcrequest(channel_id, 'poll') ==# 'ok' - return channel_id - endif - catch - echomsg v:throwpoint - echomsg v:exception - 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 - let host_var = (a:major_ver == 2) ? - \ 'g:python_host_prog' : 'g:python3_host_prog' - let skip_var = (a:major_ver == 2) ? - \ 'g:python_host_skip_check' : 'g:python3_host_skip_check' - let skip = exists(skip_var) ? {skip_var} : 0 - if exists(host_var) - " Disable auto detection. - let [result, err] = s:check_interpreter({host_var}, a:major_ver, skip) - if result - return [{host_var}, err] - endif - return ['', 'provider/pythonx: Could not load Python ' . a:major_ver - \ . ' from ' . host_var . ': ' . err] - endif +function! s:get_python_executable_from_host_var(major_version) abort + return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : '').'_host_prog', '')) +endfunction - let prog_suffixes = (a:major_ver == 2) ? - \ ['2', '2.7', '2.6', ''] - \ : ['3', '3.5', '3.4', '3.3', ''] +function! s:get_python_candidates(major_version) abort + return { + \ 2: ['python2', 'python2.7', 'python2.6', 'python'], + \ 3: ['python3', 'python3.7', 'python3.6', 'python3.5', 'python3.4', 'python3.3', + \ 'python'] + \ }[a:major_version] +endfunction +" Returns [path_to_python_executable, error_message] +function! provider#pythonx#Detect(major_version) abort + return provider#pythonx#DetectByModule('neovim', a:major_version) +endfunction + +" Returns [path_to_python_executable, error_message] +function! provider#pythonx#DetectByModule(module, major_version) abort + let python_exe = s:get_python_executable_from_host_var(a:major_version) + + if !empty(python_exe) + return [python_exe, ''] + endif + + let candidates = s:get_python_candidates(a:major_version) let errors = [] - for prog in map(prog_suffixes, "'python' . v:val") - let [result, err] = s:check_interpreter(prog, a:major_ver, skip) + + for exe in candidates + let [result, error] = provider#pythonx#CheckForModule(exe, a:module, a:major_version) if result - return [prog, err] + return [exe, error] endif - - " Accumulate errors in case we don't find - " any suitable Python interpreter. - call add(errors, err) + " Accumulate errors in case we don't find any suitable Python executable. + call add(errors, error) endfor - " No suitable Python interpreter found. - return ['', 'provider/pythonx: Could not load Python ' . a:major_ver - \ . ":\n" . join(errors, "\n")] + " No suitable Python executable found. + return ['', 'provider/pythonx: Could not load Python '.a:major_version.":\n".join(errors, "\n")] endfunction -function! s:check_interpreter(prog, major_ver, skip) abort +" Returns array: [prog_exitcode, prog_version] +function! s:import_module(prog, module) abort + let prog_version = system([a:prog, '-c' , printf( + \ 'import sys; ' . + \ 'sys.path.remove(""); ' . + \ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' . + \ 'import pkgutil; ' . + \ 'exit(2*int(pkgutil.get_loader("%s") is None))', + \ a:module)]) + return [v:shell_error, prog_version] +endfunction + +" Returns array: [was_success, error_message] +function! provider#pythonx#CheckForModule(prog, module, major_version) abort let prog_path = exepath(a:prog) if prog_path ==# '' return [0, a:prog . ' not found in search path or not executable.'] endif - if a:skip - return [1, ''] - endif - - let min_version = (a:major_ver == 2) ? '2.6' : '3.3' + let min_version = (a:major_version == 2) ? '2.6' : '3.3' - " Try to load neovim module, and output Python version. - " Return codes: - " 0 Neovim module can be loaded. - " 2 Neovim module cannot be loaded. + " Try to load module, and output Python version. + " Exit codes: + " 0 module can be loaded. + " 2 module cannot be loaded. " Otherwise something else went wrong (e.g. 1 or 127). - let prog_ver = system([ a:prog , '-c' , - \ 'import sys; ' . - \ 'sys.path.remove(""); ' . - \ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' . - \ 'import pkgutil; ' . - \ 'exit(2*int(pkgutil.get_loader("neovim") is None))' - \ ]) + let [prog_exitcode, prog_version] = s:import_module(a:prog, a:module) - if v:shell_error == 2 || v:shell_error == 0 + if prog_exitcode == 2 || prog_exitcode == 0 " Check version only for expected return codes. - if prog_ver !~ '^' . a:major_ver - return [0, prog_path . ' is Python ' . prog_ver . ' and cannot provide Python ' - \ . a:major_ver . '.'] - elseif prog_ver =~ '^' . a:major_ver && prog_ver < min_version - return [0, prog_path . ' is Python ' . prog_ver . ' and cannot provide Python >= ' + if prog_version !~ '^' . a:major_version + return [0, prog_path . ' is Python ' . prog_version . ' and cannot provide Python ' + \ . a:major_version . '.'] + elseif prog_version =~ '^' . a:major_version && prog_version < min_version + return [0, prog_path . ' is Python ' . prog_version . ' and cannot provide Python >= ' \ . min_version . '.'] endif endif - if v:shell_error == 2 - return [0, prog_path . ' does not have the neovim module installed. ' - \ . 'See ":help provider-python".'] - elseif v:shell_error == 127 + if prog_exitcode == 2 + return [0, prog_path.' does not have the "' . a:module . '" module. :help provider-python'] + elseif prog_exitcode == 127 " This can happen with pyenv's shims. - return [0, prog_path . ' does not exist: ' . prog_ver] - elseif v:shell_error + return [0, prog_path . ' does not exist: ' . prog_version] + elseif prog_exitcode return [0, 'Checking ' . prog_path . ' caused an unknown error. ' - \ . '(' . v:shell_error . ', output: ' . prog_ver . ')' - \ . ' Please report this at github.com/neovim/neovim.'] + \ . '(' . prog_exitcode . ', output: ' . prog_version . ')' + \ . ' Report this at https://github.com/neovim/neovim'] endif return [1, ''] diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim index aad8c09d28..3b4c6c4839 100644 --- a/runtime/autoload/provider/ruby.vim +++ b/runtime/autoload/provider/ruby.vim @@ -1,34 +1,71 @@ " The Ruby provider helper -if exists('s:loaded_ruby_provider') +if exists('g:loaded_ruby_provider') finish endif +let g:loaded_ruby_provider = 1 -let s:loaded_ruby_provider = 1 +function! provider#ruby#Detect() abort + return s:prog +endfunction + +function! provider#ruby#Prog() abort + return s:prog +endfunction function! provider#ruby#Require(host) abort - " Collect registered Ruby plugins into args - let args = [] + let prog = provider#ruby#Prog() let ruby_plugins = remote#host#PluginsForHost(a:host.name) for plugin in ruby_plugins - call add(args, plugin.path) + let prog .= " " . shellescape(plugin.path) endfor - try - let channel_id = rpcstart(provider#ruby#Prog(), args) + return provider#Poll(prog, a:host.orig_name, '$NVIM_RUBY_LOG_FILE') +endfunction - if rpcrequest(channel_id, 'poll') == 'ok' - return channel_id - endif - catch - echomsg v:throwpoint - echomsg v:exception - endtry +function! provider#ruby#Call(method, args) abort + if s:err != '' + echoerr s:err + return + endif - throw remote#host#LoadErrorForHost(a:host.orig_name, - \ '$NVIM_RUBY_LOG_FILE') + if !exists('s:host') + try + let s:host = remote#host#Require('legacy-ruby-provider') + catch + let s:err = v:exception + echohl WarningMsg + echomsg v:exception + echohl None + return + endtry + endif + return call('rpcrequest', insert(insert(a:args, 'ruby_'.a:method), s:host)) endfunction -function! provider#ruby#Prog() abort - return 'neovim-ruby-host' +function! s:detect() + if exists("g:ruby_host_prog") + return expand(g:ruby_host_prog) + elseif has('win32') + return exepath('neovim-ruby-host.bat') + else + let p = exepath('neovim-ruby-host') + if empty(p) + return '' + endif + " neovim-ruby-host could be an rbenv shim for another Ruby version. + call system(p) + return v:shell_error ? '' : p + end endfunction + +let s:err = '' +let s:prog = s:detect() +let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb' + +if empty(s:prog) + let s:err = 'Cannot find the neovim RubyGem. Try :checkhealth' +endif + +call remote#host#RegisterClone('legacy-ruby-provider', 'ruby') +call remote#host#RegisterPlugin('legacy-ruby-provider', s:plugin_path, []) diff --git a/runtime/autoload/provider/script_host.rb b/runtime/autoload/provider/script_host.rb new file mode 100644 index 0000000000..a1c58bde85 --- /dev/null +++ b/runtime/autoload/provider/script_host.rb @@ -0,0 +1,6 @@ +begin + require 'neovim/ruby_provider' +rescue LoadError + warn('Your neovim RubyGem is missing or out of date.', + 'Install the latest version using `gem install neovim`.') +end diff --git a/runtime/autoload/remote/define.vim b/runtime/autoload/remote/define.vim index b04a5d2280..2688a62a82 100644 --- a/runtime/autoload/remote/define.vim +++ b/runtime/autoload/remote/define.vim @@ -89,7 +89,8 @@ endfunction function! remote#define#AutocmdOnHost(host, method, sync, name, opts) let group = s:GetNextAutocmdGroup() - let forward = '"doau '.group.' '.a:name.' ".'.'expand("<amatch>")' + let forward = '"doau '.group.' '.a:name.' ".' + \ . 'fnameescape(expand("<amatch>"))' let a:opts.group = group let bootstrap_def = s:GetAutocmdPrefix(a:name, a:opts) \ .' call remote#define#AutocmdBootstrap("'.a:host.'"' @@ -168,14 +169,40 @@ function! remote#define#FunctionOnChannel(channel, method, sync, name, opts) exe function_def endfunction +let s:busy = {} +let s:pending_notifications = {} function! s:GetRpcFunction(sync) - if a:sync - return 'rpcrequest' + if a:sync ==# 'urgent' + return 'rpcnotify' + elseif a:sync + return 'remote#define#request' endif - return 'rpcnotify' + return 'remote#define#notify' endfunction +function! remote#define#notify(chan, ...) + if get(s:busy, a:chan, 0) > 0 + let pending = get(s:pending_notifications, a:chan, []) + call add(pending, deepcopy(a:000)) + let s:pending_notifications[a:chan] = pending + else + call call('rpcnotify', [a:chan] + a:000) + endif +endfunction + +function! remote#define#request(chan, ...) + let s:busy[a:chan] = get(s:busy, a:chan, 0)+1 + let val = call('rpcrequest', [a:chan]+a:000) + let s:busy[a:chan] -= 1 + if s:busy[a:chan] == 0 + for msg in get(s:pending_notifications, a:chan, []) + call call('rpcnotify', [a:chan] + msg) + endfor + let s:pending_notifications[a:chan] = [] + endif + return val +endfunction function! s:GetCommandPrefix(name, opts) return 'command!'.s:StringifyOpts(a:opts, ['nargs', 'complete', 'range', diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim index 4ec2eeb5b7..6266b312bd 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -2,7 +2,6 @@ let s:hosts = {} let s:plugin_patterns = {} let s:plugins_for_host = {} - " Register a host by associating it with a factory(funcref) function! remote#host#Register(name, pattern, factory) abort let s:hosts[a:name] = {'factory': a:factory, 'channel': 0, 'initialized': 0} @@ -13,7 +12,6 @@ function! remote#host#Register(name, pattern, factory) abort endif endfunction - " Register a clone to an existing host. The new host will use the same factory " as `source`, but it will run as a different process. This can be used by " plugins that should run isolated from other plugins created for the same host @@ -31,12 +29,8 @@ function! remote#host#RegisterClone(name, orig_name) abort \ } endfunction - " Get a host channel, bootstrapping it if necessary function! remote#host#Require(name) abort - if empty(s:plugins_for_host) - call remote#host#LoadRemotePlugins() - endif if !has_key(s:hosts, a:name) throw 'No host named "'.a:name.'" is registered' endif @@ -52,7 +46,6 @@ function! remote#host#Require(name) abort return host.channel endfunction - function! remote#host#IsRunning(name) abort if !has_key(s:hosts, a:name) throw 'No host named "'.a:name.'" is registered' @@ -60,7 +53,6 @@ function! remote#host#IsRunning(name) abort return s:hosts[a:name].channel != 0 endfunction - " Example of registering a Python plugin with two commands (one async), one " autocmd (async) and one function (sync): " @@ -117,37 +109,14 @@ function! remote#host#RegisterPlugin(host, path, specs) abort call add(plugins, {'path': a:path, 'specs': a:specs}) endfunction - -function! s:GetManifest() abort - let prefix = exists('$MYVIMRC') - \ ? $MYVIMRC - \ : matchstr(get(split(capture('scriptnames'), '\n'), 0, ''), '\f\+$') - return fnamemodify(expand(prefix, 1), ':h') - \.'/.'.fnamemodify(prefix, ':t').'-rplugin~' -endfunction - - -function! remote#host#LoadRemotePlugins() abort - if filereadable(s:GetManifest()) - exe 'source '.s:GetManifest() - endif -endfunction - - -function! remote#host#LoadRemotePluginsEvent(event, pattern) abort - autocmd! nvim-rplugin - call remote#host#LoadRemotePlugins() - execute 'silent doautocmd <nomodeline>' a:event a:pattern -endfunction - - function! s:RegistrationCommands(host) abort " Register a temporary host clone for discovering specs let host_id = a:host.'-registration-clone' call remote#host#RegisterClone(host_id, a:host) let pattern = s:plugin_patterns[a:host] - let paths = globpath(&rtp, 'rplugin/'.a:host.'/'.pattern, 0, 1) - let paths = map(paths, 'tr(v:val,"\\","/")') " Normalize slashes #4795 + let paths = globpath(&rtp, 'rplugin/'.a:host.'/'.pattern, 1, 1) + let paths = map(paths, 'tr(resolve(v:val),"\\","/")') " Normalize slashes #4795 + let paths = uniq(sort(paths)) if empty(paths) return [] endif @@ -184,7 +153,6 @@ function! s:RegistrationCommands(host) abort return lines endfunction - function! remote#host#UpdateRemotePlugins() abort let commands = [] let hosts = keys(s:hosts) @@ -201,12 +169,11 @@ function! remote#host#UpdateRemotePlugins() abort endtry endif endfor - call writefile(commands, s:GetManifest()) - echomsg printf('remote/host: generated the manifest file in "%s"', - \ s:GetManifest()) + call writefile(commands, g:loaded_remote_plugins) + echomsg printf('remote/host: generated rplugin manifest: %s', + \ g:loaded_remote_plugins) endfunction - function! remote#host#PluginsForHost(host) abort if !has_key(s:plugins_for_host, a:host) let s:plugins_for_host[a:host] = [] @@ -214,18 +181,13 @@ function! remote#host#PluginsForHost(host) abort return s:plugins_for_host[a:host] endfunction - function! remote#host#LoadErrorForHost(host, log) abort return 'Failed to load '. a:host . ' host. '. - \ 'You can try to see what happened '. - \ 'by starting Neovim with the environment variable '. - \ a:log . ' set to a file and opening the generated '. - \ 'log file. Also, the host stderr will be available '. - \ 'in Neovim log, so it may contain useful information. '. - \ 'See also ~/.nvimlog.' + \ 'You can try to see what happened by starting nvim with '. + \ a:log . ' set and opening the generated log file.'. + \ ' Also, the host stderr is available in messages.' endfunction - " Registration of standard hosts " Python/Python3 @@ -237,3 +199,7 @@ call remote#host#Register('python3', '*', " Ruby call remote#host#Register('ruby', '*.rb', \ function('provider#ruby#Require')) + +" nodejs +call remote#host#Register('node', '*', + \ function('provider#node#Require')) diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim index e1064c8a58..40b87f4cbe 100644 --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -93,7 +93,7 @@ function! s:GetBufferRubyEntity( name, type, ... ) let stopline = 1 - let crex = '^\s*\<' . a:type . '\>\s*\<' . a:name . '\>\s*\(<\s*.*\s*\)\?' + let crex = '^\s*\<' . a:type . '\>\s*\<' . escape(a:name, '*') . '\>\s*\(<\s*.*\s*\)\?' let [lnum,lcol] = searchpos( crex, 'w' ) "let [lnum,lcol] = searchpairpos( crex . '\zs', '', '\(end\|}\)', 'w' ) @@ -149,7 +149,7 @@ function! s:GetRubyVarType(v) let ctors = ctors.'\)' let fstr = '=\s*\([^ \t]\+.' . ctors .'\>\|[\[{"''/]\|%[xwQqr][(\[{@]\|[A-Za-z0-9@:\-()\.]\+...\?\|lambda\|&\)' - let sstr = ''.a:v.'\>\s*[+\-*/]*'.fstr + let sstr = ''.escape(a:v, '*').'\>\s*[+\-*/]*'.fstr let [lnum,lcol] = searchpos(sstr,'nb',stopline) if lnum != 0 && lcol != 0 let str = matchstr(getline(lnum),fstr,lcol) @@ -196,7 +196,7 @@ function! rubycomplete#Complete(findstart, base) if c =~ '\w' continue elseif ! c =~ '\.' - idx = -1 + let idx = -1 break else break @@ -266,6 +266,28 @@ class VimRubyCompletion end end + def load_gems + fpath = VIM::evaluate("get(g:, 'rubycomplete_gemfile_path', 'Gemfile')") + return unless File.file?(fpath) && File.readable?(fpath) + want_bundler = VIM::evaluate("get(g:, 'rubycomplete_use_bundler')") + parse_file = !want_bundler + begin + require 'bundler' + Bundler.setup + Bundler.require + rescue Exception + parse_file = true + end + if parse_file + File.new(fpath).each_line do |line| + begin + require $1 if /\s*gem\s*['"]([^'"]+)/.match(line) + rescue Exception + end + end + end + end + def load_buffer_class(name) dprint "load_buffer_class(%s) START" % name classdef = get_buffer_entity(name, 's:GetBufferRubyClass("%s")') @@ -588,6 +610,10 @@ class VimRubyCompletion load_rails end + want_gems = VIM::evaluate("get(g:, 'rubycomplete_load_gemfile')") + load_gems unless want_gems.to_i.zero? + + input = VIM::Buffer.current.line cpos = VIM::Window.current.cursor[1] - 1 input = input[0..cpos] @@ -678,7 +704,9 @@ class VimRubyCompletion cv = eval("self.class.constants") vartype = get_var_type( receiver ) dprint "vartype: %s" % vartype - if vartype != '' + + invalid_vartype = ['', "gets"] + if !invalid_vartype.include?(vartype) load_buffer_class( vartype ) begin @@ -706,7 +734,7 @@ class VimRubyCompletion methods.concat m.instance_methods(false) } end - variables += add_rails_columns( "#{vartype}" ) if vartype && vartype.length > 0 + variables += add_rails_columns( "#{vartype}" ) if vartype && !invalid_vartype.include?(vartype) when /^\(?\s*[A-Za-z0-9:^@.%\/+*\(\)]+\.\.\.?[A-Za-z0-9:^@.%\/+*\(\)]+\s*\)?\.([^.]*)/ message = $1 diff --git a/runtime/autoload/rust.vim b/runtime/autoload/rust.vim new file mode 100644 index 0000000000..34a3b41773 --- /dev/null +++ b/runtime/autoload/rust.vim @@ -0,0 +1,415 @@ +" Author: Kevin Ballard +" Description: Helper functions for Rust commands/mappings +" Last Modified: May 27, 2014 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +" Jump {{{1 + +function! rust#Jump(mode, function) range + let cnt = v:count1 + normal! m' + if a:mode ==# 'v' + norm! gv + endif + let foldenable = &foldenable + set nofoldenable + while cnt > 0 + execute "call <SID>Jump_" . a:function . "()" + let cnt = cnt - 1 + endwhile + let &foldenable = foldenable +endfunction + +function! s:Jump_Back() + call search('{', 'b') + keepjumps normal! w99[{ +endfunction + +function! s:Jump_Forward() + normal! j0 + call search('{', 'b') + keepjumps normal! w99[{% + call search('{') +endfunction + +" Run {{{1 + +function! rust#Run(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang + let idx = index(l:args, '--') + if idx != -1 + let rustc_args = idx == 0 ? [] : l:args[:idx-1] + let args = l:args[idx+1:] + else + let rustc_args = l:args + let args = [] + endif + else + let rustc_args = [] + endif + + let b:rust_last_rustc_args = l:rustc_args + let b:rust_last_args = l:args + + call s:WithPath(function("s:Run"), rustc_args, args) +endfunction + +function! s:Run(dict, rustc_args, args) + let exepath = a:dict.tmpdir.'/'.fnamemodify(a:dict.path, ':t:r') + if has('win32') + let exepath .= '.exe' + endif + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let rustc_args = [relpath, '-o', exepath] + a:rustc_args + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)')) + endif +endfunction + +" Expand {{{1 + +function! rust#Expand(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang && !empty(l:args) + let pretty = remove(l:args, 0) + else + let pretty = "expanded" + endif + call s:WithPath(function("s:Expand"), pretty, args) +endfunction + +function! s:Expand(dict, pretty, args) + try + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + if a:pretty =~? '^\%(everybody_loops$\|flowgraph=\)' + let flag = '--xpretty' + else + let flag = '--pretty' + endif + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '-Z', 'unstable-options', l:flag, a:pretty] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if v:shell_error + echohl WarningMsg + echo output + echohl None + else + new + silent put =output + 1 + d + setl filetype=rust + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.pretty.rs' + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endtry +endfunction + +function! rust#CompleteExpand(lead, line, pos) + if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$' + " first argument and it has a ! + let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"] + if !empty(a:lead) + call filter(list, "v:val[:len(a:lead)-1] == a:lead") + endif + return list + endif + + return glob(escape(a:lead, "*?[") . '*', 0, 1) +endfunction + +" Emit {{{1 + +function! rust#Emit(type, args) + let args = s:ShellTokenize(a:args) + call s:WithPath(function("s:Emit"), a:type, args) +endfunction + +function! s:Emit(dict, type, args) + try + let output_path = a:dict.tmpdir.'/output' + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '--emit', a:type, '-o', output_path] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + new + exe 'silent keepalt read' fnameescape(output_path) + 1 + d + if a:type == "llvm-ir" + setl filetype=llvm + let extension = 'll' + elseif a:type == "asm" + setl filetype=asm + let extension = 's' + endif + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + if exists('l:extension') + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.'.extension + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endif + endtry +endfunction + +" Utility functions {{{1 + +" Invokes func(dict, ...) +" Where {dict} is a dictionary with the following keys: +" 'path' - The path to the file +" 'tmpdir' - The path to a temporary directory that will be deleted when the +" function returns. +" 'istemp' - 1 if the path is a file inside of {dict.tmpdir} or 0 otherwise. +" If {istemp} is 1 then an additional key is provided: +" 'tmpdir_relpath' - The {path} relative to the {tmpdir}. +" +" {dict.path} may be a path to a file inside of {dict.tmpdir} or it may be the +" existing path of the current buffer. If the path is inside of {dict.tmpdir} +" then it is guaranteed to have a '.rs' extension. +function! s:WithPath(func, ...) + let buf = bufnr('') + let saved = {} + let dict = {} + try + let saved.write = &write + set write + let dict.path = expand('%') + let pathisempty = empty(dict.path) + + " Always create a tmpdir in case the wrapped command wants it + let dict.tmpdir = tempname() + call mkdir(dict.tmpdir) + + if pathisempty || !saved.write + let dict.istemp = 1 + " if we're doing this because of nowrite, preserve the filename + if !pathisempty + let filename = expand('%:t:r').".rs" + else + let filename = 'unnamed.rs' + endif + let dict.tmpdir_relpath = filename + let dict.path = dict.tmpdir.'/'.filename + + let saved.mod = &mod + set nomod + + silent exe 'keepalt write! ' . fnameescape(dict.path) + if pathisempty + silent keepalt 0file + endif + else + let dict.istemp = 0 + update + endif + + call call(a:func, [dict] + a:000) + finally + if bufexists(buf) + for [opt, value] in items(saved) + silent call setbufvar(buf, '&'.opt, value) + unlet value " avoid variable type mismatches + endfor + endif + if has_key(dict, 'tmpdir') | silent call s:RmDir(dict.tmpdir) | endif + endtry +endfunction + +function! rust#AppendCmdLine(text) + call setcmdpos(getcmdpos()) + let cmd = getcmdline() . a:text + return cmd +endfunction + +" Tokenize the string according to sh parsing rules +function! s:ShellTokenize(text) + " states: + " 0: start of word + " 1: unquoted + " 2: unquoted backslash + " 3: double-quote + " 4: double-quoted backslash + " 5: single-quote + let l:state = 0 + let l:current = '' + let l:args = [] + for c in split(a:text, '\zs') + if l:state == 0 || l:state == 1 " unquoted + if l:c ==# ' ' + if l:state == 0 | continue | endif + call add(l:args, l:current) + let l:current = '' + let l:state = 0 + elseif l:c ==# '\' + let l:state = 2 + elseif l:c ==# '"' + let l:state = 3 + elseif l:c ==# "'" + let l:state = 5 + else + let l:current .= l:c + let l:state = 1 + endif + elseif l:state == 2 " unquoted backslash + if l:c !=# "\n" " can it even be \n? + let l:current .= l:c + endif + let l:state = 1 + elseif l:state == 3 " double-quote + if l:c ==# '\' + let l:state = 4 + elseif l:c ==# '"' + let l:state = 1 + else + let l:current .= l:c + endif + elseif l:state == 4 " double-quoted backslash + if stridx('$`"\', l:c) >= 0 + let l:current .= l:c + elseif l:c ==# "\n" " is this even possible? + " skip it + else + let l:current .= '\'.l:c + endif + let l:state = 3 + elseif l:state == 5 " single-quoted + if l:c == "'" + let l:state = 1 + else + let l:current .= l:c + endif + endif + endfor + if l:state != 0 + call add(l:args, l:current) + endif + return l:args +endfunction + +function! s:RmDir(path) + " sanity check; make sure it's not empty, /, or $HOME + if empty(a:path) + echoerr 'Attempted to delete empty path' + return 0 + elseif a:path == '/' || a:path == $HOME + echoerr 'Attempted to delete protected path: ' . a:path + return 0 + endif + return system("rm -rf " . shellescape(a:path)) +endfunction + +" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd. +" If {pwd} is the empty string then it doesn't change the cwd. +function! s:system(pwd, cmd) + let cmd = a:cmd + if !empty(a:pwd) + let cmd = 'cd ' . shellescape(a:pwd) . ' && ' . cmd + endif + return system(cmd) +endfunction + +" Playpen Support {{{1 +" Parts of gist.vim by Yasuhiro Matsumoto <mattn.jp@gmail.com> reused +" gist.vim available under the BSD license, available at +" http://github.com/mattn/gist-vim +function! s:has_webapi() + if !exists("*webapi#http#post") + try + call webapi#http#post() + catch + endtry + endif + return exists("*webapi#http#post") +endfunction + +function! rust#Play(count, line1, line2, ...) abort + redraw + + let l:rust_playpen_url = get(g:, 'rust_playpen_url', 'https://play.rust-lang.org/') + let l:rust_shortener_url = get(g:, 'rust_shortener_url', 'https://is.gd/') + + if !s:has_webapi() + echohl ErrorMsg | echomsg ':RustPlay depends on webapi.vim (https://github.com/mattn/webapi-vim)' | echohl None + return + endif + + let bufname = bufname('%') + if a:count < 1 + let content = join(getline(a:line1, a:line2), "\n") + else + let save_regcont = @" + let save_regtype = getregtype('"') + silent! normal! gvy + let content = @" + call setreg('"', save_regcont, save_regtype) + endif + + let body = l:rust_playpen_url."?code=".webapi#http#encodeURI(content) + + if strlen(body) > 5000 + echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(body).')' | echohl None + return + endif + + let payload = "format=simple&url=".webapi#http#encodeURI(body) + let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {}) + let url = res.content + + redraw | echomsg 'Done: '.url +endfunction + +" }}}1 + +" vim: set noet sw=8 ts=8: diff --git a/runtime/autoload/rustfmt.vim b/runtime/autoload/rustfmt.vim new file mode 100644 index 0000000000..a689b5e00d --- /dev/null +++ b/runtime/autoload/rustfmt.vim @@ -0,0 +1,107 @@ +" Author: Stephen Sugden <stephen@stephensugden.com> +" +" Adapted from https://github.com/fatih/vim-go +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if !exists("g:rustfmt_autosave") + let g:rustfmt_autosave = 0 +endif + +if !exists("g:rustfmt_command") + let g:rustfmt_command = "rustfmt" +endif + +if !exists("g:rustfmt_options") + let g:rustfmt_options = "" +endif + +if !exists("g:rustfmt_fail_silently") + let g:rustfmt_fail_silently = 0 +endif + +let s:got_fmt_error = 0 + +function! s:RustfmtCommandRange(filename, line1, line2) + let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]} + return printf("%s %s --write-mode=overwrite --file-lines '[%s]'", g:rustfmt_command, g:rustfmt_options, json_encode(l:arg)) +endfunction + +function! s:RustfmtCommand(filename) + return g:rustfmt_command . " --write-mode=overwrite " . g:rustfmt_options . " " . shellescape(a:filename) +endfunction + +function! s:RunRustfmt(command, curw, tmpname) + if exists("*systemlist") + let out = systemlist(a:command) + else + let out = split(system(a:command), '\r\?\n') + endif + + if v:shell_error == 0 || v:shell_error == 3 + " remove undo point caused via BufWritePre + try | silent undojoin | catch | endtry + + " Replace current file with temp file, then reload buffer + call rename(a:tmpname, expand('%')) + silent edit! + let &syntax = &syntax + + " only clear location list if it was previously filled to prevent + " clobbering other additions + if s:got_fmt_error + let s:got_fmt_error = 0 + call setloclist(0, []) + lwindow + endif + elseif g:rustfmt_fail_silently == 0 + " otherwise get the errors and put them in the location list + let errors = [] + + for line in out + " src/lib.rs:13:5: 13:10 error: expected `,`, or `}`, found `value` + let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\):\s*\(\d\+:\d\+\s*\)\?\s*error: \(.*\)') + if !empty(tokens) + call add(errors, {"filename": @%, + \"lnum": tokens[2], + \"col": tokens[3], + \"text": tokens[5]}) + endif + endfor + + if empty(errors) + % | " Couldn't detect rustfmt error format, output errors + endif + + if !empty(errors) + call setloclist(0, errors, 'r') + echohl Error | echomsg "rustfmt returned error" | echohl None + endif + + let s:got_fmt_error = 1 + lwindow + " We didn't use the temp file, so clean up + call delete(a:tmpname) + endif + + call winrestview(a:curw) +endfunction + +function! rustfmt#FormatRange(line1, line2) + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction + +function! rustfmt#Format() + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommand(l:tmpname) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction diff --git a/runtime/autoload/shada.vim b/runtime/autoload/shada.vim index 9be85b6f2e..87acc515ee 100644 --- a/runtime/autoload/shada.vim +++ b/runtime/autoload/shada.vim @@ -45,7 +45,7 @@ call map(copy(s:SHADA_ENTRY_NAMES), let s:SHADA_MAP_ENTRIES = { \'search_pattern': ['sp', 'sh', 'ss', 'sb', 'sm', 'sc', 'sl', 'se', 'so', \ 'su'], - \'register': ['n', 'rc', 'rw', 'rt'], + \'register': ['n', 'rc', 'rw', 'rt', 'ru'], \'global_mark': ['n', 'f', 'l', 'c'], \'local_mark': ['f', 'n', 'l', 'c'], \'jump': ['f', 'l', 'c'], @@ -139,6 +139,7 @@ let s:SHADA_STANDARD_KEYS = { \'rt': ['type', 'regtype', s:SHADA_ENUMS.regtype.CHARACTERWISE], \'rw': ['block width', 'uint', 0], \'rc': ['contents', 'binarray', s:SHADA_REQUIRED], + \'ru': ['is_unnamed', 'boolean', g:msgpack#false], \'n': ['name', 'intchar', char2nr('"')], \'l': ['line number', 'uint', 1], \'c': ['column', 'uint', 0], @@ -241,8 +242,6 @@ function s:shada_check_type(type, val) abort if msg isnot# 0 return msg endif - if a:val > 0 || a:val < 1 - endif return 0 elseif a:type is# 'binarray' if type isnot# 'array' @@ -359,9 +358,14 @@ function s:shada_string(type, v) abort if (has_key(s:SHADA_ENUMS, a:type) && type(a:v) == type(0) \&& has_key(s:SHADA_REV_ENUMS[a:type], a:v)) return s:SHADA_REV_ENUMS[a:type][a:v] - elseif (a:type is# 'intchar' && type(a:v) == type(0) - \&& strtrans(nr2char(a:v)) is# nr2char(a:v)) - return "'" . nr2char(a:v) . "'" + " Restricting a:v to be <= 127 is not necessary, but intchar constants are + " normally expected to be either ASCII printable characters or NUL. + elseif a:type is# 'intchar' && type(a:v) == type(0) && a:v >= 0 && a:v <= 127 + if a:v > 0 && strtrans(nr2char(a:v)) is# nr2char(a:v) + return "'" . nr2char(a:v) . "'" + else + return "'\\" . a:v . "'" + endif else return msgpack#string(a:v) endif diff --git a/runtime/autoload/spellfile.vim b/runtime/autoload/spellfile.vim index a5ffa514ea..9ec6091218 100644 --- a/runtime/autoload/spellfile.vim +++ b/runtime/autoload/spellfile.vim @@ -20,6 +20,7 @@ function! spellfile#LoadFile(lang) endif return endif + let lang = tolower(a:lang) " If the URL changes we try all files again. if s:spellfile_URL != g:spellfile_URL @@ -28,13 +29,13 @@ function! spellfile#LoadFile(lang) endif " I will say this only once! - if has_key(s:donedict, a:lang . &enc) + if has_key(s:donedict, lang . &enc) if &verbose echomsg 'spellfile#LoadFile(): Tried this language/encoding before.' endif return endif - let s:donedict[a:lang . &enc] = 1 + let s:donedict[lang . &enc] = 1 " Find spell directories we can write in. let [dirlist, dirchoices] = spellfile#GetDirChoices() @@ -88,13 +89,13 @@ function! spellfile#LoadFile(lang) endif endif if newbufnr == winbufnr(0) - " We are back the old buffer, remove any (half-finished) download. - g/^/d_ + " We are back to the old buffer, remove any (half-finished) download. + keeppatterns g/^/d_ else let newbufnr = winbufnr(0) endif - let fname = a:lang . '.ascii.spl' + let fname = lang . '.ascii.spl' echo 'Could not find it, trying ' . fname . '...' call spellfile#Nread(fname) if getline(2) !~ 'VIMspell' @@ -127,7 +128,7 @@ function! spellfile#LoadFile(lang) exe "write " . dirname . '/' . fname " Also download the .sug file. - g/^/d_ + keeppatterns g/^/d_ let fname = substitute(fname, '\.spl$', '.sug', '') echo 'Downloading ' . fname . '...' call spellfile#Nread(fname) @@ -197,7 +198,7 @@ function! spellfile#WritableSpellDir() " Always use the $XDG_DATA_HOME/nvim/site directory if exists('$XDG_DATA_HOME') return $XDG_DATA_HOME . "/nvim/site/spell" - else + elseif !(has('win32') || has('win64')) return $HOME . "/.local/share/nvim/site/spell" endif for dir in split(&rtp, ',') diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim index e80729add4..ea0d8c2de9 100644 --- a/runtime/autoload/sqlcomplete.vim +++ b/runtime/autoload/sqlcomplete.vim @@ -2,7 +2,7 @@ " Language: SQL " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> " Version: 16.0 -" Last Change: 2015 Dec 29 +" Last Change: 2017 Oct 15 " Homepage: http://www.vim.org/scripts/script.php?script_id=1572 " Usage: For detailed help " ":help sql.txt" diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index 5e76870cce..dc670dbd14 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -117,7 +117,7 @@ fun! tar#Browse(tarfile) if !filereadable(a:tarfile) " call Decho('a:tarfile<'.a:tarfile.'> not filereadable') if a:tarfile !~# '^\a\+://' - " if its an url, don't complain, let url-handlers such as vim do its thing + " if it's an url, don't complain, let url-handlers such as vim do its thing redraw! echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None endif @@ -152,10 +152,12 @@ fun! tar#Browse(tarfile) " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif + let curlast= line("$") if tarfile =~# '\.\(gz\|tgz\)$' + let gzip_command = s:get_gzip_command(tarfile) " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") - exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " + exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " elseif tarfile =~# '\.lrp' " call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ") exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - " @@ -287,12 +289,14 @@ fun! tar#Read(fname,mode) else let tar_secure= " " endif + if tarfile =~# '\.bz2$' " call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp elseif tarfile =~# '\.\(gz\|tgz\)$' + let gzip_command = s:get_gzip_command(tarfile) " call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1)) - exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp elseif tarfile =~# '\.lrp$' " call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp @@ -389,6 +393,8 @@ fun! tar#Write(fname) let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','') let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','') + let gzip_command = s:get_gzip_command(tarfile) + " handle compressed archives if tarfile =~# '\.bz2' call system("bzip2 -d -- ".shellescape(tarfile,0)) @@ -396,12 +402,12 @@ fun! tar#Write(fname) let compress= "bzip2 -- ".shellescape(tarfile,0) " call Decho("compress<".compress.">") elseif tarfile =~# '\.gz' - call system("gzip -d -- ".shellescape(tarfile,0)) + call system(gzip_command . " -d -- ".shellescape(tarfile,0)) let tarfile = substitute(tarfile,'\.gz','','e') let compress= "gzip -- ".shellescape(tarfile,0) " call Decho("compress<".compress.">") elseif tarfile =~# '\.tgz' - call system("gzip -d -- ".shellescape(tarfile,0)) + call system(gzip_command . " -d -- ".shellescape(tarfile,0)) let tarfile = substitute(tarfile,'\.tgz','.tar','e') let compress= "gzip -- ".shellescape(tarfile,0) let tgz = 1 @@ -581,7 +587,10 @@ fun! tar#Vimuntar(...) " if necessary, decompress the tarball; then, extract it if tartail =~ '\.tgz' - if executable("gunzip") + let gzip_command = s:get_gzip_command(tarfile) + if executable(gzip_command) + silent exe "!" . gzip_command . " -d ".shellescape(tartail) + elseif executable("gunzip") silent exe "!gunzip ".shellescape(tartail) elseif executable("gzip") silent exe "!gzip -d ".shellescape(tartail) @@ -619,6 +628,28 @@ fun! tar#Vimuntar(...) " call Dret("tar#Vimuntar") endfun +func s:get_gzip_command(file) + " Try using the "file" command to get the actual compression type, since + " there is no standard way for the naming: ".tgz", ".tbz", ".txz", etc. + " If the "file" command doesn't work fall back to just using the file name. + if a:file =~# 'z$' + let filetype = system('file ' . a:file) + if filetype =~ 'bzip2 compressed' && executable('bzip2') + return 'bzip2' + endif + if filetype =~ 'XZ compressed' && executable('xz') + return 'xz' + endif + endif + if a:file =~# 'bz2$' + return 'bzip2' + endif + if a:file =~# 'xz$' + return 'xz' + endif + return 'gzip' +endfunc + " ===================================================================== " Modelines And Restoration: {{{1 let &cpo= s:keepcpo diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim index 43d8a87886..3265fdde36 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 @@ -15,30 +12,17 @@ function! tutor#SetupVim() endif endfunction -" Mappings: {{{1 - -function! s:CheckMaps() - nmap +" Loads metadata file, if available +function! tutor#LoadMetadata() + let b:tutor_metadata = json_decode(join(readfile(expand('%').'.json'), "\n")) endfunction -function! s:MapKeyWithRedirect(key, cmd) - if maparg(a:key) !=# '' - redir => l:keys - silent call s:CheckMaps() - redir END - let l:key_list = split(l:keys, '\n') - - let l:raw_map = filter(copy(l:key_list), "v:val =~# '\\* ".a:key."'") - if len(l:raw_map) == 0 - exe "nnoremap <buffer> <expr> ".a:key." ".a:cmd - return - endif - let l:map_data = split(l:raw_map[0], '\s*') +" Mappings: {{{1 - exe "nnoremap <buffer> <expr> ".l:map_data[0]." ".a:cmd - else - exe "nnoremap <buffer> <expr> ".a:key." ".a:cmd - endif +function! tutor#SetNormalMappings() + nnoremap <silent> <buffer> <CR> :call tutor#FollowLink(0)<cr> + nnoremap <silent> <buffer> <2-LeftMouse> :call tutor#MouseDoubleClick()<cr> + nnoremap <buffer> >> :call tutor#InjectCommand()<cr> endfunction function! tutor#MouseDoubleClick() @@ -46,7 +30,7 @@ function! tutor#MouseDoubleClick() normal! zo else if match(getline('.'), '^#\{1,} ') > -1 - normal! zc + silent normal! zc else call tutor#FollowLink(0) endif @@ -59,114 +43,6 @@ function! tutor#InjectCommand() redraw | echohl WarningMsg | echon "tutor: ran" | echohl None | echon " " | echohl Statement | echon l:cmd endfunction -function! tutor#SetNormalMappings() - call s:MapKeyWithRedirect('l', 'tutor#ForwardSkipConceal(v:count1)') - call s:MapKeyWithRedirect('h', 'tutor#BackwardSkipConceal(v:count1)') - call s:MapKeyWithRedirect('<right>', 'tutor#ForwardSkipConceal(v:count1)') - call s:MapKeyWithRedirect('<left>', 'tutor#BackwardSkipConceal(v:count1)') - - nnoremap <silent> <buffer> <CR> :call tutor#FollowLink(0)<cr> - nnoremap <silent> <buffer> <2-LeftMouse> :call tutor#MouseDoubleClick()<cr> - nnoremap <buffer> >> :call tutor#InjectCommand()<cr> -endfunction - -function! tutor#SetSampleTextMappings() - noremap <silent> <buffer> A :if match(getline('.'), '^--->') > -1 \| call search('\s{\@=', 'Wc') \| startinsert \| else \| startinsert! \| endif<cr> - noremap <silent> <buffer> $ :if match(getline('.'), '^--->') > -1 \| call search('.\s{\@=', 'Wc') \| else \| call search('$', 'Wc') \| endif<cr> - onoremap <silent> <buffer> $ :if match(getline('.'), '^--->') > -1 \| call search('.\s{\@=', 'Wc') \| else \| call search('$', 'Wc') \| endif<cr> - noremap <silent> <buffer> ^ :if match(getline('.'), '^--->') > -1 \| call search('\(--->\s\)\@<=.', 'bcW') \| else \| call search('^', 'bcW') \|endif<cr> - onoremap <silent> <buffer> ^ :if match(getline('.'), '^--->') > -1 \| call search('\(--->\s\)\@<=.', 'bcW') \| else \| call search('^', 'bcW') \|endif<cr> - nmap <silent> <buffer> 0 ^<esc> - nmap <silent> <buffer> <Home> ^<esc> - nmap <silent> <buffer> <End> $ - imap <silent> <buffer> <Home> <esc>^<esc>:startinsert<cr> - imap <silent> <buffer> <End> <esc>$:startinsert<cr> - noremap <silent> <buffer> I :exe "normal! 0" \| startinsert<cr> -endfunction - -" Navigation: {{{1 - -" taken from http://stackoverflow.com/a/24224578 - -function! tutor#ForwardSkipConceal(count) - let cnt=a:count - let mvcnt=0 - let c=col('.') - let l=line('.') - let lc=col('$') - let line=getline('.') - while cnt - if c>=lc - let mvcnt+=cnt - break - endif - if stridx(&concealcursor, 'n')==-1 - let isconcealed=0 - else - let [isconcealed, cchar, group] = synconcealed(l, c) - endif - if isconcealed - let cnt-=strchars(cchar) - let oldc=c - let c+=1 - while c < lc - let [isconcealed2, cchar2, group2] = synconcealed(l, c) - if !isconcealed2 || cchar2 != cchar - break - endif - let c+= 1 - endwhile - let mvcnt+=strchars(line[oldc-1:c-2]) - else - let cnt-=1 - let mvcnt+=1 - let c+=len(matchstr(line[c-1:], '.')) - endif - endwhile - return mvcnt.'l' -endfunction - -function! tutor#BackwardSkipConceal(count) - let cnt=a:count - let mvcnt=0 - let c=col('.') - let l=line('.') - let lc=0 - let line=getline('.') - while cnt - if c<=1 - let mvcnt+=cnt - break - endif - if stridx(&concealcursor, 'n')==-1 || c == 0 - let isconcealed=0 - else - let [isconcealed, cchar, group]=synconcealed(l, c-1) - endif - if isconcealed - let cnt-=strchars(cchar) - let oldc=c - let c-=1 - while c>1 - let [isconcealed2, cchar2, group2] = synconcealed(l, c-1) - if !isconcealed2 || cchar2 != cchar - break - endif - let c-=1 - endwhile - let c = max([c, 1]) - let mvcnt+=strchars(line[c-1:oldc-2]) - else - let cnt-=1 - let mvcnt+=1 - let c-=len(matchstr(line[:c-2], '.$')) - endif - endwhile - return mvcnt.'h' -endfunction - -" Hypertext: {{{1 - function! tutor#FollowLink(force) let l:stack_s = join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), '') if l:stack_s =~# 'tutorLink' @@ -201,50 +77,39 @@ function! tutor#TutorFolds() endif endfunction -function! tutor#InfoText() - let l:info_parts = [] - if exists('b:tutor_infofunc') - call add(l:info_parts, eval(b:tutor_infofunc.'()')) - endif - return join(l:info_parts, " ") -endfunction +" Marks: {{{1 -" Marks {{{1 -function! tutor#PlaceXMarks() - call cursor(1, 1) - let b:tutor_sign_id = 1 - while search('^--->', 'W') > 0 - call tutor#CheckText(getline('.')) - let b:tutor_sign_id+=1 - endwhile - call cursor(1, 1) +function! tutor#ApplyMarks() + hi! link tutorExpect Special + if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect') + let b:tutor_sign_id = 1 + for expct in keys(b:tutor_metadata['expect']) + let lnum = eval(expct) + call matchaddpos('tutorExpect', [lnum]) + call tutor#CheckLine(lnum) + endfor + endif endfunction -function! tutor#CheckText(text) - if match(a:text, '{expect:ANYTHING}\s*$') == -1 - if match(getline('.'), '^--->\s*$') > -1 - exe "sign place ".b:tutor_sign_id." line=".line('.')." name=tutorbad buffer=".bufnr('%') - else - if match(getline('.'), '|expect:.\+|') == -1 - let l:cur_text = matchstr(a:text, '---> \zs.\{-}\ze {expect:') - let l:expected_text = matchstr(a:text, '{expect:\zs.*\ze}\s*$') - else - let l:cur_text = matchstr(a:text, '---> \zs.\{-}\ze |expect:') - let l:expected_text = matchstr(a:text, '|expect:\zs.*\ze|\s*$') - endif - if l:cur_text ==# l:expected_text - exe "sign place ".b:tutor_sign_id." line=".line('.')." name=tutorok buffer=".bufnr('%') - else - exe "sign place ".b:tutor_sign_id." line=".line('.')." name=tutorbad buffer=".bufnr('%') - endif +function! tutor#ApplyMarksOnChanged() + if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect') + let lnum = line('.') + if index(keys(b:tutor_metadata['expect']), string(lnum)) > -1 + call tutor#CheckLine(lnum) endif endif endfunction -function! tutor#OnTextChanged() - let l:text = getline('.') - if match(l:text, '^--->') > -1 - call tutor#CheckText(l:text) +function! tutor#CheckLine(line) + if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect') + let bufn = bufnr('%') + let ctext = getline(a:line) + if b:tutor_metadata['expect'][string(a:line)] == -1 || ctext ==# b:tutor_metadata['expect'][string(a:line)] + exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorok buffer=".bufn + else + exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorbad buffer=".bufn + endif + let b:tutor_sign_id+=1 endif endfunction diff --git a/runtime/autoload/vimexpect.vim b/runtime/autoload/vimexpect.vim index 16e7d30d6c..0ed888d2a4 100644 --- a/runtime/autoload/vimexpect.vim +++ b/runtime/autoload/vimexpect.vim @@ -140,7 +140,7 @@ endfunction " Job handler that simply forwards lines to the parser. -function! s:JobOutput(id, lines) +function! s:JobOutput(_id, lines, _event) dict call self._parser.feed(a:lines) endfunction diff --git a/runtime/autoload/xmlformat.vim b/runtime/autoload/xmlformat.vim new file mode 100644 index 0000000000..f227b5ee25 --- /dev/null +++ b/runtime/autoload/xmlformat.vim @@ -0,0 +1,111 @@ +" Vim plugin for formatting XML +" Last Change: Thu, 22 May 2018 21:26:55 +0100 +" Version: 0.1 +" Author: Christian Brabandt <cb@256bit.org> +" Repository: https://github.com/chrisbra/vim-xml-ftplugin +" License: VIM License +" Documentation: see :h xmlformat.txt (TODO!) +" --------------------------------------------------------------------- +" Load Once: {{{1 +if exists("g:loaded_xmlformat") || &cp + finish +endif +let g:loaded_xmlformat = 1 +let s:keepcpo = &cpo +set cpo&vim + +" Main function: Format the input {{{1 +func! xmlformat#Format() + " only allow reformatting through the gq command + " (e.g. Vim is in normal mode) + if mode() != 'n' + " do not fall back to internal formatting + return 0 + endif + let sw = shiftwidth() + let prev = prevnonblank(v:lnum-1) + let s:indent = indent(prev)/sw + let result = [] + let lastitem = prev ? getline(prev) : '' + let is_xml_decl = 0 + " split on `<`, but don't split on very first opening < + for item in split(join(getline(v:lnum, (v:lnum + v:count - 1))), '.\@<=[>]\zs') + if s:EndTag(item) + let s:indent = s:DecreaseIndent() + call add(result, s:Indent(item)) + elseif s:EmptyTag(lastitem) + call add(result, s:Indent(item)) + elseif s:StartTag(lastitem) && s:IsTag(item) + let s:indent += 1 + call add(result, s:Indent(item)) + else + if !s:IsTag(item) + " Simply split on '<' + let t=split(item, '.<\@=\zs') + let s:indent+=1 + call add(result, s:Indent(t[0])) + let s:indent = s:DecreaseIndent() + call add(result, s:Indent(t[1])) + else + call add(result, s:Indent(item)) + endif + endif + let lastitem = item + endfor + + if !empty(result) + exe v:lnum. ",". (v:lnum + v:count - 1). 'd' + call append(v:lnum - 1, result) + " Might need to remove the last line, if it became empty because of the + " append() call + let last = v:lnum + len(result) + if getline(last) is '' + exe last. 'd' + endif + endif + + " do not run internal formatter! + return 0 +endfunc +" Check if given tag is XML Declaration header {{{1 +func! s:IsXMLDecl(tag) + return a:tag =~? '^\s*<?xml\s\?\%(version="[^"]*"\)\?\s\?\%(encoding="[^"]*"\)\? ?>\s*$' +endfunc +" Return tag indented by current level {{{1 +func! s:Indent(item) + return repeat(' ', shiftwidth()*s:indent). s:Trim(a:item) +endfu +" Return item trimmed from leading whitespace {{{1 +func! s:Trim(item) + if exists('*trim') + return trim(a:item) + else + return matchstr(a:item, '\S\+.*') + endif +endfunc +" Check if tag is a new opening tag <tag> {{{1 +func! s:StartTag(tag) + return a:tag =~? '^\s*<[^/?]' +endfunc +" Remove one level of indentation {{{1 +func! s:DecreaseIndent() + return (s:indent > 0 ? s:indent - 1 : 0) +endfunc +" Check if tag is a closing tag </tag> {{{1 +func! s:EndTag(tag) + return a:tag =~? '^\s*</' +endfunc +" Check that the tag is actually a tag and not {{{1 +" something like "foobar</foobar>" +func! s:IsTag(tag) + return s:Trim(a:tag)[0] == '<' +endfunc +" Check if tag is empty <tag/> {{{1 +func! s:EmptyTag(tag) + return a:tag =~ '/>\s*$' +endfunc +" Restoration And Modelines: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo +" Modeline {{{1 +" vim: fdm=marker fdl=0 ts=2 et sw=0 sts=-1 diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index 687500ebe3..ea086e0882 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -1,7 +1,7 @@ " zip.vim: Handles browsing zipfiles " AUTOLOAD PORTION -" Date: Jul 02, 2013 -" Version: 27 +" Date: Sep 13, 2016 +" Version: 28 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " License: Vim License (see vim's :help license) " Copyright: Copyright (C) 2005-2013 Charles E. Campbell {{{1 @@ -20,10 +20,10 @@ if &cp || exists("g:loaded_zip") finish endif -let g:loaded_zip= "v27" +let g:loaded_zip= "v28" if v:version < 702 echohl WarningMsg - echo "***warning*** this version of zip needs vim 7.2" + echo "***warning*** this version of zip needs vim 7.2 or later" echohl Normal finish endif @@ -53,6 +53,9 @@ endif if !exists("g:zip_unzipcmd") let g:zip_unzipcmd= "unzip" endif +if !exists("g:zip_extractcmd") + let g:zip_extractcmd= g:zip_unzipcmd +endif " ---------------- " Functions: {{{1 @@ -62,14 +65,14 @@ endif " zip#Browse: {{{2 fun! zip#Browse(zipfile) " call Dfunc("zip#Browse(zipfile<".a:zipfile.">)") - " sanity check: insure that the zipfile has "PK" as its first two letters + " sanity check: ensure that the zipfile has "PK" as its first two letters " (zipped files have a leading PK as a "magic cookie") if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK' exe "noautocmd e ".fnameescape(a:zipfile) " call Dret("zip#Browse : not a zipfile<".a:zipfile.">") return " else " Decho -" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - its a zip file") +" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - it's a zip file") endif let repkeep= &report @@ -92,7 +95,7 @@ fun! zip#Browse(zipfile) endif if !filereadable(a:zipfile) if a:zipfile !~# '^\a\+://' - " if its an url, don't complain, let url-handlers such as vim do its thing + " if it's an url, don't complain, let url-handlers such as vim do its thing redraw! echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None " call inputsave()|call input("Press <cr> to continue")|call inputrestore() @@ -136,8 +139,10 @@ fun! zip#Browse(zipfile) return endif + " Maps associated with zip plugin setlocal noma nomod ro - noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr> + noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr> + noremap <silent> <buffer> x :call zip#Extract()<cr> let &report= repkeep " call Dret("zip#Browse") @@ -204,6 +209,15 @@ fun! zip#Read(fname,mode) endif " call Decho("zipfile<".zipfile.">") " call Decho("fname <".fname.">") + " sanity check + if !executable(substitute(g:zip_unzipcmd,'\s\+.*$','','')) + redraw! + echohl Error | echo "***error*** (zip#Read) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program" | echohl None +" call inputsave()|call input("Press <cr> to continue")|call inputrestore() + let &report= repkeep +" call Dret("zip#Write") + return + endif " the following code does much the same thing as " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1) @@ -236,9 +250,9 @@ fun! zip#Write(fname) set report=10 " sanity checks - if !executable(g:zip_zipcmd) + if !executable(substitute(g:zip_zipcmd,'\s\+.*$','','')) redraw! - echohl Error | echo "***error*** (zip#Write) sorry, your system doesn't appear to have the zip pgm" | echohl None + echohl Error | echo "***error*** (zip#Write) sorry, your system doesn't appear to have the ".g:zip_zipcmd." program" | echohl None " call inputsave()|call input("Press <cr> to continue")|call inputrestore() let &report= repkeep " call Dret("zip#Write") @@ -345,6 +359,48 @@ fun! zip#Write(fname) endfun " --------------------------------------------------------------------- +" zip#Extract: extract a file from a zip archive {{{2 +fun! zip#Extract() +" call Dfunc("zip#Extract()") + + let repkeep= &report + set report=10 + let fname= getline(".") +" call Decho("fname<".fname.">") + + " sanity check + if fname =~ '^"' + let &report= repkeep +" call Dret("zip#Extract") + return + endif + if fname =~ '/$' + redraw! + echohl Error | echo "***error*** (zip#Extract) Please specify a file, not a directory" | echohl None + let &report= repkeep +" call Dret("zip#Extract") + return + endif + + " extract the file mentioned under the cursor +" call Decho("system(".g:zip_extractcmd." ".shellescape(b:zipfile)." ".shellescape(shell).")") + call system(g:zip_extractcmd." ".shellescape(b:zipfile)." ".shellescape(shell)) +" call Decho("zipfile<".b:zipfile.">") + if v:shell_error != 0 + echohl Error | echo "***error*** ".g:zip_extractcmd." ".b:zipfile." ".fname.": failed!" | echohl NONE + elseif !filereadable(fname) + echohl Error | echo "***error*** attempted to extract ".fname." but it doesn't appear to be present!" + else + echo "***note*** successfully extracted ".fname + endif + + " restore option + let &report= repkeep + +" call Dret("zip#Extract") +endfun + +" --------------------------------------------------------------------- " s:Escape: {{{2 fun! s:Escape(fname,isfilt) " call Dfunc("QuoteFileDir(fname<".a:fname."> isfilt=".a:isfilt.")") |